diff --git a/package.json b/package.json index 990e40721..f4ed8bfb2 100644 --- a/package.json +++ b/package.json @@ -110,5 +110,8 @@ "**/*.((ts|js)?(x)|vue|md)": "bin/_lint --fix", "**/*.(yaml|json|css)": "prettier --write" }, - "license": "MIT" + "license": "MIT", + "publishConfig": { + "access": "public" + } } diff --git a/packages/@interactjs/actions/.npmignore b/packages/@interactjs/actions/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/actions/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/actions/LICENSE b/packages/@interactjs/actions/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/actions/drag/index.d.ts b/packages/@interactjs/actions/drag/index.d.ts new file mode 100644 index 000000000..35181713a --- /dev/null +++ b/packages/@interactjs/actions/drag/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/actions/drag/plugin'; diff --git a/packages/@interactjs/actions/drag/index.js b/packages/@interactjs/actions/drag/index.js new file mode 100644 index 000000000..9e0948c16 --- /dev/null +++ b/packages/@interactjs/actions/drag/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/index.js.map b/packages/@interactjs/actions/drag/index.js.map new file mode 100644 index 000000000..b27b6f3a3 --- /dev/null +++ b/packages/@interactjs/actions/drag/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/drag/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/drag/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,yBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/index.prod.js b/packages/@interactjs/actions/drag/index.prod.js new file mode 100644 index 000000000..b7f9ed169 --- /dev/null +++ b/packages/@interactjs/actions/drag/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/index.prod.js.map b/packages/@interactjs/actions/drag/index.prod.js.map new file mode 100644 index 000000000..294df83cc --- /dev/null +++ b/packages/@interactjs/actions/drag/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/drag/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/drag/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,sCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/index.ts b/packages/@interactjs/actions/drag/index.ts new file mode 100644 index 000000000..27b164443 --- /dev/null +++ b/packages/@interactjs/actions/drag/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/actions/drag/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/actions/drag/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/plugin.d.ts b/packages/@interactjs/actions/drag/plugin.d.ts new file mode 100644 index 000000000..ebdf1c39a --- /dev/null +++ b/packages/@interactjs/actions/drag/plugin.d.ts @@ -0,0 +1,31 @@ +import type { InteractEvent } from '@interactjs/core/InteractEvent'; +import type { PerActionDefaults } from '@interactjs/core/options'; +import type { Plugin } from '@interactjs/core/scope'; +import type { ActionMethod, ListenersArg } from '@interactjs/core/types'; +declare module '@interactjs/core/Interactable' { + interface Interactable { + draggable: DraggableMethod; + } +} +declare module '@interactjs/core/options' { + interface ActionDefaults { + drag: DraggableOptions; + } +} +declare module '@interactjs/core/types' { + interface ActionMap { + drag?: typeof drag; + } +} +export declare type DragEvent = InteractEvent<'drag'>; +export declare type DraggableMethod = ActionMethod; +export interface DraggableOptions extends PerActionDefaults { + startAxis?: 'x' | 'y' | 'xy'; + lockAxis?: 'x' | 'y' | 'xy' | 'start'; + oninertiastart?: ListenersArg; + onstart?: ListenersArg; + onmove?: ListenersArg; + onend?: ListenersArg; +} +declare const drag: Plugin; +export default drag; diff --git a/packages/@interactjs/actions/drag/plugin.js b/packages/@interactjs/actions/drag/plugin.js new file mode 100644 index 000000000..cbc2a5447 --- /dev/null +++ b/packages/@interactjs/actions/drag/plugin.js @@ -0,0 +1,157 @@ +import 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'; + }, + + filterEventType: type => type.search('drag') === 0 +}; +export default drag; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/plugin.js.map b/packages/@interactjs/actions/drag/plugin.js.map new file mode 100644 index 000000000..1ea5bf27c --- /dev/null +++ b/packages/@interactjs/actions/drag/plugin.js.map @@ -0,0 +1,64 @@ +{ + "version": 3, + "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", + "filterEventType", + "type", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drag: DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = InteractEvent<'drag'>\n\nexport type DraggableMethod = ActionMethod\n\nexport interface DraggableOptions extends PerActionDefaults {\n startAxis?: 'x' | 'y' | 'xy'\n lockAxis?: 'x' | 'y' | 'xy' | 'start'\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 } 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 (\n this: Interactable,\n options?: DraggableOptions | boolean,\n): 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 as DraggableOptions\n}\n\nconst drag: 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' ? dragOptions.startAxis : 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 DraggableOptions,\n\n getCursor () {\n return 'move'\n },\n\n filterEventType: (type: string) => type.search('drag') === 0,\n}\n\nexport default drag\n" + ], + "mappings": "AAKA,OAAOA,EAAP,MAAe,mBAAf;;AAiCA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IAAEC,OAAF;IAAWC,YAAX;IAAyBC;EAAzB,IAAsCH,KAA5C;EAEAE,YAAY,CAACE,SAAb,CAAuBC,SAAvB,GAAmCC,IAAI,CAACD,SAAxC;EAEAJ,OAAO,CAACM,GAAR,CAAYD,IAAZ,GAAmBA,IAAnB;EACAL,OAAO,CAACO,UAAR,CAAmBF,IAAnB,GAA0B,WAA1B;EAEAH,QAAQ,CAACF,OAAT,CAAiBK,IAAjB,GAAwBA,IAAI,CAACH,QAA7B;AACD;;AAED,SAASM,UAAT,CAAqB;EAAEC;AAAF,CAArB,EAAsC;EACpC,IAAIA,WAAW,CAACC,QAAZ,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S,EAAE,IADH;IAERD,QAAQ,EAAE;EAFF,CAlCS;;EAuCnBc,SAAS,GAAI;IACX,OAAO,MAAP;EACD,CAzCkB;;EA2CnBC,eAAe,EAAGC,IAAD,IAAkBA,IAAI,CAACC,MAAL,CAAY,MAAZ,MAAwB;AA3CxC,CAArB;AA8CA,eAAe3C,IAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/plugin.prod.js b/packages/@interactjs/actions/drag/plugin.prod.js new file mode 100644 index 000000000..82175fa44 --- /dev/null +++ b/packages/@interactjs/actions/drag/plugin.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/is.prod.js";function o({interaction:t}){if("drag"!==t.prepared.name)return;const o=t.prepared.axis;"x"===o?(t.coords.cur.page.y=t.coords.start.page.y,t.coords.cur.client.y=t.coords.start.client.y,t.coords.velocity.client.y=0,t.coords.velocity.page.y=0):"y"===o&&(t.coords.cur.page.x=t.coords.start.page.x,t.coords.cur.client.x=t.coords.start.client.x,t.coords.velocity.client.x=0,t.coords.velocity.page.x=0)}function e({iEvent:t,interaction:o}){if("drag"!==o.prepared.name)return;const e=o.prepared.axis;if("x"===e||"y"===e){const r="x"===e?"y":"x";t.page[r]=o.coords.start.page[r],t.client[r]=o.coords.start.client[r],t.delta[r]=0}}const r={id:"actions/drag",install(t){const{actions:o,Interactable:e,defaults:s}=t;e.prototype.draggable=r.draggable,o.map.drag=r,o.methodDict.drag="draggable",s.actions.drag=r.defaults},listeners:{"interactions:before-action-move":o,"interactions:action-resume":o,"interactions:action-move":e,"auto-start:check"(t){const{interaction:o,interactable:e,buttons:r}=t,s=e.options.drag;if(s&&s.enabled&&(!o.pointerIsDown||!/mouse|pointer/.test(o.pointerType)||0!=(r&e.options.drag.mouseButtons)))return t.action={name:"drag",axis:"start"===s.lockAxis?s.startAxis:s.lockAxis},!1}},draggable(o){return t.object(o)?(this.options.drag.enabled=!1!==o.enabled,this.setPerAction("drag",o),this.setOnEvents("drag",o),/^(xy|x|y|start)$/.test(o.lockAxis)&&(this.options.drag.lockAxis=o.lockAxis),/^(xy|x|y)$/.test(o.startAxis)&&(this.options.drag.startAxis=o.startAxis),this):t.bool(o)?(this.options.drag.enabled=o,this):this.options.drag},beforeMove:o,move:e,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor(){return"move"},filterEventType:t=>0===t.search("drag")};export default r; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drag/plugin.prod.js.map b/packages/@interactjs/actions/drag/plugin.prod.js.map new file mode 100644 index 000000000..9fe083c49 --- /dev/null +++ b/packages/@interactjs/actions/drag/plugin.prod.js.map @@ -0,0 +1,64 @@ +{ + "version": 3, + "names": [ + "is", + "beforeMove", + "interaction", + "prepared", + "name", + "axis", + "coords", + "cur", + "page", + "y", + "start", + "client", + "velocity", + "x", + "move", + "iEvent", + "opposite", + "delta", + "drag", + "id", + "install", + "scope", + "actions", + "Interactable", + "defaults", + "prototype", + "draggable", + "map", + "methodDict", + "listeners", + "arg", + "interactable", + "buttons", + "dragOptions", + "options", + "enabled", + "pointerIsDown", + "test", + "pointerType", + "mouseButtons", + "action", + "lockAxis", + "startAxis", + "object", + "this", + "setPerAction", + "setOnEvents", + "bool", + "getCursor", + "filterEventType", + "type", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drag: DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = InteractEvent<'drag'>\n\nexport type DraggableMethod = ActionMethod\n\nexport interface DraggableOptions extends PerActionDefaults {\n startAxis?: 'x' | 'y' | 'xy'\n lockAxis?: 'x' | 'y' | 'xy' | 'start'\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 } 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 (\n this: Interactable,\n options?: DraggableOptions | boolean,\n): 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 as DraggableOptions\n}\n\nconst drag: 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' ? dragOptions.startAxis : 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 DraggableOptions,\n\n getCursor () {\n return 'move'\n },\n\n filterEventType: (type: string) => type.search('drag') === 0,\n}\n\nexport default drag\n" + ], + "mappings": "OAKOA,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2BAA4Ba,EAC5B,mBAAqBgB,GACnB,MAAM5B,YAAEA,EAAF6B,aAAeA,EAAfC,QAA6BA,GAAYF,EACzCG,EAAcF,EAAaG,QAAQhB,KAEzC,GACIe,GAAeA,EAAYE,WAE5BjC,EAAYkC,gBACX,gBAAgBC,KAAKnC,EAAYoC,cACsB,IAAtDN,EAAUD,EAAaG,QAAQhB,KAAKqB,eAUzC,OALAT,EAAIU,OAAS,CACXpC,KAAM,OACNC,KAA+B,UAAzB4B,EAAYQ,SAAuBR,EAAYS,UAAYT,EAAYQ,WAGxE,IAGXf,UAzDAQ,GAEA,OAAIlC,EAAG2C,OAAOT,IACZU,KAAKV,QAAQhB,KAAKiB,SAA8B,IAApBD,EAAQC,QACpCS,KAAKC,aAAa,OAAQX,GAC1BU,KAAKE,YAAY,OAAQZ,GAErB,mBAAmBG,KAAKH,EAAQO,YAClCG,KAAKV,QAAQhB,KAAKuB,SAAWP,EAAQO,UAEnC,aAAaJ,KAAKH,EAAQQ,aAC5BE,KAAKV,QAAQhB,KAAKwB,UAAYR,EAAQQ,WAGjCE,MAGL5C,EAAG+C,KAAKb,IACVU,KAAKV,QAAQhB,KAAKiB,QAAUD,EAErBU,MAGFA,KAAKV,QAAQhB,MAmCpBjB,aACAa,OACAU,SAAU,CACRkB,UAAW,KACXD,SAAU,MAGZO,YACE,MAAO,QAGTC,gBAAkBC,GAAyC,IAAxBA,EAAKC,OAAO,wBAGlCjC" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/DropEvent.d.ts b/packages/@interactjs/actions/drop/DropEvent.d.ts new file mode 100644 index 000000000..efcdd8302 --- /dev/null +++ b/packages/@interactjs/actions/drop/DropEvent.d.ts @@ -0,0 +1,29 @@ +import { BaseEvent } from '@interactjs/core/BaseEvent'; +import type { InteractEvent } from '@interactjs/core/InteractEvent'; +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Element } from '@interactjs/core/types'; +import type { DropState } from './plugin'; +export declare class DropEvent extends BaseEvent<'drag'> { + target: Element; + dropzone: Interactable; + dragEvent: InteractEvent<'drag'>; + relatedTarget: Element; + draggable: Interactable; + propagationStopped: boolean; + immediatePropagationStopped: boolean; + /** + * Class of events fired on dropzones during drags with acceptable targets. + */ + constructor(dropState: DropState, dragEvent: InteractEvent<'drag'>, type: string); + /** + * 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(): void; + preventDefault(): void; + stopPropagation(): void; + stopImmediatePropagation(): void; +} diff --git a/packages/@interactjs/actions/drop/DropEvent.js b/packages/@interactjs/actions/drop/DropEvent.js new file mode 100644 index 000000000..c0a557afa --- /dev/null +++ b/packages/@interactjs/actions/drop/DropEvent.js @@ -0,0 +1,80 @@ +import { BaseEvent } from "../../core/BaseEvent.js"; +import * as arr from "../../utils/arr.js"; +export class DropEvent extends BaseEvent { + dropzone; + dragEvent; + relatedTarget; + draggable; + propagationStopped = false; + immediatePropagationStopped = false; + /** + * Class of events fired on dropzones during drags with acceptable targets. + */ + + constructor(dropState, dragEvent, type) { + 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; + } + +} +//# sourceMappingURL=DropEvent.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/DropEvent.js.map b/packages/@interactjs/actions/drop/DropEvent.js.map new file mode 100644 index 000000000..caa0d1cff --- /dev/null +++ b/packages/@interactjs/actions/drop/DropEvent.js.map @@ -0,0 +1,45 @@ +{ + "version": 3, + "names": [ + "BaseEvent", + "arr", + "DropEvent", + "dropzone", + "dragEvent", + "relatedTarget", + "draggable", + "propagationStopped", + "immediatePropagationStopped", + "constructor", + "dropState", + "type", + "_interaction", + "element", + "prev", + "cur", + "target", + "currentTarget", + "interactable", + "timeStamp", + "reject", + "rejected", + "events", + "enter", + "stopImmediatePropagation", + "activeDrops", + "index", + "findIndex", + "splice", + "deactivateEvent", + "fire", + "preventDefault", + "stopPropagation" + ], + "sources": [ + "DropEvent.ts" + ], + "sourcesContent": [ + "import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\n\nimport type { DropState } from './plugin'\n\nexport class DropEvent extends BaseEvent<'drag'> {\n declare target: Element\n dropzone: Interactable\n dragEvent: InteractEvent<'drag'>\n relatedTarget: Element\n draggable: Interactable\n propagationStopped = false\n immediatePropagationStopped = false\n\n /**\n * Class of events fired on dropzones during drags with acceptable targets.\n */\n constructor (dropState: DropState, dragEvent: InteractEvent<'drag'>, type: string) {\n super(dragEvent._interaction)\n\n const { element, dropzone } = type === 'dragleave' ? dropState.prev : 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 || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)\n ) {\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(\n activeDrops,\n ({ dropzone, element }) => dropzone === this.dropzone && element === this.target,\n )\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 } 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" + ], + "mappings": "AAAA,SAASA,SAAT,QAA0B,yBAA1B;AAIA,OAAO,KAAKC,GAAZ,MAAqB,oBAArB;AAIA,OAAO,MAAMC,SAAN,SAAwBF,SAAxB,CAA0C;EAE/CG,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,SAAS;EACTC,kBAAkB,GAAG,KAAH;EAClBC,2BAA2B,GAAG,KAAH;EAE3B;AACF;AACA;;EACEC,WAAW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AAF;QAAYU;MAAZ,CAAD,KAA2BV,QAAQ,KAAK,KAAKA,QAAlB,IAA8BU,OAAO,KAAK,KAAKG,MAF9D,CAAd;MAKAN,SAAS,CAACe,WAAV,CAAsBG,MAAtB,CAA6BF,KAA7B,EAAoC,CAApC;MAEA,MAAMG,eAAe,GAAG,IAAI3B,SAAJ,CAAcQ,SAAd,EAAyB,KAAKN,SAA9B,EAAyC,gBAAzC,CAAxB;MAEAyB,eAAe,CAAC1B,QAAhB,GAA2B,KAAKA,QAAhC;MACA0B,eAAe,CAACb,MAAhB,GAAyB,KAAKA,MAA9B;MAEA,KAAKb,QAAL,CAAc2B,IAAd,CAAmBD,eAAnB;IACD,CAfD,MAeO;MACL,KAAK1B,QAAL,CAAc2B,IAAd,CAAmB,IAAI5B,SAAJ,CAAcQ,SAAd,EAAyB,KAAKN,SAA9B,EAAyC,WAAzC,CAAnB;IACD;EACF;;EAED2B,cAAc,GAAI,CAAE;;EAEpBC,eAAe,GAAI;IACjB,KAAKzB,kBAAL,GAA0B,IAA1B;EACD;;EAEDiB,wBAAwB,GAAI;IAC1B,KAAKhB,2BAAL,GAAmC,KAAKD,kBAAL,GAA0B,IAA7D;EACD;;AAhF8C" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/DropEvent.prod.js b/packages/@interactjs/actions/drop/DropEvent.prod.js new file mode 100644 index 000000000..bc906c1de --- /dev/null +++ b/packages/@interactjs/actions/drop/DropEvent.prod.js @@ -0,0 +1,2 @@ +import{BaseEvent as t}from"../../core/BaseEvent.prod.js";import*as e from"../../utils/arr.prod.js";export class DropEvent extends t{dropzone;dragEvent;relatedTarget;draggable;propagationStopped=!1;immediatePropagationStopped=!1;constructor(t,e,r){super(e._interaction);const{element:o,dropzone:a}="dragleave"===r?t.prev:t.cur;this.type=r,this.target=o,this.currentTarget=o,this.dropzone=a,this.dragEvent=e,this.relatedTarget=e.target,this.draggable=e.interactable,this.timeStamp=e.timeStamp}reject(){const{dropState:t}=this._interaction;if("dropactivate"===this.type||this.dropzone&&t.cur.dropzone===this.dropzone&&t.cur.element===this.target)if(t.prev.dropzone=this.dropzone,t.prev.element=this.target,t.rejected=!0,t.events.enter=null,this.stopImmediatePropagation(),"dropactivate"===this.type){const r=t.activeDrops,o=e.findIndex(r,(({dropzone:t,element:e})=>t===this.dropzone&&e===this.target));t.activeDrops.splice(o,1);const a=new DropEvent(t,this.dragEvent,"dropdeactivate");a.dropzone=this.dropzone,a.target=this.target,this.dropzone.fire(a)}else this.dropzone.fire(new DropEvent(t,this.dragEvent,"dragleave"))}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}} +//# sourceMappingURL=DropEvent.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/DropEvent.prod.js.map b/packages/@interactjs/actions/drop/DropEvent.prod.js.map new file mode 100644 index 000000000..d599fd442 --- /dev/null +++ b/packages/@interactjs/actions/drop/DropEvent.prod.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "names": [ + "BaseEvent", + "arr", + "DropEvent", + "dropzone", + "dragEvent", + "relatedTarget", + "draggable", + "propagationStopped", + "immediatePropagationStopped", + "constructor", + "dropState", + "type", + "super", + "_interaction", + "element", + "prev", + "cur", + "this", + "target", + "currentTarget", + "interactable", + "timeStamp", + "reject", + "rejected", + "events", + "enter", + "stopImmediatePropagation", + "activeDrops", + "index", + "findIndex", + "splice", + "deactivateEvent", + "fire", + "preventDefault", + "stopPropagation" + ], + "sources": [ + "DropEvent.ts" + ], + "sourcesContent": [ + "import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\n\nimport type { DropState } from './plugin'\n\nexport class DropEvent extends BaseEvent<'drag'> {\n declare target: Element\n dropzone: Interactable\n dragEvent: InteractEvent<'drag'>\n relatedTarget: Element\n draggable: Interactable\n propagationStopped = false\n immediatePropagationStopped = false\n\n /**\n * Class of events fired on dropzones during drags with acceptable targets.\n */\n constructor (dropState: DropState, dragEvent: InteractEvent<'drag'>, type: string) {\n super(dragEvent._interaction)\n\n const { element, dropzone } = type === 'dragleave' ? dropState.prev : 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 || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)\n ) {\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(\n activeDrops,\n ({ dropzone, element }) => dropzone === this.dropzone && element === this.target,\n )\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 } 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" + ], + "mappings": "oBAASA,MAAiB,yCAIdC,MAAS,iCAId,MAAMC,kBAAkBF,EAE7BG,SACAC,UACAC,cACAC,UACAC,oBAAqB,EACrBC,6BAA8B,EAK9BC,YAAaC,EAAsBN,EAAkCO,GACnEC,MAAMR,EAAUS,cAEhB,MAAMC,QAAEA,EAAFX,SAAWA,GAAsB,cAATQ,EAAuBD,EAAUK,KAAOL,EAAUM,IAEhFC,KAAKN,KAAOA,EACZM,KAAKC,OAASJ,EACdG,KAAKE,cAAgBL,EACrBG,KAAKd,SAAWA,EAChBc,KAAKb,UAAYA,EACjBa,KAAKZ,cAAgBD,EAAUc,OAC/BD,KAAKX,UAAYF,EAAUgB,aAC3BH,KAAKI,UAAYjB,EAAUiB,UAU7BC,SACE,MAAMZ,UAAEA,GAAcO,KAAKJ,aAE3B,GACgB,iBAAdI,KAAKN,MACHM,KAAKd,UAAYO,EAAUM,IAAIb,WAAac,KAAKd,UAAYO,EAAUM,IAAIF,UAAYG,KAAKC,OAahG,GARAR,EAAUK,KAAKZ,SAAWc,KAAKd,SAC/BO,EAAUK,KAAKD,QAAUG,KAAKC,OAE9BR,EAAUa,UAAW,EACrBb,EAAUc,OAAOC,MAAQ,KAEzBR,KAAKS,2BAEa,iBAAdT,KAAKN,KAAyB,CAChC,MAAMgB,EAAcjB,EAAUiB,YACxBC,EAAQ3B,EAAI4B,UAChBF,GACA,EAAGxB,WAAUW,aAAcX,IAAac,KAAKd,UAAYW,IAAYG,KAAKC,SAG5ER,EAAUiB,YAAYG,OAAOF,EAAO,GAEpC,MAAMG,EAAkB,IAAI7B,UAAUQ,EAAWO,KAAKb,UAAW,kBAEjE2B,EAAgB5B,SAAWc,KAAKd,SAChC4B,EAAgBb,OAASD,KAAKC,OAE9BD,KAAKd,SAAS6B,KAAKD,QAEnBd,KAAKd,SAAS6B,KAAK,IAAI9B,UAAUQ,EAAWO,KAAKb,UAAW,cAIhE6B,kBAEAC,kBACEjB,KAAKV,oBAAqB,EAG5BmB,2BACET,KAAKT,4BAA8BS,KAAKV,oBAAqB" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/index.d.ts b/packages/@interactjs/actions/drop/index.d.ts new file mode 100644 index 000000000..d47f3c848 --- /dev/null +++ b/packages/@interactjs/actions/drop/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/actions/drop/plugin'; diff --git a/packages/@interactjs/actions/drop/index.js b/packages/@interactjs/actions/drop/index.js new file mode 100644 index 000000000..9e0948c16 --- /dev/null +++ b/packages/@interactjs/actions/drop/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/index.js.map b/packages/@interactjs/actions/drop/index.js.map new file mode 100644 index 000000000..85eced70b --- /dev/null +++ b/packages/@interactjs/actions/drop/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/drop/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/drop/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,yBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/index.prod.js b/packages/@interactjs/actions/drop/index.prod.js new file mode 100644 index 000000000..b7f9ed169 --- /dev/null +++ b/packages/@interactjs/actions/drop/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/index.prod.js.map b/packages/@interactjs/actions/drop/index.prod.js.map new file mode 100644 index 000000000..8579af8d0 --- /dev/null +++ b/packages/@interactjs/actions/drop/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/drop/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/drop/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,sCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/index.ts b/packages/@interactjs/actions/drop/index.ts new file mode 100644 index 000000000..3073cf7f3 --- /dev/null +++ b/packages/@interactjs/actions/drop/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/actions/drop/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/actions/drop/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/plugin.d.ts b/packages/@interactjs/actions/drop/plugin.d.ts new file mode 100644 index 000000000..e02d560d5 --- /dev/null +++ b/packages/@interactjs/actions/drop/plugin.d.ts @@ -0,0 +1,103 @@ +import type { InteractEvent } from '@interactjs/core/InteractEvent'; +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Interaction } from '@interactjs/core/Interaction'; +import type { PerActionDefaults } from '@interactjs/core/options'; +import type { Plugin } from '@interactjs/core/scope'; +import type { Element, PointerEventType, Rect, ListenersArg } from '@interactjs/core/types'; +import '../drag/plugin'; +import type { DragEvent } from '../drag/plugin'; +import { DropEvent } from './DropEvent'; +export declare type DropFunctionChecker = (dragEvent: any, // related drag operation +event: any, // touch or mouse EventEmitter +dropped: boolean, // default checker result +dropzone: Interactable, // dropzone interactable +dropElement: Element, // drop zone element +draggable: Interactable, // draggable's Interactable +draggableElement: Element) => boolean; +export interface DropzoneOptions extends PerActionDefaults { + accept?: string | Element | (({ dropzone, draggableElement }: { + dropzone: Interactable; + draggableElement: Element; + }) => boolean); + overlap?: 'pointer' | 'center' | number; + checker?: DropFunctionChecker; + ondropactivate?: ListenersArg; + ondropdeactivate?: ListenersArg; + ondragenter?: ListenersArg; + ondragleave?: ListenersArg; + ondropmove?: ListenersArg; + ondrop?: ListenersArg; +} +export interface DropzoneMethod { + (this: Interactable, options: DropzoneOptions | boolean): Interactable; + (): DropzoneOptions; +} +declare module '@interactjs/core/Interactable' { + interface Interactable { + dropzone: DropzoneMethod; + dropCheck: (dragEvent: InteractEvent, event: PointerEventType, draggable: Interactable, draggableElement: Element, dropElemen: Element, rect: any) => boolean; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + dropState?: DropState; + } +} +declare module '@interactjs/core/InteractEvent' { + interface InteractEvent { + prevDropzone?: Interactable; + dropzone?: Interactable; + dragEnter?: Element; + dragLeave?: Element; + } +} +declare module '@interactjs/core/options' { + interface ActionDefaults { + drop: DropzoneOptions; + } +} +declare module '@interactjs/core/scope' { + interface Scope { + dynamicDrop?: boolean; + } + interface SignalArgs { + 'actions/drop:start': DropSignalArg; + 'actions/drop:move': DropSignalArg; + 'actions/drop:end': DropSignalArg; + } +} +declare module '@interactjs/core/types' { + interface ActionMap { + drop?: typeof drop; + } +} +declare module '@interactjs/core/InteractStatic' { + interface InteractStatic { + dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this; + } +} +interface DropSignalArg { + interaction: Interaction<'drag'>; + dragEvent: DragEvent; +} +export interface ActiveDrop { + dropzone: Interactable; + element: Element; + rect: Rect; +} +export interface DropState { + cur: { + dropzone: Interactable; + element: Element; + }; + prev: { + dropzone: Interactable; + element: Element; + }; + rejected: boolean; + events: FiredDropEvents; + activeDrops: ActiveDrop[]; +} +declare type FiredDropEvents = Partial>; +declare const drop: Plugin; +export default drop; diff --git a/packages/@interactjs/actions/drop/plugin.js b/packages/@interactjs/actions/drop/plugin.js new file mode 100644 index 000000000..2dd5ef70d --- /dev/null +++ b/packages/@interactjs/actions/drop/plugin.js @@ -0,0 +1,545 @@ +import * as domUtils from "../../utils/domUtils.js"; +import extend from "../../utils/extend.js"; +import getOriginXY from "../../utils/getOriginXY.js"; +import is from "../../utils/is.js"; +import normalizeListeners from "../../utils/normalizeListeners.js"; +import * as pointerUtils from "../../utils/pointerUtils.js"; +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ + +import '../drag/plugin'; +import drag from '../drag/plugin'; +/* eslint-enable import/no-duplicates */ + +import { DropEvent } from './DropEvent'; + +function install(scope) { + const { + actions, + + /** @lends module:interact */ + interactStatic: interact, + + /** @lends Interactable */ + Interactable, + 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 {object | 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 (is.bool(newValue)) { + // if (dragging && scope.dynamicDrop !== newValue && !newValue) { + // calcRects(dropzones) + // } + scope.dynamicDrop = newValue; + return interact; + } + + return scope.dynamicDrop; + }; + + 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 collectDropzones({ + 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 (is.element(accept) && accept !== draggableElement || is.string(accept) && !domUtils.matchesSelector(draggableElement, accept) || is.func(accept) && !accept({ + dropzone, + draggableElement + })) { + continue; + } + + for (const dropzoneElement of dropzone.getAllElements()) { + if (dropzoneElement !== draggableElement) { + drops.push({ + dropzone, + element: dropzoneElement, + rect: dropzone.getRect(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, dragElement) { + // get dropzones and their elements that could receive the draggable + const activeDrops = collectDropzones(scope, dragElement); + + for (const activeDrop of activeDrops) { + activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element); + } + + return activeDrops; +} + +function getDrop({ + dropState, + interactable: draggable, + element: dragElement +}, dragEvent, pointerEvent) { + const validDrops = []; // collect all dropzones and their elements which qualify for a drop + + for (const { + dropzone, + element: dropzoneElement, + rect + } of dropState.activeDrops) { + const isValid = dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect); + validDrops.push(isValid ? dropzoneElement : null); + } // get the most appropriate dropzone based on DOM depth and order + + + const dropIndex = domUtils.indexOfDeepestElement(validDrops); + return dropState.activeDrops[dropIndex] || null; +} + +function getDropEvents(interaction, _pointerEvent, dragEvent) { + const dropState = interaction.dropState; + 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'); + dragEvent.dropzone = dropState.cur.dropzone; + } + + return dropEvents; +} + +function fireDropEvents(interaction, events) { + const dropState = interaction.dropState; + const { + activeDrops, + cur, + prev + } = dropState; + + if (events.leave) { + prev.dropzone.fire(events.leave); + } + + if (events.enter) { + cur.dropzone.fire(events.enter); + } + + if (events.move) { + cur.dropzone.fire(events.move); + } + + 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 +}, scope) { + if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') { + return; + } + + const dropState = interaction.dropState; + + 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, options) { + if (is.object(options)) { + interactable.options.drop.enabled = options.enabled !== false; + + if (options.listeners) { + const normalized = 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; + }, {}); + const prevListeners = interactable.options.drop.listeners; + prevListeners && interactable.off(prevListeners); + interactable.on(corrected); + interactable.options.drop.listeners = corrected; + } + + if (is.func(options.ondrop)) { + interactable.on('drop', options.ondrop); + } + + if (is.func(options.ondropactivate)) { + interactable.on('dropactivate', options.ondropactivate); + } + + if (is.func(options.ondropdeactivate)) { + interactable.on('dropdeactivate', options.ondropdeactivate); + } + + if (is.func(options.ondragenter)) { + interactable.on('dragenter', options.ondragenter); + } + + if (is.func(options.ondragleave)) { + interactable.on('dragleave', options.ondragleave); + } + + if (is.func(options.ondropmove)) { + interactable.on('dropmove', options.ondropmove); + } + + if (/^(pointer|center)$/.test(options.overlap)) { + interactable.options.drop.overlap = options.overlap; + } else if (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 (is.bool(options)) { + interactable.options.drop.enabled = options; + return interactable; + } + + return interactable.options.drop; +} + +function dropCheckMethod(interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) { + 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 = getOriginXY(draggable, draggableElement, 'drag'); + const page = pointerUtils.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 && 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 = { + 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 + }, scope) => { + if (interaction.prepared.name !== 'drag') { + return; + } + + const dropState = interaction.dropState; // reset active dropzones + + dropState.activeDrops = []; + dropState.events = {}; + 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 + }); + } + }, + 'interactions:action-move': onEventCreated, + 'interactions:after-action-move': ({ + interaction, + iEvent: dragEvent + }, scope) => { + if (interaction.prepared.name !== 'drag') { + return; + } + + const dropState = interaction.dropState; + fireDropEvents(interaction, dropState.events); + scope.fire('actions/drop:move', { + interaction, + dragEvent + }); + dropState.events = {}; + }, + 'interactions:action-end': (arg, scope) => { + if (arg.interaction.prepared.name !== 'drag') { + return; + } + + const { + interaction, + iEvent: dragEvent + } = arg; + onEventCreated(arg, scope); + 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, + filterEventType: type => type.search('drag') === 0 || type.search('drop') === 0, + defaults: { + enabled: false, + accept: null, + overlap: 'pointer' + } +}; +export default drop; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/plugin.js.map b/packages/@interactjs/actions/drop/plugin.js.map new file mode 100644 index 000000000..9cce181db --- /dev/null +++ b/packages/@interactjs/actions/drop/plugin.js.map @@ -0,0 +1,156 @@ +{ + "version": 3, + "names": [ + "domUtils", + "extend", + "getOriginXY", + "is", + "normalizeListeners", + "pointerUtils", + "drag", + "DropEvent", + "install", + "scope", + "actions", + "interactStatic", + "interact", + "Interactable", + "defaults", + "usePlugin", + "prototype", + "dropzone", + "options", + "dropzoneMethod", + "dropCheck", + "dragEvent", + "event", + "draggable", + "draggableElement", + "dropElement", + "rect", + "dropCheckMethod", + "dynamicDrop", + "newValue", + "bool", + "phaselessTypes", + "dragenter", + "dragleave", + "dropactivate", + "dropdeactivate", + "dropmove", + "drop", + "methodDict", + "collectDropzones", + "interactables", + "drops", + "list", + "enabled", + "accept", + "element", + "string", + "matchesSelector", + "func", + "dropzoneElement", + "getAllElements", + "push", + "getRect", + "fireActivationEvents", + "activeDrops", + "slice", + "target", + "fire", + "propagationStopped", + "immediatePropagationStopped", + "getActiveDrops", + "dragElement", + "activeDrop", + "getDrop", + "dropState", + "interactable", + "pointerEvent", + "validDrops", + "isValid", + "dropIndex", + "indexOfDeepestElement", + "getDropEvents", + "interaction", + "_pointerEvent", + "dropEvents", + "enter", + "leave", + "activate", + "deactivate", + "move", + "type", + "rejected", + "cur", + "prev", + "dragLeave", + "prevDropzone", + "dragEnter", + "relatedTarget", + "fireDropEvents", + "events", + "onEventCreated", + "iEvent", + "dropResult", + "object", + "listeners", + "normalized", + "corrected", + "Object", + "keys", + "reduce", + "acc", + "correctedType", + "test", + "prevListeners", + "off", + "on", + "ondrop", + "ondropactivate", + "ondropdeactivate", + "ondragenter", + "ondragleave", + "ondropmove", + "overlap", + "number", + "Math", + "max", + "min", + "checker", + "dropped", + "dropOverlap", + "origin", + "page", + "getPageXY", + "x", + "y", + "horizontal", + "left", + "right", + "vertical", + "top", + "bottom", + "dragRect", + "cx", + "width", + "cy", + "height", + "overlapArea", + "overlapRatio", + "id", + "prepared", + "name", + "arg", + "filterEventType", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, PointerEventType, Rect, ListenersArg } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '../drag/plugin'\n\nimport type { DragEvent } from '../drag/plugin'\nimport drag from '../drag/plugin'\n/* eslint-enable import/no-duplicates */\n\nimport { DropEvent } from './DropEvent'\n\nexport type DropFunctionChecker = (\n dragEvent: any, // related drag operation\n event: any, // touch or mouse EventEmitter\n dropped: boolean, // default checker result\n dropzone: Interactable, // dropzone interactable\n dropElement: Element, // drop zone element\n draggable: Interactable, // draggable's Interactable\n draggableElement: Element, // dragged element\n) => boolean\n\nexport interface DropzoneOptions extends PerActionDefaults {\n accept?:\n | string\n | Element\n | (({ dropzone, draggableElement }: { dropzone: Interactable, draggableElement: Element }) => boolean)\n // How the overlap is checked on the drop zone\n overlap?: 'pointer' | 'center' | number\n checker?: DropFunctionChecker\n\n ondropactivate?: ListenersArg\n ondropdeactivate?: ListenersArg\n ondragenter?: ListenersArg\n ondragleave?: ListenersArg\n ondropmove?: ListenersArg\n ondrop?: ListenersArg\n}\n\nexport interface DropzoneMethod {\n (this: Interactable, options: DropzoneOptions | boolean): Interactable\n (): DropzoneOptions\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n dropzone: DropzoneMethod\n dropCheck: (\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElemen: 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/InteractEvent' {\n interface InteractEvent {\n prevDropzone?: Interactable\n dropzone?: Interactable\n dragEnter?: Element\n dragLeave?: Element\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drop: DropzoneOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\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\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drop?: typeof drop\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n interface InteractStatic {\n dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this\n }\n}\n\ninterface DropSignalArg {\n interaction: Interaction<'drag'>\n dragEvent: DragEvent\n}\n\nexport interface ActiveDrop {\n dropzone: Interactable\n element: Element\n rect: Rect\n}\n\nexport interface DropState {\n cur: {\n // the dropzone a drag target might be dropped into\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n prev: {\n // the dropzone that was recently dragged away from\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n // wheather the potential drop was rejected from a listener\n rejected: boolean\n // the drop events related to the current drag event\n events: FiredDropEvents\n activeDrops: ActiveDrop[]\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n /** @lends module:interact */\n interactStatic: interact,\n /** @lends Interactable */\n Interactable,\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 {object | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.dropzone = function (this: Interactable, options) {\n return dropzoneMethod(this, options)\n } as Interactable['dropzone']\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 (\n this: Interactable,\n dragEvent,\n event,\n draggable,\n draggableElement,\n dropElement,\n rect,\n ) {\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 (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 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 collectDropzones ({ interactables }: Scope, draggableElement: Element) {\n const drops: ActiveDrop[] = []\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) {\n continue\n }\n\n const accept = dropzone.options.drop.accept\n\n // test the draggable draggableElement against the dropzone's accept setting\n if (\n (is.element(accept) && accept !== draggableElement) ||\n (is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||\n (is.func(accept) && !accept({ dropzone, draggableElement }))\n ) {\n continue\n }\n\n for (const dropzoneElement of dropzone.getAllElements()) {\n if (dropzoneElement !== draggableElement) {\n drops.push({\n dropzone,\n element: dropzoneElement,\n rect: dropzone.getRect(dropzoneElement),\n })\n }\n }\n }\n\n return drops\n}\n\nfunction fireActivationEvents (activeDrops: ActiveDrop[], event: DropEvent) {\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: Element) {\n // get dropzones and their elements that could receive the draggable\n const activeDrops = collectDropzones(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 (\n { dropState, interactable: draggable, element: dragElement }: Interaction,\n dragEvent,\n pointerEvent,\n) {\n const validDrops: Element[] = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {\n const isValid = dropzone.dropCheck(\n dragEvent,\n pointerEvent,\n draggable!,\n dragElement!,\n dropzoneElement,\n rect,\n )\n validDrops.push(isValid ? dropzoneElement : null)\n }\n\n // get the most appropriate dropzone based on DOM depth and order\n const dropIndex = domUtils.indexOfDeepestElement(validDrops)\n\n return dropState!.activeDrops[dropIndex] || null\n}\n\nfunction getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {\n const dropState = interaction.dropState!\n const dropEvents: Record = {\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 as never\n dropEvents.activate.dropzone = null as never\n }\n if (dragEvent.type === 'dragend') {\n dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')\n\n dropEvents.deactivate.target = null as never\n dropEvents.deactivate.dropzone = null as never\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 dragEvent.dropzone = dropState.cur.dropzone\n }\n\n return dropEvents\n}\n\ntype FiredDropEvents = Partial<\nRecord<'leave' | 'enter' | 'move' | 'drop' | 'activate' | 'deactivate', DropEvent>\n>\n\nfunction fireDropEvents (interaction: Interaction, events: FiredDropEvents) {\n const dropState = interaction.dropState!\n const { activeDrops, cur, prev } = dropState\n\n if (events.leave) {\n prev.dropzone.fire(events.leave)\n }\n if (events.enter) {\n cur.dropzone.fire(events.enter)\n }\n if (events.move) {\n cur.dropzone.fire(events.move)\n }\n if (events.drop) {\n cur.dropzone.fire(events.drop)\n }\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 }: DoPhaseArg<'drag', EventPhase>, scope: Scope) {\n if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') {\n return\n }\n\n const dropState = interaction.dropState!\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 =\n 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: Interactable): DropzoneOptions\nfunction dropzoneMethod(interactable: Interactable, options: DropzoneOptions | boolean): Interactable\nfunction dropzoneMethod (interactable: Interactable, options?: DropzoneOptions | boolean) {\n if (is.object(options)) {\n interactable.options.drop.enabled = options.enabled !== false\n\n if (options.listeners) {\n const normalized = 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 const prevListeners = interactable.options.drop.listeners\n prevListeners && interactable.off(prevListeners)\n\n interactable.on(corrected)\n interactable.options.drop.listeners = corrected\n }\n\n if (is.func(options.ondrop)) {\n interactable.on('drop', options.ondrop)\n }\n if (is.func(options.ondropactivate)) {\n interactable.on('dropactivate', options.ondropactivate)\n }\n if (is.func(options.ondropdeactivate)) {\n interactable.on('dropdeactivate', options.ondropdeactivate)\n }\n if (is.func(options.ondragenter)) {\n interactable.on('dragenter', options.ondragenter)\n }\n if (is.func(options.ondragleave)) {\n interactable.on('dragleave', options.ondragleave)\n }\n if (is.func(options.ondropmove)) {\n interactable.on('dropmove', options.ondropmove)\n }\n\n if (/^(pointer|center)$/.test(options.overlap as string)) {\n interactable.options.drop.overlap = options.overlap\n } else if (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 (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: Interactable,\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElement: 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n : false\n }\n\n const dropOverlap = interactable.options.drop.overlap\n\n if (dropOverlap === 'pointer') {\n const origin = getOriginXY(draggable, draggableElement, 'drag')\n const page = pointerUtils.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 && is.number(dropOverlap)) {\n const overlapArea =\n 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n }\n\n return dropped\n}\n\nconst drop: Plugin = {\n id: 'actions/drop',\n install,\n listeners: {\n 'interactions:before-action-start': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\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': (\n { interaction, event, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n\n // reset active dropzones\n dropState.activeDrops = []\n dropState.events = {}\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 'interactions:action-move': onEventCreated,\n\n 'interactions:after-action-move': (\n { interaction, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n fireDropEvents(interaction, dropState.events)\n\n scope.fire('actions/drop:move', { interaction, dragEvent })\n dropState.events = {}\n },\n\n 'interactions:action-end': (arg: DoPhaseArg<'drag', EventPhase>, scope) => {\n if (arg.interaction.prepared.name !== 'drag') {\n return\n }\n\n const { interaction, iEvent: dragEvent } = arg\n\n onEventCreated(arg, scope)\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') {\n return\n }\n\n const { dropState } = interaction\n\n if (dropState) {\n dropState.activeDrops = null as never\n dropState.events = null as never\n dropState.cur.dropzone = null as never\n dropState.cur.element = null as never\n dropState.prev.dropzone = null as never\n dropState.prev.element = null as never\n dropState.rejected = false\n }\n },\n },\n getActiveDrops,\n getDrop,\n getDropEvents,\n fireDropEvents,\n\n filterEventType: (type: string) => type.search('drag') === 0 || type.search('drop') === 0,\n\n defaults: {\n enabled: false,\n accept: null as never,\n overlap: 'pointer',\n } as DropzoneOptions,\n}\n\nexport default drop\n" + ], + "mappings": "AAMA,OAAO,KAAKA,QAAZ,MAA0B,yBAA1B;AACA,OAA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cAAc,CAAChB,WAAD,EAAcA,WAAW,CAACR,SAAZ,CAAuByB,MAArC,CAAd;MACAhF,KAAK,CAACgD,IAAN,CAAW,kBAAX,EAA+B;QAAEe,WAAF;QAAenD;MAAf,CAA/B;IACD,CAtEQ;IAwET,qBAAqB,CAAC;MAAEmD;IAAF,CAAD,KAAqB;MACxC,IAAIA,WAAW,CAACmE,QAAZ,CAAqBC,IAArB,KAA8B,MAAlC,EAA0C;QACxC;MACD;;MAED,MAAM;QAAE5E;MAAF,IAAgBQ,WAAtB;;MAEA,IAAIR,SAAJ,EAAe;QACbA,SAAS,CAACV,WAAV,GAAwB,IAAxB;QACAU,SAAS,CAACyB,MAAV,GAAmB,IAAnB;QACAzB,SAAS,CAACkB,GAAV,CAAcjE,QAAd,GAAyB,IAAzB;QACA+C,SAAS,CAACkB,GAAV,CAAcrC,OAAd,GAAwB,IAAxB;QACAmB,SAAS,CAACmB,IAAV,CAAelE,QAAf,GAA0B,IAA1B;QACA+C,SAAS,CAACmB,IAAV,CAAetC,OAAf,GAAyB,IAAzB;QACAmB,SAAS,CAACiB,QAAV,GAAqB,KAArB;MACD;IACF;EAxFQ,CAHQ;EA6FnBrB,cA7FmB;EA8FnBG,OA9FmB;EA+FnBQ,aA/FmB;EAgGnBiB,cAhGmB;EAkGnBsD,eAAe,EAAG9D,IAAD,IAAkBA,IAAI,CAAC+D,MAAL,CAAY,MAAZ,MAAwB,CAAxB,IAA6B/D,IAAI,CAAC+D,MAAL,CAAY,MAAZ,MAAwB,CAlGrE;EAoGnBjI,QAAQ,EAAE;IACR6B,OAAO,EAAE,KADD;IAERC,MAAM,EAAE,IAFA;IAGRoE,OAAO,EAAE;EAHD;AApGS,CAArB;AA2GA,eAAe3E,IAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/plugin.prod.js b/packages/@interactjs/actions/drop/plugin.prod.js new file mode 100644 index 000000000..73cc0701a --- /dev/null +++ b/packages/@interactjs/actions/drop/plugin.prod.js @@ -0,0 +1,2 @@ +import*as e from"../../utils/domUtils.prod.js";import t from"../../utils/extend.prod.js";import o from"../../utils/getOriginXY.prod.js";import r from"../../utils/is.prod.js";import n from"../../utils/normalizeListeners.prod.js";import*as a from"../../utils/pointerUtils.prod.js";import"../drag/plugin";import p from"../drag/plugin";import{DropEvent as i}from"./DropEvent";function d(e,t){for(const{dropzone:o,element:r}of e.slice())t.dropzone=o,t.target=r,o.fire(t),t.propagationStopped=t.immediatePropagationStopped=!1}function c(t,o){const n=(({interactables:t},o)=>{const n=[];for(const a of t.list){if(!a.options.drop.enabled)continue;const t=a.options.drop.accept;if(!(r.element(t)&&t!==o||r.string(t)&&!e.matchesSelector(o,t)||r.func(t)&&!t({dropzone:a,draggableElement:o})))for(const e of a.getAllElements())e!==o&&n.push({dropzone:a,element:e,rect:a.getRect(e)})}return n})(t,o);for(const e of n)e.rect=e.dropzone.getRect(e.element);return n}function l({dropState:t,interactable:o,element:r},n,a){const p=[];for(const{dropzone:e,element:i,rect:d}of t.activeDrops){const t=e.dropCheck(n,a,o,r,i,d);p.push(t?i:null)}const i=e.indexOfDeepestElement(p);return t.activeDrops[i]||null}function s(e,t,o){const r=e.dropState,n={enter:null,leave:null,activate:null,deactivate:null,move:null,drop:null};return"dragstart"===o.type&&(n.activate=new i(r,o,"dropactivate"),n.activate.target=null,n.activate.dropzone=null),"dragend"===o.type&&(n.deactivate=new i(r,o,"dropdeactivate"),n.deactivate.target=null,n.deactivate.dropzone=null),r.rejected||(r.cur.element!==r.prev.element&&(r.prev.dropzone&&(n.leave=new i(r,o,"dragleave"),o.dragLeave=n.leave.target=r.prev.element,o.prevDropzone=n.leave.dropzone=r.prev.dropzone),r.cur.dropzone&&(n.enter=new i(r,o,"dragenter"),o.dragEnter=r.cur.element,o.dropzone=r.cur.dropzone)),"dragend"===o.type&&r.cur.dropzone&&(n.drop=new i(r,o,"drop"),o.dropzone=r.cur.dropzone,o.relatedTarget=r.cur.element),"dragmove"===o.type&&r.cur.dropzone&&(n.move=new i(r,o,"dropmove"),o.dropzone=r.cur.dropzone)),n}function v(e,t){const o=e.dropState,{activeDrops:r,cur:n,prev:a}=o;t.leave&&a.dropzone.fire(t.leave),t.enter&&n.dropzone.fire(t.enter),t.move&&n.dropzone.fire(t.move),t.drop&&n.dropzone.fire(t.drop),t.deactivate&&d(r,t.deactivate),o.prev.dropzone=n.dropzone,o.prev.element=n.element}function u({interaction:e,iEvent:t,event:o},r){if("dragmove"!==t.type&&"dragend"!==t.type)return;const n=e.dropState;r.dynamicDrop&&(n.activeDrops=c(r,e.element));const a=t,p=l(e,a,o);n.rejected=n.rejected&&!!p&&p.dropzone===n.cur.dropzone&&p.element===n.cur.element,n.cur.dropzone=p&&p.dropzone,n.cur.element=p&&p.element,n.events=s(e,0,a)}const m={id:"actions/drop",install(e){const{actions:i,interactStatic:d,Interactable:c,defaults:l}=e;e.usePlugin(p),c.prototype.dropzone=function(e){return((e,t)=>{if(r.object(t)){if(e.options.drop.enabled=!1!==t.enabled,t.listeners){const o=n(t.listeners),r=Object.keys(o).reduce(((e,t)=>(e[/^(enter|leave)/.test(t)?"drag"+t:/^(activate|deactivate|move)/.test(t)?"drop"+t:t]=o[t],e)),{}),a=e.options.drop.listeners;a&&e.off(a),e.on(r),e.options.drop.listeners=r}return r.func(t.ondrop)&&e.on("drop",t.ondrop),r.func(t.ondropactivate)&&e.on("dropactivate",t.ondropactivate),r.func(t.ondropdeactivate)&&e.on("dropdeactivate",t.ondropdeactivate),r.func(t.ondragenter)&&e.on("dragenter",t.ondragenter),r.func(t.ondragleave)&&e.on("dragleave",t.ondragleave),r.func(t.ondropmove)&&e.on("dropmove",t.ondropmove),/^(pointer|center)$/.test(t.overlap)?e.options.drop.overlap=t.overlap:r.number(t.overlap)&&(e.options.drop.overlap=Math.max(Math.min(1,t.overlap),0)),"accept"in t&&(e.options.drop.accept=t.accept),"checker"in t&&(e.options.drop.checker=t.checker),e}return r.bool(t)?(e.options.drop.enabled=t,e):e.options.drop})(this,e)},c.prototype.dropCheck=function(e,t,n,p,i,d){return((e,t,n,p,i,d,c)=>{let l=!1;if(!(c=c||e.getRect(d)))return!!e.options.drop.checker&&e.options.drop.checker(t,n,l,e,d,p,i);const s=e.options.drop.overlap;if("pointer"===s){const e=o(p,i,"drag"),r=a.getPageXY(t);r.x+=e.x,r.y+=e.y;const n=r.x>c.left&&r.xc.top&&r.y=c.left&&e<=c.right&&t>=c.top&&t<=c.bottom}return v&&r.number(s)&&(l=Math.max(0,Math.min(c.right,v.right)-Math.max(c.left,v.left))*Math.max(0,Math.min(c.bottom,v.bottom)-Math.max(c.top,v.top))/(v.width*v.height)>=s),e.options.drop.checker&&(l=e.options.drop.checker(t,n,l,e,d,p,i)),l})(this,e,t,n,p,i,d)},d.dynamicDrop=t=>r.bool(t)?(e.dynamicDrop=t,d):e.dynamicDrop,t(i.phaselessTypes,{dragenter:!0,dragleave:!0,dropactivate:!0,dropdeactivate:!0,dropmove:!0,drop:!0}),i.methodDict.drop="dropzone",e.dynamicDrop=!1,l.actions.drop=m.defaults},listeners:{"interactions:before-action-start"({interaction:e}){"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"({interaction:e,event:t,iEvent:o},r){if("drag"!==e.prepared.name)return;const n=e.dropState;n.activeDrops=[],n.events={},n.activeDrops=c(r,e.element),n.events=s(e,0,o),n.events.activate&&(d(n.activeDrops,n.events.activate),r.fire("actions/drop:start",{interaction:e,dragEvent:o}))},"interactions:action-move":u,"interactions:after-action-move"({interaction:e,iEvent:t},o){if("drag"!==e.prepared.name)return;const r=e.dropState;v(e,r.events),o.fire("actions/drop:move",{interaction:e,dragEvent:t}),r.events={}},"interactions:action-end"(e,t){if("drag"!==e.interaction.prepared.name)return;const{interaction:o,iEvent:r}=e;u(e,t),v(o,o.dropState.events),t.fire("actions/drop:end",{interaction:o,dragEvent:r})},"interactions:stop"({interaction:e}){if("drag"!==e.prepared.name)return;const{dropState:t}=e;t&&(t.activeDrops=null,t.events=null,t.cur.dropzone=null,t.cur.element=null,t.prev.dropzone=null,t.prev.element=null,t.rejected=!1)}},getActiveDrops:c,getDrop:l,getDropEvents:s,fireDropEvents:v,filterEventType:e=>0===e.search("drag")||0===e.search("drop"),defaults:{enabled:!1,accept:null,overlap:"pointer"}};export default m; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/drop/plugin.prod.js.map b/packages/@interactjs/actions/drop/plugin.prod.js.map new file mode 100644 index 000000000..547ac688b --- /dev/null +++ b/packages/@interactjs/actions/drop/plugin.prod.js.map @@ -0,0 +1,154 @@ +{ + "version": 3, + "names": [ + "domUtils", + "extend", + "getOriginXY", + "is", + "normalizeListeners", + "pointerUtils", + "drag", + "DropEvent", + "fireActivationEvents", + "activeDrops", + "event", + "dropzone", + "element", + "slice", + "target", + "fire", + "propagationStopped", + "immediatePropagationStopped", + "getActiveDrops", + "scope", + "dragElement", + "interactables", + "draggableElement", + "drops", + "list", + "options", + "drop", + "enabled", + "accept", + "string", + "matchesSelector", + "func", + "dropzoneElement", + "getAllElements", + "push", + "rect", + "getRect", + "collectDropzones", + "activeDrop", + "getDrop", + "dropState", + "interactable", + "draggable", + "dragEvent", + "pointerEvent", + "validDrops", + "isValid", + "dropCheck", + "dropIndex", + "indexOfDeepestElement", + "getDropEvents", + "interaction", + "_pointerEvent", + "dropEvents", + "enter", + "leave", + "activate", + "deactivate", + "move", + "type", + "rejected", + "cur", + "prev", + "dragLeave", + "prevDropzone", + "dragEnter", + "relatedTarget", + "fireDropEvents", + "events", + "onEventCreated", + "iEvent", + "dynamicDrop", + "dropResult", + "id", + "install", + "actions", + "interactStatic", + "interact", + "Interactable", + "defaults", + "usePlugin", + "prototype", + "object", + "listeners", + "normalized", + "corrected", + "Object", + "keys", + "reduce", + "acc", + "test", + "prevListeners", + "off", + "on", + "ondrop", + "ondropactivate", + "ondropdeactivate", + "ondragenter", + "ondragleave", + "ondropmove", + "overlap", + "number", + "Math", + "max", + "min", + "checker", + "bool", + "dropzoneMethod", + "this", + "dropElement", + "dropped", + "dropOverlap", + "origin", + "page", + "getPageXY", + "x", + "y", + "horizontal", + "left", + "right", + "vertical", + "top", + "bottom", + "dragRect", + "cx", + "width", + "cy", + "height", + "dropCheckMethod", + "newValue", + "phaselessTypes", + "dragenter", + "dragleave", + "dropactivate", + "dropdeactivate", + "dropmove", + "methodDict", + "prepared", + "name", + "arg", + "filterEventType", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, PointerEventType, Rect, ListenersArg } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '../drag/plugin'\n\nimport type { DragEvent } from '../drag/plugin'\nimport drag from '../drag/plugin'\n/* eslint-enable import/no-duplicates */\n\nimport { DropEvent } from './DropEvent'\n\nexport type DropFunctionChecker = (\n dragEvent: any, // related drag operation\n event: any, // touch or mouse EventEmitter\n dropped: boolean, // default checker result\n dropzone: Interactable, // dropzone interactable\n dropElement: Element, // drop zone element\n draggable: Interactable, // draggable's Interactable\n draggableElement: Element, // dragged element\n) => boolean\n\nexport interface DropzoneOptions extends PerActionDefaults {\n accept?:\n | string\n | Element\n | (({ dropzone, draggableElement }: { dropzone: Interactable, draggableElement: Element }) => boolean)\n // How the overlap is checked on the drop zone\n overlap?: 'pointer' | 'center' | number\n checker?: DropFunctionChecker\n\n ondropactivate?: ListenersArg\n ondropdeactivate?: ListenersArg\n ondragenter?: ListenersArg\n ondragleave?: ListenersArg\n ondropmove?: ListenersArg\n ondrop?: ListenersArg\n}\n\nexport interface DropzoneMethod {\n (this: Interactable, options: DropzoneOptions | boolean): Interactable\n (): DropzoneOptions\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n dropzone: DropzoneMethod\n dropCheck: (\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElemen: 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/InteractEvent' {\n interface InteractEvent {\n prevDropzone?: Interactable\n dropzone?: Interactable\n dragEnter?: Element\n dragLeave?: Element\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drop: DropzoneOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\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\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drop?: typeof drop\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n interface InteractStatic {\n dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this\n }\n}\n\ninterface DropSignalArg {\n interaction: Interaction<'drag'>\n dragEvent: DragEvent\n}\n\nexport interface ActiveDrop {\n dropzone: Interactable\n element: Element\n rect: Rect\n}\n\nexport interface DropState {\n cur: {\n // the dropzone a drag target might be dropped into\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n prev: {\n // the dropzone that was recently dragged away from\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n // wheather the potential drop was rejected from a listener\n rejected: boolean\n // the drop events related to the current drag event\n events: FiredDropEvents\n activeDrops: ActiveDrop[]\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n /** @lends module:interact */\n interactStatic: interact,\n /** @lends Interactable */\n Interactable,\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 {object | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.dropzone = function (this: Interactable, options) {\n return dropzoneMethod(this, options)\n } as Interactable['dropzone']\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 (\n this: Interactable,\n dragEvent,\n event,\n draggable,\n draggableElement,\n dropElement,\n rect,\n ) {\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 (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 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 collectDropzones ({ interactables }: Scope, draggableElement: Element) {\n const drops: ActiveDrop[] = []\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) {\n continue\n }\n\n const accept = dropzone.options.drop.accept\n\n // test the draggable draggableElement against the dropzone's accept setting\n if (\n (is.element(accept) && accept !== draggableElement) ||\n (is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||\n (is.func(accept) && !accept({ dropzone, draggableElement }))\n ) {\n continue\n }\n\n for (const dropzoneElement of dropzone.getAllElements()) {\n if (dropzoneElement !== draggableElement) {\n drops.push({\n dropzone,\n element: dropzoneElement,\n rect: dropzone.getRect(dropzoneElement),\n })\n }\n }\n }\n\n return drops\n}\n\nfunction fireActivationEvents (activeDrops: ActiveDrop[], event: DropEvent) {\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: Element) {\n // get dropzones and their elements that could receive the draggable\n const activeDrops = collectDropzones(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 (\n { dropState, interactable: draggable, element: dragElement }: Interaction,\n dragEvent,\n pointerEvent,\n) {\n const validDrops: Element[] = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {\n const isValid = dropzone.dropCheck(\n dragEvent,\n pointerEvent,\n draggable!,\n dragElement!,\n dropzoneElement,\n rect,\n )\n validDrops.push(isValid ? dropzoneElement : null)\n }\n\n // get the most appropriate dropzone based on DOM depth and order\n const dropIndex = domUtils.indexOfDeepestElement(validDrops)\n\n return dropState!.activeDrops[dropIndex] || null\n}\n\nfunction getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {\n const dropState = interaction.dropState!\n const dropEvents: Record = {\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 as never\n dropEvents.activate.dropzone = null as never\n }\n if (dragEvent.type === 'dragend') {\n dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')\n\n dropEvents.deactivate.target = null as never\n dropEvents.deactivate.dropzone = null as never\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 dragEvent.dropzone = dropState.cur.dropzone\n }\n\n return dropEvents\n}\n\ntype FiredDropEvents = Partial<\nRecord<'leave' | 'enter' | 'move' | 'drop' | 'activate' | 'deactivate', DropEvent>\n>\n\nfunction fireDropEvents (interaction: Interaction, events: FiredDropEvents) {\n const dropState = interaction.dropState!\n const { activeDrops, cur, prev } = dropState\n\n if (events.leave) {\n prev.dropzone.fire(events.leave)\n }\n if (events.enter) {\n cur.dropzone.fire(events.enter)\n }\n if (events.move) {\n cur.dropzone.fire(events.move)\n }\n if (events.drop) {\n cur.dropzone.fire(events.drop)\n }\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 }: DoPhaseArg<'drag', EventPhase>, scope: Scope) {\n if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') {\n return\n }\n\n const dropState = interaction.dropState!\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 =\n 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: Interactable): DropzoneOptions\nfunction dropzoneMethod(interactable: Interactable, options: DropzoneOptions | boolean): Interactable\nfunction dropzoneMethod (interactable: Interactable, options?: DropzoneOptions | boolean) {\n if (is.object(options)) {\n interactable.options.drop.enabled = options.enabled !== false\n\n if (options.listeners) {\n const normalized = 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 const prevListeners = interactable.options.drop.listeners\n prevListeners && interactable.off(prevListeners)\n\n interactable.on(corrected)\n interactable.options.drop.listeners = corrected\n }\n\n if (is.func(options.ondrop)) {\n interactable.on('drop', options.ondrop)\n }\n if (is.func(options.ondropactivate)) {\n interactable.on('dropactivate', options.ondropactivate)\n }\n if (is.func(options.ondropdeactivate)) {\n interactable.on('dropdeactivate', options.ondropdeactivate)\n }\n if (is.func(options.ondragenter)) {\n interactable.on('dragenter', options.ondragenter)\n }\n if (is.func(options.ondragleave)) {\n interactable.on('dragleave', options.ondragleave)\n }\n if (is.func(options.ondropmove)) {\n interactable.on('dropmove', options.ondropmove)\n }\n\n if (/^(pointer|center)$/.test(options.overlap as string)) {\n interactable.options.drop.overlap = options.overlap\n } else if (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 (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: Interactable,\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElement: 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n : false\n }\n\n const dropOverlap = interactable.options.drop.overlap\n\n if (dropOverlap === 'pointer') {\n const origin = getOriginXY(draggable, draggableElement, 'drag')\n const page = pointerUtils.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 && is.number(dropOverlap)) {\n const overlapArea =\n 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n }\n\n return dropped\n}\n\nconst drop: Plugin = {\n id: 'actions/drop',\n install,\n listeners: {\n 'interactions:before-action-start': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\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': (\n { interaction, event, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n\n // reset active dropzones\n dropState.activeDrops = []\n dropState.events = {}\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 'interactions:action-move': onEventCreated,\n\n 'interactions:after-action-move': (\n { interaction, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n fireDropEvents(interaction, dropState.events)\n\n scope.fire('actions/drop:move', { interaction, dragEvent })\n dropState.events = {}\n },\n\n 'interactions:action-end': (arg: DoPhaseArg<'drag', EventPhase>, scope) => {\n if (arg.interaction.prepared.name !== 'drag') {\n return\n }\n\n const { interaction, iEvent: dragEvent } = arg\n\n onEventCreated(arg, scope)\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') {\n return\n }\n\n const { dropState } = interaction\n\n if (dropState) {\n dropState.activeDrops = null as never\n dropState.events = null as never\n dropState.cur.dropzone = null as never\n dropState.cur.element = null as never\n dropState.prev.dropzone = null as never\n dropState.prev.element = null as never\n dropState.rejected = false\n }\n },\n },\n getActiveDrops,\n getDrop,\n getDropEvents,\n fireDropEvents,\n\n filterEventType: (type: string) => type.search('drag') === 0 || type.search('drop') === 0,\n\n defaults: {\n enabled: false,\n accept: null as never,\n overlap: 'pointer',\n } as DropzoneOptions,\n}\n\nexport default drop\n" + ], + "mappings": "UAMYA,MAAc,sCACnBC,MAAY,oCACZC,MAAiB,yCACjBC,MAAQ,gCACRC,MAAwB,mDACnBC,MAAkB,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AAU4B,OAAOZ,UAC7DrC,EAAMJ,KAAK,qBAAsB,CAAEoC,cAAaR,gBAIpD,2BAA4B0B,EAE5B,kCACIlB,cAAamB,OAAQ3B,GACvBxB,GAEA,GAAkC,SAA9BgC,EAAYsF,SAASC,KACvB,OAGF,MAAMlG,EAAYW,EAAYX,UAC9B2B,EAAehB,EAAaX,EAAU4B,QAEtCjD,EAAMJ,KAAK,oBAAqB,CAAEoC,cAAaR,cAC/CH,EAAU4B,OAAS,IAGrB,0BAA4BuE,EAAqCxH,GAC/D,GAAsC,SAAlCwH,EAAIxF,YAAYsF,SAASC,KAC3B,OAGF,MAAMvF,YAAEA,EAAamB,OAAQ3B,GAAcgG,EAE3CtE,EAAesE,EAAKxH,GACpBgD,EAAehB,EAAaA,EAAYX,UAAW4B,QACnDjD,EAAMJ,KAAK,mBAAoB,CAAEoC,cAAaR,eAGhD,qBAAwBQ,gBACtB,GAAkC,SAA9BA,EAAYsF,SAASC,KACvB,OAGF,MAAMlG,UAAEA,GAAcW,EAElBX,IACFA,EAAU/B,YAAc,KACxB+B,EAAU4B,OAAS,KACnB5B,EAAUqB,IAAIlD,SAAW,KACzB6B,EAAUqB,IAAIjD,QAAU,KACxB4B,EAAUsB,KAAKnD,SAAW,KAC1B6B,EAAUsB,KAAKlD,QAAU,KACzB4B,EAAUoB,UAAW,KAI3B1C,iBACAqB,UACAW,gBACAiB,iBAEAyE,gBAAkBjF,GAAyC,IAAxBA,EAAKkF,OAAO,SAAyC,IAAxBlF,EAAKkF,OAAO,QAE5E9D,SAAU,CACRpD,SAAS,EACTC,OAAQ,KACRwE,QAAS,2BAIE1E" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/index.d.ts b/packages/@interactjs/actions/gesture/index.d.ts new file mode 100644 index 000000000..7045fc077 --- /dev/null +++ b/packages/@interactjs/actions/gesture/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/actions/gesture/plugin'; diff --git a/packages/@interactjs/actions/gesture/index.js b/packages/@interactjs/actions/gesture/index.js new file mode 100644 index 000000000..9e0948c16 --- /dev/null +++ b/packages/@interactjs/actions/gesture/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/index.js.map b/packages/@interactjs/actions/gesture/index.js.map new file mode 100644 index 000000000..fc34bbc0a --- /dev/null +++ b/packages/@interactjs/actions/gesture/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/gesture/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/gesture/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,yBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/index.prod.js b/packages/@interactjs/actions/gesture/index.prod.js new file mode 100644 index 000000000..b7f9ed169 --- /dev/null +++ b/packages/@interactjs/actions/gesture/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/index.prod.js.map b/packages/@interactjs/actions/gesture/index.prod.js.map new file mode 100644 index 000000000..5e1a14255 --- /dev/null +++ b/packages/@interactjs/actions/gesture/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/gesture/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/gesture/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,sCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/index.ts b/packages/@interactjs/actions/gesture/index.ts new file mode 100644 index 000000000..21db98581 --- /dev/null +++ b/packages/@interactjs/actions/gesture/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/actions/gesture/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/actions/gesture/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/plugin.d.ts b/packages/@interactjs/actions/gesture/plugin.d.ts new file mode 100644 index 000000000..0f23d30e1 --- /dev/null +++ b/packages/@interactjs/actions/gesture/plugin.d.ts @@ -0,0 +1,52 @@ +import type { InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'; +import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'; +import type { PerActionDefaults } from '@interactjs/core/options'; +import type { Plugin } from '@interactjs/core/scope'; +import type { ActionMethod, Rect, PointerType, ListenersArg } from '@interactjs/core/types'; +export declare type GesturableMethod = 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/options' { + interface ActionDefaults { + gesture: GesturableOptions; + } +} +declare module '@interactjs/core/types' { + interface ActionMap { + gesture?: typeof gesture; + } +} +export interface GesturableOptions extends PerActionDefaults { + onstart?: ListenersArg; + onmove?: ListenersArg; + onend?: ListenersArg; +} +export interface GestureEvent extends InteractEvent<'gesture'> { + distance: number; + angle: number; + da: number; + scale: number; + ds: number; + box: Rect; + touches: PointerType[]; +} +export interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> { + iEvent: GestureEvent; + interaction: Interaction<'gesture'>; +} +declare const gesture: Plugin; +export default gesture; diff --git a/packages/@interactjs/actions/gesture/plugin.js b/packages/@interactjs/actions/gesture/plugin.js new file mode 100644 index 000000000..dd3920387 --- /dev/null +++ b/packages/@interactjs/actions/gesture/plugin.js @@ -0,0 +1,146 @@ +import is from "../../utils/is.js"; +import * as pointerUtils from "../../utils/pointerUtils.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 (is.object(options)) { + this.options.gesture.enabled = options.enabled !== false; + this.setPerAction('gesture', options); + this.setOnEvents('gesture', options); + return this; + } + + if (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 = pointerUtils.touchDistance(pointers, deltaSource); + iEvent.box = pointerUtils.touchBBox(pointers); + iEvent.scale = 1; + iEvent.ds = 0; + iEvent.angle = pointerUtils.touchAngle(pointers, deltaSource); + iEvent.da = 0; + interaction.gesture.startDistance = iEvent.distance; + interaction.gesture.startAngle = iEvent.angle; + } else if (ending || interaction.pointers.length < 2) { + 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 = pointerUtils.touchDistance(pointers, deltaSource); + iEvent.box = pointerUtils.touchBBox(pointers); + iEvent.scale = iEvent.distance / interaction.gesture.startDistance; + iEvent.angle = pointerUtils.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 (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 ''; + }, + + filterEventType: type => type.search('gesture') === 0 +}; +export default gesture; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/plugin.js.map b/packages/@interactjs/actions/gesture/plugin.js.map new file mode 100644 index 000000000..f09be0151 --- /dev/null +++ b/packages/@interactjs/actions/gesture/plugin.js.map @@ -0,0 +1,71 @@ +{ + "version": 3, + "names": [ + "is", + "pointerUtils", + "install", + "scope", + "actions", + "Interactable", + "defaults", + "prototype", + "gesturable", + "options", + "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", + "length", + "prevEvent", + "number", + "Infinity", + "isNaN", + "id", + "before", + "listeners", + "arg", + "undefined", + "gestureOptions", + "action", + "getCursor", + "filterEventType", + "type", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, Rect, PointerType, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport type GesturableMethod = 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/options' {\n interface ActionDefaults {\n gesture: GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GesturableOptions extends PerActionDefaults {\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface GestureEvent extends 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: Rect // enclosing box of all points\n touches: PointerType[]\n}\n\nexport interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> {\n iEvent: GestureEvent\n interaction: Interaction<'gesture'>\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 (\n this: InstanceType,\n options: GesturableOptions | boolean,\n ) {\n if (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 (is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as GesturableOptions\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 = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = pointerUtils.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n } else if (ending || interaction.pointers.length < 2) {\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 } else {\n iEvent.distance = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = pointerUtils.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 (is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: 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 getCursor () {\n return ''\n },\n\n filterEventType: (type: string) => type.search('gesture') === 0,\n}\n\nexport default gesture\n" + ], + "mappings": "AAKA,OAAOA,EAAP,MAAe,mBAAf;AACA,OAAO,KAAKC,YAAZ,MAA8B,6BAA9B;;AAuDA,SAASC,OAA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KAAK,EAAE,CADa;QAEpBN,QAAQ,EAAE,CAFU;QAGpBI,KAAK,EAAE,CAHa;QAIpBM,UAAU,EAAE,CAJQ;QAKpBD,aAAa,EAAE;MALK,CAAtB;IAOD,CAbQ;IAeT,oBAAqBU,GAAD,IAAS;MAC3B,IAAIA,GAAG,CAAChC,WAAJ,CAAgBK,QAAhB,CAAyBmB,MAAzB,GAAkC,CAAtC,EAAyC;QACvC,OAAOS,SAAP;MACD;;MAED,MAAMC,cAAc,GAAGF,GAAG,CAACrB,YAAJ,CAAiBrB,OAAjB,CAAyBE,OAAhD;;MAEA,IAAI,EAAE0C,cAAc,IAAIA,cAAc,CAACzC,OAAnC,CAAJ,EAAiD;QAC/C,OAAOwC,SAAP;MACD;;MAEDD,GAAG,CAACG,MAAJ,GAAa;QAAE/B,IAAI,EAAE;MAAR,CAAb;MAEA,OAAO,KAAP;IACD;EA7BQ,CAJW;EAoCtBjB,QAAQ,EAAE,EApCY;;EAsCtBiD,SAAS,GAAI;IACX,OAAO,EAAP;EACD,CAxCqB;;EA0CtBC,eAAe,EAAGC,IAAD,IAAkBA,IAAI,CAACC,MAAL,CAAY,SAAZ,MAA2B;AA1CxC,CAAxB;AA6CA,eAAe/C,OAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/plugin.prod.js b/packages/@interactjs/actions/gesture/plugin.prod.js new file mode 100644 index 000000000..5663d32c1 --- /dev/null +++ b/packages/@interactjs/actions/gesture/plugin.prod.js @@ -0,0 +1,2 @@ +import e from"../../utils/is.prod.js";import*as t from"../../utils/pointerUtils.prod.js";function s({interaction:s,iEvent:n,phase:a}){if("gesture"!==s.prepared.name)return;const r=s.pointers.map((e=>e.pointer)),i="start"===a,o="end"===a,c=s.interactable.options.deltaSource;if(n.touches=[r[0],r[1]],i)n.distance=t.touchDistance(r,c),n.box=t.touchBBox(r),n.scale=1,n.ds=0,n.angle=t.touchAngle(r,c),n.da=0,s.gesture.startDistance=n.distance,s.gesture.startAngle=n.angle;else if(o||s.pointers.length<2){const e=s.prevEvent;n.distance=e.distance,n.box=e.box,n.scale=e.scale,n.ds=0,n.angle=e.angle,n.da=0}else n.distance=t.touchDistance(r,c),n.box=t.touchBBox(r),n.scale=n.distance/s.gesture.startDistance,n.angle=t.touchAngle(r,c),n.ds=n.scale-s.gesture.scale,n.da=n.angle-s.gesture.angle;s.gesture.distance=n.distance,s.gesture.angle=n.angle,e.number(n.scale)&&n.scale!==1/0&&!isNaN(n.scale)&&(s.gesture.scale=n.scale)}const n={id:"actions/gesture",before:["actions/drag","actions/resize"],install(t){const{actions:s,Interactable:a,defaults:r}=t;a.prototype.gesturable=function(t){return e.object(t)?(this.options.gesture.enabled=!1!==t.enabled,this.setPerAction("gesture",t),this.setOnEvents("gesture",t),this):e.bool(t)?(this.options.gesture.enabled=t,this):this.options.gesture},s.map.gesture=n,s.methodDict.gesture="gesturable",r.actions.gesture=n.defaults},listeners:{"interactions:action-start":s,"interactions:action-move":s,"interactions:action-end":s,"interactions:new"({interaction:e}){e.gesture={angle:0,distance:0,scale:1,startAngle:0,startDistance:0}},"auto-start:check"(e){if(e.interaction.pointers.length<2)return;const t=e.interactable.options.gesture;return t&&t.enabled?(e.action={name:"gesture"},!1):void 0}},defaults:{},getCursor(){return""},filterEventType:e=>0===e.search("gesture")};export default n; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/gesture/plugin.prod.js.map b/packages/@interactjs/actions/gesture/plugin.prod.js.map new file mode 100644 index 000000000..f4dbd0cdc --- /dev/null +++ b/packages/@interactjs/actions/gesture/plugin.prod.js.map @@ -0,0 +1,71 @@ +{ + "version": 3, + "names": [ + "is", + "pointerUtils", + "updateGestureProps", + "interaction", + "iEvent", + "phase", + "prepared", + "name", + "pointers", + "map", + "p", + "pointer", + "starting", + "ending", + "deltaSource", + "interactable", + "options", + "touches", + "distance", + "touchDistance", + "box", + "touchBBox", + "scale", + "ds", + "angle", + "touchAngle", + "da", + "gesture", + "startDistance", + "startAngle", + "length", + "prevEvent", + "number", + "Infinity", + "isNaN", + "id", + "before", + "install", + "scope", + "actions", + "Interactable", + "defaults", + "prototype", + "gesturable", + "object", + "this", + "enabled", + "setPerAction", + "setOnEvents", + "bool", + "methodDict", + "listeners", + "arg", + "gestureOptions", + "action", + "getCursor", + "filterEventType", + "type", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, Rect, PointerType, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport type GesturableMethod = 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/options' {\n interface ActionDefaults {\n gesture: GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GesturableOptions extends PerActionDefaults {\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface GestureEvent extends 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: Rect // enclosing box of all points\n touches: PointerType[]\n}\n\nexport interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> {\n iEvent: GestureEvent\n interaction: Interaction<'gesture'>\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 (\n this: InstanceType,\n options: GesturableOptions | boolean,\n ) {\n if (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 (is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as GesturableOptions\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 = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = pointerUtils.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n } else if (ending || interaction.pointers.length < 2) {\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 } else {\n iEvent.distance = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = pointerUtils.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 (is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: 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 getCursor () {\n return ''\n },\n\n filterEventType: (type: string) => type.search('gesture') === 0,\n}\n\nexport default gesture\n" + ], + "mappings": "OAKOA,MAAQ,mCACHC,MAAkB,mCA4G9B,SAASC,GAAoBC,YAAEA,EAAFC,OAAeA,EAAfC,MAAuBA,IAClD,GAAkC,YAA9BF,EAAYG,SAASC,KAAoB,OAE7C,MAAMC,EAAWL,EAAYK,SAASC,KAAKC,GAAMA,EAAEC,UAC7CC,EAAqB,UAAVP,EACXQ,EAAmB,QAAVR,EACTS,EAAcX,EAAYY,aAAaC,QAAQF,YAIrD,GAFAV,EAAOa,QAAU,CAACT,EAAS,GAAIA,EAAS,IAEpCI,EACFR,EAAOc,SAAWjB,E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AK7B,QAAQW,QAAQmB,SAA8B,IAApB9B,EAAQ8B,QACvCD,KAAKE,aAAa,UAAW/B,GAC7B6B,KAAKG,YAAY,UAAWhC,GAErB6B,MAGL7C,EAAGiD,KAAKjC,IACV6B,KAAK7B,QAAQW,QAAQmB,QAAU9B,EAExB6B,MAGFA,KAAK7B,QAAQW,SAGtBY,EAAQ9B,IAAIkB,QAAUA,EACtBY,EAAQW,WAAWvB,QAAU,aAE7Bc,EAASF,QAAQZ,QAAUA,EAAQc,UAsDnCU,UAAW,CACT,4BAA6BjD,EAC7B,2BAA4BA,EAC5B,0BAA2BA,EAE3B,oBAAuBC,gBACrBA,EAAYwB,QAAU,CACpBH,MAAO,EACPN,SAAU,EACVI,MAAO,EACPO,WAAY,EACZD,cAAe,IAInB,mBAAqBwB,GACnB,GAAIA,EAAIjD,YAAYK,SAASsB,OAAS,EACpC,OAGF,MAAMuB,EAAiBD,EAAIrC,aAAaC,QAAQW,QAEhD,OAAM0B,GAAkBA,EAAeP,SAIvCM,EAAIE,OAAS,CAAE/C,KAAM,YAEd,QANP,IAUJkC,SAAU,GAEVc,YACE,MAAO,IAGTC,gBAAkBC,GAA4C,IAA3BA,EAAKC,OAAO,2BAGlC/B" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/index.d.ts b/packages/@interactjs/actions/index.d.ts new file mode 100644 index 000000000..c3287de1c --- /dev/null +++ b/packages/@interactjs/actions/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/actions/plugin'; diff --git a/packages/@interactjs/actions/index.js b/packages/@interactjs/actions/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/actions/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/index.js.map b/packages/@interactjs/actions/index.js.map new file mode 100644 index 000000000..d8b77858e --- /dev/null +++ b/packages/@interactjs/actions/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/index.prod.js b/packages/@interactjs/actions/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/actions/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/index.prod.js.map b/packages/@interactjs/actions/index.prod.js.map new file mode 100644 index 000000000..11b8e42d8 --- /dev/null +++ b/packages/@interactjs/actions/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/index.ts b/packages/@interactjs/actions/index.ts new file mode 100644 index 000000000..f76b661c4 --- /dev/null +++ b/packages/@interactjs/actions/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/actions/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/actions/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/actions/plugin.d.ts b/packages/@interactjs/actions/plugin.d.ts new file mode 100644 index 000000000..989fb96d5 --- /dev/null +++ b/packages/@interactjs/actions/plugin.d.ts @@ -0,0 +1,10 @@ +import type { Scope } from '@interactjs/core/scope'; +import './drag/plugin'; +import './drop/plugin'; +import './gesture/plugin'; +import './resize/plugin'; +declare const _default: { + id: string; + install(scope: Scope): void; +}; +export default _default; diff --git a/packages/@interactjs/actions/plugin.js b/packages/@interactjs/actions/plugin.js new file mode 100644 index 000000000..de07de76a --- /dev/null +++ b/packages/@interactjs/actions/plugin.js @@ -0,0 +1,23 @@ +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ +import './drag/plugin'; +import './drop/plugin'; +import './gesture/plugin'; +import './resize/plugin'; +import drag from './drag/plugin'; +import drop from './drop/plugin'; +import gesture from './gesture/plugin'; +import resize from './resize/plugin'; +/* eslint-enable import/no-duplicates */ + +export default { + id: 'actions', + + install(scope) { + scope.usePlugin(gesture); + scope.usePlugin(resize); + scope.usePlugin(drag); + scope.usePlugin(drop); + } + +}; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/plugin.js.map b/packages/@interactjs/actions/plugin.js.map new file mode 100644 index 000000000..99733009f --- /dev/null +++ b/packages/@interactjs/actions/plugin.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "drag", + "drop", + "gesture", + "resize", + "id", + "install", + "scope", + "usePlugin" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './drag/plugin'\nimport './drop/plugin'\nimport './gesture/plugin'\nimport './resize/plugin'\n\nimport drag from './drag/plugin'\nimport drop from './drop/plugin'\nimport gesture from './gesture/plugin'\nimport resize from './resize/plugin'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'actions',\n install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n },\n}\n" + ], + "mappings": "AAEA;AACA,OAAO,eAAP;AACA,OAAO,eAAP;AACA,OAAO,kBAAP;AACA,OAAO,iBAAP;AAEA,OAAOA,IAAP,MAAiB,eAAjB;AACA,OAAOC,IAAP,MAAiB,eAAjB;AACA,OAAOC,OAAP,MAAoB,kBAApB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA;;AAEA,eAAe;EACbC,EAAE,EAAE,SADS;;EAEbC,OAAO,CAAEC,KAAF,EAAgB;IACrBA,KAAK,CAACC,SAAN,CAAgBL,OAAhB;IACAI,KAAK,CAACC,SAAN,CAAgBJ,MAAhB;IACAG,KAAK,CAACC,SAAN,CAAgBP,IAAhB;IACAM,KAAK,CAACC,SAAN,CAAgBN,IAAhB;EACD;;AAPY,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/plugin.prod.js b/packages/@interactjs/actions/plugin.prod.js new file mode 100644 index 000000000..fc2204b59 --- /dev/null +++ b/packages/@interactjs/actions/plugin.prod.js @@ -0,0 +1,2 @@ +import"./drag/plugin";import"./drop/plugin";import"./gesture/plugin";import"./resize/plugin";import i from"./drag/plugin";import r from"./drop/plugin";import p from"./gesture/plugin";import u from"./resize/plugin";export default{id:"actions",install(g){g.usePlugin(p),g.usePlugin(u),g.usePlugin(i),g.usePlugin(r)}}; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/plugin.prod.js.map b/packages/@interactjs/actions/plugin.prod.js.map new file mode 100644 index 000000000..211cd0094 --- /dev/null +++ b/packages/@interactjs/actions/plugin.prod.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "drag", + "drop", + "gesture", + "resize", + "id", + "install", + "scope", + "usePlugin" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './drag/plugin'\nimport './drop/plugin'\nimport './gesture/plugin'\nimport './resize/plugin'\n\nimport drag from './drag/plugin'\nimport drop from './drop/plugin'\nimport gesture from './gesture/plugin'\nimport resize from './resize/plugin'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'actions',\n install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n },\n}\n" + ], + "mappings": "MAGO,sBACA,sBACA,yBACA,yBAEAA,MAAU,uBACVC,MAAU,uBACVC,MAAa,0BACbC,MAAY,gCAGJ,CACbC,GAAI,UACJC,QAASC,GACPA,EAAMC,UAAUL,GAChBI,EAAMC,UAAUJ,GAChBG,EAAMC,UAAUP,GAChBM,EAAMC,UAAUN" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/index.d.ts b/packages/@interactjs/actions/resize/index.d.ts new file mode 100644 index 000000000..6bbea2e27 --- /dev/null +++ b/packages/@interactjs/actions/resize/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/actions/resize/plugin'; diff --git a/packages/@interactjs/actions/resize/index.js b/packages/@interactjs/actions/resize/index.js new file mode 100644 index 000000000..9e0948c16 --- /dev/null +++ b/packages/@interactjs/actions/resize/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/index.js.map b/packages/@interactjs/actions/resize/index.js.map new file mode 100644 index 000000000..47f196a84 --- /dev/null +++ b/packages/@interactjs/actions/resize/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/resize/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/resize/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,yBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/index.prod.js b/packages/@interactjs/actions/resize/index.prod.js new file mode 100644 index 000000000..b7f9ed169 --- /dev/null +++ b/packages/@interactjs/actions/resize/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/index.prod.js.map b/packages/@interactjs/actions/resize/index.prod.js.map new file mode 100644 index 000000000..3917e4652 --- /dev/null +++ b/packages/@interactjs/actions/resize/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/actions/resize/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/actions/resize/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,sCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/index.ts b/packages/@interactjs/actions/resize/index.ts new file mode 100644 index 000000000..a520adc45 --- /dev/null +++ b/packages/@interactjs/actions/resize/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/actions/resize/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/actions/resize/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/plugin.d.ts b/packages/@interactjs/actions/resize/plugin.d.ts new file mode 100644 index 000000000..5d0c87b6b --- /dev/null +++ b/packages/@interactjs/actions/resize/plugin.d.ts @@ -0,0 +1,46 @@ +import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'; +import type { PerActionDefaults } from '@interactjs/core/options'; +import type { Plugin } from '@interactjs/core/scope'; +import type { ActionName, ActionProps, ActionMethod, EdgeOptions, FullRect, ListenersArg } from '@interactjs/core/types'; +export declare type EdgeName = 'top' | 'left' | 'bottom' | 'right'; +export declare type ResizableMethod = 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/options' { + interface ActionDefaults { + resize: ResizableOptions; + } +} +declare module '@interactjs/core/types' { + interface ActionMap { + resize?: typeof resize; + } +} +export interface ResizableOptions extends PerActionDefaults { + square?: boolean; + preserveAspectRatio?: boolean; + edges?: EdgeOptions | null; + axis?: 'x' | 'y' | 'xy'; + invert?: 'none' | 'negate' | 'reposition'; + margin?: number; + squareResize?: boolean; + oninertiastart?: ListenersArg; + onstart?: ListenersArg; + onmove?: ListenersArg; + onend?: ListenersArg; +} +export interface ResizeEvent

extends InteractEvent<'resize', P> { + deltaRect?: FullRect; + edges?: ActionProps['edges']; +} +declare const resize: Plugin; +export default resize; diff --git a/packages/@interactjs/actions/resize/plugin.js b/packages/@interactjs/actions/resize/plugin.js new file mode 100644 index 000000000..26e67c578 --- /dev/null +++ b/packages/@interactjs/actions/resize/plugin.js @@ -0,0 +1,443 @@ +import * as dom from "../../utils/domUtils.js"; +import extend from "../../utils/extend.js"; +import 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, Math.abs((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') { + const edge = width >= 0 ? rect.left : rect.right; + return page.x < edge + margin; + } + + if (name === 'top') { + const edge = height >= 0 ? rect.top : rect.bottom; + return page.y < edge + 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); +} +/* eslint-disable multiline-ternary */ +// eslint-disable-next-line @typescript-eslint/consistent-type-imports + + +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' + }; +} +/* eslint-enable multiline-ternary */ + + +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'; + 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; + }, + + filterEventType: type => type.search('resize') === 0, + defaultMargin: null +}; +export default resize; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/plugin.js.map b/packages/@interactjs/actions/resize/plugin.js.map new file mode 100644 index 000000000..fdfe6f2ab --- /dev/null +++ b/packages/@interactjs/actions/resize/plugin.js.map @@ -0,0 +1,117 @@ +{ + "version": 3, + "names": [ + "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", + "abs", + "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", + "filterEventType", + "type", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type {\n ActionName,\n ActionProps,\n ActionMethod,\n EdgeOptions,\n FullRect,\n ListenersArg,\n OrBoolean,\n Point,\n Rect,\n} from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = 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/options' {\n interface ActionDefaults {\n resize: ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizableOptions extends PerActionDefaults {\n square?: boolean\n preserveAspectRatio?: boolean\n edges?: EdgeOptions | null\n axis?: 'x' | 'y' | 'xy' // deprecated\n invert?: 'none' | 'negate' | 'reposition'\n margin?: number\n squareResize?: boolean\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface ResizeEvent

extends InteractEvent<'resize', P> {\n deltaRect?: FullRect\n edges?: 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: Interactable, options: 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) {\n return undefined\n }\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(\n edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin,\n )\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 } 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: Interactable, options: 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 } 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 } 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: Point,\n element: Node,\n interactableElement: Element,\n rect: Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) {\n return false\n }\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, Math.abs((name === 'left' || name === 'right' ? width : height) / 2))\n\n if (width < 0) {\n if (name === 'left') {\n name = 'right'\n } else if (name === 'right') {\n name = 'left'\n }\n }\n if (height < 0) {\n if (name === 'top') {\n name = 'bottom'\n } else if (name === 'bottom') {\n name = 'top'\n }\n }\n\n if (name === 'left') {\n const edge = width >= 0 ? rect.left : rect.right\n return page.x < edge + margin\n }\n if (name === 'top') {\n const edge = height >= 0 ? rect.top : rect.bottom\n return page.y < edge + margin\n }\n\n if (name === 'right') {\n return page.x > (width >= 0 ? rect.right : rect.left) - margin\n }\n if (name === 'bottom') {\n return page.y > (height >= 0 ? rect.bottom : rect.top) - margin\n }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) {\n return false\n }\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\n/* eslint-disable multiline-ternary */\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nfunction initCursors (browser: typeof import('@interactjs/utils/browser').default) {\n return browser.isIe9\n ? {\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 : {\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/* eslint-enable multiline-ternary */\n\nfunction start ({ iEvent, interaction }: { iEvent: 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: 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 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 } 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: 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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\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 } else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n } else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n } else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: 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 ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\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 filterEventType: (type: string) => type.search('resize') === 0,\n\n defaultMargin: null as number,\n}\n\nexport default resize\n" + ], + "mappings": "AAgBA,OAAO,KAAKA,GAAZ,MAAqB,yBAArB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,EAAP,MAAe,mBAAf;;AAkDA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IACJC,OADI;IAEJC,OAFI;;IAGJ;IACAC,YAJI;IAIU;IACdC;EALI,IAMFJ,KANJ,CAD8B,CAS9B;;EAEAK,MAAM,CAACC,OAAP,GAAiBC,WAAW,CAACL,OAAD,CAA5B;EACAG,MAAM,CAACG,aAAP,GAAuBN,OAAO,CAACO,aAAR,IAAyBP,OAAO,CAACQ,oBAAjC,GAAwD,EAAxD,GAA6D,EAApF;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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IAAX,IAAmB,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,OAA1B,CAAnB,EAAuD;QACrD,IAAIN,KAAK,CAACM,IAAD,CAAT,EAAiB;UACfyD,SAAS,IAAIzD,IAAb;QACD;MACF;;MAEDwD,MAAM,GAAG1F,OAAO,CAAC2F,SAAD,CAAhB;IACD;;IAED,OAAOD,MAAP;EACD,CA/DoB;;EAiErBE,eAAe,EAAGC,IAAD,IAAkBA,IAAI,CAACC,MAAL,CAAY,QAAZ,MAA0B,CAjExC;EAmErB5F,aAAa,EAAE;AAnEM,CAAvB;AAsEA,eAAeH,MAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/plugin.prod.js b/packages/@interactjs/actions/resize/plugin.prod.js new file mode 100644 index 000000000..e520b757a --- /dev/null +++ b/packages/@interactjs/actions/resize/plugin.prod.js @@ -0,0 +1,2 @@ +import*as e from"../../utils/domUtils.prod.js";import t from"../../utils/extend.prod.js";import r from"../../utils/is.prod.js";function i(t,i,s,o,n,a,l){if(!i)return!1;if(!0===i){const e=r.number(a.width)?a.width:a.right-a.left,i=r.number(a.height)?a.height:a.bottom-a.top;if(l=Math.min(l,Math.abs(("left"===t||"right"===t?e:i)/2)),e<0&&("left"===t?t="right":"right"===t&&(t="left")),i<0&&("top"===t?t="bottom":"bottom"===t&&(t="top")),"left"===t){const t=e>=0?a.left:a.right;return s.x=0?a.top:a.bottom;return s.y(e>=0?a.right:a.left)-l;if("bottom"===t)return s.y>(i>=0?a.bottom:a.top)-l}return!!r.element(o)&&(r.element(i)?i===o:e.matchesUpTo(o,i,n))}function s({iEvent:e,interaction:t}){if("resize"!==t.prepared.name||!t.resizeAxes)return;const r=e;t.interactable.options.resize.square?("y"===t.resizeAxes?r.delta.x=r.delta.y:r.delta.y=r.delta.x,r.axes="xy"):(r.axes=t.resizeAxes,"x"===t.resizeAxes?r.delta.y=0:"y"===t.resizeAxes&&(r.delta.x=0))}const o={id:"actions/resize",before:["actions/drag"],install(e){const{actions:t,browser:i,Interactable:s,defaults:n}=e;o.cursors=(e=>e.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"})(i),o.defaultMargin=i.supportsTouch||i.supportsPointerEvent?20:10,s.prototype.resizable=function(t){return((e,t,i)=>r.object(t)?(e.options.resize.enabled=!1!==t.enabled,e.setPerAction("resize",t),e.setOnEvents("resize",t),r.string(t.axis)&&/^x$|^y$|^xy$/.test(t.axis)?e.options.resize.axis=t.axis:null===t.axis&&(e.options.resize.axis=i.defaults.actions.resize.axis),r.bool(t.preserveAspectRatio)?e.options.resize.preserveAspectRatio=t.preserveAspectRatio:r.bool(t.square)&&(e.options.resize.square=t.square),e):r.bool(t)?(e.options.resize.enabled=t,e):e.options.resize)(this,t,e)},t.map.resize=o,t.methodDict.resize="resizable",n.actions.resize=o.defaults},listeners:{"interactions:new"({interaction:e}){e.resizeAxes="xy"},"interactions:action-start"(e){(({iEvent:e,interaction:r})=>{if("resize"!==r.prepared.name||!r.prepared.edges)return;const i=e,s=r.rect;r._rects={start:t({},s),corrected:t({},s),previous:t({},s),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},i.edges=r.prepared.edges,i.rect=r._rects.corrected,i.deltaRect=r._rects.delta})(e),s(e)},"interactions:action-move"(e){(({iEvent:e,interaction:r})=>{if("resize"!==r.prepared.name||!r.prepared.edges)return;const i=e,s=r.interactable.options.resize.invert,o="reposition"===s||"negate"===s,n=r.rect,{start:a,corrected:l,delta:c,previous:p}=r._rects;if(t(p,l),o){if(t(l,n),"reposition"===s){if(l.top>l.bottom){const e=l.top;l.top=l.bottom,l.bottom=e}if(l.left>l.right){const e=l.left;l.left=l.right,l.right=e}}}else l.top=Math.min(n.top,a.bottom),l.bottom=Math.max(n.bottom,a.top),l.left=Math.min(n.left,a.right),l.right=Math.max(n.right,a.left);l.width=l.right-l.left,l.height=l.bottom-l.top;for(const e in l)c[e]=l[e]-p[e];i.edges=r.prepared.edges,i.rect=l,i.deltaRect=c})(e),s(e)},"interactions:action-end"({iEvent:e,interaction:t}){if("resize"!==t.prepared.name||!t.prepared.edges)return;const r=e;r.edges=t.prepared.edges,r.rect=t._rects.corrected,r.deltaRect=t._rects.delta},"auto-start:check"(e){const{interaction:s,interactable:n,element:a,rect:l,buttons:c}=e;if(!l)return;const p=t({},s.coords.cur.page),d=n.options.resize;if(d&&d.enabled&&(!s.pointerIsDown||!/mouse|pointer/.test(s.pointerType)||0!=(c&d.mouseButtons))){if(r.object(d.edges)){const t={left:!1,right:!1,top:!1,bottom:!1};for(const e in t)t[e]=i(e,d.edges[e],p,s._latestPointer.eventTarget,a,l,d.margin||o.defaultMargin);t.left=t.left&&!t.right,t.top=t.top&&!t.bottom,(t.left||t.right||t.top||t.bottom)&&(e.action={name:"resize",edges:t})}else{const t="y"!==d.axis&&p.x>l.right-o.defaultMargin,r="x"!==d.axis&&p.y>l.bottom-o.defaultMargin;(t||r)&&(e.action={name:"resize",axes:(t?"x":"")+(r?"y":"")})}return!e.action&&void 0}}},defaults:{square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},cursors:null,getCursor({edges:e,axis:t,name:r}){const i=o.cursors;let s=null;if(t)s=i[r+t];else if(e){let t="";for(const r of["top","bottom","left","right"])e[r]&&(t+=r);s=i[t]}return s},filterEventType:e=>0===e.search("resize"),defaultMargin:null};export default o; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/actions/resize/plugin.prod.js.map b/packages/@interactjs/actions/resize/plugin.prod.js.map new file mode 100644 index 000000000..2635a20a7 --- /dev/null +++ b/packages/@interactjs/actions/resize/plugin.prod.js.map @@ -0,0 +1,116 @@ +{ + "version": 3, + "names": [ + "dom", + "extend", + "is", + "checkResizeEdge", + "name", + "value", + "page", + "element", + "interactableElement", + "rect", + "margin", + "width", + "number", + "right", + "left", + "height", + "bottom", + "top", + "Math", + "min", + "abs", + "edge", + "x", + "y", + "matchesUpTo", + "updateEventAxes", + "iEvent", + "interaction", + "prepared", + "resizeAxes", + "resizeEvent", + "interactable", + "options", + "resize", + "square", + "delta", + "axes", + "id", + "before", + "install", + "scope", + "actions", + "browser", + "Interactable", + "defaults", + "cursors", + "isIe9", + "xy", + "topleft", + "bottomright", + "topright", + "bottomleft", + "initCursors", + "defaultMargin", + "supportsTouch", + "supportsPointerEvent", + "prototype", + "resizable", + "object", + "enabled", + "setPerAction", + "setOnEvents", + "string", + "axis", + "test", + "bool", + "preserveAspectRatio", + "this", + "map", + "methodDict", + "listeners", + "arg", + "edges", + "_rects", + "start", + "corrected", + "previous", + "deltaRect", + "invert", + "invertible", + "current", + "startRect", + "swap", + "max", + "move", + "buttons", + "coords", + "cur", + "resizeOptions", + "pointerIsDown", + "pointerType", + "mouseButtons", + "resizeEdges", + "_latestPointer", + "eventTarget", + "action", + "undefined", + "NaN", + "getCursor", + "result", + "cursorKey", + "filterEventType", + "type", + "search" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type {\n ActionName,\n ActionProps,\n ActionMethod,\n EdgeOptions,\n FullRect,\n ListenersArg,\n OrBoolean,\n Point,\n Rect,\n} from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = 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/options' {\n interface ActionDefaults {\n resize: ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizableOptions extends PerActionDefaults {\n square?: boolean\n preserveAspectRatio?: boolean\n edges?: EdgeOptions | null\n axis?: 'x' | 'y' | 'xy' // deprecated\n invert?: 'none' | 'negate' | 'reposition'\n margin?: number\n squareResize?: boolean\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface ResizeEvent

extends InteractEvent<'resize', P> {\n deltaRect?: FullRect\n edges?: 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: Interactable, options: 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) {\n return undefined\n }\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(\n edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin,\n )\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 } 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: Interactable, options: 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 } 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 } 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: Point,\n element: Node,\n interactableElement: Element,\n rect: Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) {\n return false\n }\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, Math.abs((name === 'left' || name === 'right' ? width : height) / 2))\n\n if (width < 0) {\n if (name === 'left') {\n name = 'right'\n } else if (name === 'right') {\n name = 'left'\n }\n }\n if (height < 0) {\n if (name === 'top') {\n name = 'bottom'\n } else if (name === 'bottom') {\n name = 'top'\n }\n }\n\n if (name === 'left') {\n const edge = width >= 0 ? rect.left : rect.right\n return page.x < edge + margin\n }\n if (name === 'top') {\n const edge = height >= 0 ? rect.top : rect.bottom\n return page.y < edge + margin\n }\n\n if (name === 'right') {\n return page.x > (width >= 0 ? rect.right : rect.left) - margin\n }\n if (name === 'bottom') {\n return page.y > (height >= 0 ? rect.bottom : rect.top) - margin\n }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) {\n return false\n }\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\n/* eslint-disable multiline-ternary */\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nfunction initCursors (browser: typeof import('@interactjs/utils/browser').default) {\n return browser.isIe9\n ? {\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 : {\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/* eslint-enable multiline-ternary */\n\nfunction start ({ iEvent, interaction }: { iEvent: 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: 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 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 } 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: 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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\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 } else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n } else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n } else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: 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 ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\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 filterEventType: (type: string) => type.search('resize') === 0,\n\n defaultMargin: null as number,\n}\n\nexport default resize\n" + ], + "mappings": "UAgBYA,MAAS,sCACdC,MAAY,oCACZC,MAAQ,yBAoNf,SAASC,EACPC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GAGA,IAAKL,EACH,OAAO,EAIT,IAAc,IAAVA,EAAgB,CAElB,MAAMM,EAAQT,EAAGU,OAAOH,EAAKE,OAASF,EAAKE,MAAQF,EAAKI,MAAQJ,EAAKK,KAC/DC,EAASb,EAAGU,OAAOH,EAAKM,QAAUN,EAAKM,OAASN,EAAKO,OAASP,EA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SAAU,OAAQ,SACvCmD,EAAMnD,KACR+E,GAAa/E,GAIjB8E,EAAStD,EAAQuD,GAGnB,OAAOD,GAGTE,gBAAkBC,GAA2C,IAA1BA,EAAKC,OAAO,UAE/ClD,cAAe,qBAGFpB" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/.npmignore b/packages/@interactjs/auto-scroll/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/auto-scroll/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/auto-scroll/LICENSE b/packages/@interactjs/auto-scroll/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/auto-scroll/index.d.ts b/packages/@interactjs/auto-scroll/index.d.ts new file mode 100644 index 000000000..96776c871 --- /dev/null +++ b/packages/@interactjs/auto-scroll/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/auto-scroll/plugin'; diff --git a/packages/@interactjs/auto-scroll/index.js b/packages/@interactjs/auto-scroll/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/auto-scroll/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/index.js.map b/packages/@interactjs/auto-scroll/index.js.map new file mode 100644 index 000000000..b7e603b40 --- /dev/null +++ b/packages/@interactjs/auto-scroll/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/auto-scroll/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/auto-scroll/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/index.prod.js b/packages/@interactjs/auto-scroll/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/auto-scroll/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/index.prod.js.map b/packages/@interactjs/auto-scroll/index.prod.js.map new file mode 100644 index 000000000..0f4590e7d --- /dev/null +++ b/packages/@interactjs/auto-scroll/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/auto-scroll/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/auto-scroll/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/index.ts b/packages/@interactjs/auto-scroll/index.ts new file mode 100644 index 000000000..b6a331b73 --- /dev/null +++ b/packages/@interactjs/auto-scroll/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/auto-scroll/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/auto-scroll/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/plugin.d.ts b/packages/@interactjs/auto-scroll/plugin.d.ts new file mode 100644 index 000000000..b1789e3e4 --- /dev/null +++ b/packages/@interactjs/auto-scroll/plugin.d.ts @@ -0,0 +1,65 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type Interaction from '@interactjs/core/Interaction'; +import type { Plugin } from '@interactjs/core/scope'; +import type { ActionName, PointerType } from '@interactjs/core/types'; +declare module '@interactjs/core/scope' { + interface Scope { + autoScroll: typeof autoScroll; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + autoScroll?: typeof autoScroll; + } +} +declare module '@interactjs/core/options' { + interface PerActionDefaults { + autoScroll?: AutoScrollOptions; + } +} +export interface AutoScrollOptions { + container?: Window | HTMLElement | string; + margin?: number; + distance?: number; + interval?: number; + speed?: number; + enabled?: boolean; +} +declare const autoScroll: { + defaults: AutoScrollOptions; + now: () => number; + interaction: Interaction; + i: number; + x: number; + y: number; + isScrolling: boolean; + prevTime: number; + margin: number; + speed: number; + start(interaction: Interaction): void; + stop(): void; + scroll(): void; + check(interactable: Interactable, actionName: ActionName): boolean; + onInteractionMove({ interaction, pointer, }: { + interaction: Interaction; + pointer: PointerType; + }): void; +}; +export declare function getContainer(value: any, interactable: Interactable, element: 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: Element; +}, func: any): { + x: number; + y: number; +}; +declare const autoScrollPlugin: Plugin; +export default autoScrollPlugin; diff --git a/packages/@interactjs/auto-scroll/plugin.js b/packages/@interactjs/auto-scroll/plugin.js new file mode 100644 index 000000000..8e598301b --- /dev/null +++ b/packages/@interactjs/auto-scroll/plugin.js @@ -0,0 +1,248 @@ +import * as domUtils from "../utils/domUtils.js"; +import 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 + // Direction each pulse is to scroll in + x: 0, + y: 0, + 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) { + var _options$actionName$a; + + const options = interactable.options; + return (_options$actionName$a = options[actionName].autoScroll) == null ? void 0 : _options$actionName$a.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=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/plugin.js.map b/packages/@interactjs/auto-scroll/plugin.js.map new file mode 100644 index 000000000..5c60bde04 --- /dev/null +++ b/packages/@interactjs/auto-scroll/plugin.js.map @@ -0,0 +1,94 @@ +{ + "version": 3, + "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" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, PointerType } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\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/options' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement | string\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const { defaults, actions } = 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 Interaction | null,\n i: 0, // the handle returned by window.setInterval\n\n // Direction each pulse is to scroll in\n x: 0,\n y: 0,\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: 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 = 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 } 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: Interactable, actionName: ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll?.enabled\n },\n onInteractionMove ({\n interaction,\n pointer,\n }: {\n interaction: Interaction\n pointer: PointerType\n }) {\n if (\n !(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))\n ) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top: boolean\n let right: boolean\n let bottom: boolean\n let left: boolean\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 } 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: Interactable, element: Element) {\n return (\n (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n )\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta (\n {\n interaction,\n element,\n }: {\n interaction: Partial>\n element: Element\n },\n func: any,\n) {\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(scrollOptions.container, interaction.interactable, element)\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: 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" + ], + "mappings": "AAIA,OAAO,KAAKA,QAAZ,MAA0B,sBAA1B;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,OAAOC,GAAP,MAAgB,iBAAhB;AACA,SAASC,qBAAT,QAAsC,kBAAtC;AACA,SAASC,SAAT,QAA0B,oBAA1B;;AA6BA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IAAEC,QAAF;IAAYC;EAAZ,IAAwBF,KAA9B;EAEAA,KAAK,CAACG,UAAN,GAAmBA,UAAnB;;EACAA,UAAU,CAACC,GAAX,GAAiB,MAAMJ,KAAK,CAACI,GAAN,EAAvB;;EAEAF,OAAO,CAACG,cAAR,CAAuBC,UAAvB,GAAoC,IAApC;EACAL,QAAQ,CAACM,SAAT,CAAmBJ,UAAnB,GAAgCA,UAAU,CAACF,QAA3C;AACD;;AAED,MAAME,UAAU,GAAG;EACjBF,QAAQ,EAAE;IACRO,OAAO,EAAE,KADD;IAERC,MAAM,EAAE,EAFA;IAIR;IACAC,SAAS,EAAE,IALH;IAOR;IACAC,KAA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AQC,CAAC,EAAE;IAAX,CAAP;EACD;;EAED,MAAMqD,eAAe,GAAGvC,YAAY,CAACsC,aAAa,CAAC1D,SAAf,EAA0BG,WAAW,CAACW,YAAtC,EAAoDC,OAApD,CAApC;EAEA,MAAM6C,QAAQ,GAAGnC,SAAS,CAACkC,eAAD,CAA1B;EACAF,IAAI;EACJ,MAAMI,OAAO,GAAGpC,SAAS,CAACkC,eAAD,CAAzB;EAEA,OAAO;IACLtD,CAAC,EAAEwD,OAAO,CAACxD,CAAR,GAAYuD,QAAQ,CAACvD,CADnB;IAELC,CAAC,EAAEuD,OAAO,CAACvD,CAAR,GAAYsD,QAAQ,CAACtD;EAFnB,CAAP;AAID;AAED,MAAMwD,gBAAwB,GAAG;EAC/BC,EAAE,EAAE,aAD2B;EAE/B1E,OAF+B;EAG/B2E,SAAS,EAAE;IACT,oBAAoB,CAAC;MAAE7D;IAAF,CAAD,KAAqB;MACvCA,WAAW,CAACV,UAAZ,GAAyB,IAAzB;IACD,CAHQ;IAKT,wBAAwB,CAAC;MAAEU;IAAF,CAAD,KAAqB;MAC3CA,WAAW,CAACV,UAAZ,GAAyB,IAAzB;MACAA,UAAU,CAACoB,IAAX;;MACA,IAAIpB,UAAU,CAACU,WAAf,EAA4B;QAC1BV,UAAU,CAACU,WAAX,GAAyB,IAAzB;MACD;IACF,CAXQ;IAaT,qBAAqBV,UAAU,CAACoB,IAbvB;IAeT,4BAA6BoD,GAAD,IAAcxE,UAAU,CAAC0C,iBAAX,CAA6B8B,GAA7B;EAfjC;AAHoB,CAAjC;AAsBA,eAAeH,gBAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/plugin.prod.js b/packages/@interactjs/auto-scroll/plugin.prod.js new file mode 100644 index 000000000..5efd21e06 --- /dev/null +++ b/packages/@interactjs/auto-scroll/plugin.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/domUtils.prod.js";import n from"../utils/is.prod.js";import e from"../utils/raf.prod.js";import{getStringOptionResult as o}from"../utils/rect.prod.js";import{getWindow as i}from"../utils/window.prod.js";const r={defaults:{enabled:!1,margin:60,container:null,speed:300},now:Date.now,interaction:null,i:0,x:0,y:0,isScrolling:!1,prevTime:0,margin:0,speed:0,start(t){r.isScrolling=!0,e.cancel(r.i),t.autoScroll=r,r.interaction=t,r.prevTime=r.now(),r.i=e.request(r.scroll)},stop(){r.isScrolling=!1,r.interaction&&(r.interaction.autoScroll=null),e.cancel(r.i)},scroll(){const{interaction:t}=r,{interactable:o,element:i}=t,l=t.prepared.name,c=o.options[l].autoScroll,a=getContainer(c.container,o,i),s=r.now(),p=(s-r.prevTime)/1e3,u=c.speed*p;if(u>=1){const e={x:r.x*u,y:r.y*u};if(e.x||e.y){const r=getScroll(a);n.window(a)?a.scrollBy(e.x,e.y):a&&(a.scrollLeft+=e.x,a.scrollTop+=e.y);const l=getScroll(a),c={x:l.x-r.x,y:l.y-r.y};(c.x||c.y)&&o.fire({type:"autoscroll",target:i,interactable:o,delta:c,interaction:t,container:a})}r.prevTime=s}r.isScrolling&&(e.cancel(r.i),r.i=e.request(r.scroll))},check(t,n){var e;return null==(e=t.options[n].autoScroll)?void 0:e.enabled},onInteractionMove({interaction:e,pointer:o}){if(!e.interacting()||!r.check(e.interactable,e.prepared.name))return;if(e.simulation)return void(r.x=r.y=0);let i,l,c,a;const{interactable:s,element:p}=e,u=e.prepared.name,d=s.options[u].autoScroll,m=getContainer(d.container,s,p);if(n.window(m))a=o.clientXm.innerWidth-r.margin,c=o.clientY>m.innerHeight-r.margin;else{const n=t.getElementClientRect(m);a=o.clientXn.right-r.margin,c=o.clientY>n.bottom-r.margin}r.x=l?1:a?-1:0,r.y=c?1:i?-1:0,r.isScrolling||(r.margin=d.margin,r.speed=d.speed,r.start(e))}};export function getContainer(t,e,r){return(n.string(t)?o(t,e,r):t)||i(r)}export function getScroll(t){return n.window(t)&&(t=window.document.body),{x:t.scrollLeft,y:t.scrollTop}}export function getScrollSize(t){return n.window(t)&&(t=window.document.body),{x:t.scrollWidth,y:t.scrollHeight}}export function getScrollSizeDelta({interaction:t,element:n},e){const o=t&&t.interactable.options[t.prepared.name].autoScroll;if(!o||!o.enabled)return e(),{x:0,y:0};const i=getContainer(o.container,t.interactable,n),r=getScroll(i);e();const l=getScroll(i);return{x:l.x-r.x,y:l.y-r.y}}const l={id:"auto-scroll",install(t){const{defaults:n,actions:e}=t;t.autoScroll=r,r.now=()=>t.now(),e.phaselessTypes.autoscroll=!0,n.perAction.autoScroll=r.defaults},listeners:{"interactions:new"({interaction:t}){t.autoScroll=null},"interactions:destroy"({interaction:t}){t.autoScroll=null,r.stop(),r.interaction&&(r.interaction=null)},"interactions:stop":r.stop,"interactions:action-move":t=>r.onInteractionMove(t)}};export default l; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-scroll/plugin.prod.js.map b/packages/@interactjs/auto-scroll/plugin.prod.js.map new file mode 100644 index 000000000..f3278650e --- /dev/null +++ b/packages/@interactjs/auto-scroll/plugin.prod.js.map @@ -0,0 +1,95 @@ +{ + "version": 3, + "names": [ + "domUtils", + "is", + "raf", + "getStringOptionResult", + "getWindow", + "autoScroll", + "defaults", + "enabled", + "margin", + "container", + "speed", + "now", + "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", + "_options$actionName$a", + "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", + "install", + "scope", + "actions", + "phaselessTypes", + "autoscroll", + "perAction", + "listeners", + "arg" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, PointerType } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\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/options' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement | string\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const { defaults, actions } = 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 Interaction | null,\n i: 0, // the handle returned by window.setInterval\n\n // Direction each pulse is to scroll in\n x: 0,\n y: 0,\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: 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 = 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 } 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: Interactable, actionName: ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll?.enabled\n },\n onInteractionMove ({\n interaction,\n pointer,\n }: {\n interaction: Interaction\n pointer: PointerType\n }) {\n if (\n !(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))\n ) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top: boolean\n let right: boolean\n let bottom: boolean\n let left: boolean\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 } 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: Interactable, element: Element) {\n return (\n (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n )\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta (\n {\n interaction,\n element,\n }: {\n interaction: Partial>\n element: Element\n },\n func: any,\n) {\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(scrollOptions.container, interaction.interactable, element)\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: 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" + ], + "mappings": "UAIYA,MAAc,mCACnBC,MAAQ,6BACRC,MAAS,uDACPC,MAA6B,4CAC7BC,MAAiB,0BAuC1B,MAAMC,EAAa,CACjBC,SAAU,CACRC,SAAS,EACTC,OAAQ,GAGRC,UAAW,KAGXC,MAAO,KAGTC,IAAKC,KAAKD,IAEVE,YAAa,KACbC,EAAG,EAGHC,EAAG,EACHC,EAAG,EAEHC,aAAa,EACbC,SAAU,EACVV,OAAQ,EACRE,MAAO,EAEPS,MAAON,GACLR,EAAWY,aAAc,EACzBf,EAAIkB,OAAOf,EAAWS,GAEtBD,EAAYR,WAAaA,EACzBA,EAAWQ,YAAcA,EACzBR,EAAWa,SAAWb,EAAWM,MACjCN,EAAWS,EAAIZ,EAAImB,QAAQhB,EAAWiB,SAGxCC,OACElB,EAAWY,aAAc,EACrBZ,EAAWQ,cACbR,EAAWQ,YAAYR,WAAa,MAEtCH,EAAIkB,OAAOf,EAAWS,IAIxBQ,SACE,MAAMT,YAAEA,GAAgBR,GAClBmB,aAAEA,EAAFC,QAAgBA,GAAYZ,EAC5Ba,EAAab,EAAYc,SAASC,KAClCC,EAAUL,EAAaK,QAAQH,GAAYrB,WAC3CI,EAAYqB,aAAaD,EAAQpB,UAAWe,EAAcC,GAC1Dd,EAAMN,EAAWM,MAEjBoB,GAAMpB,EAAMN,EAAWa,UAAY,IAEnCc,EAAIH,EAAQnB,MAAQqB,EAE1B,GAAIC,GAAK,EAAG,CACV,MAAMC,EAAW,CACflB,EAAGV,EAAWU,EAAIiB,EAClBhB,EAAGX,EAAWW,EAAIgB,GAGpB,GAAIC,EAASlB,GAAKkB,EAASjB,EAAG,CAC5B,MAAMkB,EAAaC,UAAU1B,GAEzBR,EAAGmC,OAAO3B,GACZA,EAAUwB,SAASA,EAASlB,EAAGkB,EAASjB,GAC/BP,IACTA,EAAU4B,YAAc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B,MAAMtE,SAAEA,EAAFuE,QAAYA,GAAYD,EAE9BA,EAAMvE,WAAaA,EACnBA,EAAWM,IAAM,IAAMiE,EAAMjE,MAE7BkE,EAAQC,eAAeC,YAAa,EACpCzE,EAAS0E,UAAU3E,WAAaA,EAAWC,UAwN3C2E,UAAW,CACT,oBAAuBpE,gBACrBA,EAAYR,WAAa,MAG3B,wBAA2BQ,gBACzBA,EAAYR,WAAa,KACzBA,EAAWkB,OACPlB,EAAWQ,cACbR,EAAWQ,YAAc,OAI7B,oBAAqBR,EAAWkB,KAEhC,2BAA6B2D,GAAa7E,EAAWyC,kBAAkBoC,oBAI5DT" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/.npmignore b/packages/@interactjs/auto-start/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/auto-start/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/auto-start/InteractableMethods.d.ts b/packages/@interactjs/auto-start/InteractableMethods.d.ts new file mode 100644 index 000000000..66558497d --- /dev/null +++ b/packages/@interactjs/auto-start/InteractableMethods.d.ts @@ -0,0 +1,28 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Interaction } from '@interactjs/core/Interaction'; +import type { Scope } from '@interactjs/core/scope'; +import type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'; +declare module '@interactjs/core/Interactable' { + interface Interactable { + getAction: (this: Interactable, pointer: PointerType, event: PointerEventType, interaction: Interaction, element: Element) => ActionProps | null; + styleCursor: typeof styleCursor; + actionChecker: typeof actionChecker; + ignoreFrom: { + (...args: any[]): Interactable; + (): boolean; + }; + allowFrom: { + (...args: any[]): Interactable; + (): boolean; + }; + } +} +declare function install(scope: Scope): void; +declare function styleCursor(this: Interactable): boolean; +declare function styleCursor(this: Interactable, newValue: boolean): typeof this; +declare function actionChecker(this: Interactable, checker: any): any; +declare const _default: { + id: string; + install: typeof install; +}; +export default _default; diff --git a/packages/@interactjs/auto-start/InteractableMethods.js b/packages/@interactjs/auto-start/InteractableMethods.js new file mode 100644 index 000000000..fcc42a116 --- /dev/null +++ b/packages/@interactjs/auto-start/InteractableMethods.js @@ -0,0 +1,173 @@ +import is from "../utils/is.js"; +import { warnOnce } from "../utils/misc.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; + }; + /** + * 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. + * + * @deprecated + * Don't use this method. Instead set the `ignoreFrom` option for each action + * or for `pointerEvents` + * + * ```js + * 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}).'); + /** + * + * 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. + * + * @deprecated + * Don't use this method. Instead set the `allowFrom` option for each action + * or for `pointerEvents` + * + * ```js + * 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/packages/@interactjs/auto-start/InteractableMethods.js.map b/packages/@interactjs/auto-start/InteractableMethods.js.map new file mode 100644 index 000000000..001558c80 --- /dev/null +++ b/packages/@interactjs/auto-start/InteractableMethods.js.map @@ -0,0 +1,43 @@ +{ + "version": 3, + "names": [ + "is", + "warnOnce", + "install", + "scope", + "Interactable", + "prototype", + "getAction", + "pointer", + "event", + "interaction", + "element", + "action", + "defaultActionChecker", + "options", + "actionChecker", + "ignoreFrom", + "newValue", + "_backCompatOption", + "allowFrom", + "styleCursor", + "interactable", + "rect", + "getRect", + "buttons", + "button", + "arg", + "fire", + "bool", + "checker", + "func", + "id" + ], + "sources": [ + "InteractableMethods.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport { warnOnce } from '@interactjs/utils/misc'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ) => 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\nfunction install (scope: 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: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ): 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 * 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 * @deprecated\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\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: Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\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 * @deprecated\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\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: 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: Interactable,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n scope: Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons =\n (event as MouseEvent).buttons ||\n {\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: Interactable): boolean\nfunction styleCursor(this: Interactable, newValue: boolean): typeof this\nfunction styleCursor (this: 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: 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" + ], + "mappings": "AAIA,OAAOA,EAAP,MAAe,gBAAf;AACA,SAASC,QAAT,QAAyB,kBAAzB;;AAwBA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IACJ;IACAC,YAFI,CAEU;;EAFV,IAGFD,KAHJ;;EAKAC,YAAY,CAACC,SAAb,CAAuBC,SAAvB,GAAmC,SAASA,SAAT,CAEjCC,OAFiC,EAGjCC,KAHiC,EAIjCC,WAJiC,EAKjCC,OALiC,EAMpB;IACb,MAAMC,MAAM,GAAGC,oBAAoB,CAAC,IAAD,EAAOJ,KAAP,EAAcC,WAAd,EAA2BC,OAA3B,EAAoCP,KAApC,CAAnC;;IAEA,IAAI,KAAKU,OAAL,CAAaC,aAAjB,EAAgC;MAC9B,OAAO,KAAKD,OAAL,CAAaC,aAAb,CAA2BP,OAA3B,EAAoCC,KAApC,EAA2CG,MAA3C,EAAmD,IAAnD,EAAyDD,OAAzD,EAAkED,WAAlE,CAAP;IACD;;IAED,OAAOE,MAAP;EACD,CAdD;EAgBA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACEP,YAAY,CAACC,SAAb,CAAuBU,UAAvB,GAAoCd,QAAQ,CAAC,UAA8Be,QAA9B,EAAwC;IACnF,OAAO,KAAKC,iBAAL,CAAuB,YAAvB,EAAqCD,QAArC,CAAP;EACD,CAF2C,EAEzC,mGAFyC,CAA5C;EAIA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EACEZ,YAAY,CAACC,SAAb,CAAuBa,SAAvB,GAAmCjB,QAAQ,CAAC,UAA8Be,QAA9B,EAAwC;IAClF,OAAO,KAAKC,iBAAL,CAAuB,WAAvB,EAAoCD,QAApC,CAAP;EACD,CAF0C,EAExC,iGAFwC,CAA3C;EAIA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EACEZ,YAAY,CAACC,SAAb,CAAuBS,aAAvB,GAAuCA,aAAvC;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;;EACEV,YAAY,CAACC,SAAb,CAAuBc,WAAvB,GAAqCA,WAArC;AACD;;AAED,SAASP,oBAAT,CACEQ,YADF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ableMethods.prod.js b/packages/@interactjs/auto-start/InteractableMethods.prod.js new file mode 100644 index 000000000..9f9e316f7 --- /dev/null +++ b/packages/@interactjs/auto-start/InteractableMethods.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/is.prod.js";import{warnOnce as o}from"../utils/misc.prod.js";function e(o){return t.bool(o)?(this.options.styleCursor=o,this):null===o?(delete this.options.styleCursor,this):this.options.styleCursor}function r(o){return t.func(o)?(this.options.actionChecker=o,this):null===o?(delete this.options.actionChecker,this):this.options.actionChecker}export default{id:"auto-start/interactableMethods",install(t){const{Interactable:n}=t;n.prototype.getAction=function(o,e,r,n){const i=((t,o,e,r,n)=>{const i=t.getRect(r),s={action:null,interactable:t,interaction:e,element:r,rect:i,buttons:o.buttons||{0:1,1:4,3:8,4:16}[o.button]};return n.fire("auto-start:check",s),s.action})(this,e,r,n,t);return this.options.actionChecker?this.options.actionChecker(o,e,i,this,n,r):i},n.prototype.ignoreFrom=o((function(t){return this._backCompatOption("ignoreFrom",t)}),"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),n.prototype.allowFrom=o((function(t){return this._backCompatOption("allowFrom",t)}),"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),n.prototype.actionChecker=r,n.prototype.styleCursor=e}}; +//# sourceMappingURL=InteractableMethods.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/InteractableMethods.prod.js.map b/packages/@interactjs/auto-start/InteractableMethods.prod.js.map new file mode 100644 index 000000000..afe05075b --- /dev/null +++ b/packages/@interactjs/auto-start/InteractableMethods.prod.js.map @@ -0,0 +1,44 @@ +{ + "version": 3, + "names": [ + "is", + "warnOnce", + "styleCursor", + "newValue", + "bool", + "this", + "options", + "actionChecker", + "checker", + "func", + "id", + "install", + "scope", + "Interactable", + "prototype", + "getAction", + "pointer", + "event", + "interaction", + "element", + "action", + "interactable", + "rect", + "getRect", + "arg", + "buttons", + "button", + "fire", + "defaultActionChecker", + "ignoreFrom", + "_backCompatOption", + "allowFrom" + ], + "sources": [ + "InteractableMethods.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport { warnOnce } from '@interactjs/utils/misc'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ) => 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\nfunction install (scope: 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: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ): 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 * 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 * @deprecated\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\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: Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\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 * @deprecated\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\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: 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: Interactable,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n scope: Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons =\n (event as MouseEvent).buttons ||\n {\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: Interactable): boolean\nfunction styleCursor(this: Interactable, newValue: boolean): typeof this\nfunction styleCursor (this: 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: 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" + ], + "mappings": "OAIOA,MAAQ,yCACNC,MAAgB,wBAiLzB,SAASC,EAAiCC,GACxC,OAAIH,EAAGI,KAAKD,IACVE,KAAKC,QAAQJ,YAAcC,EAEpBE,MAGQ,OAAbF,UACKE,KAAKC,QAAQJ,YAEbG,MAGFA,KAAKC,QAAQJ,YAGtB,SAASK,EAAmCC,GAC1C,OAAIR,EAAGS,KAAKD,IACVH,KAAKC,QAAQC,cAAgBC,EAEtBH,MAGO,OAAZG,UACKH,KAAKC,QAAQC,cAEbF,MAGFA,KAAKC,QAAQC,4BAGP,CACbG,GAAI,iCACJC,QA3LgBC,GAChB,MAAMC,aAEJA,GACED,EAEJC,EAAaC,UAAUC,UAAY,SAEjCC,EACAC,EACAC,EACAC,GAEA,MAAMC,EA4GV,EACEC,EACAJ,EACAC,EACAC,EACAP,KAEA,MAAMU,EAAOD,EAAaE,QAAQJ,GAS5BK,EAAM,CACVJ,OAAQ,KACRC,eACAH,cACAC,UACAG,OACAG,QAbCR,EAAqBQ,SACtB,CACE,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,IACFR,EAAqBS,SAY1B,OAFAd,EAAMe,KAAK,mBAAoBH,GAExBA,EAAIJ,QAvIMQ,CAAqBvB,KAAMY,EAAOC,EAAaC,EAASP,GAEvE,OAAIP,KAAKC,QAAQC,cACRF,KAAKC,QAAQC,cAAcS,EAASC,EAAOG,EAAQf,KAAMc,EAASD,GAGpEE,GA2BTP,EAAaC,UAAUe,WAAa5B,GAAS,SAA8BE,GACzE,OAAOE,KAAKyB,kBAAkB,aAAc3B,KAC3C,qGA0BHU,EAAaC,UAAUiB,UAAY9B,GAAS,SAA8BE,GACxE,OAAOE,KAAKyB,kBAAkB,YAAa3B,KAC1C,mGAiCHU,EAAaC,UAAUP,cAAgBA,EASvCM,EAAaC,UAAUZ,YAAcA" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/LICENSE b/packages/@interactjs/auto-start/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/auto-start/base.d.ts b/packages/@interactjs/auto-start/base.d.ts new file mode 100644 index 000000000..d8e018960 --- /dev/null +++ b/packages/@interactjs/auto-start/base.d.ts @@ -0,0 +1,55 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Interaction } from '@interactjs/core/Interaction'; +import type { Scope, Plugin } from '@interactjs/core/scope'; +import type { CursorChecker, Element, ActionName, ActionProps } from '@interactjs/core/types'; +import './InteractableMethods'; +declare module '@interactjs/core/InteractStatic' { + interface InteractStatic { + maxInteractions: (newValue: any) => any; + } +} +declare module '@interactjs/core/scope' { + interface Scope { + autoStart: AutoStart; + } + interface SignalArgs { + 'autoStart:before-start': Omit & { + interaction: Interaction; + }; + 'autoStart:prepared': { + interaction: Interaction; + }; + 'auto-start:check': CheckSignalArg; + } +} +declare module '@interactjs/core/options' { + interface BaseDefaults { + actionChecker?: any; + cursorChecker?: any; + styleCursor?: any; + } + interface PerActionDefaults { + manualStart?: boolean; + max?: number; + maxPerElement?: number; + allowFrom?: string | Element; + ignoreFrom?: string | Element; + cursorChecker?: CursorChecker; + mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16; + } +} +interface CheckSignalArg { + interactable: Interactable; + interaction: Interaction; + element: Element; + action: ActionProps; + buttons: number; +} +export interface AutoStart { + maxInteractions: number; + withinInteractionLimit: typeof withinInteractionLimit; + cursorElement: Element; +} +declare function withinInteractionLimit(interactable: Interactable, element: Element, action: ActionProps, scope: Scope): boolean; +declare const autoStart: Plugin; +export default autoStart; diff --git a/packages/@interactjs/auto-start/base.js b/packages/@interactjs/auto-start/base.js new file mode 100644 index 000000000..53331bda2 --- /dev/null +++ b/packages/@interactjs/auto-start/base.js @@ -0,0 +1,316 @@ +import * as domUtils from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import is from "../utils/is.js"; +import { copyAction } from "../utils/misc.js"; +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ + +import './InteractableMethods'; +import InteractableMethods from './InteractableMethods'; +/* eslint-enable import/no-duplicates */ + +function install(scope) { + const { + interactStatic: interact, + defaults + } = scope; + scope.usePlugin(InteractableMethods); + defaults.base.actionChecker = null; + defaults.base.styleCursor = true; + 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 (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 = domUtils.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; + 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 (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 (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'], + 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/packages/@interactjs/auto-start/base.js.map b/packages/@interactjs/auto-start/base.js.map new file mode 100644 index 000000000..f77335054 --- /dev/null +++ b/packages/@interactjs/auto-start/base.js.map @@ -0,0 +1,110 @@ +{ + "version": 3, + "names": [ + "domUtils", + "extend", + "is", + "copyAction", + "InteractableMethods", + "install", + "scope", + "interactStatic", + "interact", + "defaults", + "usePlugin", + "base", + "actionChecker", + "styleCursor", + "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", + "interactables", + "forEachMatch", + "parentNode", + "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" + ], + "sources": [ + "base.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type {\n CursorChecker,\n PointerType,\n PointerEventType,\n Element,\n ActionName,\n ActionProps,\n} from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport { copyAction } from '@interactjs/utils/misc'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './InteractableMethods'\nimport InteractableMethods from './InteractableMethods'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Omit & {\n interaction: Interaction\n }\n 'autoStart:prepared': { interaction: Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/options' {\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 | Element\n ignoreFrom?: string | Element\n cursorChecker?: 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 // TODO: docst\n mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interactable\n interaction: Interaction\n element: Element\n action: 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: Element\n}\n\nfunction install (scope: Scope) {\n const { interactStatic: interact, defaults } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n 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: number) => 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 (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n if (interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:move'],\n scope: Scope,\n) {\n if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction } = arg\n\n if (\n !interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name\n ) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName = (interaction as Interaction).prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (\n interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)\n ) {\n interaction.stop()\n } else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interaction }, scope: 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: ActionProps,\n interactable: Interactable,\n element: Element,\n eventTarget: Node,\n scope: Scope,\n) {\n if (\n interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)\n ) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n matches: Interactable[],\n matchElements: Element[],\n eventTarget: Node,\n scope: 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) {\n continue\n }\n\n const action = validateAction(matchAction, match, matchElement, eventTarget, 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: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n eventTarget: Node,\n scope: Scope,\n) {\n let matches: Interactable[] = []\n let matchElements: Element[] = []\n\n let element = eventTarget as Element\n\n function pushMatches (interactable: Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(\n interaction,\n pointer,\n event,\n matches,\n matchElements,\n eventTarget,\n scope,\n )\n\n if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = domUtils.parentNode(element) as Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interaction,\n {\n action,\n interactable,\n element,\n }: {\n action: ActionProps\n interactable: Interactable\n element: Element\n },\n scope: Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name ? interactable.getRect(element) : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n scope: 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)) {\n return false\n }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) {\n continue\n }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) {\n continue\n }\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: Scope) {\n if (is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Element, cursor: string, scope: 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: Interaction, scope: 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 = interactable.options[prepared.name].cursorChecker\n\n if (is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n } else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Plugin = {\n id: 'auto-start/base',\n before: ['actions'],\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}\n\nexport default autoStart\n" + ], + "mappings": "AAWA,OAAO,KAAKA,QAAZ,MAA0B,sBAA1B;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;;AACA,OAAO,uBAAP;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA;;AA2DA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IAAEC,cAAc,EAAEC,QAAlB;IAA4BC;EAA5B,IAAyCH,KAA/C;EAEAA,KAAK,CAACI,SAAN,CAAgBN,mBAAhB;EAEAK,QAAQ,CAACE,IAAT,CAAcC,aAAd,GAA8B,IAA9B;EACAH,QAAQ,CAACE,IAAT,CAAcE,WAAd,GAA4B,IAA5B;EAEAZ,MAAM,CAACQ,QAAQ,CAACK,SAAV,EAAqB;IACzBC,WAAW,EAAE,KADY;IAEzBC,GAAG,EAAEC,QAFoB;IAGzBC,aAAa,EAAE,CAHU;IAIzBC,SAAS,EAAE,IAJc;IAKzBC,UAAU,EAAE,IALa;IAOzB;IACA;IACAC,YAAY,EAAE;EATW,CAArB,CAAN;EAYA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EACEb,QAAQ,CAACc,eAAT,GAA4BC,QAAD,IAAsBD,eAAe,CAACC,QAAD,EAAWjB,KAAX,CAAhE;;EAEAA,KAAK,CAACkB,SAAN,GAAkB;IAChB;IACAF,eAAe,EAAEL,QAFD;IAGhBQ,sBAHgB;IAIhBC,aAAa,EAAE;EAJC,CAAlB;AAMD;;AAED,S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C,aAA1D;;IAEA,IAAIvF,EAAE,CAACwF,IAAH,CAAQD,aAAR,CAAJ,EAA4B;MAC1BL,MAAM,GAAGK,aAAa,CAAC/C,QAAD,EAAWG,YAAX,EAAyBG,OAAzB,EAAkCpB,WAAW,CAAC+D,YAA9C,CAAtB;IACD,CAFD,MAEO;MACLP,MAAM,GAAG9E,KAAK,CAACsF,OAAN,CAAcC,GAAd,CAAkBnD,QAAQ,CAACC,IAA3B,EAAiCmD,SAAjC,CAA2CpD,QAA3C,CAAT;IACD;EACF;;EAEDW,SAAS,CAACzB,WAAW,CAACoB,OAAb,EAAsBoC,MAAM,IAAI,EAAhC,EAAoC9E,KAApC,CAAT;AACD;;AAED,MAAMkB,SAAiB,GAAG;EACxBuE,EAAE,EAAE,iBADoB;EAExBC,MAAM,EAAE,CAAC,SAAD,CAFgB;EAGxB3F,OAHwB;EAIxB4F,SAAS,EAAE;IACT,qBAAqBtE,aADZ;IAET,qBAAqB,CAACa,GAAD,EAAMlC,KAAN,KAAgB;MACnC8B,aAAa,CAACI,GAAD,EAAMlC,KAAN,CAAb;MACAiC,WAAW,CAACC,GAAD,EAAMlC,KAAN,CAAX;IACD,CALQ;IAMT,qBAAqB8C;EANZ,CAJa;EAYxB9B,eAZwB;EAaxBG,sBAbwB;EAcxB6B;AAdwB,CAA1B;AAiBA,eAAe9B,SAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/base.prod.js b/packages/@interactjs/auto-start/base.prod.js new file mode 100644 index 000000000..880deea69 --- /dev/null +++ b/packages/@interactjs/auto-start/base.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/domUtils.prod.js";import e from"../utils/extend.prod.js";import n from"../utils/is.prod.js";import{copyAction as r}from"../utils/misc.prod.js";import"./InteractableMethods";import o from"./InteractableMethods";function a(t,e,n,r,o){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&c(e,n,t,o)?t:null}function i(t,e,n,r,o,i,l){for(let s=0,c=r.length;s=l)return!1;if(o.interactable===t){if(c+=r===n.name?1:0,c>=a)return!1;if(o.element===e&&(u++,r===n.name&&u>=i))return!1}}}return l>0}function u(t,e){return n.number(t)?(e.autoStart.maxInteractions=t,this):e.autoStart.maxInteractions}function m(t,e,n){const{cursorElement:r}=n.autoStart;r&&r!==t&&(r.style.cursor=""),t.ownerDocument.documentElement.style.cursor=e,t.style.cursor=e,n.autoStart.cursorElement=e?t:null}function p(t,e){const{interactable:r,element:o,prepared:a}=t;if("mouse"!==t.pointerType||!r||!r.options.styleCursor)return void(e.autoStart.cursorElement&&m(e.autoStart.cursorElement,"",e));let i="";if(a.name){const l=r.options[a.name].cursorChecker;i=n.func(l)?l(a,r,o,t._interacting):e.actions.map[a.name].getCursor(a)}m(t.element,i||"",e)}const f={id:"auto-start/base",before:["actions"],install(t){const{interactStatic:n,defaults:r}=t;t.usePlugin(o),r.base.actionChecker=null,r.base.styleCursor=!0,e(r.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),n.maxInteractions=e=>u(e,t),t.autoStart={maxInteractions:1/0,withinInteractionLimit:c,cursorElement:null}},listeners:{"interactions:down"({interaction:t,pointer:e,event:n,eventTarget:r},o){t.interacting()||s(t,l(t,e,n,r,o),o)},"interactions:move"(t,e){(({interaction:t,pointer:e,event:n,eventTarget:r},o)=>{"mouse"!==t.pointerType||t.pointerIsDown||t.interacting()||s(t,l(t,e,n,r,o),o)})(t,e),((t,e)=>{const{interaction:n}=t;if(!n.pointerIsDown||n.interacting()||!n.pointerWasMoved||!n.prepared.name)return;e.fire("autoStart:before-start",t);const{interactable:r}=n,o=n.prepared.name;o&&r&&(r.options[o].manualStart||!c(r,n.element,n.prepared,e)?n.stop():(n.start(n.prepared,r,n.element),p(n,e)))})(t,e)},"interactions:stop"({interaction:t},e){const{interactable:n}=t;n&&n.options.styleCursor&&m(t.element,"",e)}},maxInteractions:u,withinInteractionLimit:c,validateAction:a};export default f; +//# sourceMappingURL=base.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/base.prod.js.map b/packages/@interactjs/auto-start/base.prod.js.map new file mode 100644 index 000000000..576f0c71c --- /dev/null +++ b/packages/@interactjs/auto-start/base.prod.js.map @@ -0,0 +1,109 @@ +{ + "version": 3, + "names": [ + "domUtils", + "extend", + "is", + "copyAction", + "InteractableMethods", + "validateAction", + "action", + "interactable", + "element", + "eventTarget", + "scope", + "testIgnoreAllow", + "options", + "name", + "enabled", + "withinInteractionLimit", + "validateMatches", + "interaction", + "pointer", + "event", + "matches", + "matchElements", + "i", + "len", + "length", + "match", + "matchElement", + "matchAction", + "getAction", + "getActionInfo", + "pushMatches", + "push", + "interactables", + "forEachMatch", + "actionInfo", + "manualStart", + "parentNode", + "prepare", + "prepared", + "rect", + "getRect", + "setInteractionCursor", + "fire", + "maxActions", + "max", + "maxPerElement", + "autoStartMax", + "autoStart", + "maxInteractions", + "activeInteractions", + "interactableCount", + "elementCount", + "interactions", + "list", + "otherAction", + "interacting", + "newValue", + "number", + "this", + "setCursor", + "cursor", + "cursorElement", + "prevCursorElement", + "style", + "ownerDocument", + "documentElement", + "pointerType", + "styleCursor", + "cursorChecker", + "func", + "_interacting", + "actions", + "map", + "getCursor", + "id", + "before", + "install", + "interactStatic", + "interact", + "defaults", + "usePlugin", + "base", + "actionChecker", + "perAction", + "Infinity", + "allowFrom", + "ignoreFrom", + "mouseButtons", + "listeners", + "arg", + "pointerIsDown", + "prepareOnMove", + "pointerWasMoved", + "actionName", + "stop", + "start", + "startOnMove" + ], + "sources": [ + "base.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type {\n CursorChecker,\n PointerType,\n PointerEventType,\n Element,\n ActionName,\n ActionProps,\n} from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport { copyAction } from '@interactjs/utils/misc'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './InteractableMethods'\nimport InteractableMethods from './InteractableMethods'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Omit & {\n interaction: Interaction\n }\n 'autoStart:prepared': { interaction: Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/options' {\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 | Element\n ignoreFrom?: string | Element\n cursorChecker?: 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 // TODO: docst\n mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interactable\n interaction: Interaction\n element: Element\n action: 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: Element\n}\n\nfunction install (scope: Scope) {\n const { interactStatic: interact, defaults } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n 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: number) => 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 (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n if (interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:move'],\n scope: Scope,\n) {\n if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction } = arg\n\n if (\n !interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name\n ) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName = (interaction as Interaction).prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (\n interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)\n ) {\n interaction.stop()\n } else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interaction }, scope: 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: ActionProps,\n interactable: Interactable,\n element: Element,\n eventTarget: Node,\n scope: Scope,\n) {\n if (\n interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)\n ) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n matches: Interactable[],\n matchElements: Element[],\n eventTarget: Node,\n scope: 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) {\n continue\n }\n\n const action = validateAction(matchAction, match, matchElement, eventTarget, 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: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n eventTarget: Node,\n scope: Scope,\n) {\n let matches: Interactable[] = []\n let matchElements: Element[] = []\n\n let element = eventTarget as Element\n\n function pushMatches (interactable: Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(\n interaction,\n pointer,\n event,\n matches,\n matchElements,\n eventTarget,\n scope,\n )\n\n if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = domUtils.parentNode(element) as Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interaction,\n {\n action,\n interactable,\n element,\n }: {\n action: ActionProps\n interactable: Interactable\n element: Element\n },\n scope: Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name ? interactable.getRect(element) : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n scope: 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)) {\n return false\n }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) {\n continue\n }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) {\n continue\n }\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: Scope) {\n if (is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Element, cursor: string, scope: 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: Interaction, scope: 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 = interactable.options[prepared.name].cursorChecker\n\n if (is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n } else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Plugin = {\n id: 'auto-start/base',\n before: ['actions'],\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}\n\nexport default autoStart\n" + ], + "mappings": "UAWYA,MAAc,mCACnBC,MAAY,iCACZC,MAAQ,2CACNC,MAAkB,8BAGpB,+BACAC,MAAyB,wBAkKhC,SAASC,EACPC,EACAC,EACAC,EACAC,EACAC,GAEA,OACEH,EAAaI,gBAAgBJ,EAAaK,QAAQN,EAAOO,MAAOL,EAASC,IACzEF,EAAaK,QAAQN,EAAOO,MAAMC,SAClCC,EAAuBR,EAAcC,EAASF,EAAQI,GAE/CJ,EAGF,KAGT,SAASU,EACPC,EACAC,EACAC,EACAC,EACAC,EACAZ,EACAC,GAEA,IAAK,IAAIY,EAAI,EAAGC,EAAMH,EAAQI,OAAQF,EAAIC,EAAKD,IAAK,CAClD,MAAMG,EAAQL,EAAQE,GAChBI,EAAeL,EAAcC,GAC7BK,EAAcF,EAAMG,UAAUV,EAASC,EAAOF,EAAaS,GAEjE,IAAKC,EACH,SAGF,MAAMrB,EAASD,EAA2BsB,EAAaF,EAAOC,EAAcjB,EAAaC,GAEzF,GAAIJ,EACF,MAAO,CACLA,SACAC,aAAckB,EACdjB,QAASkB,GAKf,MAAO,CAAEpB,OAAQ,KAAMC,aAAc,KAAMC,QAAS,MAGtD,SAASqB,EACPZ,EACAC,EACAC,EACAV,EACAC,GAEA,IAAIU,EAA0B,GAC1BC,EAA2B,GAE3Bb,EAAUC,EAEd,SAASqB,EAAavB,GACpBa,EAAQW,KAAKxB,GACbc,EAAcU,KAAKvB,GAGrB,KAAON,EAAGM,QAAQA,IAAU,CAC1BY,EAAU,GACVC,EAAgB,GAEhBX,EAAMsB,c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.d.ts b/packages/@interactjs/auto-start/dragAxis.d.ts new file mode 100644 index 000000000..ad8325e35 --- /dev/null +++ b/packages/@interactjs/auto-start/dragAxis.d.ts @@ -0,0 +1,9 @@ +import type { SignalArgs, Scope } from '@interactjs/core/scope'; +declare function beforeStart({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: Scope): void; +declare const _default: { + id: string; + listeners: { + 'autoStart:before-start': typeof beforeStart; + }; +}; +export default _default; diff --git a/packages/@interactjs/auto-start/dragAxis.js b/packages/@interactjs/auto-start/dragAxis.js new file mode 100644 index 000000000..b03c1875d --- /dev/null +++ b/packages/@interactjs/auto-start/dragAxis.js @@ -0,0 +1,73 @@ +import { parentNode } from "../utils/domUtils.js"; +import is from "../utils/is.js"; +import autoStart from './base'; + +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/packages/@interactjs/auto-start/dragAxis.js.map b/packages/@interactjs/auto-start/dragAxis.js.map new file mode 100644 index 000000000..cd01842cc --- /dev/null +++ b/packages/@interactjs/auto-start/dragAxis.js.map @@ -0,0 +1,50 @@ +{ + "version": 3, + "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" + ], + "sources": [ + "dragAxis.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { SignalArgs, Scope } from '@interactjs/core/scope'\nimport type { ActionName, Element } from '@interactjs/core/types'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\n\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: 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 =\n 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 as Interaction).prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Element\n\n const getDraggable = function (interactable: Interactable): Interactable | void {\n if (interactable === interaction.interactable) return\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer,\n interaction.downEvent,\n interaction,\n element,\n )\n\n if (\n action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)\n ) {\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 as Interaction).prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interactable) {\n if (!interactable) {\n return false\n }\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" + ], + "mappings": "AAIA,SAASA,UAAT,QAA2B,sBAA3B;AACA,OAAOC,EAAP,MAAe,gBAAf;AAEA,OAAOC,SAAP,MAAsB,QAAtB;;AAEA,SAASC,WAAT,CAAsB;EAAEC,WAAF;EAAeC,WAAf;EAA4BC,EAA5B;EAAgCC;AAAhC,CAAtB,EAA6FC,KAA7F,EAA2G;EACzG,IAAIJ,WAAW,CAACK,QAAZ,CAAqBC,IAArB,KAA8B,MAAlC,EAA0C,OAD+D,CAGzG;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MADhB,IAEAqB,cAAc,CAACX,WAAD,EAAcJ,YAAd,CAFd,IAGAd,SAAS,CAAC8B,cAAV,CAAyBL,MAAzB,EAAiCX,YAAjC,EAA+CO,OAA/C,EAAwDlB,WAAxD,EAAqEG,KAArE,CAJF,EAKE;UACA,OAAOQ,YAAP;QACD;MACF;IACF,CAtBD,CAP2E,CA+B3E;;;IACA,OAAOf,EAAE,CAACsB,OAAH,CAAWA,OAAX,CAAP,EAA4B;MAC1B,MAAMP,YAAY,GAAGR,KAAK,CAACyB,aAAN,CAAoBC,YAApB,CAAiCX,OAAjC,EAA0CC,YAA1C,CAArB;;MAEA,IAAIR,YAAJ,EAAkB;QAChB;QAAEZ,WAAD,CAAyCK,QAAzC,CAAkDC,IAAlD,GAAyD,MAAzD;QACDN,WAAW,CAACY,YAAZ,GAA2BA,YAA3B;QACAZ,WAAW,CAACmB,OAAZ,GAAsBA,OAAtB;QACA;MACD;;MAEDA,OAAO,GAAGvB,UAAU,CAACuB,OAAD,CAApB;IACD;EACF;AACF;;AAED,SAASQ,cAAT,CAAyBZ,SAAzB,EAA4CH,YAA5C,EAAwE;EACtE,IAAI,CAACA,YAAL,EAAmB;IACjB,OAAO,KAAP;EACD;;EAED,MAAMmB,QAAQ,GAAGnB,YAAY,CAACC,OAAb,CAAqBC,IAArB,CAA0BC,SAA3C;EAEA,OAAOA,SAAS,KAAK,IAAd,IAAsBgB,QAAQ,KAAK,IAAnC,IAA2CA,QAAQ,KAAKhB,SAA/D;AACD;;AAED,eAAe;EACbiB,EAAE,EAAE,qBADS;EAEbC,SAAS,EAAE;IAAE,0BAA0BlC;EAA5B;AAFE,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/dragAxis.prod.js b/packages/@interactjs/auto-start/dragAxis.prod.js new file mode 100644 index 000000000..0e7d92111 --- /dev/null +++ b/packages/@interactjs/auto-start/dragAxis.prod.js @@ -0,0 +1,2 @@ +import{parentNode as t}from"../utils/domUtils.prod.js";import r from"../utils/is.prod.js";import e from"./base";export default{id:"auto-start/dragAxis",listeners:{"autoStart:before-start"({interaction:a,eventTarget:n,dx:o,dy:i},s){if("drag"!==a.prepared.name)return;const d=Math.abs(o),l=Math.abs(i),c=a.interactable.options.drag,p=c.startAxis,f=d>l?"x":d{if(t===a.interactable)return;const r=a.interactable.options.drag;if(!r.manualStart&&t.testIgnoreAllow(r,o,n)){const r=t.getAction(a.downPointer,a.downEvent,a,o);if(r&&"drag"===r.name&&((t,r)=>{if(!r)return!1;const e=r.options.drag.startAxis;return"xy"===t||"xy"===e||e===t})(f,t)&&e.validateAction(r,t,o,n,s))return t}};for(;r.element(o);){const r=s.interactables.forEachMatch(o,i);if(r){a.prepared.name="drag",a.interactable=r,a.element=o;break}o=t(o)}}}}}; +//# sourceMappingURL=dragAxis.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/dragAxis.prod.js.map b/packages/@interactjs/auto-start/dragAxis.prod.js.map new file mode 100644 index 000000000..46dd6f920 --- /dev/null +++ b/packages/@interactjs/auto-start/dragAxis.prod.js.map @@ -0,0 +1,49 @@ +{ + "version": 3, + "names": [ + "parentNode", + "is", + "autoStart", + "id", + "listeners", + "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", + "thisAxis", + "checkStartAxis", + "validateAction", + "interactables", + "forEachMatch" + ], + "sources": [ + "dragAxis.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { SignalArgs, Scope } from '@interactjs/core/scope'\nimport type { ActionName, Element } from '@interactjs/core/types'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\n\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: 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 =\n 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 as Interaction).prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Element\n\n const getDraggable = function (interactable: Interactable): Interactable | void {\n if (interactable === interaction.interactable) return\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer,\n interaction.downEvent,\n interaction,\n element,\n )\n\n if (\n action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)\n ) {\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 as Interaction).prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interactable) {\n if (!interactable) {\n return false\n }\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" + ], + "mappings": "qBAISA,MAAkB,mCACpBC,MAAQ,6BAERC,MAAe,uBA2EP,CACbC,GAAI,sBACJ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 No newline at end of file diff --git a/packages/@interactjs/auto-start/hold.d.ts b/packages/@interactjs/auto-start/hold.d.ts new file mode 100644 index 000000000..36a73261d --- /dev/null +++ b/packages/@interactjs/auto-start/hold.d.ts @@ -0,0 +1,15 @@ +import type { Plugin } from '@interactjs/core/scope'; +import './base'; +declare module '@interactjs/core/options' { + interface PerActionDefaults { + hold?: number; + delay?: number; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + autoStartHoldTimer?: any; + } +} +declare const hold: Plugin; +export default hold; diff --git a/packages/@interactjs/auto-start/hold.js b/packages/@interactjs/auto-start/hold.js new file mode 100644 index 000000000..9f1c96d36 --- /dev/null +++ b/packages/@interactjs/auto-start/hold.js @@ -0,0 +1,69 @@ +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ +import './base'; +import basePlugin from './base'; +/* eslint-enable */ + +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; +} + +const hold = { + 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.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) { + clearTimeout(interaction.autoStartHoldTimer); + interaction.autoStartHoldTimer = null; + } + }, + // prevent regular down->move autoStart + 'autoStart:before-start': ({ + interaction + }) => { + const holdDuration = getHoldDuration(interaction); + + if (holdDuration > 0) { + interaction.prepared.name = null; + } + } + }, + getHoldDuration +}; +export default hold; +//# sourceMappingURL=hold.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/hold.js.map b/packages/@interactjs/auto-start/hold.js.map new file mode 100644 index 000000000..034bb74dd --- /dev/null +++ b/packages/@interactjs/auto-start/hold.js.map @@ -0,0 +1,37 @@ +{ + "version": 3, + "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", + "holdDuration" + ], + "sources": [ + "hold.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable */\n\ndeclare module '@interactjs/core/options' {\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: Scope) {\n const { defaults } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction: Interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) {\n return null\n }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nconst hold: Plugin = {\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.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n interaction.autoStartHoldTimer = null\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const holdDuration = getHoldDuration(interaction)\n\n if (holdDuration > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\nexport default hold\n" + ], + "mappings": "AAGA;AACA,OAAO,QAAP;AACA,OAAOA,UAAP,MAAuB,QAAvB;AACA;;AAeA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IAAEC;EAAF,IAAeD,KAArB;EAEAA,KAAK,CAACE,SAAN,CAAgBJ,UAAhB;EAEAG,QAAQ,CAACE,SAAT,CAAmBC,IAAnB,GAA0B,CAA1B;EACAH,QAAQ,CAACE,SAAT,CAAmBE,KAAnB,GAA2B,CAA3B;AACD;;AAED,SAASC,eAAT,CAA0BC,WAA1B,EAAoD;EAClD,MAAMC,UAAU,GAAGD,WAAW,CAACE,QAAZ,IAAwBF,WAAW,CAACE,QAAZ,CAAqBC,IAAhE;;EAEA,IAAI,CAACF,UAAL,EAAiB;IACf,OAAO,IAAP;EACD;;EAED,MAAMG,OAAO,GAAGJ,WAAW,CAACK,YAAZ,CAAyBD,OAAzC;EAEA,OAAOA,OAAO,CAACH,UAAD,CAAP,CAAoBJ,IAApB,IAA4BO,OAAO,CAACH,UAAD,CAAP,CAAoBH,KAAvD;AACD;;AAED,MAAMD,IAAY,GAAG;EACnBS,EAAE,EAAE,iBADe;EAEnBd,OAFmB;EAGnBe,SAAS,EAAE;IACT,oBAAoB,CAAC;MAAEP;IAAF,CAAD,KAAqB;MACvCA,WAAW,CAACQ,kBAAZ,GAAiC,IAAjC;IACD,CAHQ;IAKT,sBAAsB,CAAC;MAAER;IAAF,CAAD,KAAqB;MACzC,MAAMH,IAAI,GAAGE,eAAe,CAACC,WAAD,CAA5B;;MAEA,IAAIH,IAAI,GAAG,CAAX,EAAc;QACZG,WAAW,CAACQ,kBAAZ,GAAiCC,UAAU,CAAC,MAAM;UAChDT,WAAW,CAACU,KAAZ,CAAkBV,WAAW,CAACE,QAA9B,EAAwCF,WAAW,CAACK,YAApD,EAAkEL,WAAW,CAACW,OAA9E;QACD,CAF0C,EAExCd,IAFwC,CAA3C;MAGD;IACF,CAbQ;IAeT,qBAAqB,CAAC;MAAEG,WAAF;MAAeY;IAAf,CAAD,KAAgC;MACnD,IAAIZ,WAAW,CAACQ,kBAAZ,IAAkCR,WAAW,CAACa,eAA9C,IAAiE,CAACD,SAAtE,EAAiF;QAC/EE,YAAY,CAACd,WAAW,CAACQ,kBAAb,CAAZ;QACAR,WAAW,CAACQ,kBAAZ,GAAiC,IAAjC;MACD;IACF,CApBQ;IAsBT;IACA,0BAA0B,CAAC;MAAER;IAAF,CAAD,KAAqB;MAC7C,MAAMe,YAAY,GAAGhB,eAAe,CAACC,WAAD,CAApC;;MAEA,IAAIe,YAAY,GAAG,CAAnB,EAAsB;QACpBf,WAAW,CAACE,QAAZ,CAAqBC,IAArB,GAA4B,IAA5B;MACD;IACF;EA7BQ,CAHQ;EAkCnBJ;AAlCmB,CAArB;AAoCA,eAAeF,IAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/hold.prod.js b/packages/@interactjs/auto-start/hold.prod.js new file mode 100644 index 000000000..5cdf9d023 --- /dev/null +++ b/packages/@interactjs/auto-start/hold.prod.js @@ -0,0 +1,2 @@ +import"./base";import t from"./base";function e(t){const e=t.prepared&&t.prepared.name;if(!e)return null;const r=t.interactable.options;return r[e].hold||r[e].delay}const r={id:"auto-start/hold",install(e){const{defaults:r}=e;e.usePlugin(t),r.perAction.hold=0,r.perAction.delay=0},listeners:{"interactions:new"({interaction:t}){t.autoStartHoldTimer=null},"autoStart:prepared"({interaction:t}){const r=e(t);r>0&&(t.autoStartHoldTimer=setTimeout((()=>{t.start(t.prepared,t.interactable,t.element)}),r))},"interactions:move"({interaction:t,duplicate:e}){t.autoStartHoldTimer&&t.pointerWasMoved&&!e&&(clearTimeout(t.autoStartHoldTimer),t.autoStartHoldTimer=null)},"autoStart:before-start"({interaction:t}){e(t)>0&&(t.prepared.name=null)}},getHoldDuration:e};export default r; +//# sourceMappingURL=hold.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/hold.prod.js.map b/packages/@interactjs/auto-start/hold.prod.js.map new file mode 100644 index 000000000..1a665d8d5 --- /dev/null +++ b/packages/@interactjs/auto-start/hold.prod.js.map @@ -0,0 +1,36 @@ +{ + "version": 3, + "names": [ + "basePlugin", + "getHoldDuration", + "interaction", + "actionName", + "prepared", + "name", + "options", + "interactable", + "hold", + "delay", + "id", + "install", + "scope", + "defaults", + "usePlugin", + "perAction", + "listeners", + "autoStartHoldTimer", + "setTimeout", + "start", + "element", + "duplicate", + "pointerWasMoved", + "clearTimeout" + ], + "sources": [ + "hold.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable */\n\ndeclare module '@interactjs/core/options' {\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: Scope) {\n const { defaults } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction: Interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) {\n return null\n }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nconst hold: Plugin = {\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.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n interaction.autoStartHoldTimer = null\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const holdDuration = getHoldDuration(interaction)\n\n if (holdDuration > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\nexport default hold\n" + ], + "mappings": "MAIO,gBACAA,MAAgB,SAyBvB,SAASC,EAAiBC,GACxB,MAAMC,EAAaD,EAAYE,UAAYF,EAAYE,SAASC,KAEhE,IAAKF,EACH,OAAO,KAGT,MAAMG,EAAUJ,EAAYK,aAAaD,QAEzC,OAAOA,EAAQH,GAAYK,MAAQF,EAAQH,GAAYM,MAGzD,MAAMD,EAAe,CACnBE,GAAI,kBACJC,QAvBgBC,GAChB,MAAMC,SAAEA,GAAaD,EAErBA,EAAME,UAAUd,GAEhBa,EAASE,UAAUP,KAAO,EAC1BK,EAASE,UAAUN,MAAQ,GAkB3BO,UAAW,CACT,oBAAuBd,gBACrBA,EAAYe,mBAAqB,MAGnC,sBAAyBf,gBACvB,MAAMM,EAAOP,EAAgBC,GAEzBM,EAAO,IACTN,EAAYe,mBAAqBC,YAAW,KAC1ChB,EAAYiB,MAAMjB,EAAYE,SAAUF,EAAYK,aAAcL,EAAYkB,WAC7EZ,KAIP,qBAAwBN,cAAamB,cAC/BnB,EAAYe,oBAAsBf,EAAYoB,kBAAoBD,IACpEE,aAAarB,EAAYe,oBACzBf,EAAYe,mBAAqB,OAKrC,0BAA6Bf,gBACND,EAAgBC,GAElB,IACjBA,EAAYE,SAASC,KAAO,QAIlCJ,kCAEaO" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/index.d.ts b/packages/@interactjs/auto-start/index.d.ts new file mode 100644 index 000000000..1eefb5855 --- /dev/null +++ b/packages/@interactjs/auto-start/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/auto-start/plugin'; diff --git a/packages/@interactjs/auto-start/index.js b/packages/@interactjs/auto-start/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/auto-start/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/index.js.map b/packages/@interactjs/auto-start/index.js.map new file mode 100644 index 000000000..52f369127 --- /dev/null +++ b/packages/@interactjs/auto-start/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/auto-start/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/auto-start/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/index.prod.js b/packages/@interactjs/auto-start/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/auto-start/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/index.prod.js.map b/packages/@interactjs/auto-start/index.prod.js.map new file mode 100644 index 000000000..81a453143 --- /dev/null +++ b/packages/@interactjs/auto-start/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/auto-start/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/auto-start/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/index.ts b/packages/@interactjs/auto-start/index.ts new file mode 100644 index 000000000..dfd657d3d --- /dev/null +++ b/packages/@interactjs/auto-start/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/auto-start/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/auto-start/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/auto-start/plugin.d.ts b/packages/@interactjs/auto-start/plugin.d.ts new file mode 100644 index 000000000..6e69b8285 --- /dev/null +++ b/packages/@interactjs/auto-start/plugin.d.ts @@ -0,0 +1,9 @@ +import type { Scope } from '@interactjs/core/scope'; +import './base'; +import './dragAxis'; +import './hold'; +declare const _default: { + id: string; + install(scope: Scope): void; +}; +export default _default; diff --git a/packages/@interactjs/auto-start/plugin.js b/packages/@interactjs/auto-start/plugin.js new file mode 100644 index 000000000..2c755ef8e --- /dev/null +++ b/packages/@interactjs/auto-start/plugin.js @@ -0,0 +1,20 @@ +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ +import './base'; +import './dragAxis'; +import './hold'; +import autoStart from './base'; +import dragAxis from './dragAxis'; +import hold from './hold'; +/* eslint-enable import/no-duplicates */ + +export default { + id: 'auto-start', + + install(scope) { + scope.usePlugin(autoStart); + scope.usePlugin(hold); + scope.usePlugin(dragAxis); + } + +}; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/plugin.js.map b/packages/@interactjs/auto-start/plugin.js.map new file mode 100644 index 000000000..a4c84e90f --- /dev/null +++ b/packages/@interactjs/auto-start/plugin.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "names": [ + "autoStart", + "dragAxis", + "hold", + "id", + "install", + "scope", + "usePlugin" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './dragAxis'\nimport './hold'\n\nimport autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'auto-start',\n install (scope: Scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n },\n}\n" + ], + "mappings": "AAEA;AACA,OAAO,QAAP;AACA,OAAO,YAAP;AACA,OAAO,QAAP;AAEA,OAAOA,SAAP,MAAsB,QAAtB;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA;;AAEA,eAAe;EACbC,EAAE,EAAE,YADS;;EAEbC,OAAO,CAAEC,KAAF,EAAgB;IACrBA,KAAK,CAACC,SAAN,CAAgBN,SAAhB;IACAK,KAAK,CAACC,SAAN,CAAgBJ,IAAhB;IACAG,KAAK,CAACC,SAAN,CAAgBL,QAAhB;EACD;;AANY,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/auto-start/plugin.prod.js b/packages/@interactjs/auto-start/plugin.prod.js new file mode 100644 index 000000000..1407fb15b --- /dev/null +++ b/packages/@interactjs/auto-start/plugin.prod.js @@ -0,0 +1,2 @@ +import"./base";import"./dragAxis";import"./hold";import i from"./base";import o from"./dragAxis";import r from"./hold";export default{id:"auto-start",install(t){t.usePlugin(i),t.usePlugin(r),t.usePlugin(o)}}; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/auto-start/plugin.prod.js.map b/packages/@interactjs/auto-start/plugin.prod.js.map new file mode 100644 index 000000000..e69a5dff2 --- /dev/null +++ b/packages/@interactjs/auto-start/plugin.prod.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "names": [ + "autoStart", + "dragAxis", + "hold", + "id", + "install", + "scope", + "usePlugin" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './dragAxis'\nimport './hold'\n\nimport autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'auto-start',\n install (scope: Scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n },\n}\n" + ], + "mappings": "MAGO,eACA,mBACA,gBAEAA,MAAe,gBACfC,MAAc,oBACdC,MAAU,uBAGF,CACbC,GAAI,aACJC,QAASC,GACPA,EAAMC,UAAUN,GAChBK,EAAMC,UAAUJ,GAChBG,EAAMC,UAAUL" +} \ No newline at end of file diff --git a/packages/@interactjs/core/.npmignore b/packages/@interactjs/core/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/core/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/core/BaseEvent.d.ts b/packages/@interactjs/core/BaseEvent.d.ts new file mode 100644 index 000000000..a58725697 --- /dev/null +++ b/packages/@interactjs/core/BaseEvent.d.ts @@ -0,0 +1,26 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'; +import type { ActionName } from '@interactjs/core/types'; +export declare class BaseEvent { + type: string; + target: EventTarget; + currentTarget: Node; + interactable: Interactable; + _interaction: Interaction; + timeStamp: number; + immediatePropagationStopped: boolean; + propagationStopped: boolean; + constructor(interaction: 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 interface BaseEvent { + interaction: InteractionProxy; +} diff --git a/packages/@interactjs/core/BaseEvent.js b/packages/@interactjs/core/BaseEvent.js new file mode 100644 index 000000000..dff1e1782 --- /dev/null +++ b/packages/@interactjs/core/BaseEvent.js @@ -0,0 +1,40 @@ +export class BaseEvent { + immediatePropagationStopped = false; + propagationStopped = false; + + constructor(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; + } + +} // defined outside of class definition to avoid assignment of undefined during +// construction + +// getters and setters defined here to support typescript 3.6 and below which +// don't support getter and setters in .d.ts files +Object.defineProperty(BaseEvent.prototype, 'interaction', { + get() { + return this._interaction._proxy; + }, + + set() {} + +}); +//# sourceMappingURL=BaseEvent.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/BaseEvent.js.map b/packages/@interactjs/core/BaseEvent.js.map new file mode 100644 index 000000000..555188405 --- /dev/null +++ b/packages/@interactjs/core/BaseEvent.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "BaseEvent", + "immediatePropagationStopped", + "propagationStopped", + "constructor", + "interaction", + "_interaction", + "preventDefault", + "stopPropagation", + "stopImmediatePropagation", + "Object", + "defineProperty", + "prototype", + "get", + "_proxy", + "set" + ], + "sources": [ + "BaseEvent.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName } from '@interactjs/core/types'\n\nexport class BaseEvent {\n declare type: string\n declare target: EventTarget\n declare currentTarget: Node\n declare interactable: Interactable\n declare _interaction: Interaction\n declare timeStamp: number\n immediatePropagationStopped = false\n propagationStopped = false\n\n constructor (interaction: 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\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface BaseEvent {\n interaction: InteractionProxy\n}\n\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperty(BaseEvent.prototype, 'interaction', {\n get (this: BaseEvent) {\n return this._interaction._proxy\n },\n set (this: BaseEvent) {},\n})\n" + ], + "mappings": "AAIA,OAAO,MAAMA,SAAN,CAAqD;EAO1DC,2BAA2B,GAAG,KAAH;EAC3BC,kBAAkB,GAAG,KAAH;;EAElBC,WAAW,CAAEC,WAAF,EAA+B;IACxC,KAAKC,YAAL,GAAoBD,WAApB;EACD;;EAEDE,cAAc,GAAI,CAAE;EAEpB;AACF;AACA;;;EACEC,eAAe,GAAI;IACjB,KAAKL,kBAAL,GAA0B,IAA1B;EACD;EAED;AACF;AACA;;;EACEM,wBAAwB,GAAI;IAC1B,KAAKP,2BAAL,GAAmC,KAAKC,kBAAL,GAA0B,IAA7D;EACD;;AA5ByD,C,CA+B5D;AACA;;AAKA;AACA;AACAO,MAAM,CAACC,cAAP,CAAsBV,SAAS,CAACW,SAAhC,EAA2C,aAA3C,EAA0D;EACxDC,GAAG,GAAmB;IACpB,OAAO,KAAKP,YAAL,CAAkBQ,MAAzB;EACD,CAHuD;;EAIxDC,GAAG,GAAmB,CAAE;;AAJgC,CAA1D" +} \ No newline at end of file diff --git a/packages/@interactjs/core/BaseEvent.prod.js b/packages/@interactjs/core/BaseEvent.prod.js new file mode 100644 index 000000000..270c850fe --- /dev/null +++ b/packages/@interactjs/core/BaseEvent.prod.js @@ -0,0 +1,2 @@ +export class BaseEvent{immediatePropagationStopped=!1;propagationStopped=!1;constructor(t){this._interaction=t}preventDefault(){}stopPropagation(){this.propagationStopped=!0}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}}Object.defineProperty(BaseEvent.prototype,"interaction",{get(){return this._interaction._proxy},set(){}}); +//# sourceMappingURL=BaseEvent.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/BaseEvent.prod.js.map b/packages/@interactjs/core/BaseEvent.prod.js.map new file mode 100644 index 000000000..fd7824a7b --- /dev/null +++ b/packages/@interactjs/core/BaseEvent.prod.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "names": [ + "BaseEvent", + "immediatePropagationStopped", + "propagationStopped", + "constructor", + "interaction", + "this", + "_interaction", + "preventDefault", + "stopPropagation", + "stopImmediatePropagation", + "Object", + "defineProperty", + "prototype", + "get", + "_proxy", + "set" + ], + "sources": [ + "BaseEvent.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName } from '@interactjs/core/types'\n\nexport class BaseEvent {\n declare type: string\n declare target: EventTarget\n declare currentTarget: Node\n declare interactable: Interactable\n declare _interaction: Interaction\n declare timeStamp: number\n immediatePropagationStopped = false\n propagationStopped = false\n\n constructor (interaction: 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\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface BaseEvent {\n interaction: InteractionProxy\n}\n\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperty(BaseEvent.prototype, 'interaction', {\n get (this: BaseEvent) {\n return this._interaction._proxy\n },\n set (this: BaseEvent) {},\n})\n" + ], + "mappings": "OAIO,MAAMA,UAOXC,6BAA8B,EAC9BC,oBAAqB,EAErBC,YAAaC,GACXC,KAAKC,aAAeF,EAGtBG,kBAKAC,kBACEH,KAAKH,oBAAqB,EAM5BO,2BACEJ,KAAKJ,4BAA8BI,KAAKH,oBAAqB,GAYjEQ,OAAOC,eAAeX,UAAUY,UAAW,cAAe,CACxDC,MACE,OAAOR,KAAKC,aAAaQ,QAE3BC" +} \ No newline at end of file diff --git a/packages/@interactjs/core/Eventable.d.ts b/packages/@interactjs/core/Eventable.d.ts new file mode 100644 index 000000000..0008a721f --- /dev/null +++ b/packages/@interactjs/core/Eventable.d.ts @@ -0,0 +1,19 @@ +import type { ListenersArg, Rect } from '@interactjs/core/types'; +import type { NormalizedListeners } from '@interactjs/utils/normalizeListeners'; +export declare class Eventable { + options: any; + types: NormalizedListeners; + propagationStopped: boolean; + immediatePropagationStopped: boolean; + global: any; + constructor(options?: { + [index: string]: any; + }); + fire(event: T): void; + on(type: string, listener: ListenersArg): void; + off(type: string, listener: ListenersArg): void; + getRect(_element: Element): Rect; +} diff --git a/packages/@interactjs/core/Eventable.js b/packages/@interactjs/core/Eventable.js new file mode 100644 index 000000000..42579aa1b --- /dev/null +++ b/packages/@interactjs/core/Eventable.js @@ -0,0 +1,74 @@ +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); + } +} + +export class Eventable { + options; + types = {}; + propagationStopped = false; + immediatePropagationStopped = false; + global; + + constructor(options) { + 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; + } + +} +//# sourceMappingURL=Eventable.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/Eventable.js.map b/packages/@interactjs/core/Eventable.js.map new file mode 100644 index 000000000..38788c83a --- /dev/null +++ b/packages/@interactjs/core/Eventable.js.map @@ -0,0 +1,39 @@ +{ + "version": 3, + "names": [ + "arr", + "extend", + "normalize", + "fireUntilImmediateStopped", + "event", + "listeners", + "listener", + "immediatePropagationStopped", + "Eventable", + "options", + "types", + "propagationStopped", + "global", + "constructor", + "fire", + "type", + "on", + "merge", + "off", + "eventList", + "length", + "subListener", + "index", + "indexOf", + "splice", + "getRect", + "_element" + ], + "sources": [ + "Eventable.ts" + ], + "sourcesContent": [ + "import type { Listener, ListenersArg, Rect } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport type { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\nimport normalize from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped (event: any, listeners: Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) {\n break\n }\n\n listener(event)\n }\n}\n\nexport class 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: T) {\n let listeners: Listener[]\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: 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: 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) {\n continue\n }\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: Element): Rect {\n return null\n }\n}\n" + ], + "mappings": "AACA,OAAO,KAAKA,GAAZ,MAAqB,iBAArB;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AAEA,OAAOC,SAAP,MAAsB,gCAAtB;;AAEA,SAASC,yBAAT,CAAoCC,KAApC,EAAgDC,SAAhD,EAAuE;EACrE,KAAK,MAAMC,QAAX,IAAuBD,SAAvB,EAAkC;IAChC,IAAID,KAAK,CAACG,2BAAV,EAAuC;MACrC;IACD;;IAEDD,QAAQ,CAACF,KAAD,CAAR;EACD;AACF;;AAED,OAAO,MAAMI,SAAN,CAAgB;EACrBC,OAAO;EACPC,KAAK,GAAwB,EAAxB;EACLC,kBAAkB,GAAG,KAAH;EAClBJ,2BAA2B,GAAG,KAAH;EAC3BK,MAAM;;EAENC,WAAW,CAAEJ,OAAF,EAAsC;IAC/C,KAAKA,OAAL,GAAeR,MAAM,CAAC,EAAD,EAAKQ,OAAO,IAAI,EAAhB,CAArB;EACD;;EAEDK,IAAI,CAA4DV,KAA5D,EAAsE;IACxE,IAAIC,SAAJ;IACA,MAAMO,MAAM,GAAG,KAAKA,MAApB,CAFwE,CAIxE;IACA;;IACA,IAAKP,SAAS,GAAG,KAAKK,KAAL,CAAWN,KAAK,CAACW,IAAjB,CAAjB,EAA0C;MACxCZ,yBAAyB,CAACC,KAAD,EAAQC,SAAR,CAAzB;IACD,CARuE,CAUxE;;;IACA,IAAI,CAACD,KAAK,CAACO,kBAAP,IAA6BC,MAA7B,KAAwCP,SAAS,GAAGO,MAAM,CAACR,KAAK,CAACW,IAAP,CAA1D,CAAJ,EAA6E;MAC3EZ,yBAAyB,CAACC,KAAD,EAAQC,SAAR,CAAzB;IACD;EACF;;EAEDW,EAAE,CAAED,IAAF,EAAgBT,QAAhB,EAAwC;IACxC,MAAMD,SAAS,GAAGH,SAAS,CAACa,IAAD,EAAOT,QAAP,CAA3B;;IAEA,KAAKS,IAAL,IAAaV,SAAb,EAAwB;MACtB,KAAKK,KAAL,CAAWK,IAAX,IAAmBf,GAAG,CAACiB,KAAJ,CAAU,KAAKP,KAAL,CAAWK,IAAX,KAAoB,EAA9B,EAAkCV,SAAS,CAACU,IAAD,CAA3C,CAAnB;IACD;EACF;;EAEDG,GAAG,CAAEH,IAAF,EAAgBT,QAAhB,EAAwC;IACzC,MAAMD,SAAS,GAAGH,SAAS,CAACa,IAAD,EAAOT,QAAP,CAA3B;;IAEA,KAAKS,IAAL,IAAaV,SAAb,EAAwB;MACtB,MAAMc,SAAS,GAAG,KAAKT,KAAL,CAAWK,IAAX,CAAlB;;MAEA,IAAI,CAACI,SAAD,IAAc,CAACA,SAAS,CAACC,MAA7B,EAAqC;QACnC;MACD;;MAED,KAAK,MAAMC,WAAX,IAA0BhB,SAAS,CAACU,IAAD,CAAnC,EAA2C;QACzC,MAAMO,KAAK,GAAGH,SAAS,CAACI,OAAV,CAAkBF,WAAlB,CAAd;;QAEA,IAAIC,KAAK,KAAK,CAAC,CAAf,EAAkB;UAChBH,SAAS,CAACK,MAAV,CAAiBF,KAAjB,EAAwB,CAAxB;QACD;MACF;IACF;EACF;;EAEDG,OAAO,CAAEC,QAAF,EAA2B;IAChC,OAAO,IAAP;EACD;;AAzDoB" +} \ No newline at end of file diff --git a/packages/@interactjs/core/Eventable.prod.js b/packages/@interactjs/core/Eventable.prod.js new file mode 100644 index 000000000..c4a7da94d --- /dev/null +++ b/packages/@interactjs/core/Eventable.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/arr.prod.js";import o from"../utils/extend.prod.js";import e from"../utils/normalizeListeners.prod.js";function s(t,o){for(const e of o){if(t.immediatePropagationStopped)break;e(t)}}export class Eventable{options;types={};propagationStopped=!1;immediatePropagationStopped=!1;global;constructor(t){this.options=o({},t||{})}fire(t){let o;const e=this.global;(o=this.types[t.type])&&s(t,o),!t.propagationStopped&&e&&(o=e[t.type])&&s(t,o)}on(o,s){const i=e(o,s);for(o in i)this.types[o]=t.merge(this.types[o]||[],i[o])}off(t,o){const s=e(t,o);for(t in s){const o=this.types[t];if(o&&o.length)for(const e of s[t]){const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}}getRect(t){return null}} +//# sourceMappingURL=Eventable.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/Eventable.prod.js.map b/packages/@interactjs/core/Eventable.prod.js.map new file mode 100644 index 000000000..50c667573 --- /dev/null +++ b/packages/@interactjs/core/Eventable.prod.js.map @@ -0,0 +1,40 @@ +{ + "version": 3, + "names": [ + "arr", + "extend", + "normalize", + "fireUntilImmediateStopped", + "event", + "listeners", + "listener", + "immediatePropagationStopped", + "Eventable", + "options", + "types", + "propagationStopped", + "global", + "constructor", + "this", + "fire", + "type", + "on", + "merge", + "off", + "eventList", + "length", + "subListener", + "index", + "indexOf", + "splice", + "getRect", + "_element" + ], + "sources": [ + "Eventable.ts" + ], + "sourcesContent": [ + "import type { Listener, ListenersArg, Rect } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport type { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\nimport normalize from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped (event: any, listeners: Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) {\n break\n }\n\n listener(event)\n }\n}\n\nexport class 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: T) {\n let listeners: Listener[]\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: 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: 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) {\n continue\n }\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: Element): Rect {\n return null\n }\n}\n" + ], + "mappings": "UACYA,MAAS,8BACdC,MAAY,iCAEZC,MAAe,sCAEtB,SAASC,EAA2BC,EAAYC,GAC9C,IAAK,MAAMC,KAAYD,EAAW,CAChC,GAAID,EAAMG,4BACR,MAGFD,EAASF,WAIN,MAAMI,UACXC,QACAC,MAA6B,GAC7BC,oBAAqB,EACrBJ,6BAA8B,EAC9BK,OAEAC,YAAaJ,GACXK,KAAKL,QAAUR,EAAO,GAAIQ,GAAW,IAGvCM,KAAgEX,GAC9D,IAAIC,EACJ,MAAMO,EAASE,KAAKF,QAIfP,EAAYS,KAAKJ,MAAMN,EAAMY,QAChCb,EAA0BC,EAAOC,IAI9BD,EAAMO,oBAAsBC,IAAWP,EAAYO,EAAOR,EAAMY,QACnEb,EAA0BC,EAAOC,GAIrCY,GAAID,EAAcV,GAChB,MAAMD,EAAYH,EAAUc,EAAMV,GAElC,IAAKU,KAAQX,EACXS,KAAKJ,MAAMM,GAAQhB,EAAIkB,MAAMJ,KAAKJ,MAAMM,IAAS,GAAIX,EAAUW,IAInEG,IAAKH,EAAcV,GACjB,MAAMD,EAAYH,EAAUc,EAAMV,GAElC,IAAKU,KAAQX,EAAW,CACtB,MAAMe,EAAYN,KAAKJ,MAAMM,GAE7B,GAAKI,GAAcA,EAAUC,OAI7B,IAAK,MAAMC,KAAejB,EAAUW,GAAO,CACzC,MAAMO,EAAQH,EAAUI,QAAQF,IAEjB,IAAXC,GACFH,EAAUK,OAAOF,EAAO,KAMhCG,QAASC,GACP,OAAO" +} \ No newline at end of file diff --git a/packages/@interactjs/core/InteractEvent.d.ts b/packages/@interactjs/core/InteractEvent.d.ts new file mode 100644 index 000000000..eafbb52e1 --- /dev/null +++ b/packages/@interactjs/core/InteractEvent.d.ts @@ -0,0 +1,72 @@ +import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'; +import { BaseEvent } from './BaseEvent'; +import type { Interaction } from './Interaction'; +import type { ActionName } from './types'; +export declare type EventPhase = keyof PhaseMap; +export interface PhaseMap { + start: true; + move: true; + end: true; +} +export interface InteractEvent { + pageX: number; + pageY: number; + clientX: number; + clientY: number; + dx: number; + dy: number; + velocityX: number; + velocityY: number; +} +export declare class InteractEvent extends BaseEvent { + target: Element; + currentTarget: Element; + relatedTarget: Element | null; + screenX?: number; + screenY?: number; + button: number; + buttons: number; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; + page: Point; + client: Point; + delta: Point; + rect: FullRect; + x0: number; + y0: number; + t0: number; + dt: number; + duration: number; + clientX0: number; + clientY0: number; + velocity: Point; + speed: number; + swipe: ReturnType['getSwipe']>; + axes?: 'x' | 'y' | 'xy'; + preEnd?: boolean; + /** */ + constructor(interaction: Interaction, event: PointerEventType, actionName: T, phase: P, element: Element, preEnd?: boolean, type?: string); + 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; +} diff --git a/packages/@interactjs/core/InteractEvent.js b/packages/@interactjs/core/InteractEvent.js new file mode 100644 index 000000000..23f9472d0 --- /dev/null +++ b/packages/@interactjs/core/InteractEvent.js @@ -0,0 +1,233 @@ +import extend from "../utils/extend.js"; +import getOriginXY from "../utils/getOriginXY.js"; +import hypot from "../utils/hypot.js"; +import { BaseEvent } from './BaseEvent'; +import { defaults } from './options'; +export class InteractEvent extends BaseEvent { + relatedTarget = null; + screenX; + screenY; + button; + buttons; + ctrlKey; + shiftKey; + altKey; + metaKey; + page; + client; + delta; + rect; + x0; + y0; + t0; + dt; + duration; + clientX0; + clientY0; + velocity; + speed; + swipe; // resize + + axes; + preEnd; + /** */ + + constructor(interaction, event, actionName, phase, element, preEnd, type) { + super(interaction); + 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; + } + + 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; + } + +} // getters and setters defined here to support typescript 3.6 and below which +// don't support getter and setters in .d.ts files + +Object.defineProperties(InteractEvent.prototype, { + pageX: { + get() { + return this.page.x; + }, + + set(value) { + this.page.x = value; + } + + }, + pageY: { + get() { + return this.page.y; + }, + + set(value) { + this.page.y = value; + } + + }, + clientX: { + get() { + return this.client.x; + }, + + set(value) { + this.client.x = value; + } + + }, + clientY: { + get() { + return this.client.y; + }, + + set(value) { + this.client.y = value; + } + + }, + dx: { + get() { + return this.delta.x; + }, + + set(value) { + this.delta.x = value; + } + + }, + dy: { + get() { + return this.delta.y; + }, + + set(value) { + this.delta.y = value; + } + + }, + velocityX: { + get() { + return this.velocity.x; + }, + + set(value) { + this.velocity.x = value; + } + + }, + velocityY: { + get() { + return this.velocity.y; + }, + + set(value) { + this.velocity.y = value; + } + + } +}); +//# sourceMappingURL=InteractEvent.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/InteractEvent.js.map b/packages/@interactjs/core/InteractEvent.js.map new file mode 100644 index 000000000..a4ca9fbc4 --- /dev/null +++ b/packages/@interactjs/core/InteractEvent.js.map @@ -0,0 +1,98 @@ +{ + "version": 3, + "names": [ + "extend", + "getOriginXY", + "hypot", + "BaseEvent", + "defaults", + "InteractEvent", + "relatedTarget", + "screenX", + "screenY", + "button", + "buttons", + "ctrlKey", + "shiftKey", + "altKey", + "metaKey", + "page", + "client", + "delta", + "rect", + "x0", + "y0", + "t0", + "dt", + "duration", + "clientX0", + "clientY0", + "velocity", + "speed", + "swipe", + "axes", + "preEnd", + "constructor", + "interaction", + "event", + "actionName", + "phase", + "element", + "type", + "target", + "interactable", + "deltaSource", + "options", + "origin", + "starting", + "ending", + "prevEvent", + "coords", + "start", + "timeStamp", + "cur", + "x", + "y", + "currentTarget", + "pointers", + "length", + "downTime", + "getSwipe", + "_interaction", + "angle", + "Math", + "atan2", + "velocityY", + "velocityX", + "PI", + "overlap", + "left", + "up", + "right", + "down", + "preventDefault", + "stopImmediatePropagation", + "immediatePropagationStopped", + "propagationStopped", + "stopPropagation", + "Object", + "defineProperties", + "prototype", + "pageX", + "get", + "set", + "value", + "pageY", + "clientX", + "clientY", + "dx", + "dy" + ], + "sources": [ + "InteractEvent.ts" + ], + "sourcesContent": [ + "import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\n\nimport { BaseEvent } from './BaseEvent'\nimport type { Interaction } from './Interaction'\nimport { defaults } from './options'\nimport type { ActionName } from './types'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface InteractEvent {\n pageX: number\n pageY: number\n\n clientX: number\n clientY: number\n\n dx: number\n dy: number\n\n velocityX: number\n velocityY: number\n}\n\nexport class InteractEvent<\n T extends ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n declare target: Element\n declare currentTarget: Element\n relatedTarget: Element | 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: Point\n client: Point\n delta: Point\n rect: FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Point\n speed: number\n swipe: ReturnType['getSwipe']>\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: PointerEventType,\n actionName: T,\n phase: P,\n element: 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 ? interaction.pointers[interaction.pointers.length - 1].downTime : 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 } 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 getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 || 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\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperties(InteractEvent.prototype, {\n pageX: {\n get () {\n return this.page.x\n },\n set (value) {\n this.page.x = value\n },\n },\n pageY: {\n get () {\n return this.page.y\n },\n set (value) {\n this.page.y = value\n },\n },\n\n clientX: {\n get () {\n return this.client.x\n },\n set (value) {\n this.client.x = value\n },\n },\n clientY: {\n get () {\n return this.client.y\n },\n set (value) {\n this.client.y = value\n },\n },\n\n dx: {\n get () {\n return this.delta.x\n },\n set (value) {\n this.delta.x = value\n },\n },\n dy: {\n get () {\n return this.delta.y\n },\n set (value) {\n this.delta.y = value\n },\n },\n\n velocityX: {\n get () {\n return this.velocity.x\n },\n set (value) {\n this.velocity.x = value\n },\n },\n velocityY: {\n get () {\n return this.velocity.y\n },\n set (value) {\n this.velocity.y = value\n },\n },\n})\n" + ], + "mappings": "AACA,OAAOA,MAAP,MAAmB,oBAAnB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AAEA,SAASC,SAAT,QAA0B,aAA1B;AAEA,SAASC,QAAT,QAAyB,WAAzB;AA2BA,OAAO,MAAMC,aAAN,SAGGF,SAHH,CAGgB;EAGrBG,aAAa,GAAmB,IAAnB;EACbC,OAAO;EACPC,OAAO;EACPC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC,IAAI;EACJC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACLC,KAAK,CAzBgB,CA0BrB;;EACAC,IAAI;EACJC,MAAM;EAEN;;EACAC,WAAW,CACTC,WADS,EAETC,KAFS,EAGTC,UAHS,EAITC,KAJS,EAKTC,OALS,EAMTN,MANS,EAOTO,IAPS,EAQT;IACA,MAAML,WAAN;IAEAI,OAAO,GAAGA,OAAO,IAAIJ,WAAW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;IACTiB,GAAG,GAAI;MACL,OAAO,KAAKpD,QAAL,CAAcyB,CAArB;IACD,CAHQ;;IAIT4B,GAAG,CAAEC,KAAF,EAAS;MACV,KAAKtD,QAAL,CAAcyB,CAAd,GAAkB6B,KAAlB;IACD;;EANQ;AA5DoC,CAAjD" +} \ No newline at end of file diff --git a/packages/@interactjs/core/InteractEvent.prod.js b/packages/@interactjs/core/InteractEvent.prod.js new file mode 100644 index 000000000..d1fb3605c --- /dev/null +++ b/packages/@interactjs/core/InteractEvent.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/extend.prod.js";import e from"../utils/getOriginXY.prod.js";import i from"../utils/hypot.prod.js";import{BaseEvent as s}from"./BaseEvent";import{defaults as r}from"./options";export class InteractEvent extends s{relatedTarget=null;screenX;screenY;button;buttons;ctrlKey;shiftKey;altKey;metaKey;page;client;delta;rect;x0;y0;t0;dt;duration;clientX0;clientY0;velocity;speed;swipe;axes;preEnd;constructor(s,o,n,a,p,c,l){super(s),p=p||s.element;const h=s.interactable,y=(h&&h.options||r).deltaSource,d=e(h,p,n),g="start"===a,v="end"===a,m=g?this:s.prevEvent,u=g?s.coords.start:v?{page:m.page,client:m.client,timeStamp:s.coords.cur.timeStamp}:s.coords.cur;this.page=t({},u.page),this.client=t({},u.client),this.rect=t({},s.rect),this.timeStamp=u.timeStamp,v||(this.page.x-=d.x,this.page.y-=d.y,this.client.x-=d.x,this.client.y-=d.y),this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.button=o.button,this.buttons=o.buttons,this.target=p,this.currentTarget=p,this.preEnd=c,this.type=l||n+(a||""),this.interactable=h,this.t0=g?s.pointers[s.pointers.length-1].downTime:m.t0,this.x0=s.coords.start.page.x-d.x,this.y0=s.coords.start.page.y-d.y,this.clientX0=s.coords.start.client.x-d.x,this.clientY0=s.coords.start.client.y-d.y,this.delta=g||v?{x:0,y:0}:{x:this[y].x-m[y].x,y:this[y].y-m[y].y},this.dt=s.coords.delta.timeStamp,this.duration=this.timeStamp-this.t0,this.velocity=t({},s.coords.velocity[y]),this.speed=i(this.velocity.x,this.velocity.y),this.swipe=v||"inertiastart"===a?this.getSwipe():null}getSwipe(){const t=this._interaction;if(t.prevEvent.speed<600||this.timeStamp-t.prevEvent.timeStamp>150)return null;let e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);const i=112.5<=e&&e<247.5,s=202.5<=e&&e<337.5;return{up:s,down:!s&&22.5<=e&&e<157.5,left:i,right:!i&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}preventDefault(){}stopImmediatePropagation(){this.immediatePropagationStopped=this.propagationStopped=!0}stopPropagation(){this.propagationStopped=!0}}Object.defineProperties(InteractEvent.prototype,{pageX:{get(){return this.page.x},set(t){this.page.x=t}},pageY:{get(){return this.page.y},set(t){this.page.y=t}},clientX:{get(){return this.client.x},set(t){this.client.x=t}},clientY:{get(){return this.client.y},set(t){this.client.y=t}},dx:{get(){return this.delta.x},set(t){this.delta.x=t}},dy:{get(){return this.delta.y},set(t){this.delta.y=t}},velocityX:{get(){return this.velocity.x},set(t){this.velocity.x=t}},velocityY:{get(){return this.velocity.y},set(t){this.velocity.y=t}}}); +//# sourceMappingURL=InteractEvent.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/InteractEvent.prod.js.map b/packages/@interactjs/core/InteractEvent.prod.js.map new file mode 100644 index 000000000..de96188a6 --- /dev/null +++ b/packages/@interactjs/core/InteractEvent.prod.js.map @@ -0,0 +1,99 @@ +{ + "version": 3, + "names": [ + "extend", + "getOriginXY", + "hypot", + "BaseEvent", + "defaults", + "InteractEvent", + "relatedTarget", + "screenX", + "screenY", + "button", + "buttons", + "ctrlKey", + "shiftKey", + "altKey", + "metaKey", + "page", + "client", + "delta", + "rect", + "x0", + "y0", + "t0", + "dt", + "duration", + "clientX0", + "clientY0", + "velocity", + "speed", + "swipe", + "axes", + "preEnd", + "constructor", + "interaction", + "event", + "actionName", + "phase", + "element", + "type", + "super", + "target", + "interactable", + "deltaSource", + "options", + "origin", + "starting", + "ending", + "prevEvent", + "this", + "coords", + "start", + "timeStamp", + "cur", + "x", + "y", + "currentTarget", + "pointers", + "length", + "downTime", + "getSwipe", + "_interaction", + "angle", + "Math", + "atan2", + "velocityY", + "velocityX", + "PI", + "left", + "up", + "down", + "right", + "preventDefault", + "stopImmediatePropagation", + "immediatePropagationStopped", + "propagationStopped", + "stopPropagation", + "Object", + "defineProperties", + "prototype", + "pageX", + "get", + "set", + "value", + "pageY", + "clientX", + "clientY", + "dx", + "dy" + ], + "sources": [ + "InteractEvent.ts" + ], + "sourcesContent": [ + "import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\n\nimport { BaseEvent } from './BaseEvent'\nimport type { Interaction } from './Interaction'\nimport { defaults } from './options'\nimport type { ActionName } from './types'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface InteractEvent {\n pageX: number\n pageY: number\n\n clientX: number\n clientY: number\n\n dx: number\n dy: number\n\n velocityX: number\n velocityY: number\n}\n\nexport class InteractEvent<\n T extends ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n declare target: Element\n declare currentTarget: Element\n relatedTarget: Element | 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: Point\n client: Point\n delta: Point\n rect: FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Point\n speed: number\n swipe: ReturnType['getSwipe']>\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: PointerEventType,\n actionName: T,\n phase: P,\n element: 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 ? interaction.pointers[interaction.pointers.length - 1].downTime : 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 } 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 getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 || 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\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperties(InteractEvent.prototype, {\n pageX: {\n get () {\n return this.page.x\n },\n set (value) {\n this.page.x = value\n },\n },\n pageY: {\n get () {\n return this.page.y\n },\n set (value) {\n this.page.y = value\n },\n },\n\n clientX: {\n get () {\n return this.client.x\n },\n set (value) {\n this.client.x = value\n },\n },\n clientY: {\n get () {\n return this.client.y\n },\n set (value) {\n this.client.y = value\n },\n },\n\n dx: {\n get () {\n return this.delta.x\n },\n set (value) {\n this.delta.x = value\n },\n },\n dy: {\n get () {\n return this.delta.y\n },\n set (value) {\n this.delta.y = value\n },\n },\n\n velocityX: {\n get () {\n return this.velocity.x\n },\n set (value) {\n this.velocity.x = value\n },\n },\n velocityY: {\n get () {\n return this.velocity.y\n },\n set (value) {\n this.velocity.y = value\n },\n },\n})\n" + ], + "mappings": "OACOA,MAAY,iCACZC,MAAiB,s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ff --git a/packages/@interactjs/core/InteractStatic.d.ts b/packages/@interactjs/core/InteractStatic.d.ts new file mode 100644 index 000000000..bfa0d16f6 --- /dev/null +++ b/packages/@interactjs/core/InteractStatic.d.ts @@ -0,0 +1,37 @@ +/** @module interact */ +import type { Scope, Plugin } from '@interactjs/core/scope'; +import type { EventTypes, ListenersArg, Target } from '@interactjs/core/types'; +import * as domUtils from '@interactjs/utils/domUtils'; +import * as pointerUtils from '@interactjs/utils/pointerUtils'; +import type { Interactable } from './Interactable'; +import type { Options } from './options'; +declare module '@interactjs/core/InteractStatic' { + interface InteractStatic { + (target: Target, options?: Options): Interactable; + getPointerAverage: typeof pointerUtils.pointerAverage; + getTouchBBox: typeof pointerUtils.touchBBox; + getTouchDistance: typeof pointerUtils.touchDistance; + getTouchAngle: typeof pointerUtils.touchAngle; + getElementRect: typeof domUtils.getElementRect; + getElementClientRect: typeof domUtils.getElementClientRect; + matchesSelector: typeof domUtils.matchesSelector; + closest: typeof domUtils.closest; + version: string; + use(plugin: Plugin, options?: { + [key: string]: any; + }): any; + isSet(target: Target, options?: any): boolean; + on(type: string | EventTypes, listener: ListenersArg, options?: object): any; + off(type: EventTypes, listener: any, options?: object): any; + debug(): any; + supportsTouch(): boolean; + supportsPointerEvent(): boolean; + stop(): any; + pointerMoveTolerance(newValue?: number): any; + addDocument(doc: Document, options?: object): void; + removeDocument(doc: Document): void; + } +} +declare type _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic; +export declare function createInteractStatic(scope: Scope): _InteractStatic; +export {}; diff --git a/packages/@interactjs/core/InteractStatic.js b/packages/@interactjs/core/InteractStatic.js new file mode 100644 index 000000000..05f0c77b1 --- /dev/null +++ b/packages/@interactjs/core/InteractStatic.js @@ -0,0 +1,254 @@ +/** @module interact */ +import browser from "../utils/browser.js"; +import * as domUtils from "../utils/domUtils.js"; +import is from "../utils/is.js"; +import isNonNativeEvent from "../utils/isNonNativeEvent.js"; +import { warnOnce } from "../utils/misc.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; +export function createInteractStatic(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} + */ + const interact = (target, options) => { + let interactable = scope.interactables.getExisting(target, options); + + if (!interactable) { + interactable = scope.interactables.new(target, options); + interactable.events.global = interact.globalEvents; + } + + return interactable; + }; // expose the functions used to calculate multi-touch properties + + + interact.getPointerAverage = pointerUtils.pointerAverage; + interact.getTouchBBox = pointerUtils.touchBBox; + interact.getTouchDistance = pointerUtils.touchDistance; + interact.getTouchAngle = pointerUtils.touchAngle; + interact.getElementRect = domUtils.getElementRect; + interact.getElementClientRect = domUtils.getElementClientRect; + interact.matchesSelector = domUtils.matchesSelector; + interact.closest = domUtils.closest; + interact.globalEvents = {}; // eslint-disable-next-line no-undef + + interact.version = "1.10.23"; + interact.scope = scope; + /** + * Use a plugin + * + * @alias module:interact.use + * + */ + + interact.use = function (plugin, options) { + this.scope.usePlugin(plugin, options); + return this; + }; + /** + * Check if an element or selector has been set with the {@link interact} + * function + * + * @alias module:interact.isSet + * + * @param {Target} target The Element or string being searched for + * @param {object} options + * @return {boolean} Indicates if the element or CSS selector was previously + * passed to interact + */ + + + interact.isSet = function (target, options) { + return !!this.scope.interactables.get(target, options && options.context); + }; + /** + * @deprecated + * 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 = warnOnce(function on(type, listener, options) { + if (is.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (is.array(type)) { + for (const eventType of type) { + this.on(eventType, listener, options); + } + + return this; + } + + if (is.object(type)) { + for (const prop in type) { + this.on(prop, type[prop], listener); + } + + return this; + } // if it is an InteractEvent type, add listener to globalEvents + + + if (isNonNativeEvent(type, this.scope.actions)) { + // if this type of event was never bound + if (!this.globalEvents[type]) { + this.globalEvents[type] = [listener]; + } else { + this.globalEvents[type].push(listener); + } + } // If non InteractEvent type, addEventListener to document + else { + this.scope.events.add(this.scope.document, type, listener, { + options + }); + } + + return this; + }, 'The interact.on() method is being deprecated'); + /** + * @deprecated + * 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 = warnOnce(function off(type, listener, options) { + if (is.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (is.array(type)) { + for (const eventType of type) { + this.off(eventType, listener, options); + } + + return this; + } + + if (is.object(type)) { + for (const prop in type) { + this.off(prop, type[prop], listener); + } + + return this; + } + + if (isNonNativeEvent(type, this.scope.actions)) { + let index; + + if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) { + this.globalEvents[type].splice(index, 1); + } + } else { + this.scope.events.remove(this.scope.document, type, listener, options); + } + + return this; + }, 'The interact.off() method is being deprecated'); + + interact.debug = function () { + return this.scope; + }; + /** + * @alias module:interact.supportsTouch + * + * @return {boolean} Whether or not the browser supports touch input + */ + + + interact.supportsTouch = function () { + return browser.supportsTouch; + }; + /** + * @alias module:interact.supportsPointerEvent + * + * @return {boolean} Whether or not the browser supports PointerEvents + */ + + + interact.supportsPointerEvent = function () { + return browser.supportsPointerEvent; + }; + /** + * Cancels all interactions (end events are not fired) + * + * @alias module:interact.stop + * + * @return {object} interact + */ + + + interact.stop = function () { + for (const interaction of this.scope.interactions.list) { + interaction.stop(); + } + + return this; + }; + /** + * 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 = function (newValue) { + if (is.number(newValue)) { + this.scope.interactions.pointerMoveTolerance = newValue; + return this; + } + + return this.scope.interactions.pointerMoveTolerance; + }; + + interact.addDocument = function (doc, options) { + this.scope.addDocument(doc, options); + }; + + interact.removeDocument = function (doc) { + this.scope.removeDocument(doc); + }; + + return interact; +} +//# sourceMappingURL=InteractStatic.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/InteractStatic.js.map b/packages/@interactjs/core/InteractStatic.js.map new file mode 100644 index 000000000..900616fb6 --- /dev/null +++ b/packages/@interactjs/core/InteractStatic.js.map @@ -0,0 +1,82 @@ +{ + "version": 3, + "names": [ + "browser", + "domUtils", + "is", + "isNonNativeEvent", + "warnOnce", + "pointerUtils", + "createInteractStatic", + "scope", + "interact", + "target", + "options", + "interactable", + "interactables", + "getExisting", + "new", + "events", + "global", + "globalEvents", + "getPointerAverage", + "pointerAverage", + "getTouchBBox", + "touchBBox", + "getTouchDistance", + "touchDistance", + "getTouchAngle", + "touchAngle", + "getElementRect", + "getElementClientRect", + "matchesSelector", + "closest", + "version", + "use", + "plugin", + "usePlugin", + "isSet", + "get", + "context", + "on", + "type", + "listener", + "string", + "search", + "trim", + "split", + "array", + "eventType", + "object", + "prop", + "actions", + "push", + "add", + "document", + "off", + "index", + "indexOf", + "splice", + "remove", + "debug", + "supportsTouch", + "supportsPointerEvent", + "stop", + "interaction", + "interactions", + "list", + "pointerMoveTolerance", + "newValue", + "number", + "addDocument", + "doc", + "removeDocument" + ], + "sources": [ + "InteractStatic.ts" + ], + "sourcesContent": [ + "/** @module interact */\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Context, EventTypes, Listener, ListenersArg, Target } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport { warnOnce } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { Interactable } from './Interactable'\nimport type { Options } from './options'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n (target: Target, options?: Options): Interactable\n getPointerAverage: typeof pointerUtils.pointerAverage\n getTouchBBox: typeof pointerUtils.touchBBox\n getTouchDistance: typeof pointerUtils.touchDistance\n getTouchAngle: typeof pointerUtils.touchAngle\n getElementRect: typeof domUtils.getElementRect\n getElementClientRect: typeof domUtils.getElementClientRect\n matchesSelector: typeof domUtils.matchesSelector\n closest: typeof domUtils.closest\n /** @internal */ globalEvents: any\n version: string\n /** @internal */ scope: Scope\n use(\n plugin: Plugin,\n options?: {\n [key: string]: any\n },\n ): any\n isSet(target: Target, options?: any): boolean\n on(type: string | EventTypes, listener: ListenersArg, options?: object): any\n off(type: EventTypes, listener: any, options?: object): any\n debug(): any\n supportsTouch(): boolean\n supportsPointerEvent(): boolean\n stop(): any\n pointerMoveTolerance(newValue?: number): any\n addDocument(doc: Document, options?: object): void\n removeDocument(doc: Document): void\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic\n\nexport function createInteractStatic (scope: Scope): _InteractStatic {\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 */\n const interact = ((target: Target, options: Options) => {\n let interactable = scope.interactables.getExisting(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = interact.globalEvents\n }\n\n return interactable\n }) as _InteractStatic\n\n // expose the functions used to calculate multi-touch properties\n interact.getPointerAverage = pointerUtils.pointerAverage\n interact.getTouchBBox = pointerUtils.touchBBox\n interact.getTouchDistance = pointerUtils.touchDistance\n interact.getTouchAngle = pointerUtils.touchAngle\n\n interact.getElementRect = domUtils.getElementRect\n interact.getElementClientRect = domUtils.getElementClientRect\n interact.matchesSelector = domUtils.matchesSelector\n interact.closest = domUtils.closest\n\n interact.globalEvents = {} as any\n\n // eslint-disable-next-line no-undef\n interact.version = process.env.npm_package_version\n interact.scope = scope\n /**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n */\n interact.use = function (plugin, options) {\n this.scope.usePlugin(plugin, options)\n\n return this\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 {Target} target The Element or string being searched for\n * @param {object} options\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\n interact.isSet = function (target: Target, options?: { context?: Context }): boolean {\n return !!this.scope.interactables.get(target, options && options.context)\n }\n\n /**\n * @deprecated\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 */\n interact.on = warnOnce(function on (type: string | EventTypes, listener: ListenersArg, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type as any[]) {\n this.on(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.on(prop, (type as any)[prop], listener)\n }\n\n return this\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, this.scope.actions)) {\n // if this type of event was never bound\n if (!this.globalEvents[type]) {\n this.globalEvents[type] = [listener]\n } else {\n this.globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n this.scope.events.add(this.scope.document, type, listener as Listener, { options })\n }\n\n return this\n }, 'The interact.on() method is being deprecated')\n\n /**\n * @deprecated\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 */\n interact.off = warnOnce(function off (type: EventTypes, listener: any, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type) {\n this.off(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.off(prop, type[prop], listener)\n }\n\n return this\n }\n\n if (isNonNativeEvent(type, this.scope.actions)) {\n let index: number\n\n if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {\n this.globalEvents[type].splice(index, 1)\n }\n } else {\n this.scope.events.remove(this.scope.document, type, listener, options)\n }\n\n return this\n }, 'The interact.off() method is being deprecated')\n\n interact.debug = function () {\n return this.scope\n }\n\n /**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\n interact.supportsTouch = function () {\n return browser.supportsTouch\n }\n\n /**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\n interact.supportsPointerEvent = function () {\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 */\n interact.stop = function () {\n for (const interaction of this.scope.interactions.list) {\n interaction.stop()\n }\n\n return this\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 */\n interact.pointerMoveTolerance = function (newValue?: number) {\n if (is.number(newValue)) {\n this.scope.interactions.pointerMoveTolerance = newValue\n\n return this\n }\n\n return this.scope.interactions.pointerMoveTolerance\n }\n\n interact.addDocument = function (doc: Document, options?: object) {\n this.scope.addDocument(doc, options)\n }\n\n interact.removeDocument = function (doc: Document) {\n this.scope.removeDocument(doc)\n }\n\n return interact\n}\n" + ], + "mappings": "AAAA;AAGA,OAAOA,OAAP,MAAoB,qBAApB;AACA,OAAO,KAAKC,QAAZ,MAA0B,sBAA1B;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,OAAOC,gBAAP,MAA6B,8BAA7B;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,OAAO,KAAKC,YAAZ,MAA8B,0BAA9B;AAyCA,OAAO,SAASC,oBAAT,CAA+BC,KAA/B,EAA8D;EACnE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,QAAQ,GAAI,CAACC,MAAD,EAAiBC,OAAjB,KAAsC;IACtD,IAAIC,YAAY,GAAGJ,KAAK,CAACK,aAAN,CAAoBC,WAApB,CAAgCJ,MAAhC,EAAwCC,OAAxC,CAAnB;;IAEA,IAAI,CAACC,YAAL,EAAmB;MACjBA,YAAY,GAAGJ,KAAK,CAACK,aAAN,CAAoBE,GAApB,CAAwBL,MAAxB,EAAgCC,OAAhC,CAAf;MACAC,YAAY,CAACI,MAAb,CAAoBC,MAApB,GAA6BR,QAAQ,CAACS,YAAtC;IACD;;IAED,OAAON,YAAP;EACD,CATD,CA1BmE,CAqCnE;;;EACAH,QAAQ,CAACU,iBAAT,GAA6Bb,YAAY,CAACc,cAA1C;EACAX,QAAQ,CAACY,YAAT,GAAwBf,YAAY,CAACgB,SAArC;EACAb,QAAQ,CAACc,gBAAT,GAA4BjB,YAAY,CAACkB,aAAzC;EACAf,QA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;AACA;AACA;;;EACEC,QAAQ,CAACkD,aAAT,GAAyB,YAAY;IACnC,OAAO1D,OAAO,CAAC0D,aAAf;EACD,CAFD;EAIA;AACF;AACA;AACA;AACA;;;EACElD,QAAQ,CAACmD,oBAAT,GAAgC,YAAY;IAC1C,OAAO3D,OAAO,CAAC2D,oBAAf;EACD,CAFD;EAIA;AACF;AACA;AACA;AACA;AACA;AACA;;;EACEnD,QAAQ,CAACoD,IAAT,GAAgB,YAAY;IAC1B,KAAK,MAAMC,WAAX,IAA0B,KAAKtD,KAAL,CAAWuD,YAAX,CAAwBC,IAAlD,EAAwD;MACtDF,WAAW,CAACD,IAAZ;IACD;;IAED,OAAO,IAAP;EACD,CAND;EAQA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACEpD,QAAQ,CAACwD,oBAAT,GAAgC,UAAUC,QAAV,EAA6B;IAC3D,IAAI/D,EAAE,CAACgE,MAAH,CAAUD,QAAV,CAAJ,EAAyB;MACvB,KAAK1D,KAAL,CAAWuD,YAAX,CAAwBE,oBAAxB,GAA+CC,QAA/C;MAEA,OAAO,IAAP;IACD;;IAED,OAAO,KAAK1D,KAAL,CAAWuD,YAAX,CAAwBE,oBAA/B;EACD,CARD;;EAUAxD,QAAQ,CAAC2D,WAAT,GAAuB,UAAUC,GAAV,EAAyB1D,OAAzB,EAA2C;IAChE,KAAKH,KAAL,CAAW4D,WAAX,CAAuBC,GAAvB,EAA4B1D,OAA5B;EACD,CAFD;;EAIAF,QAAQ,CAAC6D,cAAT,GAA0B,UAAUD,GAAV,EAAyB;IACjD,KAAK7D,KAAL,CAAW8D,cAAX,CAA0BD,GAA1B;EACD,CAFD;;EAIA,OAAO5D,QAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/core/InteractStatic.prod.js b/packages/@interactjs/core/InteractStatic.prod.js new file mode 100644 index 000000000..8debc0129 --- /dev/null +++ b/packages/@interactjs/core/InteractStatic.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/browser.prod.js";import*as e from"../utils/domUtils.prod.js";import o from"../utils/is.prod.js";import s from"../utils/isNonNativeEvent.prod.js";import{warnOnce as i}from"../utils/misc.prod.js";import*as n from"../utils/pointerUtils.prod.js";export function createInteractStatic(r){const c=(t,e)=>{let o=r.interactables.getExisting(t,e);return o||(o=r.interactables.new(t,e),o.events.global=c.globalEvents),o};return c.getPointerAverage=n.pointerAverage,c.getTouchBBox=n.touchBBox,c.getTouchDistance=n.touchDistance,c.getTouchAngle=n.touchAngle,c.getElementRect=e.getElementRect,c.getElementClientRect=e.getElementClientRect,c.matchesSelector=e.matchesSelector,c.closest=e.closest,c.globalEvents={},c.version="1.10.23",c.scope=r,c.use=function(t,e){return this.scope.usePlugin(t,e),this},c.isSet=function(t,e){return!!this.scope.interactables.get(t,e&&e.context)},c.on=i((function(t,e,i){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.on(o,e,i);return this}if(o.object(t)){for(const o in t)this.on(o,t[o],e);return this}return s(t,this.scope.actions)?this.globalEvents[t]?this.globalEvents[t].push(e):this.globalEvents[t]=[e]:this.scope.events.add(this.scope.document,t,e,{options:i}),this}),"The interact.on() method is being deprecated"),c.off=i((function(t,e,i){if(o.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),o.array(t)){for(const o of t)this.off(o,e,i);return this}if(o.object(t)){for(const o in t)this.off(o,t[o],e);return this}if(s(t,this.scope.actions)){let o;t in this.globalEvents&&-1!==(o=this.globalEvents[t].indexOf(e))&&this.globalEvents[t].splice(o,1)}else this.scope.events.remove(this.scope.document,t,e,i);return this}),"The interact.off() method is being deprecated"),c.debug=function(){return this.scope},c.supportsTouch=()=>t.supportsTouch,c.supportsPointerEvent=()=>t.supportsPointerEvent,c.stop=function(){for(const t of this.scope.interactions.list)t.stop();return this},c.pointerMoveTolerance=function(t){return o.number(t)?(this.scope.interactions.pointerMoveTolerance=t,this):this.scope.interactions.pointerMoveTolerance},c.addDocument=function(t,e){this.scope.addDocument(t,e)},c.removeDocument=function(t){this.scope.removeDocument(t)},c} +//# sourceMappingURL=InteractStatic.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/InteractStatic.prod.js.map b/packages/@interactjs/core/InteractStatic.prod.js.map new file mode 100644 index 000000000..6ea37178e --- /dev/null +++ b/packages/@interactjs/core/InteractStatic.prod.js.map @@ -0,0 +1,83 @@ +{ + "version": 3, + "names": [ + "browser", + "domUtils", + "is", + "isNonNativeEvent", + "warnOnce", + "pointerUtils", + "createInteractStatic", + "scope", + "interact", + "target", + "options", + "interactable", + "interactables", + "getExisting", + "new", + "events", + "global", + "globalEvents", + "getPointerAverage", + "pointerAverage", + "getTouchBBox", + "touchBBox", + "getTouchDistance", + "touchDistance", + "getTouchAngle", + "touchAngle", + "getElementRect", + "getElementClientRect", + "matchesSelector", + "closest", + "version", + "use", + "plugin", + "this", + "usePlugin", + "isSet", + "get", + "context", + "on", + "type", + "listener", + "string", + "search", + "trim", + "split", + "array", + "eventType", + "object", + "prop", + "actions", + "push", + "add", + "document", + "off", + "index", + "indexOf", + "splice", + "remove", + "debug", + "supportsTouch", + "supportsPointerEvent", + "stop", + "interaction", + "interactions", + "list", + "pointerMoveTolerance", + "newValue", + "number", + "addDocument", + "doc", + "removeDocument" + ], + "sources": [ + "InteractStatic.ts" + ], + "sourcesContent": [ + "/** @module interact */\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Context, EventTypes, Listener, ListenersArg, Target } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport { warnOnce } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { Interactable } from './Interactable'\nimport type { Options } from './options'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n (target: Target, options?: Options): Interactable\n getPointerAverage: typeof pointerUtils.pointerAverage\n getTouchBBox: typeof pointerUtils.touchBBox\n getTouchDistance: typeof pointerUtils.touchDistance\n getTouchAngle: typeof pointerUtils.touchAngle\n getElementRect: typeof domUtils.getElementRect\n getElementClientRect: typeof domUtils.getElementClientRect\n matchesSelector: typeof domUtils.matchesSelector\n closest: typeof domUtils.closest\n /** @internal */ globalEvents: any\n version: string\n /** @internal */ scope: Scope\n use(\n plugin: Plugin,\n options?: {\n [key: string]: any\n },\n ): any\n isSet(target: Target, options?: any): boolean\n on(type: string | EventTypes, listener: ListenersArg, options?: object): any\n off(type: EventTypes, listener: any, options?: object): any\n debug(): any\n supportsTouch(): boolean\n supportsPointerEvent(): boolean\n stop(): any\n pointerMoveTolerance(newValue?: number): any\n addDocument(doc: Document, options?: object): void\n removeDocument(doc: Document): void\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic\n\nexport function createInteractStatic (scope: Scope): _InteractStatic {\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 */\n const interact = ((target: Target, options: Options) => {\n let interactable = scope.interactables.getExisting(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = interact.globalEvents\n }\n\n return interactable\n }) as _InteractStatic\n\n // expose the functions used to calculate multi-touch properties\n interact.getPointerAverage = pointerUtils.pointerAverage\n interact.getTouchBBox = pointerUtils.touchBBox\n interact.getTouchDistance = pointerUtils.touchDistance\n interact.getTouchAngle = pointerUtils.touchAngle\n\n interact.getElementRect = domUtils.getElementRect\n interact.getElementClientRect = domUtils.getElementClientRect\n interact.matchesSelector = domUtils.matchesSelector\n interact.closest = domUtils.closest\n\n interact.globalEvents = {} as any\n\n // eslint-disable-next-line no-undef\n interact.version = process.env.npm_package_version\n interact.scope = scope\n /**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n */\n interact.use = function (plugin, options) {\n this.scope.usePlugin(plugin, options)\n\n return this\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 {Target} target The Element or string being searched for\n * @param {object} options\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\n interact.isSet = function (target: Target, options?: { context?: Context }): boolean {\n return !!this.scope.interactables.get(target, options && options.context)\n }\n\n /**\n * @deprecated\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 */\n interact.on = warnOnce(function on (type: string | EventTypes, listener: ListenersArg, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type as any[]) {\n this.on(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.on(prop, (type as any)[prop], listener)\n }\n\n return this\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, this.scope.actions)) {\n // if this type of event was never bound\n if (!this.globalEvents[type]) {\n this.globalEvents[type] = [listener]\n } else {\n this.globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n this.scope.events.add(this.scope.document, type, listener as Listener, { options })\n }\n\n return this\n }, 'The interact.on() method is being deprecated')\n\n /**\n * @deprecated\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 */\n interact.off = warnOnce(function off (type: EventTypes, listener: any, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type) {\n this.off(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.off(prop, type[prop], listener)\n }\n\n return this\n }\n\n if (isNonNativeEvent(type, this.scope.actions)) {\n let index: number\n\n if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {\n this.globalEvents[type].splice(index, 1)\n }\n } else {\n this.scope.events.remove(this.scope.document, type, listener, options)\n }\n\n return this\n }, 'The interact.off() method is being deprecated')\n\n interact.debug = function () {\n return this.scope\n }\n\n /**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\n interact.supportsTouch = function () {\n return browser.supportsTouch\n }\n\n /**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\n interact.supportsPointerEvent = function () {\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 */\n interact.stop = function () {\n for (const interaction of this.scope.interactions.list) {\n interaction.stop()\n }\n\n return this\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 */\n interact.pointerMoveTolerance = function (newValue?: number) {\n if (is.number(newValue)) {\n this.scope.interactions.pointerMoveTolerance = newValue\n\n return this\n }\n\n return this.scope.interactions.pointerMoveTolerance\n }\n\n interact.addDocument = function (doc: Document, options?: object) {\n this.scope.addDocument(doc, options)\n }\n\n interact.removeDocument = function (doc: Document) {\n this.scope.removeDocument(doc)\n }\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,OAAOD,IACZjC,KAAK1B,MAAMwD,aAAaE,qBAAuBC,EAExCjC,MAGFA,KAAK1B,MAAMwD,aAAaE,sBAGjCzD,EAAS4D,YAAc,SAAUC,EAAe3D,GAC9CuB,KAAK1B,MAAM6D,YAAYC,EAAK3D,IAG9BF,EAAS8D,eAAiB,SAAUD,GAClCpC,KAAK1B,MAAM+D,eAAeD,IAGrB7D" +} \ No newline at end of file diff --git a/packages/@interactjs/core/Interactable.d.ts b/packages/@interactjs/core/Interactable.d.ts new file mode 100644 index 000000000..b5dee0d10 --- /dev/null +++ b/packages/@interactjs/core/Interactable.d.ts @@ -0,0 +1,127 @@ +import type { Scope } from '@interactjs/core/scope'; +import type { ActionName, Actions, Context, Element, EventTypes, Listeners, ListenersArg, OrBoolean, Target } from '@interactjs/core/types'; +import { Eventable } from './Eventable'; +import type { OptionsArg, Options } from './options'; +declare type IgnoreValue = string | Element | boolean; +declare type DeltaSource = 'page' | 'client'; +declare const enum OnOffMethod { + On = 0, + Off = 1 +} +/** */ +export declare class Interactable implements Partial { + readonly options: Required; + readonly _actions: Actions; + readonly target: Target; + readonly events: Eventable; + readonly _context: Context; + readonly _win: Window; + readonly _doc: Document; + readonly _scopeEvents: Scope['events']; + /** */ + constructor(target: Target, options: any, defaultContext: Document | Element, scopeEvents: Scope['events']); + setOnEvents(actionName: ActionName, phases: NonNullable): this; + updatePerActionListeners(actionName: ActionName, prev: Listeners | undefined, cur: Listeners | undefined): void; + setPerAction(actionName: ActionName, options: 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 {Rect} The object's bounding rectangle. + */ + getRect(element: Element): Required; + /** + * 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(): (element: Element) => any | null; + rectChecker(checker: (element: Element) => any): this; + _backCompatOption(optionName: keyof 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(): DeltaSource; + deltaSource(newValue: DeltaSource): this; + /** + * Gets the selector context Node of the Interactable. The default is + * `window.document`. + * + * @return {Node} The context Node of this Interactable + */ + context(): Context; + inContext(element: Document | Node): boolean; + testIgnoreAllow(this: Interactable, options: { + ignoreFrom?: IgnoreValue; + allowFrom?: IgnoreValue; + }, targetNode: Node, eventTarget: Node): boolean; + testAllow(this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node): boolean; + testIgnore(this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node): boolean; + /** + * 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: E): this; + _onOff(method: OnOffMethod, typeArg: EventTypes, listenerArg?: ListenersArg | null, options?: any, filter?: (type: string) => boolean): 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: EventTypes, listener?: 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[] | EventTypes, listener?: ListenersArg, options?: any): this; + /** + * Reset the options of this Interactable + * + * @param {object} options The new settings to apply + * @return {object} This Interactable + */ + set(options: OptionsArg): this; + /** + * Remove this interactable from the list of interactables and remove it's + * action capabilities and event listeners + */ + unset(): void; +} +export {}; diff --git a/packages/@interactjs/core/Interactable.js b/packages/@interactjs/core/Interactable.js new file mode 100644 index 000000000..457e214b9 --- /dev/null +++ b/packages/@interactjs/core/Interactable.js @@ -0,0 +1,440 @@ +/* eslint-disable no-dupe-class-members */ +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 extend from "../utils/extend.js"; +import is from "../utils/is.js"; +import isNonNativeEvent from "../utils/isNonNativeEvent.js"; +import normalizeListeners from "../utils/normalizeListeners.js"; +import { getWindow } from "../utils/window.js"; +import { Eventable } from './Eventable'; +var OnOffMethod; +/** */ + +(function (OnOffMethod) { + OnOffMethod[OnOffMethod["On"] = 0] = "On"; + OnOffMethod[OnOffMethod["Off"] = 1] = "Off"; +})(OnOffMethod || (OnOffMethod = {})); + +export class Interactable { + /** @internal */ + get _defaults() { + return { + base: {}, + perAction: {}, + actions: {} + }; + } + + options; + _actions; + target; + events = new Eventable(); + _context; + _win; + _doc; + _scopeEvents; + /** */ + + constructor(target, options, defaultContext, scopeEvents) { + 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._scopeEvents = scopeEvents; + 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) { + var _this$_actions$map$ac; + + const actionFilter = (_this$_actions$map$ac = this._actions.map[actionName]) == null ? void 0 : _this$_actions$map$ac.filterEventType; + + const filter = type => (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions); + + if (is.array(prev) || is.object(prev)) { + this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter); + } + + if (is.array(cur) || is.object(cur)) { + this._onOff(OnOffMethod.On, actionName, cur, undefined, filter); + } + } + + 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 {Rect} 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 = element => { + const rect = extend({}, checker.apply(this, element)); + + if (!('width' in rect)) { + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + } + + return rect; + }; + + 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; + } + /** @internal */ + + + getAllElements() { + const { + target + } = this; + + if (is.string(target)) { + return Array.from(this._context.querySelectorAll(target)); + } + + if (is.func(target) && target.getAllElements) { + return target.getAllElements(); + } + + return is.element(target) ? [target] : []; + } + /** + * 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, filter) { + if (is.object(typeArg) && !is.array(typeArg)) { + options = listenerArg; + listenerArg = null; + } + + const listeners = normalizeListeners(typeArg, listenerArg, filter); + + 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 === OnOffMethod.On ? 'on' : 'off'](type, listener); + } // delegated event + else if (is.string(this.target)) { + this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](this.target, this._context, type, listener, options); + } // remove listener from this Interactable's element + else { + this._scopeEvents[method === OnOffMethod.On ? 'add' : '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, listener, options) { + return this._onOff(OnOffMethod.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(OnOffMethod.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 (setting === 'getRect') { + this.rectChecker(options.getRect); + continue; + } + + 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 + */ + + + unset() { + if (is.string(this.target)) { + // remove delegated events + for (const type in this._scopeEvents.delegatedEvents) { + const delegated = this._scopeEvents.delegatedEvents[type]; + + for (let i = delegated.length - 1; i >= 0; i--) { + const { + selector, + context, + listeners + } = delegated[i]; + + if (selector === this.target && context === this._context) { + delegated.splice(i, 1); + } + + for (let l = listeners.length - 1; l >= 0; l--) { + this._scopeEvents.removeDelegate(this.target, this._context, type, listeners[l][0], listeners[l][1]); + } + } + } + } else { + this._scopeEvents.remove(this.target, 'all'); + } + } + +} +//# sourceMappingURL=Interactable.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/Interactable.js.map b/packages/@interactjs/core/Interactable.js.map new file mode 100644 index 000000000..4930c5e7d --- /dev/null +++ b/packages/@interactjs/core/Interactable.js.map @@ -0,0 +1,133 @@ +{ + "version": 3, + "names": [ + "arr", + "browser", + "clone", + "getElementRect", + "matchesUpTo", + "nodeContains", + "trySelector", + "extend", + "is", + "isNonNativeEvent", + "normalizeListeners", + "getWindow", + "Eventable", + "OnOffMethod", + "Interactable", + "_defaults", + "base", + "perAction", + "actions", + "options", + "_actions", + "target", + "events", + "_context", + "_win", + "_doc", + "_scopeEvents", + "constructor", + "defaultContext", + "scopeEvents", + "context", + "document", + "set", + "setOnEvents", + "actionName", + "phases", + "func", + "onstart", + "on", + "onmove", + "onend", + "oninertiastart", + "updatePerActionListeners", + "prev", + "cur", + "actionFilter", + "map", + "filterEventType", + "filter", + "type", + "array", + "object", + "_onOff", + "Off", + "undefined", + "On", + "setPerAction", + "defaults", + "optionName_", + "optionName", + "actionOptions", + "optionValue", + "listeners", + "from", + "plainObject", + "enabled", + "bool", + "getRect", + "element", + "string", + "querySelector", + "rectChecker", + "checker", + "rect", + "apply", + "width", + "right", + "left", + "height", + "bottom", + "top", + "_backCompatOption", + "newValue", + "action", + "origin", + "deltaSource", + "getAllElements", + "Array", + "querySelectorAll", + "inContext", + "ownerDocument", + "testIgnoreAllow", + "targetNode", + "eventTarget", + "testIgnore", + "ignoreFrom", + "testAllow", + "allowFrom", + "fire", + "iEvent", + "method", + "typeArg", + "listenerArg", + "wheelEvent", + "listener", + "types", + "off", + "actionName_", + "methodDict", + "methodName", + "setting", + "unset", + "delegatedEvents", + "delegated", + "i", + "length", + "selector", + "splice", + "l", + "removeDelegate", + "remove" + ], + "sources": [ + "Interactable.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-dupe-class-members */\nimport type { Scope } from '@interactjs/core/scope'\nimport type {\n ActionMap,\n ActionMethod,\n ActionName,\n Actions,\n Context,\n Element,\n EventTypes,\n Listeners,\n ListenersArg,\n OrBoolean,\n Target,\n} from '@interactjs/core/types'\nimport * 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 extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'\n\ntype IgnoreValue = string | Element | boolean\ntype DeltaSource = 'page' | 'client'\n\nconst enum OnOffMethod {\n On,\n Off,\n}\n\n/** */\nexport class Interactable implements Partial {\n /** @internal */ 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: Target\n readonly events = new Eventable()\n readonly _context: Context\n readonly _win: Window\n readonly _doc: Document\n readonly _scopeEvents: Scope['events']\n\n /** */\n constructor (\n target: Target,\n options: any,\n defaultContext: Document | Element,\n scopeEvents: Scope['events'],\n ) {\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 this._scopeEvents = scopeEvents\n\n this.set(options)\n }\n\n setOnEvents (actionName: ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) {\n this.on(`${actionName}start`, phases.onstart)\n }\n if (is.func(phases.onmove)) {\n this.on(`${actionName}move`, phases.onmove)\n }\n if (is.func(phases.onend)) {\n this.on(`${actionName}end`, phases.onend)\n }\n if (is.func(phases.oninertiastart)) {\n this.on(`${actionName}inertiastart`, phases.oninertiastart)\n }\n\n return this\n }\n\n updatePerActionListeners (actionName: ActionName, prev: Listeners | undefined, cur: Listeners | undefined) {\n const actionFilter = (this._actions.map[actionName] as { filterEventType?: (type: string) => boolean })\n ?.filterEventType\n const filter = (type: string) =>\n (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions)\n\n if (is.array(prev) || is.object(prev)) {\n this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this._onOff(OnOffMethod.On, actionName, cur, undefined, filter)\n }\n }\n\n setPerAction (actionName: ActionName, options: 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 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 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\n // set anabled field to true if it exists in the defaults\n if (\n is.object(defaults.perAction[optionName]) &&\n 'enabled' in (defaults.perAction[optionName] as any)\n ) {\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 {Rect} The object's bounding rectangle.\n */\n getRect (element: Element) {\n element = element || (is.element(this.target) ? this.target : 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(): (element: Element) => any | null\n rectChecker(checker: (element: Element) => any): this\n rectChecker (checker?: (element: Element) => any) {\n if (is.func(checker)) {\n this.getRect = (element) => {\n const rect = extend({}, checker.apply(this, element))\n\n if (!(('width' in rect) as unknown)) {\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n return rect\n }\n\n return this\n }\n\n if (checker === null) {\n delete (this as Partial).getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof 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 as keyof ActionMap] as any)[optionName] = 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(): DeltaSource\n deltaSource(newValue: DeltaSource): this\n deltaSource (newValue?: DeltaSource) {\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 /** @internal */\n getAllElements (): Element[] {\n const { target } = this\n\n if (is.string(target)) {\n return Array.from(this._context.querySelectorAll(target))\n }\n\n if (is.func(target) && (target as any).getAllElements) {\n return (target as any).getAllElements()\n }\n\n return is.element(target) ? [target] : []\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 || nodeContains(this._context, element)\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Node,\n ) {\n return (\n !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget)\n )\n }\n\n testAllow (this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!allowFrom) {\n return true\n }\n\n if (!is.element(element)) {\n return false\n }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n } else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!ignoreFrom || !is.element(element)) {\n return false\n }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\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: E) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (\n method: OnOffMethod,\n typeArg: EventTypes,\n listenerArg?: ListenersArg | null,\n options?: any,\n filter?: (type: string) => boolean,\n ) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const listeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (let type in listeners) {\n if (type === 'wheel') {\n type = browser.wheelEvent\n }\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 === OnOffMethod.On ? 'on' : 'off'](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](\n this.target,\n this._context,\n type,\n listener,\n options,\n )\n }\n // remove listener from this Interactable's element\n else {\n this._scopeEvents[method === OnOffMethod.On ? 'add' : 'remove'](\n this.target,\n type,\n listener,\n options,\n )\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: EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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[] | EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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: 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 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 ;(this[methodName] as ActionMethod)(options[actionName])\n }\n\n for (const setting in options) {\n if (setting === 'getRect') {\n this.rectChecker(options.getRect)\n continue\n }\n\n if (is.func((this as any)[setting])) {\n ;(this as any)[setting](options[setting as keyof typeof options])\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 unset () {\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in this._scopeEvents.delegatedEvents) {\n const delegated = this._scopeEvents.delegatedEvents[type]\n\n for (let i = delegated.length - 1; i >= 0; i--) {\n const { selector, context, listeners } = delegated[i]\n\n if (selector === this.target && context === this._context) {\n delegated.splice(i, 1)\n }\n\n for (let l = listeners.length - 1; l >= 0; l--) {\n this._scopeEvents.removeDelegate(\n this.target,\n this._context,\n type,\n listeners[l][0],\n listeners[l][1],\n )\n }\n }\n }\n } else {\n this._scopeEvents.remove(this.target, 'all')\n }\n }\n}\n" + ], + "mappings": "AAAA;AAeA,OAAO,KAAKA,GAAZ,MAAqB,iBAArB;A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AlB,CAAkC/D,IAAlC,CAAlB;;QAEA,KAAK,IAAIiE,CAAC,GAAGD,SAAS,CAACE,MAAV,GAAmB,CAAhC,EAAmCD,CAAC,IAAI,CAAxC,EAA2CA,CAAC,EAA5C,EAAgD;UAC9C,MAAM;YAAEE,QAAF;YAAYtF,OAAZ;YAAqBgC;UAArB,IAAmCmD,SAAS,CAACC,CAAD,CAAlD;;UAEA,IAAIE,QAAQ,KAAK,KAAK/F,MAAlB,IAA4BS,OAAO,KAAK,KAAKP,QAAjD,EAA2D;YACzD0F,SAAS,CAACI,MAAV,CAAiBH,CAAjB,EAAoB,CAApB;UACD;;UAED,KAAK,IAAII,CAAC,GAAGxD,SAAS,CAACqD,MAAV,GAAmB,CAAhC,EAAmCG,CAAC,IAAI,CAAxC,EAA2CA,CAAC,EAA5C,EAAgD;YAC9C,KAAK5F,YAAL,CAAkB6F,cAAlB,CACE,KAAKlG,MADP,EAEE,KAAKE,QAFP,EAGE0B,IAHF,EAIEa,SAAS,CAACwD,CAAD,CAAT,CAAa,CAAb,CAJF,EAKExD,SAAS,CAACwD,CAAD,CAAT,CAAa,CAAb,CALF;UAOD;QACF;MACF;IACF,CAvBD,MAuBO;MACL,KAAK5F,YAAL,CAAkB8F,MAAlB,CAAyB,KAAKnG,MAA9B,EAAsC,KAAtC;IACD;EACF;;AA7bqD" +} \ No newline at end of file diff --git a/packages/@interactjs/core/Interactable.prod.js b/packages/@interactjs/core/Interactable.prod.js new file mode 100644 index 000000000..e95dc93bf --- /dev/null +++ b/packages/@interactjs/core/Interactable.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/arr.prod.js";import e from"../utils/browser.prod.js";import s from"../utils/clone.prod.js";import{getElementRect as n,matchesUpTo as o,nodeContains as i,trySelector as r}from"../utils/domUtils.prod.js";import c from"../utils/extend.prod.js";import h from"../utils/is.prod.js";import l from"../utils/isNonNativeEvent.prod.js";import a from"../utils/normalizeListeners.prod.js";import{getWindow as f}from"../utils/window.prod.js";import{Eventable as p}from"./Eventable";var u;(t=>{t[t.On=0]="On",t[t.Off=1]="Off"})(u||(u={}));export class Interactable{get _defaults(){return{base:{},perAction:{},actions:{}}}options;_actions;target;events=new p;_context;_win;_doc;_scopeEvents;constructor(t,e,s,n){this._actions=e.actions,this.target=t,this._context=e.context||s,this._win=f(r(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=n,this.set(e)}setOnEvents(t,e){return h.func(e.onstart)&&this.on(t+"start",e.onstart),h.func(e.onmove)&&this.on(t+"move",e.onmove),h.func(e.onend)&&this.on(t+"end",e.onend),h.func(e.oninertiastart)&&this.on(t+"inertiastart",e.oninertiastart),this}updatePerActionListeners(t,e,s){var n;const o=null==(n=this._actions.map[t])?void 0:n.filterEventType,i=t=>(null==o||o(t))&&l(t,this._actions);(h.array(e)||h.object(e))&&this._onOff(u.Off,t,e,void 0,i),(h.array(s)||h.object(s))&&this._onOff(u.On,t,s,void 0,i)}setPerAction(e,n){const o=this._defaults;for(const i in n){const r=i,l=this.options[e],a=n[r];"listeners"===r&&this.updatePerActionListeners(e,l.listeners,a),h.array(a)?l[r]=t.from(a):h.plainObject(a)?(l[r]=c(l[r]||{},s(a)),h.object(o.perAction[r])&&"enabled"in o.perAction[r]&&(l[r].enabled=!1!==a.enabled)):h.bool(a)&&h.object(o.perAction[r])?l[r].enabled=a:l[r]=a}}getRect(t){return t=t||(h.element(this.target)?this.target:null),h.string(this.target)&&(t=t||this._context.querySelector(this.target)),n(t)}rectChecker(t){return h.func(t)?(this.getRect=e=>{const s=c({},t.apply(this,e));return"width"in s||(s.width=s.right-s.left,s.height=s.bottom-s.top),s},this):null===t?(delete this.getRect,this):this.getRect}_backCompatOption(t,e){if(r(e)||h.object(e)){this.options[t]=e;for(const s in this._actions.map)this.options[s][t]=e;return this}return this.options[t]}origin(t){return this._backCompatOption("origin",t)}deltaSource(t){return"page"===t||"client"===t?(this.options.deltaSource=t,this):this.options.deltaSource}getAllElements(){const{target:t}=this;return h.string(t)?Array.from(this._context.querySelectorAll(t)):h.func(t)&&t.getAllElements?t.getAllElements():h.element(t)?[t]:[]}context(){return this._context}inContext(t){return this._context===t.ownerDocument||i(this._context,t)}testIgnoreAllow(t,e,s){return!this.testIgnore(t.ignoreFrom,e,s)&&this.testAllow(t.allowFrom,e,s)}testAllow(t,e,s){return!t||!!h.element(s)&&(h.string(t)?o(s,t,e):!!h.element(t)&&i(t,s))}testIgnore(t,e,s){return!(!t||!h.element(s))&&(h.string(t)?o(s,t,e):!!h.element(t)&&i(t,s))}fire(t){return this.events.fire(t),this}_onOff(t,s,n,o,i){h.object(s)&&!h.array(s)&&(o=n,n=null);const r=a(s,n,i);for(let s in r){"wheel"===s&&(s=e.wheelEvent);for(const e of r[s])l(s,this._actions)?this.events[t===u.On?"on":"off"](s,e):h.string(this.target)?this._scopeEvents[t===u.On?"addDelegate":"removeDelegate"](this.target,this._context,s,e,o):this._scopeEvents[t===u.On?"add":"remove"](this.target,s,e,o)}return this}on(t,e,s){return this._onOff(u.On,t,e,s)}off(t,e,s){return this._onOff(u.Off,t,e,s)}set(t){const e=this._defaults;h.object(t)||(t={}),this.options=s(e.base);for(const s in this._actions.methodDict){const n=s,o=this._actions.methodDict[n];this.options[n]={},this.setPerAction(n,c(c({},e.perAction),e.actions[n])),this[o](t[n])}for(const e in t)"getRect"!==e?h.func(this[e])&&this[e](t[e]):this.rectChecker(t.getRect);return this}unset(){if(h.string(this.target))for(const t in this._scopeEvents.delegatedEvents){const e=this._scopeEvents.delegatedEvents[t];for(let s=e.length-1;s>=0;s--){const{selector:n,context:o,listeners:i}=e[s];n===this.target&&o===this._context&&e.splice(s,1);for(let e=i.length-1;e>=0;e--)this._scopeEvents.removeDelegate(this.target,this._context,t,i[e][0],i[e][1])}}else this._scopeEvents.remove(this.target,"all")}} +//# sourceMappingURL=Interactable.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/Interactable.prod.js.map b/packages/@interactjs/core/Interactable.prod.js.map new file mode 100644 index 000000000..2817f2f17 --- /dev/null +++ b/packages/@interactjs/core/Interactable.prod.js.map @@ -0,0 +1,135 @@ +{ + "version": 3, + "names": [ + "arr", + "browser", + "clone", + "getElementRect", + "matchesUpTo", + "nodeContains", + "trySelector", + "extend", + "is", + "isNonNativeEvent", + "normalizeListeners", + "getWindow", + "Eventable", + "OnOffMethod", + "Interactable", + "_defaults", + "base", + "perAction", + "actions", + "options", + "_actions", + "target", + "events", + "_context", + "_win", + "_doc", + "_scopeEvents", + "constructor", + "defaultContext", + "scopeEvents", + "this", + "context", + "document", + "set", + "setOnEvents", + "actionName", + "phases", + "func", + "onstart", + "on", + "onmove", + "onend", + "oninertiastart", + "updatePerActionListeners", + "prev", + "cur", + "_this$_actions$map$ac", + "actionFilter", + "map", + "filterEventType", + "filter", + "type", + "array", + "object", + "_onOff", + "Off", + "undefined", + "On", + "setPerAction", + "defaults", + "optionName_", + "optionName", + "actionOptions", + "optionValue", + "listeners", + "from", + "plainObject", + "enabled", + "bool", + "getRect", + "element", + "string", + "querySelector", + "rectChecker", + "checker", + "rect", + "apply", + "width", + "right", + "left", + "height", + "bottom", + "top", + "_backCompatOption", + "newValue", + "action", + "origin", + "deltaSource", + "getAllElements", + "Array", + "querySelectorAll", + "inContext", + "ownerDocument", + "testIgnoreAllow", + "targetNode", + "eventTarget", + "testIgnore", + "ignoreFrom", + "testAllow", + "allowFrom", + "fire", + "iEvent", + "method", + "typeArg", + "listenerArg", + "wheelEvent", + "listener", + "types", + "off", + "actionName_", + "methodDict", + "methodName", + "setting", + "unset", + "delegatedEvents", + "delegated", + "i", + "length", + "selector", + "splice", + "l", + "removeDelegate", + "remove" + ], + "sources": [ + "Interactable.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-dupe-class-members */\nimport type { Scope } from '@interactjs/core/scope'\nimport type {\n ActionMap,\n ActionMethod,\n ActionName,\n Actions,\n Context,\n Element,\n EventTypes,\n Listeners,\n ListenersArg,\n OrBoolean,\n Target,\n} from '@interactjs/core/types'\nimport * 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 extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'\n\ntype IgnoreValue = string | Element | boolean\ntype DeltaSource = 'page' | 'client'\n\nconst enum OnOffMethod {\n On,\n Off,\n}\n\n/** */\nexport class Interactable implements Partial {\n /** @internal */ 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: Target\n readonly events = new Eventable()\n readonly _context: Context\n readonly _win: Window\n readonly _doc: Document\n readonly _scopeEvents: Scope['events']\n\n /** */\n constructor (\n target: Target,\n options: any,\n defaultContext: Document | Element,\n scopeEvents: Scope['events'],\n ) {\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 this._scopeEvents = scopeEvents\n\n this.set(options)\n }\n\n setOnEvents (actionName: ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) {\n this.on(`${actionName}start`, phases.onstart)\n }\n if (is.func(phases.onmove)) {\n this.on(`${actionName}move`, phases.onmove)\n }\n if (is.func(phases.onend)) {\n this.on(`${actionName}end`, phases.onend)\n }\n if (is.func(phases.oninertiastart)) {\n this.on(`${actionName}inertiastart`, phases.oninertiastart)\n }\n\n return this\n }\n\n updatePerActionListeners (actionName: ActionName, prev: Listeners | undefined, cur: Listeners | undefined) {\n const actionFilter = (this._actions.map[actionName] as { filterEventType?: (type: string) => boolean })\n ?.filterEventType\n const filter = (type: string) =>\n (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions)\n\n if (is.array(prev) || is.object(prev)) {\n this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this._onOff(OnOffMethod.On, actionName, cur, undefined, filter)\n }\n }\n\n setPerAction (actionName: ActionName, options: 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 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 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\n // set anabled field to true if it exists in the defaults\n if (\n is.object(defaults.perAction[optionName]) &&\n 'enabled' in (defaults.perAction[optionName] as any)\n ) {\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 {Rect} The object's bounding rectangle.\n */\n getRect (element: Element) {\n element = element || (is.element(this.target) ? this.target : 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(): (element: Element) => any | null\n rectChecker(checker: (element: Element) => any): this\n rectChecker (checker?: (element: Element) => any) {\n if (is.func(checker)) {\n this.getRect = (element) => {\n const rect = extend({}, checker.apply(this, element))\n\n if (!(('width' in rect) as unknown)) {\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n return rect\n }\n\n return this\n }\n\n if (checker === null) {\n delete (this as Partial).getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof 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 as keyof ActionMap] as any)[optionName] = 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(): DeltaSource\n deltaSource(newValue: DeltaSource): this\n deltaSource (newValue?: DeltaSource) {\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 /** @internal */\n getAllElements (): Element[] {\n const { target } = this\n\n if (is.string(target)) {\n return Array.from(this._context.querySelectorAll(target))\n }\n\n if (is.func(target) && (target as any).getAllElements) {\n return (target as any).getAllElements()\n }\n\n return is.element(target) ? [target] : []\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 || nodeContains(this._context, element)\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Node,\n ) {\n return (\n !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget)\n )\n }\n\n testAllow (this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!allowFrom) {\n return true\n }\n\n if (!is.element(element)) {\n return false\n }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n } else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!ignoreFrom || !is.element(element)) {\n return false\n }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\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: E) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (\n method: OnOffMethod,\n typeArg: EventTypes,\n listenerArg?: ListenersArg | null,\n options?: any,\n filter?: (type: string) => boolean,\n ) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const listeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (let type in listeners) {\n if (type === 'wheel') {\n type = browser.wheelEvent\n }\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 === OnOffMethod.On ? 'on' : 'off'](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](\n this.target,\n this._context,\n type,\n listener,\n options,\n )\n }\n // remove listener from this Interactable's element\n else {\n this._scopeEvents[method === OnOffMethod.On ? 'add' : 'remove'](\n this.target,\n type,\n listener,\n options,\n )\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: EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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[] | EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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: 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 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 ;(this[methodName] as ActionMethod)(options[actionName])\n }\n\n for (const setting in options) {\n if (setting === 'getRect') {\n this.rectChecker(options.getRect)\n continue\n }\n\n if (is.func((this as any)[setting])) {\n ;(this as any)[setting](options[setting as keyof typeof options])\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 unset () {\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in this._scopeEvents.delegatedEvents) {\n const delegated = this._scopeEvents.delegatedEvents[type]\n\n for (let i = delegated.length - 1; i >= 0; i--) {\n const { selector, context, listeners } = delegated[i]\n\n if (selector === this.target && context === this._context) {\n delegated.splice(i, 1)\n }\n\n for (let l = listeners.length - 1; l >= 0; l--) {\n this._scopeEvents.removeDelegate(\n this.target,\n this._context,\n type,\n listeners[l][0],\n listeners[l][1],\n )\n }\n }\n }\n } else {\n this._scopeEvents.remove(this.target, 'all')\n }\n }\n}\n" + ], + "mappings": "UAeYA,MAAS,8BACdC,MAAa,kCACbC,MAAW,kDACTC,iBAAgBC,kBAAaC,iBAAcC,MAAmB,mCAChEC,MAAY,iCACZC,MAAQ,6BACRC,MAAsB,2CACtBC,MAAwB,0DACtBC,MAAiB,8CAEjBC,MAAiB,c,IAMfC,E,CAAAA,Q,WAAAA,I,eAAAA,M,YAMJ,MAAMC,aACUC,gBACnB,MAAO,CACLC,KAAM,GACNC,UAAW,GACXC,QAAS,IAIJC,QACAC,SACAC,OACAC,OAAS,IAAIV,EACbW,SACAC,KACAC,KACAC,aAGTC,YACEN,EACAF,EACAS,EACAC,GAEAC,KAAKV,SAAWD,EAAQD,QACxBY,KAAKT,OAASA,EACdS,KAAKP,SAAWJ,EAAQY,SAAWH,EACnCE,KAAKN,KAAOb,EAAUL,EAAYe,GAAUS,KAAKP,SAAWF,GAC5DS,KAAKL,KAAOK,KAAKN,KAAKQ,SACtBF,KAAKJ,aAAeG,EAEpBC,KAAKG,IAAId,GAGXe,YAAaC,EAAwBC,GAcnC,OAbI5B,EAAG6B,KAAKD,EAAOE,UACjBR,KAAKS,GAAMJ,EAAF,QAAqBC,EAAOE,SAEnC9B,EAAG6B,KAAKD,EAAOI,SACjBV,KAAKS,GAAMJ,EAAF,OAAoBC,EAAOI,QAElChC,EAAG6B,KAAKD,EAAOK,QACjBX,KAAKS,GAAMJ,EAAF,MAAmBC,EAAOK,OAEjCjC,EAAG6B,KAAKD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actjs/core/InteractableSet.d.ts new file mode 100644 index 000000000..d315ad11a --- /dev/null +++ b/packages/@interactjs/core/InteractableSet.d.ts @@ -0,0 +1,25 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { OptionsArg, Options } from '@interactjs/core/options'; +import type { Scope } from '@interactjs/core/scope'; +import type { Target } from '@interactjs/core/types'; +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'interactable:new': { + interactable: Interactable; + target: Target; + options: OptionsArg; + win: Window; + }; + } +} +export declare class InteractableSet { + list: Interactable[]; + selectorMap: { + [selector: string]: Interactable[]; + }; + scope: Scope; + constructor(scope: Scope); + new(target: Target, options?: any): Interactable; + getExisting(target: Target, options?: Options): Interactable; + forEachMatch(node: Node, callback: (interactable: Interactable) => T): T | void; +} diff --git a/packages/@interactjs/core/InteractableSet.js b/packages/@interactjs/core/InteractableSet.js new file mode 100644 index 000000000..c23f72dfb --- /dev/null +++ b/packages/@interactjs/core/InteractableSet.js @@ -0,0 +1,88 @@ +import * as arr from "../utils/arr.js"; +import * as domUtils from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import is from "../utils/is.js"; +export class InteractableSet { + // all set interactables + list = []; + selectorMap = {}; + scope; + + constructor(scope) { + this.scope = scope; + scope.addListeners({ + 'interactable:unset': ({ + interactable + }) => { + const { + target + } = interactable; + const interactablesOnTarget = is.string(target) ? this.selectorMap[target] : target[this.scope.id]; + const targetIndex = arr.findIndex(interactablesOnTarget, i => i === interactable); + interactablesOnTarget.splice(targetIndex, 1); + } + }); + } + + new(target, options) { + options = extend(options || {}, { + actions: this.scope.actions + }); + const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events); + this.scope.addDocument(interactable._doc); + this.list.push(interactable); + + if (is.string(target)) { + if (!this.selectorMap[target]) { + this.selectorMap[target] = []; + } + + this.selectorMap[target].push(interactable); + } else { + if (!interactable.target[this.scope.id]) { + Object.defineProperty(target, this.scope.id, { + value: [], + configurable: true + }); + } + + ; + target[this.scope.id].push(interactable); + } + + this.scope.fire('interactable:new', { + target, + options, + interactable, + win: this.scope._win + }); + return interactable; + } + + getExisting(target, options) { + const context = options && options.context || this.scope.document; + const isSelector = is.string(target); + const interactablesOnTarget = isSelector ? this.selectorMap[target] : target[this.scope.id]; + if (!interactablesOnTarget) return undefined; + return arr.find(interactablesOnTarget, interactable => interactable._context === context && (isSelector || interactable.inContext(target))); + } + + 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/packages/@interactjs/core/InteractableSet.js.map b/packages/@interactjs/core/InteractableSet.js.map new file mode 100644 index 000000000..3a70ba6cc --- /dev/null +++ b/packages/@interactjs/core/InteractableSet.js.map @@ -0,0 +1,60 @@ +{ + "version": 3, + "names": [ + "arr", + "domUtils", + "extend", + "is", + "InteractableSet", + "list", + "selectorMap", + "scope", + "constructor", + "addListeners", + "interactable", + "target", + "interactablesOnTarget", + "string", + "id", + "targetIndex", + "findIndex", + "i", + "splice", + "new", + "options", + "actions", + "Interactable", + "document", + "events", + "addDocument", + "_doc", + "push", + "Object", + "defineProperty", + "value", + "configurable", + "fire", + "win", + "_win", + "getExisting", + "context", + "isSelector", + "undefined", + "find", + "_context", + "inContext", + "forEachMatch", + "node", + "callback", + "ret", + "element", + "matchesSelector" + ], + "sources": [ + "InteractableSet.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { OptionsArg, Options } from '@interactjs/core/options'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { Target } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interactable\n target: Target\n options: OptionsArg\n win: Window\n }\n }\n}\n\nexport class InteractableSet {\n // all set interactables\n list: Interactable[] = []\n\n selectorMap: {\n [selector: string]: Interactable[]\n } = {}\n\n scope: Scope\n\n constructor (scope: Scope) {\n this.scope = scope\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target } = interactable\n const interactablesOnTarget: Interactable[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = arr.findIndex(interactablesOnTarget, (i) => i === interactable)\n interactablesOnTarget.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Target, options?: any): Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) {\n this.selectorMap[target] = []\n }\n this.selectorMap[target].push(interactable)\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(interactable)\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 getExisting (target: Target, options?: Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const interactablesOnTarget: Interactable[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!interactablesOnTarget) return undefined\n\n return arr.find(\n interactablesOnTarget,\n (interactable) =>\n interactable._context === context && (isSelector || interactable.inContext(target as any)),\n )\n }\n\n forEachMatch (node: Node, callback: (interactable: Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret: T\n\n if (\n (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 ) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n" + ], + "mappings": "AAIA,OAAO,KAAKA,GAAZ,MAAqB,iBAArB;AACA,OAAO,KAAKC,QAAZ,MAA0B,sBAA1B;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAOC,EAAP,MAAe,gBAAf;AAaA,OAAO,MAAMC,eAAN,CAAsB;EAC3B;EACAC,IAAI,GAAmB,EAAnB;EAEJC,WAAW,GAEP,EAFO;EAIXC,KAAK;;EAELC,WAAW,CAAED,KAAF,EAAgB;IACzB,KAAKA,KAAL,GAAaA,KAAb;IACAA,KAAK,CAACE,YAAN,CAAmB;MACjB,sBAAsB,CAAC;QAAEC;MAAF,CAAD,KAAsB;QAC1C,MAAM;UAAEC;QAAF,IAAaD,YAAnB;QACA,MAAME,qBAAqC,GAAGT,EAAE,CAACU,MAAH,CAAUF,MAAV,IAC1C,KAAKL,WAAL,CAAiBK,MAAjB,CAD0C,GAEzCA,MAAD,CAAgB,KAAKJ,KAAL,CAAWO,EAA3B,CAFJ;QAIA,MAAMC,WAAW,GAAGf,GAAG,CAACgB,SAAJ,CAAcJ,qBAAd,EAAsCK,CAAD,IAAOA,CAAC,KAAKP,YAAlD,CAApB;QACAE,qBAAqB,CAACM,MAAtB,CAA6BH,WAA7B,EAA0C,CAA1C;MACD;IATgB,CAAnB;EAWD;;EAEDI,GAAG,CAAER,MAAF,EAAkBS,OAAlB,EAA+C;IAChDA,OAAO,GAAGlB,MAAM,CAACkB,OAAO,IAAI,EAAZ,EAAgB;MAC9BC,OAAO,EAAE,KAAKd,KAAL,CAAWc;IADU,CAAhB,CAAhB;IAGA,MAAMX,YAAY,GAAG,IAAI,KAAKH,KAAL,CAAWe,YAAf,CAA4BX,MAA5B,EAAoCS,OAApC,EAA6C,KAAKb,KAAL,CAAWgB,QAAxD,EAAkE,KAAKhB,KAAL,CAAWiB,MAA7E,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3B,CAFJ;IAIA,IAAI,CAACF,qBAAL,EAA4B,OAAO0B,SAAP;IAE5B,OAAOtC,GAAG,CAACuC,IAAJ,CACL3B,qBADK,EAEJF,YAAD,IACEA,YAAY,CAAC8B,QAAb,KAA0BJ,OAA1B,KAAsCC,UAAU,IAAI3B,YAAY,CAAC+B,SAAb,CAAuB9B,MAAvB,CAApD,CAHG,CAAP;EAKD;;EAED+B,YAAY,CAAKC,IAAL,EAAiBC,QAAjB,EAAwE;IAClF,KAAK,MAAMlC,YAAX,IAA2B,KAAKL,IAAhC,EAAsC;MACpC,IAAIwC,GAAJ;;MAEA,IACE,CAAC1C,EAAE,CAACU,MAAH,CAAUH,YAAY,CAACC,MAAvB,IACG;MACFR,EAAE,CAAC2C,OAAH,CAAWH,IAAX,KAAoB1C,QAAQ,CAAC8C,eAAT,CAAyBJ,IAAzB,EAA+BjC,YAAY,CAACC,MAA5C,CAFrB,GAGG;MACFgC,IAAI,KAAKjC,YAAY,CAACC,MAJxB,KAKA;MACAD,YAAY,CAAC+B,SAAb,CAAuBE,IAAvB,CAPF,EAQE;QACAE,GAAG,GAAGD,QAAQ,CAAClC,YAAD,CAAd;MACD;;MAED,IAAImC,GAAG,KAAKP,SAAZ,EAAuB;QACrB,OAAOO,GAAP;MACD;IACF;EACF;;AAhG0B" +} \ No newline at end of file diff --git a/packages/@interactjs/core/InteractableSet.prod.js b/packages/@interactjs/core/InteractableSet.prod.js new file mode 100644 index 000000000..221dff5ba --- /dev/null +++ b/packages/@interactjs/core/InteractableSet.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/arr.prod.js";import*as e from"../utils/domUtils.prod.js";import s from"../utils/extend.prod.js";import i from"../utils/is.prod.js";export class InteractableSet{list=[];selectorMap={};scope;constructor(e){this.scope=e,e.addListeners({"interactable:unset":({interactable:e})=>{const{target:s}=e,o=i.string(s)?this.selectorMap[s]:s[this.scope.id],r=t.findIndex(o,(t=>t===e));o.splice(r,1)}})}new(t,e){e=s(e||{},{actions:this.scope.actions});const o=new this.scope.Interactable(t,e,this.scope.document,this.scope.events);return this.scope.addDocument(o._doc),this.list.push(o),i.string(t)?(this.selectorMap[t]||(this.selectorMap[t]=[]),this.selectorMap[t].push(o)):(o.target[this.scope.id]||Object.defineProperty(t,this.scope.id,{value:[],configurable:!0}),t[this.scope.id].push(o)),this.scope.fire("interactable:new",{target:t,options:e,interactable:o,win:this.scope._win}),o}getExisting(e,s){const o=s&&s.context||this.scope.document,r=i.string(e),c=r?this.selectorMap[e]:e[this.scope.id];if(c)return t.find(c,(t=>t._context===o&&(r||t.inContext(e))))}forEachMatch(t,s){for(const o of this.list){let r;if((i.string(o.target)?i.element(t)&&e.matchesSelector(t,o.target):t===o.target)&&o.inContext(t)&&(r=s(o)),void 0!==r)return r}}} +//# sourceMappingURL=InteractableSet.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/InteractableSet.prod.js.map b/packages/@interactjs/core/InteractableSet.prod.js.map new file mode 100644 index 000000000..93d67f4bb --- /dev/null +++ b/packages/@interactjs/core/InteractableSet.prod.js.map @@ -0,0 +1,61 @@ +{ + "version": 3, + "names": [ + "arr", + "domUtils", + "extend", + "is", + "InteractableSet", + "list", + "selectorMap", + "scope", + "constructor", + "this", + "addListeners", + "interactable", + "target", + "interactablesOnTarget", + "string", + "id", + "targetIndex", + "findIndex", + "i", + "splice", + "new", + "options", + "actions", + "Interactable", + "document", + "events", + "addDocument", + "_doc", + "push", + "Object", + "defineProperty", + "value", + "configurable", + "fire", + "win", + "_win", + "getExisting", + "context", + "isSelector", + "find", + "_context", + "inContext", + "forEachMatch", + "node", + "callback", + "ret", + "element", + "matchesSelector", + "undefined" + ], + "sources": [ + "InteractableSet.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { OptionsArg, Options } from '@interactjs/core/options'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { Target } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interactable\n target: Target\n options: OptionsArg\n win: Window\n }\n }\n}\n\nexport class InteractableSet {\n // all set interactables\n list: Interactable[] = []\n\n selectorMap: {\n [selector: string]: Interactable[]\n } = {}\n\n scope: Scope\n\n constructor (scope: Scope) {\n this.scope = scope\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target } = interactable\n const interactablesOnTarget: Interactable[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = arr.findIndex(interactablesOnTarget, (i) => i === interactable)\n interactablesOnTarget.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Target, options?: any): Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) {\n this.selectorMap[target] = []\n }\n this.selectorMap[target].push(interactable)\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(interactable)\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 getExisting (target: Target, options?: Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const interactablesOnTarget: Interactable[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!interactablesOnTarget) return undefined\n\n return arr.find(\n interactablesOnTarget,\n (interactable) =>\n interactable._context === context && (isSelector || interactable.inContext(target as any)),\n )\n }\n\n forEachMatch (node: Node, callback: (interactable: Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret: T\n\n if (\n (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 ) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n" + ], + "mappings": "UAIYA,MAAS,iCACTC,MAAc,mCACnBC,MAAY,iCACZC,MAAQ,6BAaR,MAAMC,gBAEXC,KAAuB,GAEvBC,YAEI,GAEJC,MAEAC,YAAaD,GACXE,KAAKF,MAAQA,EACbA,EAAMG,aAAa,CACjB,qBAAsB,EAAGC,mBACvB,MAAMC,OAAEA,GAAWD,EACbE,EAAwCV,EAAGW,OAAOF,GACpDH,KAAKH,YAAYM,GAChBA,EAAeH,KAAKF,MAAMQ,IAEzBC,EAAchB,EAAIiB,UAAUJ,GAAwBK,GAAMA,IAAMP,IACtEE,EAAsBM,OAAOH,EAAa,MAKhDI,IAAKR,EAAgBS,GACnBA,EAAUnB,EAAOmB,GAAW,GAAI,CAC9BC,QAASb,KAAKF,MAAMe,UAEtB,MAAMX,EAAe,IAAIF,KAAKF,MAAMgB,aAAaX,EAAQS,EAASZ,KAAKF,MAAMiB,SAAUf,KAAKF,MAAMkB,QA4BlG,OA1BAhB,KAAKF,MAAMmB,YAAYf,EAAagB,MACpClB,KAAKJ,KAAKuB,KAAKjB,GAEXR,EAAGW,OAAOF,IACPH,KAAKH,YAAYM,KACpBH,KAAKH,YAAYM,GAAU,IAE7BH,KAAKH,YAAYM,GAAQgB,KAAKjB,KAExBA,EAAaC,OAAeH,KAAKF,MAAMQ,KAC3Cc,OAAOC,eAAelB,EAAQH,KAAKF,MAAMQ,GAAI,CAC3CgB,MAAO,GACPC,cAAc,IAIhBpB,EAAeH,KAAKF,MAAMQ,IAAIa,KAAKjB,IAGvCF,KAAKF,MAAM0B,KAAK,mBAAoB,CAClCrB,SACAS,UACAV,eACAuB,IAAKzB,KAAKF,MAAM4B,OAGXxB,EAGTyB,YAAaxB,EAAgBS,GAC3B,MAAMgB,EAAWhB,GAAWA,EAAQgB,SAAY5B,KAAKF,MAAMiB,SACrDc,EAAanC,EAAGW,OAAOF,GACvBC,EAAwCyB,EAC1C7B,KAAKH,YAAYM,GAChBA,EAAeH,KAAKF,MAAMQ,IAE/B,GAAKF,EAEL,OAAOb,EAAIuC,KACT1B,GACCF,GACCA,EAAa6B,WAAaH,IAAYC,GAAc3B,EAAa8B,UAAU7B,MAIjF8B,aAAiBC,EAAYC,GAC3B,IAAK,MAAMjC,KAAgBF,KAAKJ,KAAM,CACpC,IAAIwC,EAcJ,IAXG1C,EAAGW,OAAOH,EAAaC,QAEtBT,EAAG2C,QAAQH,IAAS1C,EAAS8C,gBAAgBJ,EAAMhC,EAAaC,QAEhE+B,IAAShC,EAAaC,SAExBD,EAAa8B,UAAUE,KAEvBE,EAAMD,EAASjC,SAGLqC,IAARH,EACF,OAAOA" +} \ No newline at end of file diff --git a/packages/@interactjs/core/Interaction.d.ts b/packages/@interactjs/core/Interaction.d.ts new file mode 100644 index 000000000..a4a50c9f6 --- /dev/null +++ b/packages/@interactjs/core/Interaction.d.ts @@ -0,0 +1,217 @@ +import type { Element, EdgeOptions, PointerEventType, PointerType, FullRect, CoordsSet } from '@interactjs/core/types'; +import type { EventPhase } from './InteractEvent'; +import { InteractEvent } from './InteractEvent'; +import type { Interactable } from './Interactable'; +import { PointerInfo } from './PointerInfo'; +import type { Scope } from './scope'; +import type { ActionName, ActionProps } from './types'; +export declare enum _ProxyValues { + interactable = "", + element = "", + prepared = "", + pointerIsDown = "", + pointerWasMoved = "", + _proxy = "" +} +export declare enum _ProxyMethods { + start = "", + move = "", + end = "", + stop = "", + interacting = "" +} +export declare type PointerArgProps = { + pointer: PointerType; + event: PointerEventType; + eventTarget: Node; + pointerIndex: number; + pointerInfo: PointerInfo; + interaction: Interaction; +} & T; +export interface DoPhaseArg { + event: 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': { + interaction: Interaction; + event: Event; + type: 'blur'; + }; + '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, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>; +export declare class Interaction { + interactable: Interactable | null; + element: Element | null; + rect: FullRect | null; + _rects?: { + start: FullRect; + corrected: FullRect; + previous: FullRect; + delta: FullRect; + }; + edges: EdgeOptions | null; + _scopeFire: Scope['fire']; + prepared: ActionProps; + pointerType: string; + pointers: PointerInfo[]; + downEvent: PointerEventType | null; + downPointer: PointerType; + _latestPointer: { + pointer: PointerType; + event: PointerEventType; + eventTarget: Node; + }; + prevEvent: InteractEvent; + pointerIsDown: boolean; + pointerWasMoved: boolean; + _interacting: boolean; + _ending: boolean; + _stopped: boolean; + _proxy: InteractionProxy; + simulation: any; + /** + * @alias Interaction.prototype.move + */ + doMove: (this: void) => any; + coords: CoordsSet; + readonly _id: number; + /** */ + constructor({ pointerType, scopeFire }: { + pointerType?: string; + scopeFire: Scope['fire']; + }); + pointerDown(pointer: PointerType, event: PointerEventType, eventTarget: Node): 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 {Boolean} Whether the interaction was successfully started + */ + start(action: ActionProps, interactable: Interactable, element: Element): boolean; + pointerMove(pointer: PointerType, event: PointerEventType, eventTarget: Node): 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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: EventTarget): void; + documentBlur(event: Event): 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?: PointerEventType): void; + currentAction(): T; + interacting(): boolean; + /** */ + stop(): void; + getPointerIndex(pointer: any): number; + getPointerInfo(pointer: any): PointerInfo; + updatePointer(pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean): number; + removePointer(pointer: PointerType, event: PointerEventType): void; + _updateLatestPointer(pointer: PointerType, event: PointerEventType, eventTarget: Node): void; + destroy(): void; + _createPreparedEvent

(event: 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/packages/@interactjs/core/Interaction.js b/packages/@interactjs/core/Interaction.js new file mode 100644 index 000000000..40581798e --- /dev/null +++ b/packages/@interactjs/core/Interaction.js @@ -0,0 +1,520 @@ +import * as arr from "../utils/arr.js"; +import extend from "../utils/extend.js"; +import hypot from "../utils/hypot.js"; +import { warnOnce, copyAction } from "../utils/misc.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; +import * as rectUtils from "../utils/rect.js"; +import { InteractEvent } from './InteractEvent'; +import { PointerInfo } from './PointerInfo'; +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 + interactable = null; // the target element of the interactable + + element = null; + rect = null; + _rects; + edges = null; + _scopeFire; // action that's ready to be fired on next move event + + prepared = { + name: null, + axis: null, + edges: null + }; + pointerType; // keep track of added pointers + + pointers = []; // pointerdown/mousedown/touchstart event + + downEvent = null; + downPointer = {}; + _latestPointer = { + pointer: null, + event: null, + eventTarget: null + }; // previous action event + + prevEvent = null; + pointerIsDown = false; + pointerWasMoved = false; + _interacting = false; + _ending = false; + _stopped = true; + _proxy; + simulation = null; + /** @internal */ + + get pointerMoveTolerance() { + return 1; + } + /** + * @alias Interaction.prototype.move + */ + + + doMove = warnOnce(function (signalArg) { + this.move(signalArg); + }, 'The interaction.doMove() method has been renamed to interaction.move()'); + coords = { + // Starting InteractEvent pointer coordinates + start: pointerUtils.newCoords(), + // Previous native pointer move event coordinates + prev: pointerUtils.newCoords(), + // current native pointer move event coordinates + cur: pointerUtils.newCoords(), + // Change in coordinates and time of the pointer + delta: pointerUtils.newCoords(), + // pointer velocity + velocity: pointerUtils.newCoords() + }; + _id = idCounter++; + /** */ + + constructor({ + pointerType, + scopeFire + }) { + 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 {Boolean} Whether the interaction was successfully started + */ + + + start(action, interactable, element) { + if (this.interacting() || !this.pointerIsDown || this.pointers.length < (action.name === 'gesture' ? 2 : 1) || !interactable.options[action.name].enabled) { + return false; + } + + copyAction(this.prepared, action); + this.interactable = interactable; + this.element = element; + this.rect = interactable.getRect(element); + this.edges = this.prepared.edges ? 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 = 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 + pointerUtils.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) { + pointerUtils.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) { + pointerUtils.setZeroCoords(this.coords.delta); + } + + signalArg = 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.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 = pointerUtils.getPointerId(pointer); // mouse and pen interactions may have only one pointer + + return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId); + } + + getPointerInfo(pointer) { + return this.pointers[this.getPointerIndex(pointer)]; + } + + updatePointer(pointer, event, eventTarget, down) { + const id = pointerUtils.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; + } + + pointerUtils.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now()); + pointerUtils.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur); + + if (down) { + this.pointerIsDown = true; + pointerInfo.downTime = this.coords.cur.timeStamp; + pointerInfo.downTarget = eventTarget; + pointerUtils.pointerExtend(this.downPointer, pointer); + + if (!this.interacting()) { + pointerUtils.copyCoords(this.coords.start, this.coords.cur); + pointerUtils.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); + this.pointerIsDown = false; + } + + _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) { + var _this$interactable; + + (_this$interactable = this.interactable) == null ? void 0 : _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 + rectUtils.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/packages/@interactjs/core/Interaction.js.map b/packages/@interactjs/core/Interaction.js.map new file mode 100644 index 000000000..02d376558 --- /dev/null +++ b/packages/@interactjs/core/Interaction.js.map @@ -0,0 +1,145 @@ +{ + "version": 3, + "names": [ + "arr", + "extend", + "hypot", + "warnOnce", + "copyAction", + "pointerUtils", + "rectUtils", + "InteractEvent", + "PointerInfo", + "_ProxyValues", + "_ProxyMethods", + "idCounter", + "Interaction", + "interactable", + "element", + "rect", + "_rects", + "edges", + "_scopeFire", + "prepared", + "name", + "axis", + "pointerType", + "pointers", + "downEvent", + "downPointer", + "_latestPointer", + "pointer", + "event", + "eventTarget", + "prevEvent", + "pointerIsDown", + "pointerWasMoved", + "_interacting", + "_ending", + "_stopped", + "_proxy", + "simulation", + "pointerMoveTolerance", + "doMove", + "signalArg", + "move", + "coords", + "start", + "newCoords", + "prev", + "cur", + "delta", + "velocity", + "_id", + "constructor", + "scopeFire", + "that", + "key", + "Object", + "defineProperty", + "get", + "value", + "args", + "interaction", + "pointerDown", + "pointerIndex", + "updatePointer", + "pointerInfo", + "type", + "action", + "interacting", + "length", + "options", + "enabled", + "getRect", + "left", + "right", + "top", + "bottom", + "_doPhase", + "phase", + "pointerMove", + "modification", + "endResult", + "duplicateMove", + "page", + "x", + "y", + "client", + "dx", + "dy", + "getPointerIndex", + "duplicate", + "setCoordVelocity", + "copyCoords", + "setZeroCoords", + "pointerUp", + "curEventTarget", + "test", + "end", + "removePointer", + "documentBlur", + "endPhaseResult", + "stop", + "currentAction", + "pointerId", + "getPointerId", + "findIndex", + "curPointer", + "id", + "getPointerInfo", + "down", + "push", + "setCoords", + "map", + "p", + "_now", + "setCoordDeltas", + "downTime", + "timeStamp", + "downTarget", + "pointerExtend", + "_updateLatestPointer", + "splice", + "destroy", + "_createPreparedEvent", + "preEnd", + "_fireEvent", + "iEvent", + "fire", + "addEdges", + "deltaSource", + "width", + "height", + "beforeResult", + "Date", + "now" + ], + "sources": [ + "Interaction.ts" + ], + "sourcesContent": [ + "import type {\n Element,\n EdgeOptions,\n PointerEventType,\n PointerType,\n FullRect,\n CoordsSet,\n} from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport hypot from '@interactjs/utils/hypot'\nimport { warnOnce, copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { EventPhase } from './InteractEvent'\nimport { InteractEvent } from './InteractEvent'\nimport type { Interactable } from './Interactable'\nimport { PointerInfo } from './PointerInfo'\nimport type { ActionDefaults } from './options'\nimport type { Scope } from './scope'\nimport type { ActionName, ActionProps } from './types'\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: PointerType\n event: PointerEventType\n eventTarget: Node\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: 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': { interaction: Interaction, event: Event, type: '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 = null\n\n // the target element of the interactable\n element: Element | null = null\n rect: FullRect | null = null\n _rects?: {\n start: FullRect\n corrected: FullRect\n previous: FullRect\n delta: FullRect\n }\n edges: EdgeOptions | null = null\n\n _scopeFire: 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: PointerEventType | null = null\n\n downPointer: PointerType = {} as PointerType\n\n _latestPointer: {\n pointer: PointerType\n event: 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\n\n simulation = null\n\n /** @internal */ get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = warnOnce(function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n }, 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: pointerUtils.newCoords(),\n // Previous native pointer move event coordinates\n prev: pointerUtils.newCoords(),\n // current native pointer move event coordinates\n cur: pointerUtils.newCoords(),\n // Change in coordinates and time of the pointer\n delta: pointerUtils.newCoords(),\n // pointer velocity\n velocity: pointerUtils.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: { pointerType?: string, scopeFire: Scope['fire'] }) {\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 () {\n return that[key]\n },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args: any[]) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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 as unknown as Interaction,\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 {Boolean} Whether the interaction was successfully started\n */\n start (action: ActionProps, interactable: Interactable, element: Element): boolean {\n if (\n this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name as keyof ActionDefaults].enabled\n ) {\n return false\n }\n\n 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 ? extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting =\n 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: PointerType, event: PointerEventType, eventTarget: Node) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove =\n 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: number\n let dy: number\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 = 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 as unknown as Interaction,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n pointerUtils.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 pointerUtils.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?: any) {\n if (!signalArg || !signalArg.event) {\n pointerUtils.setZeroCoords(this.coords.delta)\n }\n\n signalArg = extend(\n {\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n },\n signalArg || {},\n )\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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: 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 as unknown as Interaction,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.removePointer(pointer, event)\n }\n\n documentBlur (event: Event) {\n this.end(event as any)\n this._scopeFire('interactions:blur', {\n event,\n type: 'blur',\n interaction: this as unknown as Interaction,\n })\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?: PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult: boolean\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: any) {\n const pointerId = pointerUtils.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 : arr.findIndex(this.pointers, (curPointer) => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer: any) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {\n const id = pointerUtils.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false ? false : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(id, pointer, event, null, null)\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n } else {\n pointerInfo.pointer = pointer\n }\n\n pointerUtils.setCoords(\n this.coords.cur,\n this.pointers.map((p) => p.pointer),\n this._now(),\n )\n pointerUtils.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 pointerUtils.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n pointerUtils.copyCoords(this.coords.start, this.coords.cur)\n pointerUtils.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 as unknown as Interaction,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: PointerType, event: 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 as unknown as Interaction,\n })\n\n this.pointers.splice(pointerIndex, 1)\n this.pointerIsDown = false\n }\n\n _updateLatestPointer (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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

(\n event: PointerEventType,\n phase: P,\n preEnd?: boolean,\n type?: string,\n ) {\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

(\n signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent },\n ) {\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 rectUtils.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') {\n this.prevEvent = iEvent\n }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () {\n return Date.now()\n }\n}\n\nexport default Interaction\nexport { PointerInfo }\n" + ], + "mappings": "AAQA,OAAO,KAAKA,GAAZ,MAAqB,iBAArB;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,kBAArC;AACA,OAAO,KAAKC,YAAZ,MAA8B,0BAA9B;AACA,OAAO,KAAKC,SAAZ,MAA2B,kBAA3B;AAGA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,SAASC,WAAT,QAA4B,eAA5B;AAKA,WAAYC,YAAZ;;WAAYA,Y;EAAAA,Y;EAAAA,Y;EAAAA,Y;EAAAA,Y;EAAAA,Y;EAAAA,Y;GAAAA,Y,KAAAA,Y;;AASZ,WAAYC,aAAZ;;WAAYA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;GAAAA,a,KAAAA,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QAAV,CAAmB,KAAK7G,KAAxB,EAA+BF,IAA/B,EAAqC,KAAK2B,MAAL,CAAYK,KAAZ,CAAkB,KAAKlC,YAAL,CAAkBuD,OAAlB,CAA0B2D,WAA5C,CAArC;MAEAhH,IAAI,CAACiH,KAAL,GAAajH,IAAI,CAACyD,KAAL,GAAazD,IAAI,CAACwD,IAA/B;MACAxD,IAAI,CAACkH,MAAL,GAAclH,IAAI,CAAC2D,MAAL,GAAc3D,IAAI,CAAC0D,GAAjC;IACD;;IAED,MAAMyD,YAAY,GAAG,KAAKhH,UAAL,CAAiB,8BAA6B0D,KAAM,EAApD,EAA8DpC,SAA9D,CAArB;;IAEA,IAAI0F,YAAY,KAAK,KAArB,EAA4B;MAC1B,OAAO,KAAP;IACD;;IAED,MAAMN,MAAM,GAAIpF,SAAS,CAACoF,MAAV,GAAmB,KAAKH,oBAAL,CAA0B7F,KAA1B,EAAiCgD,KAAjC,EAAwC8C,MAAxC,EAAgD1D,IAAhD,CAAnC;;IAEA,KAAK9C,UAAL,CAAiB,uBAAsB0D,KAAM,EAA7C,EAAuDpC,SAAvD;;IAEA,IAAIoC,KAAK,KAAK,OAAd,EAAuB;MACrB,KAAK9C,SAAL,GAAiB8F,MAAjB;IACD;;IAED,KAAKD,UAAL,CAAgBC,MAAhB;;IAEA,KAAK1G,UAAL,CAAiB,6BAA4B0D,KAAM,EAAnD,EAA6DpC,SAA7D;;IAEA,OAAO,IAAP;EACD;;EAEDwE,IAAI,GAAI;IACN,OAAOmB,IAAI,CAACC,GAAL,EAAP;EACD;;AA1gBgE;AA6gBnE,eAAexH,WAAf;AACA,SAASJ,WAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/core/Interaction.prod.js b/packages/@interactjs/core/Interaction.prod.js new file mode 100644 index 000000000..67f0b520d --- /dev/null +++ b/packages/@interactjs/core/Interaction.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/arr.prod.js";import e from"../utils/extend.prod.js";import i from"../utils/hypot.prod.js";import{warnOnce as n,copyAction as o}from"../utils/misc.prod.js";import*as r from"../utils/pointerUtils.prod.js";import*as s from"../utils/rect.prod.js";import{InteractEvent as p}from"./InteractEvent";import{PointerInfo as h}from"./PointerInfo";export let _ProxyValues;(t=>{t.interactable="",t.element="",t.prepared="",t.pointerIsDown="",t.pointerWasMoved="",t._proxy=""})(_ProxyValues||(_ProxyValues={}));export let _ProxyMethods;(t=>{t.start="",t.move="",t.end="",t.stop="",t.interacting=""})(_ProxyMethods||(_ProxyMethods={}));let a=0;export class Interaction{interactable=null;element=null;rect=null;_rects;edges=null;_scopeFire;prepared={name:null,axis:null,edges:null};pointerType;pointers=[];downEvent=null;downPointer={};_latestPointer={pointer:null,event:null,eventTarget:null};prevEvent=null;pointerIsDown=!1;pointerWasMoved=!1;_interacting=!1;_ending=!1;_stopped=!0;_proxy;simulation=null;get pointerMoveTolerance(){return 1}doMove=n((function(t){this.move(t)}),"The interaction.doMove() method has been renamed to interaction.move()");coords={start:r.newCoords(),prev:r.newCoords(),cur:r.newCoords(),delta:r.newCoords(),velocity:r.newCoords()};_id=a++;constructor({pointerType:t,scopeFire:e}){this._scopeFire=e,this.pointerType=t;const i=this;this._proxy={};for(const t in _ProxyValues)Object.defineProperty(this._proxy,t,{get(){return i[t]}});for(const t in _ProxyMethods)Object.defineProperty(this._proxy,t,{value:(...e)=>i[t](...e)});this._scopeFire("interactions:new",{interaction:this})}pointerDown(t,e,i){const n=this.updatePointer(t,e,i,!0),o=this.pointers[n];this._scopeFire("interactions:down",{pointer:t,event:e,eventTarget:i,pointerIndex:n,pointerInfo:o,type:"down",interaction:this})}start(t,i,n){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<("gesture"===t.name?2:1)||!i.options[t.name].enabled)&&(o(this.prepared,t),this.interactable=i,this.element=n,this.rect=i.getRect(n),this.edges=this.prepared.edges?e({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}pointerMove(t,e,n){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(t,e,n,!1);const o=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 s,p;this.pointerIsDown&&!this.pointerWasMoved&&(s=this.coords.cur.client.x-this.coords.start.client.x,p=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=i(s,p)>this.pointerMoveTolerance);const h=this.getPointerIndex(t),a={pointer:t,pointerIndex:h,pointerInfo:this.pointers[h],event:e,type:"move",eventTarget:n,dx:s,dy:p,duplicate:o,interaction:this};o||r.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",a),o||this.simulation||(this.interacting()&&(a.type=null,this.move(a)),this.pointerWasMoved&&r.copyCoords(this.coords.prev,this.coords.cur))}move(t){t&&t.event||r.setZeroCoords(this.coords.delta),(t=e({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},t||{})).phase="move",this._doPhase(t)}pointerUp(t,e,i,n){let o=this.getPointerIndex(t);-1===o&&(o=this.updatePointer(t,e,i,!1));const r=/cancel$/i.test(e.type)?"cancel":"up";this._scopeFire("interactions:"+r,{pointer:t,pointerIndex:o,pointerInfo:this.pointers[o],event:e,eventTarget:i,type:r,curEventTarget:n,interaction:this}),this.simulation||this.end(e),this.removePointer(t,e)}documentBlur(t){this.end(t),this._scopeFire("interactions:blur",{event:t,type:"blur",interaction:this})}end(t){let e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:"end"})),this._ending=!1,!0===e&&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=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}getPointerIndex(e){const i=r.getPointerId(e);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:t.findIndex(this.pointers,(t=>t.id===i))}getPointerInfo(t){return this.pointers[this.getPointerIndex(t)]}updatePointer(t,e,i,n){const o=r.getPointerId(t);let s=this.getPointerIndex(t),p=this.pointers[s];return n=!1!==n&&(n||/(down|start)$/i.test(e.type)),p?p.pointer=t:(p=new h(o,t,e,null,null),s=this.pointers.length,this.pointers.push(p)),r.setCoords(this.coords.cur,this.pointers.map((t=>t.pointer)),this._now()),r.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),n&&(this.pointerIsDown=!0,p.downTime=this.coords.cur.timeStamp,p.downTarget=i,r.pointerExtend(this.downPointer,t),this.interacting()||(r.copyCoords(this.coords.start,this.coords.cur),r.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=e,this.pointerWasMoved=!1)),this._updateLatestPointer(t,e,i),this._scopeFire("interactions:update-pointer",{pointer:t,event:e,eventTarget:i,down:n,pointerInfo:p,pointerIndex:s,interaction:this}),s}removePointer(t,e){const i=this.getPointerIndex(t);if(-1===i)return;const n=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:t,event:e,eventTarget:null,pointerIndex:i,pointerInfo:n,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}_updateLatestPointer(t,e,i){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=i}destroy(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}_createPreparedEvent(t,e,i,n){return new p(this,t,this.prepared.name,e,this.element,i,n)}_fireEvent(t){var e;null==(e=this.interactable)||e.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}_doPhase(t){const{event:e,phase:i,preEnd:n,type:o}=t,{rect:r}=this;if(r&&"move"===i&&(s.addEdges(this.edges,r,this.coords.delta[this.interactable.options.deltaSource]),r.width=r.right-r.left,r.height=r.bottom-r.top),!1===this._scopeFire("interactions:before-action-"+i,t))return!1;const p=t.iEvent=this._createPreparedEvent(e,i,n,o);return this._scopeFire("interactions:action-"+i,t),"start"===i&&(this.prevEvent=p),this._fireEvent(p),this._scopeFire("interactions:after-action-"+i,t),!0}_now(){return Date.now()}}export default Interaction;export{h as PointerInfo}; +//# sourceMappingURL=Interaction.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/Interaction.prod.js.map b/packages/@interactjs/core/Interaction.prod.js.map new file mode 100644 index 000000000..9495a7fce --- /dev/null +++ b/packages/@interactjs/core/Interaction.prod.js.map @@ -0,0 +1,146 @@ +{ + "version": 3, + "names": [ + "arr", + "extend", + "hypot", + "warnOnce", + "copyAction", + "pointerUtils", + "rectUtils", + "InteractEvent", + "PointerInfo", + "_ProxyValues", + "_ProxyMethods", + "idCounter", + "Interaction", + "interactable", + "element", + "rect", + "_rects", + "edges", + "_scopeFire", + "prepared", + "name", + "axis", + "pointerType", + "pointers", + "downEvent", + "downPointer", + "_latestPointer", + "pointer", + "event", + "eventTarget", + "prevEvent", + "pointerIsDown", + "pointerWasMoved", + "_interacting", + "_ending", + "_stopped", + "_proxy", + "simulation", + "pointerMoveTolerance", + "doMove", + "signalArg", + "this", + "move", + "coords", + "start", + "newCoords", + "prev", + "cur", + "delta", + "velocity", + "_id", + "constructor", + "scopeFire", + "that", + "key", + "Object", + "defineProperty", + "get", + "value", + "args", + "interaction", + "pointerDown", + "pointerIndex", + "updatePointer", + "pointerInfo", + "type", + "action", + "interacting", + "length", + "options", + "enabled", + "getRect", + "left", + "right", + "top", + "bottom", + "_doPhase", + "phase", + "pointerMove", + "modification", + "endResult", + "duplicateMove", + "page", + "x", + "y", + "client", + "dx", + "dy", + "getPointerIndex", + "duplicate", + "setCoordVelocity", + "copyCoords", + "setZeroCoords", + "pointerUp", + "curEventTarget", + "test", + "end", + "removePointer", + "documentBlur", + "endPhaseResult", + "stop", + "currentAction", + "pointerId", + "getPointerId", + "findIndex", + "curPointer", + "id", + "getPointerInfo", + "down", + "push", + "setCoords", + "map", + "p", + "_now", + "setCoordDeltas", + "downTime", + "timeStamp", + "downTarget", + "pointerExtend", + "_updateLatestPointer", + "splice", + "destroy", + "_createPreparedEvent", + "preEnd", + "_fireEvent", + "iEvent", + "_this$interactable", + "fire", + "addEdges", + "deltaSource", + "width", + "height", + "Date", + "now" + ], + "sources": [ + "Interaction.ts" + ], + "sourcesContent": [ + "import type {\n Element,\n EdgeOptions,\n PointerEventType,\n PointerType,\n FullRect,\n CoordsSet,\n} from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport hypot from '@interactjs/utils/hypot'\nimport { warnOnce, copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { EventPhase } from './InteractEvent'\nimport { InteractEvent } from './InteractEvent'\nimport type { Interactable } from './Interactable'\nimport { PointerInfo } from './PointerInfo'\nimport type { ActionDefaults } from './options'\nimport type { Scope } from './scope'\nimport type { ActionName, ActionProps } from './types'\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: PointerType\n event: PointerEventType\n eventTarget: Node\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: 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': { interaction: Interaction, event: Event, type: '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 = null\n\n // the target element of the interactable\n element: Element | null = null\n rect: FullRect | null = null\n _rects?: {\n start: FullRect\n corrected: FullRect\n previous: FullRect\n delta: FullRect\n }\n edges: EdgeOptions | null = null\n\n _scopeFire: 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: PointerEventType | null = null\n\n downPointer: PointerType = {} as PointerType\n\n _latestPointer: {\n pointer: PointerType\n event: 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\n\n simulation = null\n\n /** @internal */ get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = warnOnce(function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n }, 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: pointerUtils.newCoords(),\n // Previous native pointer move event coordinates\n prev: pointerUtils.newCoords(),\n // current native pointer move event coordinates\n cur: pointerUtils.newCoords(),\n // Change in coordinates and time of the pointer\n delta: pointerUtils.newCoords(),\n // pointer velocity\n velocity: pointerUtils.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: { pointerType?: string, scopeFire: Scope['fire'] }) {\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 () {\n return that[key]\n },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args: any[]) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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 as unknown as Interaction,\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 {Boolean} Whether the interaction was successfully started\n */\n start (action: ActionProps, interactable: Interactable, element: Element): boolean {\n if (\n this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name as keyof ActionDefaults].enabled\n ) {\n return false\n }\n\n 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 ? extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting =\n 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: PointerType, event: PointerEventType, eventTarget: Node) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove =\n 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: number\n let dy: number\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 = 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 as unknown as Interaction,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n pointerUtils.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 pointerUtils.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?: any) {\n if (!signalArg || !signalArg.event) {\n pointerUtils.setZeroCoords(this.coords.delta)\n }\n\n signalArg = extend(\n {\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n },\n signalArg || {},\n )\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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: 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 as unknown as Interaction,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.removePointer(pointer, event)\n }\n\n documentBlur (event: Event) {\n this.end(event as any)\n this._scopeFire('interactions:blur', {\n event,\n type: 'blur',\n interaction: this as unknown as Interaction,\n })\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?: PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult: boolean\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: any) {\n const pointerId = pointerUtils.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 : arr.findIndex(this.pointers, (curPointer) => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer: any) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {\n const id = pointerUtils.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false ? false : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(id, pointer, event, null, null)\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n } else {\n pointerInfo.pointer = pointer\n }\n\n pointerUtils.setCoords(\n this.coords.cur,\n this.pointers.map((p) => p.pointer),\n this._now(),\n )\n pointerUtils.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 pointerUtils.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n pointerUtils.copyCoords(this.coords.start, this.coords.cur)\n pointerUtils.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 as unknown as Interaction,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: PointerType, event: 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 as unknown as Interaction,\n })\n\n this.pointers.splice(pointerIndex, 1)\n this.pointerIsDown = false\n }\n\n _updateLatestPointer (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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

(\n event: PointerEventType,\n phase: P,\n preEnd?: boolean,\n type?: string,\n ) {\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

(\n signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent },\n ) {\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 rectUtils.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') {\n this.prevEvent = iEvent\n }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () {\n return Date.now()\n }\n}\n\nexport default Interaction\nexport { PointerInfo }\n" + ], + "mappings": "UAQYA,MAAS,8BACdC,MAAY,iCACZC,MAAW,4CACTC,gBAAUC,MAAkB,kCACzBC,MAAkB,0CAClBC,MAAe,gDAGlBC,MAAqB,wCAErBC,MAAmB,uBAK5B,IAAYC,a,CAAAA,M,gBAAAA,E,WAAAA,E,YAAAA,E,iBAAAA,E,mBAAAA,E,YAAAA,4B,YASZ,IAAYC,c,CAAAA,M,SAAAA,E,QAAAA,E,OAAAA,E,QAAAA,E,iBAAAA,8B,KAuEZ,IAAIC,EAAY,SAET,MAAMC,YAEXC,aAAoC,KAGpCC,QAA0B,KAC1BC,KAAwB,KACxBC,OAMAC,MAA4B,KAE5BC,WAGAC,SAA2B,CACzBC,KAAM,KACNC,KAAM,KACNJ,MAAO,MAGTK,YAGAC,SAA0B,GAG1BC,UAAqC,KAErCC,YAA2B,GAE3BC,eAII,CACAC,QAAS,KACTC,MAAO,KACPC,YAAa,MAIjBC,UAA0C,KAE1CC,eAAgB,EAChBC,iBAAkB,EAClBC,cAAe,EACfC,SAAU,EACVC,UAAW,EACXC,OAEAC,WAAa,KAEQC,2BACnB,OAAO,EAMTC,OAASpC,GAAS,SAA6BqC,GAC7CC,KAAKC,KAAKF,KACT,0EAEHG,OAAoB,CAElBC,MAAOvC,EAAawC,YAEpBC,KAAMzC,EAAawC,YAEnBE,IAAK1C,EAAawC,YAElBG,MAAO3C,EAAawC,YAEpBI,SAAU5C,EAAawC,aAGhBK,IAAcvC,IAGvBwC,aAAa7B,YAAEA,EAAF8B,UAAeA,IAC1BX,KAAKvB,WAAakC,EAClBX,KAAKnB,YAAcA,EAEnB,MAAM+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,KAAKvB,WAAY,uBAAsB2D,EAAgBrC,GAEzC,UAAVqC,IACFpC,KAAKX,UAAY+F,GAGnBpF,KAAKmF,WAAWC,GAEhBpF,KAAKvB,WAAY,6BAA4B2D,EAAgBrC,IAEtD,EAGTyE,OACE,OAAOmB,KAAKC,sBAIDzH,mBACNJ" +} \ No newline at end of file diff --git a/packages/@interactjs/core/LICENSE b/packages/@interactjs/core/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/core/NativeTypes.d.ts b/packages/@interactjs/core/NativeTypes.d.ts new file mode 100644 index 000000000..30e708c44 --- /dev/null +++ b/packages/@interactjs/core/NativeTypes.d.ts @@ -0,0 +1,3 @@ +export declare const NativePointerEvent: PointerEvent; +export declare type NativeEventTarget = EventTarget; +export declare type NativeElement = Element; diff --git a/packages/@interactjs/core/NativeTypes.js b/packages/@interactjs/core/NativeTypes.js new file mode 100644 index 000000000..6e2c6d798 --- /dev/null +++ b/packages/@interactjs/core/NativeTypes.js @@ -0,0 +1,2 @@ +export const NativePointerEvent = null; +//# sourceMappingURL=NativeTypes.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/NativeTypes.js.map b/packages/@interactjs/core/NativeTypes.js.map new file mode 100644 index 000000000..744825729 --- /dev/null +++ b/packages/@interactjs/core/NativeTypes.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "NativePointerEvent" + ], + "sources": [ + "NativeTypes.ts" + ], + "sourcesContent": [ + "export const NativePointerEvent = null as unknown as InstanceType\nexport type NativeEventTarget = EventTarget\nexport type NativeElement = Element\n" + ], + "mappings": "AAAA,OAAO,MAAMA,kBAAkB,GAAG,IAA3B" +} \ No newline at end of file diff --git a/packages/@interactjs/core/NativeTypes.prod.js b/packages/@interactjs/core/NativeTypes.prod.js new file mode 100644 index 000000000..62cb7e073 --- /dev/null +++ b/packages/@interactjs/core/NativeTypes.prod.js @@ -0,0 +1,2 @@ +export const NativePointerEvent=null; +//# sourceMappingURL=NativeTypes.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/NativeTypes.prod.js.map b/packages/@interactjs/core/NativeTypes.prod.js.map new file mode 100644 index 000000000..973603a80 --- /dev/null +++ b/packages/@interactjs/core/NativeTypes.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "NativePointerEvent" + ], + "sources": [ + "NativeTypes.ts" + ], + "sourcesContent": [ + "export const NativePointerEvent = null as unknown as InstanceType\nexport type NativeEventTarget = EventTarget\nexport type NativeElement = Element\n" + ], + "mappings": "OAAO,MAAMA,mBAAqB" +} \ No newline at end of file diff --git a/packages/@interactjs/core/PointerInfo.d.ts b/packages/@interactjs/core/PointerInfo.d.ts new file mode 100644 index 000000000..243ace863 --- /dev/null +++ b/packages/@interactjs/core/PointerInfo.d.ts @@ -0,0 +1,9 @@ +import type { PointerEventType, PointerType } from '@interactjs/core/types'; +export declare class PointerInfo { + id: number; + pointer: PointerType; + event: PointerEventType; + downTime: number; + downTarget: Node; + constructor(id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node); +} diff --git a/packages/@interactjs/core/PointerInfo.js b/packages/@interactjs/core/PointerInfo.js new file mode 100644 index 000000000..c962ec0e9 --- /dev/null +++ b/packages/@interactjs/core/PointerInfo.js @@ -0,0 +1,17 @@ +export class PointerInfo { + id; + pointer; + event; + downTime; + downTarget; + + constructor(id, pointer, event, downTime, downTarget) { + this.id = id; + this.pointer = pointer; + this.event = event; + this.downTime = downTime; + this.downTarget = downTarget; + } + +} +//# sourceMappingURL=PointerInfo.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/PointerInfo.js.map b/packages/@interactjs/core/PointerInfo.js.map new file mode 100644 index 000000000..26439a46a --- /dev/null +++ b/packages/@interactjs/core/PointerInfo.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "names": [ + "PointerInfo", + "id", + "pointer", + "event", + "downTime", + "downTarget", + "constructor" + ], + "sources": [ + "PointerInfo.ts" + ], + "sourcesContent": [ + "import type { PointerEventType, PointerType } from '@interactjs/core/types'\n\nexport class PointerInfo {\n id: number\n pointer: PointerType\n event: PointerEventType\n downTime: number\n downTarget: Node\n\n constructor (id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node) {\n this.id = id\n this.pointer = pointer\n this.event = event\n this.downTime = downTime\n this.downTarget = downTarget\n }\n}\n" + ], + "mappings": "AAEA,OAAO,MAAMA,WAAN,CAAkB;EACvBC,EAAE;EACFC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC,UAAU;;EAEVC,WAAW,CAAEL,EAAF,EAAcC,OAAd,EAAoCC,KAApC,EAA6DC,QAA7D,EAA+EC,UAA/E,EAAiG;IAC1G,KAAKJ,EAAL,GAAUA,EAAV;IACA,KAAKC,OAAL,GAAeA,OAAf;IACA,KAAKC,KAAL,GAAaA,KAAb;IACA,KAAKC,QAAL,GAAgBA,QAAhB;IACA,KAAKC,UAAL,GAAkBA,UAAlB;EACD;;AAbsB" +} \ No newline at end of file diff --git a/packages/@interactjs/core/PointerInfo.prod.js b/packages/@interactjs/core/PointerInfo.prod.js new file mode 100644 index 000000000..2951a7025 --- /dev/null +++ b/packages/@interactjs/core/PointerInfo.prod.js @@ -0,0 +1,2 @@ +export class PointerInfo{id;pointer;event;downTime;downTarget;constructor(t,e,i,n,o){this.id=t,this.pointer=e,this.event=i,this.downTime=n,this.downTarget=o}} +//# sourceMappingURL=PointerInfo.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/PointerInfo.prod.js.map b/packages/@interactjs/core/PointerInfo.prod.js.map new file mode 100644 index 000000000..cf3875a5a --- /dev/null +++ b/packages/@interactjs/core/PointerInfo.prod.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "PointerInfo", + "id", + "pointer", + "event", + "downTime", + "downTarget", + "constructor", + "this" + ], + "sources": [ + "PointerInfo.ts" + ], + "sourcesContent": [ + "import type { PointerEventType, PointerType } from '@interactjs/core/types'\n\nexport class PointerInfo {\n id: number\n pointer: PointerType\n event: PointerEventType\n downTime: number\n downTarget: Node\n\n constructor (id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node) {\n this.id = id\n this.pointer = pointer\n this.event = event\n this.downTime = downTime\n this.downTarget = downTarget\n }\n}\n" + ], + "mappings": "OAEO,MAAMA,YACXC,GACAC,QACAC,MACAC,SACAC,WAEAC,YAAaL,EAAYC,EAAsBC,EAAyBC,EAAkBC,GACxFE,KAAKN,GAAKA,EACVM,KAAKL,QAAUA,EACfK,KAAKJ,MAAQA,EACbI,KAAKH,SAAWA,EAChBG,KAAKF,WAAaA" +} \ No newline at end of file diff --git a/packages/@interactjs/core/events.d.ts b/packages/@interactjs/core/events.d.ts new file mode 100644 index 000000000..71c43f012 --- /dev/null +++ b/packages/@interactjs/core/events.d.ts @@ -0,0 +1,55 @@ +import type { Scope } from '@interactjs/core/scope'; +import type { Element } from '@interactjs/core/types'; +import type { NativeEventTarget } from './NativeTypes'; +declare module '@interactjs/core/scope' { + interface Scope { + events: ReturnType; + } +} +interface EventOptions { + capture: boolean; + passive: boolean; +} +declare type PartialEventTarget = Partial; +declare type ListenerEntry = { + func: (event: Event | FakeEvent) => any; + options: EventOptions; +}; +declare function install(scope: Scope): { + add: (eventTarget: PartialEventTarget, type: string, listener: ListenerEntry['func'], optionalArg?: boolean | EventOptions) => void; + remove: (eventTarget: PartialEventTarget, type: string, listener?: 'all' | ListenerEntry['func'], optionalArg?: boolean | EventOptions) => void; + addDelegate: (selector: string, context: Node, type: string, listener: ListenerEntry['func'], optionalArg?: any) => void; + removeDelegate: (selector: string, context: Document | Element, type: string, listener?: ListenerEntry['func'], optionalArg?: any) => void; + delegateListener: (event: Event | FakeEvent, optionalArg?: any) => void; + delegateUseCapture: (this: Element, event: Event | FakeEvent) => any; + delegatedEvents: { + [type: string]: { + selector: string; + context: Node; + listeners: ListenerEntry[]; + }[]; + }; + documents: Document[]; + targets: { + eventTarget: PartialEventTarget; + events: { + [type: string]: ListenerEntry[]; + }; + }[]; + supportsOptions: boolean; + supportsPassive: boolean; +}; +declare class FakeEvent implements Partial { + currentTarget: Node; + originalEvent: Event; + type: string; + constructor(originalEvent: Event); + preventOriginalDefault(): void; + stopPropagation(): void; + stopImmediatePropagation(): void; +} +declare const _default: { + id: string; + install: typeof install; +}; +export default _default; diff --git a/packages/@interactjs/core/events.js b/packages/@interactjs/core/events.js new file mode 100644 index 000000000..b49de7130 --- /dev/null +++ b/packages/@interactjs/core/events.js @@ -0,0 +1,286 @@ +import * as arr from "../utils/arr.js"; +import * as domUtils from "../utils/domUtils.js"; +import is from "../utils/is.js"; +import pExtend from "../utils/pointerExtend.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; + +function install(scope) { + var _scope$document; + + const targets = []; + const delegatedEvents = {}; + const documents = []; + const eventsMethods = { + add, + remove, + addDelegate, + removeDelegate, + delegateListener, + delegateUseCapture, + delegatedEvents, + documents, + targets, + supportsOptions: false, + supportsPassive: false + }; // check if browser supports passive events and options arg + + (_scope$document = scope.document) == null ? void 0 : _scope$document.createElement('div').addEventListener('test', null, { + get capture() { + return eventsMethods.supportsOptions = true; + }, + + get passive() { + return eventsMethods.supportsPassive = true; + } + + }); + scope.events = eventsMethods; + + function add(eventTarget, type, listener, optionalArg) { + if (!eventTarget.addEventListener) return; + const options = getOptions(optionalArg); + let target = arr.find(targets, t => t.eventTarget === eventTarget); + + if (!target) { + target = { + eventTarget, + events: {} + }; + targets.push(target); + } + + if (!target.events[type]) { + target.events[type] = []; + } + + if (!arr.find(target.events[type], l => l.func === listener && optionsMatch(l.options, options))) { + eventTarget.addEventListener(type, listener, eventsMethods.supportsOptions ? options : options.capture); + target.events[type].push({ + func: listener, + options + }); + } + } + + function remove(eventTarget, type, listener, optionalArg) { + if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return; + const targetIndex = arr.findIndex(targets, t => t.eventTarget === eventTarget); + const target = targets[targetIndex]; + + if (!target || !target.events) { + return; + } + + if (type === 'all') { + for (type in target.events) { + if (target.events.hasOwnProperty(type)) { + remove(eventTarget, type, 'all'); + } + } + + return; + } + + let typeIsEmpty = false; + const typeListeners = target.events[type]; + + if (typeListeners) { + if (listener === 'all') { + for (let i = typeListeners.length - 1; i >= 0; i--) { + const entry = typeListeners[i]; + remove(eventTarget, type, entry.func, entry.options); + } + + return; + } else { + const options = getOptions(optionalArg); + + for (let i = 0; i < typeListeners.length; i++) { + const entry = typeListeners[i]; + + if (entry.func === listener && optionsMatch(entry.options, options)) { + eventTarget.removeEventListener(type, listener, eventsMethods.supportsOptions ? options : options.capture); + typeListeners.splice(i, 1); + + if (typeListeners.length === 0) { + delete target.events[type]; + typeIsEmpty = true; + } + + break; + } + } + } + } + + if (typeIsEmpty && !Object.keys(target.events).length) { + targets.splice(targetIndex, 1); + } + } + + function addDelegate(selector, context, type, listener, optionalArg) { + const options = getOptions(optionalArg); + + if (!delegatedEvents[type]) { + delegatedEvents[type] = []; // add delegate listener functions + + for (const doc of documents) { + add(doc, type, delegateListener); + add(doc, type, delegateUseCapture, true); + } + } + + const delegates = delegatedEvents[type]; + let delegate = arr.find(delegates, d => d.selector === selector && d.context === context); + + if (!delegate) { + delegate = { + selector, + context, + listeners: [] + }; + delegates.push(delegate); + } + + delegate.listeners.push({ + func: listener, + options + }); + } + + function removeDelegate(selector, context, type, listener, optionalArg) { + const options = getOptions(optionalArg); + const delegates = delegatedEvents[type]; + let matchFound = false; + let index; + if (!delegates) return; // count from last index of delegated to 0 + + for (index = delegates.length - 1; index >= 0; index--) { + const cur = delegates[index]; // look for matching selector and context Node + + if (cur.selector === selector && cur.context === context) { + const { + listeners + } = cur; // each item of the listeners array is an array: [function, capture, passive] + + for (let i = listeners.length - 1; i >= 0; i--) { + const entry = listeners[i]; // check if the listener functions and capture and passive flags match + + if (entry.func === listener && optionsMatch(entry.options, options)) { + // remove the listener from the array of listeners + listeners.splice(i, 1); // if all listeners for this target have been removed + // remove the target from the delegates array + + if (!listeners.length) { + delegates.splice(index, 1); // remove delegate function from context + + remove(context, type, delegateListener); + remove(context, type, delegateUseCapture, true); + } // 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 delegates = 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 < delegates.length; i++) { + const cur = delegates[i]; + const { + selector, + context + } = cur; + + if (domUtils.matchesSelector(element, selector) && domUtils.nodeContains(context, eventTarget) && domUtils.nodeContains(context, element)) { + const { + listeners + } = cur; + fakeEvent.currentTarget = element; + + for (const entry of listeners) { + if (optionsMatch(entry.options, options)) { + entry.func(fakeEvent); + } + } + } + } + + element = domUtils.parentNode(element); + } + } + + function delegateUseCapture(event) { + return delegateListener.call(this, event, true); + } // for type inferrence + + + return eventsMethods; +} + +class FakeEvent { + currentTarget; + originalEvent; + type; + + constructor(originalEvent) { + this.originalEvent = originalEvent; // duplicate the event so that currentTarget can be changed + + pExtend(this, originalEvent); + } + + preventOriginalDefault() { + this.originalEvent.preventDefault(); + } + + stopPropagation() { + this.originalEvent.stopPropagation(); + } + + stopImmediatePropagation() { + this.originalEvent.stopImmediatePropagation(); + } + +} + +function getOptions(param) { + if (!is.object(param)) { + return { + capture: !!param, + passive: false + }; + } + + return { + capture: !!param.capture, + passive: !!param.passive + }; +} + +function optionsMatch(a, b) { + if (a === b) return true; + if (typeof a === 'boolean') return !!b.capture === a && !!b.passive === false; + return !!a.capture === !!b.capture && !!a.passive === !!b.passive; +} + +export default { + id: 'events', + install +}; +//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/events.js.map b/packages/@interactjs/core/events.js.map new file mode 100644 index 000000000..5e3f222f4 --- /dev/null +++ b/packages/@interactjs/core/events.js.map @@ -0,0 +1,93 @@ +{ + "version": 3, + "names": [ + "arr", + "domUtils", + "is", + "pExtend", + "pointerUtils", + "install", + "scope", + "targets", + "delegatedEvents", + "documents", + "eventsMethods", + "add", + "remove", + "addDelegate", + "removeDelegate", + "delegateListener", + "delegateUseCapture", + "supportsOptions", + "supportsPassive", + "document", + "createElement", + "addEventListener", + "capture", + "passive", + "events", + "eventTarget", + "type", + "listener", + "optionalArg", + "options", + "getOptions", + "target", + "find", + "t", + "push", + "l", + "func", + "optionsMatch", + "removeEventListener", + "targetIndex", + "findIndex", + "hasOwnProperty", + "typeIsEmpty", + "typeListeners", + "i", + "length", + "entry", + "splice", + "Object", + "keys", + "selector", + "context", + "doc", + "delegates", + "delegate", + "d", + "listeners", + "matchFound", + "index", + "cur", + "event", + "fakeEvent", + "FakeEvent", + "getEventTargets", + "element", + "matchesSelector", + "nodeContains", + "currentTarget", + "parentNode", + "call", + "originalEvent", + "constructor", + "preventOriginalDefault", + "preventDefault", + "stopPropagation", + "stopImmediatePropagation", + "param", + "object", + "a", + "b", + "id" + ], + "sources": [ + "events.ts" + ], + "sourcesContent": [ + "import type { Scope } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport pExtend from '@interactjs/utils/pointerExtend'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { NativeEventTarget } from './NativeTypes'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n events: ReturnType\n }\n}\n\ninterface EventOptions {\n capture: boolean\n passive: boolean\n}\n\ntype PartialEventTarget = Partial\n\ntype ListenerEntry = { func: (event: Event | FakeEvent) => any, options: EventOptions }\n\nfunction install (scope: Scope) {\n const targets: Array<{\n eventTarget: PartialEventTarget\n events: { [type: string]: ListenerEntry[] }\n }> = []\n\n const delegatedEvents: {\n [type: string]: Array<{\n selector: string\n context: Node\n listeners: ListenerEntry[]\n }>\n } = {}\n const documents: Document[] = []\n\n const eventsMethods = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n targets,\n\n supportsOptions: false,\n supportsPassive: false,\n }\n\n // check if browser supports passive events and options arg\n scope.document?.createElement('div').addEventListener('test', null, {\n get capture () {\n return (eventsMethods.supportsOptions = true)\n },\n get passive () {\n return (eventsMethods.supportsPassive = true)\n },\n })\n\n scope.events = eventsMethods\n\n function add (\n eventTarget: PartialEventTarget,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener) return\n\n const options = getOptions(optionalArg)\n let target = arr.find(targets, (t) => t.eventTarget === eventTarget)\n\n if (!target) {\n target = {\n eventTarget,\n events: {},\n }\n\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n }\n\n if (!arr.find(target.events[type], (l) => l.func === listener && optionsMatch(l.options, options))) {\n eventTarget.addEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n target.events[type].push({ func: listener, options })\n }\n }\n\n function remove (\n eventTarget: PartialEventTarget,\n type: string,\n listener?: 'all' | ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return\n\n const targetIndex = arr.findIndex(targets, (t) => t.eventTarget === eventTarget)\n const target = targets[targetIndex]\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(eventTarget, type, 'all')\n }\n }\n return\n }\n\n let typeIsEmpty = false\n const typeListeners = target.events[type]\n\n if (typeListeners) {\n if (listener === 'all') {\n for (let i = typeListeners.length - 1; i >= 0; i--) {\n const entry = typeListeners[i]\n remove(eventTarget, type, entry.func, entry.options)\n }\n return\n } else {\n const options = getOptions(optionalArg)\n\n for (let i = 0; i < typeListeners.length; i++) {\n const entry = typeListeners[i]\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n eventTarget.removeEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n typeListeners.splice(i, 1)\n\n if (typeListeners.length === 0) {\n delete target.events[type]\n typeIsEmpty = true\n }\n\n break\n }\n }\n }\n }\n\n if (typeIsEmpty && !Object.keys(target.events).length) {\n targets.splice(targetIndex, 1)\n }\n }\n\n function addDelegate (\n selector: string,\n context: Node,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = []\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 delegates = delegatedEvents[type]\n let delegate = arr.find(delegates, (d) => d.selector === selector && d.context === context)\n\n if (!delegate) {\n delegate = { selector, context, listeners: [] }\n delegates.push(delegate)\n }\n\n delegate.listeners.push({ func: listener, options })\n }\n\n function removeDelegate (\n selector: string,\n context: Document | Element,\n type: string,\n listener?: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n const delegates = delegatedEvents[type]\n let matchFound = false\n let index: number\n\n if (!delegates) return\n\n // count from last index of delegated to 0\n for (index = delegates.length - 1; index >= 0; index--) {\n const cur = delegates[index]\n // look for matching selector and context Node\n if (cur.selector === selector && cur.context === context) {\n const { listeners } = cur\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 entry = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this target have been removed\n // remove the target from the delegates array\n if (!listeners.length) {\n delegates.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) {\n break\n }\n }\n }\n }\n\n // bound to the interactable context when a DOM event\n // listener is added to a selector interactable\n function delegateListener (event: Event | FakeEvent, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event as Event)\n const delegates = delegatedEvents[event.type]\n const [eventTarget] = pointerUtils.getEventTargets(event as 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 < delegates.length; i++) {\n const cur = delegates[i]\n const { selector, context } = cur\n\n if (\n domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)\n ) {\n const { listeners } = cur\n\n fakeEvent.currentTarget = element\n\n for (const entry of listeners) {\n if (optionsMatch(entry.options, options)) {\n entry.func(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n }\n\n function delegateUseCapture (this: Element, event: Event | FakeEvent) {\n return delegateListener.call(this, event, true)\n }\n\n // for type inferrence\n return eventsMethods\n}\n\nclass FakeEvent implements Partial {\n currentTarget: Node\n originalEvent: Event\n type: string\n\n constructor (originalEvent: Event) {\n this.originalEvent = originalEvent\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\nfunction getOptions (param: { [index: string]: any } | boolean): { capture: boolean, passive: boolean } {\n if (!is.object(param)) {\n return { capture: !!param, passive: false }\n }\n\n return {\n capture: !!param.capture,\n passive: !!param.passive,\n }\n}\n\nfunction optionsMatch (a: Partial | boolean, b: Partial) {\n if (a === b) return true\n\n if (typeof a === 'boolean') return !!b.capture === a && !!b.passive === false\n\n return !!a.capture === !!b.capture && !!a.passive === !!b.passive\n}\n\nexport default {\n id: 'events',\n install,\n}\n" + ], + "mappings": "AAEA,OAAO,KAAKA,GAAZ,MAAqB,iBAArB;AACA,OAAO,KAAKC,QAAZ,MAA0B,sBAA1B;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,OAAOC,OAAP,MAAoB,2BAApB;AACA,OAAO,KAAKC,YAAZ,MAA8B,0BAA9B;;AAmBA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAAA;;EAC9B,MAAMC,OAGJ,GAAG,EAHL;EAKA,MAAMC,eAML,GAAG,EANJ;EAOA,MAAMC,SAAqB,GAAG,EAA9B;EAEA,MAAMC,aAAa,GAAG;IACpBC,GADoB;IAEpBC,MAFoB;IAIpBC,WAJoB;IAKpBC,cALoB;IAOpBC,gBAPoB;IAQpBC,kBARoB;IASpBR,eAToB;IAUpBC,SAVoB;IAYpBF,OAZoB;IAcpBU,eAAe,EAAE,KAdG;IAepBC,eAAe,EAAE;EAfG,CAAtB,CAf8B,CAiC9B;;EACA,mBAAAZ,KAAK,CAACa,QAAN,qCAAgBC,aAAhB,CAA8B,KAA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E,EAAE,CAAC2E,MAAH,CAAUD,KAAV,CAAL,EAAuB;IACrB,OAAO;MAAEtD,OAAO,EAAE,CAAC,CAACsD,KAAb;MAAoBrD,OAAO,EAAE;IAA7B,CAAP;EACD;;EAED,OAAO;IACLD,OAAO,EAAE,CAAC,CAACsD,KAAK,CAACtD,OADZ;IAELC,OAAO,EAAE,CAAC,CAACqD,KAAK,CAACrD;EAFZ,CAAP;AAID;;AAED,SAASc,YAAT,CAAuByC,CAAvB,EAA2DC,CAA3D,EAAqF;EACnF,IAAID,CAAC,KAAKC,CAAV,EAAa,OAAO,IAAP;EAEb,IAAI,OAAOD,CAAP,KAAa,SAAjB,EAA4B,OAAO,CAAC,CAACC,CAAC,CAACzD,OAAJ,KAAgBwD,CAAhB,IAAqB,CAAC,CAACC,CAAC,CAACxD,OAAJ,KAAgB,KAA5C;EAE5B,OAAO,CAAC,CAACuD,CAAC,CAACxD,OAAJ,KAAgB,CAAC,CAACyD,CAAC,CAACzD,OAApB,IAA+B,CAAC,CAACwD,CAAC,CAACvD,OAAJ,KAAgB,CAAC,CAACwD,CAAC,CAACxD,OAA1D;AACD;;AAED,eAAe;EACbyD,EAAE,EAAE,QADS;EAEb3E;AAFa,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/core/events.prod.js b/packages/@interactjs/core/events.prod.js new file mode 100644 index 000000000..fb17888fc --- /dev/null +++ b/packages/@interactjs/core/events.prod.js @@ -0,0 +1,2 @@ +import*as e from"../utils/arr.prod.js";import*as t from"../utils/domUtils.prod.js";import n from"../utils/is.prod.js";import s from"../utils/pointerExtend.prod.js";import*as o from"../utils/pointerUtils.prod.js";class r{currentTarget;originalEvent;type;constructor(e){this.originalEvent=e,s(this,e)}preventOriginalDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}stopImmediatePropagation(){this.originalEvent.stopImmediatePropagation()}}function i(e){return n.object(e)?{capture:!!e.capture,passive:!!e.passive}:{capture:!!e,passive:!1}}function a(e,t){return e===t||("boolean"==typeof e?!!t.capture===e&&0==!!t.passive:!!e.capture==!!t.capture&&!!e.passive==!!t.passive)}export default{id:"events",install(s){var p;const l=[],c={},u=[],f={add:v,remove:d,addDelegate(t,n,s,o,r){const a=i(r);if(!c[s]){c[s]=[];for(const e of u)v(e,s,g),v(e,s,m,!0)}const p=c[s];let l=e.find(p,(e=>e.selector===t&&e.context===n));l||(l={selector:t,context:n,listeners:[]},p.push(l)),l.listeners.push({func:o,options:a})},removeDelegate(e,t,n,s,o){const r=i(o),p=c[n];let l,u=!1;if(p)for(l=p.length-1;l>=0;l--){const o=p[l];if(o.selector===e&&o.context===t){const{listeners:e}=o;for(let o=e.length-1;o>=0;o--){const i=e[o];if(i.func===s&&a(i.options,r)){e.splice(o,1),e.length||(p.splice(l,1),d(t,n,g),d(t,n,m,!0)),u=!0;break}}if(u)break}}},delegateListener:g,delegateUseCapture:m,delegatedEvents:c,documents:u,targets:l,supportsOptions:!1,supportsPassive:!1};function v(t,n,s,o){if(!t.addEventListener)return;const r=i(o);let p=e.find(l,(e=>e.eventTarget===t));p||(p={eventTarget:t,events:{}},l.push(p)),p.events[n]||(p.events[n]=[]),e.find(p.events[n],(e=>e.func===s&&a(e.options,r)))||(t.addEventListener(n,s,f.supportsOptions?r:r.capture),p.events[n].push({func:s,options:r}))}function d(t,n,s,o){if(!t.addEventListener||!t.removeEventListener)return;const r=e.findIndex(l,(e=>e.eventTarget===t)),p=l[r];if(!p||!p.events)return;if("all"===n){for(n in p.events)p.events.hasOwnProperty(n)&&d(t,n,"all");return}let c=!1;const u=p.events[n];if(u){if("all"===s){for(let e=u.length-1;e>=0;e--){const s=u[e];d(t,n,s.func,s.options)}return}{const e=i(o);for(let o=0;o\n }\n}\n\ninterface EventOptions {\n capture: boolean\n passive: boolean\n}\n\ntype PartialEventTarget = Partial\n\ntype ListenerEntry = { func: (event: Event | FakeEvent) => any, options: EventOptions }\n\nfunction install (scope: Scope) {\n const targets: Array<{\n eventTarget: PartialEventTarget\n events: { [type: string]: ListenerEntry[] }\n }> = []\n\n const delegatedEvents: {\n [type: string]: Array<{\n selector: string\n context: Node\n listeners: ListenerEntry[]\n }>\n } = {}\n const documents: Document[] = []\n\n const eventsMethods = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n targets,\n\n supportsOptions: false,\n supportsPassive: false,\n }\n\n // check if browser supports passive events and options arg\n scope.document?.createElement('div').addEventListener('test', null, {\n get capture () {\n return (eventsMethods.supportsOptions = true)\n },\n get passive () {\n return (eventsMethods.supportsPassive = true)\n },\n })\n\n scope.events = eventsMethods\n\n function add (\n eventTarget: PartialEventTarget,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener) return\n\n const options = getOptions(optionalArg)\n let target = arr.find(targets, (t) => t.eventTarget === eventTarget)\n\n if (!target) {\n target = {\n eventTarget,\n events: {},\n }\n\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n }\n\n if (!arr.find(target.events[type], (l) => l.func === listener && optionsMatch(l.options, options))) {\n eventTarget.addEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n target.events[type].push({ func: listener, options })\n }\n }\n\n function remove (\n eventTarget: PartialEventTarget,\n type: string,\n listener?: 'all' | ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return\n\n const targetIndex = arr.findIndex(targets, (t) => t.eventTarget === eventTarget)\n const target = targets[targetIndex]\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(eventTarget, type, 'all')\n }\n }\n return\n }\n\n let typeIsEmpty = false\n const typeListeners = target.events[type]\n\n if (typeListeners) {\n if (listener === 'all') {\n for (let i = typeListeners.length - 1; i >= 0; i--) {\n const entry = typeListeners[i]\n remove(eventTarget, type, entry.func, entry.options)\n }\n return\n } else {\n const options = getOptions(optionalArg)\n\n for (let i = 0; i < typeListeners.length; i++) {\n const entry = typeListeners[i]\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n eventTarget.removeEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n typeListeners.splice(i, 1)\n\n if (typeListeners.length === 0) {\n delete target.events[type]\n typeIsEmpty = true\n }\n\n break\n }\n }\n }\n }\n\n if (typeIsEmpty && !Object.keys(target.events).length) {\n targets.splice(targetIndex, 1)\n }\n }\n\n function addDelegate (\n selector: string,\n context: Node,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = []\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 delegates = delegatedEvents[type]\n let delegate = arr.find(delegates, (d) => d.selector === selector && d.context === context)\n\n if (!delegate) {\n delegate = { selector, context, listeners: [] }\n delegates.push(delegate)\n }\n\n delegate.listeners.push({ func: listener, options })\n }\n\n function removeDelegate (\n selector: string,\n context: Document | Element,\n type: string,\n listener?: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n const delegates = delegatedEvents[type]\n let matchFound = false\n let index: number\n\n if (!delegates) return\n\n // count from last index of delegated to 0\n for (index = delegates.length - 1; index >= 0; index--) {\n const cur = delegates[index]\n // look for matching selector and context Node\n if (cur.selector === selector && cur.context === context) {\n const { listeners } = cur\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 entry = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this target have been removed\n // remove the target from the delegates array\n if (!listeners.length) {\n delegates.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) {\n break\n }\n }\n }\n }\n\n // bound to the interactable context when a DOM event\n // listener is added to a selector interactable\n function delegateListener (event: Event | FakeEvent, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event as Event)\n const delegates = delegatedEvents[event.type]\n const [eventTarget] = pointerUtils.getEventTargets(event as 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 < delegates.length; i++) {\n const cur = delegates[i]\n const { selector, context } = cur\n\n if (\n domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)\n ) {\n const { listeners } = cur\n\n fakeEvent.currentTarget = element\n\n for (const entry of listeners) {\n if (optionsMatch(entry.options, options)) {\n entry.func(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n }\n\n function delegateUseCapture (this: Element, event: Event | FakeEvent) {\n return delegateListener.call(this, event, true)\n }\n\n // for type inferrence\n return eventsMethods\n}\n\nclass FakeEvent implements Partial {\n currentTarget: Node\n originalEvent: Event\n type: string\n\n constructor (originalEvent: Event) {\n this.originalEvent = originalEvent\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\nfunction getOptions (param: { [index: string]: any } | boolean): { capture: boolean, passive: boolean } {\n if (!is.object(param)) {\n return { capture: !!param, passive: false }\n }\n\n return {\n capture: !!param.capture,\n passive: !!param.passive,\n }\n}\n\nfunction optionsMatch (a: Partial | boolean, b: Partial) {\n if (a === b) return true\n\n if (typeof a === 'boolean') return !!b.capture === a && !!b.passive === false\n\n return !!a.cap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,EAAgBjB,EAGpB,KAAOzD,EAAG0E,QAAQA,IAAU,CAC1B,IAAK,IAAItB,EAAI,EAAGA,EAAIZ,EAAUU,OAAQE,IAAK,CACzC,MAAMD,EAAMX,EAAUY,IAChBpB,SAAEA,EAAFC,QAAYA,GAAYkB,EAE9B,GACEpD,EAAS4E,gBAAgBD,EAAS1C,IAClCjC,EAAS6E,aAAa3C,EAASwB,IAC/B1D,EAAS6E,aAAa3C,EAASyC,GAC/B,CACA,MAAM9B,UAAEA,GAAcO,EAEtBqB,EAAUpE,cAAgBsE,EAE1B,IAAK,MAAMrB,KAAST,EACd1B,EAAamC,EAAMjB,QAASA,IAC9BiB,EAAMP,KAAK0B,IAMnBE,EAAU3E,EAAS8E,WAAWH,IAIlC,SAASnC,EAAmCgC,GAC1C,OAAOjC,EAA4BiC,GAAO,GAI5C,OAvOA,OAAA/C,EAAAD,EAAMuD,WAANtD,EAAgBuD,cAAc,OAAOrB,iBAAiB,OAAQ,KAAM,CAC9D1C,cACF,OAAQY,EAAc2B,iBAAkB,GAEtCtC,cACF,OAAQW,EAAc4B,iBAAkB,KAI5CjC,EAAMsC,OAASjC,EA8NRA" +} \ No newline at end of file diff --git a/packages/@interactjs/core/interactablePreventDefault.d.ts b/packages/@interactjs/core/interactablePreventDefault.d.ts new file mode 100644 index 000000000..d0c7130ca --- /dev/null +++ b/packages/@interactjs/core/interactablePreventDefault.d.ts @@ -0,0 +1,18 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Scope } from '@interactjs/core/scope'; +declare module '@interactjs/core/Interactable' { + interface Interactable { + preventDefault: typeof preventDefault; + checkAndPreventDefault: (event: Event) => void; + } +} +declare type PreventDefaultValue = 'always' | 'never' | 'auto'; +declare function preventDefault(this: Interactable): PreventDefaultValue; +declare function preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this; +export declare function install(scope: Scope): void; +declare const _default: { + id: string; + install: typeof install; + listeners: any; +}; +export default _default; diff --git a/packages/@interactjs/core/interactablePreventDefault.js b/packages/@interactjs/core/interactablePreventDefault.js new file mode 100644 index 000000000..78f3152d8 --- /dev/null +++ b/packages/@interactjs/core/interactablePreventDefault.js @@ -0,0 +1,108 @@ +import { matchesSelector, nodeContains } from "../utils/domUtils.js"; +import 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 (scope.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/packages/@interactjs/core/interactablePreventDefault.js.map b/packages/@interactjs/core/interactablePreventDefault.js.map new file mode 100644 index 000000000..d3308ee67 --- /dev/null +++ b/packages/@interactjs/core/interactablePreventDefault.js.map @@ -0,0 +1,51 @@ +{ + "version": 3, + "names": [ + "matchesSelector", + "nodeContains", + "is", + "getWindow", + "preventDefault", + "newValue", + "test", + "options", + "bool", + "checkAndPreventDefault", + "interactable", + "scope", + "event", + "setting", + "events", + "supportsPassive", + "type", + "doc", + "target", + "document", + "docOptions", + "getDocOptions", + "passive", + "element", + "onInteractionEvent", + "interaction", + "install", + "Interactable", + "prototype", + "interactions", + "docEvents", + "push", + "listener", + "list", + "id", + "listeners", + "reduce", + "acc", + "eventType" + ], + "sources": [ + "interactablePreventDefault.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerEventType } from '@interactjs/core/types'\nimport { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport 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\ntype PreventDefaultValue = 'always' | 'never' | 'auto'\nfunction preventDefault(this: Interactable): PreventDefaultValue\nfunction preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this\nfunction preventDefault (this: Interactable, newValue?: PreventDefaultValue) {\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: Interactable, scope: 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 (scope.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 (\n is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')\n ) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interaction, event: PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: 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 (\n interaction.element &&\n (interaction.element === event.target || nodeContains(interaction.element, event.target))\n ) {\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" + ], + "mappings": "AAIA,SAASA,eAAT,EAA0BC,YAA1B,QAA8C,sBAA9C;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,SAASC,SAAT,QAA0B,oBAA1B;;AAYA,SAASC,cAAT,CAA6CC,QAA7C,EAA6E;EAC3E,IAAI,wBAAwBC,IAAxB,CAA6BD,QAA7B,CAAJ,EAA4C;IAC1C,KAAKE,OAAL,CAAaH,cAAb,GAA8BC,QAA9B;IACA,OAAO,IAAP;EACD;;EAED,IAAIH,EAAE,CAACM,IAAH,CAAQH,QAAR,CAAJ,EAAuB;IACrB,KAAKE,OAAL,CAAaH,cAAb,GAA8BC,QAAQ,GAAG,QAAH,GAAc,OAApD;IACA,OAAO,IAAP;EACD;;EAED,OAAO,KAAKE,OAAL,CAAaH,cAApB;AACD;;AAED,SAASK,sBAAT,CAAiCC,YAAjC,EAA6DC,KAA7D,EAA2EC,KAA3E,EAAyF;EACvF,MAAMC,OAAO,GAAGH,YAAY,CAACH,OAAb,CAAqBH,cAArC;EAEA,IAAIS,OAAO,KAAK,OAAhB,EAAyB;;EAEzB,IAAIA,OAAO,KAAK,QAAhB,EAA0B;IACxBD,KAAK,CAACR,cAAN;IACA;EACD,CARsF,CAUvF;EAEA;EACA;EACA;;;EACA,IAAIO,KAAK,CAACG,MAAN,CAAaC,eAAb,IAAgC,sBAAsBT,IAAtB,CAA2BM,KAAK,CAACI,IAAjC,CAApC,EAA4E;IAC1E,MAAMC,GAAG,GAAGd,SAAS,CAACS,KAA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d,KAAK,CAACkB,YAAN,CAAmBI,IAA7C,EAAmD;QACjD,IACER,WAAW,CAACF,OAAZ,KACCE,WAAW,CAACF,OAAZ,KAAwBX,KAAK,CAACM,MAA9B,IAAwCjB,YAAY,CAACwB,WAAW,CAACF,OAAb,EAAsBX,KAAK,CAACM,MAA5B,CADrD,CADF,EAGE;UACAO,WAAW,CAACf,YAAZ,CAAyBD,sBAAzB,CAAgDG,KAAhD;UACA;QACD;MACF;IACF;;EAZ+B,CAAlC;AAcD;AAED,eAAe;EACbsB,EAAE,EAAE,iCADS;EAEbR,OAFa;EAGbS,SAAS,EAAE,CAAC,MAAD,EAAS,MAAT,EAAiB,IAAjB,EAAuB,QAAvB,EAAiCC,MAAjC,CAAwC,CAACC,GAAD,EAAMC,SAAN,KAAoB;IACrED,GAAG,CAAE,gBAAeC,SAAU,EAA3B,CAAH,GAAmCd,kBAAnC;IACA,OAAOa,GAAP;EACD,CAHU,EAGR,EAHQ;AAHE,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/core/interactablePreventDefault.prod.js b/packages/@interactjs/core/interactablePreventDefault.prod.js new file mode 100644 index 000000000..bcf24eec4 --- /dev/null +++ b/packages/@interactjs/core/interactablePreventDefault.prod.js @@ -0,0 +1,2 @@ +import{matchesSelector as t,nodeContains as e}from"../utils/domUtils.prod.js";import n from"../utils/is.prod.js";import{getWindow as r}from"../utils/window.prod.js";function o(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):n.bool(t)?(this.options.preventDefault=t?"always":"never",this):this.options.preventDefault}function i({interaction:t,event:e}){t.interactable&&t.interactable.checkAndPreventDefault(e)}export function install(i){const{Interactable:s}=i;s.prototype.preventDefault=o,s.prototype.checkAndPreventDefault=function(e){return((e,o,i)=>{const s=e.options.preventDefault;if("never"!==s)if("always"!==s){if(o.events.supportsPassive&&/^touch(start|move)$/.test(i.type)){const t=r(i.target).document,e=o.getDocOptions(t);if(!e||!e.events||!1!==e.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(i.type)||n.element(i.target)&&t(i.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||i.preventDefault()}else i.preventDefault()})(this,i,e)},i.interactions.docEvents.push({type:"dragstart",listener(t){for(const n of i.interactions.list)if(n.element&&(n.element===t.target||e(n.element,t.target)))return void n.interactable.checkAndPreventDefault(t)}})}export default{id:"core/interactablePreventDefault",install:install,listeners:["down","move","up","cancel"].reduce(((t,e)=>(t["interactions:"+e]=i,t)),{})}; +//# sourceMappingURL=interactablePreventDefault.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/interactablePreventDefault.prod.js.map b/packages/@interactjs/core/interactablePreventDefault.prod.js.map new file mode 100644 index 000000000..aeeb35474 --- /dev/null +++ b/packages/@interactjs/core/interactablePreventDefault.prod.js.map @@ -0,0 +1,52 @@ +{ + "version": 3, + "names": [ + "matchesSelector", + "nodeContains", + "is", + "getWindow", + "preventDefault", + "newValue", + "test", + "this", + "options", + "bool", + "onInteractionEvent", + "interaction", + "event", + "interactable", + "checkAndPreventDefault", + "install", + "scope", + "Interactable", + "prototype", + "setting", + "events", + "supportsPassive", + "type", + "doc", + "target", + "document", + "docOptions", + "getDocOptions", + "passive", + "element", + "interactions", + "docEvents", + "push", + "listener", + "list", + "id", + "listeners", + "reduce", + "acc", + "eventType" + ], + "sources": [ + "interactablePreventDefault.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerEventType } from '@interactjs/core/types'\nimport { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport 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\ntype PreventDefaultValue = 'always' | 'never' | 'auto'\nfunction preventDefault(this: Interactable): PreventDefaultValue\nfunction preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this\nfunction preventDefault (this: Interactable, newValue?: PreventDefaultValue) {\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: Interactable, scope: 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 (scope.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 (\n is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')\n ) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interaction, event: PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: 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 (\n interaction.element &&\n (interaction.element === event.target || nodeContains(interaction.element, event.target))\n ) {\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" + ], + "mappings": "0BAISA,kBAAiBC,MAAoB,mCACvCC,MAAQ,0CACNC,MAAiB,0BAY1B,SAASC,EAAoCC,GAC3C,MAAI,wBAAwBC,KAAKD,IAC/BE,KAAKC,QAAQJ,eAAiBC,EACvBE,MAGLL,EAAGO,KAAKJ,IACVE,KAAKC,QAAQJ,eAAiBC,EAAW,SAAW,QAC7CE,MAGFA,KAAKC,QAAQJ,eA2CtB,SAASM,GAAoBC,YAAEA,EAAFC,MAAeA,IACtCD,EAAYE,cACdF,EAAYE,aAAaC,uBAAuBF,UAI7C,SAASG,QAASC,GAEvB,MAAMC,aAAEA,GAAiBD,EAYzBC,EAAaC,UAAUd,eAAiBA,EAExCa,EAAaC,UAAUJ,uBAAyB,SAAUF,GACxD,MA/DJ,EAAiCC,EAA4BG,EAAcJ,KACzE,MAAMO,EAAUN,EAAaL,QAAQJ,eAErC,GAAgB,UAAZe,EAEJ,GAAgB,WAAZA,EAAJ,CAUA,GAAIH,EAAMI,OAAOC,iBAAmB,sBAAsBf,KAAKM,EAAMU,MAAO,CAC1E,MAAMC,EAAMpB,EAAUS,EAAMY,QAAQC,SAC9BC,EAAaV,EAAMW,cAAcJ,GAEvC,IAAMG,IAAcA,EAAWN,SAAyC,IAA9BM,EAAWN,OAAOQ,QAC1D,OAKA,uCAAuCtB,KAAKM,EAAMU,OAMpDpB,EAAG2B,QAAQjB,EAAMY,SACjBxB,EAAgBY,EAAMY,OAAQ,0EAKhCZ,EAAMR,sBA/BJQ,EAAMR,kBAyDCU,CAAuBP,KAAMS,EAAOJ,IAI7CI,EAAMc,aAAaC,UAAUC,KAAK,CAChCV,KAAM,YACNW,SAAUrB,GACR,IAAK,MAAMD,KAAeK,EAAMc,aAAaI,KAC3C,GACEvB,EAAYkB,UACXlB,EAAYkB,UAAYjB,EAAMY,QAAUvB,EAAaU,EAAYkB,QAASjB,EAAMY,SAGjF,YADAb,EAAYE,aAAaC,uBAAuBF,oBAQ3C,CACbuB,GAAI,kCACJpB,gBACAqB,UAAW,CAAC,OAAQ,OAAQ,KAAM,UAAUC,QAAO,CAACC,EAAKC,KACvDD,EAAK,gBAAeC,GAAe7B,EAC5B4B,IACN" +} \ No newline at end of file diff --git a/packages/@interactjs/core/interactionFinder.d.ts b/packages/@interactjs/core/interactionFinder.d.ts new file mode 100644 index 000000000..6eca1c0a6 --- /dev/null +++ b/packages/@interactjs/core/interactionFinder.d.ts @@ -0,0 +1,21 @@ +import type Interaction from '@interactjs/core/Interaction'; +import type { Scope } from '@interactjs/core/scope'; +import type { PointerType } from '@interactjs/core/types'; +export interface SearchDetails { + pointer: PointerType; + pointerId: number; + pointerType: string; + eventType: string; + eventTarget: EventTarget; + curEventTarget: EventTarget; + scope: Scope; +} +declare const finder: { + methodOrder: readonly ["simulationResume", "mouseOrPen", "hasPointer", "idle"]; + search(details: SearchDetails): any; + simulationResume({ pointerType, eventType, eventTarget, scope }: SearchDetails): Interaction; + mouseOrPen({ pointerId, pointerType, eventType, scope }: SearchDetails): any; + hasPointer({ pointerId, scope }: SearchDetails): Interaction; + idle({ pointerType, scope }: SearchDetails): Interaction; +}; +export default finder; diff --git a/packages/@interactjs/core/interactionFinder.js b/packages/@interactjs/core/interactionFinder.js new file mode 100644 index 000000000..61bdaeda4 --- /dev/null +++ b/packages/@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/packages/@interactjs/core/interactionFinder.js.map b/packages/@interactjs/core/interactionFinder.js.map new file mode 100644 index 000000000..6c187abaa --- /dev/null +++ b/packages/@interactjs/core/interactionFinder.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "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" + ], + "sources": [ + "interactionFinder.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerType } from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: EventTarget\n curEventTarget: EventTarget\n scope: 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 (\n interaction.simulation &&\n interaction.simulation.allowResume &&\n interaction.pointerType === pointerType\n ) {\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)) {\n continue\n }\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: Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n" + ], + "mappings": "AAGA,OAAO,KAAKA,GAAZ,MAAqB,sBAArB;AAYA,MAAMC,MAAM,GAAG;EACbC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,YAA3B,CADqC,CAErC;QACA;;QACA,IAAID,MAAM,IAAI,EAAEA,MAAM,CAACE,OAAP,CAAeC,OAAf,IAA0BH,MAAM,CAACE,OAAP,CAAeC,OAAf,CAAuBC,OAAnD,CAAd,EAA2E;UACzE;QACD;MACF,CAPD,CAQA;MARA,KASK,IAAI1B,WAAW,CAACoB,QAAZ,CAAqBC,MAArB,IAA+B,CAAnC,EAAsC;QACzC;MACD;;MAED,IAAI,CAACrB,WAAW,CAACiB,WAAZ,EAAD,IAA8Bf,WAAW,KAAKF,WAAW,CAACE,WAA9D,EAA2E;QACzE,OAAOF,WAAP;MACD;IACF;;IAED,OAAO,IAAP;EACD;;AAxHY,CAAf;;AA2HA,SAASgB,YAAT,CAAuBhB,WAAvB,EAAiDc,SAAjD,EAAoE;EAClE,OAAOd,WAAW,CAACoB,QAAZ,CAAqBO,IAArB,CAA0B,CAAC;IAAEC;EAAF,CAAD,KAAYA,EAAE,KAAKd,SAA7C,CAAP;AACD;;AAED,eAAenB,MAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/core/interactionFinder.prod.js b/packages/@interactjs/core/interactionFinder.prod.js new file mode 100644 index 000000000..e6572cc7f --- /dev/null +++ b/packages/@interactjs/core/interactionFinder.prod.js @@ -0,0 +1,2 @@ +import*as e from"../utils/domUtils.prod.js";const t={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search(e){for(const n of t.methodOrder){const i=t[n](e);if(i)return i}return null},simulationResume({pointerType:t,eventType:n,eventTarget:i,scope:r}){if(!/down|start/i.test(n))return null;for(const n of r.interactions.list){let r=i;if(n.simulation&&n.simulation.allowResume&&n.pointerType===t)for(;r;){if(r===n.element)return n;r=e.parentNode(r)}}return null},mouseOrPen({pointerId:e,pointerType:t,eventType:i,scope:r}){if("mouse"!==t&&"pen"!==t)return null;let o;for(const i of r.interactions.list)if(i.pointerType===t){if(i.simulation&&!n(i,e))continue;if(i.interacting())return i;o||(o=i)}if(o)return o;for(const e of r.interactions.list)if(!(e.pointerType!==t||/down/i.test(i)&&e.simulation))return e;return null},hasPointer({pointerId:e,scope:t}){for(const i of t.interactions.list)if(n(i,e))return i;return null},idle({pointerType:e,scope:t}){for(const n of t.interactions.list){if(1===n.pointers.length){const e=n.interactable;if(e&&(!e.options.gesture||!e.options.gesture.enabled))continue}else if(n.pointers.length>=2)continue;if(!n.interacting()&&e===n.pointerType)return n}return null}};function n(e,t){return e.pointers.some((({id:e})=>e===t))}export default t; +//# sourceMappingURL=interactionFinder.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/interactionFinder.prod.js.map b/packages/@interactjs/core/interactionFinder.prod.js.map new file mode 100644 index 000000000..1db439a57 --- /dev/null +++ b/packages/@interactjs/core/interactionFinder.prod.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "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" + ], + "sources": [ + "interactionFinder.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerType } from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: EventTarget\n curEventTarget: EventTarget\n scope: 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 (\n interaction.simulation &&\n interaction.simulation.allowResume &&\n interaction.pointerType === pointerType\n ) {\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)) {\n continue\n }\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: Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n" + ], + "mappings": "UAGYA,MAAS,4BAYrB,MAAMC,EAAS,CACbC,YAAa,CAAC,mBAAoB,aAAc,aAAc,QAE9DC,OAAQC,GACN,IAAK,MAAMC,KAAUJ,EAAOC,YAAa,CACvC,MAAMI,EAAcL,EAAOI,GAAQD,GAEnC,GAAIE,EACF,OAAOA,EAIX,OAAO,MAITC,kBAAkBC,YAAEA,EAAFC,UAAeA,EAAfC,YAA0BA,EAA1BC,MAAuCA,IACvD,IAAK,cAAcC,KAAKH,GACtB,OAAO,KAGT,IAAK,MAAMH,KAAeK,EAAME,aAAaC,KAAM,CACjD,IAAIC,EAAUL,EAEd,GACEJ,EAAYU,YACZV,EAAYU,WAAWC,aACvBX,EAAYE,cAAgBA,EAE5B,KAAOO,GAAS,CAEd,GAAIA,IAAYT,EAAYS,QAC1B,OAAOT,EAETS,EAAUf,EAAIkB,WAAWH,IAK/B,OAAO,MAITI,YAAYC,UAAEA,EAAFZ,YAAaA,EAAbC,UAA0BA,EAA1BE,MAAqCA,IAC/C,GAAoB,UAAhBH,GAA2C,QAAhBA,EAC7B,OAAO,KAGT,IAAIa,EAEJ,IAAK,MAAMf,KAAeK,EAAME,aAAaC,KAC3C,GAAIR,EAAYE,cAAgBA,EAAa,CAE3C,GAAIF,EAAYU,aAAeM,EAAahB,EAAac,GACvD,SAIF,GAAId,EAAYiB,cACd,OAAOjB,EAGCe,IACRA,EAAiBf,GAOvB,GAAIe,EACF,OAAOA,EAMT,IAAK,MAAMf,KAAeK,EAAME,aAAaC,KAC3C,KAAIR,EAAYE,cAAgBA,GAAiB,QAAQI,KAAKH,IAAcH,EAAYU,YACtF,OAAOV,EAIX,OAAO,MAITkB,YAAYJ,UAAEA,EAAFT,MAAaA,IACvB,IAAK,MAAML,KAAeK,EAAME,aAAaC,KAC3C,GAAIQ,EAAahB,EAAac,GAC5B,OAAOd,EAIX,OAAO,MAITmB,MAAMjB,YAAEA,EAAFG,MAAeA,IACnB,IAAK,MAAML,KAAeK,EAAME,aAAaC,KAAM,CAEjD,GAAoC,IAAhCR,EAAYoB,SAASC,OAAc,CACrC,MAAMC,EAAStB,EAAYuB,aAG3B,GAAID,KAAYA,EAAOE,QAAQC,UAAWH,EAAOE,QAAQC,QAAQC,SAC/D,cAIC,GAAI1B,EAAYoB,SAASC,QAAU,EACtC,SAGF,IAAKrB,EAAYiB,eAAiBf,IAAgBF,EAAYE,YAC5D,OAAOF,EAIX,OAAO,OAIX,SAASgB,EAAchB,EAA0Bc,GAC/C,OAAOd,EAAYoB,SAASO,MAAK,EAAGC,QAASA,IAAOd,mBAGvCnB" +} \ No newline at end of file diff --git a/packages/@interactjs/core/interactions.d.ts b/packages/@interactjs/core/interactions.d.ts new file mode 100644 index 000000000..3823ca016 --- /dev/null +++ b/packages/@interactjs/core/interactions.d.ts @@ -0,0 +1,31 @@ +import type { Plugin } from '@interactjs/core/scope'; +import type { ActionName, Listener } from '@interactjs/core/types'; +import InteractionBase from './Interaction'; +import './interactablePreventDefault'; +import type { SearchDetails } from './interactionFinder'; +declare module '@interactjs/core/scope' { + interface Scope { + Interaction: typeof InteractionBase; + interactions: { + new: (options: any) => InteractionBase; + list: Array>; + listeners: { + [type: string]: Listener; + }; + docEvents: Array<{ + type: string; + listener: Listener; + }>; + pointerMoveTolerance: number; + }; + prevTouchTime: number; + } + interface SignalArgs { + 'interactions:find': { + interaction: InteractionBase; + searchDetails: SearchDetails; + }; + } +} +declare const interactions: Plugin; +export default interactions; diff --git a/packages/@interactjs/core/interactions.js b/packages/@interactjs/core/interactions.js new file mode 100644 index 000000000..8ddc2edb1 --- /dev/null +++ b/packages/@interactjs/core/interactions.js @@ -0,0 +1,282 @@ +import browser from "../utils/browser.js"; +import domObjects from "../utils/domObjects.js"; +import { nodeContains } from "../utils/domUtils.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; +import InteractionBase from './Interaction'; +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ + +import './interactablePreventDefault'; +import interactablePreventDefault from './interactablePreventDefault'; +/* eslint-enable import/no-duplicates */ + +import finder from './interactionFinder'; +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 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); + } + } + } + } + + scope.usePlugin(interactablePreventDefault); +} + +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(); // @ts-expect-error + + 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 { + interactions: { + docEvents + }, + events + } = scope; + 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); + } +} + +const interactions = { + id: 'core/interactions', + install, + listeners: { + 'scope:add-document': arg => onDocSignal(arg, 'add'), + 'scope:remove-document': arg => onDocSignal(arg, 'remove'), + 'interactable:unset': ({ + interactable + }, scope) => { + // Stop and destroy related interactions when an Interactable is unset + for (let i = scope.interactions.list.length - 1; i >= 0; i--) { + const interaction = scope.interactions.list[i]; + + if (interaction.interactable !== interactable) { + continue; + } + + interaction.stop(); + scope.fire('interactions:destroy', { + interaction + }); + interaction.destroy(); + + if (scope.interactions.list.length > 2) { + scope.interactions.list.splice(i, 1); + } + } + } + }, + onDocSignal, + doOnInteractions, + methodNames +}; +export default interactions; +//# sourceMappingURL=interactions.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/interactions.js.map b/packages/@interactjs/core/interactions.js.map new file mode 100644 index 000000000..b8bd342c5 --- /dev/null +++ b/packages/@interactjs/core/interactions.js.map @@ -0,0 +1,103 @@ +{ + "version": 3, + "names": [ + "browser", + "domObjects", + "nodeContains", + "pointerUtils", + "InteractionBase", + "interactablePreventDefault", + "finder", + "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", + "usePlugin", + "getPointerType", + "eventTarget", + "curEventTarget", + "getEventTargets", + "matches", + "test", + "changedTouch", + "changedTouches", + "pointerId", + "getPointerId", + "searchDetails", + "eventType", + "getInteraction", + "invalidPointer", + "supportsPointerEvent", + "i", + "length", + "timeStamp", + "foundInteraction", + "search", + "signalArg", + "onDocSignal", + "eventMethodName", + "events", + "eventMethod", + "isIOS", + "passive", + "delegatedEvents", + "delegateListener", + "delegateUseCapture", + "eventOptions", + "id", + "interactable", + "stop", + "destroy", + "splice" + ], + "sources": [ + "interactions.ts" + ], + "sourcesContent": [ + "import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Listener } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport InteractionBase from './Interaction'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './interactablePreventDefault'\nimport interactablePreventDefault from './interactablePreventDefault'\n/* eslint-enable import/no-duplicates */\nimport type { SearchDetails } from './interactionFinder'\nimport finder from './interactionFinder'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: Array>\n listeners: { [type: string]: Listener }\n docEvents: Array<{ type: string, listener: Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown',\n 'pointerMove',\n 'pointerUp',\n 'updatePointer',\n 'removePointer',\n '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 } 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 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 () {\n return scope.now()\n }\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 || interaction.pointerType !== 'touch' || 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 scope.usePlugin(interactablePreventDefault)\n}\n\nfunction doOnInteractions (method: string, scope: Scope) {\n return function (event: Event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches: any[] = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n // @ts-expect-error\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 } 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 =\n 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 as PointerEvent,\n pointerId: pointerUtils.getPointerId(event as PointerEvent),\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 (\n { doc, scope, options }: SignalArgs[T],\n eventMethodName: 'add' | 'remove',\n) {\n const {\n interactions: { docEvents },\n events,\n } = scope\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\nconst interactions: Plugin = {\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 'interactable:unset': ({ interactable }, scope) => {\n // Stop and destroy related interactions when an Interactable is 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 !== interactable) {\n continue\n }\n\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 onDocSignal,\n doOnInteractions,\n methodNames,\n}\n\nexport default interactions\n" + ], + "mappings": "AAEA,OAAOA,OAAP,MAAoB,qBAApB;A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MAAE6C;IAAF,CAAD,EAAmB9E,KAAnB,KAA6B;MACjD;MACA,KAAK,IAAI6D,CAAC,GAAG7D,KAAK,CAACoB,YAAN,CAAmBC,IAAnB,CAAwByC,MAAxB,GAAiC,CAA9C,EAAiDD,CAAC,IAAI,CAAtD,EAAyDA,CAAC,EAA1D,EAA8D;QAC5D,MAAM1C,WAAW,GAAGnB,KAAK,CAACoB,YAAN,CAAmBC,IAAnB,CAAwBwC,CAAxB,CAApB;;QAEA,IAAI1C,WAAW,CAAC2D,YAAZ,KAA6BA,YAAjC,EAA+C;UAC7C;QACD;;QAED3D,WAAW,CAAC4D,IAAZ;QACA/E,KAAK,CAACkC,IAAN,CAAW,sBAAX,EAAmC;UAAEf;QAAF,CAAnC;QACAA,WAAW,CAAC6D,OAAZ;;QAEA,IAAIhF,KAAK,CAACoB,YAAN,CAAmBC,IAAnB,CAAwByC,MAAxB,GAAiC,CAArC,EAAwC;UACtC9D,KAAK,CAACoB,YAAN,CAAmBC,IAAnB,CAAwB4D,MAAxB,CAA+BpB,CAA/B,EAAkC,CAAlC;QACD;MACF;IACF;EApBQ,CAHgB;EAyB3BM,WAzB2B;EA0B3BhE,gBA1B2B;EA2B3BL;AA3B2B,CAA7B;AA8BA,eAAesB,YAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/core/interactions.prod.js b/packages/@interactjs/core/interactions.prod.js new file mode 100644 index 000000000..a6a787f12 --- /dev/null +++ b/packages/@interactjs/core/interactions.prod.js @@ -0,0 +1,2 @@ +import e from"../utils/browser.prod.js";import t from"../utils/domObjects.prod.js";import{nodeContains as n}from"../utils/domUtils.prod.js";import*as o from"../utils/pointerUtils.prod.js";import r from"./Interaction";import"./interactablePreventDefault";import i from"./interactablePreventDefault";import s from"./interactionFinder";const p=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function c(t,n){return r=>{const i=n.interactions.list,s=o.getPointerType(r),[p,c]=o.getEventTargets(r),l=[];if(/^touch/.test(r.type)){n.prevTouchTime=n.now();for(const e of r.changedTouches){const t=e,i={pointer:t,pointerId:o.getPointerId(t),pointerType:s,eventType:r.type,eventTarget:p,curEventTarget:c,scope:n},u=a(i);l.push([i.pointer,i.eventTarget,i.curEventTarget,u])}}else{let t=!1;if(!e.supportsPointerEvent&&/mouse/.test(r.type)){for(let e=0;en(e,t.downTarget)))||e.removePointer(t.pointer,t.event)}l=t.PointerEvent?[{type:a.down,listener:u},{type:a.down,listener:s.pointerDown},{type:a.move,listener:s.pointerMove},{type:a.up,listener:s.pointerUp},{type:a.cancel,listener:s.pointerUp}]:[{type:"mousedown",listener:s.pointerDown},{type:"mousemove",listener:s.pointerMove},{type:"mouseup",listener:s.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:s.pointerDown},{type:"touchmove",listener:s.pointerMove},{type:"touchend",listener:s.pointerUp},{type:"touchcancel",listener:s.pointerUp}],l.push({type:"blur",listener(e){for(const t of o.interactions.list)t.documentBlur(e)}}),o.prevTouchTime=0,o.Interaction=class extends r{get pointerMoveTolerance(){return o.interactions.pointerMoveTolerance}set pointerMoveTolerance(e){o.interactions.pointerMoveTolerance=e}_now(){return o.now()}},o.interactions={list:[],new(e){e.scopeFire=(e,t)=>o.fire(e,t);const t=new o.Interaction(e);return o.interactions.list.push(t),t},listeners:s,docEvents:l,pointerMoveTolerance:1},o.usePlugin(i)},listeners:{"scope:add-document":e=>l(e,"add"),"scope:remove-document":e=>l(e,"remove"),"interactable:unset"({interactable:e},t){for(let n=t.interactions.list.length-1;n>=0;n--){const o=t.interactions.list[n];o.interactable===e&&(o.stop(),t.fire("interactions:destroy",{interaction:o}),o.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(n,1))}}},onDocSignal:l,doOnInteractions:c,methodNames:p};export default u; +//# sourceMappingURL=interactions.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/interactions.prod.js.map b/packages/@interactjs/core/interactions.prod.js.map new file mode 100644 index 000000000..ecb0c3213 --- /dev/null +++ b/packages/@interactjs/core/interactions.prod.js.map @@ -0,0 +1,102 @@ +{ + "version": 3, + "names": [ + "browser", + "domObjects", + "nodeContains", + "pointerUtils", + "InteractionBase", + "interactablePreventDefault", + "finder", + "methodNames", + "doOnInteractions", + "method", + "scope", + "event", + "interactions", + "list", + "pointerType", + "getPointerType", + "eventTarget", + "curEventTarget", + "getEventTargets", + "matches", + "test", + "type", + "prevTouchTime", + "now", + "changedTouch", + "changedTouches", + "pointer", + "searchDetails", + "pointerId", + "getPointerId", + "eventType", + "interaction", + "getInteraction", + "push", + "invalidPointer", + "supportsPointerEvent", + "i", + "length", + "pointerIsDown", + "timeStamp", + "signalArg", + "search", + "fire", + "new", + "onDocSignal", + "doc", + "options", + "eventMethodName", + "docEvents", + "events", + "eventMethod", + "isIOS", + "passive", + "delegatedEvents", + "delegateListener", + "delegateUseCapture", + "eventOptions", + "listener", + "id", + "install", + "listeners", + "pEventTypes", + "releasePointersOnRemovedEls", + "_interacting", + "pointers", + "documents", + "some", + "downTarget", + "removePointer", + "PointerEvent", + "down", + "pointerDown", + "move", + "pointerMove", + "up", + "pointerUp", + "cancel", + "documentBlur", + "Interaction", + "pointerMoveTolerance", + "value", + "_now", + "scopeFire", + "name", + "arg", + "usePlugin", + "interactable", + "stop", + "destroy", + "splice" + ], + "sources": [ + "interactions.ts" + ], + "sourcesContent": [ + "import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Listener } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport InteractionBase from './Interaction'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './interactablePreventDefault'\nimport interactablePreventDefault from './interactablePreventDefault'\n/* eslint-enable import/no-duplicates */\nimport type { SearchDetails } from './interactionFinder'\nimport finder from './interactionFinder'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: Array>\n listeners: { [type: string]: Listener }\n docEvents: Array<{ type: string, listener: Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown',\n 'pointerMove',\n 'pointerUp',\n 'updatePointer',\n 'removePointer',\n '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 } 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 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 () {\n return scope.now()\n }\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 || interaction.pointerType !== 'touch' || 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 scope.usePlugin(interactablePreventDefault)\n}\n\nfunction doOnInteractions (method: string, scope: Scope) {\n return function (event: Event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches: any[] = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n // @ts-expect-error\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 } 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 =\n 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 as PointerEvent,\n pointerId: pointerUtils.getPointerId(event as PointerEvent),\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 (\n { doc, scope, options }: SignalArgs[T],\n eventMethodName: 'add' | 'remove',\n) {\n const {\n interactions: { docEvents },\n events,\n } = scope\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\nconst interactions: Plugin = {\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 'interactable:unset': ({ interactable }, scope) => {\n // Stop and destroy related interactions when an Interactable is 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 !== interactable) {\n continue\n }\n\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 onDocSignal,\n doOnInteractions,\n methodNames,\n}\n\nexport default interactions\n" + ], + "mappings": "OAEOA,MAAa,kCACbC,MAAgB,qDACdC,MAAoB,sCACjBC,MAAkB,uCAEvBC,MAAqB,sBAErB,sCACAC,MAAgC,sCAGhCC,MAAY,sBAuBnB,MAAMC,EAAc,CAClB,cACA,cACA,YACA,gBACA,gBACA,cAiGF,SAASC,EAAkBC,EAAgBC,GACzC,OAAiBC,IACf,MAAMC,EAAeF,EAAME,aAAaC,KAElCC,EAAcX,EAAaY,eAAeJ,IACzCK,EAAaC,GAAkBd,EAAae,gBAAgBP,GAC7DQ,EAAiB,GAEvB,GAAI,SAASC,KAAKT,EAAMU,MAAO,CAC7BX,EAAMY,cAAgBZ,EAAMa,MAG5B,IAAK,MAAMC,KAAgBb,EAAMc,eAAgB,CAC/C,MAAMC,EAAUF,EAEVG,EAA+B,CACnCD,UACAE,UAHgBzB,EAAa0B,aAAaH,GAI1CZ,cACAgB,UAAWnB,EAAMU,KACjBL,cACAC,iBACAP,SAEIqB,EAAcC,EAAeL,GAEnCR,EAAQc,KAAK,CACXN,EAAcD,QACdC,EAAcX,YACdW,EAAcV,eACdc,SAGC,CACL,IAAIG,GAAiB,EAErB,IAAKlC,EAAQmC,sBAAwB,QAAQf,KAAKT,EAAMU,MAAO,CAE7D,IAAK,IAAIe,EAAI,EAAGA,EAAIxB,EAAayB,SAAWH,EAAgBE,IAC1DF,EAAiD,UAAhCtB,EAAawB,GAAGtB,aAA2BF,EAAawB,GAAGE,cAK9EJ,EACEA,GACAxB,EAAMa,MAAQb,EAAMY,cAAgB,KAEhB,IAApBX,EAAM4B,UAGV,IAAKL,EAAgB,CACnB,MAAMP,EAAgB,CACpBD,QAASf,EACTiB,UAAWzB,EAAa0B,aAAalB,GACrCG,cACAgB,UAAWnB,EAAMU,KACjBJ,iBACAD,cAC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AET6B,YACAZ,YACA+B,qBAAsB,GAoBxBrE,EAAM2E,UAAUhF,IA4HhBuD,UAAW,CACT,qBAAuBwB,GAAQxC,EAAYwC,EAAK,OAChD,wBAA0BA,GAAQxC,EAAYwC,EAAK,UACnD,sBAAyBE,gBAAgB5E,GAEvC,IAAK,IAAI0B,EAAI1B,EAAME,aAAaC,KAAKwB,OAAS,EAAGD,GAAK,EAAGA,IAAK,CAC5D,MAAML,EAAcrB,EAAME,aAAaC,KAAKuB,GAExCL,EAAYuD,eAAiBA,IAIjCvD,EAAYwD,OACZ7E,EAAMgC,KAAK,uBAAwB,CAAEX,gBACrCA,EAAYyD,UAER9E,EAAME,aAAaC,KAAKwB,OAAS,GACnC3B,EAAME,aAAaC,KAAK4E,OAAOrD,EAAG,OAK1CQ,cACApC,mBACAD,8BAGaK" +} \ No newline at end of file diff --git a/packages/@interactjs/core/options.d.ts b/packages/@interactjs/core/options.d.ts new file mode 100644 index 000000000..e4c86606e --- /dev/null +++ b/packages/@interactjs/core/options.d.ts @@ -0,0 +1,27 @@ +import type { Point, Listeners, OrBoolean, Element, Rect } from '@interactjs/core/types'; +export interface Defaults { + base: BaseDefaults; + perAction: PerActionDefaults; + actions: ActionDefaults; +} +export interface ActionDefaults { +} +export interface BaseDefaults { + preventDefault?: 'auto' | 'never' | string; + deltaSource?: 'page' | 'client'; + context?: Node; + getRect?: (element: Element) => Rect; +} +export interface PerActionDefaults { + enabled?: boolean; + origin?: Point | string | Element; + listeners?: Listeners; + allowFrom?: string | Element; + ignoreFrom?: string | Element; +} +export declare type Options = Partial & Partial & { + [P in keyof ActionDefaults]?: Partial; +}; +export interface OptionsArg extends BaseDefaults, OrBoolean> { +} +export declare const defaults: Defaults; diff --git a/packages/@interactjs/core/options.js b/packages/@interactjs/core/options.js new file mode 100644 index 000000000..619e42241 --- /dev/null +++ b/packages/@interactjs/core/options.js @@ -0,0 +1,16 @@ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export const defaults = { + base: { + preventDefault: 'auto', + deltaSource: 'page' + }, + perAction: { + enabled: false, + origin: { + x: 0, + y: 0 + } + }, + actions: {} +}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/options.js.map b/packages/@interactjs/core/options.js.map new file mode 100644 index 000000000..c9f87e060 --- /dev/null +++ b/packages/@interactjs/core/options.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "defaults", + "base", + "preventDefault", + "deltaSource", + "perAction", + "enabled", + "origin", + "x", + "y", + "actions" + ], + "sources": [ + "options.ts" + ], + "sourcesContent": [ + "import type { Point, Listeners, OrBoolean, Element, Rect } from '@interactjs/core/types'\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\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Node\n getRect?: (element: Element) => Rect\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Point | string | Element\n listeners?: Listeners\n allowFrom?: string | Element\n ignoreFrom?: string | Element\n}\n\nexport type Options = Partial &\nPartial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\nexport interface OptionsArg extends BaseDefaults, 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" + ], + "mappings": "AAQA;AAyBA,OAAO,MAAMA,QAAkB,GAAG;EAChCC,IAAI,EAAE;IACJC,cAAc,EAAE,MADZ;IAEJC,WAAW,EAAE;EAFT,CAD0B;EAMhCC,SAAS,EAAE;IACTC,OAAO,EAAE,KADA;IAETC,MAAM,EAAE;MAAEC,CAAC,EAAE,CAAL;MAAQC,CAAC,EAAE;IAAX;EAFC,CANqB;EAWhCC,OAAO,EAAE;AAXuB,CAA3B" +} \ No newline at end of file diff --git a/packages/@interactjs/core/options.prod.js b/packages/@interactjs/core/options.prod.js new file mode 100644 index 000000000..b12df780a --- /dev/null +++ b/packages/@interactjs/core/options.prod.js @@ -0,0 +1,2 @@ +export const defaults={base:{preventDefault:"auto",deltaSource:"page"},perAction:{enabled:!1,origin:{x:0,y:0}},actions:{}}; +//# sourceMappingURL=options.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/options.prod.js.map b/packages/@interactjs/core/options.prod.js.map new file mode 100644 index 000000000..dcb48c624 --- /dev/null +++ b/packages/@interactjs/core/options.prod.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "defaults", + "base", + "preventDefault", + "deltaSource", + "perAction", + "enabled", + "origin", + "x", + "y", + "actions" + ], + "sources": [ + "options.ts" + ], + "sourcesContent": [ + "import type { Point, Listeners, OrBoolean, Element, Rect } from '@interactjs/core/types'\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\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Node\n getRect?: (element: Element) => Rect\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Point | string | Element\n listeners?: Listeners\n allowFrom?: string | Element\n ignoreFrom?: string | Element\n}\n\nexport type Options = Partial &\nPartial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\nexport interface OptionsArg extends BaseDefaults, 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" + ], + "mappings": "OAiCO,MAAMA,SAAqB,CAChCC,KAAM,CACJC,eAAgB,OAChBC,YAAa,QAGfC,UAAW,CACTC,SAAS,EACTC,OAAQ,CAAEC,EAAG,EAAGC,EAAG,IAGrBC,QAAS" +} \ No newline at end of file diff --git a/packages/@interactjs/core/scope.d.ts b/packages/@interactjs/core/scope.d.ts new file mode 100644 index 000000000..6b848a711 --- /dev/null +++ b/packages/@interactjs/core/scope.d.ts @@ -0,0 +1,103 @@ +import type Interaction from '@interactjs/core/Interaction'; +import { Eventable } from './Eventable'; +import { InteractEvent } from './InteractEvent'; +import { Interactable as InteractableBase } from './Interactable'; +import { InteractableSet } from './InteractableSet'; +import './events'; +import './interactions'; +import type { OptionsArg } from './options'; +import type { Actions } from './types'; +export interface SignalArgs { + 'scope:add-document': DocSignalArg; + 'scope:remove-document': DocSignalArg; + 'interactable:unset': { + interactable: InteractableBase; + }; + 'interactable:set': { + interactable: InteractableBase; + options: OptionsArg; + }; + 'interactions:destroy': { + interaction: 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: Record; +} +export interface Plugin { + [key: string]: any; + id?: string; + listeners?: ListenerMap; + before?: string[]; + install?(scope: Scope, options?: any): void; +} +export declare class Scope { + id: string; + isInitialized: boolean; + listenerMaps: Array<{ + map: ListenerMap; + id?: string; + }>; + browser: { + init: (window: any) => void; + supportsTouch: boolean; + supportsPointerEvent: boolean; + isIOS7: boolean; + isIOS: boolean; + isIe9: boolean; + isOperaMobile: boolean; + prefixedMatchesSelector: "matches"; + pEventTypes: { + up: string; + down: string; + over: string; + out: string; + move: string; + cancel: string; + }; + wheelEvent: string; + }; + defaults: import("@interactjs/core/options").Defaults; + Eventable: typeof Eventable; + actions: Actions; + interactStatic: import("@interactjs/core/InteractStatic").InteractStatic; + 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 | typeof globalThis): Scope; + pluginIsInstalled(plugin: Plugin): boolean; + 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 initScope(scope: Scope, window: Window | typeof globalThis): Scope; +export {}; diff --git a/packages/@interactjs/core/scope.js b/packages/@interactjs/core/scope.js new file mode 100644 index 000000000..df6839e36 --- /dev/null +++ b/packages/@interactjs/core/scope.js @@ -0,0 +1,250 @@ +import browser from "../utils/browser.js"; +import clone from "../utils/clone.js"; +import domObjects from "../utils/domObjects.js"; +import extend from "../utils/extend.js"; +import is from "../utils/is.js"; +import raf from "../utils/raf.js"; +import * as win from "../utils/window.js"; +import { Eventable } from './Eventable'; +import { InteractEvent } from './InteractEvent'; +import { createInteractStatic } from './InteractStatic'; +import { Interactable as InteractableBase } from './Interactable'; +import { InteractableSet } from './InteractableSet'; +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ + +import './events'; +import './interactions'; +import events from './events'; +import interactions from './interactions'; +/* eslint-enable import/no-duplicates */ + +import { defaults } from './options'; +export class Scope { + id = `__interact_scope_${Math.floor(Math.random() * 100)}`; + isInitialized = false; + listenerMaps = []; + browser = browser; + defaults = clone(defaults); + Eventable = Eventable; + actions = { + map: {}, + phases: { + start: true, + move: true, + end: true + }, + methodDict: {}, + phaselessTypes: {} + }; + interactStatic = createInteractStatic(this); + InteractEvent = InteractEvent; + Interactable; + interactables = new InteractableSet(this); // main window + + _win; // main document + + document; // main window + + window; // all documents being listened to + + documents = []; + _plugins = { + list: [], + map: {} + }; + + constructor() { + const scope = this; + this.Interactable = class extends InteractableBase { + get _defaults() { + return scope.defaults; + } + + set(options) { + super.set(options); + scope.fire('interactable:set', { + options, + interactable: this + }); + return this; + } + + unset() { + super.unset(); + const index = scope.interactables.list.indexOf(this); + if (index < 0) return; + scope.interactables.list.splice(index, 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; + } + } + } + + onWindowUnload = event => this.removeDocument(event.target); + + init(window) { + return this.isInitialized ? this : initScope(this, window); + } + + pluginIsInstalled(plugin) { + const { + id + } = plugin; + return id ? !!this._plugins.map[id] : this._plugins.list.indexOf(plugin) !== -1; + } + + usePlugin(plugin, options) { + if (!this.isInitialized) { + return this; + } + + 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; + acc[pluginIdRoot(id)] = true; + return acc; + }, {}); + + for (; index < len; index++) { + const otherId = this.listenerMaps[index].id; + + if (otherId && (before[otherId] || before[pluginIdRoot(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 ? extend({}, options) : {}; + this.documents.push({ + doc, + options + }); + this.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) { + this.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; + this.events.remove(window, 'unload', this.onWindowUnload); + this.documents.splice(index, 1); + this.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 initScope(scope, window) { + scope.isInitialized = true; + + if (is.window(window)) { + win.init(window); + } + + domObjects.init(window); + browser.init(window); + raf.init(window); // @ts-expect-error + + scope.window = window; + scope.document = window.document; + scope.usePlugin(interactions); + scope.usePlugin(events); + return scope; +} + +function pluginIdRoot(id) { + return id && id.replace(/\/.*$/, ''); +} +//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/scope.js.map b/packages/@interactjs/core/scope.js.map new file mode 100644 index 000000000..250b980a4 --- /dev/null +++ b/packages/@interactjs/core/scope.js.map @@ -0,0 +1,97 @@ +{ + "version": 3, + "names": [ + "browser", + "clone", + "domObjects", + "extend", + "is", + "raf", + "win", + "Eventable", + "InteractEvent", + "createInteractStatic", + "Interactable", + "InteractableBase", + "InteractableSet", + "events", + "interactions", + "defaults", + "Scope", + "id", + "Math", + "floor", + "random", + "isInitialized", + "listenerMaps", + "actions", + "map", + "phases", + "start", + "move", + "end", + "methodDict", + "phaselessTypes", + "interactStatic", + "interactables", + "_win", + "document", + "window", + "documents", + "_plugins", + "list", + "constructor", + "scope", + "_defaults", + "set", + "options", + "fire", + "interactable", + "unset", + "index", + "indexOf", + "splice", + "addListeners", + "push", + "name", + "arg", + "listener", + "onWindowUnload", + "event", + "removeDocument", + "target", + "init", + "initScope", + "pluginIsInstalled", + "plugin", + "usePlugin", + "install", + "listeners", + "before", + "len", + "length", + "reduce", + "acc", + "pluginIdRoot", + "otherId", + "addDocument", + "doc", + "getDocIndex", + "getWindow", + "add", + "remove", + "i", + "getDocOptions", + "docIndex", + "now", + "Date", + "replace" + ], + "sources": [ + "scope.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport domObjects from '@interactjs/utils/domObjects'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport * as win from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport { InteractEvent } from './InteractEvent'\nimport { createInteractStatic } from './InteractStatic'\nimport { Interactable as InteractableBase } from './Interactable'\nimport { InteractableSet } from './InteractableSet'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './events'\nimport './interactions'\nimport events from './events'\nimport interactions from './interactions'\n/* eslint-enable import/no-duplicates */\nimport type { OptionsArg } from './options'\nimport { defaults } from './options'\nimport type { Actions } from './types'\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: OptionsArg }\n 'interactions:destroy': { interaction: 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: Record\n}\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 isInitialized = false\n listenerMaps: Array<{\n map: ListenerMap\n id?: string\n }> = []\n\n browser = browser\n defaults = clone(defaults) as typeof defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {} as any,\n phaselessTypes: {},\n }\n\n interactStatic = createInteractStatic(this)\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\n\n this.Interactable = class extends InteractableBase {\n get _defaults () {\n return scope.defaults\n }\n\n set (this: T, options: OptionsArg) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset (this: InteractableBase) {\n super.unset()\n\n const index = scope.interactables.list.indexOf(this)\n if (index < 0) return\n\n scope.interactables.list.splice(index, 1)\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 {\n map: { [name]: listener },\n } 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 | typeof globalThis) {\n return this.isInitialized ? this : initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n const { id } = plugin\n return id ? !!this._plugins.map[id] : this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (!this.isInitialized) {\n return this\n }\n\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) {\n this._plugins.map[plugin.id] = plugin\n }\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 acc[pluginIdRoot(id)] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (otherId && (before[otherId] || before[pluginIdRoot(otherId)])) {\n break\n }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\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) {\n return false\n }\n\n const window = win.getWindow(doc)\n\n options = options ? extend({}, options) : {}\n\n this.documents.push({ doc, options })\n this.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 this.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 this.events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n this.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 initScope (scope: Scope, window: Window | typeof globalThis) {\n scope.isInitialized = true\n\n if (is.window(window)) {\n win.init(window)\n }\n\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n\n // @ts-expect-error\n scope.window = window\n scope.document = window.document\n\n scope.usePlugin(interactions)\n scope.usePlugin(events)\n\n return scope\n}\n\nfunction pluginIdRoot (id: string) {\n return id && id.replace(/\\/.*$/, '')\n}\n" + ], + "mappings": "AACA,OAAOA,OAAP,MAAoB,qBAApB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,U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AAQ,GAAG,KAAKN,WAAL,CAAiBD,GAAjB,CAAjB;IAEA,OAAOO,QAAQ,KAAK,CAAC,CAAd,GAAkB,IAAlB,GAAyB,KAAK7C,SAAL,CAAe6C,QAAf,EAAyBtC,OAAzD;EACD;;EAEDuC,GAAG,GAAI;IACL,OAAO,CAAG,KAAK/C,MAAN,CAAqBgD,IAAtB,IAA8CA,IAA/C,EAAqDD,GAArD,EAAP;EACD;;AAxMgB;AA2MnB,OAAO,SAAStB,SAAT,CAAoBpB,KAApB,EAAkCL,MAAlC,EAAsE;EAC3EK,KAAK,CAACnB,aAAN,GAAsB,IAAtB;;EAEA,IAAIjB,EAAE,CAAC+B,MAAH,CAAUA,MAAV,CAAJ,EAAuB;IACrB7B,GAAG,CAACqD,IAAJ,CAASxB,MAAT;EACD;;EAEDjC,UAAU,CAACyD,IAAX,CAAgBxB,MAAhB;EACAnC,OAAO,CAAC2D,IAAR,CAAaxB,MAAb;EACA9B,GAAG,CAACsD,IAAJ,CAASxB,MAAT,EAT2E,CAW3E;;EACAK,KAAK,CAACL,MAAN,GAAeA,MAAf;EACAK,KAAK,CAACN,QAAN,GAAiBC,MAAM,CAACD,QAAxB;EAEAM,KAAK,CAACuB,SAAN,CAAgBjD,YAAhB;EACA0B,KAAK,CAACuB,SAAN,CAAgBlD,MAAhB;EAEA,OAAO2B,KAAP;AACD;;AAED,SAAS+B,YAAT,CAAuBtD,EAAvB,EAAmC;EACjC,OAAOA,EAAE,IAAIA,EAAE,CAACmE,OAAH,CAAW,OAAX,EAAoB,EAApB,CAAb;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/core/scope.prod.js b/packages/@interactjs/core/scope.prod.js new file mode 100644 index 000000000..3fee74b6d --- /dev/null +++ b/packages/@interactjs/core/scope.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/browser.prod.js";import e from"../utils/clone.prod.js";import i from"../utils/domObjects.prod.js";import s from"../utils/extend.prod.js";import n from"../utils/is.prod.js";import o from"../utils/raf.prod.js";import*as r from"../utils/window.prod.js";import{Eventable as a}from"./Eventable";import{InteractEvent as l}from"./InteractEvent";import{createInteractStatic as d}from"./InteractStatic";import{Interactable as c}from"./Interactable";import{InteractableSet as p}from"./InteractableSet";import"./events";import"./interactions";import u from"./events";import m from"./interactions";import{defaults as h}from"./options";export class Scope{id="__interact_scope_"+Math.floor(100*Math.random());isInitialized=!1;listenerMaps=[];browser=t;defaults=e(h);Eventable=a;actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}};interactStatic=d(this);InteractEvent=l;Interactable;interactables=new p(this);_win;document;window;documents=[];_plugins={list:[],map:{}};constructor(){const t=this;this.Interactable=class extends c{get _defaults(){return t.defaults}set(e){return super.set(e),t.fire("interactable:set",{options:e,interactable:this}),this}unset(){super.unset();const e=t.interactables.list.indexOf(this);e<0||(t.interactables.list.splice(e,1),t.fire("interactable:unset",{interactable:this}))}}}addListeners(t,e){this.listenerMaps.push({id:e,map:t})}fire(t,e){for(const{map:{[t]:i}}of this.listenerMaps)if(i&&!1===i(e,this,t))return!1}onWindowUnload=t=>this.removeDocument(t.target);init(t){return this.isInitialized?this:initScope(this,t)}pluginIsInstalled(t){const{id:e}=t;return e?!!this._plugins.map[e]:-1!==this._plugins.list.indexOf(t)}usePlugin(t,e){if(!this.isInitialized)return this;if(this.pluginIsInstalled(t))return this;if(t.id&&(this._plugins.map[t.id]=t),this._plugins.list.push(t),t.install&&t.install(this,e),t.listeners&&t.before){let e=0;const i=this.listenerMaps.length,s=t.before.reduce(((t,e)=>(t[e]=!0,t[f(e)]=!0,t)),{});for(;e void | boolean\n}\n\ninterface DocSignalArg {\n doc: Document\n window: Window\n scope: Scope\n options: Record\n}\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 isInitialized = false\n listenerMaps: Array<{\n map: ListenerMap\n id?: string\n }> = []\n\n browser = browser\n defaults = clone(defaults) as typeof defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {} as any,\n phaselessTypes: {},\n }\n\n interactStatic = createInteractStatic(this)\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\n\n this.Interactable = class extends InteractableBase {\n get _defaults () {\n return scope.defaults\n }\n\n set (this: T, options: OptionsArg) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset (this: InteractableBase) {\n super.unset()\n\n const index = scope.interactables.list.indexOf(this)\n if (index < 0) return\n\n scope.interactables.list.splice(index, 1)\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 {\n map: { [name]: listener },\n } 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 | typeof globalThis) {\n return this.isInitialized ? this : initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n const { id } = plugin\n return id ? !!this._plugins.map[id] : this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (!this.isInitialized) {\n return this\n }\n\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) {\n this._plugins.map[plugin.id] = plugin\n }\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 acc[pluginIdRoot(id)] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (otherId && (before[otherId] || before[pluginIdRoot(otherId)])) {\n break\n }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\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) {\n return false\n }\n\n const window = win.getWindow(doc)\n\n options = options ? extend({}, options) : {}\n\n this.documents.push({ doc, options })\n this.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 this.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 this.events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n this.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 initScope (scope: Scope, window: Window | typeof globalThis) {\n scope.isInitialized = true\n\n if (is.window(window)) {\n win.init(window)\n }\n\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n\n // @ts-expect-error\n scope.window = window\n scope.document = window.document\n\n scope.usePlugin(interactions)\n scope.usePlugin(events)\n\n return scope\n}\n\nfunction pluginIdRoot (id: string) {\n return id && id.replace(/\\/.*$/, '')\n}\n" + ], + "mappings": "OACOA,MAAa,kCACbC,MAAW,gCACXC,MAAgB,qCAChBC,MAAY,iCACZC,MAAQ,6BACRC,MAAS,iCACJC,MAAS,8CAEZC,MAAiB,sCACjBC,MAAqB,iDACrBC,MAA4B,0CACZC,MAAwB,2CACxCC,MAAuB,0BAEzB,iBACA,wBACAC,MAAY,kBACZC,MAAkB,oCAGhBC,MAAgB,mBAgClB,MAAMC,MACXC,GAAM,oBAAmBC,KAAKC,MAAsB,IAAhBD,KAAKE,UACzCC,eAAgB,EAChBC,aAGK,GAELrB,QAAUA,EACVc,SAAWb,EAAMa,GACjBP,UAAYA,EACZe,QAAmB,CACjBC,IAAK,GACLC,OAAQ,CACNC,OAAO,EACPC,MAAM,EACNC,KAAK,GAEPC,WAAY,GACZC,eAAgB,IAGlBC,eAAiBrB,EAAqBsB,MACtCvB,cAAgBA,EAChBwB,aACAC,cAAgB,IAAItB,EAAgBoB,MAGpCG,KAGAC,SAGAC,OAGAC,UAAoD,GAEpDC,SAGI,CACAC,KAAM,GACNhB,IAAK,IAGTiB,cACE,MAAMC,EAAQV,KAEdA,KAAKC,aAAe,cAActB,EAC5BgC,gBACF,OAAOD,EAAM3B,SAGf6B,IAA0CC,GAQxC,OAPAC,MAAMF,IAAIC,GAEVH,EAAMK,KAAK,mBAAoB,CAC7BF,UACAG,aAAchB,OAGTA,KAGTiB,QACEH,MAAMG,QAEN,MAAMC,EAAQR,EAAMR,cAAcM,KAAKW,QAAQnB,MAC3CkB,EAAQ,IAEZR,EAAMR,cAAcM,KAAKY,OAAOF,EAAO,GACvCR,EAAMK,KAAK,qBAAsB,CAAEC,aAAchB,UAKvDqB,aAAc7B,EAAkBP,GAC9Be,KAAKV,aAAagC,KAAK,CAAErC,KAAIO,QAG/BuB,KAA8BQ,EAASC,GACrC,IAAK,MACHhC,KAAO+B,CAACA,GAAOE,MACZzB,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,GAET6B,EAGT,SAASgC,EAAczD,GACrB,OAAOA,GAAMA,EAAGsE,QAAQ,QAAS" +} \ No newline at end of file diff --git a/packages/@interactjs/core/tests/_helpers.d.ts b/packages/@interactjs/core/tests/_helpers.d.ts new file mode 100644 index 000000000..fbbf78138 --- /dev/null +++ b/packages/@interactjs/core/tests/_helpers.d.ts @@ -0,0 +1,112 @@ +import type { PointerType, Rect, Target } from '@interactjs/core/types'; +import * as pointerUtils from '@interactjs/utils/pointerUtils'; +import type { Plugin } from '../scope'; +import { Scope } from '../scope'; +import type { ActionProps } from '../types'; +export declare function unique(): number; +export declare function uniqueProps(obj: any): void; +export declare function newCoordsSet(n?: number): { + start: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + cur: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + prev: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + delta: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + velocity: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; +}; +export declare function newPointer(n?: number): PointerType; +export declare function mockScope({ document }?: any): Scope; +export declare function getProps(src: T, props: readonly K[]): Pick; +export declare function testEnv({ plugins, target, rect, document, }?: { + plugins?: Plugin[]; + target?: T; + rect?: Rect; + document?: Document; +}): { + scope: Scope; + interaction: import("@interactjs/core/Interaction").Interaction; + target: T extends undefined ? HTMLElement : T; + interactable: import("@interactjs/core/Interactable").Interactable; + coords: pointerUtils.MockCoords; + event: { + coords: pointerUtils.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; + preventDefault(): void; + } & PointerType & import("@interactjs/core/types").PointerEventType; + interact: import("@interactjs/core/InteractStatic").InteractStatic; + start: (action: ActionProps) => boolean; + stop: () => void; + down: () => void; + move: (force?: boolean) => void; + up: () => void; +}; +export declare function timeout(n: number): Promise; +export declare function ltrbwh(left: number, top: number, right: number, bottom: number, width: number, height: number): { + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; +}; diff --git a/packages/@interactjs/core/types.d.ts b/packages/@interactjs/core/types.d.ts new file mode 100644 index 000000000..d10f5f40d --- /dev/null +++ b/packages/@interactjs/core/types.d.ts @@ -0,0 +1,105 @@ +import type Interaction from '@interactjs/core/Interaction'; +import type { PhaseMap, InteractEvent } from './InteractEvent'; +import type { Interactable } from './Interactable'; +import type { NativePointerEvent as NativePointerEvent_ } from './NativeTypes'; +export declare type OrBoolean = { + [P in keyof T]: T[P] | boolean; +}; +export declare type Element = HTMLElement | SVGElement; +export declare type Context = Document | Element; +export declare type EventTarget = Window | Document | Element; +export declare type Target = EventTarget | string; +export interface Point { + x: number; + y: number; +} +export interface Size { + width: number; + height: number; +} +export interface Rect { + top: number; + left: number; + bottom: number; + right: number; + width?: number; + height?: number; +} +export declare type FullRect = Required; +export declare type RectFunction = (...args: T) => Rect | Element; +export declare type RectResolvable = Rect | string | Element | RectFunction; +export declare type Dimensions = Point & Size; +export interface CoordsSetMember { + page: Point; + client: Point; + timeStamp: number; +} +export interface CoordsSet { + cur: CoordsSetMember; + prev: CoordsSetMember; + start: CoordsSetMember; + delta: CoordsSetMember; + velocity: CoordsSetMember; +} +export interface HasGetRect { + getRect(element: Element): Rect; +} +export interface ActionMap { +} +export declare type ActionName = keyof ActionMap; +export interface Actions { + map: ActionMap; + phases: PhaseMap; + methodDict: Record; + phaselessTypes: { + [type: string]: true; + }; +} +export interface ActionProps { + name: T; + axis?: 'x' | 'y' | 'xy' | null; + edges?: EdgeOptions | null; +} +export interface InertiaOption { + resistance?: number; + minSpeed?: number; + endSpeed?: number; + allowResume?: boolean; + smoothEndDuration?: number; +} +export declare type InertiaOptions = InertiaOption | boolean; +export interface EdgeOptions { + top?: boolean | string | Element; + left?: boolean | string | Element; + bottom?: boolean | string | Element; + right?: boolean | string | Element; +} +export declare type CursorChecker = (action: ActionProps, interactable: Interactable, element: Element, interacting: boolean) => string; +export interface ActionMethod { + (this: Interactable): T; + (this: Interactable, options?: Partial> | boolean): typeof this; +} +export interface OptionMethod { + (this: Interactable): T; + (this: Interactable, options: T): typeof this; +} +export declare type ActionChecker = (pointerEvent: any, defaultAction: string, interactable: Interactable, element: Element, interaction: Interaction) => ActionProps; +export declare type OriginFunction = (target: Element) => Rect; +export interface PointerEventsOptions { + holdDuration?: number; + allowFrom?: string; + ignoreFrom?: string; + origin?: Rect | Point | string | Element | OriginFunction; +} +export declare type RectChecker = (element: Element) => Rect; +export declare type NativePointerEventType = typeof NativePointerEvent_; +export declare type PointerEventType = MouseEvent | TouchEvent | Partial | InteractEvent; +export declare type PointerType = MouseEvent | Touch | Partial | InteractEvent; +export declare type EventTypes = string | ListenerMap | Array; +export declare type Listener = (...args: any[]) => any; +export declare type Listeners = ListenerMap | ListenerMap[]; +export declare type ListenersArg = Listener | ListenerMap | Array; +export interface ListenerMap { + [index: string]: ListenersArg | ListenersArg[]; +} +export declare type ArrayElementType = T extends Array ? P : never; diff --git a/packages/@interactjs/core/types.js b/packages/@interactjs/core/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/packages/@interactjs/core/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/types.js.map b/packages/@interactjs/core/types.js.map new file mode 100644 index 000000000..267f6d492 --- /dev/null +++ b/packages/@interactjs/core/types.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "types.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\n\nimport type { PhaseMap, InteractEvent } from './InteractEvent'\nimport type { Interactable } from './Interactable'\nimport type { NativePointerEvent as NativePointerEvent_ } from './NativeTypes'\n\nexport type OrBoolean = {\n [P in keyof T]: T[P] | boolean\n}\n\nexport type Element = HTMLElement | SVGElement\nexport type Context = Document | Element\nexport type EventTarget = Window | Document | Element\nexport type Target = EventTarget | string\n\nexport interface Point {\n x: number\n y: number\n}\n\nexport interface Size {\n width: number\n height: number\n}\n\nexport interface Rect {\n top: number\n left: number\n bottom: number\n right: number\n width?: number\n height?: number\n}\n\nexport type FullRect = Required\n\nexport type RectFunction = (...args: T) => Rect | Element\n\nexport type RectResolvable = Rect | string | Element | RectFunction\n\nexport type Dimensions = Point & Size\n\nexport interface CoordsSetMember {\n page: Point\n client: Point\n timeStamp: number\n}\n\nexport interface CoordsSet {\n cur: CoordsSetMember\n prev: CoordsSetMember\n start: CoordsSetMember\n delta: CoordsSetMember\n velocity: CoordsSetMember\n}\n\nexport interface HasGetRect {\n getRect(element: Element): Rect\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionMap {}\n\nexport type ActionName = keyof ActionMap\n\nexport interface Actions {\n map: ActionMap\n phases: PhaseMap\n methodDict: Record\n phaselessTypes: { [type: string]: true }\n}\n\nexport interface ActionProps {\n name: T\n axis?: 'x' | 'y' | 'xy' | null\n edges?: EdgeOptions | null\n}\n\nexport interface InertiaOption {\n resistance?: number\n minSpeed?: number\n endSpeed?: number\n allowResume?: boolean\n smoothEndDuration?: number\n}\nexport type InertiaOptions = InertiaOption | boolean\n\nexport interface EdgeOptions {\n top?: boolean | string | Element\n left?: boolean | string | Element\n bottom?: boolean | string | Element\n right?: boolean | string | Element\n}\n\nexport type CursorChecker = (\n action: ActionProps,\n interactable: Interactable,\n element: Element,\n interacting: boolean,\n) => string\n\nexport interface ActionMethod {\n (this: Interactable): T\n // eslint-disable-next-line no-undef\n (this: Interactable, options?: Partial> | boolean): typeof this\n}\n\nexport interface OptionMethod {\n (this: Interactable): T\n // eslint-disable-next-line no-undef\n (this: Interactable, options: T): typeof this\n}\n\nexport type ActionChecker = (\n pointerEvent: any,\n defaultAction: string,\n interactable: Interactable,\n element: Element,\n interaction: Interaction,\n) => ActionProps\n\nexport type OriginFunction = (target: Element) => Rect\n\nexport interface PointerEventsOptions {\n holdDuration?: number\n allowFrom?: string\n ignoreFrom?: string\n origin?: Rect | Point | string | Element | OriginFunction\n}\n\nexport type RectChecker = (element: Element) => Rect\n\nexport type NativePointerEventType = typeof NativePointerEvent_\nexport type PointerEventType = MouseEvent | TouchEvent | Partial | InteractEvent\nexport type PointerType = MouseEvent | Touch | Partial | InteractEvent\n\nexport type EventTypes = string | ListenerMap | Array\n\nexport type Listener = (...args: any[]) => any\nexport type Listeners = ListenerMap | ListenerMap[]\nexport type ListenersArg = Listener | ListenerMap | Array\nexport interface ListenerMap {\n [index: string]: ListenersArg | ListenersArg[]\n}\n\nexport type ArrayElementType = T extends Array ? P : never\n" + ], + "mappings": "" +} \ No newline at end of file diff --git a/packages/@interactjs/core/types.prod.js b/packages/@interactjs/core/types.prod.js new file mode 100644 index 000000000..33692d986 --- /dev/null +++ b/packages/@interactjs/core/types.prod.js @@ -0,0 +1,2 @@ +export{}; +//# sourceMappingURL=types.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/core/types.prod.js.map b/packages/@interactjs/core/types.prod.js.map new file mode 100644 index 000000000..32e471b75 --- /dev/null +++ b/packages/@interactjs/core/types.prod.js.map @@ -0,0 +1,6 @@ +{ + "version": 3, + "names": [], + "sources": [], + "mappings": "" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/.npmignore b/packages/@interactjs/dev-tools/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/dev-tools/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/dev-tools/LICENSE b/packages/@interactjs/dev-tools/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/dev-tools/index.d.ts b/packages/@interactjs/dev-tools/index.d.ts new file mode 100644 index 000000000..294904723 --- /dev/null +++ b/packages/@interactjs/dev-tools/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/dev-tools/plugin'; diff --git a/packages/@interactjs/dev-tools/index.js b/packages/@interactjs/dev-tools/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/dev-tools/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/index.js.map b/packages/@interactjs/dev-tools/index.js.map new file mode 100644 index 000000000..9fea6c15e --- /dev/null +++ b/packages/@interactjs/dev-tools/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/dev-tools/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/dev-tools/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/index.prod.js b/packages/@interactjs/dev-tools/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/dev-tools/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/index.prod.js.map b/packages/@interactjs/dev-tools/index.prod.js.map new file mode 100644 index 000000000..a4d5bee32 --- /dev/null +++ b/packages/@interactjs/dev-tools/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/dev-tools/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/dev-tools/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/index.ts b/packages/@interactjs/dev-tools/index.ts new file mode 100644 index 000000000..7e677ad37 --- /dev/null +++ b/packages/@interactjs/dev-tools/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/dev-tools/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/dev-tools/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/plugin.d.ts b/packages/@interactjs/dev-tools/plugin.d.ts new file mode 100644 index 000000000..3c4973a96 --- /dev/null +++ b/packages/@interactjs/dev-tools/plugin.d.ts @@ -0,0 +1,48 @@ +import '@interactjs/dev-tools/visualizer/plugin'; +import type Interaction from '@interactjs/core/Interaction'; +import type { Plugin } from '@interactjs/core/scope'; +import type { OptionMethod } from '@interactjs/core/types'; +import visualizer from '@interactjs/dev-tools/visualizer/plugin'; +declare module '@interactjs/core/scope' { + interface Scope { + logger: Logger; + } +} +declare module '@interactjs/core/InteractStatic' { + interface InteractStatic { + visializer: typeof visualizer; + } +} +declare module '@interactjs/core/options' { + interface BaseDefaults { + devTools?: DevToolsOptions; + } +} +declare module '@interactjs/core/Interactable' { + interface Interactable { + devTools: 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: Interaction) => boolean; + getInfo: (interaction: Interaction) => any[]; +} +declare enum CheckName { + touchAction = "touchAction", + boxSizing = "boxSizing", + noListeners = "noListeners" +} +declare const defaultExport: Plugin; +export default defaultExport; diff --git a/packages/@interactjs/dev-tools/plugin.js b/packages/@interactjs/dev-tools/plugin.js new file mode 100644 index 000000000..4f9f4def1 --- /dev/null +++ b/packages/@interactjs/dev-tools/plugin.js @@ -0,0 +1,174 @@ +// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates +import "./visualizer/plugin.js"; +// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates +import visualizer from "./visualizer/plugin.js"; +import domObjects from "../utils/domObjects.js"; +import { parentNode } from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import is from "../utils/is.js"; +import isNonNativeEvent from "../utils/isNonNativeEvent.js"; +import normalizeListeners from "../utils/normalizeListeners.js"; +import * as 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' +}; // eslint-disable-next-line no-undef + +const isProduction = "development" === 'production'; + +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; + }; // can't set native events on non string targets without `addEventListener` prop + + + const { + _onOff + } = Interactable.prototype; + + Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) { + if (is.string(this.target) || this.target.addEventListener) { + return _onOff.call(this, method, typeArg, listenerArg, options, filter); + } + + if (is.object(typeArg) && !is.array(typeArg)) { + options = listenerArg; + listenerArg = null; + } + + const normalizedListeners = normalizeListeners(typeArg, listenerArg, filter); + + for (const type in normalizedListeners) { + if (isNonNativeEvent(type, scope.actions)) continue; + scope.logger.warn(prefix + `Can't add native "${type}" event listener to target without \`addEventListener(type, listener, options)\` prop.`); + } + + return _onOff.call(this, method, normalizedListeners, options); + }; + + scope.usePlugin(visualizer); +} + +const checks = [{ + name: CheckName.touchAction, + + perform({ + element + }) { + return !!element && !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) { + var _interaction$interact; + + const actionName = interaction.prepared.name; + const moveListeners = ((_interaction$interact = interaction.interactable) == null ? void 0 : _interaction$interact.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) { + const value = element.style[prop] || win.window.getComputedStyle(element)[prop]; + return styleRe.test((value || '').toString()); +} + +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=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/plugin.js.map b/packages/@interactjs/dev-tools/plugin.js.map new file mode 100644 index 000000000..401584524 --- /dev/null +++ b/packages/@interactjs/dev-tools/plugin.js.map @@ -0,0 +1,84 @@ +{ + "version": 3, + "names": [ + "visualizer", + "domObjects", + "parentNode", + "extend", + "is", + "isNonNativeEvent", + "normalizeListeners", + "win", + "CheckName", + "prefix", + "links", + "touchAction", + "boxSizing", + "isProduction", + "install", + "scope", + "logger", + "Interactable", + "defaults", + "console", + "base", + "devTools", + "ignore", + "prototype", + "options", + "_onOff", + "method", + "typeArg", + "listenerArg", + "filter", + "string", + "target", + "addEventListener", + "call", + "object", + "array", + "normalizedListeners", + "type", + "actions", + "warn", + "usePlugin", + "checks", + "name", + "perform", + "element", + "parentHasStyle", + "getInfo", + "text", + "interaction", + "prepared", + "HTMLElement", + "hasStyle", + "noListeners", + "actionName", + "moveListeners", + "interactable", + "events", + "types", + "length", + "prop", + "styleRe", + "value", + "style", + "window", + "getComputedStyle", + "test", + "toString", + "parent", + "id", + "defaultExport", + "listeners", + "check" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport '@interactjs/dev-tools/visualizer/plugin'\n\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, OptionMethod } from '@interactjs/core/types'\n// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport visualizer from '@interactjs/dev-tools/visualizer/plugin'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n visializer: typeof visualizer\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools: 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: Interaction) => boolean\n getInfo: (interaction: 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\n// eslint-disable-next-line no-undef\nconst isProduction = process.env.NODE_ENV === 'production'\n\nfunction install (scope: Scope, { logger }: { logger?: Logger } = {}) {\n const { Interactable, defaults } = 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 // can't set native events on non string targets without `addEventListener` prop\n const { _onOff } = Interactable.prototype\n Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) {\n if (is.string(this.target) || this.target.addEventListener) {\n return _onOff.call(this, method, typeArg, listenerArg, options, filter)\n }\n\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const normalizedListeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (const type in normalizedListeners) {\n if (isNonNativeEvent(type, scope.actions)) continue\n scope.logger.warn(\n prefix +\n `Can't add native \"${type}\" event listener to target without \\`addEventListener(type, listener, options)\\` prop.`,\n )\n }\n\n return _onOff.call(this, method, normalizedListeners, options)\n }\n scope.usePlugin(visualizer)\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !!element && !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [element, links.touchAction]\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 (\n interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n )\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [element, links.boxSizing]\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 [interaction.prepared.name, interaction.interactable]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n const value = element.style[prop] || win.window.getComputedStyle(element)[prop]\n return styleRe.test((value || '').toString())\n}\n\nfunction parentHasStyle (element: 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: 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" + ], + "mappings": "AAAA;AACA,OAAO,wBAAP;AAKA;AACA,OAAOA,UAAP,MAAuB,wBAAvB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,SAASC,UAAT,QAA2B,sBAA3B;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,OAAOC,gBAAP,MAA6B,8BAA7B;AACA,OAAOC,kBAAP,MAA+B,gCAA/B;AACA,OAAO,KAAKC,GAAZ,MAAqB,oBAArB;IA2CKC,S;;WAAAA,S;EAAAA,S;EAAAA,S;EAAAA,S;GAAAA,S,KAAAA,S;;AAML,MAAMC,MAAM,GAAG,gBAAf;AACA,MAAMC,KAAK,GAA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GAAGxD,YAAY,GACtC;EAAEuD,EAAF;EAAMtD,OAAO,EAAE,MAAM,CAAE;AAAvB,CADsC,GAEtC;EACAsD,EADA;EAEAtD,OAFA;EAGAwD,SAAS,EAAE;IACT,6BAA6B,CAAC;MAAEtB;IAAF,CAAD,EAAkBjC,KAAlB,KAA4B;MACvD,KAAK,MAAMwD,KAAX,IAAoB9B,MAApB,EAA4B;QAC1B,MAAMjB,OAAO,GAAGwB,WAAW,CAACO,YAAZ,IAA4BP,WAAW,CAACO,YAAZ,CAAyB/B,OAArE;;QAEA,IACE,EAAEA,OAAO,IAAIA,OAAO,CAACH,QAAnB,IAA+BG,OAAO,CAACH,QAAR,CAAiBC,MAAjB,CAAwBiD,KAAK,CAAC7B,IAA9B,CAAjC,KACE6B,KAAK,CAAC5B,OAAN,CAAcK,WAAd,CAFJ,EAGE;UACAjC,KAAK,CAACC,MAAN,CAAauB,IAAb,CAAkB9B,MAAM,GAAG8D,KAAK,CAACxB,IAAjC,EAAuC,GAAGwB,KAAK,CAACzB,OAAN,CAAcE,WAAd,CAA1C;QACD;MACF;IACF;EAZQ,CAHX;EAiBAP,MAjBA;EAkBAjC,SAlBA;EAmBAE,KAnBA;EAoBAD;AApBA,CAFJ;AAyBA,eAAe4D,aAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/plugin.prod.js b/packages/@interactjs/dev-tools/plugin.prod.js new file mode 100644 index 000000000..6841d39a5 --- /dev/null +++ b/packages/@interactjs/dev-tools/plugin.prod.js @@ -0,0 +1,2 @@ +import"./visualizer/plugin.prod.js";import o from"./visualizer/plugin.prod.js";import i from"../utils/domObjects.prod.js";import{parentNode as t}from"../utils/domUtils.prod.js";import r from"../utils/extend.prod.js";import s from"../utils/is.prod.js";import n from"../utils/isNonNativeEvent.prod.js";import p from"../utils/normalizeListeners.prod.js";import*as m from"../utils/window.prod.js";var e;(o=>{o.touchAction="touchAction",o.boxSizing="boxSizing",o.noListeners="noListeners"})(e||(e={}));e.touchAction,e.boxSizing,e.noListeners;const l={id:"dev-tools",install(){}};export default l; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/plugin.prod.js.map b/packages/@interactjs/dev-tools/plugin.prod.js.map new file mode 100644 index 000000000..c75539b8d --- /dev/null +++ b/packages/@interactjs/dev-tools/plugin.prod.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "visualizer", + "domObjects", + "parentNode", + "extend", + "is", + "isNonNativeEvent", + "normalizeListeners", + "win", + "CheckName", + "touchAction", + "boxSizing", + "noListeners", + "defaultExport", + "id", + "install" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport '@interactjs/dev-tools/visualizer/plugin'\n\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, OptionMethod } from '@interactjs/core/types'\n// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport visualizer from '@interactjs/dev-tools/visualizer/plugin'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n visializer: typeof visualizer\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools: 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: Interaction) => boolean\n getInfo: (interaction: 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\n// eslint-disable-next-line no-undef\nconst isProduction = process.env.NODE_ENV === 'production'\n\nfunction install (scope: Scope, { logger }: { logger?: Logger } = {}) {\n const { Interactable, defaults } = 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 // can't set native events on non string targets without `addEventListener` prop\n const { _onOff } = Interactable.prototype\n Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) {\n if (is.string(this.target) || this.target.addEventListener) {\n return _onOff.call(this, method, typeArg, listenerArg, options, filter)\n }\n\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const normalizedListeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (const type in normalizedListeners) {\n if (isNonNativeEvent(type, scope.actions)) continue\n scope.logger.warn(\n prefix +\n `Can't add native \"${type}\" event listener to target without \\`addEventListener(type, listener, options)\\` prop.`,\n )\n }\n\n return _onOff.call(this, method, normalizedListeners, options)\n }\n scope.usePlugin(visualizer)\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !!element && !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [element, links.touchAction]\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 (\n interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n )\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [element, links.boxSizing]\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 [interaction.prepared.name, interaction.interactable]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n const value = element.style[prop] || win.window.getComputedStyle(element)[prop]\n return styleRe.test((value || '').toString())\n}\n\nfunction parentHasStyle (element: 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: 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" + ], + "mappings": "MACO,qCAMAA,MAAgB,qCAChBC,MAAgB,mDACdC,MAAkB,mCACpBC,MAAY,iCACZC,MAAQ,6BACRC,MAAsB,2CACtBC,MAAwB,gDACnBC,MAAS,0B,IA2ChBC,E,CAAAA,M,0BAAAA,E,sBAAAA,E,4BAAAA,M,KA8DKA,EAAUC,YAWVD,EAAUE,UAiBVF,EAAUG,YAiCpB,MACMC,EACF,CAAEC,GAFK,YAEDC,4BAwBKF" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/plugin.d.ts b/packages/@interactjs/dev-tools/visualizer/plugin.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/plugin.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/dev-tools/visualizer/plugin.js b/packages/@interactjs/dev-tools/visualizer/plugin.js new file mode 100644 index 000000000..6d35357b6 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/plugin.js @@ -0,0 +1,2 @@ +export default {}; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/plugin.js.map b/packages/@interactjs/dev-tools/visualizer/plugin.js.map new file mode 100644 index 000000000..f943145c4 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/plugin.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "AAAA,eAAe,EAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/plugin.prod.js b/packages/@interactjs/dev-tools/visualizer/plugin.prod.js new file mode 100644 index 000000000..64960c6b2 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/plugin.prod.js @@ -0,0 +1,2 @@ +export default{}; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/plugin.prod.js.map b/packages/@interactjs/dev-tools/visualizer/plugin.prod.js.map new file mode 100644 index 000000000..3e51f77f2 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/plugin.prod.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "cAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/plugin.stub.d.ts b/packages/@interactjs/dev-tools/visualizer/plugin.stub.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/plugin.stub.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/dev-tools/visualizer/visualizer.spec.stub.d.ts b/packages/@interactjs/dev-tools/visualizer/visualizer.spec.stub.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/@interactjs/dev-tools/visualizer/vueModules.d.ts b/packages/@interactjs/dev-tools/visualizer/vueModules.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/vueModules.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@interactjs/dev-tools/visualizer/vueModules.js b/packages/@interactjs/dev-tools/visualizer/vueModules.js new file mode 100644 index 000000000..c80e36b09 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/vueModules.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=vueModules.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/vueModules.js.map b/packages/@interactjs/dev-tools/visualizer/vueModules.js.map new file mode 100644 index 000000000..37355262d --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/vueModules.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "vueModules.ts" + ], + "sourcesContent": [ + "export {}\n" + ], + "mappings": "AAAA" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/vueModules.prod.js b/packages/@interactjs/dev-tools/visualizer/vueModules.prod.js new file mode 100644 index 000000000..c8c7a5a01 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/vueModules.prod.js @@ -0,0 +1,2 @@ +export{}; +//# sourceMappingURL=vueModules.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/vueModules.prod.js.map b/packages/@interactjs/dev-tools/visualizer/vueModules.prod.js.map new file mode 100644 index 000000000..32e471b75 --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/vueModules.prod.js.map @@ -0,0 +1,6 @@ +{ + "version": 3, + "names": [], + "sources": [], + "mappings": "" +} \ No newline at end of file diff --git a/packages/@interactjs/dev-tools/visualizer/vueModules.stub.d.ts b/packages/@interactjs/dev-tools/visualizer/vueModules.stub.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/@interactjs/dev-tools/visualizer/vueModules.stub.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@interactjs/inertia/.npmignore b/packages/@interactjs/inertia/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/inertia/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/inertia/LICENSE b/packages/@interactjs/inertia/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/inertia/index.d.ts b/packages/@interactjs/inertia/index.d.ts new file mode 100644 index 000000000..71fc5fcdc --- /dev/null +++ b/packages/@interactjs/inertia/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/inertia/plugin'; diff --git a/packages/@interactjs/inertia/index.js b/packages/@interactjs/inertia/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/inertia/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/inertia/index.js.map b/packages/@interactjs/inertia/index.js.map new file mode 100644 index 000000000..22ed8ea65 --- /dev/null +++ b/packages/@interactjs/inertia/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/inertia/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/inertia/index.prod.js b/packages/@interactjs/inertia/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/inertia/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/inertia/index.prod.js.map b/packages/@interactjs/inertia/index.prod.js.map new file mode 100644 index 000000000..19230b53b --- /dev/null +++ b/packages/@interactjs/inertia/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/inertia/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/inertia/index.ts b/packages/@interactjs/inertia/index.ts new file mode 100644 index 000000000..6415881ae --- /dev/null +++ b/packages/@interactjs/inertia/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/inertia/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/inertia/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/inertia/plugin.d.ts b/packages/@interactjs/inertia/plugin.d.ts new file mode 100644 index 000000000..9022bc678 --- /dev/null +++ b/packages/@interactjs/inertia/plugin.d.ts @@ -0,0 +1,72 @@ +import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'; +import type { SignalArgs, Plugin } from '@interactjs/core/scope'; +import type { ActionName, Point, PointerEventType } from '@interactjs/core/types'; +import Modification from '@interactjs/modifiers/Modification'; +import '@interactjs/modifiers/base'; +import '@interactjs/offset/plugin'; +import type { ModifierArg } from '@interactjs/modifiers/types'; +declare module '@interactjs/core/InteractEvent' { + interface PhaseMap { + resume?: true; + inertiastart?: true; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + inertia?: InertiaState; + } +} +declare module '@interactjs/core/options' { + 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': DoPhaseArg; + 'interactions:after-action-inertiastart': DoPhaseArg; + 'interactions:before-action-resume': Omit, 'iEvent'>; + 'interactions:action-resume': DoPhaseArg; + 'interactions:after-action-resume': DoPhaseArg; + } +} +export declare class InertiaState { + active: boolean; + isModified: boolean; + smoothEnd: boolean; + allowResume: boolean; + modification: Modification; + modifierCount: number; + modifierArg: ModifierArg; + startCoords: Point; + t0: number; + v0: number; + te: number; + targetOffset: Point; + modifiedOffset: Point; + currentOffset: Point; + lambda_v0?: number; + one_ve_v0?: number; + timeout: number; + readonly interaction: Interaction; + constructor(interaction: Interaction); + start(event: PointerEventType): boolean; + startInertia(): void; + startSmoothEnd(): void; + onNextFrame(tickFn: () => void): void; + inertiaTick(): void; + smoothEndTick(): void; + resume({ pointer, event, eventTarget }: SignalArgs['interactions:down']): void; + end(): void; + stop(): void; +} +declare const inertia: Plugin; +export default inertia; diff --git a/packages/@interactjs/inertia/plugin.js b/packages/@interactjs/inertia/plugin.js new file mode 100644 index 000000000..0277853b7 --- /dev/null +++ b/packages/@interactjs/inertia/plugin.js @@ -0,0 +1,394 @@ +import Modification from "../modifiers/Modification.js"; +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ + +import "../modifiers/base.js"; +import "../offset/plugin.js"; +import * as modifiers from "../modifiers/base.js"; +import offset from "../offset/plugin.js"; +/* eslint-enable import/no-duplicates */ + +import * as dom from "../utils/domUtils.js"; +import hypot from "../utils/hypot.js"; +import 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 { + active = false; + isModified = false; + smoothEnd = false; + allowResume = false; + modification; + modifierCount = 0; + modifierArg; + startCoords; + t0 = 0; + v0 = 0; + te = 0; + targetOffset; + modifiedOffset; + currentOffset; + lambda_v0 = 0; // eslint-disable-line camelcase + + one_ve_v0 = 0; // eslint-disable-line camelcase + + timeout; + interaction; + + constructor(interaction) { + this.interaction = interaction; + } + + 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 = modification.fillArg({ + 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.onNextFrame(() => this.inertiaTick()); + } + + startSmoothEnd() { + this.smoothEnd = true; + this.isModified = true; + this.targetOffset = { + x: this.modification.result.delta.x, + y: this.modification.result.delta.y + }; + this.onNextFrame(() => this.smoothEndTick()); + } + + onNextFrame(tickFn) { + this.timeout = raf.request(() => { + if (this.active) { + tickFn(); + } + }); + } + + 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.onNextFrame(() => 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.onNextFrame(() => 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', 'actions'], + 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=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/inertia/plugin.js.map b/packages/@interactjs/inertia/plugin.js.map new file mode 100644 index 000000000..c99fb85b3 --- /dev/null +++ b/packages/@interactjs/inertia/plugin.js.map @@ -0,0 +1,144 @@ +{ + "version": 3, + "names": [ + "Modification", + "modifiers", + "offset", + "dom", + "hypot", + "is", + "copyCoords", + "raf", + "install", + "scope", + "defaults", + "usePlugin", + "default", + "actions", + "phases", + "inertiastart", + "resume", + "perAction", + "inertia", + "enabled", + "resistance", + "minSpeed", + "endSpeed", + "allowResume", + "smoothEndDuration", + "InertiaState", + "active", + "isModified", + "smoothEnd", + "modification", + "modifierCount", + "modifierArg", + "startCoords", + "t0", + "v0", + "te", + "targetOffset", + "modifiedOffset", + "currentOffset", + "lambda_v0", + "one_ve_v0", + "timeout", + "interaction", + "constructor", + "start", + "event", + "options", + "getOptions", + "client", + "velocityClient", + "coords", + "velocity", + "pointerSpeed", + "x", + "y", + "copyFrom", + "_now", + "cur", + "page", + "fillArg", + "pageCoords", + "preEnd", + "phase", + "thrown", + "timeStamp", + "startInertia", + "result", + "setAll", + "changed", + "startSmoothEnd", + "rect", + "offsetBy", + "_doPhase", + "simulation", + "startVelocity", + "lambda", + "inertiaDur", + "Math", + "log", + "delta", + "onNextFrame", + "inertiaTick", + "smoothEndTick", + "tickFn", + "request", + "t", + "progress", + "exp", + "newOffset", + "getQuadraticCurvePoint", + "move", + "end", + "duration", + "easeOutQuad", + "skipModifiers", + "pointer", + "eventTarget", + "updatePointer", + "prev", + "stop", + "cancel", + "_interacting", + "started", + "arg", + "state", + "element", + "parentNode", + "interactable", + "prepared", + "name", + "id", + "before", + "listeners", + "applyToInteraction", + "setAndApply", + "addEventModifiers", + "restoreInteractionCoords", + "_getQBezierValue", + "p1", + "p2", + "p3", + "iT", + "startX", + "startY", + "cpX", + "cpY", + "endX", + "endY", + "position", + "b", + "c", + "d" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Point, PointerEventType } from '@interactjs/core/types'\nimport Modification from '@interactjs/modifiers/Modification'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/modifiers/base'\nimport '@interactjs/offset/plugin'\nimport * as modifiers from '@interactjs/modifiers/base'\nimport type { ModifierArg } from '@interactjs/modifiers/types'\nimport offset from '@interactjs/offset/plugin'\n/* eslint-enable import/no-duplicates */\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\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/options' {\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': DoPhaseArg\n 'interactions:after-action-inertiastart': DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': DoPhaseArg\n 'interactions:after-action-resume': DoPhaseArg\n }\n}\n\nfunction install (scope: Scope) {\n const { defaults } = 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\n modifierCount = 0\n modifierArg!: ModifierArg\n\n startCoords!: Point\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset!: Point\n modifiedOffset!: Point\n currentOffset!: Point\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout!: number\n readonly interaction: Interaction\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n }\n\n start (event: 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 = modification.fillArg({\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 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.onNextFrame(() => 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.onNextFrame(() => this.smoothEndTick())\n }\n\n onNextFrame (tickFn: () => void) {\n this.timeout = raf.request(() => {\n if (this.active) {\n tickFn()\n }\n })\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: Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0,\n 0,\n this.targetOffset.x,\n this.targetOffset.y,\n this.modifiedOffset.x,\n this.modifiedOffset.y,\n progress,\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.onNextFrame(() => this.inertiaTick())\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.onNextFrame(() => this.smoothEndTick())\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 }: 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 }: 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: 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: Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interaction) {\n return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia\n}\n\nconst inertia: Plugin = {\n id: 'inertia',\n before: ['modifiers', 'actions'],\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) =>\n 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,\n startY: number,\n cpX: number,\n cpY: number,\n endX: number,\n endY: number,\n position: number,\n) {\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" + ], + "mappings": "AAGA,OAAOA,YAAP,MAAyB,8BAAzB;AACA;;AACA,OAAO,sBAAP;AACA,OAAO,qBAAP;AACA,OAAO,KAAKC,SAAZ,MAA2B,sBAA3B;AAEA,OAAOC,MAAP,MAAmB,qBAAnB;AACA;;AACA,OAAO,KAAKC,GAAZ,MAAqB,sBAArB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,EAAP,MAAe,gBAAf;AACA,SAASC,UAAT,QAA2B,0BAA3B;AACA,OAAOC,GAAP,MAAgB,iBAAhB;;AAuCA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IAAEC;EAAF,IAAeD,KAArB;EAEAA,KAAK,CAACE,SAAN,CAAgBT,MAAhB;EACAO,KAAK,CAACE,SAAN,CAAgBV,SAAS,CAACW,OAA1B;EACAH,KAAK,CAACI,OAAN,CAAcC,MAAd,CAAqB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,EAA0E;EACxE,MAAMC,EAAE,GAAG,IAAIpC,CAAf;EACA,OAAOoC,EAAE,GAAGA,EAAL,GAAUH,EAAV,GAAe,IAAIG,EAAJ,GAASpC,CAAT,GAAakC,EAA5B,GAAiClC,CAAC,GAAGA,CAAJ,GAAQmC,EAAhD;AACD;;AAED,SAAS/B,sBAAT,CACEiC,MADF,EAEEC,MAFF,EAGEC,GAHF,EAIEC,GAJF,EAKEC,IALF,EAMEC,IANF,EAOEC,QAPF,EAQE;EACA,OAAO;IACL3E,CAAC,EAAEgE,gBAAgB,CAACW,QAAD,EAAWN,MAAX,EAAmBE,GAAnB,EAAwBE,IAAxB,CADd;IAELxE,CAAC,EAAE+D,gBAAgB,CAACW,QAAD,EAAWL,MAAX,EAAmBE,GAAnB,EAAwBE,IAAxB;EAFd,CAAP;AAID,C,CAED;;;AACA,SAASlC,WAAT,CAAsBR,CAAtB,EAAiC4C,CAAjC,EAA4CC,CAA5C,EAAuDC,CAAvD,EAAkE;EAChE9C,CAAC,IAAI8C,CAAL;EACA,OAAO,CAACD,CAAD,GAAK7C,CAAL,IAAUA,CAAC,GAAG,CAAd,IAAmB4C,CAA1B;AACD;;AAED,eAAe/G,OAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/inertia/plugin.prod.js b/packages/@interactjs/inertia/plugin.prod.js new file mode 100644 index 000000000..ec290aa01 --- /dev/null +++ b/packages/@interactjs/inertia/plugin.prod.js @@ -0,0 +1,2 @@ +import t from"../modifiers/Modification.prod.js";import"../modifiers/base.prod.js";import"../offset/plugin.prod.js";import*as i from"../modifiers/base.prod.js";import e from"../offset/plugin.prod.js";import*as s from"../utils/domUtils.prod.js";import o from"../utils/hypot.prod.js";import r from"../utils/is.prod.js";import{copyCoords as n}from"../utils/pointerUtils.prod.js";import a from"../utils/raf.prod.js";export class InertiaState{active=!1;isModified=!1;smoothEnd=!1;allowResume=!1;modification;modifierCount=0;modifierArg;startCoords;t0=0;v0=0;te=0;targetOffset;modifiedOffset;currentOffset;lambda_v0=0;one_ve_v0=0;timeout;interaction;constructor(t){this.interaction=t}start(i){const{interaction:e}=this,s=f(e);if(!s||!s.enabled)return!1;const{client:r}=e.coords.velocity,n=o(r.x,r.y),a=this.modification||(this.modification=new t(e));if(a.copyFrom(e.modification),this.t0=e._now(),this.allowResume=s.allowResume,this.v0=n,this.currentOffset={x:0,y:0},this.startCoords=e.coords.cur.page,this.modifierArg=a.fillArg({pageCoords:this.startCoords,preEnd:!0,phase:"inertiastart"}),this.t0-e.coords.cur.timeStamp<50&&n>s.minSpeed&&n>s.endSpeed)this.startInertia();else{if(a.result=a.setAll(this.modifierArg),!a.result.changed)return!1;this.startSmoothEnd()}return e.modification.result.rect=null,e.offsetBy(this.targetOffset),e._doPhase({interaction:e,event:i,phase:"inertiastart"}),e.offsetBy({x:-this.targetOffset.x,y:-this.targetOffset.y}),e.modification.result.rect=null,this.active=!0,e.simulation=this,!0}startInertia(){const t=this.interaction.coords.velocity.client,i=f(this.interaction),e=i.resistance,s=-Math.log(i.endSpeed/this.v0)/e;this.targetOffset={x:(t.x-s)/e,y:(t.y-s)/e},this.te=s,this.lambda_v0=e/this.v0,this.one_ve_v0=1-i.endSpeed/this.v0;const{modification:o,modifierArg:r}=this;r.pageCoords={x:this.startCoords.x+this.targetOffset.x,y:this.startCoords.y+this.targetOffset.y},o.result=o.setAll(r),o.result.changed&&(this.isModified=!0,this.modifiedOffset={x:this.targetOffset.x+o.result.delta.x,y:this.targetOffset.y+o.result.delta.y}),this.onNextFrame((()=>this.inertiaTick()))}startSmoothEnd(){this.smoothEnd=!0,this.isModified=!0,this.targetOffset={x:this.modification.result.delta.x,y:this.modification.result.delta.y},this.onNextFrame((()=>this.smoothEndTick()))}onNextFrame(t){this.timeout=a.request((()=>{this.active&&t()}))}inertiaTick(){const{interaction:t}=this,i=f(t).resistance,e=(t._now()-this.t0)/1e3;if(ethis.inertiaTick()))}else t.offsetBy({x:this.modifiedOffset.x-this.currentOffset.x,y:this.modifiedOffset.y-this.currentOffset.y}),this.end();var s,o,r,n,a}smoothEndTick(){const{interaction:t}=this,i=t._now()-this.t0,{smoothEndDuration:e}=f(t);if(ithis.smoothEndTick()))}else t.offsetBy({x:this.targetOffset.x-this.currentOffset.x,y:this.targetOffset.y-this.currentOffset.y}),this.end()}resume({pointer:t,event:i,eventTarget:e}){const{interaction:s}=this;s.offsetBy({x:-this.currentOffset.x,y:-this.currentOffset.y}),s.updatePointer(t,i,e,!0),s._doPhase({interaction:s,event:i,phase:"resume"}),n(s.coords.prev,s.coords.cur),this.stop()}end(){this.interaction.move(),this.interaction.end(),this.stop()}stop(){this.active=this.smoothEnd=!1,this.interaction.simulation=null,a.cancel(this.timeout)}}function f({interactable:t,prepared:i}){return t&&t.options&&i.name&&t.options[i.name].inertia}const c={id:"inertia",before:["modifiers","actions"],install(t){const{defaults:s}=t;t.usePlugin(e),t.usePlugin(i.default),t.actions.phases.inertiastart=!0,t.actions.phases.resume=!0,s.perAction.inertia={enabled:!1,resistance:10,minSpeed:100,endSpeed:10,allowResume:!0,smoothEndDuration:300}},listeners:{"interactions:new"({interaction:t}){t.inertia=new InertiaState(t)},"interactions:before-action-end":({interaction:t,event:i})=>(!t._interacting||t.simulation||!t.inertia.start(i))&&null,"interactions:down"(t){const{interaction:i,eventTarget:e}=t,o=i.inertia;if(!o.active)return;let n=e;for(;r.element(n);){if(n===i.element){o.resume(t);break}n=s.parentNode(n)}},"interactions:stop"({interaction:t}){const i=t.inertia;i.active&&i.stop()},"interactions:before-action-resume"(t){const{modification:i}=t.interaction;i.stop(t),i.start(t,t.interaction.coords.cur.page),i.applyToInteraction(t)},"interactions:before-action-inertiastart":t=>t.interaction.modification.setAndApply(t),"interactions:action-resume":i.addEventModifiers,"interactions:action-inertiastart":i.addEventModifiers,"interactions:after-action-inertiastart":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:after-action-resume":t=>t.interaction.modification.restoreInteractionCoords(t)}};function d(t,i,e,s){const o=1-t;return o*o*i+2*o*t*e+t*t*s}function h(t,i,e,s){return-e*(t/=s)*(t-2)+i}export default c; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/inertia/plugin.prod.js.map b/packages/@interactjs/inertia/plugin.prod.js.map new file mode 100644 index 000000000..629527339 --- /dev/null +++ b/packages/@interactjs/inertia/plugin.prod.js.map @@ -0,0 +1,140 @@ +{ + "version": 3, + "names": [ + "Modification", + "modifiers", + "offset", + "dom", + "hypot", + "is", + "copyCoords", + "raf", + "InertiaState", + "active", + "isModified", + "smoothEnd", + "allowResume", + "modification", + "modifierCount", + "modifierArg", + "startCoords", + "t0", + "v0", + "te", + "targetOffset", + "modifiedOffset", + "currentOffset", + "lambda_v0", + "one_ve_v0", + "timeout", + "interaction", + "constructor", + "this", + "start", + "event", + "options", + "getOptions", + "enabled", + "client", + "velocityClient", + "coords", + "velocity", + "pointerSpeed", + "x", + "y", + "copyFrom", + "_now", + "cur", + "page", + "fillArg", + "pageCoords", + "preEnd", + "phase", + "timeStamp", + "minSpeed", + "endSpeed", + "startInertia", + "result", + "setAll", + "changed", + "startSmoothEnd", + "rect", + "offsetBy", + "_doPhase", + "simulation", + "startVelocity", + "lambda", + "resistance", + "inertiaDur", + "Math", + "log", + "delta", + "onNextFrame", + "inertiaTick", + "smoothEndTick", + "tickFn", + "request", + "t", + "progress", + "exp", + "newOffset", + "cpX", + "cpY", + "endX", + "endY", + "_getQBezierValue", + "position", + "move", + "end", + "smoothEndDuration", + "duration", + "easeOutQuad", + "skipModifiers", + "resume", + "pointer", + "eventTarget", + "updatePointer", + "prev", + "stop", + "cancel", + "interactable", + "prepared", + "name", + "inertia", + "id", + "before", + "install", + "scope", + "defaults", + "usePlugin", + "default", + "actions", + "phases", + "inertiastart", + "perAction", + "listeners", + "_interacting", + "arg", + "state", + "element", + "parentNode", + "applyToInteraction", + "setAndApply", + "addEventModifiers", + "restoreInteractionCoords", + "p1", + "p2", + "p3", + "iT", + "b", + "c", + "d" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Point, PointerEventType } from '@interactjs/core/types'\nimport Modification from '@interactjs/modifiers/Modification'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/modifiers/base'\nimport '@interactjs/offset/plugin'\nimport * as modifiers from '@interactjs/modifiers/base'\nimport type { ModifierArg } from '@interactjs/modifiers/types'\nimport offset from '@interactjs/offset/plugin'\n/* eslint-enable import/no-duplicates */\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\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/options' {\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': DoPhaseArg\n 'interactions:after-action-inertiastart': DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': DoPhaseArg\n 'interactions:after-action-resume': DoPhaseArg\n }\n}\n\nfunction install (scope: Scope) {\n const { defaults } = 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\n modifierCount = 0\n modifierArg!: ModifierArg\n\n startCoords!: Point\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset!: Point\n modifiedOffset!: Point\n currentOffset!: Point\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout!: number\n readonly interaction: Interaction\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n }\n\n start (event: 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 = modification.fillArg({\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 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.onNextFrame(() => 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.onNextFrame(() => this.smoothEndTick())\n }\n\n onNextFrame (tickFn: () => void) {\n this.timeout = raf.request(() => {\n if (this.active) {\n tickFn()\n }\n })\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: Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0,\n 0,\n this.targetOffset.x,\n this.targetOffset.y,\n this.modifiedOffset.x,\n this.modifiedOffset.y,\n progress,\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.onNextFrame(() => this.inertiaTick())\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.onNextFrame(() => this.smoothEndTick())\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 }: 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 }: 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: 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: Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interaction) {\n return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia\n}\n\nconst inertia: Plugin = {\n id: 'inertia',\n before: ['modifiers', 'actions'],\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) =>\n 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,\n startY: number,\n cpX: number,\n cpY: number,\n endX: number,\n endY: number,\n position: number,\n) {\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) +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,GAAQA,EAAIvF,YAAYb,aAAayG,YAAYL,GAC7F,6BAA8BhH,EAAUsH,kBACxC,mCAAoCtH,EAAUsH,kBAC9C,yCAA2CN,GACzCA,EAAIvF,YAAYb,aAAa2G,yBAAyBP,GACxD,mCAAqCA,GAAQA,EAAIvF,YAAYb,aAAa2G,yBAAyBP,KAKvG,SAAShC,EAAkBR,EAAWgD,EAAYC,EAAYC,GAC5D,MAAMC,EAAK,EAAInD,EACf,OAAOmD,EAAKA,EAAKH,EAAK,EAAIG,EAAKnD,EAAIiD,EAAKjD,EAAIA,EAAIkD,EAmBlD,SAASpC,EAAad,EAAWoD,EAAWC,EAAWC,GAErD,OAAQD,GADRrD,GAAKsD,IACYtD,EAAI,GAAKoD,iBAGb1B" +} \ No newline at end of file diff --git a/packages/@interactjs/interact/.npmignore b/packages/@interactjs/interact/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/interact/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/interact/LICENSE b/packages/@interactjs/interact/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/interact/index.d.ts b/packages/@interactjs/interact/index.d.ts new file mode 100644 index 000000000..515776ed1 --- /dev/null +++ b/packages/@interactjs/interact/index.d.ts @@ -0,0 +1,2 @@ +declare const interact: import("@interactjs/core/InteractStatic").InteractStatic; +export default interact; diff --git a/packages/@interactjs/interact/index.js b/packages/@interactjs/interact/index.js new file mode 100644 index 000000000..0433b9d14 --- /dev/null +++ b/packages/@interactjs/interact/index.js @@ -0,0 +1,9 @@ +import { Scope } from "../core/scope.js"; +const scope = new Scope(); +const interact = scope.interactStatic; +export default interact; + +const _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this; + +scope.init(_global); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/interact/index.js.map b/packages/@interactjs/interact/index.js.map new file mode 100644 index 000000000..67ace2131 --- /dev/null +++ b/packages/@interactjs/interact/index.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "Scope", + "scope", + "interact", + "interactStatic", + "_global", + "globalThis", + "window", + "init" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "import { Scope } from '@interactjs/core/scope'\n\nconst scope = new Scope()\n\nconst interact = scope.interactStatic\n\nexport default interact\n\nconst _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this\nscope.init(_global)\n" + ], + "mappings": "AAAA,SAASA,KAAT,QAAsB,kBAAtB;AAEA,MAAMC,KAAK,GAAG,IAAID,KAAJ,EAAd;AAEA,MAAME,QAAQ,GAAGD,KAAK,CAACE,cAAvB;AAEA,eAAeD,QAAf;;AAEA,MAAME,OAAO,GAAG,OAAOC,UAAP,KAAsB,WAAtB,GAAoCA,UAApC,GAAiD,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyC,IAA1G;;AACAL,KAAK,CAACM,IAAN,CAAWH,OAAX" +} \ No newline at end of file diff --git a/packages/@interactjs/interact/index.prod.js b/packages/@interactjs/interact/index.prod.js new file mode 100644 index 000000000..5cefc01a3 --- /dev/null +++ b/packages/@interactjs/interact/index.prod.js @@ -0,0 +1,2 @@ +import{Scope as o}from"../core/scope.prod.js";const t=new o,e=t.interactStatic;export default e;const i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this;t.init(i); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/interact/index.prod.js.map b/packages/@interactjs/interact/index.prod.js.map new file mode 100644 index 000000000..e5f2daad0 --- /dev/null +++ b/packages/@interactjs/interact/index.prod.js.map @@ -0,0 +1,21 @@ +{ + "version": 3, + "names": [ + "Scope", + "scope", + "interact", + "interactStatic", + "_global", + "globalThis", + "window", + "this", + "init" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "import { Scope } from '@interactjs/core/scope'\n\nconst scope = new Scope()\n\nconst interact = scope.interactStatic\n\nexport default interact\n\nconst _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this\nscope.init(_global)\n" + ], + "mappings": "gBAASA,MAAa,wBAEtB,MAAMC,EAAQ,IAAID,EAEZE,EAAWD,EAAME,8BAERD,EAEf,MAAME,EAAgC,oBAAfC,WAA6BA,WAA+B,oBAAXC,OAAyBA,OAASC,KAC1GN,EAAMO,KAAKJ" +} \ No newline at end of file diff --git a/packages/@interactjs/interactjs/.npmignore b/packages/@interactjs/interactjs/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/interactjs/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/interactjs/LICENSE b/packages/@interactjs/interactjs/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/interactjs/README.md b/packages/@interactjs/interactjs/README.md new file mode 100644 index 000000000..1824b547d --- /dev/null +++ b/packages/@interactjs/interactjs/README.md @@ -0,0 +1,108 @@ +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/main/CHANGELOG.md#upcoming-changes diff --git a/packages/@interactjs/interactjs/index.d.ts b/packages/@interactjs/interactjs/index.d.ts new file mode 100644 index 000000000..a0bd2f63a --- /dev/null +++ b/packages/@interactjs/interactjs/index.d.ts @@ -0,0 +1,13 @@ +import '@interactjs/actions/plugin'; +import '@interactjs/auto-scroll/plugin'; +import '@interactjs/auto-start/plugin'; +import '@interactjs/core/interactablePreventDefault'; +import '@interactjs/dev-tools/plugin'; +import '@interactjs/inertia/plugin'; +import '@interactjs/interact'; +import '@interactjs/modifiers/plugin'; +import '@interactjs/offset/plugin'; +import '@interactjs/pointer-events/plugin'; +import '@interactjs/reflow/plugin'; +import interact from '@interactjs/interact'; +export default interact; diff --git a/packages/@interactjs/interactjs/index.js b/packages/@interactjs/interactjs/index.js new file mode 100644 index 000000000..de30fff10 --- /dev/null +++ b/packages/@interactjs/interactjs/index.js @@ -0,0 +1,49 @@ +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ +import "../actions/plugin.js"; +import "../auto-scroll/plugin.js"; +import "../auto-start/plugin.js"; +import "../core/interactablePreventDefault.js"; +import "../dev-tools/plugin.js"; +import "../inertia/plugin.js"; +import "../interact/index.js"; +import "../modifiers/plugin.js"; +import "../offset/plugin.js"; +import "../pointer-events/plugin.js"; +import "../reflow/plugin.js"; +import actions from "../actions/plugin.js"; +import autoScroll from "../auto-scroll/plugin.js"; +import autoStart from "../auto-start/plugin.js"; +import interactablePreventDefault from "../core/interactablePreventDefault.js"; +import devTools from "../dev-tools/plugin.js"; +import inertia from "../inertia/plugin.js"; +import interact from "../interact/index.js"; +import modifiers from "../modifiers/plugin.js"; +import offset from "../offset/plugin.js"; +import pointerEvents from "../pointer-events/plugin.js"; +import reflow from "../reflow/plugin.js"; +/* eslint-enable import/no-duplicates */ + +interact.use(interactablePreventDefault); +interact.use(offset); // pointerEvents + +interact.use(pointerEvents); // inertia + +interact.use(inertia); // snap, resize, etc. + +interact.use(modifiers); // autoStart, hold + +interact.use(autoStart); // drag and drop, resize, gesture + +interact.use(actions); // autoScroll + +interact.use(autoScroll); // reflow + +interact.use(reflow); // eslint-disable-next-line no-undef + +if ("development" !== 'production') { + interact.use(devTools); +} + +export default interact; +interact.default = interact; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/interactjs/index.js.map b/packages/@interactjs/interactjs/index.js.map new file mode 100644 index 000000000..b85256a61 --- /dev/null +++ b/packages/@interactjs/interactjs/index.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "names": [ + "actions", + "autoScroll", + "autoStart", + "interactablePreventDefault", + "devTools", + "inertia", + "interact", + "modifiers", + "offset", + "pointerEvents", + "reflow", + "use", + "default" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/actions/plugin'\nimport '@interactjs/auto-scroll/plugin'\nimport '@interactjs/auto-start/plugin'\nimport '@interactjs/core/interactablePreventDefault'\nimport '@interactjs/dev-tools/plugin'\nimport '@interactjs/inertia/plugin'\nimport '@interactjs/interact'\nimport '@interactjs/modifiers/plugin'\nimport '@interactjs/offset/plugin'\nimport '@interactjs/pointer-events/plugin'\nimport '@interactjs/reflow/plugin'\n\nimport actions from '@interactjs/actions/plugin'\nimport autoScroll from '@interactjs/auto-scroll/plugin'\nimport autoStart from '@interactjs/auto-start/plugin'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/plugin'\nimport inertia from '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact'\nimport modifiers from '@interactjs/modifiers/plugin'\nimport offset from '@interactjs/offset/plugin'\nimport pointerEvents from '@interactjs/pointer-events/plugin'\nimport reflow from '@interactjs/reflow/plugin'\n/* eslint-enable import/no-duplicates */\n\ninteract.use(interactablePreventDefault)\n\ninteract.use(offset)\n\n// pointerEvents\ninteract.use(pointerEvents)\n\n// inertia\ninteract.use(inertia)\n\n// snap, resize, etc.\ninteract.use(modifiers)\n\n// autoStart, hold\ninteract.use(autoStart)\n\n// drag and drop, resize, gesture\ninteract.use(actions)\n\n// autoScroll\ninteract.use(autoScroll)\n\n// reflow\ninteract.use(reflow)\n\n// eslint-disable-next-line no-undef\nif (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n}\n\nexport default interact\n;(interact as any).default = interact\n" + ], + "mappings": "AAAA;AACA,OAAO,sBAAP;AACA,OAAO,0BAAP;AACA,OAAO,yBAAP;AACA,OAAO,uCAAP;AACA,OAAO,wBAAP;AACA,OAAO,sBAAP;AACA,OAAO,sBAAP;AACA,OAAO,wBAAP;AACA,OAAO,qBAAP;AACA,OAAO,6BAAP;AACA,OAAO,qBAAP;AAEA,OAAOA,OAAP,MAAoB,sBAApB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,SAAP,MAAsB,yBAAtB;AACA,OAAOC,0BAAP,MAAuC,uCAAvC;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,OAAP,MAAoB,sBAApB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,OAAOC,SAAP,MAAsB,wBAAtB;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA;;AAEAJ,QAAQ,CAACK,GAAT,CAAaR,0BAAb;AAEAG,QAAQ,CAACK,GAAT,CAAaH,MAAb,E,CAEA;;AACAF,QAAQ,CAACK,GAAT,CAAaF,aAAb,E,CAEA;;AACAH,QAAQ,CAACK,GAAT,CAAaN,OAAb,E,CAEA;;AACAC,QAAQ,CAACK,GAAT,CAAaJ,SAAb,E,CAEA;;AACAD,QAAQ,CAACK,GAAT,CAAaT,SAAb,E,CAEA;;AACAI,QAAQ,CAACK,GAAT,CAAaX,OAAb,E,CAEA;;AACAM,QAAQ,CAACK,GAAT,CAAaV,UAAb,E,CAEA;;AACAK,QAAQ,CAACK,GAAT,CAAaD,MAAb,E,CAEA;;AACA,IAAI,kBAAyB,YAA7B,EAA2C;EACzCJ,QAAQ,CAACK,GAAT,CAAaP,QAAb;AACD;;AAED,eAAeE,QAAf;AACEA,QAAD,CAAkBM,OAAlB,GAA4BN,QAA5B" +} \ No newline at end of file diff --git a/packages/@interactjs/interactjs/index.prod.js b/packages/@interactjs/interactjs/index.prod.js new file mode 100644 index 000000000..76d7d461a --- /dev/null +++ b/packages/@interactjs/interactjs/index.prod.js @@ -0,0 +1,2 @@ +import"../actions/plugin.prod.js";import"../auto-scroll/plugin.prod.js";import"../auto-start/plugin.prod.js";import"../core/interactablePreventDefault.prod.js";import"../dev-tools/plugin.prod.js";import"../inertia/plugin.prod.js";import"../interact/index.prod.js";import"../modifiers/plugin.prod.js";import"../offset/plugin.prod.js";import"../pointer-events/plugin.prod.js";import"../reflow/plugin.prod.js";import o from"../actions/plugin.prod.js";import r from"../auto-scroll/plugin.prod.js";import p from"../auto-start/plugin.prod.js";import i from"../core/interactablePreventDefault.prod.js";import t from"../dev-tools/plugin.prod.js";import s from"../inertia/plugin.prod.js";import e from"../interact/index.prod.js";import m from"../modifiers/plugin.prod.js";import u from"../offset/plugin.prod.js";import n from"../pointer-events/plugin.prod.js";import l from"../reflow/plugin.prod.js";e.use(i),e.use(u),e.use(n),e.use(s),e.use(m),e.use(p),e.use(o),e.use(r),e.use(l);export default e;e.default=e; +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/interactjs/index.prod.js.map b/packages/@interactjs/interactjs/index.prod.js.map new file mode 100644 index 000000000..68c8fadd4 --- /dev/null +++ b/packages/@interactjs/interactjs/index.prod.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "names": [ + "actions", + "autoScroll", + "autoStart", + "interactablePreventDefault", + "devTools", + "inertia", + "interact", + "modifiers", + "offset", + "pointerEvents", + "reflow", + "use", + "default" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/actions/plugin'\nimport '@interactjs/auto-scroll/plugin'\nimport '@interactjs/auto-start/plugin'\nimport '@interactjs/core/interactablePreventDefault'\nimport '@interactjs/dev-tools/plugin'\nimport '@interactjs/inertia/plugin'\nimport '@interactjs/interact'\nimport '@interactjs/modifiers/plugin'\nimport '@interactjs/offset/plugin'\nimport '@interactjs/pointer-events/plugin'\nimport '@interactjs/reflow/plugin'\n\nimport actions from '@interactjs/actions/plugin'\nimport autoScroll from '@interactjs/auto-scroll/plugin'\nimport autoStart from '@interactjs/auto-start/plugin'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/plugin'\nimport inertia from '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact'\nimport modifiers from '@interactjs/modifiers/plugin'\nimport offset from '@interactjs/offset/plugin'\nimport pointerEvents from '@interactjs/pointer-events/plugin'\nimport reflow from '@interactjs/reflow/plugin'\n/* eslint-enable import/no-duplicates */\n\ninteract.use(interactablePreventDefault)\n\ninteract.use(offset)\n\n// pointerEvents\ninteract.use(pointerEvents)\n\n// inertia\ninteract.use(inertia)\n\n// snap, resize, etc.\ninteract.use(modifiers)\n\n// autoStart, hold\ninteract.use(autoStart)\n\n// drag and drop, resize, gesture\ninteract.use(actions)\n\n// autoScroll\ninteract.use(autoScroll)\n\n// reflow\ninteract.use(reflow)\n\n// eslint-disable-next-line no-undef\nif (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n}\n\nexport default interact\n;(interact as any).default = interact\n" + ], + "mappings": "MACO,kCACA,sCACA,qCACA,mDACA,oCACA,kCACA,kCACA,oCACA,iCACA,yCACA,kCAEAA,MAAa,mCACbC,MAAgB,uCAChBC,MAAe,sCACfC,MAAgC,oDAChCC,MAAc,qCACdC,MAAa,mCACbC,MAAc,mCACdC,MAAe,qCACfC,MAAY,kCACZC,MAAmB,0CACnBC,MAAY,2BAGnBJ,EAASK,IAAIR,GAEbG,EAASK,IAAIH,GAGbF,EAASK,IAAIF,GAGbH,EAASK,IAAIN,GAGbC,EAASK,IAAIJ,GAGbD,EAASK,IAAIT,GAGbI,EAASK,IAAIX,GAGbM,EAASK,IAAIV,GAGbK,EAASK,IAAID,kBAOEJ,EACbA,EAAiBM,QAAUN" +} \ No newline at end of file diff --git a/packages/@interactjs/interactjs/index.stub.d.ts b/packages/@interactjs/interactjs/index.stub.d.ts new file mode 100644 index 000000000..a0bd2f63a --- /dev/null +++ b/packages/@interactjs/interactjs/index.stub.d.ts @@ -0,0 +1,13 @@ +import '@interactjs/actions/plugin'; +import '@interactjs/auto-scroll/plugin'; +import '@interactjs/auto-start/plugin'; +import '@interactjs/core/interactablePreventDefault'; +import '@interactjs/dev-tools/plugin'; +import '@interactjs/inertia/plugin'; +import '@interactjs/interact'; +import '@interactjs/modifiers/plugin'; +import '@interactjs/offset/plugin'; +import '@interactjs/pointer-events/plugin'; +import '@interactjs/reflow/plugin'; +import interact from '@interactjs/interact'; +export default interact; diff --git a/packages/@interactjs/interactjs/package.json b/packages/@interactjs/interactjs/package.json index 772dfaea0..bf969d3bb 100644 --- a/packages/@interactjs/interactjs/package.json +++ b/packages/@interactjs/interactjs/package.json @@ -10,25 +10,17 @@ }, "dependencies": { "@interactjs/actions": "1.10.23", - "@interactjs/arrange": "1.10.23", "@interactjs/auto-scroll": "1.10.23", "@interactjs/auto-start": "1.10.23", - "@interactjs/clone": "1.10.23", "@interactjs/core": "1.10.23", "@interactjs/dev-tools": "1.10.23", - "@interactjs/feedback": "1.10.23", "@interactjs/inertia": "1.10.23", "@interactjs/interact": "1.10.23", "@interactjs/modifiers": "1.10.23", - "@interactjs/multi-target": "1.10.23", "@interactjs/offset": "1.10.23", "@interactjs/pointer-events": "1.10.23", - "@interactjs/react": "1.10.23", - "@interactjs/rebound": "1.10.23", - "@interactjs/symbol-tree": "1.10.23", "@interactjs/reflow": "1.10.23", - "@interactjs/utils": "1.10.23", - "@interactjs/vue": "1.10.23" + "@interactjs/utils": "1.10.23" }, "publishConfig": { "access": "public" diff --git a/packages/@interactjs/modifiers/.npmignore b/packages/@interactjs/modifiers/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/modifiers/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/modifiers/LICENSE b/packages/@interactjs/modifiers/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/modifiers/Modification.d.ts b/packages/@interactjs/modifiers/Modification.d.ts new file mode 100644 index 000000000..ed763dd13 --- /dev/null +++ b/packages/@interactjs/modifiers/Modification.d.ts @@ -0,0 +1,87 @@ +import type { EventPhase } from '@interactjs/core/InteractEvent'; +import type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'; +import type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'; +import type { Modifier, ModifierArg, ModifierState } from './types'; +export interface ModificationResult { + delta: Point; + rectDelta: Rect; + coords: Point; + rect: FullRect; + eventProps: any[]; + changed: boolean; +} +interface MethodArg { + phase: EventPhase; + pageCoords: Point; + rect: FullRect; + coords: Point; + preEnd?: boolean; + skipModifiers?: number; +} +export default class Modification { + states: ModifierState[]; + startOffset: Rect; + startDelta: Point; + result: ModificationResult; + endResult: Point; + startEdges: EdgeOptions; + edges: EdgeOptions; + readonly interaction: Readonly; + constructor(interaction: Interaction); + start({ phase }: { + phase: EventPhase; + }, pageCoords: Point): ModificationResult; + fillArg(arg: Partial): ModifierArg<{ + options: unknown; + methods?: { + start?: (arg: ModifierArg) => void; + set?: (arg: ModifierArg) => any; + beforeEnd?: (arg: ModifierArg) => void | Point; + stop?: (arg: ModifierArg) => void; + }; + index?: number; + name?: any; + }>; + startAll(arg: MethodArg & Partial): void; + setAll(arg: MethodArg & Partial): ModificationResult; + applyToInteraction(arg: { + phase: EventPhase; + rect?: Rect; + }): void; + setAndApply(arg: Partial & { + phase: EventPhase; + preEnd?: boolean; + skipModifiers?: number; + modifiedCoords?: Point; + }): void | false; + beforeEnd(arg: Omit & { + state?: ModifierState; + }): void | false; + stop(arg: { + interaction: Interaction; + }): void; + prepareStates(modifierList: Modifier[]): { + options: unknown; + methods?: { + start?: (arg: ModifierArg) => void; + set?: (arg: ModifierArg) => any; + beforeEnd?: (arg: ModifierArg) => void | Point; + stop?: (arg: ModifierArg) => void; + }; + index?: number; + name?: any; + }[]; + restoreInteractionCoords({ interaction: { coords, rect, modification } }: { + interaction: Interaction; + }): void; + shouldDo(options: any, preEnd?: boolean, phase?: string, requireEndOnly?: boolean): boolean; + 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/packages/@interactjs/modifiers/Modification.js b/packages/@interactjs/modifiers/Modification.js new file mode 100644 index 000000000..f72b28245 --- /dev/null +++ b/packages/@interactjs/modifiers/Modification.js @@ -0,0 +1,402 @@ +import clone from "../utils/clone.js"; +import extend from "../utils/extend.js"; +import * as rectUtils from "../utils/rect.js"; +export default class Modification { + states = []; + startOffset = { + left: 0, + right: 0, + top: 0, + bottom: 0 + }; + startDelta; + result; + endResult; + startEdges; + edges; + interaction; + + constructor(interaction) { + this.interaction = interaction; + this.result = createResult(); + this.edges = { + left: false, + right: false, + top: false, + bottom: false + }; + } + + start({ + phase + }, pageCoords) { + const { + interaction + } = this; + const modifierList = getModifierList(interaction); + this.prepareStates(modifierList); + this.startEdges = extend({}, interaction.edges); + this.edges = extend({}, this.startEdges); + this.startOffset = getRectOffset(interaction.rect, pageCoords); + this.startDelta = { + x: 0, + y: 0 + }; + const arg = this.fillArg({ + 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 ||= interaction.rect; + arg.edges ||= this.startEdges; + arg.startOffset = this.startOffset; + return arg; + } + + startAll(arg) { + for (const state of this.states) { + if (state.methods.start) { + arg.state = state; + state.methods.start(arg); + } + } + } + + setAll(arg) { + const { + phase, + preEnd, + skipModifiers, + rect: unmodifiedRect, + edges: unmodifiedEdges + } = arg; + arg.coords = extend({}, arg.pageCoords); + arg.rect = extend({}, unmodifiedRect); + arg.edges = extend({}, unmodifiedEdges); + const states = skipModifiers ? this.states.slice(skipModifiers) : this.states; + const newResult = createResult(arg.coords, arg.rect); + + for (const state of states) { + var _state$methods; + + const { + options + } = state; + const lastModifierCoords = extend({}, arg.coords); + let returnValue = null; + + if ((_state$methods = state.methods) != null && _state$methods.set && this.shouldDo(options, preEnd, phase)) { + arg.state = state; + returnValue = state.methods.set(arg); + rectUtils.addEdges(arg.edges, arg.rect, { + x: arg.coords.x - lastModifierCoords.x, + y: arg.coords.y - lastModifierCoords.y + }); + } + + newResult.eventProps.push(returnValue); + } + + extend(this.edges, arg.edges); + 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; + + if (prevCoords && prevRect) { + const rectChanged = 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; + } + + 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(this.fillArg({ + 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, arg.phase, 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]; + 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, requireEndOnly) { + if ( // ignore disabled modifiers + !options || options.enabled === false || // check if we require endOnly option to fire move before end + requireEndOnly && !options.endOnly || // don't apply endOnly modifiers when not ending + options.endOnly && !preEnd || // check if modifier should run be applied on start + phase === 'start' && !options.setStart) { + return false; + } + + return true; + } + + copyFrom(other) { + this.startOffset = other.startOffset; + this.startDelta = other.startDelta; + this.startEdges = other.startEdges; + 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; + } + + 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/packages/@interactjs/modifiers/Modification.js.map b/packages/@interactjs/modifiers/Modification.js.map new file mode 100644 index 000000000..2afe80c55 --- /dev/null +++ b/packages/@interactjs/modifiers/Modification.js.map @@ -0,0 +1,114 @@ +{ + "version": 3, + "names": [ + "clone", + "extend", + "rectUtils", + "Modification", + "states", + "startOffset", + "left", + "right", + "top", + "bottom", + "startDelta", + "result", + "endResult", + "startEdges", + "edges", + "interaction", + "constructor", + "createResult", + "start", + "phase", + "pageCoords", + "modifierList", + "getModifierList", + "prepareStates", + "getRectOffset", + "rect", + "x", + "y", + "arg", + "fillArg", + "preEnd", + "startAll", + "setAll", + "interactable", + "element", + "state", + "methods", + "skipModifiers", + "unmodifiedRect", + "unmodifiedEdges", + "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", + "move", + "stop", + "modifierArg", + "index", + "name", + "restoreInteractionCoords", + "modification", + "coordsAndDeltas", + "requireEndOnly", + "enabled", + "endOnly", + "setStart", + "copyFrom", + "other", + "map", + "s", + "destroy", + "prop", + "actionOptions", + "prepared", + "actionModifiers", + "modifiers", + "type", + "_methods", + "filter", + "m" + ], + "sources": [ + "Modification.ts" + ], + "sourcesContent": [ + "import type { EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { Modifier, ModifierArg, ModifierState } from './types'\n\nexport interface ModificationResult {\n delta: Point\n rectDelta: Rect\n coords: Point\n rect: FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: EventPhase\n pageCoords: Point\n rect: FullRect\n coords: Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta!: Point\n result!: ModificationResult\n endResult!: Point\n startEdges!: EdgeOptions\n edges: EdgeOptions\n readonly interaction: Readonly\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n this.result = createResult()\n this.edges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n }\n\n start ({ phase }: { phase: EventPhase }, pageCoords: Point) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.startEdges = extend({}, interaction.edges)\n this.edges = extend({}, this.startEdges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg = this.fillArg({\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 ||= interaction.rect\n arg.edges ||= this.startEdges\n arg.startOffset = this.startOffset\n\n return arg as ModifierArg\n }\n\n startAll (arg: MethodArg & Partial) {\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 const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n arg.edges = extend({}, unmodifiedEdges)\n\n const states = skipModifiers ? this.states.slice(skipModifiers) : 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(arg.edges, arg.rect, {\n x: arg.coords.x - lastModifierCoords.x,\n y: arg.coords.y - lastModifierCoords.y,\n })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n extend(this.edges, arg.edges)\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\n if (prevCoords && prevRect) {\n const rectChanged =\n 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 =\n rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y\n }\n\n return newResult\n }\n\n applyToInteraction (arg: { phase: EventPhase, rect?: 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 [\n [startCoords, startDelta],\n [curCoords, curDelta],\n ] 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 (\n arg: Partial & {\n phase: EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Point\n },\n ): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll(\n this.fillArg({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n }),\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 (\n !result.changed &&\n (!skipModifiers || skipModifiers < this.states.length) &&\n interaction.interacting()\n ) {\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, arg.phase, 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: Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend(\n {\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n },\n arg,\n )\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) {\n state.methods.stop(modifierArg as ModifierArg)\n }\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 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: 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, requireEndOnly?: boolean) {\n if (\n // ignore disabled modifiers\n !options ||\n options.enabled === false ||\n // check if we require endOnly option to fire move before end\n (requireEndOnly && !options.endOnly) ||\n // don't apply endOnly modifiers when not ending\n (options.endOnly && !preEnd) ||\n // check if modifier should run be applied on start\n (phase === 'start' && !options.setStart)\n ) {\n return false\n }\n\n return true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.startEdges = other.startEdges\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?: Point, rect?: 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\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map((type) => {\n const options = actionOptions[type]\n\n return (\n options &&\n options.enabled && {\n options,\n methods: options._methods,\n }\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" + ], + "mappings": "AAGA,OAAOA,KAAP,MAAkB,mBAAlB;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAO,KAAKC,SAAZ,MAA2B,kBAA3B;AAsBA,eAAe,MAAMC,YAAN,CAAmB;EAChCC,MAAM,GAAoB,EAApB;EACNC,WAAW,GAAS;IAAEC,IAAI,EAAE,CAAR;IAAWC,KAAK,EA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,CAAC,CAACA,CAZZ,CAAP;AAaD;;AAED,OAAO,SAAS7E,aAAT,CAAwBC,IAAxB,EAA8Be,MAA9B,EAAsC;EAC3C,OAAOf,IAAI,GACP;IACAnB,IAAI,EAAEkC,MAAM,CAACd,CAAP,GAAWD,IAAI,CAACnB,IADtB;IAEAE,GAAG,EAAEgC,MAAM,CAACb,CAAP,GAAWF,IAAI,CAACjB,GAFrB;IAGAD,KAAK,EAAEkB,IAAI,CAAClB,KAAL,GAAaiC,MAAM,CAACd,CAH3B;IAIAjB,MAAM,EAAEgB,IAAI,CAAChB,MAAL,GAAc+B,MAAM,CAACb;EAJ7B,CADO,GAOP;IACArB,IAAI,EAAE,CADN;IAEAE,GAAG,EAAE,CAFL;IAGAD,KAAK,EAAE,CAHP;IAIAE,MAAM,EAAE;EAJR,CAPJ;AAaD" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/Modification.prod.js b/packages/@interactjs/modifiers/Modification.prod.js new file mode 100644 index 000000000..5992d1f1c --- /dev/null +++ b/packages/@interactjs/modifiers/Modification.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/clone.prod.js";import e from"../utils/extend.prod.js";import*as s from"../utils/rect.prod.js";export default class o{states=[];startOffset={left:0,right:0,top:0,bottom:0};startDelta;result;endResult;startEdges;edges;interaction;constructor(t){this.interaction=t,this.result=r(),this.edges={left:!1,right:!1,top:!1,bottom:!1}}start({phase:t},s){const{interaction:o}=this,i=(t=>{const e=t.interactable.options[t.prepared.name],s=e.modifiers;return s&&s.length?s:["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map((t=>{const s=e[t];return s&&s.enabled&&{options:s,methods:s._methods}})).filter((t=>!!t))})(o);this.prepareStates(i),this.startEdges=e({},o.edges),this.edges=e({},this.startEdges),this.startOffset=getRectOffset(o.rect,s),this.startDelta={x:0,y:0};const a=this.fillArg({phase:t,pageCoords:s,preEnd:!1});return this.result=r(),this.startAll(a),this.result=this.setAll(a)}fillArg(t){const{interaction:e}=this;return t.interaction=e,t.interactable=e.interactable,t.element=e.element,t.rect||=e.rect,t.edges||=this.startEdges,t.startOffset=this.startOffset,t}startAll(t){for(const e of this.states)e.methods.start&&(t.state=e,e.methods.start(t))}setAll(t){const{phase:o,preEnd:i,skipModifiers:a,rect:n,edges:l}=t;t.coords=e({},t.pageCoords),t.rect=e({},n),t.edges=e({},l);const c=a?this.states.slice(a):this.states,d=r(t.coords,t.rect);for(const r of c){var h;const{options:a}=r,n=e({},t.coords);let l=null;null!=(h=r.methods)&&h.set&&this.shouldDo(a,i,o)&&(t.state=r,l=r.methods.set(t),s.addEdges(t.edges,t.rect,{x:t.coords.x-n.x,y:t.coords.y-n.y})),d.eventProps.push(l)}e(this.edges,t.edges),d.delta.x=t.coords.x-t.pageCoords.x,d.delta.y=t.coords.y-t.pageCoords.y,d.rectDelta.left=t.rect.left-n.left,d.rectDelta.right=t.rect.right-n.right,d.rectDelta.top=t.rect.top-n.top,d.rectDelta.bottom=t.rect.bottom-n.bottom;const p=this.result.coords,f=this.result.rect;if(p&&f){const t=d.rect.left!==f.left||d.rect.right!==f.right||d.rect.top!==f.top||d.rect.bottom!==f.bottom;d.changed=t||p.x!==d.coords.x||p.y!==d.coords.y}return d}applyToInteraction(t){const{interaction:s}=this,{phase:o}=t,r=s.coords.cur,i=s.coords.start,{result:a,startDelta:n}=this,l=a.delta;"start"===o&&e(this.startDelta,a.delta);for(const[t,e]of[[i,n],[r,l]])t.page.x+=e.x,t.page.y+=e.y,t.client.x+=e.x,t.client.y+=e.y;const{rectDelta:c}=this.result,d=t.rect||s.rect;d.left+=c.left,d.right+=c.right,d.top+=c.top,d.bottom+=c.bottom,d.width=d.right-d.left,d.height=d.bottom-d.top}setAndApply(t){const{interaction:e}=this,{phase:s,preEnd:o,skipModifiers:r}=t,i=this.setAll(this.fillArg({preEnd:o,phase:s,pageCoords:t.modifiedCoords||e.coords.cur.page}));if(this.result=i,!i.changed&&(!r||rt(e))),this.result=r(e({},s.result.coords),e({},s.result.rect))}destroy(){for(const t in this)this[t]=null}}function r(t,e){return{rect:e,coords:t,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}export function getRectOffset(t,e){return t?{left:e.x-t.left,top:e.y-t.top,right:t.right-e.x,bottom:t.bottom-e.y}:{left:0,top:0,right:0,bottom:0}} +//# sourceMappingURL=Modification.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/Modification.prod.js.map b/packages/@interactjs/modifiers/Modification.prod.js.map new file mode 100644 index 000000000..9041fac44 --- /dev/null +++ b/packages/@interactjs/modifiers/Modification.prod.js.map @@ -0,0 +1,116 @@ +{ + "version": 3, + "names": [ + "clone", + "extend", + "rectUtils", + "Modification", + "states", + "startOffset", + "left", + "right", + "top", + "bottom", + "startDelta", + "result", + "endResult", + "startEdges", + "edges", + "interaction", + "constructor", + "this", + "createResult", + "start", + "phase", + "pageCoords", + "modifierList", + "actionOptions", + "interactable", + "options", + "prepared", + "name", + "actionModifiers", + "modifiers", + "length", + "map", + "type", + "enabled", + "methods", + "_methods", + "filter", + "m", + "getModifierList", + "prepareStates", + "getRectOffset", + "rect", + "x", + "y", + "arg", + "fillArg", + "preEnd", + "startAll", + "setAll", + "element", + "state", + "skipModifiers", + "unmodifiedRect", + "unmodifiedEdges", + "coords", + "slice", + "newResult", + "_state$methods", + "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", + "interacting", + "adjustment", + "beforeEnd", + "event", + "doPreend", + "endPosition", + "move", + "stop", + "modifierArg", + "index", + "restoreInteractionCoords", + "modification", + "coordsAndDeltas", + "requireEndOnly", + "endOnly", + "setStart", + "copyFrom", + "other", + "s", + "destroy", + "prop" + ], + "sources": [ + "Modification.ts" + ], + "sourcesContent": [ + "import type { EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { Modifier, ModifierArg, ModifierState } from './types'\n\nexport interface ModificationResult {\n delta: Point\n rectDelta: Rect\n coords: Point\n rect: FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: EventPhase\n pageCoords: Point\n rect: FullRect\n coords: Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta!: Point\n result!: ModificationResult\n endResult!: Point\n startEdges!: EdgeOptions\n edges: EdgeOptions\n readonly interaction: Readonly\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n this.result = createResult()\n this.edges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n }\n\n start ({ phase }: { phase: EventPhase }, pageCoords: Point) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.startEdges = extend({}, interaction.edges)\n this.edges = extend({}, this.startEdges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg = this.fillArg({\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 ||= interaction.rect\n arg.edges ||= this.startEdges\n arg.startOffset = this.startOffset\n\n return arg as ModifierArg\n }\n\n startAll (arg: MethodArg & Partial) {\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 const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n arg.edges = extend({}, unmodifiedEdges)\n\n const states = skipModifiers ? this.states.slice(skipModifiers) : 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(arg.edges, arg.rect, {\n x: arg.coords.x - lastModifierCoords.x,\n y: arg.coords.y - lastModifierCoords.y,\n })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n extend(this.edges, arg.edges)\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\n if (prevCoords && prevRect) {\n const rectChanged =\n 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 =\n rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y\n }\n\n return newResult\n }\n\n applyToInteraction (arg: { phase: EventPhase, rect?: 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 [\n [startCoords, startDelta],\n [curCoords, curDelta],\n ] 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 (\n arg: Partial & {\n phase: EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Point\n },\n ): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll(\n this.fillArg({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n }),\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 (\n !result.changed &&\n (!skipModifiers || skipModifiers < this.states.length) &&\n interaction.interacting()\n ) {\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, arg.phase, 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: Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend(\n {\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n },\n arg,\n )\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) {\n state.methods.stop(modifierArg as ModifierArg)\n }\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 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: 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, requireEndOnly?: boolean) {\n if (\n // ignore disabled modifiers\n !options ||\n options.enabled === false ||\n // check if we require endOnly option to fire move before end\n (requireEndOnly && !options.endOnly) ||\n // don't apply endOnly modifiers when not ending\n (options.endOnly && !preEnd) ||\n // check if modifier should run be applied on start\n (phase === 'start' && !options.setStart)\n ) {\n return false\n }\n\n return true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.startEdges = other.startEdges\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?: Point, rect?: 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\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map((type) => {\n const options = actionOptions[type]\n\n return (\n options &&\n options.enabled && {\n options,\n methods: options._methods,\n }\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" + ], + "mappings": "OAGOA,MAAW,gCACXC,MAAY,oCACPC,MAAe,uCAsBZ,MAAMC,EACnBC,OAA0B,GAC1BC,YAAoB,CAAEC,KAAM,EAAGC,MAAO,EAAGC,IAAK,EAAGC,OAAQ,GACzDC,WACAC,OACAC,UACAC,WACAC,MACSC,YAETC,YAAaD,GACXE,KAAKF,YAAcA,EACnBE,KAAKN,OAASO,IACdD,KAAKH,MAAQ,CACXR,MAAM,EACNC,OAAO,EACPC,KAAK,EACLC,QAAQ,GAIZU,OAAOC,MAAEA,GAAgCC,GACvC,MAAMN,YAAEA,GAAgBE,KAClBK,EA6UV,CAA0BP,IACxB,MAAMQ,EAAgBR,EAAYS,aAAaC,QAAQV,EAAYW,SAASC,MACtEC,EAAkBL,EAAcM,UAEtC,OAAID,GAAmBA,EAAgBE,OAC9BF,EAGF,CAAC,OAAQ,WAAY,YAAa,WAAY,gBAAiB,gBACnEG,KAAKC,IACJ,MAAMP,EAAUF,EAAcS,GAE9B,OACEP,GACAA,EAAQQ,SAAW,CACjBR,UACAS,QAAST,E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,KAAKsF,GAAQ,MAKnB,SAASrF,EAAcoC,EAAgBb,GACrC,MAAO,CACLA,OACAa,SACAW,MAAO,CAAEvB,EAAG,EAAGC,EAAG,GAClBuB,UAAW,CACT5D,KAAM,EACNC,MAAO,EACPC,IAAK,EACLC,OAAQ,GAEVsD,WAAY,GACZO,SAAS,UA2BN,SAAS9B,cAAeC,EAAMa,GACnC,OAAOb,EACH,CACAnC,KAAMgD,EAAOZ,EAAID,EAAKnC,KACtBE,IAAK8C,EAAOX,EAAIF,EAAKjC,IACrBD,MAAOkC,EAAKlC,MAAQ+C,EAAOZ,EAC3BjC,OAAQgC,EAAKhC,OAAS6C,EAAOX,GAE7B,CACArC,KAAM,EACNE,IAAK,EACLD,MAAO,EACPE,OAAQ" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/all.d.ts b/packages/@interactjs/modifiers/all.d.ts new file mode 100644 index 000000000..3cfd35c91 --- /dev/null +++ b/packages/@interactjs/modifiers/all.d.ts @@ -0,0 +1,162 @@ +declare const _default: { + aspectRatio: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./aspectRatio").AspectRatioOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => unknown; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + restrictEdges: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./restrict/edges").RestrictEdgesOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => void; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + restrict: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./restrict/pointer").RestrictOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => unknown; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + restrictRect: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./restrict/pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => unknown; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + restrictSize: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./restrict/size").RestrictSizeOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => void; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + snapEdges: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./snap/edges").SnapEdgesOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + snap: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./snap/pointer").SnapOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + snapSize: { + (_options?: Partial): import("./types").Modifier; + _defaults: import("./snap/size").SnapSizeOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; + }; + spring: import("./types").ModifierFunction; + avoid: import("./types").ModifierFunction; + transform: import("./types").ModifierFunction; + rubberband: import("./types").ModifierFunction; +}; +export default _default; diff --git a/packages/@interactjs/modifiers/all.js b/packages/@interactjs/modifiers/all.js new file mode 100644 index 000000000..5a23a365f --- /dev/null +++ b/packages/@interactjs/modifiers/all.js @@ -0,0 +1,28 @@ +/* eslint-disable n/no-extraneous-import, import/no-unresolved */ +import aspectRatio from './aspectRatio'; +import avoid from './avoid/avoid'; +import restrictEdges from './restrict/edges'; +import restrict from './restrict/pointer'; +import restrictRect from './restrict/rect'; +import restrictSize from './restrict/size'; +import rubberband from './rubberband/rubberband'; +import snapEdges from './snap/edges'; +import snap from './snap/pointer'; +import snapSize from './snap/size'; +import spring from './spring/spring'; +import transform from './transform/transform'; +export default { + aspectRatio, + restrictEdges, + restrict, + restrictRect, + restrictSize, + snapEdges, + snap, + snapSize, + spring, + avoid, + transform, + rubberband +}; +//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/all.js.map b/packages/@interactjs/modifiers/all.js.map new file mode 100644 index 000000000..5203b3c48 --- /dev/null +++ b/packages/@interactjs/modifiers/all.js.map @@ -0,0 +1,24 @@ +{ + "version": 3, + "names": [ + "aspectRatio", + "avoid", + "restrictEdges", + "restrict", + "restrictRect", + "restrictSize", + "rubberband", + "snapEdges", + "snap", + "snapSize", + "spring", + "transform" + ], + "sources": [ + "all.ts" + ], + "sourcesContent": [ + "/* eslint-disable n/no-extraneous-import, import/no-unresolved */\nimport aspectRatio from './aspectRatio'\nimport avoid from './avoid/avoid'\nimport restrictEdges from './restrict/edges'\nimport restrict from './restrict/pointer'\nimport restrictRect from './restrict/rect'\nimport restrictSize from './restrict/size'\nimport rubberband from './rubberband/rubberband'\nimport snapEdges from './snap/edges'\nimport snap from './snap/pointer'\nimport snapSize from './snap/size'\nimport spring from './spring/spring'\nimport transform from './transform/transform'\n\nexport default {\n aspectRatio,\n restrictEdges,\n restrict,\n restrictRect,\n restrictSize,\n snapEdges,\n snap,\n snapSize,\n\n spring,\n avoid,\n transform,\n rubberband,\n}\n" + ], + "mappings": "AAAA;AACA,OAAOA,WAAP,MAAwB,eAAxB;AACA,OAAOC,KAAP,MAAkB,eAAlB;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,UAAP,MAAuB,yBAAvB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AAEA,eAAe;EACbX,WADa;EAEbE,aAFa;EAGbC,QAHa;EAIbC,YAJa;EAKbC,YALa;EAMbE,SANa;EAObC,IAPa;EAQbC,QARa;EAUbC,MAVa;EAWbT,KAXa;EAYbU,SAZa;EAabL;AAba,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/all.prod.js b/packages/@interactjs/modifiers/all.prod.js new file mode 100644 index 000000000..a65603e17 --- /dev/null +++ b/packages/@interactjs/modifiers/all.prod.js @@ -0,0 +1,2 @@ +import r from"./aspectRatio";import t from"./avoid/avoid";import o from"./restrict/edges";import i from"./restrict/pointer";import e from"./restrict/rect";import s from"./restrict/size";import m from"./rubberband/rubberband";import p from"./snap/edges";import a from"./snap/pointer";import n from"./snap/size";import f from"./spring/spring";import c from"./transform/transform";export default{aspectRatio:r,restrictEdges:o,restrict:i,restrictRect:e,restrictSize:s,snapEdges:p,snap:a,snapSize:n,spring:f,avoid:t,transform:c,rubberband:m}; +//# sourceMappingURL=all.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/all.prod.js.map b/packages/@interactjs/modifiers/all.prod.js.map new file mode 100644 index 000000000..32bb2e706 --- /dev/null +++ b/packages/@interactjs/modifiers/all.prod.js.map @@ -0,0 +1,24 @@ +{ + "version": 3, + "names": [ + "aspectRatio", + "avoid", + "restrictEdges", + "restrict", + "restrictRect", + "restrictSize", + "rubberband", + "snapEdges", + "snap", + "snapSize", + "spring", + "transform" + ], + "sources": [ + "all.ts" + ], + "sourcesContent": [ + "/* eslint-disable n/no-extraneous-import, import/no-unresolved */\nimport aspectRatio from './aspectRatio'\nimport avoid from './avoid/avoid'\nimport restrictEdges from './restrict/edges'\nimport restrict from './restrict/pointer'\nimport restrictRect from './restrict/rect'\nimport restrictSize from './restrict/size'\nimport rubberband from './rubberband/rubberband'\nimport snapEdges from './snap/edges'\nimport snap from './snap/pointer'\nimport snapSize from './snap/size'\nimport spring from './spring/spring'\nimport transform from './transform/transform'\n\nexport default {\n aspectRatio,\n restrictEdges,\n restrict,\n restrictRect,\n restrictSize,\n snapEdges,\n snap,\n snapSize,\n\n spring,\n avoid,\n transform,\n rubberband,\n}\n" + ], + "mappings": "OACOA,MAAiB,uBACjBC,MAAW,uBACXC,MAAmB,0BACnBC,MAAc,4BACdC,MAAkB,yBAClBC,MAAkB,yBAClBC,MAAgB,iCAChBC,MAAe,sBACfC,MAAU,wBACVC,MAAc,qBACdC,MAAY,yBACZC,MAAe,sCAEP,CACbX,cACAE,gBACAC,WACAC,eACAC,eACAE,YACAC,OACAC,WAEAC,SACAT,QACAU,YACAL" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/aspectRatio.d.ts b/packages/@interactjs/modifiers/aspectRatio.d.ts new file mode 100644 index 000000000..35f0ef597 --- /dev/null +++ b/packages/@interactjs/modifiers/aspectRatio.d.ts @@ -0,0 +1,52 @@ +/** + * @module modifiers/aspectRatio + * + * @description + * This module forces elements to be resized with a specified dx/dy ratio. + * + * ```js + * interact(target).resizable({ + * modifiers: [ + * interact.modifiers.snapSize({ + * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ], + * }), + * interact.aspectRatio({ ratio: 'preserve' }), + * ], + * }); + * ``` + */ +import type { Point, Rect, EdgeOptions } from '@interactjs/core/types'; +import Modification from './Modification'; +import type { Modifier, ModifierModule, ModifierState } from './types'; +export interface AspectRatioOptions { + ratio?: number | 'preserve'; + equalDelta?: boolean; + modifiers?: Modifier[]; + enabled?: boolean; +} +export declare type AspectRatioState = ModifierState; +declare const aspectRatio: ModifierModule; +declare const _default: { + (_options?: Partial): Modifier; + _defaults: AspectRatioOptions; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => unknown; + beforeEnd: (arg: import("./types").ModifierArg) => void | Point; + stop: (arg: import("./types").ModifierArg) => void; + }; +}; +export default _default; +export { aspectRatio }; diff --git a/packages/@interactjs/modifiers/aspectRatio.js b/packages/@interactjs/modifiers/aspectRatio.js new file mode 100644 index 000000000..7bcd82e55 --- /dev/null +++ b/packages/@interactjs/modifiers/aspectRatio.js @@ -0,0 +1,161 @@ +/** + * @module modifiers/aspectRatio + * + * @description + * This module forces elements to be resized with a specified dx/dy ratio. + * + * ```js + * interact(target).resizable({ + * modifiers: [ + * interact.modifiers.snapSize({ + * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ], + * }), + * interact.aspectRatio({ ratio: 'preserve' }), + * ], + * }); + * ``` + */ +import extend from "../utils/extend.js"; +import { addEdges } from "../utils/rect.js"; +import Modification from './Modification'; +import { makeModifier } from './base'; +const aspectRatio = { + start(arg) { + const { + state, + rect, + edges, + pageCoords: coords + } = arg; + let { + ratio, + enabled + } = 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: edges.top || edges.left && !edges.bottom, + left: edges.left || edges.top && !edges.right, + bottom: edges.bottom || edges.right && !edges.top, + right: edges.right || edges.bottom && !edges.left + }; + state.xIsPrimaryAxis = !!(edges.left || edges.right); + + if (state.equalDelta) { + const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1); + state.edgeSign = { + x: sign, + y: sign + }; + } else { + state.edgeSign = { + x: linkedEdges.left ? -1 : 1, + y: linkedEdges.top ? -1 : 1 + }; + } + + if (enabled !== false) { + extend(edges, linkedEdges); + } + + if (!(modifiers != null && 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 { + linkedEdges + } = state; + const initialCoords = extend({}, coords); + const aspectMethod = state.equalDelta ? setEqualDelta : setRatio; + extend(arg.edges, linkedEdges); + aspectMethod(state, state.xIsPrimaryAxis, coords, rect); + + if (!state.subModification) { + return null; + } + + const correctedRect = extend({}, rect); + addEdges(linkedEdges, correctedRect, { + x: coords.x - initialCoords.x, + y: coords.y - initialCoords.y + }); + const result = state.subModification.setAll({ ...arg, + rect: correctedRect, + edges: 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.y; + } else { + coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x; + } +} + +function setRatio({ + startRect, + startCoords, + ratio, + edgeSign +}, xIsPrimaryAxis, coords, rect) { + if (xIsPrimaryAxis) { + const newHeight = rect.width / ratio; + coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y; + } else { + const newWidth = rect.height * ratio; + coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x; + } +} + +export default makeModifier(aspectRatio, 'aspectRatio'); +export { aspectRatio }; +//# sourceMappingURL=aspectRatio.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/aspectRatio.js.map b/packages/@interactjs/modifiers/aspectRatio.js.map new file mode 100644 index 000000000..8e85be7cc --- /dev/null +++ b/packages/@interactjs/modifiers/aspectRatio.js.map @@ -0,0 +1,69 @@ +{ + "version": 3, + "names": [ + "extend", + "addEdges", + "Modification", + "makeModifier", + "aspectRatio", + "start", + "arg", + "state", + "rect", + "edges", + "pageCoords", + "coords", + "ratio", + "enabled", + "options", + "equalDelta", + "modifiers", + "width", + "height", + "startCoords", + "startRect", + "linkedEdges", + "top", + "left", + "bottom", + "right", + "xIsPrimaryAxis", + "sign", + "edgeSign", + "x", + "y", + "length", + "subModification", + "interaction", + "copyFrom", + "modification", + "prepareStates", + "startAll", + "set", + "initialCoords", + "aspectMethod", + "setEqualDelta", + "setRatio", + "correctedRect", + "result", + "setAll", + "prevCoords", + "prevRect", + "delta", + "changed", + "xIsCriticalAxis", + "Math", + "abs", + "eventProps", + "defaults", + "newHeight", + "newWidth" + ], + "sources": [ + "aspectRatio.ts" + ], + "sourcesContent": [ + "/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */\n\nimport type { Point, Rect, EdgeOptions } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\n\nimport Modification from './Modification'\nimport { makeModifier } from './base'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState<\nAspectRatioOptions,\n{\n startCoords: Point\n startRect: Rect\n linkedEdges: EdgeOptions\n ratio: number\n equalDelta: boolean\n xIsPrimaryAxis: boolean\n edgeSign: {\n x: number\n y: number\n }\n subModification: Modification\n}\n>\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges, pageCoords: coords } = arg\n let { ratio, enabled } = 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: edges.top || (edges.left && !edges.bottom),\n left: edges.left || (edges.top && !edges.right),\n bottom: edges.bottom || (edges.right && !edges.top),\n right: edges.right || (edges.bottom && !edges.left),\n })\n\n state.xIsPrimaryAxis = !!(edges.left || edges.right)\n\n if (state.equalDelta) {\n const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)\n state.edgeSign = {\n x: sign,\n y: sign,\n }\n } else {\n state.edgeSign = {\n x: linkedEdges.left ? -1 : 1,\n y: linkedEdges.top ? -1 : 1,\n }\n }\n\n if (enabled !== false) {\n extend(edges, linkedEdges)\n }\n\n if (!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 { linkedEdges } = state\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n extend(arg.edges, linkedEdges)\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) {\n return null\n }\n\n const correctedRect = extend({}, rect)\n\n addEdges(linkedEdges, correctedRect, {\n x: coords.x - initialCoords.x,\n y: coords.y - initialCoords.y,\n })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: 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: Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y\n } else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x\n }\n}\n\nfunction setRatio (\n { startRect, startCoords, ratio, edgeSign }: AspectRatioState,\n xIsPrimaryAxis: boolean,\n coords: Point,\n rect: Rect,\n) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y\n } else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x\n }\n}\n\nexport default makeModifier(aspectRatio, 'aspectRatio')\nexport { aspectRatio }\n" + ], + "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,OAAOA,MAAP,MAAmB,oBAAnB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AAEA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,SAASC,YAAT,QAA6B,QAA7B;AA2BA,MAAMC,WAAiE,GAAG;EACxEC,KAAK,CAAEC,GAAF,EAAO;IACV,MAAM;MAAEC,KAAF;MAASC,IAAT;MAAeC,KAAf;MAAsBC,UAAU,E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A9F,EAA6G;EAC3G,IAAIe,cAAJ,EAAoB;IAClBf,MAAM,CAACmB,CAAP,GAAWX,WAAW,CAACW,CAAZ,GAAgB,CAACnB,MAAM,CAACkB,CAAP,GAAWV,WAAW,CAACU,CAAxB,IAA6BD,QAAQ,CAACE,CAAjE;EACD,CAFD,MAEO;IACLnB,MAAM,CAACkB,CAAP,GAAWV,WAAW,CAACU,CAAZ,GAAgB,CAAClB,MAAM,CAACmB,CAAP,GAAWX,WAAW,CAACW,CAAxB,IAA6BF,QAAQ,CAACC,CAAjE;EACD;AACF;;AAED,SAASa,QAAT,CACE;EAAEtB,SAAF;EAAaD,WAAb;EAA0BP,KAA1B;EAAiCgB;AAAjC,CADF,EAEEF,cAFF,EAGEf,MAHF,EAIEH,IAJF,EAKE;EACA,IAAIkB,cAAJ,EAAoB;IAClB,MAAM6B,SAAS,GAAG/C,IAAI,CAACS,KAAL,GAAaL,KAA/B;IAEAD,MAAM,CAACmB,CAAP,GAAWX,WAAW,CAACW,CAAZ,GAAgB,CAACyB,SAAS,GAAGnC,SAAS,CAACF,MAAvB,IAAiCU,QAAQ,CAACE,CAArE;EACD,CAJD,MAIO;IACL,MAAM0B,QAAQ,GAAGhD,IAAI,CAACU,MAAL,GAAcN,KAA/B;IAEAD,MAAM,CAACkB,CAAP,GAAWV,WAAW,CAACU,CAAZ,GAAgB,CAAC2B,QAAQ,GAAGpC,SAAS,CAACH,KAAtB,IAA+BW,QAAQ,CAACC,CAAnE;EACD;AACF;;AAED,eAAe1B,YAAY,CAACC,WAAD,EAAc,aAAd,CAA3B;AACA,SAASA,WAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/aspectRatio.prod.js b/packages/@interactjs/modifiers/aspectRatio.prod.js new file mode 100644 index 000000000..5c2f32e24 --- /dev/null +++ b/packages/@interactjs/modifiers/aspectRatio.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/extend.prod.js";import{addEdges as e}from"../utils/rect.prod.js";import o from"./Modification";import{makeModifier as r}from"./base";const i={start(e){const{state:r,rect:i,edges:s,pageCoords:a}=e;let{ratio:n,enabled:d}=r.options;const{equalDelta:l,modifiers:c}=r.options;"preserve"===n&&(n=i.width/i.height),r.startCoords=t({},a),r.startRect=t({},i),r.ratio=n,r.equalDelta=l;const p=r.linkedEdges={top:s.top||s.left&&!s.bottom,left:s.left||s.top&&!s.right,bottom:s.bottom||s.right&&!s.top,right:s.right||s.bottom&&!s.left};if(r.xIsPrimaryAxis=!(!s.left&&!s.right),r.equalDelta){const t=(p.left?1:-1)*(p.top?1:-1);r.edgeSign={x:t,y:t}}else r.edgeSign={x:p.left?-1:1,y:p.top?-1:1};if(!1!==d&&t(s,p),null==c||!c.length)return;const f=new o(e.interaction);f.copyFrom(e.interaction.modification),f.prepareStates(c),r.subModification=f,f.startAll({...e})},set(o){const{state:r,rect:i,coords:n}=o,{linkedEdges:d}=r,l=t({},n),c=r.equalDelta?s:a;if(t(o.edges,d),c(r,r.xIsPrimaryAxis,n,i),!r.subModification)return null;const p=t({},i);e(d,p,{x:n.x-l.x,y:n.y-l.y});const f=r.subModification.setAll({...o,rect:p,edges:d,pageCoords:n,prevCoords:n,prevRect:p}),{delta:g}=f;return f.changed&&(c(r,Math.abs(g.x)>Math.abs(g.y),f.coords,f.rect),t(n,f.coords)),f.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function s({startCoords:t,edgeSign:e},o,r){o?r.y=t.y+(r.x-t.x)*e.y:r.x=t.x+(r.y-t.y)*e.x}function a({startRect:t,startCoords:e,ratio:o,edgeSign:r},i,s,a){if(i){const i=a.width/o;s.y=e.y+(i-t.height)*r.y}else{const i=a.height*o;s.x=e.x+(i-t.width)*r.x}}export default r(i,"aspectRatio");export{i as aspectRatio}; +//# sourceMappingURL=aspectRatio.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/aspectRatio.prod.js.map b/packages/@interactjs/modifiers/aspectRatio.prod.js.map new file mode 100644 index 000000000..11edaf00f --- /dev/null +++ b/packages/@interactjs/modifiers/aspectRatio.prod.js.map @@ -0,0 +1,68 @@ +{ + "version": 3, + "names": [ + "extend", + "addEdges", + "Modification", + "makeModifier", + "aspectRatio", + "start", + "arg", + "state", + "rect", + "edges", + "pageCoords", + "coords", + "ratio", + "enabled", + "options", + "equalDelta", + "modifiers", + "width", + "height", + "startCoords", + "startRect", + "linkedEdges", + "top", + "left", + "bottom", + "right", + "xIsPrimaryAxis", + "sign", + "edgeSign", + "x", + "y", + "length", + "subModification", + "interaction", + "copyFrom", + "modification", + "prepareStates", + "startAll", + "set", + "initialCoords", + "aspectMethod", + "setEqualDelta", + "setRatio", + "correctedRect", + "result", + "setAll", + "prevCoords", + "prevRect", + "delta", + "changed", + "Math", + "abs", + "eventProps", + "defaults", + "newHeight", + "newWidth" + ], + "sources": [ + "aspectRatio.ts" + ], + "sourcesContent": [ + "/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */\n\nimport type { Point, Rect, EdgeOptions } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\n\nimport Modification from './Modification'\nimport { makeModifier } from './base'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState<\nAspectRatioOptions,\n{\n startCoords: Point\n startRect: Rect\n linkedEdges: EdgeOptions\n ratio: number\n equalDelta: boolean\n xIsPrimaryAxis: boolean\n edgeSign: {\n x: number\n y: number\n }\n subModification: Modification\n}\n>\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges, pageCoords: coords } = arg\n let { ratio, enabled } = 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: edges.top || (edges.left && !edges.bottom),\n left: edges.left || (edges.top && !edges.right),\n bottom: edges.bottom || (edges.right && !edges.top),\n right: edges.right || (edges.bottom && !edges.left),\n })\n\n state.xIsPrimaryAxis = !!(edges.left || edges.right)\n\n if (state.equalDelta) {\n const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)\n state.edgeSign = {\n x: sign,\n y: sign,\n }\n } else {\n state.edgeSign = {\n x: linkedEdges.left ? -1 : 1,\n y: linkedEdges.top ? -1 : 1,\n }\n }\n\n if (enabled !== false) {\n extend(edges, linkedEdges)\n }\n\n if (!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 { linkedEdges } = state\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n extend(arg.edges, linkedEdges)\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) {\n return null\n }\n\n const correctedRect = extend({}, rect)\n\n addEdges(linkedEdges, correctedRect, {\n x: coords.x - initialCoords.x,\n y: coords.y - initialCoords.y,\n })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: 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: Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y\n } else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x\n }\n}\n\nfunction setRatio (\n { startRect, startCoords, ratio, edgeSign }: AspectRatioState,\n xIsPrimaryAxis: boolean,\n coords: Point,\n rect: Rect,\n) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y\n } else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x\n }\n}\n\nexport default makeModifier(aspectRatio, 'aspectRatio')\nexport { aspectRatio }\n" + ], + "mappings": "OAmBOA,MAAY,6CACVC,MAAgB,+BAElBC,MAAkB,wCAChBC,MAAoB,SA2B7B,MAAMC,EAAoE,CACxEC,MAAOC,GACL,MAAMC,MAAEA,EAAFC,KAASA,EAATC,MAAeA,EAAOC,WAAYC,GAAWL,EACnD,IAAIM,MAAEA,EAAFC,QAASA,GAAYN,EAAMO,QAC/B,MAAMC,WAAEA,EAAFC,UAAcA,GAAcT,EAAMO,QAE1B,aAAVF,IACFA,EAAQJ,EAAKS,MAAQT,EAAKU,QAG5BX,EAAMY,YAAcnB,EAAO,GAAIW,GAC/BJ,EAAMa,UAAYpB,EAAO,GAAIQ,GAC7BD,EAAMK,MAAQA,EACdL,EAAMQ,WAAaA,EAEnB,MAAMM,EAAed,EAAMc,YAAc,CACvCC,IAAKb,EAAMa,KAAQb,EAAMc,OAASd,EAAMe,OACxCD,KAAMd,EAAMc,MAASd,EAAMa,MAAQb,EAAMgB,MACzCD,OAAQf,EAAMe,QAAWf,EAAMgB,QAAUhB,EAAMa,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AKC,IAAIH,EAAMlB,GAGtBc,EAAOjC,OAAQiC,EAAOpC,MAC3DR,EAAOW,EAAQiC,EAAOjC,SAGjBiC,EAAOQ,YAGhBC,SAAU,CACRzC,MAAO,WACPG,YAAY,EACZC,UAAW,GACXH,SAAS,IAIb,SAAS4B,GAAetB,YAAEA,EAAFS,SAAeA,GAA8BF,EAAyBf,GACxFe,EACFf,EAAOmB,EAAIX,EAAYW,GAAKnB,EAAOkB,EAAIV,EAAYU,GAAKD,EAASE,EAEjEnB,EAAOkB,EAAIV,EAAYU,GAAKlB,EAAOmB,EAAIX,EAAYW,GAAKF,EAASC,EAIrE,SAASa,GACPtB,UAAEA,EAAFD,YAAaA,EAAbP,MAA0BA,EAA1BgB,SAAiCA,GACjCF,EACAf,EACAH,GAEA,GAAIkB,EAAgB,CAClB,MAAM4B,EAAY9C,EAAKS,MAAQL,EAE/BD,EAAOmB,EAAIX,EAAYW,GAAKwB,EAAYlC,EAAUF,QAAUU,EAASE,MAChE,CACL,MAAMyB,EAAW/C,EAAKU,OAASN,EAE/BD,EAAOkB,EAAIV,EAAYU,GAAK0B,EAAWnC,EAAUH,OAASW,EAASC,kBAIxD1B,EAAaC,EAAa,sBAChCA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/avoid/avoid.d.ts b/packages/@interactjs/modifiers/avoid/avoid.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/avoid/avoid.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/avoid/avoid.js b/packages/@interactjs/modifiers/avoid/avoid.js new file mode 100644 index 000000000..9740c7250 --- /dev/null +++ b/packages/@interactjs/modifiers/avoid/avoid.js @@ -0,0 +1,2 @@ +export { default } from '../noop'; +//# sourceMappingURL=avoid.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/avoid/avoid.js.map b/packages/@interactjs/modifiers/avoid/avoid.js.map new file mode 100644 index 000000000..fd5682fef --- /dev/null +++ b/packages/@interactjs/modifiers/avoid/avoid.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "avoid.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "AAAA,SAASA,OAAT,QAAwB,SAAxB" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/avoid/avoid.prod.js b/packages/@interactjs/modifiers/avoid/avoid.prod.js new file mode 100644 index 000000000..6f9c07160 --- /dev/null +++ b/packages/@interactjs/modifiers/avoid/avoid.prod.js @@ -0,0 +1,2 @@ +export{default}from"../noop"; +//# sourceMappingURL=avoid.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/avoid/avoid.prod.js.map b/packages/@interactjs/modifiers/avoid/avoid.prod.js.map new file mode 100644 index 000000000..67c902fe6 --- /dev/null +++ b/packages/@interactjs/modifiers/avoid/avoid.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "avoid.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "OAASA,YAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/avoid/avoid.stub.d.ts b/packages/@interactjs/modifiers/avoid/avoid.stub.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/avoid/avoid.stub.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/base.d.ts b/packages/@interactjs/modifiers/base.d.ts new file mode 100644 index 000000000..7aaab99d4 --- /dev/null +++ b/packages/@interactjs/modifiers/base.d.ts @@ -0,0 +1,41 @@ +import type { InteractEvent } from '@interactjs/core/InteractEvent'; +import type Interaction from '@interactjs/core/Interaction'; +import type { Plugin } from '@interactjs/core/scope'; +import Modification from './Modification'; +import type { Modifier, ModifierModule, ModifierState } from './types'; +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/options' { + interface PerActionDefaults { + modifiers?: Modifier[]; + } +} +export declare function makeModifier(module: ModifierModule, name?: Name): { + (_options?: Partial): Modifier; + _defaults: Defaults; + _methods: { + start: (arg: import("./types").ModifierArg) => void; + set: (arg: import("./types").ModifierArg) => Result; + beforeEnd: (arg: import("./types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("./types").ModifierArg) => void; + }; +}; +export declare function addEventModifiers({ iEvent, interaction, }: { + iEvent: InteractEvent; + interaction: Interaction; +}): void; +declare const modifiersBase: Plugin; +export default modifiersBase; diff --git a/packages/@interactjs/modifiers/base.js b/packages/@interactjs/modifiers/base.js new file mode 100644 index 000000000..7d262578f --- /dev/null +++ b/packages/@interactjs/modifiers/base.js @@ -0,0 +1,110 @@ +import Modification from './Modification'; +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, + enable: () => { + options.enabled = true; + return m; + }, + disable: () => { + options.enabled = false; + return m; + } + }; + return m; + }; + + if (name && typeof name === 'string') { + // for backwrads compatibility + modifier._defaults = defaults; + modifier._methods = methods; + } + + return modifier; +} +export function addEventModifiers({ + iEvent, + interaction +}) { + const result = interaction.modification.result; + + if (result) { + iEvent.modifiers = result.eventProps; + } +} +const modifiersBase = { + id: 'modifiers/base', + before: ['actions'], + install: scope => { + scope.defaults.perAction.modifiers = []; + }, + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.modification = new Modification(interaction); + }, + 'interactions:before-action-start': arg => { + const { + interaction + } = arg; + const modification = arg.interaction.modification; + modification.start(arg, interaction.coords.start.page); + interaction.edges = modification.edges; + modification.applyToInteraction(arg); + }, + 'interactions:before-action-move': arg => { + const { + interaction + } = arg; + const { + modification + } = interaction; + const ret = modification.setAndApply(arg); + interaction.edges = modification.edges; + return ret; + }, + 'interactions:before-action-end': arg => { + const { + interaction + } = arg; + const { + modification + } = interaction; + const ret = modification.beforeEnd(arg); + interaction.edges = modification.startEdges; + return ret; + }, + '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) + } +}; +export default modifiersBase; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/base.js.map b/packages/@interactjs/modifiers/base.js.map new file mode 100644 index 000000000..d0f756054 --- /dev/null +++ b/packages/@interactjs/modifiers/base.js.map @@ -0,0 +1,55 @@ +{ + "version": 3, + "names": [ + "Modification", + "makeModifier", + "module", + "name", + "defaults", + "methods", + "start", + "set", + "beforeEnd", + "stop", + "modifier", + "_options", + "options", + "enabled", + "prop", + "m", + "enable", + "disable", + "_defaults", + "_methods", + "addEventModifiers", + "iEvent", + "interaction", + "result", + "modification", + "modifiers", + "eventProps", + "modifiersBase", + "id", + "before", + "install", + "scope", + "perAction", + "listeners", + "arg", + "coords", + "page", + "edges", + "applyToInteraction", + "ret", + "setAndApply", + "startEdges", + "restoreInteractionCoords" + ], + "sources": [ + "base.ts" + ], + "sourcesContent": [ + "import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\n\nimport Modification from './Modification'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\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}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n Result,\n> (module: ModifierModule, name?: Name) {\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 = (_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 as any)[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = {\n options,\n methods,\n name,\n enable: () => {\n options.enabled = true\n return m\n },\n disable: () => {\n options.enabled = false\n return m\n },\n }\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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\n const result = interaction.modification!.result\n\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Plugin = {\n id: 'modifiers/base',\n before: ['actions'],\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 { interaction } = arg\n const modification = arg.interaction.modification!\n\n modification.start(arg, interaction.coords.start.page)\n interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.setAndApply(arg)\n interaction.edges = modification.edges\n\n return ret\n },\n\n 'interactions:before-action-end': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.beforeEnd(arg)\n interaction.edges = modification.startEdges\n\n return ret\n },\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}\n\nexport default modifiersBase\n" + ], + "mappings": "AAIA,OAAOA,YAAP,MAAyB,gBAAzB;AAwBA,OAAO,SAASC,YAAT,CAKJC,MALI,EAK6CC,IAL7C,EAK0D;EAC/D,MAAM;IAAEC;EAAF,IAAeF,MAArB;EACA,MAAMG,OAAO,GAAG;IACdC,KAAK,EAAEJ,MAAM,CAACI,KADA;IAEdC,GAAG,EAAEL,MAAM,CAACK,GAFE;IAGdC,SAAS,EAAEN,MAAM,CAACM,SAHJ;IAIdC,IAAI,EAAEP,MAAM,CAACO;EAJC,CAAhB;;EAOA,MAAMC,QAAQ,GAAIC,QAAD,IAAkC;IACjD,MAAMC,OAAO,GAAID,QAAQ,IAAI,EAA7B;IAEAC,OAAO,CAACC,OAAR,GAAkBD,OAAO,CAACC,OAAR,KAAoB,KAAtC,CAHiD,CAKjD;;IACA,KAAK,MAAMC,IAAX,IAAmBV,QAAnB,EAA6B;MAC3B,IAAI,EAAEU,IAAI,IAAIF,OAAV,CAAJ,EAAwB;QACtB;QAAEA,OAAD,CAAiBE,IAAjB,IAAyBV,QAAQ,CAACU,IAAD,CAAjC;MACF;IACF;;IAED,MAAMC,CAA0C,GAAG;MACjDH,OADiD;MAEjDP,OAFiD;MAGjDF,IAHiD;MAIjDa,MAAM,EAAE,MAAM;QACZJ,OAAO,CAACC,OAAR,GAAkB,IAAlB;QACA,OAAOE,CAAP;MACD,CAPgD;MAQjDE,OAAO,EAAE,MAAM;QACbL,OAAO,CAACC,OAAR,GAAkB,KAAlB;QACA,OAAOE,CAAP;MACD;IAXgD,CAAnD;IAcA,OAAOA,CAAP;EACD,CA3BD;;EA6BA,IAAIZ,IAAI,IAAI,OAAO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CAAyBN,GAAzB,CAAZ;MACAZ,WAAW,CAACe,KAAZ,GAAoBb,YAAY,CAACa,KAAjC;MAEA,OAAOE,GAAP;IACD,CArBQ;IAuBT,kCAAmCL,GAAD,IAAS;MACzC,MAAM;QAAEZ;MAAF,IAAkBY,GAAxB;MACA,MAAM;QAAEV;MAAF,IAAmBF,WAAzB;MACA,MAAMiB,GAAG,GAAGf,YAAY,CAAChB,SAAb,CAAuB0B,GAAvB,CAAZ;MACAZ,WAAW,CAACe,KAAZ,GAAoBb,YAAY,CAACiB,UAAjC;MAEA,OAAOF,GAAP;IACD,CA9BQ;IAgCT,6BAA6BnB,iBAhCpB;IAiCT,4BAA4BA,iBAjCnB;IAkCT,2BAA2BA,iBAlClB;IAoCT,mCAAoCc,GAAD,IAASA,GAAG,CAACZ,WAAJ,CAAgBE,YAAhB,CAA6BkB,wBAA7B,CAAsDR,GAAtD,CApCnC;IAqCT,kCAAmCA,GAAD,IAASA,GAAG,CAACZ,WAAJ,CAAgBE,YAAhB,CAA6BkB,wBAA7B,CAAsDR,GAAtD,CArClC;IAuCT,qBAAsBA,GAAD,IAASA,GAAG,CAACZ,WAAJ,CAAgBE,YAAhB,CAA6Bf,IAA7B,CAAkCyB,GAAlC;EAvCrB;AANiB,CAA9B;AAiDA,eAAeP,aAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/base.prod.js b/packages/@interactjs/modifiers/base.prod.js new file mode 100644 index 000000000..ed5c7c76d --- /dev/null +++ b/packages/@interactjs/modifiers/base.prod.js @@ -0,0 +1,2 @@ +import t from"./Modification";export function makeModifier(t,e){const{defaults:i}=t,n={start:t.start,set:t.set,beforeEnd:t.beforeEnd,stop:t.stop},o=t=>{const o=t||{};o.enabled=!1!==o.enabled;for(const t in i)t in o||(o[t]=i[t]);const r={options:o,methods:n,name:e,enable:()=>(o.enabled=!0,r),disable:()=>(o.enabled=!1,r)};return r};return e&&"string"==typeof e&&(o._defaults=i,o._methods=n),o}export function addEventModifiers({iEvent:t,interaction:e}){const i=e.modification.result;i&&(t.modifiers=i.eventProps)}const e={id:"modifiers/base",before:["actions"],install(t){t.defaults.perAction.modifiers=[]},listeners:{"interactions:new"({interaction:e}){e.modification=new t(e)},"interactions:before-action-start"(t){const{interaction:e}=t,i=t.interaction.modification;i.start(t,e.coords.start.page),e.edges=i.edges,i.applyToInteraction(t)},"interactions:before-action-move"(t){const{interaction:e}=t,{modification:i}=e,n=i.setAndApply(t);return e.edges=i.edges,n},"interactions:before-action-end"(t){const{interaction:e}=t,{modification:i}=e,n=i.beforeEnd(t);return e.edges=i.startEdges,n},"interactions:action-start":addEventModifiers,"interactions:action-move":addEventModifiers,"interactions:action-end":addEventModifiers,"interactions:after-action-start":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:after-action-move":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:stop":t=>t.interaction.modification.stop(t)}};export default e; +//# sourceMappingURL=base.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/base.prod.js.map b/packages/@interactjs/modifiers/base.prod.js.map new file mode 100644 index 000000000..a5238244a --- /dev/null +++ b/packages/@interactjs/modifiers/base.prod.js.map @@ -0,0 +1,55 @@ +{ + "version": 3, + "names": [ + "Modification", + "makeModifier", + "module", + "name", + "defaults", + "methods", + "start", + "set", + "beforeEnd", + "stop", + "modifier", + "_options", + "options", + "enabled", + "prop", + "m", + "enable", + "disable", + "_defaults", + "_methods", + "addEventModifiers", + "iEvent", + "interaction", + "result", + "modification", + "modifiers", + "eventProps", + "modifiersBase", + "id", + "before", + "install", + "scope", + "perAction", + "listeners", + "arg", + "coords", + "page", + "edges", + "applyToInteraction", + "ret", + "setAndApply", + "startEdges", + "restoreInteractionCoords" + ], + "sources": [ + "base.ts" + ], + "sourcesContent": [ + "import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\n\nimport Modification from './Modification'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\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}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n Result,\n> (module: ModifierModule, name?: Name) {\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 = (_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 as any)[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = {\n options,\n methods,\n name,\n enable: () => {\n options.enabled = true\n return m\n },\n disable: () => {\n options.enabled = false\n return m\n },\n }\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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\n const result = interaction.modification!.result\n\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Plugin = {\n id: 'modifiers/base',\n before: ['actions'],\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 { interaction } = arg\n const modification = arg.interaction.modification!\n\n modification.start(arg, interaction.coords.start.page)\n interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.setAndApply(arg)\n interaction.edges = modification.edges\n\n return ret\n },\n\n 'interactions:before-action-end': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.beforeEnd(arg)\n interaction.edges = modification.startEdges\n\n return ret\n },\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}\n\nexport default modifiersBase\n" + ], + "mappings": "OAIOA,MAAkB,wBAwBlB,SAASC,aAKbC,EAAiDC,GAClD,MAAMC,SAAEA,GAAaF,EACfG,EAAU,CACdC,MAAOJ,EAAOI,MACdC,IAAKL,EAAOK,IACZC,UAAWN,EAAOM,UAClBC,KAAMP,EAAOO,MAGTC,EAAYC,IAChB,MAAMC,EAAWD,GAAY,GAE7BC,EAAQC,SAA8B,IAApBD,EAAQC,QAG1B,IAAK,MAAMC,KAAQV,EACXU,KAAQF,IACVA,EAAgBE,GAAQV,EAASU,IAIvC,MAAMC,EAA6C,CACjDH,UACAP,UACAF,OACAa,OAAQ,KACNJ,EAAQC,SAAU,EACXE,GAETE,QAAS,KACPL,EAAQC,SAAU,EACXE,IAIX,OAAOA,GAST,OANIZ,GAAwB,iBAATA,IAEjBO,EAASQ,UAAYd,EACrBM,EAASS,SAAWd,GAGfK,SAGF,SAASU,mBAAmBC,OACjCA,EADiCC,YAEjCA,IAKA,MAAMC,EAASD,EAAYE,aAAcD,OAErCA,IACFF,EAAOI,UAAYF,EAAOG,YAI9B,MAAMC,EAAwB,CAC5BC,GAAI,iBACJC,OAAQ,CAAC,WACTC,QAAUC,GACRA,EAAM3B,SAAS4B,UAAUP,UAAY,IAEvCQ,UAAW,CACT,oBAAuBX,gBACrBA,EAAYE,aAAe,IAAIxB,EAAasB,IAG9C,mCAAqCY,GACnC,MAAMZ,YAAEA,GAAgBY,EAClBV,EAAeU,EAAIZ,YAAYE,aAErCA,EAAalB,MAAM4B,EAAKZ,EAAYa,OAAO7B,MAAM8B,MACjDd,EAAYe,MAAQb,EAAaa,MACjCb,EAAac,mBAAmBJ,IAGlC,kCAAoCA,GAClC,MAAMZ,YAAEA,GAAgBY,GAClBV,aAAEA,GAAiBF,EACnBiB,EAAMf,EAAagB,YAAYN,GAGrC,OAFAZ,EAAYe,MAAQb,EAAaa,MAE1BE,GAGT,iCAAmCL,GACjC,MAAMZ,YAAEA,GAAgBY,GAClBV,aAAEA,GAAiBF,EACnBiB,EAAMf,EAAahB,UAAU0B,GAGnC,OAFAZ,EAAYe,MAAQb,EAAaiB,WAE1BF,GAGT,4BAA6BnB,kBAC7B,2BAA4BA,kBAC5B,0BAA2BA,kBAE3B,kCAAoCc,GAAQA,EAAIZ,YAAYE,aAAakB,yBAAyBR,GAClG,iCAAmCA,GAAQA,EAAIZ,YAAYE,aAAakB,yBAAyBR,GAEjG,oBAAsBA,GAAQA,EAAIZ,YAAYE,aAAaf,KAAKyB,oBAIrDP" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/index.d.ts b/packages/@interactjs/modifiers/index.d.ts new file mode 100644 index 000000000..d187da63d --- /dev/null +++ b/packages/@interactjs/modifiers/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/modifiers/plugin'; diff --git a/packages/@interactjs/modifiers/index.js b/packages/@interactjs/modifiers/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/modifiers/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/index.js.map b/packages/@interactjs/modifiers/index.js.map new file mode 100644 index 000000000..6a9042ff8 --- /dev/null +++ b/packages/@interactjs/modifiers/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/modifiers/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/modifiers/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/index.prod.js b/packages/@interactjs/modifiers/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/modifiers/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/index.prod.js.map b/packages/@interactjs/modifiers/index.prod.js.map new file mode 100644 index 000000000..4cbd5cf6d --- /dev/null +++ b/packages/@interactjs/modifiers/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/modifiers/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/modifiers/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/index.ts b/packages/@interactjs/modifiers/index.ts new file mode 100644 index 000000000..99e1c828e --- /dev/null +++ b/packages/@interactjs/modifiers/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/modifiers/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/modifiers/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/modifiers/noop.d.ts b/packages/@interactjs/modifiers/noop.d.ts new file mode 100644 index 000000000..bf30c39b4 --- /dev/null +++ b/packages/@interactjs/modifiers/noop.d.ts @@ -0,0 +1,3 @@ +import type { ModifierFunction } from './types'; +declare const noop: ModifierFunction; +export default noop; diff --git a/packages/@interactjs/modifiers/noop.js b/packages/@interactjs/modifiers/noop.js new file mode 100644 index 000000000..b8c98383a --- /dev/null +++ b/packages/@interactjs/modifiers/noop.js @@ -0,0 +1,5 @@ +const noop = () => {}; + +noop._defaults = {}; +export default noop; +//# sourceMappingURL=noop.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/noop.js.map b/packages/@interactjs/modifiers/noop.js.map new file mode 100644 index 000000000..e57f83575 --- /dev/null +++ b/packages/@interactjs/modifiers/noop.js.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "names": [ + "noop", + "_defaults" + ], + "sources": [ + "noop.ts" + ], + "sourcesContent": [ + "import type { ModifierFunction } from './types'\n\nconst noop = (() => {}) as unknown as ModifierFunction\n\nnoop._defaults = {}\n\nexport default noop\n" + ], + "mappings": "AAEA,MAAMA,IAAI,GAAI,MAAM,CAAE,CAAtB;;AAEAA,IAAI,CAACC,SAAL,GAAiB,EAAjB;AAEA,eAAeD,IAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/noop.prod.js b/packages/@interactjs/modifiers/noop.prod.js new file mode 100644 index 000000000..cf26d260f --- /dev/null +++ b/packages/@interactjs/modifiers/noop.prod.js @@ -0,0 +1,2 @@ +const t=()=>{};t._defaults={};export default t; +//# sourceMappingURL=noop.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/noop.prod.js.map b/packages/@interactjs/modifiers/noop.prod.js.map new file mode 100644 index 000000000..72997e716 --- /dev/null +++ b/packages/@interactjs/modifiers/noop.prod.js.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "names": [ + "noop", + "_defaults" + ], + "sources": [ + "noop.ts" + ], + "sourcesContent": [ + "import type { ModifierFunction } from './types'\n\nconst noop = (() => {}) as unknown as ModifierFunction\n\nnoop._defaults = {}\n\nexport default noop\n" + ], + "mappings": "AAEA,MAAMA,EAAQ,OAEdA,EAAKC,UAAY,kBAEFD" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/package.json b/packages/@interactjs/modifiers/package.json index 285aa7f38..9ff3d956e 100644 --- a/packages/@interactjs/modifiers/package.json +++ b/packages/@interactjs/modifiers/package.json @@ -14,7 +14,6 @@ }, "peerDependencies": { "@interactjs/core": "1.10.23", - "@interactjs/rebound": "1.10.23", "@interactjs/utils": "1.10.23" }, "optionalDependencies": { diff --git a/packages/@interactjs/modifiers/plugin.d.ts b/packages/@interactjs/modifiers/plugin.d.ts new file mode 100644 index 000000000..602fbbcc2 --- /dev/null +++ b/packages/@interactjs/modifiers/plugin.d.ts @@ -0,0 +1,11 @@ +import type { Plugin } from '@interactjs/core/scope'; +import './all'; +import './base'; +import all from './all'; +declare module '@interactjs/core/InteractStatic' { + interface InteractStatic { + modifiers: typeof all; + } +} +declare const modifiers: Plugin; +export default modifiers; diff --git a/packages/@interactjs/modifiers/plugin.js b/packages/@interactjs/modifiers/plugin.js new file mode 100644 index 000000000..6e446319c --- /dev/null +++ b/packages/@interactjs/modifiers/plugin.js @@ -0,0 +1,33 @@ +import snappers from "../snappers/plugin.js"; +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ + +import './all'; +import './base'; +import all from './all'; +import base from './base'; +/* eslint-enable import/no-duplicates */ + +const modifiers = { + id: 'modifiers', + + install(scope) { + const { + interactStatic: interact + } = scope; + scope.usePlugin(base); + scope.usePlugin(snappers); + interact.modifiers = all; // for backwrads compatibility + + for (const type in all) { + const { + _defaults, + _methods + } = all[type]; + _defaults._methods = _methods; + scope.defaults.perAction[type] = _defaults; + } + } + +}; +export default modifiers; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/plugin.js.map b/packages/@interactjs/modifiers/plugin.js.map new file mode 100644 index 000000000..b8c77def1 --- /dev/null +++ b/packages/@interactjs/modifiers/plugin.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "snappers", + "all", + "base", + "modifiers", + "id", + "install", + "scope", + "interactStatic", + "interact", + "usePlugin", + "type", + "_defaults", + "_methods", + "defaults", + "perAction" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Plugin } from '@interactjs/core/scope'\nimport snappers from '@interactjs/snappers/plugin'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './all'\nimport './base'\n\nimport all from './all'\nimport base from './base'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n modifiers: typeof all\n }\n}\n\nconst modifiers: Plugin = {\n id: 'modifiers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n scope.usePlugin(base)\n scope.usePlugin(snappers)\n\n interact.modifiers = all\n\n // for backwrads compatibility\n for (const type in all) {\n const { _defaults, _methods } = all[type as keyof typeof all]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n },\n}\n\nexport default modifiers\n" + ], + "mappings": "AACA,OAAOA,QAAP,MAAqB,uBAArB;AAEA;;AACA,OAAO,OAAP;AACA,OAAO,QAAP;AAEA,OAAOC,GAAP,MAAgB,OAAhB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA;;AAQA,MAAMC,SAAiB,GAAG;EACxBC,EAAE,EAAE,WADoB;;EAExBC,OAAO,CAAEC,KAAF,EAAS;IACd,MAAM;MAAEC,cAAc,EAAEC;IAAlB,IAA+BF,KAArC;IAEAA,KAAK,CAACG,SAAN,CAAgBP,IAAhB;IACAI,KAAK,CAACG,SAAN,CAAgBT,QAAhB;IAEAQ,QAAQ,CAACL,SAAT,GAAqBF,GAArB,CANc,CAQd;;IACA,KAAK,MAAMS,IAAX,IAAmBT,GAAnB,EAAwB;MACtB,MAAM;QAAEU,SAAF;QAAaC;MAAb,IAA0BX,GAAG,CAACS,IAAD,CAAnC;MAEEC,SAAD,CAAmBC,QAAnB,GAA8BA,QAA9B;MACCN,KAAK,CAACO,QAAN,CAAeC,SAAhB,CAAkCJ,IAAlC,IAA0CC,SAA1C;IACF;EACF;;AAjBuB,CAA1B;AAoBA,eAAeR,SAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/plugin.prod.js b/packages/@interactjs/modifiers/plugin.prod.js new file mode 100644 index 000000000..60b6c5d56 --- /dev/null +++ b/packages/@interactjs/modifiers/plugin.prod.js @@ -0,0 +1,2 @@ +import t from"../snappers/plugin.prod.js";import"./all";import"./base";import o from"./all";import i from"./base";const s={id:"modifiers",install(s){const{interactStatic:r}=s;s.usePlugin(i),s.usePlugin(t),r.modifiers=o;for(const t in o){const{_defaults:i,_methods:r}=o[t];i._methods=r,s.defaults.perAction[t]=i}}};export default s; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/plugin.prod.js.map b/packages/@interactjs/modifiers/plugin.prod.js.map new file mode 100644 index 000000000..e2e7a37b1 --- /dev/null +++ b/packages/@interactjs/modifiers/plugin.prod.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "snappers", + "all", + "base", + "modifiers", + "id", + "install", + "scope", + "interactStatic", + "interact", + "usePlugin", + "type", + "_defaults", + "_methods", + "defaults", + "perAction" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Plugin } from '@interactjs/core/scope'\nimport snappers from '@interactjs/snappers/plugin'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './all'\nimport './base'\n\nimport all from './all'\nimport base from './base'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n modifiers: typeof all\n }\n}\n\nconst modifiers: Plugin = {\n id: 'modifiers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n scope.usePlugin(base)\n scope.usePlugin(snappers)\n\n interact.modifiers = all\n\n // for backwrads compatibility\n for (const type in all) {\n const { _defaults, _methods } = all[type as keyof typeof all]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n },\n}\n\nexport default modifiers\n" + ], + "mappings": "OACOA,MAAc,mCAGd,cACA,gBAEAC,MAAS,eACTC,MAAU,SASjB,MAAMC,EAAoB,CACxBC,GAAI,YACJC,QAASC,GACP,MAAQC,eAAgBC,GAAaF,EAErCA,EAAMG,UAAUP,GAChBI,EAAMG,UAAUT,GAEhBQ,EAASL,UAAYF,EAGrB,IAAK,MAAMS,KAAQT,EAAK,CACtB,MAAMU,UAAEA,EAAFC,SAAaA,GAAaX,EAAIS,GAElCC,EAAkBC,SAAWA,EAC7BN,EAAMO,SAASC,UAAkBJ,GAAQC,oBAKlCR" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/edges.d.ts b/packages/@interactjs/modifiers/restrict/edges.d.ts new file mode 100644 index 000000000..ee1abc701 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/edges.d.ts @@ -0,0 +1,46 @@ +import type { Point, Rect } from '@interactjs/core/types'; +import type { ModifierArg, ModifierState } from '../types'; +import type { RestrictOptions } from './pointer'; +export interface RestrictEdgesOptions { + inner: RestrictOptions['restriction']; + outer: RestrictOptions['restriction']; + offset?: RestrictOptions['offset']; + endOnly: boolean; + enabled?: boolean; +} +export declare type RestrictEdgesState = ModifierState; +declare function start({ interaction, startOffset, state }: ModifierArg): void; +declare function set({ coords, edges, interaction, state }: ModifierArg): void; +declare const restrictEdges: { + noInner: { + top: number; + left: number; + bottom: number; + right: number; + }; + noOuter: { + top: number; + left: number; + bottom: number; + right: number; + }; + start: typeof start; + set: typeof set; + defaults: RestrictEdgesOptions; +}; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: RestrictEdgesOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => void; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; +}; +export default _default; +export { restrictEdges }; diff --git a/packages/@interactjs/modifiers/restrict/edges.js b/packages/@interactjs/modifiers/restrict/edges.js new file mode 100644 index 000000000..b3f1ee053 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/edges.js @@ -0,0 +1,115 @@ +// 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 }, +// }, +// }) +import extend from "../../utils/extend.js"; +import * as rectUtils from "../../utils/rect.js"; +import { makeModifier } from '../base'; +import { getRestrictionRect } from './pointer'; +const noInner = { + top: +Infinity, + left: +Infinity, + bottom: -Infinity, + right: -Infinity +}; +const noOuter = { + top: -Infinity, + left: -Infinity, + bottom: +Infinity, + right: +Infinity +}; + +function start({ + interaction, + startOffset, + state +}) { + const { + options + } = state; + let offset; + + if (options) { + const offsetRect = getRestrictionRect(options.offset, interaction, interaction.coords.start.page); + offset = rectUtils.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({ + coords, + edges, + interaction, + state +}) { + const { + offset, + options + } = state; + + if (!edges) { + return; + } + + const page = extend({}, coords); + const inner = getRestrictionRect(options.inner, interaction, page) || {}; + const outer = 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) { + for (const edge of ['top', 'left', 'bottom', 'right']) { + if (!(edge in rect)) { + rect[edge] = defaults[edge]; + } + } + + return rect; +} + +const defaults = { + inner: null, + outer: null, + offset: null, + endOnly: false, + enabled: false +}; +const restrictEdges = { + noInner, + noOuter, + start, + set, + defaults +}; +export default makeModifier(restrictEdges, 'restrictEdges'); +export { restrictEdges }; +//# sourceMappingURL=edges.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/edges.js.map b/packages/@interactjs/modifiers/restrict/edges.js.map new file mode 100644 index 000000000..672c7f061 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/edges.js.map @@ -0,0 +1,49 @@ +{ + "version": 3, + "names": [ + "extend", + "rectUtils", + "makeModifier", + "getRestrictionRect", + "noInner", + "top", + "Infinity", + "left", + "bottom", + "right", + "noOuter", + "start", + "interaction", + "startOffset", + "state", + "options", + "offset", + "offsetRect", + "coords", + "page", + "rectToXY", + "x", + "y", + "set", + "edges", + "inner", + "outer", + "fixRect", + "Math", + "min", + "max", + "rect", + "defaults", + "edge", + "endOnly", + "enabled", + "restrictEdges" + ], + "sources": [ + "edges.ts" + ], + "sourcesContent": [ + "// 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 type { Point, Rect } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } 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<\nRestrictEdgesOptions,\n{\n inner: Rect\n outer: Rect\n offset: RestrictEdgesOptions['offset']\n}\n>\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: Point\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 Rect)\n const outer = getRestrictionRect(options.outer, interaction, page) || ({} as 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 } 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 } 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: Rect, defaults: Rect) {\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 makeModifier(restrictEdges, 'restrictEdges')\nexport { restrictEdges }\n" + ], + "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,OAAOA,MAAP,MAAmB,uBAAnB;AACA,OAAO,KAAKC,SAAZ,MAA2B,qBAA3B;AAEA,SAASC,YAAT,QAA6B,SAA7B;AAIA,SAASC,kBAAT,QAAmC,WAAnC;AAmBA,MAAMC,OAAO,GAAG;EAAEC,GAAG,EAAE,CAACC,QAAR;EAAkBC,IAAI,EAAE,CAACD,QAAzB;EAAmCE,MAAM,EAAE,CAACF,QAA5C;EAAsDG,KAAK,EAAE,CAACH;AAA9D,CAAhB;AACA,MAAMI,OAAO,GAAG;EAAEL,GAAG,EAAE,CAACC,QAAR;EAAkBC,IAAI,EAAE,CAACD,QAAzB;EAAmCE,MAAM,EAAE,CAACF,QAA5C;EAAsDG,KAAK,EAAE,CAACH;AAA9D,CAAhB;;AAEA,SAASK,KAAT,CAAgB;EAAEC,WAAF;EAAeC,WAAf;EAA4BC;AAA5B,CAAhB,EAAsF;EACpF,MAAM;IAAEC;EAAF,IAAcD,KAApB;EACA,IAAIE,MAAJ;;EAEA,IAAID,OAAJ,EAAa;IACX,MAAME,UAAU,GAAGd,kBAAkB,CAACY,OAAO,CAACC,MAAT,EAAiBJ,WAAjB,EAA8BA,WAAW,CAACM,MAAZ,CAAmBP,KAAnB,CAAyBQ,IAAvD,CAArC;IAEAH,MAAM,GAAGf,SAAS,CAACmB,QAAV,CAAmBH,UAAnB,CAAT;EACD;;EAEDD,MAAM,GAAGA,MAAM,IAAI;IAAEK,CAAC,EAAE,CAAL;IAAQC,CAAC,EAAE;EAAX,CAAnB;EAEAR,KAAK,CAACE,MAAN,GAAe;IACbX,GAA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B;EAIpBY,GAJoB;EAKpBS;AALoB,CAAtB;AAQA,eAAe9B,YAAY,CAACkC,aAAD,EAAgB,eAAhB,CAA3B;AACA,SAASA,aAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/edges.prod.js b/packages/@interactjs/modifiers/restrict/edges.prod.js new file mode 100644 index 000000000..90c7c0f3c --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/edges.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/extend.prod.js";import*as o from"../../utils/rect.prod.js";import{makeModifier as e}from"../base";import{getRestrictionRect as r}from"./pointer";const n={top:1/0,left:1/0,bottom:-1/0,right:-1/0},i={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function s(t,o){for(const e of["top","left","bottom","right"])e in t||(t[e]=o[e]);return t}const f={noInner:n,noOuter:i,start({interaction:t,startOffset:e,state:n}){const{options:i}=n;let s;if(i){const e=r(i.offset,t,t.coords.start.page);s=o.rectToXY(e)}s=s||{x:0,y:0},n.offset={top:s.y+e.top,left:s.x+e.left,bottom:s.y-e.bottom,right:s.x-e.right}},set({coords:o,edges:e,interaction:f,state:m}){const{offset:a,options:l}=m;if(!e)return;const p=t({},o),h=r(l.inner,f,p)||{},c=r(l.outer,f,p)||{};s(h,n),s(c,i),e.top?o.y=Math.min(Math.max(c.top+a.top,p.y),h.top+a.top):e.bottom&&(o.y=Math.max(Math.min(c.bottom+a.bottom,p.y),h.bottom+a.bottom)),e.left?o.x=Math.min(Math.max(c.left+a.left,p.x),h.left+a.left):e.right&&(o.x=Math.max(Math.min(c.right+a.right,p.x),h.right+a.right))},defaults:{inner:null,outer:null,offset:null,endOnly:!1,enabled:!1}};export default e(f,"restrictEdges");export{f as restrictEdges}; +//# sourceMappingURL=edges.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/edges.prod.js.map b/packages/@interactjs/modifiers/restrict/edges.prod.js.map new file mode 100644 index 000000000..be0c94f43 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/edges.prod.js.map @@ -0,0 +1,48 @@ +{ + "version": 3, + "names": [ + "extend", + "rectUtils", + "makeModifier", + "getRestrictionRect", + "noInner", + "top", + "left", + "bottom", + "right", + "noOuter", + "fixRect", + "rect", + "defaults", + "edge", + "restrictEdges", + "start", + "interaction", + "startOffset", + "state", + "options", + "offset", + "offsetRect", + "coords", + "page", + "rectToXY", + "x", + "y", + "set", + "edges", + "inner", + "outer", + "Math", + "min", + "max", + "endOnly", + "enabled" + ], + "sources": [ + "edges.ts" + ], + "sourcesContent": [ + "// 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 type { Point, Rect } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } 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<\nRestrictEdgesOptions,\n{\n inner: Rect\n outer: Rect\n offset: RestrictEdgesOptions['offset']\n}\n>\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: Point\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 Rect)\n const outer = getRestrictionRect(options.outer, interaction, page) || ({} as 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 } 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 } 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: Rect, defaults: Rect) {\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 makeModifier(restrictEdges, 'restrictEdges')\nexport { restrictEdges }\n" + ], + "mappings": "OAYOA,MAAY,uCACPC,MAAe,kDAElBC,MAAoB,uCAIpBC,MAA0B,YAmBnC,MAAMC,EAAU,CAAEC,IAAK,IAAWC,KAAM,IAAWC,QAAQ,IAAWC,OAAO,KACvEC,EAAU,CAAEJ,KAAK,IAAWC,MAAM,IAAWC,OAAQ,IAAWC,MAAO,KAgD7E,SAASE,EAASC,EAAYC,GAC5B,IAAK,MAAMC,IAAQ,CAAC,MAAO,OAAQ,SAAU,SACrCA,KAAQF,IACZA,EAAKE,GAAQD,EAASC,IAI1B,OAAOF,EAGT,MAQ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AIF,KAAKC,IAAIF,EAAMtB,MAAQY,EAAOZ,MAAOe,EAAKE,GAAII,EAAMrB,MAAQY,EAAOZ,SA2BzFI,SAbqC,CACrCiB,MAAO,KACPC,MAAO,KACPV,OAAQ,KACRc,SAAS,EACTC,SAAS,mBAWIjC,EAAaY,EAAe,wBAClCA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/pointer.d.ts b/packages/@interactjs/modifiers/restrict/pointer.d.ts new file mode 100644 index 000000000..1ad1a21a0 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/pointer.d.ts @@ -0,0 +1,27 @@ +import type Interaction from '@interactjs/core/Interaction'; +import type { RectResolvable, Rect, Point } from '@interactjs/core/types'; +import type { ModifierArg, ModifierModule, ModifierState } from '../types'; +export interface RestrictOptions { + restriction: RectResolvable<[number, number, Interaction]>; + elementRect: Rect; + offset: Rect; + endOnly: boolean; + enabled?: boolean; +} +export declare type RestrictState = ModifierState; +export declare function getRestrictionRect(value: RectResolvable<[number, number, Interaction]>, interaction: Interaction, coords?: Point): Rect; +declare const restrict: ModifierModule; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: RestrictOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => unknown; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; +}; +export default _default; +export { restrict }; diff --git a/packages/@interactjs/modifiers/restrict/pointer.js b/packages/@interactjs/modifiers/restrict/pointer.js new file mode 100644 index 000000000..d0a483704 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/pointer.js @@ -0,0 +1,90 @@ +import extend from "../../utils/extend.js"; +import is from "../../utils/is.js"; +import * as rectUtils from "../../utils/rect.js"; +import { makeModifier } from '../base'; + +function start({ + rect, + startOffset, + state, + interaction, + pageCoords +}) { + const { + options + } = state; + const { + elementRect + } = options; + const offset = extend({ + left: 0, + top: 0, + right: 0, + bottom: 0 + }, options.offset || {}); + + if (rect && elementRect) { + const restriction = getRestrictionRect(options.restriction, interaction, pageCoords); + + if (restriction) { + const widthDiff = restriction.right - restriction.left - rect.width; + const 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({ + coords, + interaction, + state +}) { + const { + options, + offset + } = state; + const restriction = getRestrictionRect(options.restriction, interaction, coords); + if (!restriction) return; + const rect = rectUtils.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); +} + +export function getRestrictionRect(value, interaction, coords) { + if (is.func(value)) { + return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction]); + } else { + return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element); + } +} +const defaults = { + restriction: null, + elementRect: null, + offset: null, + endOnly: false, + enabled: false +}; +const restrict = { + start, + set, + defaults +}; +export default makeModifier(restrict, 'restrict'); +export { restrict }; +//# sourceMappingURL=pointer.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/pointer.js.map b/packages/@interactjs/modifiers/restrict/pointer.js.map new file mode 100644 index 000000000..42fad02ac --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/pointer.js.map @@ -0,0 +1,52 @@ +{ + "version": 3, + "names": [ + "extend", + "is", + "rectUtils", + "makeModifier", + "start", + "rect", + "startOffset", + "state", + "interaction", + "pageCoords", + "options", + "elementRect", + "offset", + "left", + "top", + "right", + "bottom", + "restriction", + "getRestrictionRect", + "widthDiff", + "width", + "heightDiff", + "height", + "set", + "coords", + "xywhToTlbr", + "x", + "Math", + "max", + "min", + "y", + "value", + "func", + "resolveRectLike", + "interactable", + "element", + "defaults", + "endOnly", + "enabled", + "restrict" + ], + "sources": [ + "pointer.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { RectResolvable, Rect, Point } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule, ModifierState } from '../types'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: RectResolvable<[number, number, Interaction]>\n // what part of self is allowed to drag over\n elementRect: Rect\n offset: Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState<\nRestrictOptions,\n{\n offset: Rect\n}\n>\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Rect = extend(\n {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n options.offset || {},\n )\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: RectResolvable<[number, number, Interaction]>,\n interaction: Interaction,\n coords?: Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [\n coords.x,\n coords.y,\n interaction,\n ])\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 makeModifier(restrict, 'restrict')\nexport { restrict }\n" + ], + "mappings": "AAEA,OAAOA,MAAP,MAAmB,uBAAnB;AACA,OAAOC,EAAP,MAAe,mBAAf;AACA,OAAO,KAAKC,SAAZ,MAA2B,qBAA3B;AAEA,SAASC,YAAT,QAA6B,SAA7B;;AAqBA,SAASC,KAAT,CAAgB;EAAEC,IAAF;EAAQC,WAAR;EAAqBC,KAArB;EAA4BC,WAA5B;EAAyCC;AAAzC,CAAhB,EAAmG;EACjG,MAAM;IAAEC;EAAF,IAAcH,KAApB;EACA,MAAM;IAAEI;EAAF,IAAkBD,OAAxB;EACA,MAAME,MAAY,GAAGZ,MAAM,CACzB;IACEa,IAAI,EAAE,CADR;IAEEC,GAAG,EAAE,CAFP;IAGEC,KAAK,EAAE,CAHT;IAIEC,MAAM,EAAE;EAJV,CADyB,EAOzBN,OAAO,CAACE,MAAR,IAAkB,EAPO,CAA3B;;EAUA,IAAIP,IAAI,IAAIM,WAAZ,EAAyB;IACvB,MAAMM,WAAW,GAAGC,kBAAkB,CAACR,OAAO,CAACO,WAAT,EAAsBT,WAAtB,EAAmCC,UAAnC,CAAtC;;IAEA,IAAIQ,WAAJ,EAAiB;MACf,MAAME,SAAS,GAAGF,WAAW,CAACF,KAAZ,GAAoBE,WAAW,CAACJ,I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} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/pointer.prod.js b/packages/@interactjs/modifiers/restrict/pointer.prod.js new file mode 100644 index 000000000..d93e2b1f1 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/pointer.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/extend.prod.js";import e from"../../utils/is.prod.js";import*as o from"../../utils/rect.prod.js";import{makeModifier as i}from"../base";export function getRestrictionRect(t,i,r){return e.func(t)?o.resolveRectLike(t,i.interactable,i.element,[r.x,r.y,i]):o.resolveRectLike(t,i.interactable,i.element)}const r={start({rect:e,startOffset:o,state:i,interaction:r,pageCoords:s}){const{options:n}=i,{elementRect:l}=n,c=t({left:0,top:0,right:0,bottom:0},n.offset||{});if(e&&l){const t=getRestrictionRect(n.restriction,r,s);if(t){const o=t.right-t.left-e.width,i=t.bottom-t.top-e.height;o<0&&(c.left+=o,c.right+=o),i<0&&(c.top+=i,c.bottom+=i)}c.left+=o.left-e.width*l.left,c.top+=o.top-e.height*l.top,c.right+=o.right-e.width*(1-l.right),c.bottom+=o.bottom-e.height*(1-l.bottom)}i.offset=c},set({coords:t,interaction:e,state:i}){const{options:r,offset:s}=i,n=getRestrictionRect(r.restriction,e,t);if(!n)return;const l=o.xywhToTlbr(n);t.x=Math.max(Math.min(l.right-s.right,t.x),l.left+s.left),t.y=Math.max(Math.min(l.bottom-s.bottom,t.y),l.top+s.top)},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}};export default i(r,"restrict");export{r as restrict}; +//# sourceMappingURL=pointer.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/pointer.prod.js.map b/packages/@interactjs/modifiers/restrict/pointer.prod.js.map new file mode 100644 index 000000000..cabbdbcfd --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/pointer.prod.js.map @@ -0,0 +1,52 @@ +{ + "version": 3, + "names": [ + "extend", + "is", + "rectUtils", + "makeModifier", + "getRestrictionRect", + "value", + "interaction", + "coords", + "func", + "resolveRectLike", + "interactable", + "element", + "x", + "y", + "restrict", + "start", + "rect", + "startOffset", + "state", + "pageCoords", + "options", + "elementRect", + "offset", + "left", + "top", + "right", + "bottom", + "restriction", + "widthDiff", + "width", + "heightDiff", + "height", + "set", + "xywhToTlbr", + "Math", + "max", + "min", + "defaults", + "endOnly", + "enabled" + ], + "sources": [ + "pointer.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { RectResolvable, Rect, Point } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule, ModifierState } from '../types'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: RectResolvable<[number, number, Interaction]>\n // what part of self is allowed to drag over\n elementRect: Rect\n offset: Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState<\nRestrictOptions,\n{\n offset: Rect\n}\n>\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Rect = extend(\n {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n options.offset || {},\n )\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: RectResolvable<[number, number, Interaction]>,\n interaction: Interaction,\n coords?: Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [\n coords.x,\n coords.y,\n interaction,\n ])\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 makeModifier(restrict, 'restrict')\nexport { restrict }\n" + ], + "mappings": "OAEOA,MAAY,oCACZC,MAAQ,mCACHC,MAAe,kDAElBC,MAAoB,iBA0EtB,SAASC,mBACdC,EACAC,EACAC,GAEA,OAAIN,EAAGO,KAAKH,GACHH,EAAUO,gBAAgBJ,EAAOC,EAAYI,aAAcJ,EAAYK,QAAS,CACrFJ,EAAOK,EACPL,EAAOM,EACPP,IAGKJ,EAAUO,gBAAgBJ,EAAOC,EAAYI,aAAcJ,EAAYK,SAIlF,MAQMG,EAA2D,CAC/DC,OA9EcC,KAAEA,EAAFC,YAAQA,EAARC,MAAqBA,EAArBZ,YAA4BA,EAA5Ba,WAAyCA,IACvD,MAAMC,QAAEA,GAAYF,GACdG,YAAEA,GAAgBD,EAClBE,EAAetB,EACnB,CACEuB,KAAM,EACNC,IAAK,EACLC,MAAO,EACPC,OAAQ,GAEVN,EAAQE,QAAU,IAGpB,GAAIN,GAAQK,EAAa,CACvB,MAAMM,EAAcvB,mBAAmBgB,EAAQO,YAAarB,EAAaa,GAEzE,GAAIQ,EAAa,CACf,MAAMC,EAAYD,EAAYF,MAAQE,EAAYJ,KAAOP,EAAKa,MACxDC,EAAaH,EAAYD,OAASC,EAAYH,IAAMR,EAAKe,OAE3DH,EAAY,IACdN,EAAOC,MAAQK,EACfN,EAAOG,OAASG,GAEdE,EAAa,IACfR,EAAOE,KAAOM,EACdR,EAAOI,QAAUI,GAIrBR,EAAOC,MAAQN,EAAYM,KAAOP,EAAKa,MAAQR,EAAYE,KAC3DD,EAAOE,KAAOP,EAAYO,IAAMR,EAAKe,OAASV,EAAYG,IAE1DF,EAAOG,OAASR,EAAYQ,MAAQT,EAAKa,OAAS,EAAIR,EAAYI,OAClEH,EAAOI,QAAUT,EAAYS,OAASV,EAAKe,QAAU,EAAIV,EAAYK,QAGvER,EAAMI,OAASA,GA0CfU,KAvCYzB,OAAEA,EAAFD,YAAUA,EAAVY,MAAuBA,IACnC,MAAME,QAAEA,EAAFE,OAAWA,GAAWJ,EAEtBS,EAAcvB,mBAAmBgB,EAAQO,YAAarB,EAAaC,GAEzE,IAAKoB,EAAa,OAElB,MAAMX,EAAOd,EAAU+B,WAAWN,GAElCpB,EAAOK,EAAIsB,KAAKC,IAAID,KAAKE,IAAIpB,EAAKS,MAAQH,EAAOG,MAAOlB,EAAOK,GAAII,EAAKO,KAAOD,EAAOC,MACtFhB,EAAOM,EAAIqB,KAAKC,IAAID,KAAKE,IAAIpB,EAAKU,OAASJ,EAAOI,OAAQnB,EAAOM,GAAIG,EAAKQ,IAAMF,EAAOE,MA8BvFa,SAXgC,CAChCV,YAAa,KACbN,YAAa,KACbC,OAAQ,KACRgB,SAAS,EACTC,SAAS,mBASIpC,EAAaW,EAAU,mBAC7BA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/rect.d.ts b/packages/@interactjs/modifiers/restrict/rect.d.ts new file mode 100644 index 000000000..a33457ae9 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/rect.d.ts @@ -0,0 +1,45 @@ +declare const restrictRect: { + start: (arg: import("../types").ModifierArg) => void; + set: (arg: import("../types").ModifierArg) => unknown; + defaults: import("./pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; +}; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: import("./pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; + _methods: { + start: (arg: import("../types").ModifierArg) => void; + set: (arg: import("../types").ModifierArg) => unknown; + beforeEnd: (arg: import("../types").ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: import("../types").ModifierArg) => void; + }; +}; +export default _default; +export { restrictRect }; diff --git a/packages/@interactjs/modifiers/restrict/rect.js b/packages/@interactjs/modifiers/restrict/rect.js new file mode 100644 index 000000000..36d19f3a5 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/rect.js @@ -0,0 +1,24 @@ +import extend from "../../utils/extend.js"; +import { makeModifier } from '../base'; +import { restrict } from './pointer'; +const defaults = extend({ + get elementRect() { + return { + top: 0, + left: 0, + bottom: 1, + right: 1 + }; + }, + + set elementRect(_) {} + +}, restrict.defaults); +const restrictRect = { + start: restrict.start, + set: restrict.set, + defaults +}; +export default makeModifier(restrictRect, 'restrictRect'); +export { restrictRect }; +//# sourceMappingURL=rect.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/rect.js.map b/packages/@interactjs/modifiers/restrict/rect.js.map new file mode 100644 index 000000000..336ef3003 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/rect.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "names": [ + "extend", + "makeModifier", + "restrict", + "defaults", + "elementRect", + "top", + "left", + "bottom", + "right", + "_", + "restrictRect", + "start", + "set" + ], + "sources": [ + "rect.ts" + ], + "sourcesContent": [ + "import extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\n\nimport { restrict } from './pointer'\n\nconst defaults = extend(\n {\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n },\n restrict.defaults,\n)\n\nconst restrictRect = {\n start: restrict.start,\n set: restrict.set,\n defaults,\n}\n\nexport default makeModifier(restrictRect, 'restrictRect')\nexport { restrictRect }\n" + ], + "mappings": "AAAA,OAAOA,MAAP,MAAmB,uBAAnB;AAEA,SAASC,YAAT,QAA6B,SAA7B;AAEA,SAASC,QAAT,QAAyB,WAAzB;AAEA,MAAMC,QAAQ,GAAGH,MAAM,CACrB;EACE,IAAII,WAAJ,GAAmB;IACjB,OAAO;MAAEC,GAAG,EAAE,CAAP;MAAUC,IAAI,EAAE,CAAhB;MAAmBC,MAAM,EAAE,CAA3B;MAA8BC,KAAK,EAAE;IAArC,CAAP;EACD,CAHH;;EAIE,IAAIJ,WAAJ,CAAiBK,CAAjB,EAAoB,CAAE;;AAJxB,CADqB,EAOrBP,QAAQ,CAACC,QAPY,CAAvB;AAUA,MAAMO,YAAY,GAAG;EACnBC,KAAK,EAAET,QAAQ,CAACS,KADG;EAEnBC,GAAG,EAAEV,QAAQ,CAACU,GAFK;EAGnBT;AAHmB,CAArB;AAMA,eAAeF,YAAY,CAACS,YAAD,EAAe,cAAf,CAA3B;AACA,SAASA,YAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/rect.prod.js b/packages/@interactjs/modifiers/restrict/rect.prod.js new file mode 100644 index 000000000..540a13309 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/rect.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/extend.prod.js";import{makeModifier as e}from"../base";import{restrict as r}from"./pointer";const o=t({get elementRect(){return{top:0,left:0,bottom:1,right:1}},set elementRect(t){}},r.defaults),s={start:r.start,set:r.set,defaults:o};export default e(s,"restrictRect");export{s as restrictRect}; +//# sourceMappingURL=rect.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/rect.prod.js.map b/packages/@interactjs/modifiers/restrict/rect.prod.js.map new file mode 100644 index 000000000..18b84f1c8 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/rect.prod.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "names": [ + "extend", + "makeModifier", + "restrict", + "defaults", + "elementRect", + "top", + "left", + "bottom", + "right", + "_", + "restrictRect", + "start", + "set" + ], + "sources": [ + "rect.ts" + ], + "sourcesContent": [ + "import extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\n\nimport { restrict } from './pointer'\n\nconst defaults = extend(\n {\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n },\n restrict.defaults,\n)\n\nconst restrictRect = {\n start: restrict.start,\n set: restrict.set,\n defaults,\n}\n\nexport default makeModifier(restrictRect, 'restrictRect')\nexport { restrictRect }\n" + ], + "mappings": "OAAOA,MAAY,oDAEVC,MAAoB,6BAEpBC,MAAgB,YAEzB,MAAMC,EAAWH,EACf,CACMI,kBACF,MAAO,CAAEC,IAAK,EAAGC,KAAM,EAAGC,OAAQ,EAAGC,MAAO,IAE1CJ,gBAAaK,MAEnBP,EAASC,UAGLO,EAAe,CACnBC,MAAOT,EAASS,MAChBC,IAAKV,EAASU,IACdT,2BAGaF,EAAaS,EAAc,uBACjCA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/size.d.ts b/packages/@interactjs/modifiers/restrict/size.d.ts new file mode 100644 index 000000000..6def7c0cc --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/size.d.ts @@ -0,0 +1,36 @@ +import type { Point, Rect, Size } from '@interactjs/core/types'; +import type { ModifierArg, ModifierState } from '../types'; +import type { RestrictEdgesState } from './edges'; +import type { RestrictOptions } from './pointer'; +export interface RestrictSizeOptions { + min?: Size | Point | RestrictOptions['restriction']; + max?: Size | Point | RestrictOptions['restriction']; + endOnly: boolean; + enabled?: boolean; +} +declare function start(arg: ModifierArg): void; +export declare type RestrictSizeState = RestrictEdgesState & ModifierState; +declare function set(arg: ModifierArg): void; +declare const restrictSize: { + start: typeof start; + set: typeof set; + defaults: RestrictSizeOptions; +}; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: RestrictSizeOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => void; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; +}; +export default _default; +export { restrictSize }; diff --git a/packages/@interactjs/modifiers/restrict/size.js b/packages/@interactjs/modifiers/restrict/size.js new file mode 100644 index 000000000..c5261e73f --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/size.js @@ -0,0 +1,75 @@ +import extend from "../../utils/extend.js"; +import * as rectUtils from "../../utils/rect.js"; +import { makeModifier } from '../base'; +import { restrictEdges } from './edges'; +import { getRestrictionRect } from './pointer'; +const noMin = { + width: -Infinity, + height: -Infinity +}; +const noMax = { + width: +Infinity, + height: +Infinity +}; + +function start(arg) { + return restrictEdges.start(arg); +} + +function set(arg) { + const { + interaction, + state, + rect, + edges + } = arg; + const { + options + } = state; + + if (!edges) { + return; + } + + const minSize = rectUtils.tlbrToXywh(getRestrictionRect(options.min, interaction, arg.coords)) || noMin; + const maxSize = rectUtils.tlbrToXywh(getRestrictionRect(options.max, interaction, arg.coords)) || noMax; + state.options = { + endOnly: options.endOnly, + inner: extend({}, restrictEdges.noInner), + outer: extend({}, restrictEdges.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; + } + + restrictEdges.set(arg); + state.options = options; +} + +const defaults = { + min: null, + max: null, + endOnly: false, + enabled: false +}; +const restrictSize = { + start, + set, + defaults +}; +export default makeModifier(restrictSize, 'restrictSize'); +export { restrictSize }; +//# sourceMappingURL=size.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/size.js.map b/packages/@interactjs/modifiers/restrict/size.js.map new file mode 100644 index 000000000..36666bb88 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/size.js.map @@ -0,0 +1,48 @@ +{ + "version": 3, + "names": [ + "extend", + "rectUtils", + "makeModifier", + "restrictEdges", + "getRestrictionRect", + "noMin", + "width", + "Infinity", + "height", + "noMax", + "start", + "arg", + "set", + "interaction", + "state", + "rect", + "edges", + "options", + "minSize", + "tlbrToXywh", + "min", + "coords", + "maxSize", + "max", + "endOnly", + "inner", + "noInner", + "outer", + "noOuter", + "top", + "bottom", + "left", + "right", + "defaults", + "enabled", + "restrictSize" + ], + "sources": [ + "size.ts" + ], + "sourcesContent": [ + "import type { Point, Rect, Size } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictEdgesState } from './edges'\nimport { restrictEdges } from './edges'\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Size | Point | RestrictOptions['restriction']\n max?: Size | 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 = RestrictEdgesState &\nModifierState<\nRestrictSizeOptions & { inner: Rect, outer: Rect },\n{\n min: Rect\n max: Rect\n}\n>\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 =\n rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize =\n 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 } 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 } 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 makeModifier(restrictSize, 'restrictSize')\nexport { restrictSize }\n" + ], + "mappings": "AACA,OAAOA,MAAP,MAAmB,uBAAnB;AACA,OAAO,KAAKC,SAAZ,MAA2B,qBAA3B;AAEA,SAASC,YAAT,QAA6B,SAA7B;AAIA,SAASC,aAAT,QAA8B,SAA9B;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AAEA,MAAMC,KAAK,GAAG;EAAEC,KAAK,EAAE,CAACC,QAAV;EAAoBC,MAAM,EAAE,CAACD;AAA7B,CAAd;AACA,MAAME,KAAK,GAAG;EAAEH,KAAK,EAAE,CAACC,QAAV;EAAoBC,MAAM,EAAE,CAACD;AAA7B,CAAd;;AASA,SAASG,KAAT,CAAgBC,GAAhB,EAAsD;EACpD,OAAOR,aAAa,CAACO,KAAd,CAAoBC,GAApB,CAAP;AACD;;AAWD,SAASC,GAAT,CAAcD,GAAd,EAAmD;EACjD,MAAM;IAAEE,WAAF;IAAeC,KAAf;IAAsBC,IAAtB;IAA4BC;EAA5B,IAAsCL,GAA5C;EACA,MAAM;IAAEM;EAAF,IAAcH,KAApB;;EAEA,IAAI,CAACE,KAAL,EAAY;IACV;EACD;;EAED,MAAME,OAAO,GACXjB,S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2BhB,IAAI,CAACiB,KAAL,GAAaV,OAAO,CAAChB,KAAhD;EACD,CAHD,MAGO,IAAIU,KAAK,CAACgB,KAAV,EAAiB;IACtBlB,KAAK,CAACG,OAAN,CAAcQ,KAAd,CAAoBO,KAApB,GAA4BjB,IAAI,CAACgB,IAAL,GAAYb,OAAO,CAACZ,KAAhD;IACAQ,KAAK,CAACG,OAAN,CAAcU,KAAd,CAAoBK,KAApB,GAA4BjB,IAAI,CAACgB,IAAL,GAAYT,OAAO,CAAChB,KAAhD;EACD;;EAEDH,aAAa,CAACS,GAAd,CAAkBD,GAAlB;EAEAG,KAAK,CAACG,OAAN,GAAgBA,OAAhB;AACD;;AAED,MAAMgB,QAA6B,GAAG;EACpCb,GAAG,EAAE,IAD+B;EAEpCG,GAAG,EAAE,IAF+B;EAGpCC,OAAO,EAAE,KAH2B;EAIpCU,OAAO,EAAE;AAJ2B,CAAtC;AAOA,MAAMC,YAAY,GAAG;EACnBzB,KADmB;EAEnBE,GAFmB;EAGnBqB;AAHmB,CAArB;AAMA,eAAe/B,YAAY,CAACiC,YAAD,EAAe,cAAf,CAA3B;AACA,SAASA,YAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/size.prod.js b/packages/@interactjs/modifiers/restrict/size.prod.js new file mode 100644 index 000000000..7cea6bbf4 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/size.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/extend.prod.js";import*as o from"../../utils/rect.prod.js";import{makeModifier as e}from"../base";import{restrictEdges as i}from"./edges";import{getRestrictionRect as r}from"./pointer";const n={width:-1/0,height:-1/0},s={width:1/0,height:1/0},p={start:t=>i.start(t),set(e){const{interaction:p,state:h,rect:d,edges:l}=e,{options:m}=h;if(!l)return;const f=o.tlbrToXywh(r(m.min,p,e.coords))||n,g=o.tlbrToXywh(r(m.max,p,e.coords))||s;h.options={endOnly:m.endOnly,inner:t({},i.noInner),outer:t({},i.noOuter)},l.top?(h.options.inner.top=d.bottom-f.height,h.options.outer.top=d.bottom-g.height):l.bottom&&(h.options.inner.bottom=d.top+f.height,h.options.outer.bottom=d.top+g.height),l.left?(h.options.inner.left=d.right-f.width,h.options.outer.left=d.right-g.width):l.right&&(h.options.inner.right=d.left+f.width,h.options.outer.right=d.left+g.width),i.set(e),h.options=m},defaults:{min:null,max:null,endOnly:!1,enabled:!1}};export default e(p,"restrictSize");export{p as restrictSize}; +//# sourceMappingURL=size.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/restrict/size.prod.js.map b/packages/@interactjs/modifiers/restrict/size.prod.js.map new file mode 100644 index 000000000..39ce94156 --- /dev/null +++ b/packages/@interactjs/modifiers/restrict/size.prod.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "names": [ + "extend", + "rectUtils", + "makeModifier", + "restrictEdges", + "getRestrictionRect", + "noMin", + "width", + "height", + "noMax", + "restrictSize", + "start", + "arg", + "set", + "interaction", + "state", + "rect", + "edges", + "options", + "minSize", + "tlbrToXywh", + "min", + "coords", + "maxSize", + "max", + "endOnly", + "inner", + "noInner", + "outer", + "noOuter", + "top", + "bottom", + "left", + "right", + "defaults", + "enabled" + ], + "sources": [ + "size.ts" + ], + "sourcesContent": [ + "import type { Point, Rect, Size } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictEdgesState } from './edges'\nimport { restrictEdges } from './edges'\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Size | Point | RestrictOptions['restriction']\n max?: Size | 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 = RestrictEdgesState &\nModifierState<\nRestrictSizeOptions & { inner: Rect, outer: Rect },\n{\n min: Rect\n max: Rect\n}\n>\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 =\n rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize =\n 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 } 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 } 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 makeModifier(restrictSize, 'restrictSize')\nexport { restrictSize }\n" + ], + "mappings": "OACOA,MAAY,uCACPC,MAAe,kDAElBC,MAAoB,kCAIpBC,MAAqB,uCAErBC,MAA0B,YAEnC,MAAMC,EAAQ,CAAEC,OAAO,IAAWC,QAAQ,KACpCC,EAAQ,CAAEF,MAAO,IAAWC,OAAQ,KAoEpCE,EAAe,CACnBC,MA5DcC,GACPR,EAAcO,MAAMC,GA4D3BC,IAhDYD,GACZ,MAAME,YAAEA,EAAFC,MAAeA,EAAfC,KAAsBA,EAAtBC,MAA4BA,GAAUL,GACtCM,QAAEA,GAAYH,EAEpB,IAAKE,EACH,OAGF,MAAME,EACJjB,EAAUkB,WAAWf,EAAmBa,EAAQG,IAAYP,EAAaF,EAAIU,UAAYhB,EACrFiB,EACJrB,EAAUkB,WAAWf,EAAmBa,EAAQM,IAAYV,EAAaF,EAAIU,UAAYb,EAE3FM,EAAMG,QAAU,CACdO,QAASP,EAAQO,QACjBC,MAAOzB,EAAO,GAAIG,EAAcuB,SAChCC,MAAO3B,EAAO,GAAIG,EAAcyB,UAG9BZ,EAAMa,KACRf,EAAMG,QAAQQ,MAAMI,IAAMd,EAAKe,OAASZ,EAAQX,OAChDO,EAAMG,QAAQU,MAAME,IAAMd,EAAKe,OAASR,EAAQf,QACvCS,EAAMc,SACfhB,EAAMG,QAAQQ,MAAMK,OAASf,EAAKc,IAAMX,EAAQX,OAChDO,EAAMG,QAAQU,MAAMG,OAASf,EAAKc,IAAMP,EAAQf,QAE9CS,EAAMe,MACRjB,EAAMG,QAAQQ,MAAMM,KAAOhB,EAAKiB,MAAQd,EAAQZ,MAChDQ,EAAMG,QAAQU,MAAMI,KAAOhB,EAAKiB,MAAQV,EAAQhB,OACvCU,EAAMgB,QACflB,EAAMG,QAAQQ,MAAMO,MAAQjB,EAAKgB,KAAOb,EAAQZ,MAChDQ,EAAMG,QAAQU,MAAMK,MAAQjB,EAAKgB,KAAOT,EAAQhB,OAGlDH,EAAcS,IAAID,GAElBG,EAAMG,QAAUA,GAahBgB,SAVoC,CACpCb,IAAK,KACLG,IAAK,KACLC,SAAS,EACTU,SAAS,mBASIhC,EAAaO,EAAc,uBACjCA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/rubberband/rubberband.d.ts b/packages/@interactjs/modifiers/rubberband/rubberband.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/rubberband/rubberband.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/rubberband/rubberband.js b/packages/@interactjs/modifiers/rubberband/rubberband.js new file mode 100644 index 000000000..aacc557fc --- /dev/null +++ b/packages/@interactjs/modifiers/rubberband/rubberband.js @@ -0,0 +1,2 @@ +export { default } from '../noop'; +//# sourceMappingURL=rubberband.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/rubberband/rubberband.js.map b/packages/@interactjs/modifiers/rubberband/rubberband.js.map new file mode 100644 index 000000000..d36d22c7c --- /dev/null +++ b/packages/@interactjs/modifiers/rubberband/rubberband.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "rubberband.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "AAAA,SAASA,OAAT,QAAwB,SAAxB" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/rubberband/rubberband.prod.js b/packages/@interactjs/modifiers/rubberband/rubberband.prod.js new file mode 100644 index 000000000..4eb374e55 --- /dev/null +++ b/packages/@interactjs/modifiers/rubberband/rubberband.prod.js @@ -0,0 +1,2 @@ +export{default}from"../noop"; +//# sourceMappingURL=rubberband.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/rubberband/rubberband.prod.js.map b/packages/@interactjs/modifiers/rubberband/rubberband.prod.js.map new file mode 100644 index 000000000..be847ba23 --- /dev/null +++ b/packages/@interactjs/modifiers/rubberband/rubberband.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "rubberband.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "OAASA,YAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/rubberband/rubberband.stub.d.ts b/packages/@interactjs/modifiers/rubberband/rubberband.stub.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/rubberband/rubberband.stub.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/snap/edges.d.ts b/packages/@interactjs/modifiers/snap/edges.d.ts new file mode 100644 index 000000000..817435f36 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/edges.d.ts @@ -0,0 +1,63 @@ +/** + * @module modifiers/snapEdges + * + * @description + * WOW> This module allows snapping of the edges of targets during resize + * interactions. + * + * ```js + * 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 type { ModifierArg, ModifierModule } from '../types'; +import type { SnapOptions, SnapState } from './pointer'; +import { snapSize } from './size'; +export declare type SnapEdgesOptions = Pick; +declare const snapEdges: ModifierModule>; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: SnapEdgesOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: ModifierArg) => void; + }; +}; +export default _default; +export { snapEdges }; diff --git a/packages/@interactjs/modifiers/snap/edges.js b/packages/@interactjs/modifiers/snap/edges.js new file mode 100644 index 000000000..15d75dc57 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/edges.js @@ -0,0 +1,61 @@ +/** + * @module modifiers/snapEdges + * + * @description + * WOW> This module allows snapping of the edges of targets during resize + * interactions. + * + * ```js + * 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 "../../utils/clone.js"; +import extend from "../../utils/extend.js"; +import { makeModifier } from '../base'; +import { snapSize } from './size'; + +function start(arg) { + 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 = { + start, + set: snapSize.set, + defaults: extend(clone(snapSize.defaults), { + targets: undefined, + range: undefined, + offset: { + x: 0, + y: 0 + } + }) +}; +export default makeModifier(snapEdges, 'snapEdges'); +export { snapEdges }; +//# sourceMappingURL=edges.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/edges.js.map b/packages/@interactjs/modifiers/snap/edges.js.map new file mode 100644 index 000000000..1854e7456 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/edges.js.map @@ -0,0 +1,32 @@ +{ + "version": 3, + "names": [ + "clone", + "extend", + "makeModifier", + "snapSize", + "start", + "arg", + "edges", + "state", + "targetFields", + "left", + "top", + "snapEdges", + "set", + "defaults", + "targets", + "undefined", + "range", + "offset", + "x", + "y" + ], + "sources": [ + "edges.ts" + ], + "sourcesContent": [ + "/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\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 */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule } from '../types'\n\nimport type { 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) {\n return null\n }\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(clone(snapSize.defaults), {\n targets: undefined,\n range: undefined,\n offset: { x: 0, y: 0 },\n } as const),\n}\n\nexport default makeModifier(snapEdges, 'snapEdges')\nexport { snapEdges }\n" + ], + "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,KAAP,MAAkB,sBAAlB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AAEA,SAASC,YAAT,QAA6B,SAA7B;AAIA,SAASC,QAAT,QAAyB,QAAzB;;AAIA,SAASC,KAAT,CAAgBC,GAAhB,EAA6C;EAC3C,MAAM;IAAEC;EAAF,IAAYD,GAAlB;;EAEA,IAAI,CAACC,KAAL,EAAY;IACV,OAAO,IAAP;EACD;;EAEDD,GAAG,CAACE,KAAJ,CAAUC,YAAV,GAAyBH,GAAG,CAACE,KAAJ,CAAUC,YAAV,IAA0B,CACjD,CAACF,KAAK,CAACG,IAAN,GAAa,MAAb,GAAsB,OAAvB,EAAgCH,KAAK,CAACI,GAAN,GAAY,KAAZ,GAAoB,QAApD,CADiD,CAAnD;EAIA,OAAOP,QAAQ,CAACC,KAAT,CAAeC,GAAf,CAAP;AACD;;AAED,MAAMM,SAAuF,GAAG;EAC9FP,KAD8F;EAE9FQ,GAAG,EAAET,QAAQ,CAACS,GAFgF;EAG9FC,QAAQ,EAAEZ,MAAM,CAACD,KAAK,CAACG,QAAQ,CAACU,QAAV,CAAN,EAA2B;IACzCC,OAAO,EAAEC,SADgC;IAEzCC,KAAK,EAAED,SAFkC;IAGzCE,MAAM,EAAE;MAAEC,CAAC,EAAE,CAAL;MAAQC,CAAC,EAAE;IAAX;EAHiC,CAA3B;AAH8E,CAAhG;AAUA,eAAejB,YAAY,CAACS,SAAD,EAAY,WAAZ,CAA3B;AACA,SAASA,SAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/edges.prod.js b/packages/@interactjs/modifiers/snap/edges.prod.js new file mode 100644 index 000000000..36276410a --- /dev/null +++ b/packages/@interactjs/modifiers/snap/edges.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/clone.prod.js";import e from"../../utils/extend.prod.js";import{makeModifier as s}from"../base";import{snapSize as o}from"./size";const r={start(t){const{edges:e}=t;return e?(t.state.targetFields=t.state.targetFields||[[e.left?"left":"right",e.top?"top":"bottom"]],o.start(t)):null},set:o.set,defaults:e(t(o.defaults),{targets:void 0,range:void 0,offset:{x:0,y:0}})};export default s(r,"snapEdges");export{r as snapEdges}; +//# sourceMappingURL=edges.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/edges.prod.js.map b/packages/@interactjs/modifiers/snap/edges.prod.js.map new file mode 100644 index 000000000..be405d459 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/edges.prod.js.map @@ -0,0 +1,32 @@ +{ + "version": 3, + "names": [ + "clone", + "extend", + "makeModifier", + "snapSize", + "snapEdges", + "start", + "arg", + "edges", + "state", + "targetFields", + "left", + "top", + "set", + "defaults", + "targets", + "undefined", + "range", + "offset", + "x", + "y" + ], + "sources": [ + "edges.ts" + ], + "sourcesContent": [ + "/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\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 */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule } from '../types'\n\nimport type { 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) {\n return null\n }\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(clone(snapSize.defaults), {\n targets: undefined,\n range: undefined,\n offset: { x: 0, y: 0 },\n } as const),\n}\n\nexport default makeModifier(snapEdges, 'snapEdges')\nexport { snapEdges }\n" + ], + "mappings": "OA6BOA,MAAW,mCACXC,MAAY,oDAEVC,MAAoB,6BAIpBC,MAAgB,SAkBzB,MAAMC,EAA0F,CAC9FC,MAfcC,GACd,MAAMC,MAAEA,GAAUD,EAElB,OAAKC,GAILD,EAAIE,MAAMC,aAAeH,EAAIE,MAAMC,cAAgB,CACjD,CAACF,EAAMG,KAAO,OAAS,QAASH,EAAMI,IAAM,MAAQ,WAG/CR,EAASE,MAAMC,IAPb,MAYTM,IAAKT,EAASS,IACdC,SAAUZ,EAAOD,EAAMG,EAASU,UAAW,CACzCC,aAASC,EACTC,WAAOD,EACPE,OAAQ,CAAEC,EAAG,EAAGC,EAAG,qBAIRjB,EAAaE,EAAW,oBAC9BA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/pointer.d.ts b/packages/@interactjs/modifiers/snap/pointer.d.ts new file mode 100644 index 000000000..677f35826 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/pointer.d.ts @@ -0,0 +1,79 @@ +import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'; +import type { ActionName, Point, RectResolvable, Element } from '@interactjs/core/types'; +import type { ModifierArg, ModifierState } from '../types'; +export interface Offset { + x: number; + y: number; + index: number; + relativePoint?: Point | null; +} +export interface SnapPosition { + x?: number; + y?: number; + range?: number; + offset?: Offset; + [index: string]: any; +} +export declare type SnapFunction = (x: number, y: number, interaction: InteractionProxy, offset: Offset, index: number) => SnapPosition; +export declare type SnapTarget = SnapPosition | SnapFunction; +export interface SnapOptions { + targets?: SnapTarget[]; + range?: number; + relativePoints?: Point[]; + offset?: Point | RectResolvable<[Interaction]> | 'startCoords'; + offsetWithOrigin?: boolean; + origin?: RectResolvable<[Element]> | Point; + endOnly?: boolean; + enabled?: boolean; +} +export declare type SnapState = ModifierState; +declare function start(arg: ModifierArg): void; +declare function set(arg: ModifierArg): { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; +}; +declare const snap: { + start: typeof start; + set: typeof set; + defaults: SnapOptions; +}; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: SnapOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; +}; +export default _default; +export { snap }; diff --git a/packages/@interactjs/modifiers/snap/pointer.js b/packages/@interactjs/modifiers/snap/pointer.js new file mode 100644 index 000000000..787e7fa32 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/pointer.js @@ -0,0 +1,178 @@ +import extend from "../../utils/extend.js"; +import getOriginXY from "../../utils/getOriginXY.js"; +import hypot from "../../utils/hypot.js"; +import is from "../../utils/is.js"; +import { resolveRectLike, rectToXY } from "../../utils/rect.js"; +import { makeModifier } from '../base'; + +function start(arg) { + const { + interaction, + interactable, + element, + rect, + state, + startOffset + } = arg; + const { + options + } = state; + const origin = options.offsetWithOrigin ? getOrigin(arg) : { + x: 0, + y: 0 + }; + let snapOffset; + + if (options.offset === 'startCoords') { + snapOffset = { + x: interaction.coords.start.page.x, + y: interaction.coords.start.page.y + }; + } else { + const offsetRect = resolveRectLike(options.offset, interactable, element, [interaction]); + snapOffset = rectToXY(offsetRect) || { + x: 0, + y: 0 + }; + snapOffset.x += origin.x; + snapOffset.y += origin.y; + } + + const { + relativePoints + } = options; + state.offsets = rect && relativePoints && relativePoints.length ? relativePoints.map((relativePoint, index) => ({ + index, + relativePoint, + x: startOffset.left - rect.width * relativePoint.x + snapOffset.x, + y: startOffset.top - rect.height * relativePoint.y + snapOffset.y + })) : [{ + index: 0, + relativePoint: null, + x: snapOffset.x, + y: snapOffset.y + }]; +} + +function set(arg) { + const { + interaction, + coords, + state + } = arg; + const { + options, + offsets + } = state; + const origin = getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name); + const page = extend({}, coords); + const targets = []; + + if (!options.offsetWithOrigin) { + page.x -= origin.x; + page.y -= origin.y; + } + + for (const offset of offsets) { + const relativeX = page.x - offset.x; + const relativeY = page.y - offset.y; + + for (let index = 0, len = options.targets.length; index < len; index++) { + const snapTarget = options.targets[index]; + let target; + + if (is.func(snapTarget)) { + target = snapTarget(relativeX, relativeY, interaction._proxy, offset, index); + } else { + target = snapTarget; + } + + if (!target) { + continue; + } + + targets.push({ + x: (is.number(target.x) ? target.x : relativeX) + offset.x, + y: (is.number(target.y) ? target.y : relativeY) + offset.y, + range: is.number(target.range) ? target.range : options.range, + source: snapTarget, + index, + offset + }); + } + } + + const closest = { + target: null, + inRange: false, + distance: 0, + range: 0, + delta: { + x: 0, + y: 0 + } + }; + + for (const target of targets) { + const range = target.range; + const dx = target.x - page.x; + const dy = target.y - page.y; + const distance = hypot(dx, dy); + let 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) { + const { + element + } = arg.interaction; + const optionsOrigin = rectToXY(resolveRectLike(arg.state.options.origin, null, null, [element])); + const origin = optionsOrigin || getOriginXY(arg.interactable, element, arg.interaction.prepared.name); + return origin; +} + +const defaults = { + range: Infinity, + targets: null, + offset: null, + offsetWithOrigin: true, + origin: null, + relativePoints: null, + endOnly: false, + enabled: false +}; +const snap = { + start, + set, + defaults +}; +export default makeModifier(snap, 'snap'); +export { snap }; +//# sourceMappingURL=pointer.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/pointer.js.map b/packages/@interactjs/modifiers/snap/pointer.js.map new file mode 100644 index 000000000..d328df2de --- /dev/null +++ b/packages/@interactjs/modifiers/snap/pointer.js.map @@ -0,0 +1,75 @@ +{ + "version": 3, + "names": [ + "extend", + "getOriginXY", + "hypot", + "is", + "resolveRectLike", + "rectToXY", + "makeModifier", + "start", + "arg", + "interaction", + "interactable", + "element", + "rect", + "state", + "startOffset", + "options", + "origin", + "offsetWithOrigin", + "getOrigin", + "x", + "y", + "snapOffset", + "offset", + "coords", + "page", + "offsetRect", + "relativePoints", + "offsets", + "length", + "map", + "relativePoint", + "index", + "left", + "width", + "top", + "height", + "set", + "prepared", + "name", + "targets", + "relativeX", + "relativeY", + "len", + "snapTarget", + "target", + "func", + "_proxy", + "push", + "number", + "range", + "source", + "closest", + "inRange", + "distance", + "delta", + "dx", + "dy", + "Infinity", + "optionsOrigin", + "defaults", + "endOnly", + "enabled", + "snap" + ], + "sources": [ + "pointer.ts" + ], + "sourcesContent": [ + "import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName, Point, RectResolvable, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { resolveRectLike, rectToXY } from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nexport interface Offset {\n x: number\n y: number\n index: number\n relativePoint?: Point | null\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: InteractionProxy,\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?: Point[]\n // startCoords = offset snapping from drag start page position\n offset?: Point | RectResolvable<[Interaction]> | 'startCoords'\n offsetWithOrigin?: boolean\n origin?: RectResolvable<[Element]> | Point\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState<\nSnapOptions,\n{\n offsets?: Offset[]\n closest?: any\n targetFields?: string[][]\n}\n>\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }\n\n let snapOffset: 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 } else {\n const offsetRect = resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = 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 =\n 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 : [\n {\n index: 0,\n relativePoint: null,\n x: snapOffset.x,\n y: snapOffset.y,\n },\n ]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = getOriginXY(interaction.interactable!, interaction.element!, interaction.prepared.name)\n const page = extend({}, coords)\n const targets: SnapPosition[] = []\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: SnapPosition\n\n if (is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction._proxy, offset, index)\n } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\n\n targets.push({\n x: (is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: 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 = 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 (\n !closest.target ||\n (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 ) {\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 = rectToXY(resolveRectLike(arg.state.options.origin as any, null, null, [element]))\n const origin = optionsOrigin || getOriginXY(arg.interactable, element, arg.interaction.prepared.name)\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 makeModifier(snap, 'snap')\nexport { snap }\n" + ], + "mappings": "AAEA,OAAOA,MAAP,MAAmB,uBAAnB;AACA,OAAOC,WAAP,MAAwB,4BAAxB;AACA,OAAOC,KAAP,MAAkB,sBAAlB;AACA,OAAOC,EAAP,MAAe,mBAAf;AACA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,qBAA1C;AAEA,SAASC,YAAT,QAA6B,SAA7B;;AAiDA,SAASC,KAAT,CAAgBC,GAAhB,EAA6C;EAC3C,MAAM;IAAEC,WAAF;IAAeC,YAAf;IAA6BC,OAA7B;IAAsCC,IAAtC;IAA4CC,KAA5C;IAAmDC;EAAnD,IAAmEN,GAAzE;EACA,MAAM;IAAEO;EAAF,IAAcF,KAApB;EACA,MAAMG,MAAM,GAAGD,OAAO,CAACE,gBAAR,GAA2BC,SAAS,CAACV,GAAD,CAApC,GAA4C;IAAEW,CAAC,EAAE,CAAL;IAAQC,CAAC,EAAE;EAAX,CAA3D;EAEA,IAAIC,UAAJ;;EAEA,IAAIN,OAAO,CAACO,MAAR,KAAmB,aAAvB,EAAsC;IACpCD,UAAU,GAAG;MACXF,CAAC,EAAEV,WAAW,CAACc,MAAZ,CAAmBhB,KAAnB,CAAyBiB,IAAzB,CAA8BL,CADtB;MAEXC,CAAC,EAAEX,WAAW,CAACc,MAAZ,CAAmBhB,KAAnB,CAAyBiB,IAAzB,CAA8BJ;IAFtB,CAAb;EAID,CALD,MAKO;IACL,MAAMK,UAAU,GAAGrB,eAAe,CAACW,OAAO,CAACO,MAAT,EAAwBZ,YAAxB,EAAsCC,OAAtC,EAA+C,CAACF,WAAD,CAA/C,CAAlC;IAEAY,UAAU,GAAGhB,QAAQ,CAACoB,UAAD,CAAR,IAAwB;MAAEN,CAAC,EAA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AAE;AARmB,CAA9B;AAUA,MAAMC,IAAI,GAAG;EACXvD,KADW;EAEX6B,GAFW;EAGXuB;AAHW,CAAb;AAMA,eAAerD,YAAY,CAACwD,IAAD,EAAO,MAAP,CAA3B;AACA,SAASA,IAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/pointer.prod.js b/packages/@interactjs/modifiers/snap/pointer.prod.js new file mode 100644 index 000000000..7e82690ad --- /dev/null +++ b/packages/@interactjs/modifiers/snap/pointer.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/extend.prod.js";import e from"../../utils/getOriginXY.prod.js";import n from"../../utils/hypot.prod.js";import r from"../../utils/is.prod.js";import{resolveRectLike as o,rectToXY as s}from"../../utils/rect.prod.js";import{makeModifier as a}from"../base";const i={start(t){const{interaction:n,interactable:r,element:a,rect:i,state:l,startOffset:g}=t,{options:f}=l,c=f.offsetWithOrigin?(t=>{const{element:n}=t.interaction;return s(o(t.state.options.origin,null,null,[n]))||e(t.interactable,n,t.interaction.prepared.name)})(t):{x:0,y:0};let x;if("startCoords"===f.offset)x={x:n.coords.start.page.x,y:n.coords.start.page.y};else{const t=o(f.offset,r,a,[n]);x=s(t)||{x:0,y:0},x.x+=c.x,x.y+=c.y}const{relativePoints:d}=f;l.offsets=i&&d&&d.length?d.map(((t,e)=>({index:e,relativePoint:t,x:g.left-i.width*t.x+x.x,y:g.top-i.height*t.y+x.y}))):[{index:0,relativePoint:null,x:x.x,y:x.y}]},set(o){const{interaction:s,coords:a,state:i}=o,{options:l,offsets:g}=i,f=e(s.interactable,s.element,s.prepared.name),c=t({},a),x=[];l.offsetWithOrigin||(c.x-=f.x,c.y-=f.y);for(const t of g){const e=c.x-t.x,n=c.y-t.y;for(let o=0,a=l.targets.length;o,\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?: Point[]\n // startCoords = offset snapping from drag start page position\n offset?: Point | RectResolvable<[Interaction]> | 'startCoords'\n offsetWithOrigin?: boolean\n origin?: RectResolvable<[Element]> | Point\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState<\nSnapOptions,\n{\n offsets?: Offset[]\n closest?: any\n targetFields?: string[][]\n}\n>\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }\n\n let snapOffset: 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 } else {\n const offsetRect = resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = 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 =\n 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 : [\n {\n index: 0,\n relativePoint: null,\n x: snapOffset.x,\n y: snapOffset.y,\n },\n ]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = getOriginXY(interaction.interactable!, interaction.element!, interaction.prepared.name)\n const page = extend({}, coords)\n const targets: SnapPosition[] = []\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: SnapPosition\n\n if (is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction._proxy, offset, index)\n } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\n\n targets.push({\n x: (is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: 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 = 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 (\n !closest.target ||\n (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 ) {\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 = rectToXY(resolveRectLike(arg.state.options.origin as any, null, null, [element]))\n const origin = optionsOrigin || getOriginXY(arg.interactable, element, arg.interaction.prepared.name)\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 makeModifier(snap, 'snap')\nexport { snap }\n" + ], + "mappings": "OAEOA,MAAY,oCACZC,MAAiB,yCACjBC,MAAW,mCACXC,MAAQ,mDACNC,cAAiBC,MAAgB,kDAEjCC,M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IAE3BJ,EAAWJ,EAAQE,EAAQE,SAAWF,EAAQF,MAE7CA,IAAUQ,KAAYN,EAAQF,QAAUQ,KAEvCJ,EAAWF,EAAQE,UAEtBF,EAAQC,SAAWC,EAAWF,EAAQE,YAEzCF,EAAQP,OAASA,EACjBO,EAAQE,SAAWA,EACnBF,EAAQF,MAAQA,EAChBE,EAAQC,QAAUA,EAClBD,EAAQG,MAAMjC,EAAIkC,EAClBJ,EAAQG,MAAMhC,EAAIkC,GAUtB,OANIL,EAAQC,UACV3B,EAAOJ,EAAI8B,EAAQP,OAAOvB,EAC1BI,EAAOH,EAAI6B,EAAQP,OAAOtB,GAG5BT,EAAMsC,QAAUA,EACTA,GAwBPO,SAb4B,CAC5BT,MAAOQ,IACPlB,QAAS,KACTf,OAAQ,KACRP,kBAAkB,EAClBD,OAAQ,KACRY,eAAgB,KAChB+B,SAAS,EACTC,SAAS,mBAQIvD,EAAaC,EAAM,eACzBA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/size.d.ts b/packages/@interactjs/modifiers/snap/size.d.ts new file mode 100644 index 000000000..fb094b010 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/size.d.ts @@ -0,0 +1,49 @@ +import type { ModifierArg } from '../types'; +import type { SnapOptions, SnapState } from './pointer'; +export declare type SnapSizeOptions = Pick; +declare function start(arg: ModifierArg): any; +declare function set(arg: any): { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; +}; +declare const snapSize: { + start: typeof start; + set: typeof set; + defaults: SnapSizeOptions; +}; +declare const _default: { + (_options?: Partial): import("../types").Modifier; + _defaults: SnapSizeOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: ModifierArg) => void | import("@interactjs/core/types").Point; + stop: (arg: ModifierArg) => void; + }; +}; +export default _default; +export { snapSize }; diff --git a/packages/@interactjs/modifiers/snap/size.js b/packages/@interactjs/modifiers/snap/size.js new file mode 100644 index 000000000..3a79b5bd2 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/size.js @@ -0,0 +1,102 @@ +// This module allows snapping of the size of targets during resize +// interactions. +import extend from "../../utils/extend.js"; +import is from "../../utils/is.js"; +import { makeModifier } from '../base'; +import { snap } from './pointer'; + +function start(arg) { + const { + state, + edges + } = arg; + const { + options + } = state; + + 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']]; + snap.start(arg); + state.offsets = arg.state.offsets; + arg.state = state; +} + +function set(arg) { + const { + interaction, + state, + coords + } = arg; + const { + options, + offsets + } = state; + const relative = { + x: coords.x - offsets[0].x, + y: coords.y - offsets[0].y + }; + state.options = extend({}, options); + state.options.targets = []; + + for (const snapTarget of options.targets || []) { + let target; + + if (is.func(snapTarget)) { + target = snapTarget(relative.x, relative.y, interaction); + } else { + target = snapTarget; + } + + if (!target) { + continue; + } + + for (const [xField, yField] of state.targetFields) { + if (xField in target || yField in target) { + target.x = target[xField]; + target.y = target[yField]; + break; + } + } + + state.options.targets.push(target); + } + + const returnValue = snap.set(arg); + state.options = options; + return returnValue; +} + +const defaults = { + range: Infinity, + targets: null, + offset: null, + endOnly: false, + enabled: false +}; +const snapSize = { + start, + set, + defaults +}; +export default makeModifier(snapSize, 'snapSize'); +export { snapSize }; +//# sourceMappingURL=size.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/size.js.map b/packages/@interactjs/modifiers/snap/size.js.map new file mode 100644 index 000000000..2baa12ae1 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/size.js.map @@ -0,0 +1,48 @@ +{ + "version": 3, + "names": [ + "extend", + "is", + "makeModifier", + "snap", + "start", + "arg", + "state", + "edges", + "options", + "targets", + "relativePoints", + "x", + "left", + "y", + "top", + "offset", + "origin", + "range", + "targetFields", + "offsets", + "set", + "interaction", + "coords", + "relative", + "snapTarget", + "target", + "func", + "xField", + "yField", + "push", + "returnValue", + "defaults", + "Infinity", + "endOnly", + "enabled", + "snapSize" + ], + "sources": [ + "size.ts" + ], + "sourcesContent": [ + "// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg } from '../types'\n\nimport type { SnapOptions, SnapState } from './pointer'\nimport { snap } from './pointer'\n\nexport type SnapSizeOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) {\n return null\n }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [\n {\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n },\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 } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\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,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G;EAChCd,KAAK,EAAEe,QADyB;EAEhCvB,OAAO,EAAE,IAFuB;EAGhCM,MAAM,EAAE,IAHwB;EAIhCkB,OAAO,EAAE,KAJuB;EAKhCC,OAAO,EAAE;AALuB,CAAlC;AAQA,MAAMC,QAAQ,GAAG;EACf/B,KADe;EAEfgB,GAFe;EAGfW;AAHe,CAAjB;AAMA,eAAe7B,YAAY,CAACiC,QAAD,EAAW,UAAX,CAA3B;AACA,SAASA,QAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/size.prod.js b/packages/@interactjs/modifiers/snap/size.prod.js new file mode 100644 index 000000000..902b7c920 --- /dev/null +++ b/packages/@interactjs/modifiers/snap/size.prod.js @@ -0,0 +1,2 @@ +import t from"../../utils/extend.prod.js";import s from"../../utils/is.prod.js";import{makeModifier as e}from"../base";import{snap as o}from"./pointer";const r={start(t){const{state:s,edges:e}=t,{options:r}=s;if(!e)return null;t.state={options:{targets:null,relativePoints:[{x:e.left?0:1,y:e.top?0:1}],offset:r.offset||"self",origin:{x:0,y:0},range:r.range}},s.targetFields=s.targetFields||[["width","height"],["x","y"]],o.start(t),s.offsets=t.state.offsets,t.state=s},set(e){const{interaction:r,state:n,coords:i}=e,{options:f,offsets:a}=n,l={x:i.x-a[0].x,y:i.y-a[0].y};n.options=t({},f),n.options.targets=[];for(const t of f.targets||[]){let e;if(e=s.func(t)?t(l.x,l.y,r):t,e){for(const[t,s]of n.targetFields)if(t in e||s in e){e.x=e[t],e.y=e[s];break}n.options.targets.push(e)}}const p=o.set(e);return n.options=f,p},defaults:{range:1/0,targets:null,offset:null,endOnly:!1,enabled:!1}};export default e(r,"snapSize");export{r as snapSize}; +//# sourceMappingURL=size.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/snap/size.prod.js.map b/packages/@interactjs/modifiers/snap/size.prod.js.map new file mode 100644 index 000000000..ce6f7b1ac --- /dev/null +++ b/packages/@interactjs/modifiers/snap/size.prod.js.map @@ -0,0 +1,48 @@ +{ + "version": 3, + "names": [ + "extend", + "is", + "makeModifier", + "snap", + "snapSize", + "start", + "arg", + "state", + "edges", + "options", + "targets", + "relativePoints", + "x", + "left", + "y", + "top", + "offset", + "origin", + "range", + "targetFields", + "offsets", + "set", + "interaction", + "coords", + "relative", + "snapTarget", + "target", + "func", + "xField", + "yField", + "push", + "returnValue", + "defaults", + "Infinity", + "endOnly", + "enabled" + ], + "sources": [ + "size.ts" + ], + "sourcesContent": [ + "// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg } from '../types'\n\nimport type { SnapOptions, SnapState } from './pointer'\nimport { snap } from './pointer'\n\nexport type SnapSizeOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) {\n return null\n }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [\n {\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n },\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 } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\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 makeModifier(snapSize, 'snapSize')\nexport { snapSize }\n" + ], + "mappings": "OAGOA,MAAY,oCACZC,MAAQ,gDAENC,MAAoB,yBAIpBC,MAAY,YAiFrB,MAQMC,EAAW,CACfC,MAtFcC,GACd,MAAMC,MAAEA,EAAFC,MAASA,GAAUF,GACnBG,QAAEA,GAAYF,EAEpB,IAAKC,EACH,OAAO,KAGTF,EAAIC,MAAQ,CACVE,QAAS,CACPC,QAAS,KACTC,eAAgB,CACd,CACEC,EAAGJ,EAAMK,KAAO,EAAI,EACpBC,EAAGN,EAAMO,IAAM,EAAI,IAGvBC,OAAQP,EAAQO,QAAU,OAC1BC,OAAQ,CAAEL,EAAG,EAAGE,EAAG,GACnBI,MAAOT,EAAQS,QAInBX,EAAMY,aAAeZ,EAAMY,cAAgB,CACzC,CAAC,QAAS,UACV,CAAC,IAAK,MAGRhB,EAAKE,MAAMC,GACXC,EAAMa,QAAUd,EAAIC,MAAMa,QAE1Bd,EAAIC,MAAQA,GAwDZc,IArDYf,GACZ,MAAMgB,YAAEA,EAAFf,MAAeA,EAAfgB,OAAsBA,GAAWjB,GACjCG,QAAEA,EAAFW,QAAWA,GAAYb,EACvBiB,EAAW,CACfZ,EAAGW,EAAOX,EAAIQ,EAAQ,GAAGR,EACzBE,EAAGS,EAAOT,EAAIM,EAAQ,GAAGN,GAG3BP,EAAME,QAAUT,EAAO,GAAIS,GAC3BF,EAAME,QAAQC,QAAU,GAExB,IAAK,MAAMe,KAAchB,EAAQC,SAAW,GAAI,CAC9C,IAAIgB,EAQJ,GALEA,EADEzB,EAAG0B,KAAKF,GACDA,EAAWD,EAASZ,EAAGY,EAASV,EAAGQ,GAEnCG,EAGNC,EAAL,CAIA,IAAK,MAAOE,EAAQC,KAAWtB,EAAMY,aACnC,GAAIS,KAAUF,GAAUG,KAAUH,EAAQ,CACxCA,EAAOd,EAAIc,EAAOE,GAClBF,EAAOZ,EAAIY,EAAOG,GAElB,MAIJtB,EAAME,QAAQC,QAAQoB,KAAKJ,IAG7B,MAAMK,EAAc5B,EAAKkB,IAAIf,GAI7B,OAFAC,EAAME,QAAUA,EAETsB,GAcPC,SAXgC,CAChCd,MAAOe,IACPvB,QAAS,KACTM,OAAQ,KACRkB,SAAS,EACTC,SAAS,mBASIjC,EAAaE,EAAU,mBAC7BA" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/spring/spring.d.ts b/packages/@interactjs/modifiers/spring/spring.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/spring/spring.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/spring/spring.js b/packages/@interactjs/modifiers/spring/spring.js new file mode 100644 index 000000000..9bd62f9b2 --- /dev/null +++ b/packages/@interactjs/modifiers/spring/spring.js @@ -0,0 +1,2 @@ +export { default } from '../noop'; +//# sourceMappingURL=spring.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/spring/spring.js.map b/packages/@interactjs/modifiers/spring/spring.js.map new file mode 100644 index 000000000..f76c6570e --- /dev/null +++ b/packages/@interactjs/modifiers/spring/spring.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "spring.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "AAAA,SAASA,OAAT,QAAwB,SAAxB" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/spring/spring.prod.js b/packages/@interactjs/modifiers/spring/spring.prod.js new file mode 100644 index 000000000..172ca27e1 --- /dev/null +++ b/packages/@interactjs/modifiers/spring/spring.prod.js @@ -0,0 +1,2 @@ +export{default}from"../noop"; +//# sourceMappingURL=spring.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/spring/spring.prod.js.map b/packages/@interactjs/modifiers/spring/spring.prod.js.map new file mode 100644 index 000000000..5946e8f82 --- /dev/null +++ b/packages/@interactjs/modifiers/spring/spring.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "spring.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "OAASA,YAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/spring/spring.stub.d.ts b/packages/@interactjs/modifiers/spring/spring.stub.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/spring/spring.stub.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/transform/transform.d.ts b/packages/@interactjs/modifiers/transform/transform.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/transform/transform.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/transform/transform.js b/packages/@interactjs/modifiers/transform/transform.js new file mode 100644 index 000000000..34284a183 --- /dev/null +++ b/packages/@interactjs/modifiers/transform/transform.js @@ -0,0 +1,2 @@ +export { default } from '../noop'; +//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/transform/transform.js.map b/packages/@interactjs/modifiers/transform/transform.js.map new file mode 100644 index 000000000..4448233a3 --- /dev/null +++ b/packages/@interactjs/modifiers/transform/transform.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "transform.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "AAAA,SAASA,OAAT,QAAwB,SAAxB" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/transform/transform.prod.js b/packages/@interactjs/modifiers/transform/transform.prod.js new file mode 100644 index 000000000..d3bfac319 --- /dev/null +++ b/packages/@interactjs/modifiers/transform/transform.prod.js @@ -0,0 +1,2 @@ +export{default}from"../noop"; +//# sourceMappingURL=transform.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/transform/transform.prod.js.map b/packages/@interactjs/modifiers/transform/transform.prod.js.map new file mode 100644 index 000000000..8dc9560a1 --- /dev/null +++ b/packages/@interactjs/modifiers/transform/transform.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "transform.ts" + ], + "sourcesContent": [ + "export { default } from '../noop'\n" + ], + "mappings": "OAASA,YAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/transform/transform.stub.d.ts b/packages/@interactjs/modifiers/transform/transform.stub.d.ts new file mode 100644 index 000000000..891687912 --- /dev/null +++ b/packages/@interactjs/modifiers/transform/transform.stub.d.ts @@ -0,0 +1 @@ +export { default } from '../noop'; diff --git a/packages/@interactjs/modifiers/types.d.ts b/packages/@interactjs/modifiers/types.d.ts new file mode 100644 index 000000000..e23913dd7 --- /dev/null +++ b/packages/@interactjs/modifiers/types.d.ts @@ -0,0 +1,53 @@ +import type { EventPhase } from '@interactjs/core/InteractEvent'; +import type { Interactable } from '@interactjs/core/Interactable'; +import type Interaction from '@interactjs/core/Interaction'; +import type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'; +export interface Modifier { + options: Defaults; + methods: { + start?: (arg: ModifierArg) => void; + set?: (arg: ModifierArg) => Result; + beforeEnd?: (arg: ModifierArg) => Point | void; + stop?: (arg: ModifierArg) => void; + }; + name?: Name; + enable: () => Modifier; + disable: () => Modifier; +} +export declare type ModifierState = { + options: Defaults; + methods?: Modifier['methods']; + index?: number; + name?: Name; +} & StateProps; +export interface ModifierArg { + interaction: Interaction; + interactable: Interactable; + phase: EventPhase; + rect: FullRect; + edges: EdgeOptions; + state: State; + element: Element; + pageCoords: Point; + prevCoords: Point; + prevRect?: FullRect; + coords: Point; + startOffset: Rect; + preEnd?: boolean; +} +export interface ModifierModule { + defaults?: Defaults; + start?(arg: ModifierArg): void; + set?(arg: ModifierArg): Result; + beforeEnd?(arg: ModifierArg): Point | void; + stop?(arg: ModifierArg): void; +} +export interface ModifierFunction { + (_options?: Partial): Modifier; + _defaults: Defaults; + _methods: ModifierModule; +} diff --git a/packages/@interactjs/modifiers/types.js b/packages/@interactjs/modifiers/types.js new file mode 100644 index 000000000..718fd38ae --- /dev/null +++ b/packages/@interactjs/modifiers/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/types.js.map b/packages/@interactjs/modifiers/types.js.map new file mode 100644 index 000000000..d229d8b69 --- /dev/null +++ b/packages/@interactjs/modifiers/types.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "types.ts" + ], + "sourcesContent": [ + "import type { EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\n\nexport interface Modifier<\n Defaults = any,\n State extends ModifierState = any,\n Name extends string = any,\n Result = any,\n> {\n options: Defaults\n methods: {\n start?: (arg: ModifierArg) => void\n set?: (arg: ModifierArg) => Result\n beforeEnd?: (arg: ModifierArg) => Point | void\n stop?: (arg: ModifierArg) => void\n }\n name?: Name\n enable: () => Modifier\n disable: () => Modifier\n}\n\nexport type ModifierState = {\n options: Defaults\n methods?: Modifier['methods']\n index?: number\n name?: Name\n} & StateProps\n\nexport interface ModifierArg {\n interaction: Interaction\n interactable: Interactable\n phase: EventPhase\n rect: FullRect\n edges: EdgeOptions\n state: State\n element: Element\n pageCoords: Point\n prevCoords: Point\n prevRect?: FullRect\n coords: Point\n startOffset: Rect\n preEnd?: boolean\n}\n\nexport interface ModifierModule<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Result = unknown,\n> {\n defaults?: Defaults\n start?(arg: ModifierArg): void\n set?(arg: ModifierArg): Result\n beforeEnd?(arg: ModifierArg): Point | void\n stop?(arg: ModifierArg): void\n}\n\nexport interface ModifierFunction<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n> {\n (_options?: Partial): Modifier\n _defaults: Defaults\n _methods: ModifierModule\n}\n" + ], + "mappings": "" +} \ No newline at end of file diff --git a/packages/@interactjs/modifiers/types.prod.js b/packages/@interactjs/modifiers/types.prod.js new file mode 100644 index 000000000..33692d986 --- /dev/null +++ b/packages/@interactjs/modifiers/types.prod.js @@ -0,0 +1,2 @@ +export{}; +//# sourceMappingURL=types.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/modifiers/types.prod.js.map b/packages/@interactjs/modifiers/types.prod.js.map new file mode 100644 index 000000000..32e471b75 --- /dev/null +++ b/packages/@interactjs/modifiers/types.prod.js.map @@ -0,0 +1,6 @@ +{ + "version": 3, + "names": [], + "sources": [], + "mappings": "" +} \ No newline at end of file diff --git a/packages/@interactjs/offset/.npmignore b/packages/@interactjs/offset/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/offset/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/offset/LICENSE b/packages/@interactjs/offset/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/offset/plugin.d.ts b/packages/@interactjs/offset/plugin.d.ts new file mode 100644 index 000000000..322c3f4e7 --- /dev/null +++ b/packages/@interactjs/offset/plugin.d.ts @@ -0,0 +1,20 @@ +import type Interaction from '@interactjs/core/Interaction'; +import type { Plugin } from '@interactjs/core/scope'; +import type { Point } from '@interactjs/core/types'; +declare module '@interactjs/core/Interaction' { + interface Interaction { + offsetBy?: typeof offsetBy; + offset: { + total: Point; + pending: Point; + }; + } + enum _ProxyMethods { + offsetBy = "" + } +} +export declare function addTotal(interaction: Interaction): void; +export declare function applyPending(interaction: Interaction): boolean; +declare function offsetBy(this: Interaction, { x, y }: Point): void; +declare const offset: Plugin; +export default offset; diff --git a/packages/@interactjs/offset/plugin.js b/packages/@interactjs/offset/plugin.js new file mode 100644 index 000000000..221fe509d --- /dev/null +++ b/packages/@interactjs/offset/plugin.js @@ -0,0 +1,118 @@ +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', + before: ['modifiers', 'pointer-events', 'actions', 'inertia'], + + 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=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/offset/plugin.js.map b/packages/@interactjs/offset/plugin.js.map new file mode 100644 index 000000000..9ec9a32c9 --- /dev/null +++ b/packages/@interactjs/offset/plugin.js.map @@ -0,0 +1,46 @@ +{ + "version": 3, + "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", + "before", + "install", + "scope", + "Interaction", + "prototype", + "listeners" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport { _ProxyMethods } from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\nimport type { Point } from '@interactjs/core/types'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Point\n pending: Point\n }\n }\n\n enum _ProxyMethods {\n offsetBy = '',\n }\n}\n\n;(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interaction) {\n if (!interaction.pointerIsDown) {\n return\n }\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: Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: 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: 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: 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: Interaction, { x, y }: 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 }: Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction: Interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Plugin = {\n id: 'offset',\n before: ['modifiers', 'pointer-events', 'actions', 'inertia'],\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" + ], + "mappings": "AACA,SAASA,aAAT,QAA8B,wBAA9B;AAGA,OAAO,KAAKC,SAAZ,MAA2B,kBAA3B;AAgBA;AAAED,aAAD,CAAuBE,QAAvB,GAAkC,EAAlC;AAED,OAAO,SAASC,QAAT,CAAmBC,WAAnB,EAA6C;EAClD,IAAI,CAACA,WAAW,CAACC,aAAjB,EAAgC;IAC9B;EACD;;EAEDC,WAAW,CAACF,WAAW,CAACG,MAAZ,CAAmBC,GAApB,EAAyBJ,WAAW,CAACK,MAAZ,CAAmBC,KAA5C,CAAX;EAEAN,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BC,CAA3B,GAA+B,CAA/B;EACAR,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BE,CAA3B,GAA+B,CAA/B;AACD;;AAED,SAASC,YAAT,CAAuB;EAAEV;AAAF,CAAvB,EAAsE;EACpEW,YAAY,CAACX,WAAD,CAAZ;AACD;;AAED,SAASY,SAAT,CAAoB;EAAEZ;AAAF,CAApB,EAAmF;EACjF,MAAMa,UAAU,GAAGF,YAAY,CAACX,WAAD,CAA/B;EAEA,IAAI,CAACa,UAAL,EAAiB;EAEjBb,WAAW,CAACc,IAAZ,CAAiB;IAAET,MAAM,EAAE;EAAV,CAAjB;EACAL,WAAW,CAACe,GAAZ;EAEA,OAAO,KAAP;AACD;;AAED,SAASA,GAAT,CAAc;EAAEf;AAAF,CAAd,EAA6D;EAC3DA,WAAW,CAACK,MAAZ,CAAmBC,KAAnB,CAAyBE,CAAzB,GAA6B,CAA7B;EACAR,WAAW,CAACK,MAAZ,CAAmBC,KAAnB,CAAyBG,CAAzB,GAA6B,CAA7B;EACAT,WAAW,CAACK,MAAZ,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;AACD;;AAED,SAASO,UAAT,CAAqBhB,WAArB,EAA+C;EAC7C,OAAO,CAAC,EAAEA,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BC,CAA3B,IAAgCR,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BE,CAA7D,CAAR;AACD;;AAED,MAAMJ,MAAc,GAAG;EACrBkB,EAAE,EAAE,QADiB;EAErBC,MAAM,EAAE,CAAC,WAAD,EAAc,gBAAd,EAAgC,SAAhC,EAA2C,SAA3C,CAFa;;EAGrBC,OAAO,CAAEC,KAAF,EAAS;IACdA,KAAK,CAACC,WAAN,CAAkBC,SAAlB,CAA4B9B,QAA5B,GAAuCA,QAAvC;EACD,CALoB;;EAMrB+B,SAAS,EAAE;IACT,oBAAoB,CAAC;MAAE7B;IAAF,CAAD,KAAqB;MACvCA,WAAW,CAACK,MAAZ,GAAqB;QACnBC,KAAK,EAAE;UAAEE,CAAC,EAAE,CAAL;UAAQC,CAAC,EAAE;QAAX,CADY;QAEnBF,OAAO,EAAE;UAAEC,CAAC,EAAE,CAAL;UAAQC,CAAC,EAAE;QAAX;MAFU,CAArB;IAID,CANQ;IAOT,+BAA+B,CAAC;MAAET;IAAF,CAAD,KAAqBD,QAAQ,CAACC,WAAD,CAPnD;IAQT,oCAAoCU,YAR3B;IAST,mCAAmCA,YAT1B;IAUT,kCAAkCE,SAVzB;IAWT,qBAAqBG;EAXZ;AANU,CAAvB;AAqBA,eAAeV,MAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/offset/plugin.prod.js b/packages/@interactjs/offset/plugin.prod.js new file mode 100644 index 000000000..810056393 --- /dev/null +++ b/packages/@interactjs/offset/plugin.prod.js @@ -0,0 +1,2 @@ +import{_ProxyMethods as t}from"../core/Interaction.prod.js";import*as e from"../utils/rect.prod.js";t.offsetBy="";export function addTotal(t){t.pointerIsDown&&(i(t.coords.cur,t.offset.total),t.offset.pending.x=0,t.offset.pending.y=0)}function n({interaction:t}){applyPending(t)}export function applyPending(t){if(!(t=>!(!t.offset.pending.x&&!t.offset.pending.y))(t))return!1;const{pending:n}=t.offset;return i(t.coords.cur,n),i(t.coords.delta,n),e.addEdges(t.edges,t.rect,n),n.x=0,n.y=0,!0}function o({x:t,y:e}){this.offset.pending.x+=t,this.offset.pending.y+=e,this.offset.total.x+=t,this.offset.total.y+=e}function i({page:t,client:e},{x:n,y:o}){t.x+=n,t.y+=o,e.x+=n,e.y+=o}const f={id:"offset",before:["modifiers","pointer-events","actions","inertia"],install(t){t.Interaction.prototype.offsetBy=o},listeners:{"interactions:new"({interaction:t}){t.offset={total:{x:0,y:0},pending:{x:0,y:0}}},"interactions:update-pointer":({interaction:t})=>addTotal(t),"interactions:before-action-start":n,"interactions:before-action-move":n,"interactions:before-action-end"({interaction:t}){if(applyPending(t))return t.move({offset:!0}),t.end(),!1},"interactions:stop"({interaction:t}){t.offset.total.x=0,t.offset.total.y=0,t.offset.pending.x=0,t.offset.pending.y=0}}};export default f; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/offset/plugin.prod.js.map b/packages/@interactjs/offset/plugin.prod.js.map new file mode 100644 index 000000000..4a4f1bdf2 --- /dev/null +++ b/packages/@interactjs/offset/plugin.prod.js.map @@ -0,0 +1,45 @@ +{ + "version": 3, + "names": [ + "_ProxyMethods", + "rectUtils", + "offsetBy", + "addTotal", + "interaction", + "pointerIsDown", + "addToCoords", + "coords", + "cur", + "offset", + "total", + "pending", + "x", + "y", + "beforeAction", + "applyPending", + "hasPending", + "delta", + "addEdges", + "edges", + "rect", + "this", + "page", + "client", + "id", + "before", + "install", + "scope", + "Interaction", + "prototype", + "listeners", + "move", + "end" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport { _ProxyMethods } from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\nimport type { Point } from '@interactjs/core/types'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Point\n pending: Point\n }\n }\n\n enum _ProxyMethods {\n offsetBy = '',\n }\n}\n\n;(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interaction) {\n if (!interaction.pointerIsDown) {\n return\n }\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: Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: 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: 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: 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: Interaction, { x, y }: 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 }: Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction: Interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Plugin = {\n id: 'offset',\n before: ['modifiers', 'pointer-events', 'actions', 'inertia'],\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" + ], + "mappings": "wBACSA,MAAqB,wCAGlBC,MAAe,wBAgBzBD,EAAsBE,SAAW,UAE5B,SAASC,SAAUC,GACnBA,EAAYC,gBAIjBC,EAAYF,EAAYG,OAAOC,IAAKJ,EAAYK,OAAOC,OAEvDN,EAAYK,OAAOE,QAAQC,EAAI,EAC/BR,EAAYK,OAAOE,QAAQE,EAAI,GAGjC,SAASC,GAAcV,YAAEA,IACvBW,aAAaX,UAqBR,SAASW,aAAcX,GAC5B,IA+BF,CAAqBA,MACTA,EAAYK,OAAOE,QAAQC,IAAKR,EAAYK,OAAOE,QAAQE,GAhChEG,CAAWZ,GACd,OAAO,EAGT,MAAMO,QAAEA,GAAYP,EAAYK,OAShC,OAPAH,EAAYF,EAAYG,OAAOC,IAAKG,GACpCL,EAAYF,EAAYG,OAAOU,MAAON,GACtCV,EAAUiB,SAASd,EAAYe,MAAOf,EAAYgB,KAAMT,GAExDA,EAAQC,EAAI,EACZD,EAAQE,EAAI,GAEL,EAGT,SAASX,GAA6BU,EAAEA,EAAFC,EAAKA,IACzCQ,KAAKZ,OAAOE,QAAQC,GAAKA,EACzBS,KAAKZ,OAAOE,QAAQE,GAAKA,EAEzBQ,KAAKZ,OAAOC,MAAME,GAAKA,EACvBS,KAAKZ,OAAOC,MAAMG,GAAKA,EAGzB,SAASP,GAAagB,KAAEA,EAAFC,OAAQA,IAAUX,EAAEA,EAAFC,EAAKA,IAC3CS,EAAKV,GAAKA,EACVU,EAAKT,GAAKA,EACVU,EAAOX,GAAKA,EACZW,EAAOV,GAAKA,EAOd,MAAMJ,EAAiB,CACrBe,GAAI,SACJC,OAAQ,CAAC,YAAa,iBAAkB,UAAW,WACnDC,QAASC,GACPA,EAAMC,YAAYC,UAAU3B,SAAWA,GAEzC4B,UAAW,CACT,oBAAuB1B,gBACrBA,EAAYK,OAAS,CACnBC,MAAO,CAAEE,EAAG,EAAGC,EAAG,GAClBF,QAAS,CAAEC,EAAG,EAAGC,EAAG,KAGxB,8BAA+B,EAAGT,iBAAkBD,SAASC,GAC7D,mCAAoCU,EACpC,kCAAmCA,EACnC,kCAtEgBV,YAAEA,IAGpB,GAFmBW,aAAaX,GAOhC,OAHAA,EAAY2B,KAAK,CAAEtB,QAAQ,IAC3BL,EAAY4B,OAEL,GA+DL,qBA5DU5B,YAAEA,IACdA,EAAYK,OAAOC,MAAME,EAAI,EAC7BR,EAAYK,OAAOC,MAAMG,EAAI,EAC7BT,EAAYK,OAAOE,QAAQC,EAAI,EAC/BR,EAAYK,OAAOE,QAAQE,EAAI,oBA4DlBJ" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/.npmignore b/packages/@interactjs/pointer-events/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/pointer-events/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/pointer-events/LICENSE b/packages/@interactjs/pointer-events/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/pointer-events/PointerEvent.d.ts b/packages/@interactjs/pointer-events/PointerEvent.d.ts new file mode 100644 index 000000000..d14a62f39 --- /dev/null +++ b/packages/@interactjs/pointer-events/PointerEvent.d.ts @@ -0,0 +1,26 @@ +import { BaseEvent } from '@interactjs/core/BaseEvent'; +import type Interaction from '@interactjs/core/Interaction'; +import type { PointerEventType, PointerType, Point } from '@interactjs/core/types'; +export default class PointerEvent extends BaseEvent { + type: T; + originalEvent: 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: PointerType | PointerEvent, event: PointerEventType, eventTarget: Node, interaction: Interaction, timeStamp: number); + _subtractOrigin({ x: originX, y: originY }: Point): this; + _addOrigin({ x: originX, y: originY }: Point): this; + /** + * Prevent the default behaviour of the original Event + */ + preventDefault(): void; +} +export { PointerEvent }; diff --git a/packages/@interactjs/pointer-events/PointerEvent.js b/packages/@interactjs/pointer-events/PointerEvent.js new file mode 100644 index 000000000..5fe28ffe7 --- /dev/null +++ b/packages/@interactjs/pointer-events/PointerEvent.js @@ -0,0 +1,64 @@ +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); + 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; + this.double = true; + } + } + + _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/packages/@interactjs/pointer-events/PointerEvent.js.map b/packages/@interactjs/pointer-events/PointerEvent.js.map new file mode 100644 index 000000000..53f0219eb --- /dev/null +++ b/packages/@interactjs/pointer-events/PointerEvent.js.map @@ -0,0 +1,50 @@ +{ + "version": 3, + "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" + ], + "sources": [ + "PointerEvent.ts" + ], + "sourcesContent": [ + "import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { PointerEventType, PointerType, Point } from '@interactjs/core/types'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n declare type: T\n declare originalEvent: PointerEventType\n declare pointerId: number\n declare pointerType: string\n declare double: boolean\n declare pageX: number\n declare pageY: number\n declare clientX: number\n declare clientY: number\n declare dt: number\n declare eventable: any;\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: PointerType | PointerEvent,\n event: PointerEventType,\n eventTarget: Node,\n interaction: 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 =\n !!interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500\n } else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n this.double = true\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: 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 }: 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" + ], + "mappings": "AAAA,SAASA,SAAT,QAA0B,sBAA1B;AAGA,OAAO,KAAKC,YAAZ,MAA8B,0BAA9B;AAEA,eAAe,MAAMC,YAAN,SAAmDF,SAAnD,CAAoE;EAcjF;EACAG,WAAW,CACTC,IADS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AL;IAAcC,CAAC,EAAEC;EAAjB,CAAF,EAAqC;IAClD,KAAKC,KAAL,IAAcH,OAAd;IACA,KAAKI,KAAL,IAAcF,OAAd;IACA,KAAKG,OAAL,IAAgBL,OAAhB;IACA,KAAKM,OAAL,IAAgBJ,OAAhB;IAEA,OAAO,IAAP;EACD;;EAEDK,UAAU,CAAE;IAAER,CAAC,EAAEC,OAAL;IAAcC,CAAC,EAAEC;EAAjB,CAAF,EAAqC;IAC7C,KAAKC,KAAL,IAAcH,OAAd;IACA,KAAKI,KAAL,IAAcF,OAAd;IACA,KAAKG,OAAL,IAAgBL,OAAhB;IACA,KAAKM,OAAL,IAAgBJ,OAAhB;IAEA,OAAO,IAAP;EACD;EAED;AACF;AACA;;;EACEM,cAAc,GAAI;IAChB,KAAK1B,aAAL,CAAmB0B,cAAnB;EACD;;AA9EgF;AAiFnF,SAASnC,YAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/PointerEvent.prod.js b/packages/@interactjs/pointer-events/PointerEvent.prod.js new file mode 100644 index 000000000..d7a9bb7e8 --- /dev/null +++ b/packages/@interactjs/pointer-events/PointerEvent.prod.js @@ -0,0 +1,2 @@ +import{BaseEvent as t}from"../core/BaseEvent.prod.js";import*as e from"../utils/pointerUtils.prod.js";export default class i extends t{constructor(t,i,s,r,p,n){if(super(p),e.pointerExtend(this,s),s!==i&&e.pointerExtend(this,i),this.timeStamp=n,this.originalEvent=s,this.type=t,this.pointerId=e.getPointerId(i),this.pointerType=e.getPointerType(i),this.target=r,this.currentTarget=null,"tap"===t){const t=p.getPointerIndex(i);this.dt=this.timeStamp-p.pointers[t].downTime;const e=this.timeStamp-p.tapTime;this.double=!!p.prevTap&&"doubletap"!==p.prevTap.type&&p.prevTap.target===this.target&&e<500}else"doubletap"===t&&(this.dt=i.timeStamp-p.tapTime,this.double=!0)}_subtractOrigin({x:t,y:e}){return this.pageX-=t,this.pageY-=e,this.clientX-=t,this.clientY-=e,this}_addOrigin({x:t,y:e}){return this.pageX+=t,this.pageY+=e,this.clientX+=t,this.clientY+=e,this}preventDefault(){this.originalEvent.preventDefault()}}export{i as PointerEvent}; +//# sourceMappingURL=PointerEvent.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/PointerEvent.prod.js.map b/packages/@interactjs/pointer-events/PointerEvent.prod.js.map new file mode 100644 index 000000000..e301ccdfe --- /dev/null +++ b/packages/@interactjs/pointer-events/PointerEvent.prod.js.map @@ -0,0 +1,52 @@ +{ + "version": 3, + "names": [ + "BaseEvent", + "pointerUtils", + "PointerEvent", + "constructor", + "type", + "pointer", + "event", + "eventTarget", + "interaction", + "timeStamp", + "super", + "pointerExtend", + "this", + "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" + ], + "sources": [ + "PointerEvent.ts" + ], + "sourcesContent": [ + "import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { PointerEventType, PointerType, Point } from '@interactjs/core/types'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n declare type: T\n declare originalEvent: PointerEventType\n declare pointerId: number\n declare pointerType: string\n declare double: boolean\n declare pageX: number\n declare pageY: number\n declare clientX: number\n declare clientY: number\n declare dt: number\n declare eventable: any;\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: PointerType | PointerEvent,\n event: PointerEventType,\n eventTarget: Node,\n interaction: 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 =\n !!interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500\n } else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n this.double = true\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: 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 }: 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" + ], + "mappings": "oBAASA,MAAiB,sCAGdC,MAAkB,+CAEf,MAAMC,UAA6CF,EAehEG,YACEC,EACAC,EACAC,EACAC,EACAC,EACAC,GAiBA,GAfAC,MAAMF,GACNP,EAAaU,cAAcC,KAAMN,GAE7BA,IAAUD,GACZJ,EAAaU,cAAcC,KAAMP,GAGnCO,KAAKH,UAAYA,EACjBG,KAAKC,cAAgBP,EACrBM,KAAKR,KAAOA,EACZQ,KAAKE,UAAYb,EAAac,aAAaV,GAC3CO,KAAKI,YAAcf,EAAagB,eAAeZ,GAC/CO,KAAKM,OAASX,EACdK,KAAKO,cAAgB,KAER,QAATf,EAAgB,CAClB,MAAMgB,EAAeZ,EAAYa,gBAAgBhB,GACjDO,KAAKU,GAAKV,KAAKH,UAAYD,EAAYe,SAASH,GAAcI,SAE9D,MAAMC,EAAWb,KAAKH,UAAYD,EAAYkB,QAE9Cd,KAAKe,SACDnB,EAAYoB,SACe,cAA7BpB,EAAYoB,QAAQxB,MACpBI,EAAYoB,QAAQV,SAAWN,KAAKM,QACpCO,EAAW,QACK,cAATrB,IACTQ,KAAKU,GAAMjB,EAAgCI,UAAYD,EAAYkB,QACnEd,KAAKe,QAAS,GAIlBE,iBAAmBC,EAAGC,EAASC,EAAGC,IAMhC,OALArB,KAAKsB,OAASH,EACdnB,KAAKuB,OAASF,EACdrB,KAAKwB,SAAWL,EAChBnB,KAAKyB,SAAWJ,EAETrB,KAGT0B,YAAcR,EAAGC,EAASC,EAAGC,IAM3B,OALArB,KAAKsB,OAASH,EACdnB,KAAKuB,OAASF,EACdrB,KAAKwB,SAAWL,EAChBnB,KAAKyB,SAAWJ,EAETrB,KAMT2B,iBACE3B,KAAKC,cAAc0B,yBAIdrC" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/base.d.ts b/packages/@interactjs/pointer-events/base.d.ts new file mode 100644 index 000000000..b1274214f --- /dev/null +++ b/packages/@interactjs/pointer-events/base.d.ts @@ -0,0 +1,72 @@ +import type { Eventable } from '@interactjs/core/Eventable'; +import type { Interaction } from '@interactjs/core/Interaction'; +import type { PerActionDefaults } from '@interactjs/core/options'; +import type { Plugin } from '@interactjs/core/scope'; +import type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'; +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?: Point | string | 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/options' { + interface ActionDefaults { + pointerEvents: Options; + } +} +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'pointerEvents:new': { + pointerEvent: PointerEvent; + }; + 'pointerEvents:fired': { + interaction: Interaction; + pointer: PointerType | PointerEvent; + event: PointerEventType | PointerEvent; + eventTarget: Node; + pointerEvent: PointerEvent; + targets?: EventTargetList; + type: string; + }; + 'pointerEvents:collect-targets': { + interaction: Interaction; + pointer: PointerType | PointerEvent; + event: PointerEventType | PointerEvent; + eventTarget: Node; + targets?: EventTargetList; + type: string; + path: Node[]; + node: null; + }; + } +} +declare const pointerEvents: Plugin; +export default pointerEvents; diff --git a/packages/@interactjs/pointer-events/base.js b/packages/@interactjs/pointer-events/base.js new file mode 100644 index 000000000..782a47244 --- /dev/null +++ b/packages/@interactjs/pointer-events/base.js @@ -0,0 +1,289 @@ +import * as domUtils from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import getOriginXY from "../utils/getOriginXY.js"; +import { PointerEvent } from './PointerEvent'; +const defaults = { + holdDuration: 600, + ignoreFrom: null, + allowFrom: null, + origin: { + x: 0, + y: 0 + } +}; +const pointerEvents = { + id: 'pointer-events/base', + before: ['inertia', 'modifiers', 'auto-start', 'actions'], + 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 = 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 = domUtils.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 => { + var _interaction$pointers, _interaction$pointers2; + + return target.eventable.options.holdDuration === ((_interaction$pointers = interaction.pointers[pointerIndex]) == null ? void 0 : (_interaction$pointers2 = _interaction$pointers.hold) == null ? void 0 : _interaction$pointers2.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 +}) { + const hold = interaction.pointers[pointerIndex].hold; + + if (hold && hold.timeout) { + clearTimeout(hold.timeout); + hold.timeout = null; + } +} + +function moveAndClearHold(arg, scope) { + const { + interaction, + pointer, + event, + eventTarget, + duplicate + } = arg; + + if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) { + if (interaction.pointerIsDown) { + clearHold(arg); + } + + 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 = domUtils.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; + extend(scope.actions.phaselessTypes, pointerEvents.types); +} + +export default pointerEvents; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/base.js.map b/packages/@interactjs/pointer-events/base.js.map new file mode 100644 index 000000000..8dedc95c4 --- /dev/null +++ b/packages/@interactjs/pointer-events/base.js.map @@ -0,0 +1,92 @@ +{ + "version": 3, + "names": [ + "domUtils", + "extend", + "getOriginXY", + "PointerEvent", + "defaults", + "holdDuration", + "ignoreFrom", + "allowFrom", + "origin", + "x", + "y", + "pointerEvents", + "id", + "before", + "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", + "eventable", + "node", + "_subtractOrigin", + "currentTarget", + "_addOrigin", + "immediatePropagationStopped", + "propagationStopped", + "prevTap", + "double", + "tapTime", + "timeStamp", + "pointerIndex", + "getPointerIndex", + "pointerInfo", + "pointers", + "pointerWasMoved", + "downTarget", + "path", + "getPath", + "filter", + "options", + "duration", + "Infinity", + "timeout", + "clearTimeout", + "duplicate", + "pointerIsDown", + "timer", + "minDuration", + "setTimeout", + "actions", + "phaselessTypes" + ], + "sources": [ + "base.ts" + ], + "sourcesContent": [ + "import type { Eventable } from '@interactjs/core/Eventable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\n\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?: Point | string | 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/options' {\n interface ActionDefaults {\n pointerEvents: 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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\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: Plugin = {\n id: 'pointer-events/base',\n before: ['inertia', 'modifiers', 'auto-start', 'actions'],\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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Scope,\n) {\n const { interaction, pointer, event, eventTarget, type, targets = collectEventTargets(arg, scope) } = 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 = 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 (\n pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n i + 1 < targets.length &&\n targets[i + 1].node !== pointerEvent.currentTarget)\n ) {\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 {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n },\n scope,\n )\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets (\n {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n }: {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n type: T\n },\n scope: Scope,\n) {\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 (\n type === 'tap' &&\n (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))\n ) {\n return []\n }\n\n const path = domUtils.getPath(eventTarget as 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(\n (target) => target.eventable.options.holdDuration === interaction.pointers[pointerIndex]?.hold?.duration,\n )\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 }: 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 const hold = interaction.pointers[pointerIndex].hold\n\n if (hold && hold.timeout) {\n clearTimeout(hold.timeout)\n hold.timeout = null\n }\n}\n\nfunction moveAndClearHold (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction, pointer, event, eventTarget, duplicate } = arg\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearHold(arg)\n }\n\n fire(\n {\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Element,\n type: 'move',\n },\n scope,\n )\n }\n}\n\nfunction downAndStartHold (\n { interaction, pointer, event, eventTarget, pointerIndex }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n const timer = interaction.pointers[pointerIndex].hold!\n const path = domUtils.getPath(eventTarget as 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 {\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n },\n scope,\n )\n }, minDuration)\n}\n\nfunction tapAfterUp (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:up'],\n scope: Scope,\n) {\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 extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n" + ], + "mappings": "AAKA,OAAO,KAAKA,QAAZ,MAA0B,sBAA1B;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AAEA,SAASC,YAAT,QAA6B,gBAA7B;AAqEA,MAAMC,QAA6B,GAAG;EACpCC,YAAY,EAAE,GADsB;EAEpCC,UAAU,EAAE,IAFwB;EAGpCC,SAAS,EAAE,IAHyB;EAIpCC,MAAM,EAAE;IAAEC,CAAC,EAAE,CAAL;IAAQC,CAAC,EAAE;EAAX;AAJ4B,CAAtC;AAOA,MAAMC,aAAqB,GAAG;EAC5BC,EAAE,EAAE,qBADwB;EAE5BC,MAAM,EAAE,CAAC,SAAD,EAAY,WAAZ,EAAyB,YAAzB,EAAuC,SAAvC,CAFoB;EAG5BC,OAH4B;EAI5BC,SAAS,EAAE;IACT,oBAAoBC,mBADX;IAET,+BAA+BC,WAFtB;IAGT,qBAAqBC,gBAHZ;IAIT,qBAAqB,CAACC,GAAD,EAAMC,KAAN,KAAgB;MACnCC,gBAAgB,CAACF,GAAD,EAAMC,KAAN,CAAhB;MACAE,IAAI,CAACH,GAAD,EAAMC,KAAN,CAAJ;IACD,CAPQ;IAQT,mBAAmB,CAACD,GAAD,EAAMC,KAAN,KAAgB;MACjCG,SAAS,C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,CAAC6B,eAAjB,EAAkC;IAChCzC,IAAI,CAAC;MAAEY,WAAF;MAAeG,WAAf;MAA4BF,OAA5B;MAAqCC,KAArC;MAA4CE,IAAI,EAAE;IAAlD,CAAD,EAA4DlB,KAA5D,CAAJ;EACD;AACF;;AAED,SAASN,OAAT,CAAkBM,KAAlB,EAAgC;EAC9BA,KAAK,CAACT,aAAN,GAAsBA,aAAtB;EACAS,KAAK,CAAChB,QAAN,CAAe0E,OAAf,CAAuBnE,aAAvB,GAAuCA,aAAa,CAACP,QAArD;EACAH,MAAM,CAACmB,KAAK,CAAC0D,OAAN,CAAcC,cAAf,EAA+BpE,aAAa,CAACe,KAA7C,CAAN;AACD;;AAED,eAAef,aAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/base.prod.js b/packages/@interactjs/pointer-events/base.prod.js new file mode 100644 index 000000000..ad14be76b --- /dev/null +++ b/packages/@interactjs/pointer-events/base.prod.js @@ -0,0 +1,2 @@ +import*as t from"../utils/domUtils.prod.js";import e from"../utils/extend.prod.js";import n from"../utils/getOriginXY.prod.js";import{PointerEvent as o}from"./PointerEvent";const r={id:"pointer-events/base",before:["inertia","modifiers","auto-start","actions"],install(t){t.pointerEvents=r,t.defaults.actions.pointerEvents=r.defaults,e(t.actions.phaselessTypes,r.types)},listeners:{"interactions:new"({interaction:t}){t.prevTap=null,t.tapTime=0},"interactions:update-pointer"({down:t,pointerInfo:e}){!t&&e.hold||(e.hold={duration:1/0,timeout:null})},"interactions:move"(t,e){const{interaction:n,pointer:o,event:r,eventTarget:a,duplicate:s}=t;s||n.pointerIsDown&&!n.pointerWasMoved||(n.pointerIsDown&&p(t),i({interaction:n,pointer:o,event:r,eventTarget:a,type:"move"},e))},"interactions:down"(e,n){(({interaction:e,pointer:n,event:o,eventTarget:r,pointerIndex:a},p)=>{const s=e.pointers[a].hold,l=t.getPath(r),c={interaction:e,pointer:n,event:o,eventTarget:r,type:"hold",targets:[],path:l,node:null};for(const t of l)c.node=t,p.fire("pointerEvents:collect-targets",c);if(!c.targets.length)return;let d=1/0;for(const t of c.targets){const e=t.eventable.options.holdDuration;e{i({interaction:e,eventTarget:r,pointer:n,event:o,type:"hold"},p)}),d)})(e,n),i(e,n)},"interactions:up"(t,e){p(t),i(t,e),(({interaction:t,pointer:e,event:n,eventTarget:o},r)=>{t.pointerWasMoved||i({interaction:t,eventTarget:o,pointer:e,event:n,type:"tap"},r)})(t,e)},"interactions:cancel"(t,e){p(t),i(t,e)}},PointerEvent:o,fire:i,collectEventTargets:a,defaults:{holdDuration:600,ignoreFrom:null,allowFrom:null,origin:{x:0,y:0}},types:{down:!0,move:!0,up:!0,cancel:!0,tap:!0,doubletap:!0,hold:!0}};function i(t,e){const{interaction:r,pointer:p,event:s,eventTarget:l,type:c,targets:d=a(t,e)}=t,v=new o(c,p,s,l,r,e.now());e.fire("pointerEvents:new",{pointerEvent:v});const u={interaction:r,pointer:p,event:s,eventTarget:l,targets:d,type:c,pointerEvent:v};for(let t=0;t{var n,o;return t.eventable.options.holdDuration===(null==(n=e.pointers[p])||null==(o=n.hold)?void 0:o.duration)}))),c.targets}function p({interaction:t,pointerIndex:e}){const n=t.pointers[e].hold;n&&n.timeout&&(clearTimeout(n.timeout),n.timeout=null)}export default r; +//# sourceMappingURL=base.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/base.prod.js.map b/packages/@interactjs/pointer-events/base.prod.js.map new file mode 100644 index 000000000..b382db012 --- /dev/null +++ b/packages/@interactjs/pointer-events/base.prod.js.map @@ -0,0 +1,91 @@ +{ + "version": 3, + "names": [ + "domUtils", + "extend", + "getOriginXY", + "PointerEvent", + "pointerEvents", + "id", + "before", + "install", + "scope", + "defaults", + "actions", + "phaselessTypes", + "types", + "listeners", + "interaction", + "prevTap", + "tapTime", + "down", + "pointerInfo", + "hold", + "duration", + "Infinity", + "timeout", + "arg", + "pointer", + "event", + "eventTarget", + "duplicate", + "pointerIsDown", + "pointerWasMoved", + "clearHold", + "fire", + "type", + "pointerIndex", + "timer", + "pointers", + "path", + "getPath", + "signalArg", + "targets", + "node", + "length", + "minDuration", + "target", + "holdDuration", + "eventable", + "options", + "setTimeout", + "downAndStartHold", + "tapAfterUp", + "collectEventTargets", + "ignoreFrom", + "allowFrom", + "origin", + "x", + "y", + "move", + "up", + "cancel", + "tap", + "doubletap", + "pointerEvent", + "now", + "i", + "prop", + "props", + "_subtractOrigin", + "currentTarget", + "_addOrigin", + "immediatePropagationStopped", + "propagationStopped", + "double", + "timeStamp", + "getPointerIndex", + "downTarget", + "filter", + "_interaction$pointers", + "_interaction$pointers2", + "clearTimeout" + ], + "sources": [ + "base.ts" + ], + "sourcesContent": [ + "import type { Eventable } from '@interactjs/core/Eventable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\n\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?: Point | string | 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/options' {\n interface ActionDefaults {\n pointerEvents: 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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\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: Plugin = {\n id: 'pointer-events/base',\n before: ['inertia', 'modifiers', 'auto-start', 'actions'],\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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Scope,\n) {\n const { interaction, pointer, event, eventTarget, type, targets = collectEventTargets(arg, scope) } = 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 = 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 (\n pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n i + 1 < targets.length &&\n targets[i + 1].node !== pointerEvent.currentTarget)\n ) {\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 {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n },\n scope,\n )\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets (\n {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n }: {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n type: T\n },\n scope: Scope,\n) {\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 (\n type === 'tap' &&\n (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))\n ) {\n return []\n }\n\n const path = domUtils.getPath(eventTarget as 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(\n (target) => target.eventable.options.holdDuration === interaction.pointers[pointerIndex]?.hold?.duration,\n )\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 }: 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 const hold = interaction.pointers[pointerIndex].hold\n\n if (hold && hold.timeout) {\n clearTimeout(hold.timeout)\n hold.timeout = null\n }\n}\n\nfunction moveAndClearHold (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction, pointer, event, eventTarget, duplicate } = arg\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearHold(arg)\n }\n\n fire(\n {\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Element,\n type: 'move',\n },\n scope,\n )\n }\n}\n\nfunction downAndStartHold (\n { interaction, pointer, event, eventTarget, pointerIndex }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n const timer = interaction.pointers[pointerIndex].hold!\n const path = domUtils.getPath(eventTarget as 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 {\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n },\n scope,\n )\n }, minDuration)\n}\n\nfunction tapAfterUp (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:up'],\n scope: Scope,\n) {\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 extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n" + ], + "mappings": "UAKYA,MAAc,mCACnBC,MAAY,iCACZC,MAAiB,sDAEfC,MAAoB,iBAqE7B,MAOMC,EAAwB,CAC5BC,GAAI,sBACJC,OAAQ,CAAC,UAAW,YAAa,aAAc,WAC/CC,QA+QgBC,GAChBA,EAAMJ,cAAgBA,EACtBI,EAAMC,SAASC,QAAQN,cAAgBA,EAAcK,SACrDR,EAAOO,EAAME,QAAQC,eAAgBP,EAAcQ,QAjRnDC,UAAW,CACT,oBAuK0BC,YAAEA,IAC9BA,EAAYC,QAAU,KACtBD,EAAYE,QAAU,GAxKpB,+BA2KkBC,KAAEA,EAAFC,YAAQA,KACvBD,GAAQC,EAAYC,OAIzBD,EAAYC,KAAO,CAAEC,SAAUC,IAAUC,QAAS,QA/KhD,oBA2LuBC,EAAsCf,GAC/D,MAAMM,YAAEA,EAAFU,QAAeA,EAAfC,MAAwBA,EAAxBC,YAA+BA,EAA/BC,UAA4CA,GAAcJ,EAE3DI,GAAeb,EAAYc,gBAAiBd,EAAYe,kBACvDf,EAAYc,eACdE,EAAUP,GAGZQ,EACE,CACEjB,cACAU,UACAC,QACAC,YAAaA,EACbM,KAAM,QAERxB,KA1MF,oBAAsBe,EAAKf,GA+M/B,GACEM,YAAEA,EAAFU,QAAeA,EAAfC,MAAwBA,EAAxBC,YAA+BA,EAA/BO,aAA4CA,GAC5CzB,KAEA,MAAM0B,EAAQpB,EAAYqB,SAASF,GAAcd,KAC3CiB,EAAOpC,EAASqC,QAAQX,GACxBY,EAAY,CAChBxB,cACAU,UACAC,QACAC,cACAM,KAAM,OACNO,QAAS,GACTH,OACAI,KAAM,MAGR,IAAK,MAAMA,KAAQJ,EACjBE,EAAUE,KAAOA,EAEjBhC,EAAMuB,KAAK,gCAAiCO,GAG9C,IAAKA,EAAUC,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,OAAAgC,EAA0C9D,EAAYqB,SAASF,KAA/D,OAAA4C,EAA0CD,EAAoCzD,WAA9E,EAA0C0D,EAA0CzD,cAI7FkB,EAAUC,QAgBnB,SAAST,GAAWhB,YAAEA,EAAFmB,aAAeA,IACjC,MAAMd,EAAOL,EAAYqB,SAASF,GAAcd,KAE5CA,GAAQA,EAAKG,UACfwD,aAAa3D,EAAKG,SAClBH,EAAKG,QAAU,qBA0FJlB" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/holdRepeat.d.ts b/packages/@interactjs/pointer-events/holdRepeat.d.ts new file mode 100644 index 000000000..fe9d1d527 --- /dev/null +++ b/packages/@interactjs/pointer-events/holdRepeat.d.ts @@ -0,0 +1,19 @@ +import type { Plugin } from '@interactjs/core/scope'; +import './base'; +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: Plugin; +export default holdRepeat; diff --git a/packages/@interactjs/pointer-events/holdRepeat.js b/packages/@interactjs/pointer-events/holdRepeat.js new file mode 100644 index 000000000..4cc7aff43 --- /dev/null +++ b/packages/@interactjs/pointer-events/holdRepeat.js @@ -0,0 +1,70 @@ +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ +import './base'; +import basePlugin from './base'; +/* eslint-enable import/no-duplicates */ + +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/packages/@interactjs/pointer-events/holdRepeat.js.map b/packages/@interactjs/pointer-events/holdRepeat.js.map new file mode 100644 index 000000000..d4c0fe273 --- /dev/null +++ b/packages/@interactjs/pointer-events/holdRepeat.js.map @@ -0,0 +1,48 @@ +{ + "version": 3, + "names": [ + "basePlugin", + "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" + ], + "sources": [ + "holdRepeat.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { ListenerMap, Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\n\nimport type PointerEvent from './PointerEvent'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable import/no-duplicates */\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: Scope) {\n scope.usePlugin(basePlugin)\n\n const { pointerEvents } = 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 }: SignalArgs['pointerEvents:fired'],\n scope: 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 {\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n },\n scope,\n )\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: 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: 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 ListenerM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AAYD;;AAED,SAASQ,aAAT,CAAwB;EAAEZ;AAAF,CAAxB,EAAuE;EACrE;EACA;EACA,IAAIA,WAAW,CAACO,kBAAhB,EAAoC;IAClCM,aAAa,CAACb,WAAW,CAACO,kBAAb,CAAb;IACAP,WAAW,CAACO,kBAAZ,GAAiC,IAAjC;EACD;AACF;;AAED,MAAMO,UAAkB,GAAG;EACzBC,EAAE,EAAE,2BADqB;EAEzB9B,OAFyB;EAGzB+B,SAAS,EAAE,CAAC,MAAD,EAAS,IAAT,EAAe,QAAf,EAAyB,QAAzB,EAAmCC,MAAnC,CACT,CAACC,GAAD,EAAMC,UAAN,KAAqB;IACnB;IAAED,GAAD,CAAc,iBAAgBC,UAAW,EAAzC,IAA8CP,aAA9C;IACD,OAAOM,GAAP;EACD,CAJQ,EAKT;IACE,qBAAqBvB,KADvB;IAEE,uBAAuBI;EAFzB,CALS;AAHc,CAA3B;AAeA,eAAee,UAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/holdRepeat.prod.js b/packages/@interactjs/pointer-events/holdRepeat.prod.js new file mode 100644 index 000000000..4d4b25436 --- /dev/null +++ b/packages/@interactjs/pointer-events/holdRepeat.prod.js @@ -0,0 +1,2 @@ +import"./base";import e from"./base";function t({interaction:e}){e.holdIntervalHandle&&(clearInterval(e.holdIntervalHandle),e.holdIntervalHandle=null)}const n={id:"pointer-events/holdRepeat",install(t){t.usePlugin(e);const{pointerEvents:n}=t;n.defaults.holdRepeatInterval=0,n.types.holdrepeat=t.actions.phaselessTypes.holdrepeat=!0},listeners:["move","up","cancel","endall"].reduce(((e,n)=>(e["pointerEvents:"+n]=t,e)),{"pointerEvents:new"({pointerEvent:e}){"hold"===e.type&&(e.count=(e.count||0)+1)},"pointerEvents:fired"({interaction:e,pointerEvent:t,eventTarget:n,targets:o},l){if("hold"!==t.type||!o.length)return;const r=o[0].eventable.options.holdRepeatInterval;r<=0||(e.holdIntervalHandle=setTimeout((()=>{l.pointerEvents.fire({interaction:e,eventTarget:n,type:"hold",pointer:t,event:t},l)}),r))}})};export default n; +//# sourceMappingURL=holdRepeat.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/holdRepeat.prod.js.map b/packages/@interactjs/pointer-events/holdRepeat.prod.js.map new file mode 100644 index 000000000..916f73c42 --- /dev/null +++ b/packages/@interactjs/pointer-events/holdRepeat.prod.js.map @@ -0,0 +1,46 @@ +{ + "version": 3, + "names": [ + "basePlugin", + "endHoldRepeat", + "interaction", + "holdIntervalHandle", + "clearInterval", + "holdRepeat", + "id", + "install", + "scope", + "usePlugin", + "pointerEvents", + "defaults", + "holdRepeatInterval", + "types", + "holdrepeat", + "actions", + "phaselessTypes", + "listeners", + "reduce", + "acc", + "enderTypes", + "pointerEvent", + "type", + "count", + "eventTarget", + "targets", + "length", + "interval", + "eventable", + "options", + "setTimeout", + "fire", + "pointer", + "event" + ], + "sources": [ + "holdRepeat.ts" + ], + "sourcesContent": [ + "import type Interaction from '@interactjs/core/Interaction'\nimport type { ListenerMap, Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\n\nimport type PointerEvent from './PointerEvent'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable import/no-duplicates */\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: Scope) {\n scope.usePlugin(basePlugin)\n\n const { pointerEvents } = 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 }: SignalArgs['pointerEvents:fired'],\n scope: 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 {\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n },\n scope,\n )\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: 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: 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" + ], + "mappings": "MAKO,gBACAA,MAAgB,SAgEvB,SAASC,GAAeC,YAAEA,IAGpBA,EAAYC,qBACdC,cAAcF,EAAYC,oBAC1BD,EAAYC,mBAAqB,MAIrC,MAAME,EAAqB,CACzBC,GAAI,4BACJC,QAtDgBC,GAChBA,EAAMC,UAAUT,GAEhB,MAAMU,cAAEA,GAAkBF,EAG1BE,EAAcC,SAASC,mBAAqB,EAC5CF,EAAcG,MAAMC,WAAaN,EAAMO,QAAQC,eAAeF,YAAa,GAgD3EG,UAAW,CAAC,OAAQ,KAAM,SAAU,UAAUC,QAC5C,CAACC,EAAKC,KACFD,EAAa,iBAAgBC,GAAgBnB,EACxCkB,IAET,CACE,qBAnDUE,aAAEA,IACU,SAAtBA,EAAaC,OAEjBD,EAAaE,OAASF,EAAaE,OAAS,GAAK,IAiD7C,uBA7CJrB,YAAEA,EAAFmB,aAAeA,EAAfG,YAA6BA,EAA7BC,QAA0CA,GAC1CjB,GAEA,GAA0B,SAAtBa,EAAaC,OAAoBG,EAAQC,OAAQ,OAGrD,MAAMC,EAAWF,EAAQ,GAAGG,UAAUC,QAAQjB,mBAG1Ce,GAAY,IAGhBzB,EAAYC,mBAAqB2B,YAAW,KAC1CtB,EAAME,cAAcqB,KAClB,CACE7B,cACAsB,cACAF,KAAM,OACNU,QAASX,EACTY,MAAOZ,GAETb,KAEDmB,uBA2BUtB" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/index.d.ts b/packages/@interactjs/pointer-events/index.d.ts new file mode 100644 index 000000000..bc9145423 --- /dev/null +++ b/packages/@interactjs/pointer-events/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/pointer-events/plugin'; diff --git a/packages/@interactjs/pointer-events/index.js b/packages/@interactjs/pointer-events/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/pointer-events/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/index.js.map b/packages/@interactjs/pointer-events/index.js.map new file mode 100644 index 000000000..fc4437b63 --- /dev/null +++ b/packages/@interactjs/pointer-events/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/pointer-events/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/pointer-events/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/index.prod.js b/packages/@interactjs/pointer-events/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/pointer-events/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/index.prod.js.map b/packages/@interactjs/pointer-events/index.prod.js.map new file mode 100644 index 000000000..5efd49b10 --- /dev/null +++ b/packages/@interactjs/pointer-events/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/pointer-events/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/pointer-events/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/index.ts b/packages/@interactjs/pointer-events/index.ts new file mode 100644 index 000000000..9f994b411 --- /dev/null +++ b/packages/@interactjs/pointer-events/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/pointer-events/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/pointer-events/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/interactableTargets.d.ts b/packages/@interactjs/pointer-events/interactableTargets.d.ts new file mode 100644 index 000000000..14240dae2 --- /dev/null +++ b/packages/@interactjs/pointer-events/interactableTargets.d.ts @@ -0,0 +1,11 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { Plugin } from '@interactjs/core/scope'; +declare module '@interactjs/core/Interactable' { + interface Interactable { + pointerEvents: typeof pointerEventsMethod; + __backCompatOption: (optionName: string, newValue: any) => any; + } +} +declare function pointerEventsMethod(this: Interactable, options: any): Interactable; +declare const plugin: Plugin; +export default plugin; diff --git a/packages/@interactjs/pointer-events/interactableTargets.js b/packages/@interactjs/pointer-events/interactableTargets.js new file mode 100644 index 000000000..8d05cbb93 --- /dev/null +++ b/packages/@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/packages/@interactjs/pointer-events/interactableTargets.js.map b/packages/@interactjs/pointer-events/interactableTargets.js.map new file mode 100644 index 000000000..bf39d38fc --- /dev/null +++ b/packages/@interactjs/pointer-events/interactableTargets.js.map @@ -0,0 +1,46 @@ +{ + "version": 3, + "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" + ], + "sources": [ + "interactableTargets.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\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: Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({ targets, node, type, eventTarget }, 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 ) {\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: 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" + ], + "mappings": "AAGA,OAAOA,MAAP,MAAmB,oBAAnB;;AASA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EAC9B,MAAM;IAAEC;EAAF,IAAmBD,KAAzB;EAEAC,YAAY,CAACC,SAAb,CAAuBC,aAAvB,GAAuCC,mBAAvC;EAEA,MAAMC,kBAAkB,GAAGJ,YAAY,CAACC,SAAb,CAAuBI,iBAAlD;;EAEAL,YAAY,CAACC,SAAb,CAAuBI,iBAAvB,GAA2C,UAAUC,UAAV,EAAsBC,QAAtB,EAAgC;IACzE,MAAMC,GAAG,GAAGJ,kBAAkB,CAACK,IAAnB,CAAwB,IAAxB,EAA8BH,UAA9B,EAA0CC,QAA1C,CAAZ;;IAEA,IAAIC,GAAG,KAAK,IAAZ,EAAkB;MAChB,KAAKE,MAAL,CAAYC,OAAZ,CAAoBL,UAApB,IAAkCC,QAAlC;IACD;;IAED,OAAOC,GAAP;EACD,CARD;AASD;;AAED,SAASL,mBAAT,CAAkDQ,OAAlD,EAAgE;EAC9Dd,MAAM,CAAC,KAAKa,MAAL,CAAYC,OAAb,EAAsBA,OAAtB,CAAN;EAEA,OAAO,IAAP;AACD;;AAED,MAAMC,MAAc,GAAG;EACrBC,EAAE,EAAE,oCADiB;EAErBf,OAFqB;EAGrBgB,SAAS,EAAE;IACT,iCAAiC,CAAC;MAAEC,OAAF;MAAWC,IAAX;MAAiBC,IAAjB;MAAuBC;IAAvB,CAAD,EAAuCnB,KAAvC,KAAiD;MAChFA,KAAK,CAACoB,aAAN,CAAoBC,YAApB,CAAiCJ,IAAjC,EAAwCK,YAAD,IAAgC;QACrE,MAAMC,SAAS,GAAGD,YAAY,CAACX,MAA/B;QACA,MAAMC,OAAO,GAAGW,SAAS,CAACX,OAA1B;;QAEA,IACEW,SAAS,CAACC,KAAV,CAAgBN,IAAhB,KACAK,SAAS,CAACC,KAAV,CAAgBN,IAAhB,EAAsBO,MADtB,IAEAH,YAAY,CAACI,eAAb,CAA6Bd,OAA7B,EAAsCK,IAAtC,EAA4CE,WAA5C,CAHF,EAIE;UACAH,OAAO,CAACW,IAAR,CAAa;YACXV,IADW;YAEXM,SAFW;YAGXK,KAAK,EAAE;cAAEN;YAAF;UAHI,CAAb;QAKD;MACF,CAfD;IAgBD,CAlBQ;IAoBT,oBAAoB,CAAC;MAAEA;IAAF,CAAD,KAAsB;MACxCA,YAAY,CAACX,MAAb,CAAoBkB,OAApB,GAA8B,UAAUC,OAAV,EAA4B;QACxD,OAAOR,YAAY,CAACO,OAAb,CAAqBC,OAArB,CAAP;MACD,CAFD;IAGD,CAxBQ;IA0BT,oBAAoB,CAAC;MAAER,YAAF;MAAgBV;IAAhB,CAAD,EAA4BZ,KAA5B,KAAsC;MACxDF,MAAM,CAACwB,YAAY,CAACX,MAAb,CAAoBC,OAArB,EAA8BZ,KAAK,CAACG,aAAN,CAAoB4B,QAAlD,CAAN;MACAjC,MAAM,CAACwB,YAAY,CAACX,MAAb,CAAoBC,OAArB,EAA8BA,OAAO,CAACT,aAAR,IAAyB,EAAvD,CAAN;IACD;EA7BQ;AAHU,CAAvB;AAoCA,eAAeU,MAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/interactableTargets.prod.js b/packages/@interactjs/pointer-events/interactableTargets.prod.js new file mode 100644 index 000000000..0665c44c3 --- /dev/null +++ b/packages/@interactjs/pointer-events/interactableTargets.prod.js @@ -0,0 +1,2 @@ +import t from"../utils/extend.prod.js";function e(e){return t(this.events.options,e),this}const n={id:"pointer-events/interactableTargets",install(t){const{Interactable:n}=t;n.prototype.pointerEvents=e;const o=n.prototype._backCompatOption;n.prototype._backCompatOption=function(t,e){const n=o.call(this,t,e);return n===this&&(this.events.options[t]=e),n}},listeners:{"pointerEvents:collect-targets"({targets:t,node:e,type:n,eventTarget:o},s){s.interactables.forEachMatch(e,(s=>{const i=s.events,r=i.options;i.types[n]&&i.types[n].length&&s.testIgnoreAllow(r,e,o)&&t.push({node:e,eventable:i,props:{interactable:s}})}))},"interactable:new"({interactable:t}){t.events.getRect=e=>t.getRect(e)},"interactable:set"({interactable:e,options:n},o){t(e.events.options,o.pointerEvents.defaults),t(e.events.options,n.pointerEvents||{})}}};export default n; +//# sourceMappingURL=interactableTargets.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/interactableTargets.prod.js.map b/packages/@interactjs/pointer-events/interactableTargets.prod.js.map new file mode 100644 index 000000000..849f03282 --- /dev/null +++ b/packages/@interactjs/pointer-events/interactableTargets.prod.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "names": [ + "extend", + "pointerEventsMethod", + "options", + "this", + "events", + "plugin", + "id", + "install", + "scope", + "Interactable", + "prototype", + "pointerEvents", + "__backCompatOption", + "_backCompatOption", + "optionName", + "newValue", + "ret", + "call", + "listeners", + "targets", + "node", + "type", + "eventTarget", + "interactables", + "forEachMatch", + "interactable", + "eventable", + "types", + "length", + "testIgnoreAllow", + "push", + "props", + "getRect", + "element", + "defaults" + ], + "sources": [ + "interactableTargets.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\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: Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({ targets, node, type, eventTarget }, 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 ) {\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: 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" + ], + "mappings": "OAGOA,MAAY,0BA2BnB,SAASC,EAAyCC,GAGhD,OAFAF,EAAOG,KAAKC,OAAOF,QAASA,GAErBC,KAGT,MAAME,EAAiB,CACrBC,GAAI,qCACJC,QA1BgBC,GAChB,MAAMC,aAAEA,GAAiBD,EAEzBC,EAAaC,UAAUC,cAAgBV,EAEvC,MAAMW,EAAqBH,EAAaC,UAAUG,kBAElDJ,EAAaC,UAAUG,kBAAoB,SAAUC,EAAYC,GAC/D,MAAMC,EAAMJ,EAAmBK,KAAKd,KAAMW,EAAYC,GAMtD,OAJIC,IAAQb,OACVA,KAAKC,OAAOF,QAAQY,GAAcC,GAG7BC,IAaTE,UAAW,CACT,iCAAoCC,UAASC,OAAMC,OAAMC,eAAed,GACtEA,EAAMe,cAAcC,aAAaJ,GAAOK,IACtC,MAAMC,EAAYD,EAAarB,OACzBF,EAAUwB,EAAUxB,QAGxBwB,EAAUC,MAAMN,IAChBK,EAAUC,MAAMN,GAAMO,QACtBH,EAAaI,gBAAgB3B,EAASkB,EAAME,IAE5CH,EAAQW,KAAK,CACXV,OACAM,YACAK,MAAO,CAAEN,sBAMjB,oBAAuBA,iBACrBA,EAAarB,OAAO4B,QAAoBC,GAC/BR,EAAaO,QAAQC,IAIhC,oBAAuBR,eAAcvB,WAAWM,GAC9CR,EAAOyB,EAAarB,OAAOF,QAASM,EAAMG,cAAcuB,UACxDlC,EAAOyB,EAAarB,OAAOF,QAASA,EAAQS,eAAiB,sBAKpDN" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/plugin.d.ts b/packages/@interactjs/pointer-events/plugin.d.ts new file mode 100644 index 000000000..6760a50d5 --- /dev/null +++ b/packages/@interactjs/pointer-events/plugin.d.ts @@ -0,0 +1,6 @@ +import type { Plugin } from '@interactjs/core/scope'; +import './base'; +import './holdRepeat'; +import './interactableTargets'; +declare const plugin: Plugin; +export default plugin; diff --git a/packages/@interactjs/pointer-events/plugin.js b/packages/@interactjs/pointer-events/plugin.js new file mode 100644 index 000000000..b370635be --- /dev/null +++ b/packages/@interactjs/pointer-events/plugin.js @@ -0,0 +1,21 @@ +/* eslint-disable import/no-duplicates -- for typescript module augmentations */ +import './base'; +import './holdRepeat'; +import './interactableTargets'; +import * as pointerEvents from './base'; +import holdRepeat from './holdRepeat'; +import interactableTargets from './interactableTargets'; +/* eslint-enable import/no-duplicates */ + +const plugin = { + id: 'pointer-events', + + install(scope) { + scope.usePlugin(pointerEvents); + scope.usePlugin(holdRepeat); + scope.usePlugin(interactableTargets); + } + +}; +export default plugin; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/plugin.js.map b/packages/@interactjs/pointer-events/plugin.js.map new file mode 100644 index 000000000..e252ea947 --- /dev/null +++ b/packages/@interactjs/pointer-events/plugin.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "pointerEvents", + "holdRepeat", + "interactableTargets", + "plugin", + "id", + "install", + "scope", + "usePlugin" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './holdRepeat'\nimport './interactableTargets'\n\nimport * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n/* eslint-enable import/no-duplicates */\n\nconst plugin: Plugin = {\n id: 'pointer-events',\n install (scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n },\n}\n\nexport default plugin\n" + ], + "mappings": "AAEA;AACA,OAAO,QAAP;AACA,OAAO,cAAP;AACA,OAAO,uBAAP;AAEA,OAAO,KAAKA,aAAZ,MAA+B,QAA/B;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA;;AAEA,MAAMC,MAAc,GAAG;EACrBC,EAAE,EAAE,gBADiB;;EAErBC,OAAO,CAAEC,KAAF,EAAS;IACdA,KAAK,CAACC,SAAN,CAAgBP,aAAhB;IACAM,KAAK,CAACC,SAAN,CAAgBN,UAAhB;IACAK,KAAK,CAACC,SAAN,CAAgBL,mBAAhB;EACD;;AANoB,CAAvB;AASA,eAAeC,MAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/plugin.prod.js b/packages/@interactjs/pointer-events/plugin.prod.js new file mode 100644 index 000000000..41567a3c7 --- /dev/null +++ b/packages/@interactjs/pointer-events/plugin.prod.js @@ -0,0 +1,2 @@ +import"./base";import"./holdRepeat";import"./interactableTargets";import*as e from"./base";import t from"./holdRepeat";import r from"./interactableTargets";const i={id:"pointer-events",install(i){i.usePlugin(e),i.usePlugin(t),i.usePlugin(r)}};export default i; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/pointer-events/plugin.prod.js.map b/packages/@interactjs/pointer-events/plugin.prod.js.map new file mode 100644 index 000000000..4065318f9 --- /dev/null +++ b/packages/@interactjs/pointer-events/plugin.prod.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "pointerEvents", + "holdRepeat", + "interactableTargets", + "plugin", + "id", + "install", + "scope", + "usePlugin" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './holdRepeat'\nimport './interactableTargets'\n\nimport * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n/* eslint-enable import/no-duplicates */\n\nconst plugin: Plugin = {\n id: 'pointer-events',\n install (scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n },\n}\n\nexport default plugin\n" + ], + "mappings": "MAGO,eACA,qBACA,kCAEKA,MAAmB,gBACxBC,MAAgB,sBAChBC,MAAyB,wBAGhC,MAAMC,EAAiB,CACrBC,GAAI,iBACJC,QAASC,GACPA,EAAMC,UAAUP,GAChBM,EAAMC,UAAUN,GAChBK,EAAMC,UAAUL,oBAILC" +} \ No newline at end of file diff --git a/packages/@interactjs/reflow/.npmignore b/packages/@interactjs/reflow/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/reflow/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/reflow/LICENSE b/packages/@interactjs/reflow/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/reflow/index.d.ts b/packages/@interactjs/reflow/index.d.ts new file mode 100644 index 000000000..d5834e4dc --- /dev/null +++ b/packages/@interactjs/reflow/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/reflow/plugin'; diff --git a/packages/@interactjs/reflow/index.js b/packages/@interactjs/reflow/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/reflow/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/reflow/index.js.map b/packages/@interactjs/reflow/index.js.map new file mode 100644 index 000000000..1b48fa03f --- /dev/null +++ b/packages/@interactjs/reflow/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/reflow/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/reflow/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/reflow/index.prod.js b/packages/@interactjs/reflow/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/reflow/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/reflow/index.prod.js.map b/packages/@interactjs/reflow/index.prod.js.map new file mode 100644 index 000000000..f3e548b10 --- /dev/null +++ b/packages/@interactjs/reflow/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/reflow/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/reflow/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/reflow/index.ts b/packages/@interactjs/reflow/index.ts new file mode 100644 index 000000000..1b23f1996 --- /dev/null +++ b/packages/@interactjs/reflow/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/reflow/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/reflow/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/reflow/plugin.d.ts b/packages/@interactjs/reflow/plugin.d.ts new file mode 100644 index 000000000..cccb4c9e9 --- /dev/null +++ b/packages/@interactjs/reflow/plugin.d.ts @@ -0,0 +1,31 @@ +import type { Interactable } from '@interactjs/core/Interactable'; +import type { DoAnyPhaseArg } from '@interactjs/core/Interaction'; +import type { Scope, Plugin } from '@interactjs/core/scope'; +import type { ActionName, ActionProps } from '@interactjs/core/types'; +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'interactions:before-action-reflow': Omit; + 'interactions:action-reflow': DoAnyPhaseArg; + 'interactions:after-action-reflow': DoAnyPhaseArg; + } +} +declare module '@interactjs/core/Interactable' { + interface Interactable { + reflow: (action: ActionProps) => ReturnType; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + _reflowPromise: Promise; + _reflowResolve: (...args: unknown[]) => void; + } +} +declare module '@interactjs/core/InteractEvent' { + interface PhaseMap { + reflow?: true; + } +} +export declare function install(scope: Scope): void; +declare function doReflow(interactable: Interactable, action: ActionProps, scope: Scope): Promise; +declare const reflow: Plugin; +export default reflow; diff --git a/packages/@interactjs/reflow/plugin.js b/packages/@interactjs/reflow/plugin.js new file mode 100644 index 000000000..e69feb5b9 --- /dev/null +++ b/packages/@interactjs/reflow/plugin.js @@ -0,0 +1,145 @@ +import * as arr from "../utils/arr.js"; +import { copyAction } from "../utils/misc.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; +import { tlbrToXywh } from "../utils/rect.js"; +export function install(scope) { + const { + /** @lends Interactable */ + 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 doReflow(this, action, scope); + }; +} + +function doReflow(interactable, action, scope) { + const elements = interactable.getAllElements(); // tslint:disable-next-line variable-name + + const Promise = scope.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 = 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.prevEvent = event; + interaction.updatePointer(event, event, element, true); + pointerUtils.setZeroCoords(interaction.coords.delta); + copyAction(interaction.prepared, action); + + interaction._doPhase(signalArg); + + const { + Promise + } = scope.window; + const reflowPromise = Promise ? new Promise(resolve => { + interaction._reflowResolve = resolve; + }) : undefined; + interaction._reflowPromise = reflowPromise; + interaction.start(action, interactable, element); + + if (interaction._interacting) { + interaction.move(signalArg); + interaction.end(event); + } else { + interaction.stop(); + + interaction._reflowResolve(); + } + + interaction.removePointer(event, event); + return reflowPromise; +} + +const reflow = { + 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); + } + } + } +}; +export default reflow; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/reflow/plugin.js.map b/packages/@interactjs/reflow/plugin.js.map new file mode 100644 index 000000000..86f2800d7 --- /dev/null +++ b/packages/@interactjs/reflow/plugin.js.map @@ -0,0 +1,81 @@ +{ + "version": 3, + "names": [ + "arr", + "copyAction", + "pointerUtils", + "tlbrToXywh", + "install", + "scope", + "Interactable", + "actions", + "phases", + "reflow", + "prototype", + "action", + "doReflow", + "interactable", + "elements", + "getAllElements", + "Promise", + "window", + "promises", + "element", + "rect", + "getRect", + "runningInteraction", + "find", + "interactions", + "list", + "interaction", + "interacting", + "prepared", + "name", + "reflowPromise", + "move", + "_reflowPromise", + "resolve", + "_reflowResolve", + "xywh", + "coords", + "page", + "x", + "y", + "client", + "timeStamp", + "now", + "event", + "coordsToEvent", + "startReflow", + "push", + "all", + "then", + "new", + "pointerType", + "signalArg", + "pointer", + "eventTarget", + "phase", + "prevEvent", + "updatePointer", + "setZeroCoords", + "delta", + "_doPhase", + "undefined", + "start", + "_interacting", + "end", + "stop", + "removePointer", + "id", + "listeners", + "remove" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { DoAnyPhaseArg, Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, ActionProps, Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport { copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport { tlbrToXywh } from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-reflow': Omit\n 'interactions:action-reflow': DoAnyPhaseArg\n 'interactions:after-action-reflow': DoAnyPhaseArg\n }\n}\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: (...args: unknown[]) => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\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: ActionProps) {\n return doReflow(this, action, scope)\n }\n}\n\nfunction doReflow (\n interactable: Interactable,\n action: ActionProps,\n scope: Scope,\n): Promise {\n const elements = interactable.getAllElements()\n\n // tslint:disable-next-line variable-name\n const Promise = (scope.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) {\n break\n }\n\n const runningInteraction = arr.find(scope.interactions.list, (interaction: Interaction) => {\n return (\n interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n )\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise =\n runningInteraction._reflowPromise ||\n new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n } else {\n const xywh = 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 (\n scope: Scope,\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n event: any,\n) {\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.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n pointerUtils.setZeroCoords(interaction.coords.delta)\n\n copyAction(interaction.prepared, action)\n interaction._doPhase(signalArg)\n\n const { Promise } = scope.window as unknown as { Promise: PromiseConstructor }\n const reflowPromise = Promise\n ? new Promise((resolve) => {\n interaction._reflowResolve = resolve\n })\n : undefined\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 } else {\n interaction.stop()\n interaction._reflowResolve()\n }\n\n interaction.removePointer(event, event)\n\n return reflowPromise\n}\n\nconst reflow: Plugin = {\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}\n\nexport default reflow\n" + ], + "mappings": "AAIA,OAAO,KAAKA,GAAZ,MAAqB,iBAArB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAO,KAAKC,YAAZ,MAA8B,0BAA9B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AA6BA,OAAO,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;EACrC,MAAM;IACJ;IACAC;EAFI,IAGFD,KAHJ;EAKAA,KAAK,CAACE,OAAN,CAAcC,MAAd,CAAqBC,MAArB,GAA8B,IAA9B;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EACEH,YAAY,CAACI,SAAb,CAAuBD,MAAvB,GAAgC,UAAUE,MAAV,EAA+B;IAC7D,OAAOC,QAAQ,CAAC,IAAD,EAAOD,MAAP,EAAeN,KAAf,CAAf;EACD,CAFD;AAGD;;AAED,SAASO,QAAT,CACEC,YADF,EAEEF,MAFF,EAGEN,KAHF,EAIyB;EACvB,MAAMS,QAAQ,GAAGD,YAAY,CAACE,cAAb,EAAjB,CADuB,CAGvB;;EACA,MAAMC,OAAO,GAAI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B;EACD,CAFC,CADyB,GAIzB2B,SAJJ;EAMAlC,WAAW,CAACM,cAAZ,GAA6BF,aAA7B;EACAJ,WAAW,CAACmC,KAAZ,CAAkBlD,MAAlB,EAA0BE,YAA1B,EAAwCM,OAAxC;;EAEA,IAAIO,WAAW,CAACoC,YAAhB,EAA8B;IAC5BpC,WAAW,CAACK,IAAZ,CAAiBoB,SAAjB;IACAzB,WAAW,CAACqC,GAAZ,CAAgBpB,KAAhB;EACD,CAHD,MAGO;IACLjB,WAAW,CAACsC,IAAZ;;IACAtC,WAAW,CAACQ,cAAZ;EACD;;EAEDR,WAAW,CAACuC,aAAZ,CAA0BtB,KAA1B,EAAiCA,KAAjC;EAEA,OAAOb,aAAP;AACD;;AAED,MAAMrB,MAAc,GAAG;EACrByD,EAAE,EAAE,QADiB;EAErB9D,OAFqB;EAGrB+D,SAAS,EAAE;IACT;IACA,qBAAqB,CAAC;MAAEzC;IAAF,CAAD,EAAkBrB,KAAlB,KAA4B;MAC/C,IAAIqB,WAAW,CAACwB,WAAZ,KAA4B,QAAhC,EAA0C;QACxC,IAAIxB,WAAW,CAACQ,cAAhB,EAAgC;UAC9BR,WAAW,CAACQ,cAAZ;QACD;;QAEDlC,GAAG,CAACoE,MAAJ,CAAW/D,KAAK,CAACmB,YAAN,CAAmBC,IAA9B,EAAoCC,WAApC;MACD;IACF;EAVQ;AAHU,CAAvB;AAiBA,eAAejB,MAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/reflow/plugin.prod.js b/packages/@interactjs/reflow/plugin.prod.js new file mode 100644 index 000000000..a63f1fe8a --- /dev/null +++ b/packages/@interactjs/reflow/plugin.prod.js @@ -0,0 +1,2 @@ +import*as e from"../utils/arr.prod.js";import{copyAction as t}from"../utils/misc.prod.js";import*as o from"../utils/pointerUtils.prod.js";import{tlbrToXywh as r}from"../utils/rect.prod.js";export function install(t){const{Interactable:i}=t;t.actions.phases.reflow=!0,i.prototype.reflow=function(i){return((t,i,s)=>{const l=t.getAllElements(),a=s.window.Promise,p=a?[]:null;for(const c of l){const l=t.getRect(c);if(!l)break;const f=e.find(s.interactions.list,(e=>e.interacting()&&e.interactable===t&&e.element===c&&e.prepared.name===i.name));let m;if(f)f.move(),p&&(m=f._reflowPromise||new a((e=>{f._reflowResolve=e})));else{const e=r(l),a={page:{x:e.x,y:e.y},client:{x:e.x,y:e.y},timeStamp:s.now()},p=o.coordsToEvent(a);m=n(s,t,c,i,p)}p&&p.push(m)}return p&&a.all(p).then((()=>t))})(this,i,t)}}function n(e,r,n,i,s){const l=e.interactions.new({pointerType:"reflow"}),a={interaction:l,event:s,pointer:s,eventTarget:n,phase:"reflow"};l.interactable=r,l.element=n,l.prevEvent=s,l.updatePointer(s,s,n,!0),o.setZeroCoords(l.coords.delta),t(l.prepared,i),l._doPhase(a);const{Promise:p}=e.window,c=p?new p((e=>{l._reflowResolve=e})):void 0;return l._reflowPromise=c,l.start(i,r,n),l._interacting?(l.move(a),l.end(s)):(l.stop(),l._reflowResolve()),l.removePointer(s,s),c}const i={id:"reflow",install:install,listeners:{"interactions:stop"({interaction:t},o){"reflow"===t.pointerType&&(t._reflowResolve&&t._reflowResolve(),e.remove(o.interactions.list,t))}}};export default i; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/reflow/plugin.prod.js.map b/packages/@interactjs/reflow/plugin.prod.js.map new file mode 100644 index 000000000..708601f07 --- /dev/null +++ b/packages/@interactjs/reflow/plugin.prod.js.map @@ -0,0 +1,82 @@ +{ + "version": 3, + "names": [ + "arr", + "copyAction", + "pointerUtils", + "tlbrToXywh", + "install", + "scope", + "Interactable", + "actions", + "phases", + "reflow", + "prototype", + "action", + "interactable", + "elements", + "getAllElements", + "Promise", + "window", + "promises", + "element", + "rect", + "getRect", + "runningInteraction", + "find", + "interactions", + "list", + "interaction", + "interacting", + "prepared", + "name", + "reflowPromise", + "move", + "_reflowPromise", + "resolve", + "_reflowResolve", + "xywh", + "coords", + "page", + "x", + "y", + "client", + "timeStamp", + "now", + "event", + "coordsToEvent", + "startReflow", + "push", + "all", + "then", + "doReflow", + "this", + "new", + "pointerType", + "signalArg", + "pointer", + "eventTarget", + "phase", + "prevEvent", + "updatePointer", + "setZeroCoords", + "delta", + "_doPhase", + "undefined", + "start", + "_interacting", + "end", + "stop", + "removePointer", + "id", + "listeners", + "remove" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { DoAnyPhaseArg, Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, ActionProps, Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport { copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport { tlbrToXywh } from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-reflow': Omit\n 'interactions:action-reflow': DoAnyPhaseArg\n 'interactions:after-action-reflow': DoAnyPhaseArg\n }\n}\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: (...args: unknown[]) => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\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: ActionProps) {\n return doReflow(this, action, scope)\n }\n}\n\nfunction doReflow (\n interactable: Interactable,\n action: ActionProps,\n scope: Scope,\n): Promise {\n const elements = interactable.getAllElements()\n\n // tslint:disable-next-line variable-name\n const Promise = (scope.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) {\n break\n }\n\n const runningInteraction = arr.find(scope.interactions.list, (interaction: Interaction) => {\n return (\n interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n )\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise =\n runningInteraction._reflowPromise ||\n new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n } else {\n const xywh = 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 (\n scope: Scope,\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n event: any,\n) {\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.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n pointerUtils.setZeroCoords(interaction.coords.delta)\n\n copyAction(interaction.prepared, action)\n interaction._doPhase(signalArg)\n\n const { Promise } = scope.window as unknown as { Promise: PromiseConstructor }\n const reflowPromise = Promise\n ? new Promise((resolve) => {\n interaction._reflowResolve = resolve\n })\n : undefined\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 } else {\n interaction.stop()\n interaction._reflowResolve()\n }\n\n interaction.removePointer(event, event)\n\n return reflowPromise\n}\n\nconst reflow: Plugin = {\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}\n\nexport default reflow\n" + ], + "mappings": "UAIYA,MAAS,4CACZC,MAAkB,kCACfC,MAAkB,qDACrBC,MAAkB,+BA6BpB,SAASC,QAASC,GACvB,MAAMC,aAEJA,GACED,EAEJA,EAAME,QAAQC,OAAOC,QAAS,EAkB9BH,EAAaI,UAAUD,OAAS,SAAUE,GACxC,MAIJ,EACEC,EACAD,EACAN,KAEA,MAAMQ,EAAWD,EAAaE,iBAGxBC,EAAWV,EAAMW,OAAeD,QAChCE,EAAwCF,EAAU,GAAK,KAE7D,IAAK,MAAMG,KAAWL,EAAU,CAC9B,MAAMM,EAAOP,EAAaQ,QAAQF,GAElC,IAAKC,EACH,MAGF,MAAME,EAAqBrB,EAAIsB,KAAKjB,EAAMkB,aAAaC,MAAOC,GAE1DA,EAAYC,eACZD,EAAYb,eAAiBA,GAC7Ba,EAAYP,UAAYA,GACxBO,EAAYE,SAASC,OAASjB,EAAOiB,OAGzC,IAAIC,EAEJ,GAAIR,EACFA,EAAmBS,OAEfb,IACFY,EACER,EAAmBU,gBACnB,IAAIhB,GAASiB,IACXX,EAAmBY,eAAiBD,UAGrC,CACL,MAAME,EAAO/B,EAAWgB,GAClBgB,EAAS,CACbC,KAAM,CAAEC,EAAGH,EAAKG,EAAGC,EAAGJ,EAAKI,GAC3BC,OAAQ,CAAEF,EAAGH,EAAKG,EAAGC,EAAGJ,EAAKI,GAC7BE,UAAWnC,EAAMoC,OAGbC,EAAQxC,EAAayC,cAAcR,GACzCN,EAAgBe,EAAevC,EAAOO,EAAcM,EAASP,EAAQ+B,GAGnEzB,GACFA,EAAS4B,KAAKhB,GAIlB,OAAOZ,GAAYF,EAAQ+B,IAAI7B,GAAU8B,MAAK,IAAMnC,KA3D3CoC,CAASC,KAAMtC,EAAQN,IA8DlC,SAASuC,EACPvC,EACAO,EACAM,EACAP,EACA+B,GAEA,MAAMjB,EAAcpB,EAAMkB,aAAa2B,IAAI,CAAEC,YAAa,WACpDC,EAAY,CAChB3B,cACAiB,QACAW,QAASX,EACTY,YAAapC,EACbqC,MAAO,UAGT9B,EAAYb,aAAeA,EAC3Ba,EAAYP,QAAUA,EACtBO,EAAY+B,UAAYd,EACxBjB,EAAYgC,cAAcf,EAAOA,EAAOxB,GAAS,GACjDhB,EAAawD,cAAcjC,EAAYU,OAAOwB,OAE9C1D,EAAWwB,EAAYE,SAAUhB,GACjCc,EAAYmC,SAASR,GAErB,MAAMrC,QAAEA,GAAYV,EAAMW,OACpBa,EAAgBd,EAClB,IAAIA,GAAoBiB,IACxBP,EAAYQ,eAAiBD,UAE7B6B,EAeJ,OAbApC,EAAYM,eAAiBF,EAC7BJ,EAAYqC,MAAMnD,EAAQC,EAAcM,GAEpCO,EAAYsC,cACdtC,EAAYK,KAAKsB,GACjB3B,EAAYuC,IAAItB,KAEhBjB,EAAYwC,OACZxC,EAAYQ,kBAGdR,EAAYyC,cAAcxB,EAAOA,GAE1Bb,EAGT,MAAMpB,EAAiB,CACrB0D,GAAI,SACJ/D,gBACAgE,UAAW,CAET,qBAAwB3C,eAAepB,GACL,WAA5BoB,EAAY0B,cACV1B,EAAYQ,gBACdR,EAAYQ,iBAGdjC,EAAIqE,OAAOhE,EAAMkB,aAAaC,KAAMC,sBAM7BhB" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/.npmignore b/packages/@interactjs/snappers/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/snappers/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/snappers/LICENSE b/packages/@interactjs/snappers/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@interactjs/snappers/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/packages/@interactjs/snappers/all.d.ts b/packages/@interactjs/snappers/all.d.ts new file mode 100644 index 000000000..87a63ac90 --- /dev/null +++ b/packages/@interactjs/snappers/all.d.ts @@ -0,0 +1,3 @@ +export { default as edgeTarget } from './edgeTarget'; +export { default as elements } from './elements'; +export { default as grid } from './grid'; diff --git a/packages/@interactjs/snappers/all.js b/packages/@interactjs/snappers/all.js new file mode 100644 index 000000000..b25a5a281 --- /dev/null +++ b/packages/@interactjs/snappers/all.js @@ -0,0 +1,5 @@ +/* eslint-disable import/no-named-as-default, import/no-unresolved */ +export { default as edgeTarget } from './edgeTarget'; +export { default as elements } from './elements'; +export { default as grid } from './grid'; +//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/all.js.map b/packages/@interactjs/snappers/all.js.map new file mode 100644 index 000000000..e20655111 --- /dev/null +++ b/packages/@interactjs/snappers/all.js.map @@ -0,0 +1,16 @@ +{ + "version": 3, + "names": [ + "default", + "edgeTarget", + "elements", + "grid" + ], + "sources": [ + "all.ts" + ], + "sourcesContent": [ + "/* eslint-disable import/no-named-as-default, import/no-unresolved */\nexport { default as edgeTarget } from './edgeTarget'\nexport { default as elements } from './elements'\nexport { default as grid } from './grid'\n" + ], + "mappings": "AAAA;AACA,SAASA,OAAO,IAAIC,UAApB,QAAsC,cAAtC;AACA,SAASD,OAAO,IAAIE,QAApB,QAAoC,YAApC;AACA,SAASF,OAAO,IAAIG,IAApB,QAAgC,QAAhC" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/all.prod.js b/packages/@interactjs/snappers/all.prod.js new file mode 100644 index 000000000..8bd57d9e2 --- /dev/null +++ b/packages/@interactjs/snappers/all.prod.js @@ -0,0 +1,2 @@ +export{default as edgeTarget}from"./edgeTarget";export{default as elements}from"./elements";export{default as grid}from"./grid"; +//# sourceMappingURL=all.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/all.prod.js.map b/packages/@interactjs/snappers/all.prod.js.map new file mode 100644 index 000000000..ab7b95ccd --- /dev/null +++ b/packages/@interactjs/snappers/all.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "default" + ], + "sources": [ + "all.ts" + ], + "sourcesContent": [ + "/* eslint-disable import/no-named-as-default, import/no-unresolved */\nexport { default as edgeTarget } from './edgeTarget'\nexport { default as elements } from './elements'\nexport { default as grid } from './grid'\n" + ], + "mappings": "OACSA,0BAA6B,sBAC7BA,wBAA2B,oBAC3BA,oBAAuB" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/edgeTarget.d.ts b/packages/@interactjs/snappers/edgeTarget.d.ts new file mode 100644 index 000000000..4cab5535a --- /dev/null +++ b/packages/@interactjs/snappers/edgeTarget.d.ts @@ -0,0 +1,2 @@ +declare const _default: () => void; +export default _default; diff --git a/packages/@interactjs/snappers/edgeTarget.js b/packages/@interactjs/snappers/edgeTarget.js new file mode 100644 index 000000000..0f6ece874 --- /dev/null +++ b/packages/@interactjs/snappers/edgeTarget.js @@ -0,0 +1,2 @@ +export default (() => {}); +//# sourceMappingURL=edgeTarget.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/edgeTarget.js.map b/packages/@interactjs/snappers/edgeTarget.js.map new file mode 100644 index 000000000..fb2b479cb --- /dev/null +++ b/packages/@interactjs/snappers/edgeTarget.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "edgeTarget.ts" + ], + "sourcesContent": [ + "export default () => {}\n" + ], + "mappings": "AAAA,gBAAe,MAAM,CAAE,CAAvB" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/edgeTarget.prod.js b/packages/@interactjs/snappers/edgeTarget.prod.js new file mode 100644 index 000000000..857790463 --- /dev/null +++ b/packages/@interactjs/snappers/edgeTarget.prod.js @@ -0,0 +1,2 @@ +export default()=>{}; +//# sourceMappingURL=edgeTarget.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/edgeTarget.prod.js.map b/packages/@interactjs/snappers/edgeTarget.prod.js.map new file mode 100644 index 000000000..356cd920b --- /dev/null +++ b/packages/@interactjs/snappers/edgeTarget.prod.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "edgeTarget.ts" + ], + "sourcesContent": [ + "export default () => {}\n" + ], + "mappings": "cAAA" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/edgeTarget.stub.d.ts b/packages/@interactjs/snappers/edgeTarget.stub.d.ts new file mode 100644 index 000000000..4cab5535a --- /dev/null +++ b/packages/@interactjs/snappers/edgeTarget.stub.d.ts @@ -0,0 +1,2 @@ +declare const _default: () => void; +export default _default; diff --git a/packages/@interactjs/snappers/elements.d.ts b/packages/@interactjs/snappers/elements.d.ts new file mode 100644 index 000000000..4cab5535a --- /dev/null +++ b/packages/@interactjs/snappers/elements.d.ts @@ -0,0 +1,2 @@ +declare const _default: () => void; +export default _default; diff --git a/packages/@interactjs/snappers/elements.js b/packages/@interactjs/snappers/elements.js new file mode 100644 index 000000000..02d94bb9e --- /dev/null +++ b/packages/@interactjs/snappers/elements.js @@ -0,0 +1,2 @@ +export default (() => {}); +//# sourceMappingURL=elements.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/elements.js.map b/packages/@interactjs/snappers/elements.js.map new file mode 100644 index 000000000..4b626642d --- /dev/null +++ b/packages/@interactjs/snappers/elements.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "elements.ts" + ], + "sourcesContent": [ + "export default () => {}\n" + ], + "mappings": "AAAA,gBAAe,MAAM,CAAE,CAAvB" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/elements.prod.js b/packages/@interactjs/snappers/elements.prod.js new file mode 100644 index 000000000..bcf982b62 --- /dev/null +++ b/packages/@interactjs/snappers/elements.prod.js @@ -0,0 +1,2 @@ +export default()=>{}; +//# sourceMappingURL=elements.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/elements.prod.js.map b/packages/@interactjs/snappers/elements.prod.js.map new file mode 100644 index 000000000..bf58efcec --- /dev/null +++ b/packages/@interactjs/snappers/elements.prod.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "elements.ts" + ], + "sourcesContent": [ + "export default () => {}\n" + ], + "mappings": "cAAA" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/elements.stub.d.ts b/packages/@interactjs/snappers/elements.stub.d.ts new file mode 100644 index 000000000..4cab5535a --- /dev/null +++ b/packages/@interactjs/snappers/elements.stub.d.ts @@ -0,0 +1,2 @@ +declare const _default: () => void; +export default _default; diff --git a/packages/@interactjs/snappers/grid.d.ts b/packages/@interactjs/snappers/grid.d.ts new file mode 100644 index 000000000..e5eb4517c --- /dev/null +++ b/packages/@interactjs/snappers/grid.d.ts @@ -0,0 +1,12 @@ +import type { Rect, Point } from '@interactjs/core/types'; +import type { SnapFunction } from '@interactjs/modifiers/snap/pointer'; +export declare type GridOptions = (Partial | Point) & { + range?: number; + limits?: Rect; + offset?: Point; +}; +declare const _default: (grid: GridOptions) => SnapFunction & { + grid: GridOptions; + coordFields: (readonly ["x", "y"] | readonly ["left", "top"] | readonly ["right", "bottom"] | readonly ["width", "height"])[]; +}; +export default _default; diff --git a/packages/@interactjs/snappers/grid.js b/packages/@interactjs/snappers/grid.js new file mode 100644 index 000000000..8d1fb3a7f --- /dev/null +++ b/packages/@interactjs/snappers/grid.js @@ -0,0 +1,39 @@ +export default (grid => { + const coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(([xField, yField]) => xField in grid || yField in grid); + + const gridFunc = (x, y) => { + const { + range, + limits = { + left: -Infinity, + right: Infinity, + top: -Infinity, + bottom: Infinity + }, + offset = { + x: 0, + y: 0 + } + } = grid; + const result = { + range, + grid, + x: null, + y: null + }; + + for (const [xField, yField] of coordFields) { + const gridx = Math.round((x - offset.x) / grid[xField]); + const 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; +}); +//# sourceMappingURL=grid.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/grid.js.map b/packages/@interactjs/snappers/grid.js.map new file mode 100644 index 000000000..cbd8e8931 --- /dev/null +++ b/packages/@interactjs/snappers/grid.js.map @@ -0,0 +1,35 @@ +{ + "version": 3, + "names": [ + "grid", + "coordFields", + "filter", + "xField", + "yField", + "gridFunc", + "x", + "y", + "range", + "limits", + "left", + "Infinity", + "right", + "top", + "bottom", + "offset", + "result", + "gridx", + "Math", + "round", + "gridy", + "max", + "min" + ], + "sources": [ + "grid.ts" + ], + "sourcesContent": [ + "import type { Rect, Point } from '@interactjs/core/types'\nimport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type GridOptions = (Partial | Point) & {\n range?: number\n limits?: Rect\n offset?: Point\n}\n\nexport default (grid: GridOptions) => {\n const coordFields = (\n [\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const\n ).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: 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: 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" + ], + "mappings": "AASA,gBAAgBA,IAAD,IAAuB;EACpC,MAAMC,WAAW,GACf,CACE,CAAC,GAAD,EAAM,GAAN,CADF,EAEE,CAAC,MAAD,EAAS,KAAT,CAFF,EAGE,CAAC,OAAD,EAAU,QAAV,CAHF,EAIE,CAAC,OAAD,EAAU,QAAV,CAJF,CADkB,CAOlBC,MAPkB,CAOX,CAAC,CAACC,MAAD,EAASC,MAAT,CAAD,KAAsBD,MAAM,IAAIH,IAAV,IAAkBI,MAAM,IAAIJ,IAPvC,CAApB;;EASA,MAAMK,QAGL,GAAG,CAACC,CAAD,EAAIC,CAAJ,KAAU;IACZ,MAAM;MACJC,KAD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,GAAuBA,WAAvB;EAEA,OAAOI,QAAP;AACD,CA5CD" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/grid.prod.js b/packages/@interactjs/snappers/grid.prod.js new file mode 100644 index 000000000..9d8436d5e --- /dev/null +++ b/packages/@interactjs/snappers/grid.prod.js @@ -0,0 +1,2 @@ +export default t=>{const o=[["x","y"],["left","top"],["right","bottom"],["width","height"]].filter((([o,r])=>o in t||r in t)),r=(r,n)=>{const{range:i,limits:e={left:-1/0,right:1/0,top:-1/0,bottom:1/0},offset:h={x:0,y:0}}=t,a={range:i,grid:t,x:null,y:null};for(const[i,l]of o){const o=Math.round((r-h.x)/t[i]),f=Math.round((n-h.y)/t[l]);a[i]=Math.max(e.left,Math.min(e.right,o*t[i]+h.x)),a[l]=Math.max(e.top,Math.min(e.bottom,f*t[l]+h.y))}return a};return r.grid=t,r.coordFields=o,r}; +//# sourceMappingURL=grid.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/grid.prod.js.map b/packages/@interactjs/snappers/grid.prod.js.map new file mode 100644 index 000000000..657cf4b67 --- /dev/null +++ b/packages/@interactjs/snappers/grid.prod.js.map @@ -0,0 +1,35 @@ +{ + "version": 3, + "names": [ + "grid", + "coordFields", + "filter", + "xField", + "yField", + "gridFunc", + "x", + "y", + "range", + "limits", + "left", + "right", + "Infinity", + "top", + "bottom", + "offset", + "result", + "gridx", + "Math", + "round", + "gridy", + "max", + "min" + ], + "sources": [ + "grid.ts" + ], + "sourcesContent": [ + "import type { Rect, Point } from '@interactjs/core/types'\nimport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type GridOptions = (Partial | Point) & {\n range?: number\n limits?: Rect\n offset?: Point\n}\n\nexport default (grid: GridOptions) => {\n const coordFields = (\n [\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const\n ).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: 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: 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" + ], + "mappings": "eASgBA,IACd,MAAMC,EACJ,CACE,CAAC,IAAK,KACN,CAAC,OAAQ,OACT,CAAC,QAAS,UACV,CAAC,QAAS,WAEZC,QAAO,EAAEC,EAAQC,KAAYD,KAAUH,GAAQI,KAAUJ,IAErDK,EAGF,CAACC,EAAGC,KACN,MAAMC,MACJA,EADIC,OAEJA,EAAS,CACPC,MAAM,IACNC,MAAOC,IACPC,KAAK,IACLC,OAAQF,KANNG,OAQJA,EAAS,CAAET,EAAG,EAAGC,EAAG,IAClBP,EAEEgB,EAEF,CAAER,QAAOR,OAAMM,EAAG,KAAgBC,EAAG,MAEzC,IAAK,MAAOJ,EAAQC,KAAWH,EAAa,CAC1C,MAAMgB,EAAQC,KAAKC,OAAOb,EAAIS,EAAOT,GAAMN,EAAaG,IAClDiB,EAAQF,KAAKC,OAAOZ,EAAIQ,EAAOR,GAAMP,EAAaI,IAExDY,EAAOb,GAAUe,KAAKG,IAAIZ,EAAOC,KAAMQ,KAAKI,IAAIb,EAAOE,MAAOM,EAASjB,EAAaG,GAAUY,EAAOT,IACrGU,EAAOZ,GAAUc,KAAKG,IAAIZ,EAAOI,IAAKK,KAAKI,IAAIb,EAAOK,OAAQM,EAASpB,EAAaI,GAAUW,EAAOR,IAGvG,OAAOS,GAMT,OAHAX,EAASL,KAAOA,EAChBK,EAASJ,YAAcA,EAEhBI" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/index.d.ts b/packages/@interactjs/snappers/index.d.ts new file mode 100644 index 000000000..fc81c7ffe --- /dev/null +++ b/packages/@interactjs/snappers/index.d.ts @@ -0,0 +1 @@ +import '@interactjs/snappers/plugin'; diff --git a/packages/@interactjs/snappers/index.js b/packages/@interactjs/snappers/index.js new file mode 100644 index 000000000..f66977a39 --- /dev/null +++ b/packages/@interactjs/snappers/index.js @@ -0,0 +1,6 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import "./plugin.js"; +import interact from "../interact/index.js"; +import plugin from "./plugin.js"; +interact.use(plugin); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/index.js.map b/packages/@interactjs/snappers/index.js.map new file mode 100644 index 000000000..edf25643d --- /dev/null +++ b/packages/@interactjs/snappers/index.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/snappers/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/snappers/plugin'\ninteract.use(plugin)" + ], + "mappings": "AAAA;AACA,OAAO,aAAP;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACAD,QAAQ,CAACE,GAAT,CAAaD,MAAb" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/index.prod.js b/packages/@interactjs/snappers/index.prod.js new file mode 100644 index 000000000..da0047645 --- /dev/null +++ b/packages/@interactjs/snappers/index.prod.js @@ -0,0 +1,2 @@ +import"./plugin.prod.js";import r from"../interact/index.prod.js";import o from"./plugin.prod.js";r.use(o); +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/index.prod.js.map b/packages/@interactjs/snappers/index.prod.js.map new file mode 100644 index 000000000..90039cd3a --- /dev/null +++ b/packages/@interactjs/snappers/index.prod.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "names": [ + "interact", + "plugin", + "use" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */\nimport '@interactjs/snappers/plugin'\nimport interact from '@interactjs/interact/index'\nimport plugin from '@interactjs/snappers/plugin'\ninteract.use(plugin)" + ], + "mappings": "MACO,0BACAA,MAAc,mCACdC,MAAY,mBACnBD,EAASE,IAAID" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/index.ts b/packages/@interactjs/snappers/index.ts new file mode 100644 index 000000000..5f45adeac --- /dev/null +++ b/packages/@interactjs/snappers/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console, eol-last, import/no-duplicates, import/no-extraneous-dependencies, import/order */ +import '@interactjs/snappers/plugin' +import interact from '@interactjs/interact/index' +import plugin from '@interactjs/snappers/plugin' +interact.use(plugin) \ No newline at end of file diff --git a/packages/@interactjs/snappers/plugin.d.ts b/packages/@interactjs/snappers/plugin.d.ts new file mode 100644 index 000000000..224cc5c4f --- /dev/null +++ b/packages/@interactjs/snappers/plugin.d.ts @@ -0,0 +1,10 @@ +import type { Plugin } from '@interactjs/core/scope'; +import * as allSnappers from './all'; +declare module '@interactjs/core/InteractStatic' { + interface InteractStatic { + snappers: typeof allSnappers; + createSnapGrid: typeof allSnappers.grid; + } +} +declare const snappersPlugin: Plugin; +export default snappersPlugin; diff --git a/packages/@interactjs/snappers/plugin.js b/packages/@interactjs/snappers/plugin.js new file mode 100644 index 000000000..63f638d8f --- /dev/null +++ b/packages/@interactjs/snappers/plugin.js @@ -0,0 +1,16 @@ +import extend from "../utils/extend.js"; +import * as allSnappers from './all'; +const snappersPlugin = { + id: 'snappers', + + install(scope) { + const { + interactStatic: interact + } = scope; + interact.snappers = extend(interact.snappers || {}, allSnappers); + interact.createSnapGrid = interact.snappers.grid; + } + +}; +export default snappersPlugin; +//# sourceMappingURL=plugin.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/plugin.js.map b/packages/@interactjs/snappers/plugin.js.map new file mode 100644 index 000000000..85346e78e --- /dev/null +++ b/packages/@interactjs/snappers/plugin.js.map @@ -0,0 +1,23 @@ +{ + "version": 3, + "names": [ + "extend", + "allSnappers", + "snappersPlugin", + "id", + "install", + "scope", + "interactStatic", + "interact", + "snappers", + "createSnapGrid", + "grid" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Plugin } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\nimport * as allSnappers from './all'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n snappers: typeof allSnappers\n createSnapGrid: typeof allSnappers.grid\n }\n}\n\nconst snappersPlugin: Plugin = {\n id: 'snappers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n interact.snappers = extend(interact.snappers || {}, allSnappers)\n interact.createSnapGrid = interact.snappers.grid\n },\n}\n\nexport default snappersPlugin\n" + ], + "mappings": "AACA,OAAOA,MAAP,MAAmB,oBAAnB;AAEA,OAAO,KAAKC,WAAZ,MAA6B,OAA7B;AASA,MAAMC,cAAsB,GAAG;EAC7BC,EAAE,EAAE,UADyB;;EAE7BC,OAAO,CAAEC,KAAF,EAAS;IACd,MAAM;MAAEC,cAAc,EAAEC;IAAlB,IAA+BF,KAArC;IAEAE,QAAQ,CAACC,QAAT,GAAoBR,MAAM,CAACO,QAAQ,CAACC,QAAT,IAAqB,EAAtB,EAA0BP,WAA1B,CAA1B;IACAM,QAAQ,CAACE,cAAT,GAA0BF,QAAQ,CAACC,QAAT,CAAkBE,IAA5C;EACD;;AAP4B,CAA/B;AAUA,eAAeR,cAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/snappers/plugin.prod.js b/packages/@interactjs/snappers/plugin.prod.js new file mode 100644 index 000000000..47f1b51b6 --- /dev/null +++ b/packages/@interactjs/snappers/plugin.prod.js @@ -0,0 +1,2 @@ +import r from"../utils/extend.prod.js";import*as s from"./all";const t={id:"snappers",install(t){const{interactStatic:p}=t;p.snappers=r(p.snappers||{},s),p.createSnapGrid=p.snappers.grid}};export default t; +//# sourceMappingURL=plugin.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/snappers/plugin.prod.js.map b/packages/@interactjs/snappers/plugin.prod.js.map new file mode 100644 index 000000000..8568f061d --- /dev/null +++ b/packages/@interactjs/snappers/plugin.prod.js.map @@ -0,0 +1,23 @@ +{ + "version": 3, + "names": [ + "extend", + "allSnappers", + "snappersPlugin", + "id", + "install", + "scope", + "interactStatic", + "interact", + "snappers", + "createSnapGrid", + "grid" + ], + "sources": [ + "plugin.ts" + ], + "sourcesContent": [ + "import type { Plugin } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\nimport * as allSnappers from './all'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n snappers: typeof allSnappers\n createSnapGrid: typeof allSnappers.grid\n }\n}\n\nconst snappersPlugin: Plugin = {\n id: 'snappers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n interact.snappers = extend(interact.snappers || {}, allSnappers)\n interact.createSnapGrid = interact.snappers.grid\n },\n}\n\nexport default snappersPlugin\n" + ], + "mappings": "OACOA,MAAY,oCAEPC,MAAiB,QAS7B,MAAMC,EAAyB,CAC7BC,GAAI,WACJC,QAASC,GACP,MAAQC,eAAgBC,GAAaF,EAErCE,EAASC,SAAWR,EAAOO,EAASC,UAAY,GAAIP,GACpDM,EAASE,eAAiBF,EAASC,SAASE,sBAIjCR" +} \ No newline at end of file diff --git a/packages/@interactjs/types/.npmignore b/packages/@interactjs/types/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/types/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/types/LICENSE b/packages/@interactjs/types/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/types/index.d.ts b/packages/@interactjs/types/index.d.ts new file mode 100644 index 000000000..7563815be --- /dev/null +++ b/packages/@interactjs/types/index.d.ts @@ -0,0 +1,3043 @@ +declare module "@interactjs/utils/extend" { + export default function extend(dest: U & Partial, source: T): T & U; +} +declare module "@interactjs/core/options" { + import type { Point, Listeners, OrBoolean, Element, Rect } from "@interactjs/core/types"; + export interface Defaults { + base: BaseDefaults; + perAction: PerActionDefaults; + actions: ActionDefaults; + } + export interface ActionDefaults { + } + export interface BaseDefaults { + preventDefault?: 'auto' | 'never' | string; + deltaSource?: 'page' | 'client'; + context?: Node; + getRect?: (element: Element) => Rect; + } + export interface PerActionDefaults { + enabled?: boolean; + origin?: Point | string | Element; + listeners?: Listeners; + allowFrom?: string | Element; + ignoreFrom?: string | Element; + } + export type Options = Partial & Partial & { + [P in keyof ActionDefaults]?: Partial; + }; + export interface OptionsArg extends BaseDefaults, OrBoolean> { + } + export const defaults: Defaults; +} +declare module "@interactjs/utils/domObjects" { + 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; +} +declare module "@interactjs/utils/isWindow" { + const _default: (thing: any) => boolean; + export default _default; +} +declare module "@interactjs/utils/window" { + export let realWindow: Window; + let win: Window; + export { win as window }; + export function init(window: Window & { + wrap?: (...args: any[]) => any; + }): void; + export function getWindow(node: any): any; +} +declare module "@interactjs/utils/is" { + const _default_1: { + window: (thing: any) => thing is Window; + docFrag: (thing: any) => thing is DocumentFragment; + object: (thing: any) => thing is { + [index: string]: any; + }; + func: (thing: any) => thing is (...args: any[]) => any; + number: (thing: any) => thing is number; + bool: (thing: any) => thing is boolean; + string: (thing: any) => thing is string; + element: (thing: any) => thing is HTMLElement | SVGElement; + plainObject: (thing: any) => thing is { + [index: string]: any; + }; + array: (thing: any) => thing is T[]; + }; + export default _default_1; +} +declare module "@interactjs/utils/browser" { + const browser: { + init: typeof init; + supportsTouch: boolean; + supportsPointerEvent: boolean; + isIOS7: boolean; + isIOS: boolean; + isIe9: boolean; + isOperaMobile: boolean; + prefixedMatchesSelector: "matches"; + pEventTypes: { + up: string; + down: string; + over: string; + out: string; + move: string; + cancel: string; + }; + wheelEvent: string; + }; + function init(window: any): void; + export default browser; +} +declare module "@interactjs/utils/domUtils" { + import type { Rect, Target, Element } from "@interactjs/core/types"; + export function nodeContains(parent: Node, child: Node): boolean; + export function closest(element: Node, selector: string): HTMLElement | SVGElement; + export function parentNode(node: Node | Document): ParentNode; + export function matchesSelector(element: Element, selector: string): boolean; + export function indexOfDeepestElement(elements: Element[] | NodeListOf): number; + export function matchesUpTo(element: Element, selector: string, limit: Node): boolean; + export function getActualElement(element: Element): any; + export function getScrollXY(relevantWindow?: Window): { + x: number; + y: number; + }; + export function getElementClientRect(element: Element): Required; + export function getElementRect(element: Element): Required; + export function getPath(node: Node | Document): any[]; + export function trySelector(value: Target): boolean; +} +declare module "@interactjs/utils/rect" { + import type { HasGetRect, RectResolvable, Rect, Point, FullRect, EdgeOptions } from "@interactjs/core/types"; + export function getStringOptionResult(value: any, target: HasGetRect, element: Node): ParentNode | Rect; + export function resolveRectLike(value: RectResolvable, target?: HasGetRect, element?: Node, functionArgs?: T): Rect; + export function toFullRect(rect: Rect): FullRect; + export function rectToXY(rect: Rect | Point): { + x: number; + y: number; + }; + export function xywhToTlbr>(rect: T): Rect & T; + export function tlbrToXywh(rect: Rect & Partial): Required & Point; + export function addEdges(edges: EdgeOptions, rect: Rect, delta: Point): void; +} +declare module "@interactjs/utils/getOriginXY" { + import type { PerActionDefaults } from "@interactjs/core/options"; + import type { ActionName, HasGetRect } from "@interactjs/core/types"; + export default function getOriginXY(target: HasGetRect & { + options: PerActionDefaults; + }, element: Node, actionName?: ActionName): { + x: number; + y: number; + }; +} +declare module "@interactjs/utils/hypot" { + const _default_2: (x: number, y: number) => number; + export default _default_2; +} +declare module "@interactjs/utils/arr" { + type Filter = (element: T, index: number, array: T[]) => boolean; + export const contains: (array: T[], target: T) => boolean; + export const remove: (array: T[], target: T) => T[]; + export const merge: (target: (T | U)[], source: U[]) => (T | U)[]; + export const from: (source: ArrayLike) => T[]; + export const findIndex: (array: T[], func: Filter) => number; + export const find: (array: T[], func: Filter) => T; +} +declare module "@interactjs/utils/clone" { + export default function clone(source: T): Partial; +} +declare module "@interactjs/utils/isNonNativeEvent" { + import type { Actions } from "@interactjs/core/types"; + export default function isNonNativeEvent(type: string, actions: Actions): boolean; +} +declare module "@interactjs/utils/normalizeListeners" { + import type { EventTypes, Listener, ListenersArg } from "@interactjs/core/types"; + export interface NormalizedListeners { + [type: string]: Listener[]; + } + export default function normalize(type: EventTypes, listeners?: ListenersArg | ListenersArg[] | null, filter?: (_typeOrPrefix: string) => boolean, result?: NormalizedListeners): NormalizedListeners; +} +declare module "@interactjs/core/Eventable" { + import type { ListenersArg, Rect } from "@interactjs/core/types"; + import type { NormalizedListeners } from "@interactjs/utils/normalizeListeners"; + export class Eventable { + options: any; + types: NormalizedListeners; + propagationStopped: boolean; + immediatePropagationStopped: boolean; + global: any; + constructor(options?: { + [index: string]: any; + }); + fire(event: T): void; + on(type: string, listener: ListenersArg): void; + off(type: string, listener: ListenersArg): void; + getRect(_element: Element): Rect; + } +} +declare module "@interactjs/core/Interactable" { + import type { Scope } from "@interactjs/core/scope"; + import type { ActionName, Actions, Context, Element, EventTypes, Listeners, ListenersArg, OrBoolean, Target } from "@interactjs/core/types"; + import { Eventable } from "@interactjs/core/Eventable"; + import type { OptionsArg, Options } from "@interactjs/core/options"; + type IgnoreValue = string | Element | boolean; + type DeltaSource = 'page' | 'client'; + const enum OnOffMethod { + On = 0, + Off = 1 + } + /** */ + export class Interactable implements Partial { + readonly options: Required; + readonly _actions: Actions; + readonly target: Target; + readonly events: Eventable; + readonly _context: Context; + readonly _win: Window; + readonly _doc: Document; + readonly _scopeEvents: Scope['events']; + /** */ + constructor(target: Target, options: any, defaultContext: Document | Element, scopeEvents: Scope['events']); + setOnEvents(actionName: ActionName, phases: NonNullable): this; + updatePerActionListeners(actionName: ActionName, prev: Listeners | undefined, cur: Listeners | undefined): void; + setPerAction(actionName: ActionName, options: 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 {Rect} The object's bounding rectangle. + */ + getRect(element: Element): Required; + /** + * 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(): (element: Element) => any | null; + rectChecker(checker: (element: Element) => any): this; + _backCompatOption(optionName: keyof 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(): DeltaSource; + deltaSource(newValue: DeltaSource): this; + /** + * Gets the selector context Node of the Interactable. The default is + * `window.document`. + * + * @return {Node} The context Node of this Interactable + */ + context(): Context; + inContext(element: Document | Node): boolean; + testIgnoreAllow(this: Interactable, options: { + ignoreFrom?: IgnoreValue; + allowFrom?: IgnoreValue; + }, targetNode: Node, eventTarget: Node): boolean; + testAllow(this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node): boolean; + testIgnore(this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node): boolean; + /** + * 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: E): this; + _onOff(method: OnOffMethod, typeArg: EventTypes, listenerArg?: ListenersArg | null, options?: any, filter?: (type: string) => boolean): 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: EventTypes, listener?: 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[] | EventTypes, listener?: ListenersArg, options?: any): this; + /** + * Reset the options of this Interactable + * + * @param {object} options The new settings to apply + * @return {object} This Interactable + */ + set(options: OptionsArg): this; + /** + * Remove this interactable from the list of interactables and remove it's + * action capabilities and event listeners + */ + unset(): void; + } +} +declare module "@interactjs/core/BaseEvent" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Interaction, InteractionProxy } from "@interactjs/core/Interaction"; + import type { ActionName } from "@interactjs/core/types"; + export class BaseEvent { + type: string; + target: EventTarget; + currentTarget: Node; + interactable: Interactable; + _interaction: Interaction; + timeStamp: number; + immediatePropagationStopped: boolean; + propagationStopped: boolean; + constructor(interaction: 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 interface BaseEvent { + interaction: InteractionProxy; + } +} +declare module "@interactjs/core/InteractEvent" { + import type { Point, FullRect, PointerEventType, Element } from "@interactjs/core/types"; + import { BaseEvent } from "@interactjs/core/BaseEvent"; + import type { Interaction } from "@interactjs/core/Interaction"; + import type { ActionName } from "@interactjs/core/types"; + export type EventPhase = keyof PhaseMap; + export interface PhaseMap { + start: true; + move: true; + end: true; + } + export interface InteractEvent { + pageX: number; + pageY: number; + clientX: number; + clientY: number; + dx: number; + dy: number; + velocityX: number; + velocityY: number; + } + export class InteractEvent extends BaseEvent { + target: Element; + currentTarget: Element; + relatedTarget: Element | null; + screenX?: number; + screenY?: number; + button: number; + buttons: number; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; + page: Point; + client: Point; + delta: Point; + rect: FullRect; + x0: number; + y0: number; + t0: number; + dt: number; + duration: number; + clientX0: number; + clientY0: number; + velocity: Point; + speed: number; + swipe: ReturnType['getSwipe']>; + axes?: 'x' | 'y' | 'xy'; + preEnd?: boolean; + /** */ + constructor(interaction: Interaction, event: PointerEventType, actionName: T, phase: P, element: Element, preEnd?: boolean, type?: string); + 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; + } +} +declare module "@interactjs/core/NativeTypes" { + export const NativePointerEvent: PointerEvent; + export type NativeEventTarget = EventTarget; + export type NativeElement = Element; +} +declare module "@interactjs/core/types" { + import type Interaction from "@interactjs/core/Interaction"; + import type { PhaseMap, InteractEvent } from "@interactjs/core/InteractEvent"; + import type { Interactable } from "@interactjs/core/Interactable"; + import type { NativePointerEvent as NativePointerEvent_ } from "@interactjs/core/NativeTypes"; + export type OrBoolean = { + [P in keyof T]: T[P] | boolean; + }; + export type Element = HTMLElement | SVGElement; + export type Context = Document | Element; + export type EventTarget = Window | Document | Element; + export type Target = EventTarget | string; + export interface Point { + x: number; + y: number; + } + export interface Size { + width: number; + height: number; + } + export interface Rect { + top: number; + left: number; + bottom: number; + right: number; + width?: number; + height?: number; + } + export type FullRect = Required; + export type RectFunction = (...args: T) => Rect | Element; + export type RectResolvable = Rect | string | Element | RectFunction; + export type Dimensions = Point & Size; + export interface CoordsSetMember { + page: Point; + client: Point; + timeStamp: number; + } + export interface CoordsSet { + cur: CoordsSetMember; + prev: CoordsSetMember; + start: CoordsSetMember; + delta: CoordsSetMember; + velocity: CoordsSetMember; + } + export interface HasGetRect { + getRect(element: Element): Rect; + } + export interface ActionMap { + } + export type ActionName = keyof ActionMap; + export interface Actions { + map: ActionMap; + phases: PhaseMap; + methodDict: Record; + phaselessTypes: { + [type: string]: true; + }; + } + export interface ActionProps { + name: T; + axis?: 'x' | 'y' | 'xy' | null; + edges?: EdgeOptions | null; + } + export interface InertiaOption { + resistance?: number; + minSpeed?: number; + endSpeed?: number; + allowResume?: boolean; + smoothEndDuration?: number; + } + export type InertiaOptions = InertiaOption | boolean; + export interface EdgeOptions { + top?: boolean | string | Element; + left?: boolean | string | Element; + bottom?: boolean | string | Element; + right?: boolean | string | Element; + } + export type CursorChecker = (action: ActionProps, interactable: Interactable, element: Element, interacting: boolean) => string; + export interface ActionMethod { + (this: Interactable): T; + (this: Interactable, options?: Partial> | boolean): typeof this; + } + export interface OptionMethod { + (this: Interactable): T; + (this: Interactable, options: T): typeof this; + } + export type ActionChecker = (pointerEvent: any, defaultAction: string, interactable: Interactable, element: Element, interaction: Interaction) => ActionProps; + export type OriginFunction = (target: Element) => Rect; + export interface PointerEventsOptions { + holdDuration?: number; + allowFrom?: string; + ignoreFrom?: string; + origin?: Rect | Point | string | Element | OriginFunction; + } + export type RectChecker = (element: Element) => Rect; + export type NativePointerEventType = typeof NativePointerEvent_; + export type PointerEventType = MouseEvent | TouchEvent | Partial | InteractEvent; + export type PointerType = MouseEvent | Touch | Partial | InteractEvent; + export type EventTypes = string | ListenerMap | Array; + export type Listener = (...args: any[]) => any; + export type Listeners = ListenerMap | ListenerMap[]; + export type ListenersArg = Listener | ListenerMap | Array; + export interface ListenerMap { + [index: string]: ListenersArg | ListenersArg[]; + } + export type ArrayElementType = T extends Array ? P : never; +} +declare module "@interactjs/utils/misc" { + import type { ActionName, ActionProps } from "@interactjs/core/types"; + export function warnOnce(this: T, method: (...args: any[]) => any, message: string): (this: T) => any; + export function copyAction(dest: ActionProps, src: ActionProps): ActionProps; + export const sign: (n: number) => 1 | -1; +} +declare module "@interactjs/utils/pointerExtend" { + export default function pointerExtend(dest: Partial; + }>, source: T): Partial; + }>; +} +declare module "@interactjs/utils/pointerUtils" { + import type { InteractEvent } from "@interactjs/core/InteractEvent"; + import type { CoordsSetMember, PointerType, Point, PointerEventType } from "@interactjs/core/types"; + import pointerExtend from "@interactjs/utils/pointerExtend"; + export function copyCoords(dest: CoordsSetMember, src: CoordsSetMember): void; + export function setCoordDeltas(targetObj: CoordsSetMember, prev: CoordsSetMember, cur: CoordsSetMember): void; + export function setCoordVelocity(targetObj: CoordsSetMember, delta: CoordsSetMember): void; + export function setZeroCoords(targetObj: CoordsSetMember): void; + export function isNativePointer(pointer: any): boolean; + export function getXY(type: string, pointer: PointerType | InteractEvent, xy: Point): Point; + export function getPageXY(pointer: PointerType | InteractEvent, page?: Point): Point; + export function getClientXY(pointer: PointerType, client: Point): Point; + export function getPointerId(pointer: { + pointerId?: number; + identifier?: number; + type?: string; + }): number; + export function setCoords(dest: CoordsSetMember, pointers: any[], timeStamp: number): void; + export function getTouchPair(event: TouchEvent | PointerType[]): PointerType[]; + export function pointerAverage(pointers: PointerType[]): { + pageX: number; + pageY: number; + clientX: number; + clientY: number; + screenX: number; + screenY: number; + }; + export function touchBBox(event: PointerType[]): { + x: number; + y: number; + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; + }; + export function touchDistance(event: PointerType[] | TouchEvent, deltaSource: string): number; + export function touchAngle(event: PointerType[] | TouchEvent, deltaSource: string): number; + export function getPointerType(pointer: { + pointerType?: string; + identifier?: number; + type?: string; + }): string; + export function getEventTargets(event: Event): any[]; + export function newCoords(): CoordsSetMember; + export 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; + preventDefault(): void; + } & PointerType & PointerEventType; + export interface MockCoords { + page: Point; + client: Point; + timeStamp?: number; + pointerId?: any; + target?: any; + type?: string; + pointerType?: string; + buttons?: number; + } + export { pointerExtend }; +} +declare module "@interactjs/core/PointerInfo" { + import type { PointerEventType, PointerType } from "@interactjs/core/types"; + export class PointerInfo { + id: number; + pointer: PointerType; + event: PointerEventType; + downTime: number; + downTarget: Node; + constructor(id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node); + } +} +declare module "@interactjs/core/Interaction" { + import type { Element, EdgeOptions, PointerEventType, PointerType, FullRect, CoordsSet } from "@interactjs/core/types"; + import type { EventPhase } from "@interactjs/core/InteractEvent"; + import { InteractEvent } from "@interactjs/core/InteractEvent"; + import type { Interactable } from "@interactjs/core/Interactable"; + import { PointerInfo } from "@interactjs/core/PointerInfo"; + import type { Scope } from "@interactjs/core/scope"; + import type { ActionName, ActionProps } from "@interactjs/core/types"; + export enum _ProxyValues { + interactable = "", + element = "", + prepared = "", + pointerIsDown = "", + pointerWasMoved = "", + _proxy = "" + } + export enum _ProxyMethods { + start = "", + move = "", + end = "", + stop = "", + interacting = "" + } + export type PointerArgProps = { + pointer: PointerType; + event: PointerEventType; + eventTarget: Node; + pointerIndex: number; + pointerInfo: PointerInfo; + interaction: Interaction; + } & T; + export interface DoPhaseArg { + event: PointerEventType; + phase: EventPhase; + interaction: Interaction; + iEvent: InteractEvent; + preEnd?: boolean; + type?: string; + } + export type DoAnyPhaseArg = DoPhaseArg; + 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': { + interaction: Interaction; + event: Event; + type: 'blur'; + }; + '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 type InteractionProxy = Pick, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>; + export class Interaction { + interactable: Interactable | null; + element: Element | null; + rect: FullRect | null; + _rects?: { + start: FullRect; + corrected: FullRect; + previous: FullRect; + delta: FullRect; + }; + edges: EdgeOptions | null; + _scopeFire: Scope['fire']; + prepared: ActionProps; + pointerType: string; + pointers: PointerInfo[]; + downEvent: PointerEventType | null; + downPointer: PointerType; + _latestPointer: { + pointer: PointerType; + event: PointerEventType; + eventTarget: Node; + }; + prevEvent: InteractEvent; + pointerIsDown: boolean; + pointerWasMoved: boolean; + _interacting: boolean; + _ending: boolean; + _stopped: boolean; + _proxy: InteractionProxy; + simulation: any; + /** + * @alias Interaction.prototype.move + */ + doMove: (this: void) => any; + coords: CoordsSet; + readonly _id: number; + /** */ + constructor({ pointerType, scopeFire }: { + pointerType?: string; + scopeFire: Scope['fire']; + }); + pointerDown(pointer: PointerType, event: PointerEventType, eventTarget: Node): 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 {Boolean} Whether the interaction was successfully started + */ + start(action: ActionProps, interactable: Interactable, element: Element): boolean; + pointerMove(pointer: PointerType, event: PointerEventType, eventTarget: Node): 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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: EventTarget): void; + documentBlur(event: Event): 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?: PointerEventType): void; + currentAction(): T; + interacting(): boolean; + /** */ + stop(): void; + getPointerIndex(pointer: any): number; + getPointerInfo(pointer: any): PointerInfo; + updatePointer(pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean): number; + removePointer(pointer: PointerType, event: PointerEventType): void; + _updateLatestPointer(pointer: PointerType, event: PointerEventType, eventTarget: Node): void; + destroy(): void; + _createPreparedEvent

(event: 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 }; +} +declare module "@interactjs/utils/raf" { + function init(global: Window | typeof globalThis): void; + const _default_3: { + request: (callback: FrameRequestCallback) => number; + cancel: (token: number) => void; + init: typeof init; + }; + export default _default_3; +} +declare module "@interactjs/core/InteractStatic" { + /** @module interact */ + import type { Scope, Plugin } from "@interactjs/core/scope"; + import type { EventTypes, ListenersArg, Target } from "@interactjs/core/types"; + import * as domUtils from "@interactjs/utils/domUtils"; + import * as pointerUtils from "@interactjs/utils/pointerUtils"; + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Options } from "@interactjs/core/options"; + module "@interactjs/core/InteractStatic" { + interface InteractStatic { + (target: Target, options?: Options): Interactable; + getPointerAverage: typeof pointerUtils.pointerAverage; + getTouchBBox: typeof pointerUtils.touchBBox; + getTouchDistance: typeof pointerUtils.touchDistance; + getTouchAngle: typeof pointerUtils.touchAngle; + getElementRect: typeof domUtils.getElementRect; + getElementClientRect: typeof domUtils.getElementClientRect; + matchesSelector: typeof domUtils.matchesSelector; + closest: typeof domUtils.closest; + version: string; + use(plugin: Plugin, options?: { + [key: string]: any; + }): any; + isSet(target: Target, options?: any): boolean; + on(type: string | EventTypes, listener: ListenersArg, options?: object): any; + off(type: EventTypes, listener: any, options?: object): any; + debug(): any; + supportsTouch(): boolean; + supportsPointerEvent(): boolean; + stop(): any; + pointerMoveTolerance(newValue?: number): any; + addDocument(doc: Document, options?: object): void; + removeDocument(doc: Document): void; + } + } + type _InteractStatic = import("@interactjs/core/InteractStatic").InteractStatic; + export function createInteractStatic(scope: Scope): _InteractStatic; +} +declare module "@interactjs/core/InteractableSet" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { OptionsArg, Options } from "@interactjs/core/options"; + import type { Scope } from "@interactjs/core/scope"; + import type { Target } from "@interactjs/core/types"; + module "@interactjs/core/scope" { + interface SignalArgs { + 'interactable:new': { + interactable: Interactable; + target: Target; + options: OptionsArg; + win: Window; + }; + } + } + export class InteractableSet { + list: Interactable[]; + selectorMap: { + [selector: string]: Interactable[]; + }; + scope: Scope; + constructor(scope: Scope); + new(target: Target, options?: any): Interactable; + getExisting(target: Target, options?: Options): Interactable; + forEachMatch(node: Node, callback: (interactable: Interactable) => T): T | void; + } +} +declare module "@interactjs/core/events" { + import type { Scope } from "@interactjs/core/scope"; + import type { Element } from "@interactjs/core/types"; + import type { NativeEventTarget } from "@interactjs/core/NativeTypes"; + module "@interactjs/core/scope" { + interface Scope { + events: ReturnType; + } + } + interface EventOptions { + capture: boolean; + passive: boolean; + } + type PartialEventTarget = Partial; + type ListenerEntry = { + func: (event: Event | FakeEvent) => any; + options: EventOptions; + }; + function install(scope: Scope): { + add: (eventTarget: PartialEventTarget, type: string, listener: ListenerEntry['func'], optionalArg?: boolean | EventOptions) => void; + remove: (eventTarget: PartialEventTarget, type: string, listener?: 'all' | ListenerEntry['func'], optionalArg?: boolean | EventOptions) => void; + addDelegate: (selector: string, context: Node, type: string, listener: ListenerEntry['func'], optionalArg?: any) => void; + removeDelegate: (selector: string, context: Document | Element, type: string, listener?: ListenerEntry['func'], optionalArg?: any) => void; + delegateListener: (event: Event | FakeEvent, optionalArg?: any) => void; + delegateUseCapture: (this: Element, event: Event | FakeEvent) => any; + delegatedEvents: { + [type: string]: { + selector: string; + context: Node; + listeners: ListenerEntry[]; + }[]; + }; + documents: Document[]; + targets: { + eventTarget: PartialEventTarget; + events: { + [type: string]: ListenerEntry[]; + }; + }[]; + supportsOptions: boolean; + supportsPassive: boolean; + }; + class FakeEvent implements Partial { + currentTarget: Node; + originalEvent: Event; + type: string; + constructor(originalEvent: Event); + preventOriginalDefault(): void; + stopPropagation(): void; + stopImmediatePropagation(): void; + } + const _default_4: { + id: string; + install: typeof install; + }; + export default _default_4; +} +declare module "@interactjs/core/interactablePreventDefault" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Scope } from "@interactjs/core/scope"; + module "@interactjs/core/Interactable" { + interface Interactable { + preventDefault: typeof preventDefault; + checkAndPreventDefault: (event: Event) => void; + } + } + type PreventDefaultValue = 'always' | 'never' | 'auto'; + function preventDefault(this: Interactable): PreventDefaultValue; + function preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this; + export function install(scope: Scope): void; + const _default_5: { + id: string; + install: typeof install; + listeners: any; + }; + export default _default_5; +} +declare module "@interactjs/core/interactionFinder" { + import type Interaction from "@interactjs/core/Interaction"; + import type { Scope } from "@interactjs/core/scope"; + import type { PointerType } from "@interactjs/core/types"; + export interface SearchDetails { + pointer: PointerType; + pointerId: number; + pointerType: string; + eventType: string; + eventTarget: EventTarget; + curEventTarget: EventTarget; + scope: Scope; + } + const finder: { + methodOrder: readonly ["simulationResume", "mouseOrPen", "hasPointer", "idle"]; + search(details: SearchDetails): any; + simulationResume({ pointerType, eventType, eventTarget, scope }: SearchDetails): Interaction; + mouseOrPen({ pointerId, pointerType, eventType, scope }: SearchDetails): any; + hasPointer({ pointerId, scope }: SearchDetails): Interaction; + idle({ pointerType, scope }: SearchDetails): Interaction; + }; + export default finder; +} +declare module "@interactjs/core/interactions" { + import type { Plugin } from "@interactjs/core/scope"; + import type { ActionName, Listener } from "@interactjs/core/types"; + import InteractionBase from "@interactjs/core/Interaction"; + import "@interactjs/core/interactablePreventDefault"; + import type { SearchDetails } from "@interactjs/core/interactionFinder"; + module "@interactjs/core/scope" { + interface Scope { + Interaction: typeof InteractionBase; + interactions: { + new: (options: any) => InteractionBase; + list: Array>; + listeners: { + [type: string]: Listener; + }; + docEvents: Array<{ + type: string; + listener: Listener; + }>; + pointerMoveTolerance: number; + }; + prevTouchTime: number; + } + interface SignalArgs { + 'interactions:find': { + interaction: InteractionBase; + searchDetails: SearchDetails; + }; + } + } + const interactions: Plugin; + export default interactions; +} +declare module "@interactjs/core/scope" { + import type Interaction from "@interactjs/core/Interaction"; + import { Eventable } from "@interactjs/core/Eventable"; + import { InteractEvent } from "@interactjs/core/InteractEvent"; + import { Interactable as InteractableBase } from "@interactjs/core/Interactable"; + import { InteractableSet } from "@interactjs/core/InteractableSet"; + import "@interactjs/core/events"; + import "@interactjs/core/interactions"; + import type { OptionsArg } from "@interactjs/core/options"; + import type { Actions } from "@interactjs/core/types"; + export interface SignalArgs { + 'scope:add-document': DocSignalArg; + 'scope:remove-document': DocSignalArg; + 'interactable:unset': { + interactable: InteractableBase; + }; + 'interactable:set': { + interactable: InteractableBase; + options: OptionsArg; + }; + 'interactions:destroy': { + interaction: Interaction; + }; + } + export type ListenerName = keyof SignalArgs; + export type ListenerMap = { + [P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean; + }; + interface DocSignalArg { + doc: Document; + window: Window; + scope: Scope; + options: Record; + } + export interface Plugin { + [key: string]: any; + id?: string; + listeners?: ListenerMap; + before?: string[]; + install?(scope: Scope, options?: any): void; + } + export class Scope { + id: string; + isInitialized: boolean; + listenerMaps: Array<{ + map: ListenerMap; + id?: string; + }>; + browser: { + init: (window: any) => void; + supportsTouch: boolean; + supportsPointerEvent: boolean; + isIOS7: boolean; + isIOS: boolean; + isIe9: boolean; + isOperaMobile: boolean; + prefixedMatchesSelector: "matches"; + pEventTypes: { + up: string; + down: string; + over: string; + out: string; + move: string; + cancel: string; + }; + wheelEvent: string; + }; + defaults: import("@interactjs/core/options").Defaults; + Eventable: typeof Eventable; + actions: Actions; + interactStatic: import("@interactjs/core/InteractStatic").InteractStatic; + 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 | typeof globalThis): Scope; + pluginIsInstalled(plugin: Plugin): boolean; + 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 function initScope(scope: Scope, window: Window | typeof globalThis): Scope; +} +declare module "@interactjs/actions/drag/plugin" { + import type { InteractEvent } from "@interactjs/core/InteractEvent"; + import type { PerActionDefaults } from "@interactjs/core/options"; + import type { Plugin } from "@interactjs/core/scope"; + import type { ActionMethod, ListenersArg } from "@interactjs/core/types"; + module "@interactjs/core/Interactable" { + interface Interactable { + draggable: DraggableMethod; + } + } + module "@interactjs/core/options" { + interface ActionDefaults { + drag: DraggableOptions; + } + } + module "@interactjs/core/types" { + interface ActionMap { + drag?: typeof drag; + } + } + export type DragEvent = InteractEvent<'drag'>; + export type DraggableMethod = ActionMethod; + export interface DraggableOptions extends PerActionDefaults { + startAxis?: 'x' | 'y' | 'xy'; + lockAxis?: 'x' | 'y' | 'xy' | 'start'; + oninertiastart?: ListenersArg; + onstart?: ListenersArg; + onmove?: ListenersArg; + onend?: ListenersArg; + } + const drag: Plugin; + export default drag; +} +declare module "@interactjs/actions/drop/DropEvent" { + import { BaseEvent } from "@interactjs/core/BaseEvent"; + import type { InteractEvent } from "@interactjs/core/InteractEvent"; + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Element } from "@interactjs/core/types"; + import type { DropState } from "@interactjs/actions/drop/plugin"; + export class DropEvent extends BaseEvent<'drag'> { + target: Element; + dropzone: Interactable; + dragEvent: InteractEvent<'drag'>; + relatedTarget: Element; + draggable: Interactable; + propagationStopped: boolean; + immediatePropagationStopped: boolean; + /** + * Class of events fired on dropzones during drags with acceptable targets. + */ + constructor(dropState: DropState, dragEvent: InteractEvent<'drag'>, type: string); + /** + * 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(): void; + preventDefault(): void; + stopPropagation(): void; + stopImmediatePropagation(): void; + } +} +declare module "@interactjs/actions/drop/plugin" { + import type { InteractEvent } from "@interactjs/core/InteractEvent"; + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Interaction } from "@interactjs/core/Interaction"; + import type { PerActionDefaults } from "@interactjs/core/options"; + import type { Plugin } from "@interactjs/core/scope"; + import type { Element, PointerEventType, Rect, ListenersArg } from "@interactjs/core/types"; + import "@interactjs/actions/drag/plugin"; + import type { DragEvent } from "@interactjs/actions/drag/plugin"; + import { DropEvent } from "@interactjs/actions/drop/DropEvent"; + export type DropFunctionChecker = (dragEvent: any, // related drag operation + event: any, // touch or mouse EventEmitter + dropped: boolean, // default checker result + dropzone: Interactable, // dropzone interactable + dropElement: Element, // drop zone element + draggable: Interactable, // draggable's Interactable + draggableElement: Element) => boolean; + export interface DropzoneOptions extends PerActionDefaults { + accept?: string | Element | (({ dropzone, draggableElement }: { + dropzone: Interactable; + draggableElement: Element; + }) => boolean); + overlap?: 'pointer' | 'center' | number; + checker?: DropFunctionChecker; + ondropactivate?: ListenersArg; + ondropdeactivate?: ListenersArg; + ondragenter?: ListenersArg; + ondragleave?: ListenersArg; + ondropmove?: ListenersArg; + ondrop?: ListenersArg; + } + export interface DropzoneMethod { + (this: Interactable, options: DropzoneOptions | boolean): Interactable; + (): DropzoneOptions; + } + module "@interactjs/core/Interactable" { + interface Interactable { + dropzone: DropzoneMethod; + dropCheck: (dragEvent: InteractEvent, event: PointerEventType, draggable: Interactable, draggableElement: Element, dropElemen: Element, rect: any) => boolean; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + dropState?: DropState; + } + } + module "@interactjs/core/InteractEvent" { + interface InteractEvent { + prevDropzone?: Interactable; + dropzone?: Interactable; + dragEnter?: Element; + dragLeave?: Element; + } + } + module "@interactjs/core/options" { + interface ActionDefaults { + drop: DropzoneOptions; + } + } + module "@interactjs/core/scope" { + interface Scope { + dynamicDrop?: boolean; + } + interface SignalArgs { + 'actions/drop:start': DropSignalArg; + 'actions/drop:move': DropSignalArg; + 'actions/drop:end': DropSignalArg; + } + } + module "@interactjs/core/types" { + interface ActionMap { + drop?: typeof drop; + } + } + module "@interactjs/core/InteractStatic" { + interface InteractStatic { + dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this; + } + } + interface DropSignalArg { + interaction: Interaction<'drag'>; + dragEvent: DragEvent; + } + export interface ActiveDrop { + dropzone: Interactable; + element: Element; + rect: Rect; + } + export interface DropState { + cur: { + dropzone: Interactable; + element: Element; + }; + prev: { + dropzone: Interactable; + element: Element; + }; + rejected: boolean; + events: FiredDropEvents; + activeDrops: ActiveDrop[]; + } + type FiredDropEvents = Partial>; + const drop: Plugin; + export default drop; +} +declare module "@interactjs/actions/gesture/plugin" { + import type { InteractEvent, EventPhase } from "@interactjs/core/InteractEvent"; + import type { Interaction, DoPhaseArg } from "@interactjs/core/Interaction"; + import type { PerActionDefaults } from "@interactjs/core/options"; + import type { Plugin } from "@interactjs/core/scope"; + import type { ActionMethod, Rect, PointerType, ListenersArg } from "@interactjs/core/types"; + export type GesturableMethod = ActionMethod; + module "@interactjs/core/Interaction" { + interface Interaction { + gesture?: { + angle: number; + distance: number; + scale: number; + startAngle: number; + startDistance: number; + }; + } + } + module "@interactjs/core/Interactable" { + interface Interactable { + gesturable: GesturableMethod; + } + } + module "@interactjs/core/options" { + interface ActionDefaults { + gesture: GesturableOptions; + } + } + module "@interactjs/core/types" { + interface ActionMap { + gesture?: typeof gesture; + } + } + export interface GesturableOptions extends PerActionDefaults { + onstart?: ListenersArg; + onmove?: ListenersArg; + onend?: ListenersArg; + } + export interface GestureEvent extends InteractEvent<'gesture'> { + distance: number; + angle: number; + da: number; + scale: number; + ds: number; + box: Rect; + touches: PointerType[]; + } + export interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> { + iEvent: GestureEvent; + interaction: Interaction<'gesture'>; + } + const gesture: Plugin; + export default gesture; +} +declare module "@interactjs/actions/resize/plugin" { + import type { EventPhase, InteractEvent } from "@interactjs/core/InteractEvent"; + import type { PerActionDefaults } from "@interactjs/core/options"; + import type { Plugin } from "@interactjs/core/scope"; + import type { ActionName, ActionProps, ActionMethod, EdgeOptions, FullRect, ListenersArg } from "@interactjs/core/types"; + export type EdgeName = 'top' | 'left' | 'bottom' | 'right'; + export type ResizableMethod = ActionMethod; + module "@interactjs/core/Interactable" { + interface Interactable { + resizable: ResizableMethod; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + resizeAxes: 'x' | 'y' | 'xy'; + resizeStartAspectRatio: number; + } + } + module "@interactjs/core/options" { + interface ActionDefaults { + resize: ResizableOptions; + } + } + module "@interactjs/core/types" { + interface ActionMap { + resize?: typeof resize; + } + } + export interface ResizableOptions extends PerActionDefaults { + square?: boolean; + preserveAspectRatio?: boolean; + edges?: EdgeOptions | null; + axis?: 'x' | 'y' | 'xy'; + invert?: 'none' | 'negate' | 'reposition'; + margin?: number; + squareResize?: boolean; + oninertiastart?: ListenersArg; + onstart?: ListenersArg; + onmove?: ListenersArg; + onend?: ListenersArg; + } + export interface ResizeEvent

extends InteractEvent<'resize', P> { + deltaRect?: FullRect; + edges?: ActionProps['edges']; + } + const resize: Plugin; + export default resize; +} +declare module "@interactjs/actions/plugin" { + import type { Scope } from "@interactjs/core/scope"; + import "@interactjs/actions/drag/plugin"; + import "@interactjs/actions/drop/plugin"; + import "@interactjs/actions/gesture/plugin"; + import "@interactjs/actions/resize/plugin"; + const _default_6: { + id: string; + install(scope: Scope): void; + }; + export default _default_6; +} +declare module "@interactjs/interact/index" { + const interact: import("@interactjs/core/InteractStatic").InteractStatic; + export default interact; +} +declare module "@interactjs/actions/index" { + import "@interactjs/actions/plugin"; +} +declare module "@interactjs/actions/drag/index" { + import "@interactjs/actions/drag/plugin"; +} +declare module "@interactjs/actions/drop/index" { + import "@interactjs/actions/drop/plugin"; +} +declare module "@interactjs/actions/gesture/index" { + import "@interactjs/actions/gesture/plugin"; +} +declare module "@interactjs/actions/resize/index" { + import "@interactjs/actions/resize/plugin"; +} +declare module "@interactjs/auto-scroll/plugin" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type Interaction from "@interactjs/core/Interaction"; + import type { Plugin } from "@interactjs/core/scope"; + import type { ActionName, PointerType } from "@interactjs/core/types"; + module "@interactjs/core/scope" { + interface Scope { + autoScroll: typeof autoScroll; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + autoScroll?: typeof autoScroll; + } + } + module "@interactjs/core/options" { + interface PerActionDefaults { + autoScroll?: AutoScrollOptions; + } + } + export interface AutoScrollOptions { + container?: Window | HTMLElement | string; + margin?: number; + distance?: number; + interval?: number; + speed?: number; + enabled?: boolean; + } + const autoScroll: { + defaults: AutoScrollOptions; + now: () => number; + interaction: Interaction; + i: number; + x: number; + y: number; + isScrolling: boolean; + prevTime: number; + margin: number; + speed: number; + start(interaction: Interaction): void; + stop(): void; + scroll(): void; + check(interactable: Interactable, actionName: ActionName): boolean; + onInteractionMove({ interaction, pointer, }: { + interaction: Interaction; + pointer: PointerType; + }): void; + }; + export function getContainer(value: any, interactable: Interactable, element: Element): any; + export function getScroll(container: any): { + x: any; + y: any; + }; + export function getScrollSize(container: any): { + x: any; + y: any; + }; + export function getScrollSizeDelta({ interaction, element, }: { + interaction: Partial>; + element: Element; + }, func: any): { + x: number; + y: number; + }; + const autoScrollPlugin: Plugin; + export default autoScrollPlugin; +} +declare module "@interactjs/auto-scroll/index" { + import "@interactjs/auto-scroll/plugin"; +} +declare module "@interactjs/auto-start/InteractableMethods" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Interaction } from "@interactjs/core/Interaction"; + import type { Scope } from "@interactjs/core/scope"; + import type { ActionProps, PointerType, PointerEventType, Element } from "@interactjs/core/types"; + module "@interactjs/core/Interactable" { + interface Interactable { + getAction: (this: Interactable, pointer: PointerType, event: PointerEventType, interaction: Interaction, element: Element) => ActionProps | null; + styleCursor: typeof styleCursor; + actionChecker: typeof actionChecker; + ignoreFrom: { + (...args: any[]): Interactable; + (): boolean; + }; + allowFrom: { + (...args: any[]): Interactable; + (): boolean; + }; + } + } + function install(scope: Scope): void; + function styleCursor(this: Interactable): boolean; + function styleCursor(this: Interactable, newValue: boolean): typeof this; + function actionChecker(this: Interactable, checker: any): any; + const _default_7: { + id: string; + install: typeof install; + }; + export default _default_7; +} +declare module "@interactjs/auto-start/base" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Interaction } from "@interactjs/core/Interaction"; + import type { Scope, Plugin } from "@interactjs/core/scope"; + import type { CursorChecker, Element, ActionName, ActionProps } from "@interactjs/core/types"; + import "@interactjs/auto-start/InteractableMethods"; + module "@interactjs/core/InteractStatic" { + interface InteractStatic { + maxInteractions: (newValue: any) => any; + } + } + module "@interactjs/core/scope" { + interface Scope { + autoStart: AutoStart; + } + interface SignalArgs { + 'autoStart:before-start': Omit & { + interaction: Interaction; + }; + 'autoStart:prepared': { + interaction: Interaction; + }; + 'auto-start:check': CheckSignalArg; + } + } + module "@interactjs/core/options" { + interface BaseDefaults { + actionChecker?: any; + cursorChecker?: any; + styleCursor?: any; + } + interface PerActionDefaults { + manualStart?: boolean; + max?: number; + maxPerElement?: number; + allowFrom?: string | Element; + ignoreFrom?: string | Element; + cursorChecker?: CursorChecker; + mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16; + } + } + interface CheckSignalArg { + interactable: Interactable; + interaction: Interaction; + element: Element; + action: ActionProps; + buttons: number; + } + export interface AutoStart { + maxInteractions: number; + withinInteractionLimit: typeof withinInteractionLimit; + cursorElement: Element; + } + function withinInteractionLimit(interactable: Interactable, element: Element, action: ActionProps, scope: Scope): boolean; + const autoStart: Plugin; + export default autoStart; +} +declare module "@interactjs/auto-start/dragAxis" { + import type { SignalArgs, Scope } from "@interactjs/core/scope"; + function beforeStart({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: Scope): void; + const _default_8: { + id: string; + listeners: { + 'autoStart:before-start': typeof beforeStart; + }; + }; + export default _default_8; +} +declare module "@interactjs/auto-start/hold" { + import type { Plugin } from "@interactjs/core/scope"; + import "@interactjs/auto-start/base"; + module "@interactjs/core/options" { + interface PerActionDefaults { + hold?: number; + delay?: number; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + autoStartHoldTimer?: any; + } + } + const hold: Plugin; + export default hold; +} +declare module "@interactjs/auto-start/plugin" { + import type { Scope } from "@interactjs/core/scope"; + import "@interactjs/auto-start/base"; + import "@interactjs/auto-start/dragAxis"; + import "@interactjs/auto-start/hold"; + const _default_9: { + id: string; + install(scope: Scope): void; + }; + export default _default_9; +} +declare module "@interactjs/auto-start/index" { + import "@interactjs/auto-start/plugin"; +} +declare module "@interactjs/core/tests/_helpers" { + import type { PointerType, Rect, Target } from "@interactjs/core/types"; + import * as pointerUtils from "@interactjs/utils/pointerUtils"; + import type { Plugin } from "@interactjs/core/scope"; + import { Scope } from "@interactjs/core/scope"; + import type { ActionProps } from "@interactjs/core/types"; + export function unique(): number; + export function uniqueProps(obj: any): void; + export function newCoordsSet(n?: number): { + start: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + cur: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + prev: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + delta: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + velocity: { + page: { + x: number; + y: number; + }; + client: { + x: number; + y: number; + }; + timeStamp: number; + }; + }; + export function newPointer(n?: number): PointerType; + export function mockScope({ document }?: any): Scope; + export function getProps(src: T, props: readonly K[]): Pick; + export function testEnv({ plugins, target, rect, document, }?: { + plugins?: Plugin[]; + target?: T; + rect?: Rect; + document?: Document; + }): { + scope: Scope; + interaction: import("@interactjs/core/Interaction").Interaction; + target: T extends undefined ? HTMLElement : T; + interactable: import("@interactjs/types").Interactable; + coords: pointerUtils.MockCoords; + event: { + coords: pointerUtils.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; + preventDefault(): void; + } & PointerType & import("@interactjs/core/types").PointerEventType; + interact: import("@interactjs/core/InteractStatic").InteractStatic; + start: (action: ActionProps) => boolean; + stop: () => void; + down: () => void; + move: (force?: boolean) => void; + up: () => void; + }; + export function timeout(n: number): Promise; + export function ltrbwh(left: number, top: number, right: number, bottom: number, width: number, height: number): { + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; + }; +} +declare module "@interactjs/dev-tools/visualizer/plugin" { + const _default_10: {}; + export default _default_10; +} +declare module "@interactjs/dev-tools/plugin" { + import "@interactjs/dev-tools/visualizer/plugin"; + import type Interaction from "@interactjs/core/Interaction"; + import type { Plugin } from "@interactjs/core/scope"; + import type { OptionMethod } from "@interactjs/core/types"; + import visualizer from "@interactjs/dev-tools/visualizer/plugin"; + module "@interactjs/core/scope" { + interface Scope { + logger: Logger; + } + } + module "@interactjs/core/InteractStatic" { + interface InteractStatic { + visializer: typeof visualizer; + } + } + module "@interactjs/core/options" { + interface BaseDefaults { + devTools?: DevToolsOptions; + } + } + module "@interactjs/core/Interactable" { + interface Interactable { + devTools: 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: Interaction) => boolean; + getInfo: (interaction: Interaction) => any[]; + } + enum CheckName { + touchAction = "touchAction", + boxSizing = "boxSizing", + noListeners = "noListeners" + } + const defaultExport: Plugin; + export default defaultExport; +} +declare module "@interactjs/dev-tools/index" { + import "@interactjs/dev-tools/plugin"; +} +declare module "@interactjs/dev-tools/visualizer/plugin.stub" { + const _default_11: {}; + export default _default_11; +} +declare module "@interactjs/dev-tools/visualizer/vueModules.stub" { + export {}; +} +declare module "@interactjs/dev-tools/visualizer/vueModules" { + export {}; +} +declare module "@interactjs/modifiers/types" { + import type { EventPhase } from "@interactjs/core/InteractEvent"; + import type { Interactable } from "@interactjs/core/Interactable"; + import type Interaction from "@interactjs/core/Interaction"; + import type { EdgeOptions, FullRect, Point, Rect } from "@interactjs/core/types"; + export interface Modifier { + options: Defaults; + methods: { + start?: (arg: ModifierArg) => void; + set?: (arg: ModifierArg) => Result; + beforeEnd?: (arg: ModifierArg) => Point | void; + stop?: (arg: ModifierArg) => void; + }; + name?: Name; + enable: () => Modifier; + disable: () => Modifier; + } + export type ModifierState = { + options: Defaults; + methods?: Modifier['methods']; + index?: number; + name?: Name; + } & StateProps; + export interface ModifierArg { + interaction: Interaction; + interactable: Interactable; + phase: EventPhase; + rect: FullRect; + edges: EdgeOptions; + state: State; + element: Element; + pageCoords: Point; + prevCoords: Point; + prevRect?: FullRect; + coords: Point; + startOffset: Rect; + preEnd?: boolean; + } + export interface ModifierModule { + defaults?: Defaults; + start?(arg: ModifierArg): void; + set?(arg: ModifierArg): Result; + beforeEnd?(arg: ModifierArg): Point | void; + stop?(arg: ModifierArg): void; + } + export interface ModifierFunction { + (_options?: Partial): Modifier; + _defaults: Defaults; + _methods: ModifierModule; + } +} +declare module "@interactjs/modifiers/Modification" { + import type { EventPhase } from "@interactjs/core/InteractEvent"; + import type { Interaction, DoAnyPhaseArg } from "@interactjs/core/Interaction"; + import type { EdgeOptions, FullRect, Point, Rect } from "@interactjs/core/types"; + import type { Modifier, ModifierArg, ModifierState } from "@interactjs/modifiers/types"; + export interface ModificationResult { + delta: Point; + rectDelta: Rect; + coords: Point; + rect: FullRect; + eventProps: any[]; + changed: boolean; + } + interface MethodArg { + phase: EventPhase; + pageCoords: Point; + rect: FullRect; + coords: Point; + preEnd?: boolean; + skipModifiers?: number; + } + export default class Modification { + states: ModifierState[]; + startOffset: Rect; + startDelta: Point; + result: ModificationResult; + endResult: Point; + startEdges: EdgeOptions; + edges: EdgeOptions; + readonly interaction: Readonly; + constructor(interaction: Interaction); + start({ phase }: { + phase: EventPhase; + }, pageCoords: Point): ModificationResult; + fillArg(arg: Partial): ModifierArg<{ + options: unknown; + methods?: { + start?: (arg: ModifierArg) => void; + set?: (arg: ModifierArg) => any; + beforeEnd?: (arg: ModifierArg) => void | Point; + stop?: (arg: ModifierArg) => void; + }; + index?: number; + name?: any; + }>; + startAll(arg: MethodArg & Partial): void; + setAll(arg: MethodArg & Partial): ModificationResult; + applyToInteraction(arg: { + phase: EventPhase; + rect?: Rect; + }): void; + setAndApply(arg: Partial & { + phase: EventPhase; + preEnd?: boolean; + skipModifiers?: number; + modifiedCoords?: Point; + }): void | false; + beforeEnd(arg: Omit & { + state?: ModifierState; + }): void | false; + stop(arg: { + interaction: Interaction; + }): void; + prepareStates(modifierList: Modifier[]): { + options: unknown; + methods?: { + start?: (arg: ModifierArg) => void; + set?: (arg: ModifierArg) => any; + beforeEnd?: (arg: ModifierArg) => void | Point; + stop?: (arg: ModifierArg) => void; + }; + index?: number; + name?: any; + }[]; + restoreInteractionCoords({ interaction: { coords, rect, modification } }: { + interaction: Interaction; + }): void; + shouldDo(options: any, preEnd?: boolean, phase?: string, requireEndOnly?: boolean): boolean; + copyFrom(other: Modification): void; + destroy(): void; + } + export function getRectOffset(rect: any, coords: any): { + left: number; + top: number; + right: number; + bottom: number; + }; +} +declare module "@interactjs/modifiers/base" { + import type { InteractEvent } from "@interactjs/core/InteractEvent"; + import type Interaction from "@interactjs/core/Interaction"; + import type { Plugin } from "@interactjs/core/scope"; + import Modification from "@interactjs/modifiers/Modification"; + import type { Modifier, ModifierModule, ModifierState } from "@interactjs/modifiers/types"; + module "@interactjs/core/Interaction" { + interface Interaction { + modification?: Modification; + } + } + module "@interactjs/core/InteractEvent" { + interface InteractEvent { + modifiers?: Array<{ + name: string; + [key: string]: any; + }>; + } + } + module "@interactjs/core/options" { + interface PerActionDefaults { + modifiers?: Modifier[]; + } + } + export function makeModifier(module: ModifierModule, name?: Name): { + (_options?: Partial): Modifier; + _defaults: Defaults; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => Result; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + export function addEventModifiers({ iEvent, interaction, }: { + iEvent: InteractEvent; + interaction: Interaction; + }): void; + const modifiersBase: Plugin; + export default modifiersBase; +} +declare module "@interactjs/offset/plugin" { + import type Interaction from "@interactjs/core/Interaction"; + import type { Plugin } from "@interactjs/core/scope"; + import type { Point } from "@interactjs/core/types"; + module "@interactjs/core/Interaction" { + interface Interaction { + offsetBy?: typeof offsetBy; + offset: { + total: Point; + pending: Point; + }; + } + enum _ProxyMethods { + offsetBy = "" + } + } + export function addTotal(interaction: Interaction): void; + export function applyPending(interaction: Interaction): boolean; + function offsetBy(this: Interaction, { x, y }: Point): void; + const offset: Plugin; + export default offset; +} +declare module "@interactjs/inertia/plugin" { + import type { Interaction, DoPhaseArg } from "@interactjs/core/Interaction"; + import type { SignalArgs, Plugin } from "@interactjs/core/scope"; + import type { ActionName, Point, PointerEventType } from "@interactjs/core/types"; + import Modification from "@interactjs/modifiers/Modification"; + import "@interactjs/modifiers/base"; + import "@interactjs/offset/plugin"; + import type { ModifierArg } from "@interactjs/modifiers/types"; + module "@interactjs/core/InteractEvent" { + interface PhaseMap { + resume?: true; + inertiastart?: true; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + inertia?: InertiaState; + } + } + module "@interactjs/core/options" { + interface PerActionDefaults { + inertia?: { + enabled?: boolean; + resistance?: number; + minSpeed?: number; + endSpeed?: number; + allowResume?: true; + smoothEndDuration?: number; + }; + } + } + module "@interactjs/core/scope" { + interface SignalArgs { + 'interactions:before-action-inertiastart': Omit, 'iEvent'>; + 'interactions:action-inertiastart': DoPhaseArg; + 'interactions:after-action-inertiastart': DoPhaseArg; + 'interactions:before-action-resume': Omit, 'iEvent'>; + 'interactions:action-resume': DoPhaseArg; + 'interactions:after-action-resume': DoPhaseArg; + } + } + export class InertiaState { + active: boolean; + isModified: boolean; + smoothEnd: boolean; + allowResume: boolean; + modification: Modification; + modifierCount: number; + modifierArg: ModifierArg; + startCoords: Point; + t0: number; + v0: number; + te: number; + targetOffset: Point; + modifiedOffset: Point; + currentOffset: Point; + lambda_v0?: number; + one_ve_v0?: number; + timeout: number; + readonly interaction: Interaction; + constructor(interaction: Interaction); + start(event: PointerEventType): boolean; + startInertia(): void; + startSmoothEnd(): void; + onNextFrame(tickFn: () => void): void; + inertiaTick(): void; + smoothEndTick(): void; + resume({ pointer, event, eventTarget }: SignalArgs['interactions:down']): void; + end(): void; + stop(): void; + } + const inertia: Plugin; + export default inertia; +} +declare module "@interactjs/inertia/index" { + import "@interactjs/inertia/plugin"; +} +declare module "@interactjs/snappers/edgeTarget" { + const _default_12: () => void; + export default _default_12; +} +declare module "@interactjs/snappers/elements" { + const _default_13: () => void; + export default _default_13; +} +declare module "@interactjs/modifiers/snap/pointer" { + import type { Interaction, InteractionProxy } from "@interactjs/core/Interaction"; + import type { ActionName, Point, RectResolvable, Element } from "@interactjs/core/types"; + import type { ModifierArg, ModifierState } from "@interactjs/modifiers/types"; + export interface Offset { + x: number; + y: number; + index: number; + relativePoint?: Point | null; + } + export interface SnapPosition { + x?: number; + y?: number; + range?: number; + offset?: Offset; + [index: string]: any; + } + export type SnapFunction = (x: number, y: number, interaction: InteractionProxy, offset: Offset, index: number) => SnapPosition; + export type SnapTarget = SnapPosition | SnapFunction; + export interface SnapOptions { + targets?: SnapTarget[]; + range?: number; + relativePoints?: Point[]; + offset?: Point | RectResolvable<[Interaction]> | 'startCoords'; + offsetWithOrigin?: boolean; + origin?: RectResolvable<[Element]> | Point; + endOnly?: boolean; + enabled?: boolean; + } + export type SnapState = ModifierState; + function start(arg: ModifierArg): void; + function set(arg: ModifierArg): { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + const snap: { + start: typeof start; + set: typeof set; + defaults: SnapOptions; + }; + const _default_14: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: SnapOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; + }; + export default _default_14; + export { snap }; +} +declare module "@interactjs/snappers/grid" { + import type { Rect, Point } from "@interactjs/core/types"; + import type { SnapFunction } from "@interactjs/modifiers/snap/pointer"; + export type GridOptions = (Partial | Point) & { + range?: number; + limits?: Rect; + offset?: Point; + }; + const _default_15: (grid: GridOptions) => SnapFunction & { + grid: GridOptions; + coordFields: (readonly ["x", "y"] | readonly ["left", "top"] | readonly ["right", "bottom"] | readonly ["width", "height"])[]; + }; + export default _default_15; +} +declare module "@interactjs/snappers/all" { + export { default as edgeTarget } from "@interactjs/snappers/edgeTarget"; + export { default as elements } from "@interactjs/snappers/elements"; + export { default as grid } from "@interactjs/snappers/grid"; +} +declare module "@interactjs/snappers/plugin" { + import type { Plugin } from "@interactjs/core/scope"; + import * as allSnappers from "@interactjs/snappers/all"; + module "@interactjs/core/InteractStatic" { + interface InteractStatic { + snappers: typeof allSnappers; + createSnapGrid: typeof allSnappers.grid; + } + } + const snappersPlugin: Plugin; + export default snappersPlugin; +} +declare module "@interactjs/modifiers/aspectRatio" { + /** + * @module modifiers/aspectRatio + * + * @description + * This module forces elements to be resized with a specified dx/dy ratio. + * + * ```js + * interact(target).resizable({ + * modifiers: [ + * interact.modifiers.snapSize({ + * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ], + * }), + * interact.aspectRatio({ ratio: 'preserve' }), + * ], + * }); + * ``` + */ + import type { Point, Rect, EdgeOptions } from "@interactjs/core/types"; + import Modification from "@interactjs/modifiers/Modification"; + import type { Modifier, ModifierModule, ModifierState } from "@interactjs/modifiers/types"; + export interface AspectRatioOptions { + ratio?: number | 'preserve'; + equalDelta?: boolean; + modifiers?: Modifier[]; + enabled?: boolean; + } + export type AspectRatioState = ModifierState; + const aspectRatio: ModifierModule; + const _default_16: { + (_options?: Partial): Modifier; + _defaults: AspectRatioOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => unknown; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + export default _default_16; + export { aspectRatio }; +} +declare module "@interactjs/modifiers/noop" { + import type { ModifierFunction } from "@interactjs/modifiers/types"; + const noop: ModifierFunction; + export default noop; +} +declare module "@interactjs/modifiers/avoid/avoid" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/restrict/pointer" { + import type Interaction from "@interactjs/core/Interaction"; + import type { RectResolvable, Rect, Point } from "@interactjs/core/types"; + import type { ModifierArg, ModifierModule, ModifierState } from "@interactjs/modifiers/types"; + export interface RestrictOptions { + restriction: RectResolvable<[number, number, Interaction]>; + elementRect: Rect; + offset: Rect; + endOnly: boolean; + enabled?: boolean; + } + export type RestrictState = ModifierState; + export function getRestrictionRect(value: RectResolvable<[number, number, Interaction]>, interaction: Interaction, coords?: Point): Rect; + const restrict: ModifierModule; + const _default_17: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: RestrictOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => unknown; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; + }; + export default _default_17; + export { restrict }; +} +declare module "@interactjs/modifiers/restrict/edges" { + import type { Point, Rect } from "@interactjs/core/types"; + import type { ModifierArg, ModifierState } from "@interactjs/modifiers/types"; + import type { RestrictOptions } from "@interactjs/modifiers/restrict/pointer"; + export interface RestrictEdgesOptions { + inner: RestrictOptions['restriction']; + outer: RestrictOptions['restriction']; + offset?: RestrictOptions['offset']; + endOnly: boolean; + enabled?: boolean; + } + export type RestrictEdgesState = ModifierState; + function start({ interaction, startOffset, state }: ModifierArg): void; + function set({ coords, edges, interaction, state }: ModifierArg): void; + const restrictEdges: { + noInner: { + top: number; + left: number; + bottom: number; + right: number; + }; + noOuter: { + top: number; + left: number; + bottom: number; + right: number; + }; + start: typeof start; + set: typeof set; + defaults: RestrictEdgesOptions; + }; + const _default_18: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: RestrictEdgesOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => void; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; + }; + export default _default_18; + export { restrictEdges }; +} +declare module "@interactjs/modifiers/restrict/rect" { + const restrictRect: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => unknown; + defaults: import("@interactjs/modifiers/restrict/pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; + }; + const _default_19: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/restrict/pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => unknown; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + export default _default_19; + export { restrictRect }; +} +declare module "@interactjs/modifiers/restrict/size" { + import type { Point, Rect, Size } from "@interactjs/core/types"; + import type { ModifierArg, ModifierState } from "@interactjs/modifiers/types"; + import type { RestrictEdgesState } from "@interactjs/modifiers/restrict/edges"; + import type { RestrictOptions } from "@interactjs/modifiers/restrict/pointer"; + export interface RestrictSizeOptions { + min?: Size | Point | RestrictOptions['restriction']; + max?: Size | Point | RestrictOptions['restriction']; + endOnly: boolean; + enabled?: boolean; + } + function start(arg: ModifierArg): void; + export type RestrictSizeState = RestrictEdgesState & ModifierState; + function set(arg: ModifierArg): void; + const restrictSize: { + start: typeof start; + set: typeof set; + defaults: RestrictSizeOptions; + }; + const _default_20: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: RestrictSizeOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => void; + beforeEnd: (arg: ModifierArg) => void | Point; + stop: (arg: ModifierArg) => void; + }; + }; + export default _default_20; + export { restrictSize }; +} +declare module "@interactjs/modifiers/rubberband/rubberband" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/snap/size" { + import type { ModifierArg } from "@interactjs/modifiers/types"; + import type { SnapOptions, SnapState } from "@interactjs/modifiers/snap/pointer"; + export type SnapSizeOptions = Pick; + function start(arg: ModifierArg): any; + function set(arg: any): { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + const snapSize: { + start: typeof start; + set: typeof set; + defaults: SnapSizeOptions; + }; + const _default_21: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: SnapSizeOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: ModifierArg) => void; + }; + }; + export default _default_21; + export { snapSize }; +} +declare module "@interactjs/modifiers/snap/edges" { + import type { ModifierArg, ModifierModule } from "@interactjs/modifiers/types"; + import type { SnapOptions, SnapState } from "@interactjs/modifiers/snap/pointer"; + import { snapSize } from "@interactjs/modifiers/snap/size"; + export type SnapEdgesOptions = Pick; + const snapEdges: ModifierModule>; + const _default_22: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: SnapEdgesOptions; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: ModifierArg) => void; + }; + }; + export default _default_22; + export { snapEdges }; +} +declare module "@interactjs/modifiers/spring/spring" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/transform/transform" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/all" { + const _default_23: { + aspectRatio: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/aspectRatio").AspectRatioOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => unknown; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + restrictEdges: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/restrict/edges").RestrictEdgesOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + restrict: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/restrict/pointer").RestrictOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => unknown; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + restrictRect: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/restrict/pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => unknown; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + restrictSize: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/restrict/size").RestrictSizeOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + snapEdges: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/snap/edges").SnapEdgesOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + snap: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/snap/pointer").SnapOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + snapSize: { + (_options?: Partial): import("@interactjs/modifiers/types").Modifier; + _defaults: import("@interactjs/modifiers/snap/size").SnapSizeOptions; + _methods: { + start: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + set: (arg: import("@interactjs/modifiers/types").ModifierArg) => { + target: any; + inRange: boolean; + distance: number; + range: number; + delta: { + x: number; + y: number; + }; + }; + beforeEnd: (arg: import("@interactjs/modifiers/types").ModifierArg) => void | import("@interactjs/types").Point; + stop: (arg: import("@interactjs/modifiers/types").ModifierArg) => void; + }; + }; + spring: import("@interactjs/modifiers/types").ModifierFunction; + avoid: import("@interactjs/modifiers/types").ModifierFunction; + transform: import("@interactjs/modifiers/types").ModifierFunction; + rubberband: import("@interactjs/modifiers/types").ModifierFunction; + }; + export default _default_23; +} +declare module "@interactjs/modifiers/plugin" { + import type { Plugin } from "@interactjs/core/scope"; + import "@interactjs/modifiers/all"; + import "@interactjs/modifiers/base"; + import all from "@interactjs/modifiers/all"; + module "@interactjs/core/InteractStatic" { + interface InteractStatic { + modifiers: typeof all; + } + } + const modifiers: Plugin; + export default modifiers; +} +declare module "@interactjs/pointer-events/PointerEvent" { + import { BaseEvent } from "@interactjs/core/BaseEvent"; + import type Interaction from "@interactjs/core/Interaction"; + import type { PointerEventType, PointerType, Point } from "@interactjs/core/types"; + export default class PointerEvent extends BaseEvent { + type: T; + originalEvent: 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: PointerType | PointerEvent, event: PointerEventType, eventTarget: Node, interaction: Interaction, timeStamp: number); + _subtractOrigin({ x: originX, y: originY }: Point): this; + _addOrigin({ x: originX, y: originY }: Point): this; + /** + * Prevent the default behaviour of the original Event + */ + preventDefault(): void; + } + export { PointerEvent }; +} +declare module "@interactjs/pointer-events/base" { + import type { Eventable } from "@interactjs/core/Eventable"; + import type { Interaction } from "@interactjs/core/Interaction"; + import type { PerActionDefaults } from "@interactjs/core/options"; + import type { Plugin } from "@interactjs/core/scope"; + import type { Point, PointerType, PointerEventType, Element } from "@interactjs/core/types"; + import { PointerEvent } from "@interactjs/pointer-events/PointerEvent"; + export 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?: Point | string | Element; + } + module "@interactjs/core/scope" { + interface Scope { + pointerEvents: typeof pointerEvents; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + prevTap?: PointerEvent; + tapTime?: number; + } + } + module "@interactjs/core/PointerInfo" { + interface PointerInfo { + hold?: { + duration: number; + timeout: any; + }; + } + } + module "@interactjs/core/options" { + interface ActionDefaults { + pointerEvents: Options; + } + } + module "@interactjs/core/scope" { + interface SignalArgs { + 'pointerEvents:new': { + pointerEvent: PointerEvent; + }; + 'pointerEvents:fired': { + interaction: Interaction; + pointer: PointerType | PointerEvent; + event: PointerEventType | PointerEvent; + eventTarget: Node; + pointerEvent: PointerEvent; + targets?: EventTargetList; + type: string; + }; + 'pointerEvents:collect-targets': { + interaction: Interaction; + pointer: PointerType | PointerEvent; + event: PointerEventType | PointerEvent; + eventTarget: Node; + targets?: EventTargetList; + type: string; + path: Node[]; + node: null; + }; + } + } + const pointerEvents: Plugin; + export default pointerEvents; +} +declare module "@interactjs/pointer-events/holdRepeat" { + import type { Plugin } from "@interactjs/core/scope"; + import "@interactjs/pointer-events/base"; + module "@interactjs/core/Interaction" { + interface Interaction { + holdIntervalHandle?: any; + } + } + module "@interactjs/pointer-events/PointerEvent" { + interface PointerEvent { + count?: number; + } + } + module "@interactjs/pointer-events/base" { + interface PointerEventOptions { + holdRepeatInterval?: number; + } + } + const holdRepeat: Plugin; + export default holdRepeat; +} +declare module "@interactjs/pointer-events/interactableTargets" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { Plugin } from "@interactjs/core/scope"; + module "@interactjs/core/Interactable" { + interface Interactable { + pointerEvents: typeof pointerEventsMethod; + __backCompatOption: (optionName: string, newValue: any) => any; + } + } + function pointerEventsMethod(this: Interactable, options: any): Interactable; + const plugin: Plugin; + export default plugin; +} +declare module "@interactjs/pointer-events/plugin" { + import type { Plugin } from "@interactjs/core/scope"; + import "@interactjs/pointer-events/base"; + import "@interactjs/pointer-events/holdRepeat"; + import "@interactjs/pointer-events/interactableTargets"; + const plugin: Plugin; + export default plugin; +} +declare module "@interactjs/reflow/plugin" { + import type { Interactable } from "@interactjs/core/Interactable"; + import type { DoAnyPhaseArg } from "@interactjs/core/Interaction"; + import type { Scope, Plugin } from "@interactjs/core/scope"; + import type { ActionName, ActionProps } from "@interactjs/core/types"; + module "@interactjs/core/scope" { + interface SignalArgs { + 'interactions:before-action-reflow': Omit; + 'interactions:action-reflow': DoAnyPhaseArg; + 'interactions:after-action-reflow': DoAnyPhaseArg; + } + } + module "@interactjs/core/Interactable" { + interface Interactable { + reflow: (action: ActionProps) => ReturnType; + } + } + module "@interactjs/core/Interaction" { + interface Interaction { + _reflowPromise: Promise; + _reflowResolve: (...args: unknown[]) => void; + } + } + module "@interactjs/core/InteractEvent" { + interface PhaseMap { + reflow?: true; + } + } + export function install(scope: Scope): void; + function doReflow(interactable: Interactable, action: ActionProps, scope: Scope): Promise; + const reflow: Plugin; + export default reflow; +} +declare module "@interactjs/interactjs/index.stub" { + import "@interactjs/actions/plugin"; + import "@interactjs/auto-scroll/plugin"; + import "@interactjs/auto-start/plugin"; + import "@interactjs/core/interactablePreventDefault"; + import "@interactjs/dev-tools/plugin"; + import "@interactjs/inertia/plugin"; + import "@interactjs/interact/index"; + import "@interactjs/modifiers/plugin"; + import "@interactjs/offset/plugin"; + import "@interactjs/pointer-events/plugin"; + import "@interactjs/reflow/plugin"; + import interact from "@interactjs/interact/index"; + export default interact; +} +declare module "@interactjs/interactjs/index" { + import "@interactjs/actions/plugin"; + import "@interactjs/auto-scroll/plugin"; + import "@interactjs/auto-start/plugin"; + import "@interactjs/core/interactablePreventDefault"; + import "@interactjs/dev-tools/plugin"; + import "@interactjs/inertia/plugin"; + import "@interactjs/interact/index"; + import "@interactjs/modifiers/plugin"; + import "@interactjs/offset/plugin"; + import "@interactjs/pointer-events/plugin"; + import "@interactjs/reflow/plugin"; + import interact from "@interactjs/interact/index"; + export default interact; +} +declare module "@interactjs/modifiers/index" { + import "@interactjs/modifiers/plugin"; +} +declare module "@interactjs/modifiers/avoid/avoid.stub" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/rubberband/rubberband.stub" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/spring/spring.stub" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/modifiers/transform/transform.stub" { + export { default } from "@interactjs/modifiers/noop"; +} +declare module "@interactjs/pointer-events/index" { + import "@interactjs/pointer-events/plugin"; +} +declare module "@interactjs/reflow/index" { + import "@interactjs/reflow/plugin"; +} +declare module "@interactjs/snappers/edgeTarget.stub" { + const _default_24: () => void; + export default _default_24; +} +declare module "@interactjs/snappers/elements.stub" { + const _default_25: () => void; + export default _default_25; +} +declare module "@interactjs/snappers/index" { + import "@interactjs/snappers/plugin"; +} +declare module "@interactjs/types/index" { + import type { InteractEvent as _InteractEvent, EventPhase } from "@interactjs/core/InteractEvent"; + import type * as interaction from "@interactjs/core/Interaction"; + import type { ActionName, ActionProps as _ActionProps } from "@interactjs/core/types"; + import "@interactjs/interactjs/index"; + export * from "@interactjs/core/types"; + export type { Plugin } from "@interactjs/core/scope"; + export type { EventPhase } from "@interactjs/core/InteractEvent"; + export type { Options } from "@interactjs/core/options"; + export type { PointerEvent } from "@interactjs/pointer-events/PointerEvent"; + export type { Interactable } from "@interactjs/core/Interactable"; + export type { DragEvent } from "@interactjs/actions/drag/plugin"; + export type { DropEvent } from "@interactjs/actions/drop/DropEvent"; + export type { GestureEvent } from "@interactjs/actions/gesture/plugin"; + export type { ResizeEvent } from "@interactjs/actions/resize/plugin"; + export type { SnapFunction, SnapTarget } from "@interactjs/modifiers/snap/pointer"; + export type ActionProps = _ActionProps; + export type Interaction = interaction.Interaction; + export type InteractionProxy = interaction.InteractionProxy; + export type PointerArgProps = interaction.PointerArgProps; + export type InteractEvent = _InteractEvent; +} +declare module "@interactjs/utils/ElementState.stub" { + const _default_26: {}; + export default _default_26; +} +declare module "@interactjs/utils/ElementState" { + const _default_27: {}; + export default _default_27; +} +declare module "@interactjs/utils/center" { + import type { Rect } from "@interactjs/core/types"; + const _default_28: (rect: Rect) => { + x: number; + y: number; + }; + export default _default_28; +} +declare module "@interactjs/utils/displace.stub" { + const _default_29: {}; + export default _default_29; +} +declare module "@interactjs/utils/displace" { + const _default_30: {}; + export default _default_30; +} +declare module "@interactjs/utils/exchange.stub" { + const _default_31: {}; + export default _default_31; +} +declare module "@interactjs/utils/exchange" { + const _default_32: {}; + export default _default_32; +} +declare module "@interactjs/utils/shallowEqual" { + export default function shallowEqual(left: any, right: any): boolean; +} diff --git a/packages/@interactjs/types/index.js b/packages/@interactjs/types/index.js new file mode 100644 index 000000000..0324cd587 --- /dev/null +++ b/packages/@interactjs/types/index.js @@ -0,0 +1,5 @@ +/* eslint-disable import/no-extraneous-dependencies */ +// import module augmentations +import "../interactjs/index.js"; +export * from "../core/types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/@interactjs/types/index.js.map b/packages/@interactjs/types/index.js.map new file mode 100644 index 000000000..2857ae72b --- /dev/null +++ b/packages/@interactjs/types/index.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable import/no-extraneous-dependencies */\nimport type { InteractEvent as _InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'\nimport type * as interaction from '@interactjs/core/Interaction'\nimport type { ActionName, ActionProps as _ActionProps } from '@interactjs/core/types'\n// import module augmentations\nimport '@interactjs/interactjs'\n\nexport * from '@interactjs/core/types'\nexport type { Plugin } from '@interactjs/core/scope'\nexport type { EventPhase } from '@interactjs/core/InteractEvent'\nexport type { Options } from '@interactjs/core/options'\nexport type { PointerEvent } from '@interactjs/pointer-events/PointerEvent'\nexport type { Interactable } from '@interactjs/core/Interactable'\nexport type { DragEvent } from '@interactjs/actions/drag/plugin'\nexport type { DropEvent } from '@interactjs/actions/drop/DropEvent'\nexport type { GestureEvent } from '@interactjs/actions/gesture/plugin'\nexport type { ResizeEvent } from '@interactjs/actions/resize/plugin'\nexport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type ActionProps = _ActionProps\nexport type Interaction = interaction.Interaction\nexport type InteractionProxy = interaction.InteractionProxy\nexport type PointerArgProps = interaction.PointerArgProps\nexport type InteractEvent = _InteractEvent<\nT,\nP\n>\n" + ], + "mappings": "AAAA;AAIA;AACA,OAAO,wBAAP;AAEA,cAAc,kBAAd" +} \ No newline at end of file diff --git a/packages/@interactjs/types/index.prod.js b/packages/@interactjs/types/index.prod.js new file mode 100644 index 000000000..a993deecc --- /dev/null +++ b/packages/@interactjs/types/index.prod.js @@ -0,0 +1,2 @@ +import"../interactjs/index.prod.js";export*from"../core/types.prod.js"; +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/types/index.prod.js.map b/packages/@interactjs/types/index.prod.js.map new file mode 100644 index 000000000..00ce064e1 --- /dev/null +++ b/packages/@interactjs/types/index.prod.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "names": [ + "from" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "/* eslint-disable import/no-extraneous-dependencies */\nimport type { InteractEvent as _InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'\nimport type * as interaction from '@interactjs/core/Interaction'\nimport type { ActionName, ActionProps as _ActionProps } from '@interactjs/core/types'\n// import module augmentations\nimport '@interactjs/interactjs'\n\nexport * from '@interactjs/core/types'\nexport type { Plugin } from '@interactjs/core/scope'\nexport type { EventPhase } from '@interactjs/core/InteractEvent'\nexport type { Options } from '@interactjs/core/options'\nexport type { PointerEvent } from '@interactjs/pointer-events/PointerEvent'\nexport type { Interactable } from '@interactjs/core/Interactable'\nexport type { DragEvent } from '@interactjs/actions/drag/plugin'\nexport type { DropEvent } from '@interactjs/actions/drop/DropEvent'\nexport type { GestureEvent } from '@interactjs/actions/gesture/plugin'\nexport type { ResizeEvent } from '@interactjs/actions/resize/plugin'\nexport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type ActionProps = _ActionProps\nexport type Interaction = interaction.Interaction\nexport type InteractionProxy = interaction.InteractionProxy\nexport type PointerArgProps = interaction.PointerArgProps\nexport type InteractEvent = _InteractEvent<\nT,\nP\n>\n" + ], + "mappings": "MAKO,oCAEPA,KAAc" +} \ No newline at end of file diff --git a/packages/@interactjs/types/package.json b/packages/@interactjs/types/package.json index defb425ff..70d2570f6 100644 --- a/packages/@interactjs/types/package.json +++ b/packages/@interactjs/types/package.json @@ -12,7 +12,6 @@ "typings": "typings.d.ts", "devDependencies": { "@interactjs/actions": "1.10.23", - "@interactjs/arrange": "1.10.23", "@interactjs/auto-scroll": "1.10.23", "@interactjs/auto-start": "1.10.23", "@interactjs/core": "1.10.23", diff --git a/packages/@interactjs/types/typings.d.ts b/packages/@interactjs/types/typings.d.ts new file mode 100644 index 000000000..fa7bba483 --- /dev/null +++ b/packages/@interactjs/types/typings.d.ts @@ -0,0 +1,4 @@ +import * as Interact from '@interactjs/types/index' + +export as namespace Interact +export = Interact diff --git a/packages/@interactjs/utils/.npmignore b/packages/@interactjs/utils/.npmignore new file mode 100644 index 000000000..d5cdeb8b3 --- /dev/null +++ b/packages/@interactjs/utils/.npmignore @@ -0,0 +1,7 @@ +*.ts +!*.d.ts +*.map.* +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/packages/@interactjs/utils/ElementState.d.ts b/packages/@interactjs/utils/ElementState.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/utils/ElementState.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/utils/ElementState.js b/packages/@interactjs/utils/ElementState.js new file mode 100644 index 000000000..fc410d3c0 --- /dev/null +++ b/packages/@interactjs/utils/ElementState.js @@ -0,0 +1,2 @@ +export default {}; +//# sourceMappingURL=ElementState.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/ElementState.js.map b/packages/@interactjs/utils/ElementState.js.map new file mode 100644 index 000000000..337b90b05 --- /dev/null +++ b/packages/@interactjs/utils/ElementState.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "ElementState.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "AAAA,eAAe,EAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/ElementState.prod.js b/packages/@interactjs/utils/ElementState.prod.js new file mode 100644 index 000000000..052aa1cf2 --- /dev/null +++ b/packages/@interactjs/utils/ElementState.prod.js @@ -0,0 +1,2 @@ +export default{}; +//# sourceMappingURL=ElementState.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/ElementState.prod.js.map b/packages/@interactjs/utils/ElementState.prod.js.map new file mode 100644 index 000000000..c855cca32 --- /dev/null +++ b/packages/@interactjs/utils/ElementState.prod.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "ElementState.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "cAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/ElementState.stub.d.ts b/packages/@interactjs/utils/ElementState.stub.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/utils/ElementState.stub.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/utils/LICENSE b/packages/@interactjs/utils/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/packages/@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/packages/@interactjs/utils/arr.d.ts b/packages/@interactjs/utils/arr.d.ts new file mode 100644 index 000000000..b528f79b5 --- /dev/null +++ b/packages/@interactjs/utils/arr.d.ts @@ -0,0 +1,8 @@ +declare type Filter = (element: T, index: number, array: T[]) => boolean; +export declare const contains: (array: T[], target: T) => boolean; +export declare const remove: (array: T[], target: T) => T[]; +export declare const merge: (target: (T | U)[], source: U[]) => (T | U)[]; +export declare const from: (source: ArrayLike) => T[]; +export declare const findIndex: (array: T[], func: Filter) => number; +export declare const find: (array: T[], func: Filter) => T; +export {}; diff --git a/packages/@interactjs/utils/arr.js b/packages/@interactjs/utils/arr.js new file mode 100644 index 000000000..2e43ccb5a --- /dev/null +++ b/packages/@interactjs/utils/arr.js @@ -0,0 +1,21 @@ +export const contains = (array, target) => array.indexOf(target) !== -1; +export const remove = (array, target) => array.splice(array.indexOf(target), 1); +export const merge = (target, source) => { + for (const item of source) { + target.push(item); + } + + return target; +}; +export const from = source => merge([], source); +export const findIndex = (array, func) => { + for (let i = 0; i < array.length; i++) { + if (func(array[i], i, array)) { + return i; + } + } + + return -1; +}; +export const find = (array, func) => array[findIndex(array, func)]; +//# sourceMappingURL=arr.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/arr.js.map b/packages/@interactjs/utils/arr.js.map new file mode 100644 index 000000000..49b96f597 --- /dev/null +++ b/packages/@interactjs/utils/arr.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "names": [ + "contains", + "array", + "target", + "indexOf", + "remove", + "splice", + "merge", + "source", + "item", + "push", + "from", + "findIndex", + "func", + "i", + "length", + "find" + ], + "sources": [ + "arr.ts" + ], + "sourcesContent": [ + "type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport const contains = (array: T[], target: T) => array.indexOf(target) !== -1\n\nexport const remove = (array: T[], target: T) => array.splice(array.indexOf(target), 1)\n\nexport const merge = (target: Array, source: U[]) => {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport const from = (source: ArrayLike) => merge([] as T[], source as T[])\n\nexport const 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 const find = (array: T[], func: Filter): T | undefined => array[findIndex(array, func)]\n" + ], + "mappings": "AAEA,OAAO,MAAMA,QAAQ,GAAG,CAAIC,KAAJ,EAAgBC,MAAhB,KAA8BD,KAAK,CAACE,OAAN,CAAcD,MAAd,MAA0B,CAAC,CAA1E;AAEP,OAAO,MAAME,MAAM,GAAG,CAAIH,KAAJ,EAAgBC,MAAhB,KAA8BD,KAAK,CAACI,MAAN,CAAaJ,KAAK,CAACE,OAAN,CAAcD,MAAd,CAAb,EAAoC,CAApC,CAA7C;AAEP,OAAO,MAAMI,KAAK,GAAG,CAAOJ,MAAP,EAA6BK,MAA7B,KAA6C;EAChE,KAAK,MAAMC,IAAX,IAAmBD,MAAnB,EAA2B;IACzBL,MAAM,CAACO,IAAP,CAAYD,IAAZ;EACD;;EAED,OAAON,MAAP;AACD,CANM;AAQP,OAAO,MAAMQ,IAAI,GAAaH,MAAV,IAAmCD,KAAK,CAAC,EAAD,EAAYC,MAAZ,CAArD;AAEP,OAAO,MAAMI,SAAS,GAAG,CAAIV,KAAJ,EAAgBW,IAAhB,KAAoC;EAC3D,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGZ,KAAK,CAACa,MAA1B,EAAkCD,CAAC,EAAnC,EAAuC;IACrC,IAAID,IAAI,CAACX,KAAK,CAACY,CAAD,CAAN,EAAWA,CAAX,EAAcZ,KAAd,CAAR,EAA8B;MAC5B,OAAOY,CAAP;IACD;EACF;;EAED,OAAO,CAAC,CAAR;AACD,CARM;AAUP,OAAO,MAAME,IAAI,GAAG,CAAUd,KAAV,EAAsBW,IAAtB,KAAyDX,KAAK,CAACU,SAAS,CAACV,KAAD,EAAQW,IAAR,CAAV,CAA3E" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/arr.prod.js b/packages/@interactjs/utils/arr.prod.js new file mode 100644 index 000000000..fd4c021f6 --- /dev/null +++ b/packages/@interactjs/utils/arr.prod.js @@ -0,0 +1,2 @@ +export const contains=(e,n)=>-1!==e.indexOf(n);export const remove=(e,n)=>e.splice(e.indexOf(n),1);export const merge=(e,n)=>{for(const o of n)e.push(o);return e};export const from=e=>merge([],e);export const findIndex=(e,n)=>{for(let o=0;oe[findIndex(e,n)]; +//# sourceMappingURL=arr.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/arr.prod.js.map b/packages/@interactjs/utils/arr.prod.js.map new file mode 100644 index 000000000..b78be78dc --- /dev/null +++ b/packages/@interactjs/utils/arr.prod.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "names": [ + "contains", + "array", + "target", + "indexOf", + "remove", + "splice", + "merge", + "source", + "item", + "push", + "from", + "findIndex", + "func", + "i", + "length", + "find" + ], + "sources": [ + "arr.ts" + ], + "sourcesContent": [ + "type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport const contains = (array: T[], target: T) => array.indexOf(target) !== -1\n\nexport const remove = (array: T[], target: T) => array.splice(array.indexOf(target), 1)\n\nexport const merge = (target: Array, source: U[]) => {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport const from = (source: ArrayLike) => merge([] as T[], source as T[])\n\nexport const 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 const find = (array: T[], func: Filter): T | undefined => array[findIndex(array, func)]\n" + ], + "mappings": "OAEO,MAAMA,SAAW,CAAIC,EAAYC,KAAyC,IAA3BD,EAAME,QAAQD,UAE7D,MAAME,OAAS,CAAIH,EAAYC,IAAcD,EAAMI,OAAOJ,EAAME,QAAQD,GAAS,UAEjF,MAAMI,MAAQ,CAAOJ,EAAsBK,KAChD,IAAK,MAAMC,KAAQD,EACjBL,EAAOO,KAAKD,GAGd,OAAON,UAGF,MAAMQ,KAAiBH,GAAyBD,MAAM,GAAWC,UAEjE,MAAMI,UAAY,CAAIV,EAAYW,KACvC,IAAK,IAAIC,EAAI,EAAGA,EAAIZ,EAAMa,OAAQD,IAChC,GAAID,EAAKX,EAAMY,GAAIA,EAAGZ,GACpB,OAAOY,EAIX,OAAQ,UAGH,MAAME,KAAO,CAAUd,EAAYW,IAAmCX,EAAMU,UAAUV,EAAOW" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/browser.d.ts b/packages/@interactjs/utils/browser.d.ts new file mode 100644 index 000000000..1475b9110 --- /dev/null +++ b/packages/@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: "matches"; + 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/packages/@interactjs/utils/browser.js b/packages/@interactjs/utils/browser.js new file mode 100644 index 000000000..ebace7a09 --- /dev/null +++ b/packages/@interactjs/utils/browser.js @@ -0,0 +1,52 @@ +import domObjects from './domObjects'; +import is from './is'; +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 = 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 + // https://github.com/taye/interact.js/issues/703#issuecomment-471570492 + + 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 = domObjects.document && 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'; +} + +export default browser; +//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/browser.js.map b/packages/@interactjs/utils/browser.js.map new file mode 100644 index 000000000..08e0e90c2 --- /dev/null +++ b/packages/@interactjs/utils/browser.js.map @@ -0,0 +1,46 @@ +{ + "version": 3, + "names": [ + "domObjects", + "is", + "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" + ], + "sources": [ + "browser.ts" + ], + "sourcesContent": [ + "import domObjects from './domObjects'\nimport is from './is'\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 'matches',\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: Partial = window.navigator || {}\n\n // Does the browser support touch input?\n browser.supportsTouch =\n 'ontouchstart' in window ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n // https://github.com/taye/interact.js/issues/703#issuecomment-471570492\n browser.supportsPointerEvent = (navigator as any).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) && /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 =\n navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent)\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = (\n '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 ) as 'matches'\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 = domObjects.document && 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n" + ], + "mappings": "AAAA,OAAOA,UAAP,MAAuB,cAAvB;AACA,OAAOC,EAAP,MAAe,MAAf;AAEA,MAAMC,OAAO,GAAG;EACdC,IADc;EAEdC,aAAa,EAAE,IAFD;EAGdC,oBAAoB,EAAE,IAHR;EAIdC,MAAM,EAAE,IAJM;EAKdC,KAAK,EAAE,IALO;EAMdC,KAAK,EAAE,IANO;EAOdC,aAAa,EAAE,IAPD;EAQdC,uBAAuB,EAAE,IARX;EASdC,WAAW,EAAE,IATC;EAiBdC,UAAU,EAAE;AAjBE,CAAhB;;AAoBA,SAAST,IAAT,CAAeU,MAAf,EAA4B;EAC1B,MAAMC,OAAO,GAAGd,UAAU,CAACc,OAA3B;EACA,MAAMC,SAA6B,GAAGF,MAAM,CAACE,SAAP,IAAoB,EAA1D,CAF0B,CAI1B;;EACAb,OAAO,CAACE,aAAR,GACE,kBAAkBS,MAAlB,IACCZ,EAAE,CAACe,IAAH,CAAQH,MAAM,CAACI,aAAf,KAAiCjB,UAAU,CAACkB,QAAX,YAA+BL,MAAM,CAACI,aAF1E,CAL0B,CAS1B;EACA;;EACAf,OAAO,CAACG,oBAAR,GAAgCU,SAAD,CAAmBI,cAAnB,KAAsC,KAAtC,IAA+C,CAAC,CAACnB,UAAU,CAACoB,YAA3F;EAEAlB,OAAO,CAACK,KAAR,GAAgB,iBAAiBc,IAAjB,CAAsBN,SAAS,CAACO,QAAhC,CAAhB,CAb0B,CAe1B;;EACApB,OAAO,CAACI,MAAR,GAAiB,iBAAiBe,IAAjB,CAAsBN,SAAS,CAACO,QAAhC,KAA6C,YAAYD,IAAZ,CAAiBN,SAAS,CAACQ,UAA3B,CAA9D;EAEArB,OAAO,CAACM,KAAR,GAAgB,SAASa,IAAT,CAAcN,SAAS,CAACS,SAAxB,CAAhB,CAlB0B,CAoB1B;;EACAtB,OAAO,CAACO,aAAR,GACEM,SAAS,CAACU,OAAV,KAAsB,OAAtB,IAAiCvB,OAAO,CAACE,aAAzC,IAA0D,SAASiB,IAAT,CAAcN,SAAS,CAACS,SAAxB,CAD5D,CArB0B,CAwB1B;;EACAtB,OAAO,CAACQ,uBAAR,GACE,aAAaI,OAAO,CAACY,SAArB,GACI,SADJ,GAEI,2BAA2BZ,OAAO,CAACY,SAAnC,GACE,uBADF,GAEE,wBAAwBZ,OAAO,CAACY,SAAhC,GACE,oBADF,GAEE,sBAAsBZ,OAAO,CAACY,SAA9B,GACE,kBADF,GAEE,mBATZ;EAYAxB,OAAO,CAACS,WAAR,GAAsBT,OAAO,CAACG,oBAAR,GAClBL,UAAU,CAACoB,YAAX,KAA4BP,MAAM,CAACc,cAAnC,GACE;IACAC,EAAE,EAAE,aADJ;IAEAC,IAAI,EAAE,eAFN;IAGAC,IAAI,EAAE,WAHN;IAIAC,GAAG,EAAE,UAJL;IAKAC,IAAI,EAAE,eALN;IAMAC,MAAM,EAAE;EANR,CADF,GASE;IACAL,EAAE,EAAE,WADJ;IAEAC,IAAI,EAAE,aAFN;IAGAC,IAAI,EAAE,aAHN;IAIAC,GAAG,EAAE,YAJL;IAKAC,IAAI,EAAE,aALN;IAMAC,MAAM,EAAE;EANR,CAVgB,GAkBlB,IAlBJ,CArC0B,CAyD1B;;EACA/B,OAAO,CAACU,UAAR,GAAqBZ,UAAU,CAACkB,QAAX,IAAuB,kBAAkBlB,UAAU,CAACkB,QAApD,GAA+D,YAA/D,GAA8E,OAAnG;AACD;;AAED,eAAehB,OAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/browser.prod.js b/packages/@interactjs/utils/browser.prod.js new file mode 100644 index 000000000..64c2c33c9 --- /dev/null +++ b/packages/@interactjs/utils/browser.prod.js @@ -0,0 +1,2 @@ +import e from"./domObjects";import t from"./is";const o={init(n){const r=e.Element,s=n.navigator||{};o.supportsTouch="ontouchstart"in n||t.func(n.DocumentTouch)&&e.document instanceof n.DocumentTouch,o.supportsPointerEvent=!1!==s.pointerEnabled&&!!e.PointerEvent,o.isIOS=/iP(hone|od|ad)/.test(s.platform),o.isIOS7=/iP(hone|od|ad)/.test(s.platform)&&/OS 7[^\d]/.test(s.appVersion),o.isIe9=/MSIE 9/.test(s.userAgent),o.isOperaMobile="Opera"===s.appName&&o.supportsTouch&&/Presto/.test(s.userAgent),o.prefixedMatchesSelector="matches"in r.prototype?"matches":"webkitMatchesSelector"in r.prototype?"webkitMatchesSelector":"mozMatchesSelector"in r.prototype?"mozMatchesSelector":"oMatchesSelector"in r.prototype?"oMatchesSelector":"msMatchesSelector",o.pEventTypes=o.supportsPointerEvent?e.PointerEvent===n.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,o.wheelEvent=e.document&&"onmousewheel"in e.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};export default o; +//# sourceMappingURL=browser.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/browser.prod.js.map b/packages/@interactjs/utils/browser.prod.js.map new file mode 100644 index 000000000..7399e4553 --- /dev/null +++ b/packages/@interactjs/utils/browser.prod.js.map @@ -0,0 +1,46 @@ +{ + "version": 3, + "names": [ + "domObjects", + "is", + "browser", + "init", + "window", + "Element", + "navigator", + "supportsTouch", + "func", + "DocumentTouch", + "document", + "supportsPointerEvent", + "pointerEnabled", + "PointerEvent", + "isIOS", + "test", + "platform", + "isIOS7", + "appVersion", + "isIe9", + "userAgent", + "isOperaMobile", + "appName", + "prefixedMatchesSelector", + "prototype", + "pEventTypes", + "MSPointerEvent", + "up", + "down", + "over", + "out", + "move", + "cancel", + "wheelEvent" + ], + "sources": [ + "browser.ts" + ], + "sourcesContent": [ + "import domObjects from './domObjects'\nimport is from './is'\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 'matches',\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: Partial = window.navigator || {}\n\n // Does the browser support touch input?\n browser.supportsTouch =\n 'ontouchstart' in window ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n // https://github.com/taye/interact.js/issues/703#issuecomment-471570492\n browser.supportsPointerEvent = (navigator as any).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) && /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 =\n navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent)\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = (\n '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 ) as 'matches'\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 = domObjects.document && 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n" + ], + "mappings": "OAAOA,MAAgB,sBAChBC,MAAQ,OAEf,MAAMC,EAAU,CACdC,KAmBaC,GACb,MAAMC,EAAUL,EAAWK,QACrBC,EAAgCF,EAAOE,WAAa,GAG1DJ,EAAQK,cACN,iBAAkBH,GACjBH,EAAGO,KAAKJ,EAAOK,gBAAkBT,EAAWU,oBAAoBN,EAAOK,cAI1EP,EAAQS,sBAA6D,IAArCL,EAAkBM,kBAA8BZ,EAAWa,aAE3FX,EAAQY,MAAQ,iBAAiBC,KAAKT,EAAUU,UAGhDd,EAAQe,OAAS,iBAAiBF,KAAKT,EAAUU,WAAa,YAAYD,KAAKT,EAAUY,YAEzFhB,EAAQiB,MAAQ,SAASJ,KAAKT,EAAUc,WAGxClB,EAAQmB,cACgB,UAAtBf,EAAUgB,SAAuBpB,EAAQK,eAAiB,SAASQ,KAAKT,EAAUc,WAGpFlB,EAAQqB,wBACN,YAAalB,EAAQmB,UACjB,UACA,0BAA2BnB,EAAQmB,UACjC,wBACA,uBAAwBnB,EAAQmB,UAC9B,qBACA,qBAAsBnB,EAAQmB,UAC5B,mBACA,oBAGZtB,EAAQuB,YAAcvB,EAAQS,qBAC1BX,EAAWa,eAAiBT,EAAOsB,eACjC,CACAC,GAAI,cACJC,KAAM,gBACNC,KAAM,YACNC,IAAK,WACLC,KAAM,gBACNC,OAAQ,mBAER,CACAL,GAAI,YACJC,KAAM,cACNC,KAAM,cACNC,IAAK,aACLC,KAAM,cACNC,OAAQ,iBAEV,KAGJ9B,EAAQ+B,WAAajC,EAAWU,UAAY,iBAAkBV,EAAWU,SAAW,aAAe,SA5EnGH,cAAe,KACfI,qBAAsB,KACtBM,OAAQ,KACRH,MAAO,KACPK,MAAO,KACPE,cAAe,KACfE,wBAAyB,KACzBE,YAAa,KAQbQ,WAAY,qBAgEC/B" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/center.d.ts b/packages/@interactjs/utils/center.d.ts new file mode 100644 index 000000000..6fa05bbb6 --- /dev/null +++ b/packages/@interactjs/utils/center.d.ts @@ -0,0 +1,6 @@ +import type { Rect } from '@interactjs/core/types'; +declare const _default: (rect: Rect) => { + x: number; + y: number; +}; +export default _default; diff --git a/packages/@interactjs/utils/center.js b/packages/@interactjs/utils/center.js new file mode 100644 index 000000000..144e8781c --- /dev/null +++ b/packages/@interactjs/utils/center.js @@ -0,0 +1,5 @@ +export default (rect => ({ + x: rect.left + (rect.right - rect.left) / 2, + y: rect.top + (rect.bottom - rect.top) / 2 +})); +//# sourceMappingURL=center.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/center.js.map b/packages/@interactjs/utils/center.js.map new file mode 100644 index 000000000..ae815dfc4 --- /dev/null +++ b/packages/@interactjs/utils/center.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "names": [ + "rect", + "x", + "left", + "right", + "y", + "top", + "bottom" + ], + "sources": [ + "center.ts" + ], + "sourcesContent": [ + "import type { Rect } from '@interactjs/core/types'\n\nexport default (rect: Rect) => ({\n x: rect.left + (rect.right - rect.left) / 2,\n y: rect.top + (rect.bottom - rect.top) / 2,\n})\n" + ], + "mappings": "AAEA,gBAAgBA,IAAD,KAAiB;EAC9BC,CAAC,EAAED,IAAI,CAACE,IAAL,GAAY,CAACF,IAAI,CAACG,KAAL,GAAaH,IAAI,CAACE,IAAnB,IAA2B,CADZ;EAE9BE,CAAC,EAAEJ,IAAI,CAACK,GAAL,GAAW,CAACL,IAAI,CAACM,MAAL,GAAcN,IAAI,CAACK,GAApB,IAA2B;AAFX,CAAjB,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/center.prod.js b/packages/@interactjs/utils/center.prod.js new file mode 100644 index 000000000..89162841a --- /dev/null +++ b/packages/@interactjs/utils/center.prod.js @@ -0,0 +1,2 @@ +export default t=>({x:t.left+(t.right-t.left)/2,y:t.top+(t.bottom-t.top)/2}); +//# sourceMappingURL=center.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/center.prod.js.map b/packages/@interactjs/utils/center.prod.js.map new file mode 100644 index 000000000..fb0b0ebe9 --- /dev/null +++ b/packages/@interactjs/utils/center.prod.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "names": [ + "rect", + "x", + "left", + "right", + "y", + "top", + "bottom" + ], + "sources": [ + "center.ts" + ], + "sourcesContent": [ + "import type { Rect } from '@interactjs/core/types'\n\nexport default (rect: Rect) => ({\n x: rect.left + (rect.right - rect.left) / 2,\n y: rect.top + (rect.bottom - rect.top) / 2,\n})\n" + ], + "mappings": "eAEgBA,IAAD,CACbC,EAAGD,EAAKE,MAAQF,EAAKG,MAAQH,EAAKE,MAAQ,EAC1CE,EAAGJ,EAAKK,KAAOL,EAAKM,OAASN,EAAKK,KAAO" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/clone.d.ts b/packages/@interactjs/utils/clone.d.ts new file mode 100644 index 000000000..08b411b09 --- /dev/null +++ b/packages/@interactjs/utils/clone.d.ts @@ -0,0 +1 @@ +export default function clone(source: T): Partial; diff --git a/packages/@interactjs/utils/clone.js b/packages/@interactjs/utils/clone.js new file mode 100644 index 000000000..9a11b127a --- /dev/null +++ b/packages/@interactjs/utils/clone.js @@ -0,0 +1,21 @@ +import * as arr from './arr'; +import is from './is'; // 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/packages/@interactjs/utils/clone.js.map b/packages/@interactjs/utils/clone.js.map new file mode 100644 index 000000000..6a35be37a --- /dev/null +++ b/packages/@interactjs/utils/clone.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "arr", + "is", + "clone", + "source", + "dest", + "prop", + "value", + "plainObject", + "array", + "from" + ], + "sources": [ + "clone.ts" + ], + "sourcesContent": [ + "import * as arr from './arr'\nimport 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 } else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n } else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n" + ], + "mappings": "AAAA,OAAO,KAAKA,GAAZ,MAAqB,OAArB;AACA,OAAOC,EAAP,MAAe,MAAf,C,CAEA;;AACA,eAAe,SAASC,KAAT,CAAkCC,MAAlC,EAAyD;EACtE,MAAMC,IAAI,GAAG,EAAb;;EAEA,KAAK,MAAMC,IAAX,IAAmBF,MAAnB,EAA2B;IACzB,MAAMG,KAAK,GAAGH,MAAM,CAACE,IAAD,CAApB;;IAEA,IAAIJ,EAAE,CAACM,WAAH,CAAeD,KAAf,CAAJ,EAA2B;MACzBF,IAAI,CAACC,IAAD,CAAJ,GAAaH,KAAK,CAACI,KAAD,CAAlB;IACD,CAFD,MAEO,IAAIL,EAAE,CAACO,KAAH,CAASF,KAAT,CAAJ,EAAqB;MAC1BF,IAAI,CAACC,IAAD,CAAJ,GAAaL,GAAG,CAACS,IAAJ,CAASH,KAAT,CAAb;IACD,CAFM,MAEA;MACLF,IAAI,CAACC,IAAD,CAAJ,GAAaC,KAAb;IACD;EACF;;EAED,OAAOF,IAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/clone.prod.js b/packages/@interactjs/utils/clone.prod.js new file mode 100644 index 000000000..92b44d3bf --- /dev/null +++ b/packages/@interactjs/utils/clone.prod.js @@ -0,0 +1,2 @@ +import*as r from"./arr";import o from"./is";export default function t(n){const a={};for(const f in n){const i=n[f];o.plainObject(i)?a[f]=t(i):o.array(i)?a[f]=r.from(i):a[f]=i}return a} +//# sourceMappingURL=clone.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/clone.prod.js.map b/packages/@interactjs/utils/clone.prod.js.map new file mode 100644 index 000000000..29a26cec5 --- /dev/null +++ b/packages/@interactjs/utils/clone.prod.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "arr", + "is", + "clone", + "source", + "dest", + "prop", + "value", + "plainObject", + "array", + "from" + ], + "sources": [ + "clone.ts" + ], + "sourcesContent": [ + "import * as arr from './arr'\nimport 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 } else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n } else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n" + ], + "mappings": "UAAYA,MAAS,eACdC,MAAQ,sBAGA,SAASC,EAAyBC,GAC/C,MAAMC,EAAO,GAEb,IAAK,MAAMC,KAAQF,EAAQ,CACzB,MAAMG,EAAQH,EAAOE,GAEjBJ,EAAGM,YAAYD,GACjBF,EAAKC,GAAQH,EAAMI,GACVL,EAAGO,MAAMF,GAClBF,EAAKC,GAAQL,EAAIS,KAAKH,GAEtBF,EAAKC,GAAQC,EAIjB,OAAOF" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/displace.d.ts b/packages/@interactjs/utils/displace.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/utils/displace.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/utils/displace.js b/packages/@interactjs/utils/displace.js new file mode 100644 index 000000000..d3088e021 --- /dev/null +++ b/packages/@interactjs/utils/displace.js @@ -0,0 +1,2 @@ +export default {}; +//# sourceMappingURL=displace.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/displace.js.map b/packages/@interactjs/utils/displace.js.map new file mode 100644 index 000000000..122f78745 --- /dev/null +++ b/packages/@interactjs/utils/displace.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "displace.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "AAAA,eAAe,EAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/displace.prod.js b/packages/@interactjs/utils/displace.prod.js new file mode 100644 index 000000000..b60c04676 --- /dev/null +++ b/packages/@interactjs/utils/displace.prod.js @@ -0,0 +1,2 @@ +export default{}; +//# sourceMappingURL=displace.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/displace.prod.js.map b/packages/@interactjs/utils/displace.prod.js.map new file mode 100644 index 000000000..fe6052776 --- /dev/null +++ b/packages/@interactjs/utils/displace.prod.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "displace.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "cAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/displace.stub.d.ts b/packages/@interactjs/utils/displace.stub.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/utils/displace.stub.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/utils/domObjects.d.ts b/packages/@interactjs/utils/domObjects.d.ts new file mode 100644 index 000000000..8207499aa --- /dev/null +++ b/packages/@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/packages/@interactjs/utils/domObjects.js b/packages/@interactjs/utils/domObjects.js new file mode 100644 index 000000000..3ad02276b --- /dev/null +++ b/packages/@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/packages/@interactjs/utils/domObjects.js.map b/packages/@interactjs/utils/domObjects.js.map new file mode 100644 index 000000000..6a22b2230 --- /dev/null +++ b/packages/@interactjs/utils/domObjects.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "names": [ + "domObjects", + "init", + "document", + "DocumentFragment", + "SVGElement", + "SVGSVGElement", + "SVGElementInstance", + "Element", + "HTMLElement", + "Event", + "Touch", + "PointerEvent", + "blank", + "window", + "win", + "MSPointerEvent" + ], + "sources": [ + "domObjects.ts" + ], + "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 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" + ], + "mappings": "AAAA,MAAMA,UAYL,GAAG;EACFC,IADE;EAEFC,QAAQ,EAAE,IAFR;EAGFC,gBAAgB,EAAE,IAHhB;EAIFC,UAAU,EAAE,IAJV;EAKFC,aAAa,EAAE,IALb;EAMFC,kBAAkB,EAAE,IANlB;EAOFC,OAAO,EAAE,IAPP;EAQFC,WAAW,EAAE,IARX;EASFC,KAAK,EAAE,IATL;EAUFC,KAAK,EAAE,IAVL;EAWFC,YAAY,EAAE;AAXZ,CAZJ;;AA0BA,SAASC,KAAT,GAAkB,CAAE;;AAEpB,eAAeZ,UAAf;;AAEA,SAASC,IAAT,CAAeY,MAAf,EAA+B;EAC7B,MAAMC,GAAG,GAAGD,MAAZ;EAEAb,UAAU,CAACE,QAAX,GAAsBY,GAAG,CAACZ,QAA1B;EACAF,UAAU,CAACG,gBAAX,GAA8BW,GAAG,CAACX,gBAAJ,IAAwBS,KAAtD;EACAZ,UAAU,CAACI,UAAX,GAAwBU,GAAG,CAACV,UAAJ,IAAkBQ,KAA1C;EACAZ,UAAU,CAACK,aAAX,GAA2BS,GAAG,CAACT,aAAJ,IAAqBO,KAAhD;EACAZ,UAAU,CAACM,kBAAX,GAAgCQ,GAAG,CAACR,kBAAJ,IAA0BM,KAA1D;EACAZ,UAAU,CAACO,OAAX,GAAqBO,GAAG,CAACP,OAAJ,IAAeK,KAApC;EACAZ,UAAU,CAACQ,WAAX,GAAyBM,GAAG,CAACN,WAAJ,IAAmBR,UAAU,CAACO,OAAvD;EAEAP,UAAU,CAACS,KAAX,GAAmBK,GAAG,CAACL,KAAvB;EACAT,UAAU,CAACU,KAAX,GAAmBI,GAAG,CAACJ,KAAJ,IAAaE,KAAhC;EACAZ,UAAU,CAACW,YAAX,GAA0BG,GAAG,CAACH,YAAJ,IAAoBG,GAAG,CAACC,cAAlD;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/domObjects.prod.js b/packages/@interactjs/utils/domObjects.prod.js new file mode 100644 index 000000000..d19a3effe --- /dev/null +++ b/packages/@interactjs/utils/domObjects.prod.js @@ -0,0 +1,2 @@ +const e={init(t){const l=t;e.document=l.document,e.DocumentFragment=l.DocumentFragment||n,e.SVGElement=l.SVGElement||n,e.SVGSVGElement=l.SVGSVGElement||n,e.SVGElementInstance=l.SVGElementInstance||n,e.Element=l.Element||n,e.HTMLElement=l.HTMLElement||e.Element,e.Event=l.Event,e.Touch=l.Touch||n,e.PointerEvent=l.PointerEvent||l.MSPointerEvent},document:null,DocumentFragment:null,SVGElement:null,SVGSVGElement:null,SVGElementInstance:null,Element:null,HTMLElement:null,Event:null,Touch:null,PointerEvent:null};function n(){}export default e; +//# sourceMappingURL=domObjects.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/domObjects.prod.js.map b/packages/@interactjs/utils/domObjects.prod.js.map new file mode 100644 index 000000000..dea044c4e --- /dev/null +++ b/packages/@interactjs/utils/domObjects.prod.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "names": [ + "domObjects", + "init", + "window", + "win", + "document", + "DocumentFragment", + "blank", + "SVGElement", + "SVGSVGElement", + "SVGElementInstance", + "Element", + "HTMLElement", + "Event", + "Touch", + "PointerEvent", + "MSPointerEvent" + ], + "sources": [ + "domObjects.ts" + ], + "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 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" + ], + "mappings": "AAAA,MAAMA,EAYF,CACFC,KAiBaC,GACb,MAAMC,EAAMD,EAEZF,EAAWI,SAAWD,EAAIC,SAC1BJ,EAAWK,iBAAmBF,EAAIE,kBAAoBC,EACtDN,EAAWO,WAAaJ,EAAII,YAAcD,EAC1CN,EAAWQ,cAAgBL,EAAIK,eAAiBF,EAChDN,EAAWS,mBAAqBN,EAAIM,oBAAsBH,EAC1DN,EAAWU,QAAUP,EAAIO,SAAWJ,EACpCN,EAAWW,YAAcR,EAAIQ,aAAeX,EAAWU,QAEvDV,EAAWY,MAAQT,EAAIS,MACvBZ,EAAWa,MAAQV,EAAIU,OAASP,EAChCN,EAAWc,aAAeX,EAAIW,cAAgBX,EAAIY,gBA7BlDX,SAAU,KACVC,iBAAkB,KAClBE,WAAY,KACZC,cAAe,KACfC,mBAAoB,KACpBC,QAAS,KACTC,YAAa,KACbC,MAAO,KACPC,MAAO,KACPC,aAAc,MAGhB,SAASR,oBAEMN" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/domUtils.d.ts b/packages/@interactjs/utils/domUtils.d.ts new file mode 100644 index 000000000..66760a9b0 --- /dev/null +++ b/packages/@interactjs/utils/domUtils.d.ts @@ -0,0 +1,16 @@ +import type { Rect, Target, Element } from '@interactjs/core/types'; +export declare function nodeContains(parent: Node, child: Node): boolean; +export declare function closest(element: Node, selector: string): HTMLElement | SVGElement; +export declare function parentNode(node: Node | Document): ParentNode; +export declare function matchesSelector(element: Element, selector: string): boolean; +export declare function indexOfDeepestElement(elements: Element[] | NodeListOf): number; +export declare function matchesUpTo(element: Element, selector: string, limit: Node): boolean; +export declare function getActualElement(element: Element): any; +export declare function getScrollXY(relevantWindow?: Window): { + x: number; + y: number; +}; +export declare function getElementClientRect(element: Element): Required; +export declare function getElementRect(element: Element): Required; +export declare function getPath(node: Node | Document): any[]; +export declare function trySelector(value: Target): boolean; diff --git a/packages/@interactjs/utils/domUtils.js b/packages/@interactjs/utils/domUtils.js new file mode 100644 index 000000000..e28d148c5 --- /dev/null +++ b/packages/@interactjs/utils/domUtils.js @@ -0,0 +1,227 @@ +import browser from './browser'; +import domObjects from './domObjects'; +import is from './is'; +import * as win from './window'; +export function nodeContains(parent, child) { + if (parent.contains) { + return parent.contains(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.host; // Test for the element that's "above" all other qualifiers + + +export function indexOfDeepestElement(elements) { + let deepestNodeParents = []; + let deepestNodeIndex; + + for (let i = 0; i < elements.length; i++) { + const currentNode = elements[i]; + const deepestNode = elements[deepestNodeIndex]; // node may appear in elements array multiple times + + if (!currentNode || i === deepestNodeIndex) { + continue; + } + + if (!deepestNode) { + deepestNodeIndex = i; + continue; + } + + const currentNodeParent = getParent(currentNode); + const deepestNodeParent = getParent(deepestNode); // check if the deepest or current are document.documentElement/rootElement + // - if the current node is, do nothing and continue + + if (currentNodeParent === currentNode.ownerDocument) { + continue; + } // - if deepest is, update with the current node and continue to next + else if (deepestNodeParent === currentNode.ownerDocument) { + deepestNodeIndex = i; + continue; + } // compare zIndex of siblings + + + if (currentNodeParent === deepestNodeParent) { + if (zIndexIsHigherThan(currentNode, deepestNode)) { + deepestNodeIndex = i; + } + + continue; + } // populate the ancestry array for the latest deepest node + + + deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode); + let ancestryStart; // if the deepest node is an HTMLElement and the current node is a non root svg element + + if (deepestNode instanceof domObjects.HTMLElement && currentNode instanceof domObjects.SVGElement && !(currentNode instanceof domObjects.SVGSVGElement)) { + // TODO: is this check necessary? Was this for HTML elements embedded in SVG? + if (currentNode === deepestNodeParent) { + continue; + } + + ancestryStart = currentNode.ownerSVGElement; + } else { + ancestryStart = currentNode; + } + + const currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument); + let commonIndex = 0; // get (position of closest common ancestor) + 1 + + while (currentNodeParents[commonIndex] && currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]) { + commonIndex++; + } + + const parents = [currentNodeParents[commonIndex - 1], currentNodeParents[commonIndex], deepestNodeParents[commonIndex]]; + + if (parents[0]) { + let child = parents[0].lastChild; + + while (child) { + if (child === parents[1]) { + deepestNodeIndex = i; + deepestNodeParents = currentNodeParents; + break; + } else if (child === parents[2]) { + break; + } + + child = child.previousSibling; + } + } + } + + return deepestNodeIndex; +} + +function getNodeParents(node, limit) { + const parents = []; + let parent = node; + let parentParent; + + while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) { + parents.unshift(parent); + parent = parentParent; + } + + return parents; +} + +function zIndexIsHigherThan(higherNode, lowerNode) { + const higherIndex = parseInt(win.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0; + const lowerIndex = parseInt(win.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0; + return higherIndex >= lowerIndex; +} + +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.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/packages/@interactjs/utils/domUtils.js.map b/packages/@interactjs/utils/domUtils.js.map new file mode 100644 index 000000000..097b94990 --- /dev/null +++ b/packages/@interactjs/utils/domUtils.js.map @@ -0,0 +1,101 @@ +{ + "version": 3, + "names": [ + "browser", + "domObjects", + "is", + "win", + "nodeContains", + "parent", + "child", + "contains", + "parentNode", + "closest", + "element", + "selector", + "matchesSelector", + "node", + "docFrag", + "host", + "window", + "realWindow", + "replace", + "prefixedMatchesSelector", + "getParent", + "el", + "indexOfDeepestElement", + "elements", + "deepestNodeParents", + "deepestNodeIndex", + "i", + "length", + "currentNode", + "deepestNode", + "currentNodeParent", + "deepestNodeParent", + "ownerDocument", + "zIndexIsHigherThan", + "getNodeParents", + "ancestryStart", + "HTMLElement", + "SVGElement", + "SVGSVGElement", + "ownerSVGElement", + "currentNodeParents", + "commonIndex", + "parents", + "lastChild", + "previousSibling", + "limit", + "parentParent", + "unshift", + "higherNode", + "lowerNode", + "higherIndex", + "parseInt", + "getWindow", + "getComputedStyle", + "zIndex", + "lowerIndex", + "matchesUpTo", + "getActualElement", + "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" + ], + "sources": [ + "domUtils.ts" + ], + "sourcesContent": [ + "import type { Rect, Target, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport domObjects from './domObjects'\nimport is from './is'\nimport * as win from './window'\n\nexport function nodeContains (parent: Node, child: Node) {\n if (parent.contains) {\n return parent.contains(child as Node)\n }\n\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)) {\n return element\n }\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: 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: Node | Document | ShadowRoot) => el.parentNode || (el as ShadowRoot).host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Element[] | NodeListOf) {\n let deepestNodeParents: Node[] = []\n let deepestNodeIndex: number\n\n for (let i = 0; i < elements.length; i++) {\n const currentNode = elements[i]\n const deepestNode: Node = elements[deepestNodeIndex]\n\n // node may appear in elements array multiple times\n if (!currentNode || i === deepestNodeIndex) {\n continue\n }\n\n if (!deepestNode) {\n deepestNodeIndex = i\n continue\n }\n\n const currentNodeParent = getParent(currentNode)\n const deepestNodeParent = getParent(deepestNode)\n\n // check if the deepest or current are document.documentElement/rootElement\n // - if the current node is, do nothing and continue\n if (currentNodeParent === currentNode.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current node and continue to next\n else if (deepestNodeParent === currentNode.ownerDocument) {\n deepestNodeIndex = i\n continue\n }\n\n // compare zIndex of siblings\n if (currentNodeParent === deepestNodeParent) {\n if (zIndexIsHigherThan(currentNode, deepestNode)) {\n deepestNodeIndex = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest node\n deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode)\n\n let ancestryStart: Node\n\n // if the deepest node is an HTMLElement and the current node is a non root svg element\n if (\n deepestNode instanceof domObjects.HTMLElement &&\n currentNode instanceof domObjects.SVGElement &&\n !(currentNode instanceof domObjects.SVGSVGElement)\n ) {\n // TODO: is this check necessary? Was this for HTML elements embedded in SVG?\n if (currentNode === deepestNodeParent) {\n continue\n }\n\n ancestryStart = currentNode.ownerSVGElement\n } else {\n ancestryStart = currentNode\n }\n\n const currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument)\n let commonIndex = 0\n\n // get (position of closest common ancestor) + 1\n while (\n currentNodeParents[commonIndex] &&\n currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]\n ) {\n commonIndex++\n }\n\n const parents = [\n currentNodeParents[commonIndex - 1],\n currentNodeParents[commonIndex],\n deepestNodeParents[commonIndex],\n ]\n\n if (parents[0]) {\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestNodeIndex = i\n deepestNodeParents = currentNodeParents\n\n break\n } else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n }\n\n return deepestNodeIndex\n}\n\nfunction getNodeParents (node: Node, limit?: Node) {\n const parents: Node[] = []\n let parent: Node = node\n let parentParent: Node\n\n while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) {\n parents.unshift(parent)\n parent = parentParent\n }\n\n return parents\n}\n\nfunction zIndexIsHigherThan (higherNode: Node, lowerNode: Node) {\n const higherIndex = parseInt(win.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0\n const lowerIndex = parseInt(win.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0\n\n return higherIndex >= lowerIndex\n}\n\nexport function matchesUpTo (element: 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 Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Element) {\n return (element as any).correspondingUseElement || element\n}\n\nexport function getScrollXY (relevantWindow?: Window) {\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: Element): Required {\n const clientRect =\n element instanceof domObjects.SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]\n\n return (\n 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}\n\nexport function getElementRect (element: 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: Target) {\n if (!is.string(value)) {\n return false\n }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\n" + ], + "mappings": "AAEA,OAAOA,OAAP,MAAoB,WAApB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,EAAP,MAAe,MAAf;AACA,OAAO,KAAKC,GAAZ,MAAqB,UAArB;AAEA,OAAO,SAASC,YAAT,CAAuBC,MAAvB,EAAqCC,KAArC,EAAkD;EACvD,IAAID,MAAM,CAACE,QAAX,EAAqB;IACnB,OAAOF,MAAM,CAACE,QAAP,CAAgBD,KAAhB,CAAP;EACD;;EAED,OAAOA,KAAP,EAAc;IACZ,IAAIA,KAAK,KAAKD,MAAd,EAAsB;MACpB,OAAO,IAAP;IACD;;IAEDC,KAAK,GAAIA,KAAD,CAAgBE,UAAxB;EACD;;EAED,OAAO,KAAP;AACD;AAED,OAAO,SAASC,OAAT,CAAkBC,OAAlB,EAAiCC,QAAjC,EAAmD;EACxD,OAAOT,EAAE,CAACQ,OAAH,CAAWA,OAAX,CAAP,EAA4B;IAC1B,IAAIE,eAAe,CAACF,OAAD,EAAUC,QAAV,CAAnB,EAAwC;MACtC,OAAOD,OAAP;IACD;;IAEDA,OAAO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;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/domUtils.prod.js b/packages/@interactjs/utils/domUtils.prod.js new file mode 100644 index 000000000..dbc9f3bb7 --- /dev/null +++ b/packages/@interactjs/utils/domUtils.prod.js @@ -0,0 +1,2 @@ +import e from"./browser";import t from"./domObjects";import n from"./is";import*as o from"./window";export function nodeContains(e,t){if(e.contains)return e.contains(t);for(;t;){if(t===e)return!0;t=t.parentNode}return!1}export function closest(e,t){for(;n.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}export function parentNode(e){let t=e.parentNode;if(n.docFrag(t)){for(;(t=t.host)&&n.docFrag(t););return t}return t}export function matchesSelector(t,n){return o.window!==o.realWindow&&(n=n.replace(/\/deep\//g," ")),t[e.prefixedMatchesSelector](n)}const r=e=>e.parentNode||e.host;export function indexOfDeepestElement(e){let n,c=[];for(let f=0;f=(parseInt(o.getWindow(u).getComputedStyle(u).zIndex,10)||0)&&(n=f);continue}let a;if(c=c.length?c:i(m),m instanceof t.HTMLElement&&s instanceof t.SVGElement&&!(s instanceof t.SVGSVGElement)){if(s===d)continue;a=s.ownerSVGElement}else a=s;const g=i(a,m.ownerDocument);let h=0;for(;g[h]&&g[h]===c[h];)h++;const x=[g[h-1],g[h],c[h]];if(x[0]){let e=x[0].lastChild;for(;e;){if(e===x[1]){n=f,c=g;break}if(e===x[2])break;e=e.previousSibling}}}var l,u;return n}function i(e,t){const n=[];let o,i=e;for(;(o=r(i))&&i!==t&&o!==i.ownerDocument;)n.unshift(i),i=o;return n}export function matchesUpTo(e,t,o){for(;n.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===o)return matchesSelector(e,t)}return!1}export function getActualElement(e){return e.correspondingUseElement||e}export function getScrollXY(e){return{x:(e=e||o.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}export function getElementClientRect(e){const n=e instanceof t.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return n&&{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width||n.right-n.left,height:n.height||n.bottom-n.top}}export function getElementRect(t){const n=getElementClientRect(t);if(!e.isIOS7&&n){const e=getScrollXY(o.getWindow(t));n.left+=e.x,n.right+=e.x,n.top+=e.y,n.bottom+=e.y}return n}export function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}export function trySelector(e){return!!n.string(e)&&(t.document.querySelector(e),!0)} +//# sourceMappingURL=domUtils.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/domUtils.prod.js.map b/packages/@interactjs/utils/domUtils.prod.js.map new file mode 100644 index 000000000..5279c859a --- /dev/null +++ b/packages/@interactjs/utils/domUtils.prod.js.map @@ -0,0 +1,98 @@ +{ + "version": 3, + "names": [ + "browser", + "domObjects", + "is", + "win", + "nodeContains", + "parent", + "child", + "contains", + "parentNode", + "closest", + "element", + "selector", + "matchesSelector", + "node", + "docFrag", + "host", + "window", + "realWindow", + "replace", + "prefixedMatchesSelector", + "getParent", + "el", + "indexOfDeepestElement", + "elements", + "deepestNodeIndex", + "deepestNodeParents", + "i", + "length", + "currentNode", + "deepestNode", + "currentNodeParent", + "deepestNodeParent", + "ownerDocument", + "higherNode", + "lowerNode", + "parseInt", + "getWindow", + "getComputedStyle", + "zIndex", + "ancestryStart", + "getNodeParents", + "HTMLElement", + "SVGElement", + "SVGSVGElement", + "ownerSVGElement", + "currentNodeParents", + "commonIndex", + "parents", + "lastChild", + "previousSibling", + "limit", + "parentParent", + "unshift", + "matchesUpTo", + "getActualElement", + "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" + ], + "sources": [ + "domUtils.ts" + ], + "sourcesContent": [ + "import type { Rect, Target, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport domObjects from './domObjects'\nimport is from './is'\nimport * as win from './window'\n\nexport function nodeContains (parent: Node, child: Node) {\n if (parent.contains) {\n return parent.contains(child as Node)\n }\n\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)) {\n return element\n }\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: 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: Node | Document | ShadowRoot) => el.parentNode || (el as ShadowRoot).host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Element[] | NodeListOf) {\n let deepestNodeParents: Node[] = []\n let deepestNodeIndex: number\n\n for (let i = 0; i < elements.length; i++) {\n const currentNode = elements[i]\n const deepestNode: Node = elements[deepestNodeIndex]\n\n // node may appear in elements array multiple times\n if (!currentNode || i === deepestNodeIndex) {\n continue\n }\n\n if (!deepestNode) {\n deepestNodeIndex = i\n continue\n }\n\n const currentNodeParent = getParent(currentNode)\n const deepestNodeParent = getParent(deepestNode)\n\n // check if the deepest or current are document.documentElement/rootElement\n // - if the current node is, do nothing and continue\n if (currentNodeParent === currentNode.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current node and continue to next\n else if (deepestNodeParent === currentNode.ownerDocument) {\n deepestNodeIndex = i\n continue\n }\n\n // compare zIndex of siblings\n if (currentNodeParent === deepestNodeParent) {\n if (zIndexIsHigherThan(currentNode, deepestNode)) {\n deepestNodeIndex = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest node\n deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode)\n\n let ancestryStart: Node\n\n // if the deepest node is an HTMLElement and the current node is a non root svg element\n if (\n deepestNode instanceof domObjects.HTMLElement &&\n currentNode instanceof domObjects.SVGElement &&\n !(currentNode instanceof domObjects.SVGSVGElement)\n ) {\n // TODO: is this check necessary? Was this for HTML elements embedded in SVG?\n if (currentNode === deepestNodeParent) {\n continue\n }\n\n ancestryStart = currentNode.ownerSVGElement\n } else {\n ancestryStart = currentNode\n }\n\n const currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument)\n let commonIndex = 0\n\n // get (position of closest common ancestor) + 1\n while (\n currentNodeParents[commonIndex] &&\n currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]\n ) {\n commonIndex++\n }\n\n const parents = [\n currentNodeParents[commonIndex - 1],\n currentNodeParents[commonIndex],\n deepestNodeParents[commonIndex],\n ]\n\n if (parents[0]) {\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestNodeIndex = i\n deepestNodeParents = currentNodeParents\n\n break\n } else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n }\n\n return deepestNodeIndex\n}\n\nfunction getNodeParents (node: Node, limit?: Node) {\n const parents: Node[] = []\n let parent: Node = node\n let parentParent: Node\n\n while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) {\n parents.unshift(parent)\n parent = parentParent\n }\n\n return parents\n}\n\nfunction zIndexIsHigherThan (higherNode: Node, lowerNode: Node) {\n const higherIndex = parseInt(win.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0\n const lowerIndex = parseInt(win.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0\n\n return higherIndex >= lowerIndex\n}\n\nexport function matchesUpTo (element: 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 Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Element) {\n return (element as any).correspondingUseElement || element\n}\n\nexport function getScrollXY (relevantWindow?: Window) {\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: Element): Required {\n const clientRect =\n element instanceof domObjects.SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]\n\n return (\n 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}\n\nexport function getElementRect (element: 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: Target) {\n if (!is.string(value)) {\n return false\n }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\n" + ], + "mappings": "OAEOA,MAAa,mBACbC,MAAgB,sBAChBC,MAAQ,iBACHC,MAAS,kBAEd,SAASC,aAAcC,EAAcC,GAC1C,GAAID,EAAOE,SACT,OAAOF,EAAOE,SAASD,GAGzB,KAAOA,GAAO,CACZ,GAAIA,IAAUD,EACZ,OAAO,EAGTC,EAASA,EAAeE,WAG1B,OAAO,SAGF,SAASC,QAASC,EAAeC,GACtC,KAAOT,EAAGQ,QAAQA,IAAU,CAC1B,GAAIE,gBAA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G,KACjBC,MAAOJ,EAAWI,MAClBC,IAAKL,EAAWK,IAChBC,OAAQN,EAAWM,OACnBC,MAAOP,EAAWO,OAASP,EAAWI,MAAQJ,EAAWG,KACzDK,OAAQR,EAAWQ,QAAUR,EAAWM,OAASN,EAAWK,YAK3D,SAASI,eAAgBlE,GAC9B,MAAMyD,EAAaD,qBAAqBxD,GAExC,IAAKV,EAAQ6E,QAAUV,EAAY,CACjC,MAAMW,EAAStB,YAAYrD,EAAIiC,UAAU1B,IAEzCyD,EAAWG,MAAQQ,EAAOpB,EAC1BS,EAAWI,OAASO,EAAOpB,EAC3BS,EAAWK,KAAOM,EAAOf,EACzBI,EAAWM,QAAUK,EAAOf,EAG9B,OAAOI,SAGF,SAASY,QAASlE,GACvB,MAAMmE,EAAO,GAEb,KAAOnE,GACLmE,EAAKC,KAAKpE,GACVA,EAAOL,WAAWK,GAGpB,OAAOmE,SAGF,SAASE,YAAaC,GAC3B,QAAKjF,EAAGkF,OAAOD,KAKflF,EAAW2D,SAASyB,cAAcF,IAC3B" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/exchange.d.ts b/packages/@interactjs/utils/exchange.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/utils/exchange.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/utils/exchange.js b/packages/@interactjs/utils/exchange.js new file mode 100644 index 000000000..9e3421352 --- /dev/null +++ b/packages/@interactjs/utils/exchange.js @@ -0,0 +1,2 @@ +export default {}; +//# sourceMappingURL=exchange.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/exchange.js.map b/packages/@interactjs/utils/exchange.js.map new file mode 100644 index 000000000..6746d080b --- /dev/null +++ b/packages/@interactjs/utils/exchange.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "exchange.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "AAAA,eAAe,EAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/exchange.prod.js b/packages/@interactjs/utils/exchange.prod.js new file mode 100644 index 000000000..1449a5d06 --- /dev/null +++ b/packages/@interactjs/utils/exchange.prod.js @@ -0,0 +1,2 @@ +export default{}; +//# sourceMappingURL=exchange.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/exchange.prod.js.map b/packages/@interactjs/utils/exchange.prod.js.map new file mode 100644 index 000000000..d9f191566 --- /dev/null +++ b/packages/@interactjs/utils/exchange.prod.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "names": [], + "sources": [ + "exchange.ts" + ], + "sourcesContent": [ + "export default {}\n" + ], + "mappings": "cAAe" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/exchange.stub.d.ts b/packages/@interactjs/utils/exchange.stub.d.ts new file mode 100644 index 000000000..d87c48512 --- /dev/null +++ b/packages/@interactjs/utils/exchange.stub.d.ts @@ -0,0 +1,2 @@ +declare const _default: {}; +export default _default; diff --git a/packages/@interactjs/utils/extend.d.ts b/packages/@interactjs/utils/extend.d.ts new file mode 100644 index 000000000..3179be382 --- /dev/null +++ b/packages/@interactjs/utils/extend.d.ts @@ -0,0 +1 @@ +export default function extend(dest: U & Partial, source: T): T & U; diff --git a/packages/@interactjs/utils/extend.js b/packages/@interactjs/utils/extend.js new file mode 100644 index 000000000..6120cf840 --- /dev/null +++ b/packages/@interactjs/utils/extend.js @@ -0,0 +1,10 @@ +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/packages/@interactjs/utils/extend.js.map b/packages/@interactjs/utils/extend.js.map new file mode 100644 index 000000000..53162e26d --- /dev/null +++ b/packages/@interactjs/utils/extend.js.map @@ -0,0 +1,17 @@ +{ + "version": 3, + "names": [ + "extend", + "dest", + "source", + "prop", + "ret" + ], + "sources": [ + "extend.ts" + ], + "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" + ], + "mappings": "AAAA,eAAe,SAASA,MAAT,CAAsCC,IAAtC,EAA4DC,MAA5D,EAA8E;EAC3F,KAAK,MAAMC,IAAX,IAAmBD,MAAnB,EAA2B;IACzB;IAAED,IAAD,CAAuBE,IAAvB,IAA+BD,MAAM,CAACC,IAAD,CAArC;EACF;;EAED,MAAMC,GAAG,GAAGH,IAAZ;EAEA,OAAOG,GAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/extend.prod.js b/packages/@interactjs/utils/extend.prod.js new file mode 100644 index 000000000..99c1e2fd2 --- /dev/null +++ b/packages/@interactjs/utils/extend.prod.js @@ -0,0 +1,2 @@ +export default function n(n,t){for(const o in t)n[o]=t[o];return n} +//# sourceMappingURL=extend.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/extend.prod.js.map b/packages/@interactjs/utils/extend.prod.js.map new file mode 100644 index 000000000..4b68d57c6 --- /dev/null +++ b/packages/@interactjs/utils/extend.prod.js.map @@ -0,0 +1,16 @@ +{ + "version": 3, + "names": [ + "extend", + "dest", + "source", + "prop" + ], + "sources": [ + "extend.ts" + ], + "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" + ], + "mappings": "eAAe,SAASA,EAA6BC,EAAsBC,GACzE,IAAK,MAAMC,KAAQD,EACfD,EAAsBE,GAAQD,EAAOC,GAKzC,OAFYF" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/getOriginXY.d.ts b/packages/@interactjs/utils/getOriginXY.d.ts new file mode 100644 index 000000000..04dca245a --- /dev/null +++ b/packages/@interactjs/utils/getOriginXY.d.ts @@ -0,0 +1,8 @@ +import type { PerActionDefaults } from '@interactjs/core/options'; +import type { ActionName, HasGetRect } from '@interactjs/core/types'; +export default function getOriginXY(target: HasGetRect & { + options: PerActionDefaults; +}, element: Node, actionName?: ActionName): { + x: number; + y: number; +}; diff --git a/packages/@interactjs/utils/getOriginXY.js b/packages/@interactjs/utils/getOriginXY.js new file mode 100644 index 000000000..cc8829c42 --- /dev/null +++ b/packages/@interactjs/utils/getOriginXY.js @@ -0,0 +1,12 @@ +import { rectToXY, resolveRectLike } from './rect'; +export default function getOriginXY(target, element, actionName) { + const actionOptions = actionName && 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/packages/@interactjs/utils/getOriginXY.js.map b/packages/@interactjs/utils/getOriginXY.js.map new file mode 100644 index 000000000..5a1f575a9 --- /dev/null +++ b/packages/@interactjs/utils/getOriginXY.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "names": [ + "rectToXY", + "resolveRectLike", + "getOriginXY", + "target", + "element", + "actionName", + "actionOptions", + "options", + "actionOrigin", + "origin", + "originRect", + "x", + "y" + ], + "sources": [ + "getOriginXY.ts" + ], + "sourcesContent": [ + "import type { PerActionDefaults } from '@interactjs/core/options'\nimport type { ActionName, HasGetRect } from '@interactjs/core/types'\n\nimport { rectToXY, resolveRectLike } from './rect'\n\nexport default function getOriginXY (\n target: HasGetRect & { options: PerActionDefaults },\n element: Node,\n actionName?: ActionName,\n) {\n const actionOptions = actionName && (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" + ], + "mappings": "AAGA,SAASA,QAAT,EAAmBC,eAAnB,QAA0C,QAA1C;AAEA,eAAe,SAASC,WAAT,CACbC,MADa,EAEbC,OAFa,EAGbC,UAHa,EAIb;EACA,MAAMC,aAAa,GAAGD,UAAU,IAAKF,MAAM,CAACI,OAAR,CAAwBF,UAAxB,CAApC;EACA,MAAMG,YAAY,GAAGF,aAAa,IAAIA,aAAa,CAACG,MAApD;EACA,MAAMA,MAAM,GAAGD,YAAY,IAAIL,MAAM,CAACI,OAAP,CAAeE,MAA9C;EAEA,MAAMC,UAAU,GAAGT,eAAe,CAACQ,MAAD,EAASN,MAAT,EAAiBC,OAAjB,EAA0B,CAACD,MAAM,IAAIC,OAAX,CAA1B,CAAlC;EAEA,OAAOJ,QAAQ,CAACU,UAAD,CAAR,IAAwB;IAAEC,CAAC,EAAE,CAAL;IAAQC,CAAC,EAAE;EAAX,CAA/B;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/getOriginXY.prod.js b/packages/@interactjs/utils/getOriginXY.prod.js new file mode 100644 index 000000000..f1da34af3 --- /dev/null +++ b/packages/@interactjs/utils/getOriginXY.prod.js @@ -0,0 +1,2 @@ +import{rectToXY as o,resolveRectLike as t}from"./rect";export default function i(i,n,r){const e=r&&i.options[r],p=e&&e.origin||i.options.origin,c=t(p,i,n,[i&&n]);return o(c)||{x:0,y:0}} +//# sourceMappingURL=getOriginXY.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/getOriginXY.prod.js.map b/packages/@interactjs/utils/getOriginXY.prod.js.map new file mode 100644 index 000000000..90346a298 --- /dev/null +++ b/packages/@interactjs/utils/getOriginXY.prod.js.map @@ -0,0 +1,24 @@ +{ + "version": 3, + "names": [ + "rectToXY", + "resolveRectLike", + "getOriginXY", + "target", + "element", + "actionName", + "actionOptions", + "options", + "origin", + "originRect", + "x", + "y" + ], + "sources": [ + "getOriginXY.ts" + ], + "sourcesContent": [ + "import type { PerActionDefaults } from '@interactjs/core/options'\nimport type { ActionName, HasGetRect } from '@interactjs/core/types'\n\nimport { rectToXY, resolveRectLike } from './rect'\n\nexport default function getOriginXY (\n target: HasGetRect & { options: PerActionDefaults },\n element: Node,\n actionName?: ActionName,\n) {\n const actionOptions = actionName && (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" + ], + "mappings": "mBAGSA,qBAAUC,MAAuB,wBAE3B,SAASC,EACtBC,EACAC,EACAC,GAEA,MAAMC,EAAgBD,GAAeF,EAAOI,QAAgBF,GAEtDG,EADeF,GAAiBA,EAAcE,QACrBL,EAAOI,QAAQC,OAExCC,EAAaR,EAAgBO,EAAQL,EAAQC,EAAS,CAACD,GAAUC,IAEvE,OAAOJ,EAASS,IAAe,CAAEC,EAAG,EAAGC,EAAG" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/hypot.d.ts b/packages/@interactjs/utils/hypot.d.ts new file mode 100644 index 000000000..a9ae05c6f --- /dev/null +++ b/packages/@interactjs/utils/hypot.d.ts @@ -0,0 +1,2 @@ +declare const _default: (x: number, y: number) => number; +export default _default; diff --git a/packages/@interactjs/utils/hypot.js b/packages/@interactjs/utils/hypot.js new file mode 100644 index 000000000..d3512e243 --- /dev/null +++ b/packages/@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/packages/@interactjs/utils/hypot.js.map b/packages/@interactjs/utils/hypot.js.map new file mode 100644 index 000000000..f35df45c7 --- /dev/null +++ b/packages/@interactjs/utils/hypot.js.map @@ -0,0 +1,16 @@ +{ + "version": 3, + "names": [ + "x", + "y", + "Math", + "sqrt" + ], + "sources": [ + "hypot.ts" + ], + "sourcesContent": [ + "export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n" + ], + "mappings": "AAAA,gBAAe,CAACA,CAAD,EAAYC,CAAZ,KAA0BC,IAAI,CAACC,IAAL,CAAUH,CAAC,GAAGA,CAAJ,GAAQC,CAAC,GAAGA,CAAtB,CAAzC" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/hypot.prod.js b/packages/@interactjs/utils/hypot.prod.js new file mode 100644 index 000000000..79f558b4f --- /dev/null +++ b/packages/@interactjs/utils/hypot.prod.js @@ -0,0 +1,2 @@ +export default(t,a)=>Math.sqrt(t*t+a*a); +//# sourceMappingURL=hypot.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/hypot.prod.js.map b/packages/@interactjs/utils/hypot.prod.js.map new file mode 100644 index 000000000..a0aa32c1b --- /dev/null +++ b/packages/@interactjs/utils/hypot.prod.js.map @@ -0,0 +1,16 @@ +{ + "version": 3, + "names": [ + "x", + "y", + "Math", + "sqrt" + ], + "sources": [ + "hypot.ts" + ], + "sourcesContent": [ + "export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n" + ], + "mappings": "cAAA,CAAgBA,EAAWC,IAAcC,KAAKC,KAAKH,EAAIA,EAAIC,EAAIA" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/is.d.ts b/packages/@interactjs/utils/is.d.ts new file mode 100644 index 000000000..cabe69373 --- /dev/null +++ b/packages/@interactjs/utils/is.d.ts @@ -0,0 +1,17 @@ +declare const _default: { + window: (thing: any) => thing is Window; + docFrag: (thing: any) => thing is DocumentFragment; + object: (thing: any) => thing is { + [index: string]: any; + }; + func: (thing: any) => thing is (...args: any[]) => any; + number: (thing: any) => thing is number; + bool: (thing: any) => thing is boolean; + string: (thing: any) => thing is string; + element: (thing: any) => thing is HTMLElement | SVGElement; + plainObject: (thing: any) => thing is { + [index: string]: any; + }; + array: (thing: any) => thing is T[]; +}; +export default _default; diff --git a/packages/@interactjs/utils/is.js b/packages/@interactjs/utils/is.js new file mode 100644 index 000000000..cf2a0dead --- /dev/null +++ b/packages/@interactjs/utils/is.js @@ -0,0 +1,44 @@ +import isWindow from './isWindow'; +import * as win from './window'; + +const window = thing => thing === win.window || isWindow(thing); + +const docFrag = thing => object(thing) && thing.nodeType === 11; + +const object = thing => !!thing && typeof thing === 'object'; + +const func = thing => typeof thing === 'function'; + +const number = thing => typeof thing === 'number'; + +const bool = thing => typeof thing === 'boolean'; + +const string = thing => typeof thing === 'string'; + +const element = thing => { + if (!thing || typeof thing !== 'object') { + return false; + } + + const _window = win.getWindow(thing) || win.window; + + return /object|function/.test(typeof Element) ? thing instanceof Element || thing instanceof _window.Element : thing.nodeType === 1 && typeof thing.nodeName === 'string'; +}; + +const plainObject = thing => object(thing) && !!thing.constructor && /function Object\b/.test(thing.constructor.toString()); + +const array = thing => object(thing) && typeof thing.length !== 'undefined' && func(thing.splice); + +export default { + window, + docFrag, + object, + func, + number, + bool, + string, + element, + plainObject, + array +}; +//# sourceMappingURL=is.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/is.js.map b/packages/@interactjs/utils/is.js.map new file mode 100644 index 000000000..55cc67a86 --- /dev/null +++ b/packages/@interactjs/utils/is.js.map @@ -0,0 +1,35 @@ +{ + "version": 3, + "names": [ + "isWindow", + "win", + "window", + "thing", + "docFrag", + "object", + "nodeType", + "func", + "number", + "bool", + "string", + "element", + "_window", + "getWindow", + "test", + "Element", + "nodeName", + "plainObject", + "constructor", + "toString", + "array", + "length", + "splice" + ], + "sources": [ + "is.ts" + ], + "sourcesContent": [ + "import isWindow from './isWindow'\nimport * as win from './window'\n\nconst window = (thing: any): thing is Window => thing === win.window || isWindow(thing)\n\nconst docFrag = (thing: any): thing is DocumentFragment => object(thing) && thing.nodeType === 11\n\nconst object = (thing: any): thing is { [index: string]: any } => !!thing && typeof thing === 'object'\n\nconst func = (thing: any): thing is (...args: any[]) => any => typeof thing === 'function'\n\nconst number = (thing: any): thing is number => typeof thing === 'number'\n\nconst bool = (thing: any): thing is boolean => typeof thing === 'boolean'\n\nconst string = (thing: any): thing is string => typeof thing === 'string'\n\nconst element = (thing: any): thing is HTMLElement | SVGElement => {\n if (!thing || typeof thing !== 'object') {\n return false\n }\n\n const _window = win.getWindow(thing) || win.window\n\n return /object|function/.test(typeof Element)\n ? thing instanceof Element || thing instanceof _window.Element\n : thing.nodeType === 1 && typeof thing.nodeName === 'string'\n}\n\nconst plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) && !!thing.constructor && /function Object\\b/.test(thing.constructor.toString())\n\nconst array = (thing: any): thing is T[] =>\n object(thing) && typeof thing.length !== 'undefined' && func(thing.splice)\n\nexport default {\n window,\n docFrag,\n object,\n func,\n number,\n bool,\n string,\n element,\n plainObject,\n array,\n}\n" + ], + "mappings": "AAAA,OAAOA,QAAP,MAAqB,YAArB;AACA,OAAO,KAAKC,GAAZ,MAAqB,UAArB;;AAEA,MAAMC,MAAM,GAAIC,KAAD,IAAiCA,KAAK,KAAKF,GAAG,CAACC,MAAd,IAAwBF,QAAQ,CAACG,KAAD,CAAhF;;AAEA,MAAMC,OAAO,GAAID,KAAD,IAA2CE,MAAM,CAACF,KAAD,CAAN,IAAiBA,KAAK,CAACG,QAAN,KAAmB,EAA/F;;AAEA,MAAMD,MAAM,GAAIF,KAAD,IAAmD,CAAC,CAACA,KAAF,IAAW,OAAOA,KAAP,KAAiB,QAA9F;;AAEA,MAAMI,IAAI,GAAIJ,KAAD,IAAkD,OAAOA,KAAP,KAAiB,UAAhF;;AAEA,MAAMK,MAAM,GAAIL,KAAD,IAAiC,OAAOA,KAAP,KAAiB,QAAjE;;AAEA,MAAMM,IAAI,GAAIN,KAAD,IAAkC,OAAOA,KAAP,KAAiB,SAAhE;;AAEA,MAAMO,MAAM,GAAIP,KAAD,IAAiC,OAAOA,KAAP,KAAiB,QAAjE;;AAEA,MAAMQ,OAAO,GAAIR,KAAD,IAAmD;EACjE,IAAI,CAACA,KAAD,IAAU,OAAOA,KAAP,KAAiB,QAA/B,EAAyC;IACvC,OAAO,KAAP;EACD;;EAED,MAAMS,OAAO,GAAGX,GAAG,CAACY,SAAJ,CAAcV,KAAd,KAAwBF,GAAG,CAACC,MAA5C;;EAEA,OAAO,kBAAkBY,IAAlB,CAAuB,OAAOC,OAA9B,IACHZ,KAAK,YAAYY,OAAjB,IAA4BZ,KAAK,YAAYS,OAAO,CAACG,OADlD,GAEHZ,KAAK,CAACG,QAAN,KAAmB,CAAnB,IAAwB,OAAOH,KAAK,CAACa,QAAb,KAA0B,QAFtD;AAGD,CAVD;;AAYA,MAAMC,WAA0B,GAAId,KAAD,IACjCE,MAAM,CAACF,KAAD,CAAN,IAAiB,CAAC,CAACA,KAAK,CAACe,WAAzB,IAAwC,oBAAoBJ,IAApB,CAAyBX,KAAK,CAACe,WAAN,CAAkBC,QAAlB,EAAzB,CAD1C;;AAGA,MAAMC,KAAK,GAAuBjB,KAApB,IACZE,MAAM,CAACF,KAAD,CAAN,IAAiB,OAAOA,KAAK,CAACkB,MAAb,KAAwB,WAAzC,IAAwDd,IAAI,CAACJ,KAAK,CAACmB,MAAP,CAD9D;;AAGA,eAAe;EACbpB,MADa;EAEbE,OAFa;EAGbC,MAHa;EAIbE,IAJa;EAKbC,MALa;EAMbC,IANa;EAObC,MAPa;EAQbC,OARa;EASbM,WATa;EAUbG;AAVa,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/is.prod.js b/packages/@interactjs/utils/is.prod.js new file mode 100644 index 000000000..bf3fe0b93 --- /dev/null +++ b/packages/@interactjs/utils/is.prod.js @@ -0,0 +1,2 @@ +import t from"./isWindow";import*as o from"./window";const e=t=>!!t&&"object"==typeof t,n=t=>"function"==typeof t;export default{window:e=>e===o.window||t(e),docFrag:t=>e(t)&&11===t.nodeType,object:e,func:n,number:t=>"number"==typeof t,bool:t=>"boolean"==typeof t,string:t=>"string"==typeof t,element(t){if(!t||"object"!=typeof t)return!1;const e=o.getWindow(t)||o.window;return/object|function/.test(typeof Element)?t instanceof Element||t instanceof e.Element:1===t.nodeType&&"string"==typeof t.nodeName},plainObject:t=>e(t)&&!!t.constructor&&/function Object\b/.test(t.constructor.toString()),array:t=>e(t)&&void 0!==t.length&&n(t.splice)}; +//# sourceMappingURL=is.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/is.prod.js.map b/packages/@interactjs/utils/is.prod.js.map new file mode 100644 index 000000000..4aa8239f5 --- /dev/null +++ b/packages/@interactjs/utils/is.prod.js.map @@ -0,0 +1,35 @@ +{ + "version": 3, + "names": [ + "isWindow", + "win", + "object", + "thing", + "func", + "window", + "docFrag", + "nodeType", + "number", + "bool", + "string", + "element", + "_window", + "getWindow", + "test", + "Element", + "nodeName", + "plainObject", + "constructor", + "toString", + "array", + "length", + "splice" + ], + "sources": [ + "is.ts" + ], + "sourcesContent": [ + "import isWindow from './isWindow'\nimport * as win from './window'\n\nconst window = (thing: any): thing is Window => thing === win.window || isWindow(thing)\n\nconst docFrag = (thing: any): thing is DocumentFragment => object(thing) && thing.nodeType === 11\n\nconst object = (thing: any): thing is { [index: string]: any } => !!thing && typeof thing === 'object'\n\nconst func = (thing: any): thing is (...args: any[]) => any => typeof thing === 'function'\n\nconst number = (thing: any): thing is number => typeof thing === 'number'\n\nconst bool = (thing: any): thing is boolean => typeof thing === 'boolean'\n\nconst string = (thing: any): thing is string => typeof thing === 'string'\n\nconst element = (thing: any): thing is HTMLElement | SVGElement => {\n if (!thing || typeof thing !== 'object') {\n return false\n }\n\n const _window = win.getWindow(thing) || win.window\n\n return /object|function/.test(typeof Element)\n ? thing instanceof Element || thing instanceof _window.Element\n : thing.nodeType === 1 && typeof thing.nodeName === 'string'\n}\n\nconst plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) && !!thing.constructor && /function Object\\b/.test(thing.constructor.toString())\n\nconst array = (thing: any): thing is T[] =>\n object(thing) && typeof thing.length !== 'undefined' && func(thing.splice)\n\nexport default {\n window,\n docFrag,\n object,\n func,\n number,\n bool,\n string,\n element,\n plainObject,\n array,\n}\n" + ], + "mappings": "OAAOA,MAAc,uBACTC,MAAS,WAErB,MAIMC,EAAUC,KAAoDA,GAA0B,iBAAVA,EAE9EC,EAAQD,GAAkE,mBAAVA,gBA0BvD,CACbE,OAjCcF,GAAgCA,IAAUF,EAAII,QAAUL,EAASG,GAkC/EG,QAhCeH,GAA0CD,EAAOC,IAA6B,KAAnBA,EAAMI,SAiChFL,SACAE,OACAI,OA7BcL,GAAiD,iBAAVA,EA8BrDM,KA5BYN,GAAkD,kBAAVA,EA6BpDO,OA3BcP,GAAiD,iBAAVA,EA4BrDQ,QA1BeR,GACf,IAAKA,GAA0B,iBAAVA,EACnB,OAAO,EAGT,MAAMS,EAAUX,EAAIY,UAAUV,IAAUF,EAAII,OAE5C,MAAO,kBAAkBS,YAAYC,SACjCZ,aAAiBY,SAAWZ,aAAiBS,EAAQG,QAClC,IAAnBZ,EAAMI,UAA4C,iBAAnBJ,EAAMa,UAkBzCC,YAfkCd,GAClCD,EAAOC,MAAYA,EAAMe,aAAe,oBAAoBJ,KAAKX,EAAMe,YAAYC,YAenFC,MAbgCjB,GAChCD,EAAOC,SAAkC,IAAjBA,EAAMkB,QAA0BjB,EAAKD,EAAMmB" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/isNonNativeEvent.d.ts b/packages/@interactjs/utils/isNonNativeEvent.d.ts new file mode 100644 index 000000000..0cebcf5e6 --- /dev/null +++ b/packages/@interactjs/utils/isNonNativeEvent.d.ts @@ -0,0 +1,2 @@ +import type { Actions } from '@interactjs/core/types'; +export default function isNonNativeEvent(type: string, actions: Actions): boolean; diff --git a/packages/@interactjs/utils/isNonNativeEvent.js b/packages/@interactjs/utils/isNonNativeEvent.js new file mode 100644 index 000000000..0948e228f --- /dev/null +++ b/packages/@interactjs/utils/isNonNativeEvent.js @@ -0,0 +1,14 @@ +export default 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; +} +//# sourceMappingURL=isNonNativeEvent.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/isNonNativeEvent.js.map b/packages/@interactjs/utils/isNonNativeEvent.js.map new file mode 100644 index 000000000..016922123 --- /dev/null +++ b/packages/@interactjs/utils/isNonNativeEvent.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "isNonNativeEvent", + "type", + "actions", + "phaselessTypes", + "name", + "map", + "indexOf", + "substr", + "length", + "phases" + ], + "sources": [ + "isNonNativeEvent.ts" + ], + "sourcesContent": [ + "import type { Actions } from '@interactjs/core/types'\n\nexport default function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) {\n return true\n }\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" + ], + "mappings": "AAEA,eAAe,SAASA,gBAAT,CAA2BC,IAA3B,EAAyCC,OAAzC,EAA2D;EACxE,IAAIA,OAAO,CAACC,cAAR,CAAuBF,IAAvB,CAAJ,EAAkC;IAChC,OAAO,IAAP;EACD;;EAED,KAAK,MAAMG,IAAX,IAAmBF,OAAO,CAACG,GAA3B,EAAgC;IAC9B,IAAIJ,IAAI,CAACK,OAAL,CAAaF,IAAb,MAAuB,CAAvB,IAA4BH,IAAI,CAACM,MAAL,CAAYH,IAAI,CAACI,MAAjB,KAA4BN,OAAO,CAACO,MAApE,EAA4E;MAC1E,OAAO,IAAP;IACD;EACF;;EAED,OAAO,KAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/isNonNativeEvent.prod.js b/packages/@interactjs/utils/isNonNativeEvent.prod.js new file mode 100644 index 000000000..f42adb07d --- /dev/null +++ b/packages/@interactjs/utils/isNonNativeEvent.prod.js @@ -0,0 +1,2 @@ +export default function e(e,n){if(n.phaselessTypes[e])return!0;for(const r in n.map)if(0===e.indexOf(r)&&e.substr(r.length)in n.phases)return!0;return!1} +//# sourceMappingURL=isNonNativeEvent.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/isNonNativeEvent.prod.js.map b/packages/@interactjs/utils/isNonNativeEvent.prod.js.map new file mode 100644 index 000000000..2d32930b4 --- /dev/null +++ b/packages/@interactjs/utils/isNonNativeEvent.prod.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "isNonNativeEvent", + "type", + "actions", + "phaselessTypes", + "name", + "map", + "indexOf", + "substr", + "length", + "phases" + ], + "sources": [ + "isNonNativeEvent.ts" + ], + "sourcesContent": [ + "import type { Actions } from '@interactjs/core/types'\n\nexport default function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) {\n return true\n }\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" + ], + "mappings": "eAEe,SAASA,EAAkBC,EAAcC,GACtD,GAAIA,EAAQC,eAAeF,GACzB,OAAO,EAGT,IAAK,MAAMG,KAAQF,EAAQG,IACzB,GAA2B,IAAvBJ,EAAKK,QAAQF,IAAeH,EAAKM,OAAOH,EAAKI,UAAWN,EAAQO,OAClE,OAAO,EAIX,OAAO" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/isWindow.d.ts b/packages/@interactjs/utils/isWindow.d.ts new file mode 100644 index 000000000..eb3719fa8 --- /dev/null +++ b/packages/@interactjs/utils/isWindow.d.ts @@ -0,0 +1,2 @@ +declare const _default: (thing: any) => boolean; +export default _default; diff --git a/packages/@interactjs/utils/isWindow.js b/packages/@interactjs/utils/isWindow.js new file mode 100644 index 000000000..55efd021e --- /dev/null +++ b/packages/@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/packages/@interactjs/utils/isWindow.js.map b/packages/@interactjs/utils/isWindow.js.map new file mode 100644 index 000000000..acd3d5340 --- /dev/null +++ b/packages/@interactjs/utils/isWindow.js.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "names": [ + "thing", + "Window" + ], + "sources": [ + "isWindow.ts" + ], + "sourcesContent": [ + "export default (thing: any) => !!(thing && thing.Window) && thing instanceof thing.Window\n" + ], + "mappings": "AAAA,gBAAgBA,KAAD,IAAgB,CAAC,EAAEA,KAAK,IAAIA,KAAK,CAACC,MAAjB,CAAD,IAA6BD,KAAK,YAAYA,KAAK,CAACC,MAAnF" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/isWindow.prod.js b/packages/@interactjs/utils/isWindow.prod.js new file mode 100644 index 000000000..ec7ee0ffb --- /dev/null +++ b/packages/@interactjs/utils/isWindow.prod.js @@ -0,0 +1,2 @@ +export default n=>!(!n||!n.Window)&&n instanceof n.Window; +//# sourceMappingURL=isWindow.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/isWindow.prod.js.map b/packages/@interactjs/utils/isWindow.prod.js.map new file mode 100644 index 000000000..993568668 --- /dev/null +++ b/packages/@interactjs/utils/isWindow.prod.js.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "names": [ + "thing", + "Window" + ], + "sources": [ + "isWindow.ts" + ], + "sourcesContent": [ + "export default (thing: any) => !!(thing && thing.Window) && thing instanceof thing.Window\n" + ], + "mappings": "eAAgBA,MAAkBA,IAASA,EAAMC,SAAWD,aAAiBA,EAAMC" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/misc.d.ts b/packages/@interactjs/utils/misc.d.ts new file mode 100644 index 000000000..5e825407f --- /dev/null +++ b/packages/@interactjs/utils/misc.d.ts @@ -0,0 +1,4 @@ +import type { ActionName, ActionProps } from '@interactjs/core/types'; +export declare function warnOnce(this: T, method: (...args: any[]) => any, message: string): (this: T) => any; +export declare function copyAction(dest: ActionProps, src: ActionProps): ActionProps; +export declare const sign: (n: number) => 1 | -1; diff --git a/packages/@interactjs/utils/misc.js b/packages/@interactjs/utils/misc.js new file mode 100644 index 000000000..4e30dece7 --- /dev/null +++ b/packages/@interactjs/utils/misc.js @@ -0,0 +1,21 @@ +import { window } from './window'; +export function warnOnce(method, message) { + let warned = false; + return function () { + if (!warned) { + ; + 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 const sign = n => n >= 0 ? 1 : -1; +//# sourceMappingURL=misc.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/misc.js.map b/packages/@interactjs/utils/misc.js.map new file mode 100644 index 000000000..8d625360d --- /dev/null +++ b/packages/@interactjs/utils/misc.js.map @@ -0,0 +1,29 @@ +{ + "version": 3, + "names": [ + "window", + "warnOnce", + "method", + "message", + "warned", + "console", + "warn", + "apply", + "arguments", + "copyAction", + "dest", + "src", + "name", + "axis", + "edges", + "sign", + "n" + ], + "sources": [ + "misc.ts" + ], + "sourcesContent": [ + "import type { ActionName, ActionProps } from '@interactjs/core/types'\n\nimport { window } from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n return function (this: T) {\n if (!warned) {\n ;(window as any).console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: ActionProps, src: ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport const sign = (n: number) => (n >= 0 ? 1 : -1)\n" + ], + "mappings": "AAEA,SAASA,MAAT,QAAuB,UAAvB;AAEA,OAAO,SAASC,QAAT,CAA+BC,MAA/B,EAAgEC,OAAhE,EAAiF;EACtF,IAAIC,MAAM,GAAG,KAAb;EAEA,OAAO,YAAmB;IACxB,IAAI,CAACA,MAAL,EAAa;MACX;MAAEJ,MAAD,CAAgBK,OAAhB,CAAwBC,IAAxB,CAA6BH,OAA7B;MACDC,MAAM,GAAG,IAAT;IACD;;IAED,OAAOF,MAAM,CAACK,KAAP,CAAa,IAAb,EAAmBC,SAAnB,CAAP;EACD,CAPD;AAQD;AAED,OAAO,SAASC,UAAT,CAA2CC,IAA3C,EAAmEC,GAAnE,EAAwF;EAC7FD,IAAI,CAACE,IAAL,GAAYD,GAAG,CAACC,IAAhB;EACAF,IAAI,CAACG,IAAL,GAAYF,GAAG,CAACE,IAAhB;EACAH,IAAI,CAACI,KAAL,GAAaH,GAAG,CAACG,KAAjB;EAEA,OAAOJ,IAAP;AACD;AAED,OAAO,MAAMK,IAAI,GAAIC,CAAD,IAAgBA,CAAC,IAAI,CAAL,GAAS,CAAT,GAAa,CAAC,CAA3C" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/misc.prod.js b/packages/@interactjs/utils/misc.prod.js new file mode 100644 index 000000000..51a10d899 --- /dev/null +++ b/packages/@interactjs/utils/misc.prod.js @@ -0,0 +1,2 @@ +import{window as n}from"./window";export function warnOnce(e,o){let t=!1;return function(){return t||(n.console.warn(o),t=!0),e.apply(this,arguments)}}export function copyAction(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n}export const sign=n=>n>=0?1:-1; +//# sourceMappingURL=misc.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/misc.prod.js.map b/packages/@interactjs/utils/misc.prod.js.map new file mode 100644 index 000000000..6bb20a0a5 --- /dev/null +++ b/packages/@interactjs/utils/misc.prod.js.map @@ -0,0 +1,30 @@ +{ + "version": 3, + "names": [ + "window", + "warnOnce", + "method", + "message", + "warned", + "console", + "warn", + "apply", + "this", + "arguments", + "copyAction", + "dest", + "src", + "name", + "axis", + "edges", + "sign", + "n" + ], + "sources": [ + "misc.ts" + ], + "sourcesContent": [ + "import type { ActionName, ActionProps } from '@interactjs/core/types'\n\nimport { window } from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n return function (this: T) {\n if (!warned) {\n ;(window as any).console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: ActionProps, src: ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport const sign = (n: number) => (n >= 0 ? 1 : -1)\n" + ], + "mappings": "iBAESA,MAAc,kBAEhB,SAASC,SAAsBC,EAAiCC,GACrE,IAAIC,GAAS,EAEb,OAAO,WAML,OALKA,IACDJ,EAAeK,QAAQC,KAAKH,GAC9BC,GAAS,GAGJF,EAAOK,MAAMC,KAAMC,mBAIvB,SAASC,WAAkCC,EAAwBC,GAKxE,OAJAD,EAAKE,KAAOD,EAAIC,KAChBF,EAAKG,KAAOF,EAAIE,KAChBH,EAAKI,MAAQH,EAAIG,MAEVJ,SAGF,MAAMK,KAAQC,GAAeA,GAAK,EAAI,GAAK" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/normalizeListeners.d.ts b/packages/@interactjs/utils/normalizeListeners.d.ts new file mode 100644 index 000000000..b10442a75 --- /dev/null +++ b/packages/@interactjs/utils/normalizeListeners.d.ts @@ -0,0 +1,5 @@ +import type { EventTypes, Listener, ListenersArg } from '@interactjs/core/types'; +export interface NormalizedListeners { + [type: string]: Listener[]; +} +export default function normalize(type: EventTypes, listeners?: ListenersArg | ListenersArg[] | null, filter?: (_typeOrPrefix: string) => boolean, result?: NormalizedListeners): NormalizedListeners; diff --git a/packages/@interactjs/utils/normalizeListeners.js b/packages/@interactjs/utils/normalizeListeners.js new file mode 100644 index 000000000..c1603df1f --- /dev/null +++ b/packages/@interactjs/utils/normalizeListeners.js @@ -0,0 +1,41 @@ +import is from './is'; +export default function normalize(type, listeners, filter = _typeOrPrefix => true, result) { + result = result || {}; + + if (is.string(type) && type.search(' ') !== -1) { + type = split(type); + } + + if (is.array(type)) { + type.forEach(t => normalize(t, listeners, filter, result)); + return result; + } // before: type = [{ drag: () => {} }], listeners = undefined + // after: type = '' , listeners = [{ drag: () => {} }] + + + if (is.object(type)) { + listeners = type; + type = ''; + } + + if (is.func(listeners) && filter(type)) { + result[type] = result[type] || []; + result[type].push(listeners); + } else if (is.array(listeners)) { + for (const l of listeners) { + normalize(type, l, filter, result); + } + } else if (is.object(listeners)) { + for (const prefix in listeners) { + const combinedTypes = split(prefix).map(p => `${type}${p}`); + normalize(combinedTypes, listeners[prefix], filter, result); + } + } + + return result; +} + +function split(type) { + return type.trim().split(/ +/); +} +//# sourceMappingURL=normalizeListeners.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/normalizeListeners.js.map b/packages/@interactjs/utils/normalizeListeners.js.map new file mode 100644 index 000000000..a09065513 --- /dev/null +++ b/packages/@interactjs/utils/normalizeListeners.js.map @@ -0,0 +1,34 @@ +{ + "version": 3, + "names": [ + "is", + "normalize", + "type", + "listeners", + "filter", + "_typeOrPrefix", + "result", + "string", + "search", + "split", + "array", + "forEach", + "t", + "object", + "func", + "push", + "l", + "prefix", + "combinedTypes", + "map", + "p", + "trim" + ], + "sources": [ + "normalizeListeners.ts" + ], + "sourcesContent": [ + "import type { EventTypes, Listener, ListenersArg } from '@interactjs/core/types'\n\nimport is from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Listener[]\n}\n\nexport default function normalize (\n type: EventTypes,\n listeners?: ListenersArg | ListenersArg[] | null,\n filter = (_typeOrPrefix: string) => true,\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 type.forEach((t) => normalize(t, listeners, filter, result))\n return result\n }\n\n // before: type = [{ drag: () => {} }], listeners = undefined\n // after: type = '' , listeners = [{ drag: () => {} }]\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners) && filter(type)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n } else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, filter, result)\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], filter, result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n" + ], + "mappings": "AAEA,OAAOA,EAAP,MAAe,MAAf;AAMA,eAAe,SAASC,SAAT,CACbC,IADa,EAEbC,SAFa,EAGbC,MAAM,GAAIC,aAAD,IAA2B,IAHvB,EAIbC,MAJa,EAKQ;EACrBA,MAAM,GAAGA,MAAM,IAAI,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B,EAAmCb,MAAnC,EAA2CE,MAA3C,CAAT;IACD;EACF;;EAED,OAAOA,MAAP;AACD;;AAED,SAASG,KAAT,CAAgBP,IAAhB,EAA8B;EAC5B,OAAOA,IAAI,CAACmB,IAAL,GAAYZ,KAAZ,CAAkB,IAAlB,CAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/normalizeListeners.prod.js b/packages/@interactjs/utils/normalizeListeners.prod.js new file mode 100644 index 000000000..7b4b73221 --- /dev/null +++ b/packages/@interactjs/utils/normalizeListeners.prod.js @@ -0,0 +1,2 @@ +import r from"./is";export default function t(o,e,i=(r=>!0),n){if(n=n||{},r.string(o)&&-1!==o.search(" ")&&(o=f(o)),r.array(o))return o.forEach((r=>t(r,e,i,n))),n;if(r.object(o)&&(e=o,o=""),r.func(e)&&i(o))n[o]=n[o]||[],n[o].push(e);else if(r.array(e))for(const r of e)t(o,r,i,n);else if(r.object(e))for(const r in e)t(f(r).map((r=>`${o}${r}`)),e[r],i,n);return n}function f(r){return r.trim().split(/ +/)} +//# sourceMappingURL=normalizeListeners.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/normalizeListeners.prod.js.map b/packages/@interactjs/utils/normalizeListeners.prod.js.map new file mode 100644 index 000000000..0e43e2a3a --- /dev/null +++ b/packages/@interactjs/utils/normalizeListeners.prod.js.map @@ -0,0 +1,33 @@ +{ + "version": 3, + "names": [ + "is", + "normalize", + "type", + "listeners", + "filter", + "_typeOrPrefix", + "result", + "string", + "search", + "split", + "array", + "forEach", + "t", + "object", + "func", + "push", + "l", + "prefix", + "map", + "p", + "trim" + ], + "sources": [ + "normalizeListeners.ts" + ], + "sourcesContent": [ + "import type { EventTypes, Listener, ListenersArg } from '@interactjs/core/types'\n\nimport is from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Listener[]\n}\n\nexport default function normalize (\n type: EventTypes,\n listeners?: ListenersArg | ListenersArg[] | null,\n filter = (_typeOrPrefix: string) => true,\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 type.forEach((t) => normalize(t, listeners, filter, result))\n return result\n }\n\n // before: type = [{ drag: () => {} }], listeners = undefined\n // after: type = '' , listeners = [{ drag: () => {} }]\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners) && filter(type)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n } else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, filter, result)\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], filter, result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n" + ], + "mappings": "OAEOA,MAAQ,sBAMA,SAASC,EACtBC,EACAC,EACAC,EAAUC,KAA0B,GACpCC,GAQA,GANAA,EAASA,GAAU,GAEfN,EAAGO,OAAOL,KAA+B,IAAtBA,EAAKM,OAAO,OACjCN,EAAOO,EAAMP,IAGXF,EAAGU,MAAMR,GAEX,OADAA,EAAKS,SAASC,GAAMX,EAAUW,EAAGT,EAAWC,EAAQE,KAC7CA,EAUT,GALIN,EAAGa,OAAOX,KACZC,EAAYD,EACZA,EAAO,IAGLF,EAAGc,KAAKX,IAAcC,EAAOF,GAC/BI,EAAOJ,GAAQI,EAAOJ,IAAS,GAC/BI,EAAOJ,GAAMa,KAAKZ,QACb,GAAIH,EAAGU,MAAMP,GAClB,IAAK,MAAMa,KAAKb,EACdF,EAAUC,EAAMc,EAAGZ,EAAQE,QAExB,GAAIN,EAAGa,OAAOV,GACnB,IAAK,MAAMc,KAAUd,EAGnBF,EAFsBQ,EAAMQ,GAAQC,KAAKC,GAAO,GAAEjB,IAAOiB,MAEhChB,EAAUc,GAASb,EAAQE,GAIxD,OAAOA,EAGT,SAASG,EAAOP,GACd,OAAOA,EAAKkB,OAAOX,MAAM" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/package.json b/packages/@interactjs/utils/package.json index b7e4d8721..b7e2460fa 100644 --- a/packages/@interactjs/utils/package.json +++ b/packages/@interactjs/utils/package.json @@ -7,10 +7,7 @@ "url": "https://github.com/taye/interact.js.git", "directory": "packages/@interactjs/utils" }, - "peerDependencies": { - "@interactjs/feedback": "1.10.23", - "@interactjs/symbol-tree": "1.10.23" - }, + "peerDependencies": {}, "publishConfig": { "access": "public" }, diff --git a/packages/@interactjs/utils/pointerExtend.d.ts b/packages/@interactjs/utils/pointerExtend.d.ts new file mode 100644 index 000000000..e68db270b --- /dev/null +++ b/packages/@interactjs/utils/pointerExtend.d.ts @@ -0,0 +1,5 @@ +export default function pointerExtend(dest: Partial; +}>, source: T): Partial; +}>; diff --git a/packages/@interactjs/utils/pointerExtend.js b/packages/@interactjs/utils/pointerExtend.js new file mode 100644 index 000000000..6db1dc0c9 --- /dev/null +++ b/packages/@interactjs/utils/pointerExtend.js @@ -0,0 +1,27 @@ +const VENDOR_PREFIXES = ['webkit', 'moz']; +export default function pointerExtend(dest, source) { + dest.__set ||= {}; + + for (const prop in source) { + // skip deprecated prefixed properties + if (VENDOR_PREFIXES.some(prefix => prop.indexOf(prefix) === 0)) continue; + + if (typeof dest[prop] !== 'function' && prop !== '__set') { + Object.defineProperty(dest, prop, { + get() { + if (prop in dest.__set) return dest.__set[prop]; + return dest.__set[prop] = source[prop]; + }, + + set(value) { + dest.__set[prop] = value; + }, + + configurable: true + }); + } + } + + return dest; +} +//# sourceMappingURL=pointerExtend.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerExtend.js.map b/packages/@interactjs/utils/pointerExtend.js.map new file mode 100644 index 000000000..ea7438b30 --- /dev/null +++ b/packages/@interactjs/utils/pointerExtend.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "VENDOR_PREFIXES", + "pointerExtend", + "dest", + "source", + "__set", + "prop", + "some", + "prefix", + "indexOf", + "Object", + "defineProperty", + "get", + "set", + "value", + "configurable" + ], + "sources": [ + "pointerExtend.ts" + ], + "sourcesContent": [ + "const VENDOR_PREFIXES = ['webkit', 'moz']\n\nexport default function pointerExtend (dest: Partial }>, source: T) {\n dest.__set ||= {} as any\n\n for (const prop in source) {\n // skip deprecated prefixed properties\n if (VENDOR_PREFIXES.some((prefix) => prop.indexOf(prefix) === 0)) continue\n\n if (typeof dest[prop] !== 'function' && prop !== '__set') {\n Object.defineProperty(dest, prop, {\n get () {\n if (prop in dest.__set) return dest.__set[prop]\n\n return (dest.__set[prop] = source[prop] as any)\n },\n set (value: any) {\n dest.__set[prop] = value\n },\n configurable: true,\n })\n }\n }\n return dest\n}\n" + ], + "mappings": "AAAA,MAAMA,eAAe,GAAG,CAAC,QAAD,EAAW,KAAX,CAAxB;AAEA,eAAe,SAASC,aAAT,CAA2BC,IAA3B,EAAsEC,MAAtE,EAAiF;EAC9FD,IAAI,CAACE,KAAL,KAAe,EAAf;;EAEA,KAAK,MAAMC,IAAX,IAAmBF,MAAnB,EAA2B;IACzB;IACA,IAAIH,eAAe,CAACM,IAAhB,CAAsBC,MAAD,IAAYF,IAAI,CAACG,OAAL,CAAaD,MAAb,MAAyB,CAA1D,CAAJ,EAAkE;;IAElE,IAAI,OAAOL,IAAI,CAACG,IAAD,CAAX,KAAsB,UAAtB,IAAoCA,IAAI,KAAK,OAAjD,EAA0D;MACxDI,MAAM,CAACC,cAAP,CAAsBR,IAAtB,EAA4BG,IAA5B,EAAkC;QAChCM,GAAG,GAAI;UACL,IAAIN,IAAI,IAAIH,IAAI,CAACE,KAAjB,EAAwB,OAAOF,IAAI,CAACE,KAAL,CAAWC,IAAX,CAAP;UAExB,OAAQH,IAAI,CAACE,KAAL,CAAWC,IAAX,IAAmBF,MAAM,CAACE,IAAD,CAAjC;QACD,CAL+B;;QAMhCO,GAAG,CAAEC,KAAF,EAAc;UACfX,IAAI,CAACE,KAAL,CAAWC,IAAX,IAAmBQ,KAAnB;QACD,CAR+B;;QAShCC,YAAY,EAAE;MATkB,CAAlC;IAWD;EACF;;EACD,OAAOZ,IAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerExtend.prod.js b/packages/@interactjs/utils/pointerExtend.prod.js new file mode 100644 index 000000000..3043d14f2 --- /dev/null +++ b/packages/@interactjs/utils/pointerExtend.prod.js @@ -0,0 +1,2 @@ +const e=["webkit","moz"];export default function t(t,n){t.__set||={};for(const _ in n)e.some((e=>0===_.indexOf(e)))||"function"!=typeof t[_]&&"__set"!==_&&Object.defineProperty(t,_,{get(){return _ in t.__set?t.__set[_]:t.__set[_]=n[_]},set(e){t.__set[_]=e},configurable:!0});return t} +//# sourceMappingURL=pointerExtend.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerExtend.prod.js.map b/packages/@interactjs/utils/pointerExtend.prod.js.map new file mode 100644 index 000000000..9665a4f47 --- /dev/null +++ b/packages/@interactjs/utils/pointerExtend.prod.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "VENDOR_PREFIXES", + "pointerExtend", + "dest", + "source", + "__set", + "prop", + "some", + "prefix", + "indexOf", + "Object", + "defineProperty", + "get", + "set", + "value", + "configurable" + ], + "sources": [ + "pointerExtend.ts" + ], + "sourcesContent": [ + "const VENDOR_PREFIXES = ['webkit', 'moz']\n\nexport default function pointerExtend (dest: Partial }>, source: T) {\n dest.__set ||= {} as any\n\n for (const prop in source) {\n // skip deprecated prefixed properties\n if (VENDOR_PREFIXES.some((prefix) => prop.indexOf(prefix) === 0)) continue\n\n if (typeof dest[prop] !== 'function' && prop !== '__set') {\n Object.defineProperty(dest, prop, {\n get () {\n if (prop in dest.__set) return dest.__set[prop]\n\n return (dest.__set[prop] = source[prop] as any)\n },\n set (value: any) {\n dest.__set[prop] = value\n },\n configurable: true,\n })\n }\n }\n return dest\n}\n" + ], + "mappings": "AAAA,MAAMA,EAAkB,CAAC,SAAU,sBAEpB,SAASC,EAAkBC,EAA2CC,GACnFD,EAAKE,QAAU,GAEf,IAAK,MAAMC,KAAQF,EAEbH,EAAgBM,MAAMC,GAAoC,IAAzBF,EAAKG,QAAQD,MAExB,mBAAfL,EAAKG,IAAiC,UAATA,GACtCI,OAAOC,eAAeR,EAAMG,EAAM,CAChCM,MACE,OAAIN,KAAQH,EAAKE,MAAcF,EAAKE,MAAMC,GAElCH,EAAKE,MAAMC,GAAQF,EAAOE,IAEpCO,IAAKC,GACHX,EAAKE,MAAMC,GAAQQ,GAErBC,cAAc,IAIpB,OAAOZ" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerUtils.d.ts b/packages/@interactjs/utils/pointerUtils.d.ts new file mode 100644 index 000000000..cc2f04fa1 --- /dev/null +++ b/packages/@interactjs/utils/pointerUtils.d.ts @@ -0,0 +1,72 @@ +import type { InteractEvent } from '@interactjs/core/InteractEvent'; +import type { CoordsSetMember, PointerType, Point, PointerEventType } from '@interactjs/core/types'; +import pointerExtend from './pointerExtend'; +export declare function copyCoords(dest: CoordsSetMember, src: CoordsSetMember): void; +export declare function setCoordDeltas(targetObj: CoordsSetMember, prev: CoordsSetMember, cur: CoordsSetMember): void; +export declare function setCoordVelocity(targetObj: CoordsSetMember, delta: CoordsSetMember): void; +export declare function setZeroCoords(targetObj: CoordsSetMember): void; +export declare function isNativePointer(pointer: any): boolean; +export declare function getXY(type: string, pointer: PointerType | InteractEvent, xy: Point): Point; +export declare function getPageXY(pointer: PointerType | InteractEvent, page?: Point): Point; +export declare function getClientXY(pointer: PointerType, client: Point): Point; +export declare function getPointerId(pointer: { + pointerId?: number; + identifier?: number; + type?: string; +}): number; +export declare function setCoords(dest: CoordsSetMember, pointers: any[], timeStamp: number): void; +export declare function getTouchPair(event: TouchEvent | PointerType[]): PointerType[]; +export declare function pointerAverage(pointers: PointerType[]): { + pageX: number; + pageY: number; + clientX: number; + clientY: number; + screenX: number; + screenY: number; +}; +export declare function touchBBox(event: PointerType[]): { + x: number; + y: number; + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; +}; +export declare function touchDistance(event: PointerType[] | TouchEvent, deltaSource: string): number; +export declare function touchAngle(event: PointerType[] | TouchEvent, deltaSource: string): number; +export declare function getPointerType(pointer: { + pointerType?: string; + identifier?: number; + type?: string; +}): string; +export declare function getEventTargets(event: Event): any[]; +export declare function newCoords(): 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; + preventDefault(): void; +} & PointerType & PointerEventType; +export interface MockCoords { + page: Point; + client: Point; + timeStamp?: number; + pointerId?: any; + target?: any; + type?: string; + pointerType?: string; + buttons?: number; +} +export { pointerExtend }; diff --git a/packages/@interactjs/utils/pointerUtils.js b/packages/@interactjs/utils/pointerUtils.js new file mode 100644 index 000000000..55eba1da4 --- /dev/null +++ b/packages/@interactjs/utils/pointerUtils.js @@ -0,0 +1,250 @@ +import browser from './browser'; +import dom from './domObjects'; +import * as domUtils from './domUtils'; +import hypot from './hypot'; +import is from './is'; +import pointerExtend from './pointerExtend'; +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(dest, pointers, timeStamp) { + const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]; + getPageXY(pointer, dest.page); + getClientXY(pointer, dest.client); + dest.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) { + 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; + }, + + preventDefault() {} + + }; + return event; +} +export { pointerExtend }; +//# sourceMappingURL=pointerUtils.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerUtils.js.map b/packages/@interactjs/utils/pointerUtils.js.map new file mode 100644 index 000000000..f70e79d9e --- /dev/null +++ b/packages/@interactjs/utils/pointerUtils.js.map @@ -0,0 +1,109 @@ +{ + "version": 3, + "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", + "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", + "preventDefault" + ], + "sources": [ + "pointerUtils.ts" + ], + "sourcesContent": [ + "import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { CoordsSetMember, PointerType, Point, PointerEventType, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: CoordsSetMember, src: 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: CoordsSetMember, prev: CoordsSetMember, cur: 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: CoordsSetMember, delta: 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: 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: string, pointer: PointerType | InteractEvent, xy: Point) {\n xy = xy || ({} as Point)\n type = type || 'page'\n\n xy.x = pointer[(type + 'X') as 'pageX']\n xy.y = pointer[(type + 'Y') as 'pageY']\n\n return xy\n}\n\nexport function getPageXY (pointer: PointerType | InteractEvent, page?: 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 } else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer: PointerType, client: Point) {\n client = client || ({} as any)\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n } else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer: { pointerId?: number, identifier?: number, type?: string }) {\n return is.number(pointer.pointerId) ? pointer.pointerId! : pointer.identifier!\n}\n\nexport function setCoords (dest: CoordsSetMember, pointers: any[], timeStamp: number) {\n const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]\n\n getPageXY(pointer, dest.page)\n getClientXY(pointer, dest.client)\n\n dest.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event: TouchEvent | PointerType[]) {\n const touches: PointerType[] = []\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 } else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\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: PointerType[]) {\n const average = {\n pageX: 0,\n pageY: 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n type CoordKeys = keyof typeof average\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop as CoordKeys] += pointer[prop as CoordKeys]\n }\n }\n for (const prop in average) {\n average[prop as CoordKeys] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: PointerType[]) {\n if (!event.length) {\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: { pointerType?: string, identifier?: number, type?: string }) {\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: Event) {\n const path = is.func(event.composedPath)\n ? (event.composedPath() as Element[])\n : (event as unknown as { path: Element[] }).path\n\n return [\n domUtils.getActualElement(path ? path[0] : (event.target as Element)),\n domUtils.getActualElement(event.currentTarget as Element),\n ]\n}\n\nexport function newCoords (): 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 () {\n return this.coords.page\n },\n get client () {\n return this.coords.client\n },\n get timeStamp () {\n return this.coords.timeStamp\n },\n get pageX () {\n return this.coords.page.x\n },\n get pageY () {\n return this.coords.page.y\n },\n get clientX () {\n return this.coords.client.x\n },\n get clientY () {\n return this.coords.client.y\n },\n get pointerId () {\n return this.coords.pointerId\n },\n get target () {\n return this.coords.target\n },\n get type () {\n return this.coords.type\n },\n get pointerType () {\n return this.coords.pointerType\n },\n get buttons () {\n return this.coords.buttons\n },\n preventDefault () {},\n }\n\n return event as typeof event & PointerType & PointerEventType\n}\n\nexport interface MockCoords {\n page: Point\n client: Point\n timeStamp?: number\n pointerId?: any\n target?: any\n type?: string\n pointerType?: string\n buttons?: number\n}\n\nexport { pointerExtend }\n" + ], + "mappings": "AAGA,OAAOA,OAAP,MAAoB,WAApB;AACA,OAAOC,GAAP,MAAgB,cAAhB;AACA,OAAO,KAAKC,QAAZ,MAA0B,YAA1B;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,EAAP,MAAe,MAAf;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AAEA,OAAO,SAASC,UAAT,CAAqBC,IAArB,EAA4CC,GAA5C,EAAkE;EACvED,IAAI,CAACE,IAAL,GAAYF,IAAI,CAACE,IAAL,IAAc,EAA1B;EACAF,IAAI,CAACE,IAAL,CAAUC,CAAV,GAAcF,GAAG,CAACC,IAAJ,CAASC,CAAvB;EACAH,IAAI,CAACE,IAAL,CAAUE,CAAV,GAAcH,GAAG,CAACC,IAAJ,CAASE,CAAvB;EAEAJ,IAAI,CAACK,MAAL,GAAcL,IAAI,CAACK,MAAL,IAAgB,EAA9B;EACAL,IAAI,CAACK,MAAL,CAAYF,CAAZ,GAAgBF,GAAG,CAACI,MAAJ,CAAWF,CAA3B;EACAH,IAAI,CAACK,MAAL,CAAYD,CAAZ,GAAgBH,GAAG,CAACI,MAAJ,CAAWD,CAA3B;EAEAJ,IAAI,CAACM,SAAL,GAAiBL,GAAG,CAACK,SAArB;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AJ,GAAe;MACb,OAAO,KAAKyC,MAAL,CAAYlF,MAAZ,CAAmBF,CAA1B;IACD,CAnBW;;IAoBZ,IAAI4C,OAAJ,GAAe;MACb,OAAO,KAAKwC,MAAL,CAAYlF,MAAZ,CAAmBD,CAA1B;IACD,CAtBW;;IAuBZ,IAAI4B,SAAJ,GAAiB;MACf,OAAO,KAAKuD,MAAL,CAAYvD,SAAnB;IACD,CAzBW;;IA0BZ,IAAImD,MAAJ,GAAc;MACZ,OAAO,KAAKI,MAAL,CAAYJ,MAAnB;IACD,CA5BW;;IA6BZ,IAAI7D,IAAJ,GAAY;MACV,OAAO,KAAKiE,MAAL,CAAYjE,IAAnB;IACD,CA/BW;;IAgCZ,IAAIqD,WAAJ,GAAmB;MACjB,OAAO,KAAKY,MAAL,CAAYZ,WAAnB;IACD,CAlCW;;IAmCZ,IAAIa,OAAJ,GAAe;MACb,OAAO,KAAKD,MAAL,CAAYC,OAAnB;IACD,CArCW;;IAsCZC,cAAc,GAAI,CAAE;;EAtCR,CAAd;EAyCA,OAAOlD,KAAP;AACD;AAaD,SAASzC,aAAT" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerUtils.prod.js b/packages/@interactjs/utils/pointerUtils.prod.js new file mode 100644 index 000000000..be24c718d --- /dev/null +++ b/packages/@interactjs/utils/pointerUtils.prod.js @@ -0,0 +1,2 @@ +import t from"./browser";import e from"./domObjects";import*as o from"./domUtils";import n from"./hypot";import r from"./is";import i from"./pointerExtend";export function copyCoords(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp}export function setCoordDeltas(t,e,o){t.page.x=o.page.x-e.page.x,t.page.y=o.page.y-e.page.y,t.client.x=o.client.x-e.client.x,t.client.y=o.client.y-e.client.y,t.timeStamp=o.timeStamp-e.timeStamp}export function setCoordVelocity(t,e){const o=Math.max(e.timeStamp/1e3,.001);t.page.x=e.page.x/o,t.page.y=e.page.y/o,t.client.x=e.client.x/o,t.client.y=e.client.y/o,t.timeStamp=o}export function setZeroCoords(t){t.page.x=0,t.page.y=0,t.client.x=0,t.client.y=0}export function isNativePointer(t){return t instanceof e.Event||t instanceof e.Touch}export function getXY(t,e,o){return t=t||"page",(o=o||{}).x=e[t+"X"],o.y=e[t+"Y"],o}export function getPageXY(e,o){return o=o||{x:0,y:0},t.isOperaMobile&&isNativePointer(e)?(getXY("screen",e,o),o.x+=window.scrollX,o.y+=window.scrollY):getXY("page",e,o),o}export function getClientXY(e,o){return o=o||{},t.isOperaMobile&&isNativePointer(e)?getXY("screen",e,o):getXY("client",e,o),o}export function getPointerId(t){return r.number(t.pointerId)?t.pointerId:t.identifier}export function setCoords(t,e,o){const n=e.length>1?pointerAverage(e):e[0];getPageXY(n,t.page),getClientXY(n,t.client),t.timeStamp=o}export function getTouchPair(t){const e=[];return r.array(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}export function pointerAverage(t){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const o of t)for(const t in e)e[t]+=o[t];for(const o in e)e[o]/=t.length;return e}export function touchBBox(t){if(!t.length)return null;const e=getTouchPair(t),o=Math.min(e[0].pageX,e[1].pageX),n=Math.min(e[0].pageY,e[1].pageY),r=Math.max(e[0].pageX,e[1].pageX),i=Math.max(e[0].pageY,e[1].pageY);return{x:o,y:n,left:o,top:n,right:r,bottom:i,width:r-o,height:i-n}}export function touchDistance(t,e){const o=e+"X",r=e+"Y",i=getTouchPair(t),c=i[0][o]-i[1][o],p=i[0][r]-i[1][r];return n(c,p)}export function touchAngle(t,e){const o=e+"X",n=e+"Y",r=getTouchPair(t),i=r[1][o]-r[0][o],c=r[1][n]-r[0][n];return 180*Math.atan2(c,i)/Math.PI}export function getPointerType(t){return r.string(t.pointerType)?t.pointerType:r.number(t.pointerType)?[void 0,void 0,"touch","pen","mouse"][t.pointerType]:/touch/.test(t.type||"")||t instanceof e.Touch?"touch":"mouse"}export function getEventTargets(t){const e=r.func(t.composedPath)?t.composedPath():t.path;return[o.getActualElement(e?e[0]:t.target),o.getActualElement(t.currentTarget)]}export function newCoords(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}export function coordsToEvent(t){return{coords:t,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},preventDefault(){}}}export{i as pointerExtend}; +//# sourceMappingURL=pointerUtils.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/pointerUtils.prod.js.map b/packages/@interactjs/utils/pointerUtils.prod.js.map new file mode 100644 index 000000000..5f8e686c7 --- /dev/null +++ b/packages/@interactjs/utils/pointerUtils.prod.js.map @@ -0,0 +1,109 @@ +{ + "version": 3, + "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", + "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", + "atan2", + "PI", + "getPointerType", + "string", + "pointerType", + "undefined", + "test", + "getEventTargets", + "path", + "func", + "composedPath", + "getActualElement", + "target", + "currentTarget", + "newCoords", + "coordsToEvent", + "coords", + "this", + "buttons", + "preventDefault" + ], + "sources": [ + "pointerUtils.ts" + ], + "sourcesContent": [ + "import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { CoordsSetMember, PointerType, Point, PointerEventType, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: CoordsSetMember, src: 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: CoordsSetMember, prev: CoordsSetMember, cur: 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: CoordsSetMember, delta: 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: 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: string, pointer: PointerType | InteractEvent, xy: Point) {\n xy = xy || ({} as Point)\n type = type || 'page'\n\n xy.x = pointer[(type + 'X') as 'pageX']\n xy.y = pointer[(type + 'Y') as 'pageY']\n\n return xy\n}\n\nexport function getPageXY (pointer: PointerType | InteractEvent, page?: 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 } else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer: PointerType, client: Point) {\n client = client || ({} as any)\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n } else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer: { pointerId?: number, identifier?: number, type?: string }) {\n return is.number(pointer.pointerId) ? pointer.pointerId! : pointer.identifier!\n}\n\nexport function setCoords (dest: CoordsSetMember, pointers: any[], timeStamp: number) {\n const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]\n\n getPageXY(pointer, dest.page)\n getClientXY(pointer, dest.client)\n\n dest.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event: TouchEvent | PointerType[]) {\n const touches: PointerType[] = []\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 } else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\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: PointerType[]) {\n const average = {\n pageX: 0,\n pageY: 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n type CoordKeys = keyof typeof average\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop as CoordKeys] += pointer[prop as CoordKeys]\n }\n }\n for (const prop in average) {\n average[prop as CoordKeys] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: PointerType[]) {\n if (!event.length) {\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: { pointerType?: string, identifier?: number, type?: string }) {\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: Event) {\n const path = is.func(event.composedPath)\n ? (event.composedPath() as Element[])\n : (event as unknown as { path: Element[] }).path\n\n return [\n domUtils.getActualElement(path ? path[0] : (event.target as Element)),\n domUtils.getActualElement(event.currentTarget as Element),\n ]\n}\n\nexport function newCoords (): 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 () {\n return this.coords.page\n },\n get client () {\n return this.coords.client\n },\n get timeStamp () {\n return this.coords.timeStamp\n },\n get pageX () {\n return this.coords.page.x\n },\n get pageY () {\n return this.coords.page.y\n },\n get clientX () {\n return this.coords.client.x\n },\n get clientY () {\n return this.coords.client.y\n },\n get pointerId () {\n return this.coords.pointerId\n },\n get target () {\n return this.coords.target\n },\n get type () {\n return this.coords.type\n },\n get pointerType () {\n return this.coords.pointerType\n },\n get buttons () {\n return this.coords.buttons\n },\n preventDefault () {},\n }\n\n return event as typeof event & PointerType & PointerEventType\n}\n\nexport interface MockCoords {\n page: Point\n client: Point\n timeStamp?: number\n pointerId?: any\n target?: any\n type?: string\n pointerType?: string\n buttons?: number\n}\n\nexport { pointerExtend }\n" + ], + "mappings": "OAGOA,MAAa,mBACbC,MAAS,yBACJC,MAAc,oBACnBC,MAAW,iBACXC,MAAQ,cACRC,MAAmB,yBAEnB,SAASC,WAAYC,EAAuBC,GACjDD,EAAKE,KAAOF,EAAKE,MAAS,GAC1BF,EAAKE,KAAKC,EAAIF,EAAIC,KAAKC,EACvBH,EAAKE,KAAKE,EAAIH,EAAIC,KAAKE,EAEvBJ,EAAKK,OAASL,EAAKK,QAAW,GAC9BL,EAAKK,OAAOF,EAAIF,EAAII,OAAOF,EAC3BH,EAAKK,OAAOD,EAAIH,EAAII,OAAOD,EAE3BJ,EAAKM,UAAYL,EAAIK,iBAGhB,SAASC,eAAgBC,EA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AGkF,KAAKxC,EAAMyC,cACtBzC,EAAMyC,eACNzC,EAAyCuC,KAE9C,MAAO,CACLnF,EAASsF,iBAAiBH,EAAOA,EAAK,GAAMvC,EAAM2C,QAClDvF,EAASsF,iBAAiB1C,EAAM4C,uBAI7B,SAASC,YACd,MAAO,CACLlF,KAAM,CAAEC,EAAG,EAAGC,EAAG,GACjBC,OAAQ,CAAEF,EAAG,EAAGC,EAAG,GACnBE,UAAW,UAIR,SAAS+E,cAAeC,GA0C7B,MAzCc,CACZA,SACIpF,WACF,OAAOqF,KAAKD,OAAOpF,MAEjBG,aACF,OAAOkF,KAAKD,OAAOjF,QAEjBC,gBACF,OAAOiF,KAAKD,OAAOhF,WAEjBsC,YACF,OAAO2C,KAAKD,OAAOpF,KAAKC,GAEtB0C,YACF,OAAO0C,KAAKD,OAAOpF,KAAKE,GAEtB0C,cACF,OAAOyC,KAAKD,OAAOjF,OAAOF,GAExB4C,cACF,OAAOwC,KAAKD,OAAOjF,OAAOD,GAExB4B,gBACF,OAAOuD,KAAKD,OAAOtD,WAEjBkD,aACF,OAAOK,KAAKD,OAAOJ,QAEjB5D,WACF,OAAOiE,KAAKD,OAAOhE,MAEjBoD,kBACF,OAAOa,KAAKD,OAAOZ,aAEjBc,cACF,OAAOD,KAAKD,OAAOE,SAErBC,2BAiBK3F" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/raf.d.ts b/packages/@interactjs/utils/raf.d.ts new file mode 100644 index 000000000..b20dda4ce --- /dev/null +++ b/packages/@interactjs/utils/raf.d.ts @@ -0,0 +1,7 @@ +declare function init(global: Window | typeof globalThis): void; +declare const _default: { + request: (callback: FrameRequestCallback) => number; + cancel: (token: number) => void; + init: typeof init; +}; +export default _default; diff --git a/packages/@interactjs/utils/raf.js b/packages/@interactjs/utils/raf.js new file mode 100644 index 000000000..f120671cd --- /dev/null +++ b/packages/@interactjs/utils/raf.js @@ -0,0 +1,42 @@ +let lastTime = 0; +let request; +let cancel; + +function init(global) { + request = global.requestAnimationFrame; + cancel = global.cancelAnimationFrame; + + if (!request) { + const vendors = ['ms', 'moz', 'webkit', 'o']; + + for (const vendor of vendors) { + request = global[`${vendor}RequestAnimationFrame`]; + cancel = global[`${vendor}CancelAnimationFrame`] || global[`${vendor}CancelRequestAnimationFrame`]; + } + } + + request = request && request.bind(global); + cancel = cancel && cancel.bind(global); + + if (!request) { + request = callback => { + const currTime = Date.now(); + const timeToCall = Math.max(0, 16 - (currTime - lastTime)); + const token = global.setTimeout(() => { + // eslint-disable-next-line n/no-callback-literal + 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/packages/@interactjs/utils/raf.js.map b/packages/@interactjs/utils/raf.js.map new file mode 100644 index 000000000..66fa0d680 --- /dev/null +++ b/packages/@interactjs/utils/raf.js.map @@ -0,0 +1,32 @@ +{ + "version": 3, + "names": [ + "lastTime", + "request", + "cancel", + "init", + "global", + "requestAnimationFrame", + "cancelAnimationFrame", + "vendors", + "vendor", + "bind", + "callback", + "currTime", + "Date", + "now", + "timeToCall", + "Math", + "max", + "token", + "setTimeout", + "clearTimeout" + ], + "sources": [ + "raf.ts" + ], + "sourcesContent": [ + "let lastTime = 0\nlet request: typeof requestAnimationFrame\nlet cancel: typeof cancelAnimationFrame\n\nfunction init (global: Window | typeof globalThis) {\n request = global.requestAnimationFrame\n cancel = global.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = global[`${vendor}RequestAnimationFrame` as 'requestAnimationFrame']\n cancel =\n global[`${vendor}CancelAnimationFrame` as 'cancelAnimationFrame'] ||\n global[`${vendor}CancelRequestAnimationFrame` as 'cancelAnimationFrame']\n }\n }\n\n request = request && request.bind(global)\n cancel = cancel && cancel.bind(global)\n\n if (!request) {\n request = (callback) => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n const token = global.setTimeout(() => {\n // eslint-disable-next-line n/no-callback-literal\n callback(currTime + timeToCall)\n }, timeToCall)\n\n lastTime = currTime + timeToCall\n return token as any\n }\n\n cancel = (token) => clearTimeout(token)\n }\n}\n\nexport default {\n request: (callback: FrameRequestCallback) => request(callback),\n cancel: (token: number) => cancel(token),\n init,\n}\n" + ], + "mappings": "AAAA,IAAIA,QAAQ,GAAG,CAAf;AACA,IAAIC,OAAJ;AACA,IAAIC,MAAJ;;AAEA,SAASC,IAAT,CAAeC,MAAf,EAAmD;EACjDH,OAAO,GAAGG,MAAM,CAACC,qBAAjB;EACAH,MAAM,GAAGE,MAAM,CAACE,oBAAhB;;EAEA,IAAI,CAACL,OAAL,EAAc;IACZ,MAAMM,OAAO,GAAG,CAAC,IAAD,EAAO,KAAP,EAAc,QAAd,EAAwB,GAAxB,CAAhB;;IAEA,KAAK,MAAMC,MAAX,IAAqBD,OAArB,EAA8B;MAC5BN,OAAO,GAAGG,MAAM,CAAE,GAAEI,MAAO,uBAAX,CAAhB;MACAN,MAAM,GACJE,MAAM,CAAE,GAAEI,MAAO,sBAAX,CAAN,IACAJ,MAAM,CAAE,GAAEI,MAAO,6BAAX,CAFR;IAGD;EACF;;EAEDP,OAAO,GAAGA,OAAO,IAAIA,OAAO,CAACQ,IAAR,CAAaL,MAAb,CAArB;EACAF,MAAM,GAAGA,MAAM,IAAIA,MAAM,CAACO,IAAP,CAAYL,MAAZ,CAAnB;;EAEA,IAAI,CAACH,OAAL,EAAc;IACZA,OAAO,GAAIS,QAAD,IAAc;MACtB,MAAMC,QAAQ,GAAGC,IAAI,CAACC,GAAL,EAAjB;MACA,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAY,MAAML,QAAQ,GAAGX,QAAjB,CAAZ,CAAnB;MACA,MAAMiB,KAAK,GAAGb,MAAM,CAACc,UAAP,CAAkB,MAAM;QACpC;QACAR,QAAQ,CAACC,QAAQ,GAAGG,UAAZ,CAAR;MACD,CAHa,EAGXA,UAHW,CAAd;MAKAd,QAAQ,GAAGW,QAAQ,GAAGG,UAAtB;MACA,OAAOG,KAAP;IACD,CAVD;;IAYAf,MAAM,GAAIe,KAAD,IAAWE,YAAY,CAACF,KAAD,CAAhC;EACD;AACF;;AAED,eAAe;EACbhB,OAAO,EAAGS,QAAD,IAAoCT,OAAO,CAACS,QAAD,CADvC;EAEbR,MAAM,EAAGe,KAAD,IAAmBf,MAAM,CAACe,KAAD,CAFpB;EAGbd;AAHa,CAAf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/raf.prod.js b/packages/@interactjs/utils/raf.prod.js new file mode 100644 index 000000000..a628d0e47 --- /dev/null +++ b/packages/@interactjs/utils/raf.prod.js @@ -0,0 +1,2 @@ +let e,t,n=0;export default{request:t=>e(t),cancel:e=>t(e),init(a){if(e=a.requestAnimationFrame,t=a.cancelAnimationFrame,!e){const n=["ms","moz","webkit","o"];for(const i of n)e=a[i+"RequestAnimationFrame"],t=a[i+"CancelAnimationFrame"]||a[i+"CancelRequestAnimationFrame"]}e=e&&e.bind(a),t=t&&t.bind(a),e||(e=e=>{const t=Date.now(),i=Math.max(0,16-(t-n)),o=a.setTimeout((()=>{e(t+i)}),i);return n=t+i,o},t=e=>clearTimeout(e))}}; +//# sourceMappingURL=raf.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/raf.prod.js.map b/packages/@interactjs/utils/raf.prod.js.map new file mode 100644 index 000000000..44b1beba2 --- /dev/null +++ b/packages/@interactjs/utils/raf.prod.js.map @@ -0,0 +1,32 @@ +{ + "version": 3, + "names": [ + "request", + "cancel", + "lastTime", + "callback", + "token", + "init", + "global", + "requestAnimationFrame", + "cancelAnimationFrame", + "vendors", + "vendor", + "bind", + "currTime", + "Date", + "now", + "timeToCall", + "Math", + "max", + "setTimeout", + "clearTimeout" + ], + "sources": [ + "raf.ts" + ], + "sourcesContent": [ + "let lastTime = 0\nlet request: typeof requestAnimationFrame\nlet cancel: typeof cancelAnimationFrame\n\nfunction init (global: Window | typeof globalThis) {\n request = global.requestAnimationFrame\n cancel = global.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = global[`${vendor}RequestAnimationFrame` as 'requestAnimationFrame']\n cancel =\n global[`${vendor}CancelAnimationFrame` as 'cancelAnimationFrame'] ||\n global[`${vendor}CancelRequestAnimationFrame` as 'cancelAnimationFrame']\n }\n }\n\n request = request && request.bind(global)\n cancel = cancel && cancel.bind(global)\n\n if (!request) {\n request = (callback) => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n const token = global.setTimeout(() => {\n // eslint-disable-next-line n/no-callback-literal\n callback(currTime + timeToCall)\n }, timeToCall)\n\n lastTime = currTime + timeToCall\n return token as any\n }\n\n cancel = (token) => clearTimeout(token)\n }\n}\n\nexport default {\n request: (callback: FrameRequestCallback) => request(callback),\n cancel: (token: number) => cancel(token),\n init,\n}\n" + ], + "mappings": "AAAA,IACIA,EACAC,EAFAC,EAAW,gBAuCA,CACbF,QAAUG,GAAmCH,EAAQG,GACrDF,OAASG,GAAkBH,EAAOG,GAClCC,KAtCaC,GAIb,GAHAN,EAAUM,EAAOC,sBACjBN,EAASK,EAAOE,sBAEXR,EAAS,CACZ,MAAMS,EAAU,CAAC,KAAM,MAAO,SAAU,KAExC,IAAK,MAAMC,KAAUD,EACnBT,EAAUM,EAAUI,EAAF,yBAClBT,EACEK,EAAUI,EAAF,yBACRJ,EAAUI,EAAF,+BAIdV,EAAUA,GAAWA,EAAQW,KAAKL,GAClCL,EAASA,GAAUA,EAAOU,KAAKL,GAE1BN,IACHA,EAAWG,IACT,MAAMS,EAAWC,KAAKC,MAChBC,EAAaC,KAAKC,IAAI,EAAG,IAAML,EAAWV,IAC1CE,EAAQE,EAAOY,YAAW,KAE9Bf,EAASS,EAAWG,KACnBA,GAGH,OADAb,EAAWU,EAAWG,EACfX,GAGTH,EAAUG,GAAUe,aAAaf" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/rect.d.ts b/packages/@interactjs/utils/rect.d.ts new file mode 100644 index 000000000..94cceb7c8 --- /dev/null +++ b/packages/@interactjs/utils/rect.d.ts @@ -0,0 +1,11 @@ +import type { HasGetRect, RectResolvable, Rect, Point, FullRect, EdgeOptions } from '@interactjs/core/types'; +export declare function getStringOptionResult(value: any, target: HasGetRect, element: Node): ParentNode | Rect; +export declare function resolveRectLike(value: RectResolvable, target?: HasGetRect, element?: Node, functionArgs?: T): Rect; +export declare function toFullRect(rect: Rect): FullRect; +export declare function rectToXY(rect: Rect | Point): { + x: number; + y: number; +}; +export declare function xywhToTlbr>(rect: T): Rect & T; +export declare function tlbrToXywh(rect: Rect & Partial): Required & Point; +export declare function addEdges(edges: EdgeOptions, rect: Rect, delta: Point): void; diff --git a/packages/@interactjs/utils/rect.js b/packages/@interactjs/utils/rect.js new file mode 100644 index 000000000..87cd7c0de --- /dev/null +++ b/packages/@interactjs/utils/rect.js @@ -0,0 +1,96 @@ +import { closest, getElementRect, parentNode } from './domUtils'; +import extend from './extend'; +import is from './is'; +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 toFullRect(rect) { + const { + top, + left, + bottom, + right + } = rect; + const width = rect.width ?? rect.right - rect.left; + const height = rect.height ?? rect.bottom - rect.top; + return { + top, + left, + bottom, + right, + width, + height + }; +} +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/packages/@interactjs/utils/rect.js.map b/packages/@interactjs/utils/rect.js.map new file mode 100644 index 000000000..cf86a54b8 --- /dev/null +++ b/packages/@interactjs/utils/rect.js.map @@ -0,0 +1,43 @@ +{ + "version": 3, + "names": [ + "closest", + "getElementRect", + "parentNode", + "extend", + "is", + "getStringOptionResult", + "value", + "target", + "element", + "getRect", + "resolveRectLike", + "functionArgs", + "returnValue", + "string", + "func", + "toFullRect", + "rect", + "top", + "left", + "bottom", + "right", + "width", + "height", + "rectToXY", + "x", + "y", + "xywhToTlbr", + "tlbrToXywh", + "addEdges", + "edges", + "delta" + ], + "sources": [ + "rect.ts" + ], + "sourcesContent": [ + "import type {\n HasGetRect,\n RectResolvable,\n Rect,\n Element,\n Point,\n FullRect,\n EdgeOptions,\n} from '@interactjs/core/types'\n\nimport { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport is from './is'\n\nexport function getStringOptionResult (value: any, target: HasGetRect, element: Node) {\n if (value === 'parent') {\n return parentNode(element)\n }\n\n if (value === 'self') {\n return target.getRect(element as Element)\n }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: RectResolvable,\n target?: 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 } 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 Rect\n}\n\nexport function toFullRect (rect: Rect): FullRect {\n const { top, left, bottom, right } = rect\n const width = rect.width ?? rect.right - rect.left\n const height = rect.height ?? rect.bottom - rect.top\n\n return { top, left, bottom, right, width, height }\n}\n\nexport function rectToXY (rect: Rect | Point) {\n return (\n rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n )\n}\n\nexport function xywhToTlbr> (rect: T) {\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 as Rect & T\n}\n\nexport function tlbrToXywh (rect: Rect & Partial) {\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 as FullRect & Point\n}\n\nexport function addEdges (edges: EdgeOptions, rect: Rect, delta: Point) {\n if (edges.left) {\n rect.left += delta.x\n }\n if (edges.right) {\n rect.right += delta.x\n }\n if (edges.top) {\n rect.top += delta.y\n }\n if (edges.bottom) {\n rect.bottom += delta.y\n }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n" + ], + "mappings": "AAUA,SAASA,OAAT,EAAkBC,cAAlB,EAAkCC,UAAlC,QAAoD,YAApD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,EAAP,MAAe,MAAf;AAEA,OAA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D;IACAR,IAAI,CAACM,MAAL,GAAcN,IAAI,CAACM,MAAL,IAAe,CAACN,IAAI,CAACG,MAAL,IAAe,CAAhB,IAAqBH,IAAI,CAACS,CAAvD;EACD;;EAED,OAAOT,IAAP;AACD;AAED,OAAO,SAASY,QAAT,CAAmBC,KAAnB,EAAuCb,IAAvC,EAAmDc,KAAnD,EAAiE;EACtE,IAAID,KAAK,CAACX,IAAV,EAAgB;IACdF,IAAI,CAACE,IAAL,IAAaY,KAAK,CAACN,CAAnB;EACD;;EACD,IAAIK,KAAK,CAACT,KAAV,EAAiB;IACfJ,IAAI,CAACI,KAAL,IAAcU,KAAK,CAACN,CAApB;EACD;;EACD,IAAIK,KAAK,CAACZ,GAAV,EAAe;IACbD,IAAI,CAACC,GAAL,IAAYa,KAAK,CAACL,CAAlB;EACD;;EACD,IAAII,KAAK,CAACV,MAAV,EAAkB;IAChBH,IAAI,CAACG,MAAL,IAAeW,KAAK,CAACL,CAArB;EACD;;EAEDT,IAAI,CAACK,KAAL,GAAaL,IAAI,CAACI,KAAL,GAAaJ,IAAI,CAACE,IAA/B;EACAF,IAAI,CAACM,MAAL,GAAcN,IAAI,CAACG,MAAL,GAAcH,IAAI,CAACC,GAAjC;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/rect.prod.js b/packages/@interactjs/utils/rect.prod.js new file mode 100644 index 000000000..4a01031c9 --- /dev/null +++ b/packages/@interactjs/utils/rect.prod.js @@ -0,0 +1,2 @@ +import{closest as t,getElementRect as o,parentNode as e}from"./domUtils";import i from"./extend";import r from"./is";export function getStringOptionResult(o,i,r){return"parent"===o?e(r):"self"===o?i.getRect(r):t(r,o)}export function resolveRectLike(t,e,i,n){let h=t;return r.string(h)?h=getStringOptionResult(h,e,i):r.func(h)&&(h=h(...n)),r.element(h)&&(h=o(h)),h}export function toFullRect(t){const{top:o,left:e,bottom:i,right:r}=t;return{top:o,left:e,bottom:i,right:r,width:t.width??t.right-t.left,height:t.height??t.bottom-t.top}}export function rectToXY(t){return t&&{x:"x"in t?t.x:t.left,y:"y"in t?t.y:t.top}}export function xywhToTlbr(t){return!t||"left"in t&&"top"in t||((t=i({},t)).left=t.x||0,t.top=t.y||0,t.right=t.right||t.left+t.width,t.bottom=t.bottom||t.top+t.height),t}export function tlbrToXywh(t){return!t||"x"in t&&"y"in t||((t=i({},t)).x=t.left||0,t.y=t.top||0,t.width=t.width||(t.right||0)-t.x,t.height=t.height||(t.bottom||0)-t.y),t}export function addEdges(t,o,e){t.left&&(o.left+=e.x),t.right&&(o.right+=e.x),t.top&&(o.top+=e.y),t.bottom&&(o.bottom+=e.y),o.width=o.right-o.left,o.height=o.bottom-o.top} +//# sourceMappingURL=rect.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/rect.prod.js.map b/packages/@interactjs/utils/rect.prod.js.map new file mode 100644 index 000000000..45b3e319a --- /dev/null +++ b/packages/@interactjs/utils/rect.prod.js.map @@ -0,0 +1,43 @@ +{ + "version": 3, + "names": [ + "closest", + "getElementRect", + "parentNode", + "extend", + "is", + "getStringOptionResult", + "value", + "target", + "element", + "getRect", + "resolveRectLike", + "functionArgs", + "returnValue", + "string", + "func", + "toFullRect", + "rect", + "top", + "left", + "bottom", + "right", + "width", + "height", + "rectToXY", + "x", + "y", + "xywhToTlbr", + "tlbrToXywh", + "addEdges", + "edges", + "delta" + ], + "sources": [ + "rect.ts" + ], + "sourcesContent": [ + "import type {\n HasGetRect,\n RectResolvable,\n Rect,\n Element,\n Point,\n FullRect,\n EdgeOptions,\n} from '@interactjs/core/types'\n\nimport { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport is from './is'\n\nexport function getStringOptionResult (value: any, target: HasGetRect, element: Node) {\n if (value === 'parent') {\n return parentNode(element)\n }\n\n if (value === 'self') {\n return target.getRect(element as Element)\n }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: RectResolvable,\n target?: 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 } 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 Rect\n}\n\nexport function toFullRect (rect: Rect): FullRect {\n const { top, left, bottom, right } = rect\n const width = rect.width ?? rect.right - rect.left\n const height = rect.height ?? rect.bottom - rect.top\n\n return { top, left, bottom, right, width, height }\n}\n\nexport function rectToXY (rect: Rect | Point) {\n return (\n rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n )\n}\n\nexport function xywhToTlbr> (rect: T) {\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 as Rect & T\n}\n\nexport function tlbrToXywh (rect: Rect & Partial) {\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 as FullRect & Point\n}\n\nexport function addEdges (edges: EdgeOptions, rect: Rect, delta: Point) {\n if (edges.left) {\n rect.left += delta.x\n }\n if (edges.right) {\n rect.right += delta.x\n }\n if (edges.top) {\n rect.top += delta.y\n }\n if (edges.bottom) {\n rect.bottom += delta.y\n }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n" + ], + "mappings": "kBAUSA,oBAASC,gBAAgBC,MAAkB,oBAC7CC,MAAY,kBACZC,MAAQ,cAER,SAASC,sBAAuBC,EAAYC,EAAoBC,GACrE,MAAc,WAAVF,EACKJ,EAAWM,GAGN,SAAVF,EACKC,EAAOE,QAAQD,GAGjBR,EAAQQ,EAASF,UAGnB,SAASI,gBACdJ,EACAC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AMT,QACRJ,EAAKI,OAASU,EAAMN,GAElBK,EAAMZ,MACRD,EAAKC,KAAOa,EAAML,GAEhBI,EAAMV,SACRH,EAAKG,QAAUW,EAAML,GAGvBT,EAAKK,MAAQL,EAAKI,MAAQJ,EAAKE,KAC/BF,EAAKM,OAASN,EAAKG,OAASH,EAAKC" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/shallowEqual.d.ts b/packages/@interactjs/utils/shallowEqual.d.ts new file mode 100644 index 000000000..303db68e9 --- /dev/null +++ b/packages/@interactjs/utils/shallowEqual.d.ts @@ -0,0 +1 @@ +export default function shallowEqual(left: any, right: any): boolean; diff --git a/packages/@interactjs/utils/shallowEqual.js b/packages/@interactjs/utils/shallowEqual.js new file mode 100644 index 000000000..5b161d528 --- /dev/null +++ b/packages/@interactjs/utils/shallowEqual.js @@ -0,0 +1,24 @@ +export default function shallowEqual(left, right) { + if (left === right) { + return true; + } + + if (!left || !right) { + return false; + } + + const leftKeys = Object.keys(left); + + if (leftKeys.length !== Object.keys(right).length) { + return false; + } + + for (const key of leftKeys) { + if (left[key] !== right[key]) { + return false; + } + } + + return true; +} +//# sourceMappingURL=shallowEqual.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/shallowEqual.js.map b/packages/@interactjs/utils/shallowEqual.js.map new file mode 100644 index 000000000..cc1c4f5ba --- /dev/null +++ b/packages/@interactjs/utils/shallowEqual.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "shallowEqual", + "left", + "right", + "leftKeys", + "Object", + "keys", + "length", + "key" + ], + "sources": [ + "shallowEqual.ts" + ], + "sourcesContent": [ + "export default function shallowEqual (left: any, right: any) {\n if (left === right) {\n return true\n }\n\n if (!left || !right) {\n return false\n }\n\n const leftKeys = Object.keys(left)\n\n if (leftKeys.length !== Object.keys(right).length) {\n return false\n }\n\n for (const key of leftKeys) {\n if (left[key] !== right[key]) {\n return false\n }\n }\n\n return true\n}\n" + ], + "mappings": "AAAA,eAAe,SAASA,YAAT,CAAuBC,IAAvB,EAAkCC,KAAlC,EAA8C;EAC3D,IAAID,IAAI,KAAKC,KAAb,EAAoB;IAClB,OAAO,IAAP;EACD;;EAED,IAAI,CAACD,IAAD,IAAS,CAACC,KAAd,EAAqB;IACnB,OAAO,KAAP;EACD;;EAED,MAAMC,QAAQ,GAAGC,MAAM,CAACC,IAAP,CAAYJ,IAAZ,CAAjB;;EAEA,IAAIE,QAAQ,CAACG,MAAT,KAAoBF,MAAM,CAACC,IAAP,CAAYH,KAAZ,EAAmBI,MAA3C,EAAmD;IACjD,OAAO,KAAP;EACD;;EAED,KAAK,MAAMC,GAAX,IAAkBJ,QAAlB,EAA4B;IAC1B,IAAIF,IAAI,CAACM,GAAD,CAAJ,KAAcL,KAAK,CAACK,GAAD,CAAvB,EAA8B;MAC5B,OAAO,KAAP;IACD;EACF;;EAED,OAAO,IAAP;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/shallowEqual.prod.js b/packages/@interactjs/utils/shallowEqual.prod.js new file mode 100644 index 000000000..a4e88f3a0 --- /dev/null +++ b/packages/@interactjs/utils/shallowEqual.prod.js @@ -0,0 +1,2 @@ +export default function t(t,e){if(t===e)return!0;if(!t||!e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(const n of r)if(t[n]!==e[n])return!1;return!0} +//# sourceMappingURL=shallowEqual.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/shallowEqual.prod.js.map b/packages/@interactjs/utils/shallowEqual.prod.js.map new file mode 100644 index 000000000..9c57aef26 --- /dev/null +++ b/packages/@interactjs/utils/shallowEqual.prod.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "names": [ + "shallowEqual", + "left", + "right", + "leftKeys", + "Object", + "keys", + "length", + "key" + ], + "sources": [ + "shallowEqual.ts" + ], + "sourcesContent": [ + "export default function shallowEqual (left: any, right: any) {\n if (left === right) {\n return true\n }\n\n if (!left || !right) {\n return false\n }\n\n const leftKeys = Object.keys(left)\n\n if (leftKeys.length !== Object.keys(right).length) {\n return false\n }\n\n for (const key of leftKeys) {\n if (left[key] !== right[key]) {\n return false\n }\n }\n\n return true\n}\n" + ], + "mappings": "eAAe,SAASA,EAAcC,EAAWC,GAC/C,GAAID,IAASC,EACX,OAAO,EAGT,IAAKD,IAASC,EACZ,OAAO,EAGT,MAAMC,EAAWC,OAAOC,KAAKJ,GAE7B,GAAIE,EAASG,SAAWF,OAAOC,KAAKH,GAAOI,OACzC,OAAO,EAGT,IAAK,MAAMC,KAAOJ,EAChB,GAAIF,EAAKM,KAASL,EAAMK,GACtB,OAAO,EAIX,OAAO" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/window.d.ts b/packages/@interactjs/utils/window.d.ts new file mode 100644 index 000000000..7e9946992 --- /dev/null +++ b/packages/@interactjs/utils/window.d.ts @@ -0,0 +1,7 @@ +export declare let realWindow: Window; +declare let win: Window; +export { win as window }; +export declare function init(window: Window & { + wrap?: (...args: any[]) => any; +}): void; +export declare function getWindow(node: any): any; diff --git a/packages/@interactjs/utils/window.js b/packages/@interactjs/utils/window.js new file mode 100644 index 000000000..0e4a4b6cf --- /dev/null +++ b/packages/@interactjs/utils/window.js @@ -0,0 +1,31 @@ +import isWindow from './isWindow'; +export let realWindow = undefined; +let win = undefined; +export { win as window }; +export function init(window) { + // get wrapped window if using Shadow DOM polyfill + 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; +} + +if (typeof window !== 'undefined' && !!window) { + init(window); +} + +export function getWindow(node) { + if (isWindow(node)) { + return node; + } + + const rootNode = node.ownerDocument || node; + return rootNode.defaultView || win.window; +} +//# sourceMappingURL=window.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/window.js.map b/packages/@interactjs/utils/window.js.map new file mode 100644 index 000000000..1ebcd1ab9 --- /dev/null +++ b/packages/@interactjs/utils/window.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "names": [ + "isWindow", + "realWindow", + "undefined", + "win", + "window", + "init", + "el", + "document", + "createTextNode", + "ownerDocument", + "wrap", + "getWindow", + "node", + "rootNode", + "defaultView" + ], + "sources": [ + "window.ts" + ], + "sourcesContent": [ + "import isWindow from './isWindow'\n\nexport let realWindow = undefined as Window\n\nlet win = undefined as Window\nexport { win as window }\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n 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 && typeof window.wrap === 'function' && window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win = window\n}\n\nif (typeof window !== 'undefined' && !!window) {\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" + ], + "mappings": "AAAA,OAAOA,QAAP,MAAqB,YAArB;AAEA,OAAO,IAAIC,UAAU,GAAGC,SAAjB;AAEP,IAAIC,GAAG,GAAGD,SAAV;AACA,SAASC,GAAG,IAAIC,MAAhB;AAEA,OAAO,SAASC,IAAT,CAAeD,MAAf,EAAoE;EACzE;EAEAH,UAAU,GAAGG,MAAb,CAHyE,CAKzE;;EACA,MAAME,EAAE,GAAGF,MAAM,CAACG,QAAP,CAAgBC,cAAhB,CAA+B,EAA/B,CAAX,CANyE,CAQzE;;EACA,IAAIF,EAAE,CAACG,aAAH,KAAqBL,MAAM,CAACG,QAA5B,IAAwC,OAAOH,MAAM,CAACM,IAAd,KAAuB,UAA/D,IAA6EN,MAAM,CAACM,IAAP,CAAYJ,EAAZ,MAAoBA,EAArG,EAAyG;IACvG;IACAF,MAAM,GAAGA,MAAM,CAACM,IAAP,CAAYN,MAAZ,CAAT;EACD;;EAEDD,GAAG,GAAGC,MAAN;AACD;;AAED,IAAI,OAAOA,MAAP,KAAkB,WAAlB,IAAiC,CAAC,CAACA,MAAvC,EAA+C;EAC7CC,IAAI,CAACD,MAAD,CAAJ;AACD;;AAED,OAAO,SAASO,SAAT,CAAoBC,IAApB,EAA+B;EACpC,IAAIZ,QAAQ,CAACY,IAAD,CAAZ,EAAoB;IAClB,OAAOA,IAAP;EACD;;EAED,MAAMC,QAAQ,GAAGD,IAAI,CAACH,aAAL,IAAsBG,IAAvC;EAEA,OAAOC,QAAQ,CAACC,WAAT,IAAwBX,GAAG,CAACC,MAAnC;AACD" +} \ No newline at end of file diff --git a/packages/@interactjs/utils/window.prod.js b/packages/@interactjs/utils/window.prod.js new file mode 100644 index 000000000..07335e80a --- /dev/null +++ b/packages/@interactjs/utils/window.prod.js @@ -0,0 +1,2 @@ +import o from"./isWindow";export let realWindow;let n;export{n as window};export function init(o){realWindow=o;const e=o.document.createTextNode("");e.ownerDocument!==o.document&&"function"==typeof o.wrap&&o.wrap(e)===e&&(o=o.wrap(o)),n=o}"undefined"!=typeof window&&window&&init(window);export function getWindow(e){return o(e)?e:(e.ownerDocument||e).defaultView||n.window} +//# sourceMappingURL=window.prod.js.map \ No newline at end of file diff --git a/packages/@interactjs/utils/window.prod.js.map b/packages/@interactjs/utils/window.prod.js.map new file mode 100644 index 000000000..21be1476a --- /dev/null +++ b/packages/@interactjs/utils/window.prod.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "names": [ + "isWindow", + "realWindow", + "win", + "init", + "window", + "el", + "document", + "createTextNode", + "ownerDocument", + "wrap", + "getWindow", + "node", + "defaultView" + ], + "sources": [ + "window.ts" + ], + "sourcesContent": [ + "import isWindow from './isWindow'\n\nexport let realWindow = undefined as Window\n\nlet win = undefined as Window\nexport { win as window }\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n 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 && typeof window.wrap === 'function' && window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win = window\n}\n\nif (typeof window !== 'undefined' && !!window) {\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" + ], + "mappings": "OAAOA,MAAc,oBAEd,IAAIC,WAEX,IAAIC,SACKA,oBAEF,SAASC,KAAMC,GAGpBH,WAAaG,EAGb,MAAMC,EAAKD,EAAOE,SAASC,eAAe,IAGtCF,EAAGG,gBAAkBJ,EAAOE,UAAmC,mBAAhBF,EAAOK,MAAuBL,EAAOK,KAAKJ,KAAQA,IAEnGD,EAASA,EAAOK,KAAKL,IAGvBF,EAAME,EAGc,oBAAXA,QAA4BA,QACrCD,KAAKC,eAGA,SAASM,UAAWC,GACzB,OAAIX,EAASW,GACJA,GAGQA,EAAKH,eAAiBG,GAEvBC,aAAeV,EAAIE" +} \ No newline at end of file diff --git a/packages/interactjs/.npmignore b/packages/interactjs/.npmignore index ee83689f9..d5cdeb8b3 100644 --- a/packages/interactjs/.npmignore +++ b/packages/interactjs/.npmignore @@ -1,5 +1,6 @@ *.ts !*.d.ts +*.map.* *.spec.ts *.spec.js dist/docs diff --git a/packages/interactjs/README.md b/packages/interactjs/README.md index 8b9b17063..1824b547d 100644 --- a/packages/interactjs/README.md +++ b/packages/interactjs/README.md @@ -7,32 +7,31 @@

Gitter jsDelivr -Build Status +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/): +- **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)` +- [Webjars SBT/Play 2](https://www.webjars.org/): `libraryDependencies ++= Seq("org.webjars.npm" % "interactjs" % version)` ### Typescript definitions @@ -43,13 +42,11 @@ definitions, but if you need the typings alone, you can install them with: npm install --save-dev @interactjs/types ``` -Documentation -------------- +## Documentation http://interactjs.io/docs -Example -------- +## Example ```javascript var pixelSize = 16; @@ -103,8 +100,7 @@ interact('.rainbow-pixel-canvas') See the above code in action at https://codepen.io/taye/pen/tCKAm -License -------- +## License interact.js is released under the [MIT License](http://taye.mit-license.org). diff --git a/packages/interactjs/dist/api/DropEvent_DropEvent.html b/packages/interactjs/dist/api/DropEvent_DropEvent.html new file mode 100644 index 000000000..b1c042336 --- /dev/null +++ b/packages/interactjs/dist/api/DropEvent_DropEvent.html @@ -0,0 +1,171 @@ + + + + + + DropEvent - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

DropEvent

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

+ DropEvent +

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

new DropEvent()

+ + + + + +
+

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

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/packages/interactjs/dist/api/InteractEvent_InteractEvent.html b/packages/interactjs/dist/api/InteractEvent_InteractEvent.html new file mode 100644 index 000000000..9219b5ada --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/Interactable_Interactable.html b/packages/interactjs/dist/api/Interactable_Interactable.html new file mode 100644 index 000000000..fbf39bb48 --- /dev/null +++ b/packages/interactjs/dist/api/Interactable_Interactable.html @@ -0,0 +1,167 @@ + + + + + + Interactable - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

Interactable

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

+ Interactable +

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

new Interactable()

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/packages/interactjs/dist/api/Interaction_Interaction.html b/packages/interactjs/dist/api/Interaction_Interaction.html new file mode 100644 index 000000000..c40d847fc --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/doclets.json b/packages/interactjs/dist/api/doclets.json new file mode 100644 index 000000000..de3a97858 --- /dev/null +++ b/packages/interactjs/dist/api/doclets.json @@ -0,0 +1 @@ +[{"comment":"/** @article /home/runner/work/interact.js/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":"T000002R003565","___s":true,"attribs":"","id":"index","ancestors":[]},{"comment":"/**\n * Don't call listeners on the remaining targets\n */","meta":{"range":[396,499],"filename":"BaseEvent.ts","lineno":28,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100007753","name":"BaseEvent#stopImmediatePropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@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":"T000002R000864","___s":true,"attribs":"","id":"stopImmediatePropagation","signature":"()","ancestors":[]},{"comment":"/**\n * Don't call any other listeners (even on the current target)\n */","meta":{"range":[269,328],"filename":"BaseEvent.ts","lineno":21,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100007743","name":"BaseEvent#stopPropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@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":"T000002R000862","___s":true,"attribs":"","id":"stopPropagation","signature":"()","ancestors":[]},{"comment":"/**\n * Class of events fired on dropzones during drags with acceptable targets.\n */","meta":{"range":[362,822],"filename":"DropEvent.ts","lineno":18,"columnno":2,"path":"../packages/@interactjs/actions/drop","code":{"id":"astnode100000558","name":"exports.DropEvent","type":"MethodDefinition","paramnames":["dropState","dragEvent","type"]},"vars":{"":null},"shortpath":"packages/@interactjs/actions/drop/DropEvent.ts"},"description":"

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

","name":"DropEvent","longname":"DropEvent#DropEvent","kind":"class","memberof":"DropEvent","scope":"instance","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":[1043,2082],"filename":"DropEvent.ts","lineno":36,"columnno":2,"path":"../packages/@interactjs/actions/drop","code":{"id":"astnode100000642","name":"DropEvent#reject","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@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":"T000002R000077","___s":true,"attribs":"","id":"reject","signature":"()","ancestors":[]},{"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":[1094,1383],"filename":"InteractStatic.ts","lineno":51,"columnno":8,"path":"../packages/@interactjs/core","code":{"id":"astnode100015117","name":"interact","type":"ArrowFunctionExpression"},"vars":{"interactable":"module:interact~interactable","interactable.events.global":"module:interact~interactable.events.global"},"shortpath":"packages/@interactjs/core/InteractStatic.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":"function","___id":"T000002R001638","___s":true,"attribs":"","id":"interact","signature":"(target) → {Interactable}","ancestors":[]},{"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":[3839,4126],"filename":"plugin.ts","lineno":228,"columnno":2,"path":"../packages/@interactjs/actions/drop","code":{"id":"astnode100000949","name":"interact.dynamicDrop","type":"FunctionExpression","paramnames":["newValue"]},"vars":{"scope.dynamicDrop":"scope.dynamicDrop"},"shortpath":"packages/@interactjs/actions/drop/plugin.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":"T000002R000103","___s":true,"attribs":"(static) ","id":".dynamicDrop","signature":"(newValueopt) → {boolean|interact}","ancestors":["interact."]},{"comment":"/** @internal */","meta":{"range":[835,931],"filename":"Interactable.ts","lineno":22,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009102","name":"Interactable#_defaults","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@interactjs/core/Interactable.ts"},"tags":[{"originalTitle":"internal","title":"internal","text":""}],"name":"_defaults","longname":"Interactable#_defaults","kind":"member","memberof":"Interactable","scope":"instance","params":[],"___id":"T000002R000998","___s":true,"attribs":"","id":"_defaults","ancestors":[],"signature":""},{"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":[3607,3659],"filename":"InteractableMethods.ts","lineno":108,"columnno":2,"path":"../packages/@interactjs/auto-start","code":{"id":"astnode100007506","name":"Interactable.prototype.actionChecker","type":"Identifier","value":"actionChecker","paramnames":[]},"shortpath":"packages/@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":"T000002R000829","___s":true,"attribs":"","id":"actionChecker","ancestors":[],"signature":""},{"comment":"/**\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 * @deprecated\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\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":[2296,2523],"filename":"InteractableMethods.ts","lineno":80,"columnno":2,"path":"../packages/@interactjs/auto-start","code":{"id":"astnode100007486","name":"Interactable.prototype.allowFrom","type":"CallExpression","value":"","paramnames":[]},"shortpath":"packages/@interactjs/auto-start/InteractableMethods.ts"},"description":"

A drag/resize/gesture is started only If the target of the mousedown,\npointerdown or touchstart event or any of it's parents match the given\nCSS selector or Element.

","deprecated":"Don't use this method. Instead set the `allowFrom` option for each action\nor for `pointerEvents`\n\n```js\ninteract(targett)\n .resizable({\n allowFrom: '.resize-handle',\n .pointerEvents({\n allowFrom: '.handle',,\n })\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":"T000002R000828","___s":true,"attribs":"","id":"allowFrom","ancestors":[],"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":[6968,7009],"filename":"Interactable.ts","lineno":265,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009814","name":"Interactable#context","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001049","___s":true,"attribs":"","id":"context","signature":"() → {Node}","ancestors":[]},{"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":[6272,6461],"filename":"Interactable.ts","lineno":230,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009729","name":"Interactable#deltaSource","type":"MethodDefinition","paramnames":["newValue"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001045","___s":true,"attribs":"","id":"deltaSource","signature":"(newValueopt) → {string|object}","ancestors":[]},{"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":[2718,3290],"filename":"plugin.ts","lineno":84,"columnno":6,"path":"../packages/@interactjs/actions/drag","code":{"id":"astnode100000301","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":"packages/@interactjs/actions/drag/plugin.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":[]},{"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":[3283,3499],"filename":"plugin.ts","lineno":201,"columnno":2,"path":"../packages/@interactjs/actions/drop","code":{"id":"astnode100000924","name":"Interactable.prototype.dropCheck","type":"FunctionExpression","paramnames":["dragEvent","event","draggable","draggableElement","dropElement","rect"]},"shortpath":"packages/@interactjs/actions/drop/plugin.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":"T000002R000102","___s":true,"attribs":"","id":"dropCheck","signature":"()","ancestors":[]},{"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 {object | Interactable} The current setting or this Interactable\n */","meta":{"range":[2520,2620],"filename":"plugin.ts","lineno":157,"columnno":2,"path":"../packages/@interactjs/actions/drop","code":{"id":"astnode100000909","name":"Interactable.prototype.dropzone","type":"FunctionExpression","paramnames":["options"]},"shortpath":"packages/@interactjs/actions/drop/plugin.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":["object","Interactable"]},"description":"

The current setting or this Interactable

"}],"name":"dropzone","longname":"Interactable#dropzone","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000101","___s":true,"attribs":"","id":"dropzone","signature":"(optionsopt) → {object|Interactable}","ancestors":[]},{"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":[8291,8356],"filename":"Interactable.ts","lineno":323,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009967","name":"Interactable#fire","type":"MethodDefinition","paramnames":["iEvent"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001054","___s":true,"attribs":"","id":"fire","signature":"(iEvent) → {Interactable}","ancestors":[]},{"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":[995,1397],"filename":"plugin.ts","lineno":65,"columnno":2,"path":"../packages/@interactjs/actions/gesture","code":{"id":"astnode100002832","name":"Interactable.prototype.gesturable","type":"FunctionExpression","paramnames":["options"]},"vars":{"this.options.gesture.enabled":"Interactable#gesturable#options.gesture.enabled"},"shortpath":"packages/@interactjs/actions/gesture/plugin.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":"T000002R000289","___s":true,"attribs":"","id":"gesturable","signature":"(optionsopt) → {boolean|Interactable}","ancestors":[]},{"comment":"/** @internal */","meta":{"range":[6485,6792],"filename":"Interactable.ts","lineno":224,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009759","name":"Interactable#getAllElements","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@interactjs/core/Interactable.ts"},"tags":[{"originalTitle":"internal","title":"internal","text":""}],"name":"getAllElements","longname":"Interactable#getAllElements","kind":"function","memberof":"Interactable","scope":"instance","params":[],"___id":"T000002R001047","___s":true,"attribs":"","id":"getAllElements","signature":"()","ancestors":[]},{"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 {Rect} The object's bounding rectangle.\n */","meta":{"range":[4081,4323],"filename":"Interactable.ts","lineno":150,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009531","name":"Interactable#getRect","type":"MethodDefinition","paramnames":["element"]},"vars":{"":null},"shortpath":"packages/@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":["Rect"]},"description":"

The object's bounding rectangle.

"}],"name":"getRect","longname":"Interactable#getRect","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R001032","___s":true,"attribs":"","id":"getRect","signature":"(elementopt) → {Rect}","ancestors":[]},{"comment":"/**\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 * @deprecated\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\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":[1331,1562],"filename":"InteractableMethods.ts","lineno":52,"columnno":2,"path":"../packages/@interactjs/auto-start","code":{"id":"astnode100007466","name":"Interactable.prototype.ignoreFrom","type":"CallExpression","value":"","paramnames":[]},"shortpath":"packages/@interactjs/auto-start/InteractableMethods.ts"},"description":"

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.

","deprecated":"Don't use this method. Instead set the `ignoreFrom` option for each action\nor for `pointerEvents`\n\n```js\ninteract(targett)\n .draggable({\n ignoreFrom: 'input, textarea, a[href]'',\n })\n .pointerEvents({\n ignoreFrom: '[no-pointer]',\n })\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":"T000002R000827","___s":true,"attribs":"","id":"ignoreFrom","ancestors":[],"signature":""},{"comment":"/** */","meta":{"range":[1050,1400],"filename":"Interactable.ts","lineno":40,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009124","name":"exports.Interactable","type":"MethodDefinition","paramnames":["target","options","defaultContext","scopeEvents"]},"vars":{"":null},"shortpath":"packages/@interactjs/core/Interactable.ts"},"name":"Interactable","longname":"Interactable#Interactable","kind":"class","memberof":"Interactable","scope":"instance","params":[],"___id":"T000003R000003","___s":true,"attribs":"","id":"Interactable","signature":"()","ancestors":[]},{"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":[10303,10405],"filename":"Interactable.ts","lineno":400,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100010143","name":"Interactable#off","type":"MethodDefinition","paramnames":["types","listener","options"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001063","___s":true,"attribs":"","id":"off","signature":"(types, listeneropt, optionsopt) → {Interactable}","ancestors":[]},{"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":[9790,9890],"filename":"Interactable.ts","lineno":386,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100010125","name":"Interactable#on","type":"MethodDefinition","paramnames":["types","listener","options"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001062","___s":true,"attribs":"","id":"on","signature":"(types, listeneropt, optionsopt) → {Interactable}","ancestors":[]},{"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":[5861,5938],"filename":"Interactable.ts","lineno":216,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009717","name":"Interactable#origin","type":"MethodDefinition","paramnames":["newValue"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001044","___s":true,"attribs":"","id":"origin","signature":"(originopt) → {object}","ancestors":[]},{"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":[2299,2353],"filename":"interactablePreventDefault.ts","lineno":83,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100010633","name":"Interactable.prototype.preventDefault","type":"Identifier","value":"preventDefault","paramnames":[]},"shortpath":"packages/@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":"T000002R001095","___s":true,"attribs":"","id":"preventDefault","ancestors":[],"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":[4652,5107],"filename":"Interactable.ts","lineno":167,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100009580","name":"Interactable#rectChecker","type":"MethodDefinition","paramnames":["checker"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001035","___s":true,"attribs":"","id":"rectChecker","signature":"(checkeropt) → {function|object}","ancestors":[]},{"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":[921,1018],"filename":"plugin.ts","lineno":45,"columnno":2,"path":"../packages/@interactjs/reflow","code":{"id":"astnode100026440","name":"Interactable.prototype.reflow","type":"FunctionExpression","paramnames":["action"]},"shortpath":"packages/@interactjs/reflow/plugin.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"},{"type":{"names":["string"]},"description":"

The name of the action

","name":"action.name"}],"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":"T000002R003055","___s":true,"attribs":"","id":"reflow","signature":"(action) → {Promise}","ancestors":[]},{"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":[2309,2412],"filename":"plugin.ts","lineno":83,"columnno":2,"path":"../packages/@interactjs/actions/resize","code":{"id":"astnode100003477","name":"Interactable.prototype.resizable","type":"FunctionExpression","paramnames":["options"]},"shortpath":"packages/@interactjs/actions/resize/plugin.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":"T000002R000362","___s":true,"attribs":"","id":"resizable","signature":"(optionsopt) → {boolean|Interactable}","ancestors":[]},{"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":[10566,11344],"filename":"Interactable.ts","lineno":414,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100010161","name":"Interactable#set","type":"MethodDefinition","paramnames":["options"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001064","___s":true,"attribs":"","id":"set","signature":"(options) → {object}","ancestors":[]},{"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":[3947,3995],"filename":"InteractableMethods.ts","lineno":141,"columnno":2,"path":"../packages/@interactjs/auto-start","code":{"id":"astnode100007514","name":"Interactable.prototype.styleCursor","type":"Identifier","value":"styleCursor","paramnames":[]},"shortpath":"packages/@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":"T000002R000830","___s":true,"attribs":"","id":"styleCursor","ancestors":[],"signature":""},{"comment":"/**\n * Remove this interactable from the list of interactables and remove it's\n * action capabilities and event listeners\n */","meta":{"range":[11483,12258],"filename":"Interactable.ts","lineno":452,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100010294","name":"Interactable#unset","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@interactjs/core/Interactable.ts"},"description":"

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

","name":"unset","longname":"Interactable#unset","kind":"function","memberof":"Interactable","scope":"instance","params":[],"___id":"T000002R001073","___s":true,"attribs":"","id":"unset","signature":"()","ancestors":[]},{"comment":"/** */","meta":{"range":[552,2888],"filename":"InteractEvent.ts","lineno":35,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100011188","name":"exports.InteractEvent","type":"MethodDefinition","paramnames":["interaction","event","actionName","phase","element","preEnd","type"]},"vars":{"":null},"shortpath":"packages/@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":[3871,3974],"filename":"InteractEvent.ts","lineno":181,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100011841","name":"InteractEvent#stopImmediatePropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001229","___s":true,"attribs":"","id":"stopImmediatePropagation","signature":"()","ancestors":[]},{"comment":"/**\n * Don't call any other listeners (even on the current target)\n */","meta":{"range":[4056,4115],"filename":"InteractEvent.ts","lineno":188,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100011855","name":"InteractEvent#stopPropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001232","___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":[9192,9542],"filename":"Interaction.ts","lineno":420,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100013046","name":"Interaction#end","type":"MethodDefinition","paramnames":["event"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001400","___s":true,"attribs":"","id":"end","signature":"(eventopt)","ancestors":[]},{"comment":"/** */","meta":{"range":[2493,3046],"filename":"Interaction.ts","lineno":94,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100012293","name":"exports.Interaction","type":"MethodDefinition","paramnames":[""]},"vars":{"":null},"shortpath":"packages/@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":[1877,2023],"filename":"Interaction.ts","lineno":166,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100012250","name":"doMove","type":"ClassProperty"},"shortpath":"packages/@interactjs/core/Interaction.ts"},"alias":"Interaction.prototype.move","name":"move","longname":"Interaction#move","kind":"member","memberof":"Interaction","scope":"instance","___id":"T000002R001313","___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":[7537,7931],"filename":"Interaction.ts","lineno":345,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100012862","name":"Interaction#move","type":"MethodDefinition","paramnames":["signalArg"]},"vars":{"":null},"shortpath":"packages/@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":"T000002R001377","___s":true,"attribs":"","id":"move","signature":"()","ancestors":[]},{"comment":"/** @internal */","meta":{"range":[1775,1821],"filename":"Interaction.ts","lineno":68,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100012244","name":"Interaction#pointerMoveTolerance","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@interactjs/core/Interaction.ts"},"tags":[{"originalTitle":"internal","title":"internal","text":""}],"name":"pointerMoveTolerance","longname":"Interaction#pointerMoveTolerance","kind":"member","memberof":"Interaction","scope":"instance","params":[],"___id":"T000002R001312","___s":true,"attribs":"","id":"pointerMoveTolerance","ancestors":[],"signature":""},{"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 {Boolean} Whether the interaction was successfully started\n */","meta":{"range":[4614,5349],"filename":"Interaction.ts","lineno":229,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100012429","name":"Interaction#start","type":"MethodDefinition","paramnames":["action","interactable","element"]},"vars":{"":null},"shortpath":"packages/@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":["Boolean"]},"description":"

Whether the interaction was successfully started

"}],"name":"start","longname":"Interaction#start","kind":"function","memberof":"Interaction","scope":"instance","___id":"T000002R001343","___s":true,"attribs":"","id":"start","signature":"(action, target, element) → {Boolean}","ancestors":[]},{"comment":"/** */","meta":{"range":[9692,9930],"filename":"Interaction.ts","lineno":363,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100013129","name":"Interaction#stop","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@interactjs/core/Interaction.ts"},"name":"stop","longname":"Interaction#stop","kind":"function","memberof":"Interaction","scope":"instance","params":[],"___id":"T000002R001411","___s":true,"attribs":"","id":"stop","signature":"()","ancestors":[]},{"comment":"/** */","meta":{"range":[185,1192],"filename":"PointerEvent.ts","lineno":5,"columnno":2,"path":"../packages/@interactjs/pointer-events","code":{"id":"astnode100026138","name":"module.exports","type":"MethodDefinition","paramnames":["type","pointer","event","eventTarget","interaction","timeStamp"]},"vars":{"":null},"shortpath":"packages/@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":"InteractStatic.ts","lineno":1,"columnno":0,"path":"../packages/@interactjs/core","code":{},"shortpath":"packages/@interactjs/core/InteractStatic.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 {Target} target The Element or string being searched for\n * @param {object} options\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */","meta":{"range":[2567,2695],"filename":"InteractStatic.ts","lineno":115,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015268","name":"interact.isSet","type":"FunctionExpression","funcscope":"module:interact.createInteractStatic","paramnames":["target","options"]},"shortpath":"packages/@interactjs/core/InteractStatic.ts"},"description":"

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

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

The Element or string being searched for

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

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

"}],"name":"isSet","longname":"module:interact.isSet","kind":"function","memberof":"module:interact","scope":"static","___id":"T000002R001654","___s":true,"attribs":"(static) ","id":".isSet","signature":"(target, options) → {boolean}","ancestors":["interact."]},{"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":[1416,1487],"filename":"base.ts","lineno":99,"columnno":2,"path":"../packages/@interactjs/auto-start","code":{"id":"astnode100005959","name":"interact.maxInteractions","type":"ArrowFunctionExpression","paramnames":["newValue"]},"shortpath":"packages/@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":"T000002R000668","___s":true,"attribs":"(static) ","id":".maxInteractions","signature":"(newValueopt)","ancestors":["interact."]},{"comment":"/**\n * @deprecated\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":[4566,5416],"filename":"InteractStatic.ts","lineno":180,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015443","name":"interact.off","type":"CallExpression","funcscope":"module:interact.createInteractStatic","value":"","paramnames":[]},"shortpath":"packages/@interactjs/core/InteractStatic.ts"},"deprecated":"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":"T000002R001661","___s":true,"attribs":"(static) ","id":".off","ancestors":["interact."],"signature":""},{"comment":"/**\n * @deprecated\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":[3109,4122],"filename":"InteractStatic.ts","lineno":130,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015294","name":"interact.on","type":"CallExpression","funcscope":"module:interact.createInteractStatic","value":"","paramnames":[]},"shortpath":"packages/@interactjs/core/InteractStatic.ts"},"deprecated":"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":"T000002R001655","___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":[6573,6807],"filename":"InteractStatic.ts","lineno":264,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015657","name":"interact.pointerMoveTolerance","type":"FunctionExpression","funcscope":"module:interact.createInteractStatic","paramnames":["newValue"]},"vars":{"this.scope.interactions.pointerMoveTolerance":"module:interact.pointerMoveTolerance#scope.interactions.pointerMoveTolerance"},"shortpath":"packages/@interactjs/core/InteractStatic.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":"function","memberof":"module:interact","scope":"static","___id":"T000002R001672","___s":true,"attribs":"(static) ","id":".pointerMoveTolerance","signature":"(newValueopt) → {interact|number}","ancestors":["interact."]},{"comment":"/**\n * Cancels all interactions (end events are not fired)\n *\n * @alias module:interact.stop\n *\n * @return {object} interact\n */","meta":{"range":[6074,6219],"filename":"InteractStatic.ts","lineno":249,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015631","name":"interact.stop","type":"FunctionExpression","funcscope":"module:interact.createInteractStatic","paramnames":[]},"vars":{"interaction":"module:interact.stop~interaction"},"shortpath":"packages/@interactjs/core/InteractStatic.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":"function","memberof":"module:interact","scope":"static","___id":"T000002R001670","___s":true,"attribs":"(static) ","id":".stop","signature":"() → {object}","ancestors":["interact."]},{"comment":"/**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */","meta":{"range":[5835,5925],"filename":"InteractStatic.ts","lineno":240,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015620","name":"interact.supportsPointerEvent","type":"FunctionExpression","funcscope":"module:interact.createInteractStatic","paramnames":[]},"shortpath":"packages/@interactjs/core/InteractStatic.ts"},"alias":"module:interact.supportsPointerEvent","returns":[{"type":{"names":["boolean"]},"description":"

Whether or not the browser supports PointerEvents

"}],"name":"supportsPointerEvent","longname":"module:interact.supportsPointerEvent","kind":"function","memberof":"module:interact","scope":"static","___id":"T000002R001669","___s":true,"attribs":"(static) ","id":".supportsPointerEvent","signature":"() → {boolean}","ancestors":["interact."]},{"comment":"/**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */","meta":{"range":[5614,5690],"filename":"InteractStatic.ts","lineno":231,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015609","name":"interact.supportsTouch","type":"FunctionExpression","funcscope":"module:interact.createInteractStatic","paramnames":[]},"shortpath":"packages/@interactjs/core/InteractStatic.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":"function","memberof":"module:interact","scope":"static","___id":"T000002R001668","___s":true,"attribs":"(static) ","id":".supportsTouch","signature":"() → {boolean}","ancestors":["interact."]},{"comment":"/**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n */","meta":{"range":[2107,2214],"filename":"InteractStatic.ts","lineno":103,"columnno":2,"path":"../packages/@interactjs/core","code":{"id":"astnode100015248","name":"interact.use","type":"FunctionExpression","funcscope":"module:interact.createInteractStatic","paramnames":["plugin","options"]},"shortpath":"packages/@interactjs/core/InteractStatic.ts"},"description":"

Use a plugin

","alias":"module:interact.use","name":"use","longname":"module:interact.use","kind":"function","memberof":"module:interact","scope":"static","___id":"T000002R001653","___s":true,"attribs":"(static) ","id":".use","signature":"()","ancestors":["interact."]},{"comment":"/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */","meta":{"filename":"aspectRatio.ts","lineno":1,"columnno":0,"path":"../packages/@interactjs/modifiers","code":{},"shortpath":"packages/@interactjs/modifiers/aspectRatio.ts"},"kind":"module","name":"modifiers/aspectRatio","description":"

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

\n
interact(target).resizable({\n  modifiers: [\n    interact.modifiers.snapSize({\n      targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n    }),\n    interact.aspectRatio({ ratio: 'preserve' }),\n  ],\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 * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */","meta":{"filename":"aspectRatio.ts","lineno":1,"columnno":0,"path":"/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers","code":{},"shortpath":"packages/@interactjs/modifiers/aspectRatio.ts"},"kind":"module","name":"modifiers/aspectRatio","description":"

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

\n
interact(target).resizable({\n  modifiers: [\n    interact.modifiers.snapSize({\n      targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n    }),\n    interact.aspectRatio({ ratio: 'preserve' }),\n  ],\n});\n
","longname":"module:modifiers/aspectRatio","___id":"T000002R002057","___s":true,"attribs":"","id":"modifiers/aspectRatio","ancestors":[]}]},{"comment":"/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\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 */","meta":{"filename":"edges.ts","lineno":1,"columnno":0,"path":"../packages/@interactjs/modifiers/snap","code":{},"shortpath":"packages/@interactjs/modifiers/snap/edges.ts"},"kind":"module","name":"modifiers/snapEdges","description":"

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

\n
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})\n
","longname":"module:modifiers/snapEdges","___id":"T000004R000004","___s":true,"attribs":"","id":"modifiers/snapEdges","ancestors":[],"modules":[{"comment":"/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\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 */","meta":{"filename":"edges.ts","lineno":1,"columnno":0,"path":"/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/snap","code":{},"shortpath":"packages/@interactjs/modifiers/snap/edges.ts"},"kind":"module","name":"modifiers/snapEdges","description":"

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

\n
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})\n
","longname":"module:modifiers/snapEdges","___id":"T000002R002572","___s":true,"attribs":"","id":"modifiers/snapEdges","ancestors":[]}]},{"kind":"package","longname":"package:undefined","files":["/home/runner/work/interact.js/interact.js/packages/@interactjs/actions/drag/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/actions/drop/DropEvent.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/actions/drop/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/actions/gesture/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/actions/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/actions/resize/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/auto-scroll/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/auto-start/base.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/auto-start/dragAxis.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/auto-start/hold.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/auto-start/InteractableMethods.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/auto-start/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/BaseEvent.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/Eventable.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/events.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/Interactable.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/interactablePreventDefault.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/InteractableSet.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/InteractEvent.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/Interaction.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/interactionFinder.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/interactions.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/InteractStatic.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/NativeTypes.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/options.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/PointerInfo.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/scope.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/core/types.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/dev-tools/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/dev-tools/visualizer/plugin.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/dev-tools/visualizer/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/dev-tools/visualizer/visualizer.spec.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/dev-tools/visualizer/vueModules.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/dev-tools/visualizer/vueModules.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/inertia/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/interact/index.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/interactjs/index.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/interactjs/index.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/all.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/aspectRatio.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/avoid/avoid.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/avoid/avoid.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/base.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/Modification.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/noop.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/restrict/edges.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/restrict/pointer.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/restrict/rect.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/restrict/size.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/rubberband/rubberband.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/rubberband/rubberband.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/snap/edges.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/snap/pointer.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/snap/size.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/spring/spring.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/spring/spring.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/transform/transform.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/transform/transform.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/modifiers/types.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/offset/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/pointer-events/base.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/pointer-events/holdRepeat.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/pointer-events/interactableTargets.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/pointer-events/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/pointer-events/PointerEvent.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/reflow/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/all.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/edgeTarget.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/edgeTarget.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/elements.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/elements.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/grid.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/snappers/plugin.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/types/index.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/arr.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/browser.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/center.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/clone.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/displace.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/displace.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/domObjects.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/domUtils.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/ElementState.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/ElementState.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/exchange.stub.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/exchange.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/extend.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/getOriginXY.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/hypot.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/is.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/isNonNativeEvent.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/isWindow.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/misc.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/normalizeListeners.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/pointerExtend.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/pointerUtils.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/raf.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/rect.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/shallowEqual.ts","/home/runner/work/interact.js/interact.js/packages/@interactjs/utils/window.ts","/home/runner/work/interact.js/interact.js/packages/interactjs/index.ts","/home/runner/work/interact.js/interact.js/jsdoc/index.md"],"___id":"T000002R003566","___s":true,"attribs":"","id":"package:","ancestors":[]},{"comment":"/**\n * Prevent the default behaviour of the original Event\n */","meta":{"range":[1645,1708],"filename":"PointerEvent.ts","lineno":79,"columnno":2,"path":"../packages/@interactjs/pointer-events","code":{"id":"astnode100026385","name":"preventDefault","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"packages/@interactjs/pointer-events/PointerEvent.ts"},"description":"

Prevent the default behaviour of the original Event

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

Global

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

+ +

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

Methods

+ + + +
+ + + +

interact(target) → {Interactable}

+ + + + + +
+
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:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
target + + +Element +| + +string + + + + +

The HTML or SVG Element to interact with +or CSS selector

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

preventDefault()

+ + + + + +
+

Prevent the default behaviour of the original Event

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/packages/interactjs/dist/api/img/ijs-32.png b/packages/interactjs/dist/api/img/ijs-32.png new file mode 100644 index 000000000..63d1259d9 Binary files /dev/null and b/packages/interactjs/dist/api/img/ijs-32.png differ diff --git a/packages/interactjs/dist/api/img/ijs-64.png b/packages/interactjs/dist/api/img/ijs-64.png new file mode 100644 index 000000000..e6331590f Binary files /dev/null and b/packages/interactjs/dist/api/img/ijs-64.png differ diff --git a/packages/interactjs/dist/api/img/ijs-anim-short.svg b/packages/interactjs/dist/api/img/ijs-anim-short.svg new file mode 100644 index 000000000..56a7ab666 --- /dev/null +++ b/packages/interactjs/dist/api/img/ijs-anim-short.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/interactjs/dist/api/img/ijs-anim.svg b/packages/interactjs/dist/api/img/ijs-anim.svg new file mode 100644 index 000000000..4d2703569 --- /dev/null +++ b/packages/interactjs/dist/api/img/ijs-anim.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/interactjs/dist/api/img/ijs-icon.svg b/packages/interactjs/dist/api/img/ijs-icon.svg new file mode 100644 index 000000000..9a3fb22d6 --- /dev/null +++ b/packages/interactjs/dist/api/img/ijs-icon.svg @@ -0,0 +1,103 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/packages/interactjs/dist/api/img/ijs.svg b/packages/interactjs/dist/api/img/ijs.svg new file mode 100644 index 000000000..37a883ba4 --- /dev/null +++ b/packages/interactjs/dist/api/img/ijs.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/interactjs/dist/api/index.html b/packages/interactjs/dist/api/index.html new file mode 100644 index 000000000..5d85e9505 --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/jsdoc_index.md.html b/packages/interactjs/dist/api/jsdoc_index.md.html new file mode 100644 index 000000000..39220b2b2 --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/module-interact.html b/packages/interactjs/dist/api/module-interact.html new file mode 100644 index 000000000..ce70611d6 --- /dev/null +++ b/packages/interactjs/dist/api/module-interact.html @@ -0,0 +1,1137 @@ + + + + + + interact - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

interact

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

Members

+ + + +
+

(static) off

+ + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Removes a global InteractEvent listener or DOM event from `document`
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) on

+ + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Add a global listener for an InteractEvent or adds a DOM event to `document`
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + + + +

Methods

+ + + +
+ + + +

(static) isSet(target, options) → {boolean}

+ + + + + +
+

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

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
target + + +Target + + + + +

The Element or string being searched for

+ +
options + + +object + + + + + + +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean + + +
+
+ + +
+

Indicates if the element or CSS selector was previously +passed to interact

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

(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.

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

(static) pointerMoveTolerance(newValueopt) → {interact|number}

+ + + + + +
+

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

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

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

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +interact +| + +number + + +
+
+ + + +
+ + + +
+ + + +
+ + + +

(static) stop() → {object}

+ + + + + +
+

Cancels all interactions (end events are not fired)

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

interact

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

(static) supportsPointerEvent() → {boolean}

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean + + +
+
+ + +
+

Whether or not the browser supports PointerEvents

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

(static) supportsTouch() → {boolean}

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean + + +
+
+ + +
+

Whether or not the browser supports touch input

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

(static) use()

+ + + + + +
+

Use a plugin

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/packages/interactjs/dist/api/module-modifiers_aspectRatio.html b/packages/interactjs/dist/api/module-modifiers_aspectRatio.html new file mode 100644 index 000000000..3621870d3 --- /dev/null +++ b/packages/interactjs/dist/api/module-modifiers_aspectRatio.html @@ -0,0 +1,175 @@ + + + + + + modifiers/aspectRatio - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

modifiers/aspectRatio

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

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

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

modifiers/snapEdges

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

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

+
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,
+      }),
+    ],
+  },
+})
+
+ + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/packages/interactjs/dist/api/module.exports_module.exports.html b/packages/interactjs/dist/api/module.exports_module.exports.html new file mode 100644 index 000000000..fd904bb4d --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/packages_@interactjs_actions_drag_plugin.ts.html b/packages/interactjs/dist/api/packages_@interactjs_actions_drag_plugin.ts.html new file mode 100644 index 000000000..ae5efbc35 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_actions_drag_plugin.ts.html @@ -0,0 +1,253 @@ + + + + + + packages/@interactjs/actions/drag/plugin.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/actions/drag/plugin.ts

+ + + + + + + +
+
+
import type { InteractEvent } from '@interactjs/core/InteractEvent'
+import type { Interactable } from '@interactjs/core/Interactable'
+import type { PerActionDefaults } from '@interactjs/core/options'
+import type { Scope, Plugin } from '@interactjs/core/scope'
+import type { ActionMethod, ListenersArg } from '@interactjs/core/types'
+import is from '@interactjs/utils/is'
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    draggable: DraggableMethod
+  }
+}
+
+declare module '@interactjs/core/options' {
+  interface ActionDefaults {
+    drag: DraggableOptions
+  }
+}
+
+declare module '@interactjs/core/types' {
+  interface ActionMap {
+    drag?: typeof drag
+  }
+}
+
+export type DragEvent = InteractEvent<'drag'>
+
+export type DraggableMethod = ActionMethod<DraggableOptions>
+
+export interface DraggableOptions extends PerActionDefaults {
+  startAxis?: 'x' | 'y' | 'xy'
+  lockAxis?: 'x' | 'y' | 'xy' | 'start'
+  oninertiastart?: ListenersArg
+  onstart?: ListenersArg
+  onmove?: ListenersArg
+  onend?: ListenersArg
+}
+
+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: Interactable,
+  options?: 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 as DraggableOptions
+}
+
+const drag: 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 DraggableOptions,
+
+  getCursor () {
+    return 'move'
+  },
+
+  filterEventType: (type: string) => type.search('drag') === 0,
+}
+
+export default drag
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_actions_drop_DropEvent.ts.html b/packages/interactjs/dist/api/packages_@interactjs_actions_drop_DropEvent.ts.html new file mode 100644 index 000000000..c13682649 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_actions_drop_DropEvent.ts.html @@ -0,0 +1,146 @@ + + + + + + packages/@interactjs/actions/drop/DropEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/actions/drop/DropEvent.ts

+ + + + + + + +
+
+
import { BaseEvent } from '@interactjs/core/BaseEvent'
+import type { InteractEvent } from '@interactjs/core/InteractEvent'
+import type { Interactable } from '@interactjs/core/Interactable'
+import type { Element } from '@interactjs/core/types'
+import * as arr from '@interactjs/utils/arr'
+
+import type { DropState } from './plugin'
+
+export class DropEvent extends BaseEvent<'drag'> {
+  declare target: Element
+  dropzone: Interactable
+  dragEvent: InteractEvent<'drag'>
+  relatedTarget: Element
+  draggable: Interactable
+  propagationStopped = false
+  immediatePropagationStopped = false
+
+  /**
+   * Class of events fired on dropzones during drags with acceptable targets.
+   */
+  constructor (dropState: 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
+  }
+}
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_actions_drop_plugin.ts.html b/packages/interactjs/dist/api/packages_@interactjs_actions_drop_plugin.ts.html new file mode 100644 index 000000000..ff53df6b6 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_actions_drop_plugin.ts.html @@ -0,0 +1,776 @@ + + + + + + packages/@interactjs/actions/drop/plugin.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/actions/drop/plugin.ts

+ + + + + + + +
+
+
import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'
+import type { Interactable } from '@interactjs/core/Interactable'
+import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'
+import type { PerActionDefaults } from '@interactjs/core/options'
+import type { Scope, Plugin } from '@interactjs/core/scope'
+import type { Element, PointerEventType, Rect, ListenersArg } from '@interactjs/core/types'
+import * as domUtils from '@interactjs/utils/domUtils'
+import extend from '@interactjs/utils/extend'
+import getOriginXY from '@interactjs/utils/getOriginXY'
+import is from '@interactjs/utils/is'
+import normalizeListeners from '@interactjs/utils/normalizeListeners'
+import * as pointerUtils from '@interactjs/utils/pointerUtils'
+
+/* eslint-disable import/no-duplicates -- for typescript module augmentations */
+import '../drag/plugin'
+
+import type { DragEvent } from '../drag/plugin'
+import drag from '../drag/plugin'
+/* eslint-enable import/no-duplicates */
+
+import { DropEvent } from './DropEvent'
+
+export type DropFunctionChecker = (
+  dragEvent: any, // related drag operation
+  event: any, // touch or mouse EventEmitter
+  dropped: boolean, // default checker result
+  dropzone: Interactable, // dropzone interactable
+  dropElement: Element, // drop zone element
+  draggable: Interactable, // draggable's Interactable
+  draggableElement: Element, // dragged element
+) => boolean
+
+export interface DropzoneOptions extends PerActionDefaults {
+  accept?:
+  | string
+  | Element
+  | (({ dropzone, draggableElement }: { dropzone: Interactable, draggableElement: Element }) => boolean)
+  // How the overlap is checked on the drop zone
+  overlap?: 'pointer' | 'center' | number
+  checker?: DropFunctionChecker
+
+  ondropactivate?: ListenersArg
+  ondropdeactivate?: ListenersArg
+  ondragenter?: ListenersArg
+  ondragleave?: ListenersArg
+  ondropmove?: ListenersArg
+  ondrop?: ListenersArg
+}
+
+export interface DropzoneMethod {
+  (this: Interactable, options: DropzoneOptions | boolean): Interactable
+  (): DropzoneOptions
+}
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    dropzone: DropzoneMethod
+    dropCheck: (
+      dragEvent: InteractEvent,
+      event: PointerEventType,
+      draggable: Interactable,
+      draggableElement: Element,
+      dropElemen: Element,
+      rect: any,
+    ) => boolean
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    dropState?: DropState
+  }
+}
+
+declare module '@interactjs/core/InteractEvent' {
+  interface InteractEvent {
+    prevDropzone?: Interactable
+    dropzone?: Interactable
+    dragEnter?: Element
+    dragLeave?: Element
+  }
+}
+
+declare module '@interactjs/core/options' {
+  interface ActionDefaults {
+    drop: DropzoneOptions
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface Scope {
+    dynamicDrop?: boolean
+  }
+
+  interface SignalArgs {
+    'actions/drop:start': DropSignalArg
+    'actions/drop:move': DropSignalArg
+    'actions/drop:end': DropSignalArg
+  }
+}
+
+declare module '@interactjs/core/types' {
+  interface ActionMap {
+    drop?: typeof drop
+  }
+}
+
+declare module '@interactjs/core/InteractStatic' {
+  interface InteractStatic {
+    dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this
+  }
+}
+
+interface DropSignalArg {
+  interaction: Interaction<'drag'>
+  dragEvent: DragEvent
+}
+
+export interface ActiveDrop {
+  dropzone: Interactable
+  element: Element
+  rect: Rect
+}
+
+export interface DropState {
+  cur: {
+    // the dropzone a drag target might be dropped into
+    dropzone: Interactable
+    // the element at the time of checking
+    element: Element
+  }
+  prev: {
+    // the dropzone that was recently dragged away from
+    dropzone: Interactable
+    // the element at the time of checking
+    element: Element
+  }
+  // wheather the potential drop was rejected from a listener
+  rejected: boolean
+  // the drop events related to the current drag event
+  events: FiredDropEvents
+  activeDrops: ActiveDrop[]
+}
+
+function install (scope: Scope) {
+  const {
+    actions,
+    /** @lends module:interact */
+    interactStatic: interact,
+    /** @lends Interactable */
+    Interactable,
+    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 {object | Interactable} The current setting or this Interactable
+   */
+  Interactable.prototype.dropzone = function (this: Interactable, options) {
+    return dropzoneMethod(this, options)
+  } as Interactable['dropzone']
+
+  /**
+   * ```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: 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 (is.bool(newValue)) {
+      // if (dragging && scope.dynamicDrop !== newValue && !newValue) {
+      //  calcRects(dropzones)
+      // }
+
+      scope.dynamicDrop = newValue
+
+      return interact
+    }
+    return scope.dynamicDrop!
+  }
+
+  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 collectDropzones ({ interactables }: Scope, draggableElement: Element) {
+  const drops: ActiveDrop[] = []
+
+  // 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 (
+      (is.element(accept) && accept !== draggableElement) ||
+      (is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||
+      (is.func(accept) && !accept({ dropzone, draggableElement }))
+    ) {
+      continue
+    }
+
+    for (const dropzoneElement of dropzone.getAllElements()) {
+      if (dropzoneElement !== draggableElement) {
+        drops.push({
+          dropzone,
+          element: dropzoneElement,
+          rect: dropzone.getRect(dropzoneElement),
+        })
+      }
+    }
+  }
+
+  return drops
+}
+
+function fireActivationEvents (activeDrops: ActiveDrop[], event: DropEvent) {
+  // 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: Element) {
+  // get dropzones and their elements that could receive the draggable
+  const activeDrops = collectDropzones(scope, dragElement)
+
+  for (const activeDrop of activeDrops) {
+    activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element)
+  }
+
+  return activeDrops
+}
+
+function getDrop (
+  { dropState, interactable: draggable, element: dragElement }: Interaction,
+  dragEvent,
+  pointerEvent,
+) {
+  const validDrops: Element[] = []
+
+  // collect all dropzones and their elements which qualify for a drop
+  for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {
+    const isValid = dropzone.dropCheck(
+      dragEvent,
+      pointerEvent,
+      draggable!,
+      dragElement!,
+      dropzoneElement,
+      rect,
+    )
+    validDrops.push(isValid ? dropzoneElement : null)
+  }
+
+  // get the most appropriate dropzone based on DOM depth and order
+  const dropIndex = domUtils.indexOfDeepestElement(validDrops)
+
+  return dropState!.activeDrops[dropIndex] || null
+}
+
+function getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {
+  const dropState = interaction.dropState!
+  const dropEvents: Record<string, DropEvent | null> = {
+    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 as never
+    dropEvents.activate.dropzone = null as never
+  }
+  if (dragEvent.type === 'dragend') {
+    dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')
+
+    dropEvents.deactivate.target = null as never
+    dropEvents.deactivate.dropzone = null as never
+  }
+
+  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')
+
+    dragEvent.dropzone = dropState.cur.dropzone
+  }
+
+  return dropEvents
+}
+
+type FiredDropEvents = Partial<
+Record<'leave' | 'enter' | 'move' | 'drop' | 'activate' | 'deactivate', DropEvent>
+>
+
+function fireDropEvents (interaction: Interaction, events: FiredDropEvents) {
+  const dropState = interaction.dropState!
+  const { activeDrops, cur, prev } = dropState
+
+  if (events.leave) {
+    prev.dropzone.fire(events.leave)
+  }
+  if (events.enter) {
+    cur.dropzone.fire(events.enter)
+  }
+  if (events.move) {
+    cur.dropzone.fire(events.move)
+  }
+  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 }: DoPhaseArg<'drag', EventPhase>, scope: Scope) {
+  if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') {
+    return
+  }
+
+  const dropState = interaction.dropState!
+
+  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: Interactable): DropzoneOptions
+function dropzoneMethod(interactable: Interactable, options: DropzoneOptions | boolean): Interactable
+function dropzoneMethod (interactable: Interactable, options?: DropzoneOptions | boolean) {
+  if (is.object(options)) {
+    interactable.options.drop.enabled = options.enabled !== false
+
+    if (options.listeners) {
+      const normalized = 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
+      }, {})
+
+      const prevListeners = interactable.options.drop.listeners
+      prevListeners && interactable.off(prevListeners)
+
+      interactable.on(corrected)
+      interactable.options.drop.listeners = corrected
+    }
+
+    if (is.func(options.ondrop)) {
+      interactable.on('drop', options.ondrop)
+    }
+    if (is.func(options.ondropactivate)) {
+      interactable.on('dropactivate', options.ondropactivate)
+    }
+    if (is.func(options.ondropdeactivate)) {
+      interactable.on('dropdeactivate', options.ondropdeactivate)
+    }
+    if (is.func(options.ondragenter)) {
+      interactable.on('dragenter', options.ondragenter)
+    }
+    if (is.func(options.ondragleave)) {
+      interactable.on('dragleave', options.ondragleave)
+    }
+    if (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 (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 (is.bool(options)) {
+    interactable.options.drop.enabled = options
+
+    return interactable
+  }
+
+  return interactable.options.drop
+}
+
+function dropCheckMethod (
+  interactable: Interactable,
+  dragEvent: InteractEvent,
+  event: PointerEventType,
+  draggable: Interactable,
+  draggableElement: Element,
+  dropElement: 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 = getOriginXY(draggable, draggableElement, 'drag')
+    const page = pointerUtils.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 && 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: 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 }: DoPhaseArg<'drag', EventPhase>,
+      scope,
+    ) => {
+      if (interaction.prepared.name !== 'drag') {
+        return
+      }
+
+      const dropState = interaction.dropState!
+
+      // reset active dropzones
+      dropState.activeDrops = []
+      dropState.events = {}
+      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 })
+      }
+    },
+
+    'interactions:action-move': onEventCreated,
+
+    'interactions:after-action-move': (
+      { interaction, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,
+      scope,
+    ) => {
+      if (interaction.prepared.name !== 'drag') {
+        return
+      }
+
+      const dropState = interaction.dropState!
+      fireDropEvents(interaction, dropState.events)
+
+      scope.fire('actions/drop:move', { interaction, dragEvent })
+      dropState.events = {}
+    },
+
+    'interactions:action-end': (arg: DoPhaseArg<'drag', EventPhase>, scope) => {
+      if (arg.interaction.prepared.name !== 'drag') {
+        return
+      }
+
+      const { interaction, iEvent: dragEvent } = arg
+
+      onEventCreated(arg, scope)
+      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 as never
+        dropState.events = null as never
+        dropState.cur.dropzone = null as never
+        dropState.cur.element = null as never
+        dropState.prev.dropzone = null as never
+        dropState.prev.element = null as never
+        dropState.rejected = false
+      }
+    },
+  },
+  getActiveDrops,
+  getDrop,
+  getDropEvents,
+  fireDropEvents,
+
+  filterEventType: (type: string) => type.search('drag') === 0 || type.search('drop') === 0,
+
+  defaults: {
+    enabled: false,
+    accept: null as never,
+    overlap: 'pointer',
+  } as DropzoneOptions,
+}
+
+export default drop
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_actions_gesture_plugin.ts.html b/packages/interactjs/dist/api/packages_@interactjs_actions_gesture_plugin.ts.html new file mode 100644 index 000000000..bc40b0302 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_actions_gesture_plugin.ts.html @@ -0,0 +1,263 @@ + + + + + + packages/@interactjs/actions/gesture/plugin.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/actions/gesture/plugin.ts

+ + + + + + + +
+
+
import type { InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'
+import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'
+import type { PerActionDefaults } from '@interactjs/core/options'
+import type { Scope, Plugin } from '@interactjs/core/scope'
+import type { ActionMethod, Rect, PointerType, ListenersArg } from '@interactjs/core/types'
+import is from '@interactjs/utils/is'
+import * as pointerUtils from '@interactjs/utils/pointerUtils'
+
+export type GesturableMethod = ActionMethod<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/options' {
+  interface ActionDefaults {
+    gesture: GesturableOptions
+  }
+}
+
+declare module '@interactjs/core/types' {
+  interface ActionMap {
+    gesture?: typeof gesture
+  }
+}
+
+export interface GesturableOptions extends PerActionDefaults {
+  onstart?: ListenersArg
+  onmove?: ListenersArg
+  onend?: ListenersArg
+}
+
+export interface GestureEvent extends InteractEvent<'gesture'> {
+  distance: number
+  angle: number
+  da: number // angle change
+  scale: number // ratio of distance start to current event
+  ds: number // scale change
+  box: Rect // enclosing box of all points
+  touches: PointerType[]
+}
+
+export interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> {
+  iEvent: GestureEvent
+  interaction: Interaction<'gesture'>
+}
+
+function install (scope: 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: InstanceType<typeof Interactable>,
+    options: GesturableOptions | boolean,
+  ) {
+    if (is.object(options)) {
+      this.options.gesture.enabled = options.enabled !== false
+      this.setPerAction('gesture', options)
+      this.setOnEvents('gesture', options)
+
+      return this
+    }
+
+    if (is.bool(options)) {
+      this.options.gesture.enabled = options
+
+      return this
+    }
+
+    return this.options.gesture as GesturableOptions
+  } 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 = pointerUtils.touchDistance(pointers, deltaSource)
+    iEvent.box = pointerUtils.touchBBox(pointers)
+    iEvent.scale = 1
+    iEvent.ds = 0
+    iEvent.angle = pointerUtils.touchAngle(pointers, deltaSource)
+    iEvent.da = 0
+
+    interaction.gesture.startDistance = iEvent.distance
+    interaction.gesture.startAngle = iEvent.angle
+  } else if (ending || interaction.pointers.length < 2) {
+    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 = pointerUtils.touchDistance(pointers, deltaSource)
+    iEvent.box = pointerUtils.touchBBox(pointers)
+    iEvent.scale = iEvent.distance / interaction.gesture.startDistance
+    iEvent.angle = pointerUtils.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 (is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) {
+    interaction.gesture.scale = iEvent.scale
+  }
+}
+
+const gesture: 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 ''
+  },
+
+  filterEventType: (type: string) => type.search('gesture') === 0,
+}
+
+export default gesture
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_actions_resize_plugin.ts.html b/packages/interactjs/dist/api/packages_@interactjs_actions_resize_plugin.ts.html new file mode 100644 index 000000000..97a80b8be --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_actions_resize_plugin.ts.html @@ -0,0 +1,578 @@ + + + + + + packages/@interactjs/actions/resize/plugin.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/actions/resize/plugin.ts

+ + + + + + + +
+
+
import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'
+import type { Interactable } from '@interactjs/core/Interactable'
+import type { Interaction } from '@interactjs/core/Interaction'
+import type { PerActionDefaults } from '@interactjs/core/options'
+import type { Scope, Plugin } from '@interactjs/core/scope'
+import type {
+  ActionName,
+  ActionProps,
+  ActionMethod,
+  EdgeOptions,
+  FullRect,
+  ListenersArg,
+  OrBoolean,
+  Point,
+  Rect,
+} from '@interactjs/core/types'
+import * as dom from '@interactjs/utils/domUtils'
+import extend from '@interactjs/utils/extend'
+import is from '@interactjs/utils/is'
+
+export type EdgeName = 'top' | 'left' | 'bottom' | 'right'
+
+export type ResizableMethod = ActionMethod<ResizableOptions>
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    resizable: ResizableMethod
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction<T extends ActionName | null = ActionName> {
+    resizeAxes: 'x' | 'y' | 'xy'
+    resizeStartAspectRatio: number
+  }
+}
+
+declare module '@interactjs/core/options' {
+  interface ActionDefaults {
+    resize: ResizableOptions
+  }
+}
+
+declare module '@interactjs/core/types' {
+  interface ActionMap {
+    resize?: typeof resize
+  }
+}
+
+export interface ResizableOptions extends PerActionDefaults {
+  square?: boolean
+  preserveAspectRatio?: boolean
+  edges?: EdgeOptions | null
+  axis?: 'x' | 'y' | 'xy' // deprecated
+  invert?: 'none' | 'negate' | 'reposition'
+  margin?: number
+  squareResize?: boolean
+  oninertiastart?: ListenersArg
+  onstart?: ListenersArg
+  onmove?: ListenersArg
+  onend?: ListenersArg
+}
+
+export interface ResizeEvent<P extends EventPhase = EventPhase> extends InteractEvent<'resize', P> {
+  deltaRect?: FullRect
+  edges?: 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: Interactable, options: 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: Interactable, options: OrBoolean<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: Point,
+  element: Node,
+  interactableElement: Element,
+  rect: 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, Math.abs((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') {
+      const edge = width >= 0 ? rect.left : rect.right
+      return page.x < edge + margin
+    }
+    if (name === 'top') {
+      const edge = height >= 0 ? rect.top : rect.bottom
+      return page.y < edge + 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)
+}
+
+/* eslint-disable multiline-ternary */
+// eslint-disable-next-line @typescript-eslint/consistent-type-imports
+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',
+    }
+}
+/* eslint-enable multiline-ternary */
+
+function start ({ iEvent, interaction }: { iEvent: 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: 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'
+
+  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: 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: 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: 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 ResizableOptions,
+
+  cursors: null as ReturnType<typeof initCursors>,
+
+  getCursor ({ edges, axis, name }: 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
+  },
+
+  filterEventType: (type: string) => type.search('resize') === 0,
+
+  defaultMargin: null as number,
+}
+
+export default resize
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_auto-start_InteractableMethods.ts.html b/packages/interactjs/dist/api/packages_@interactjs_auto-start_InteractableMethods.ts.html new file mode 100644 index 000000000..3b171aff6 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_auto-start_InteractableMethods.ts.html @@ -0,0 +1,274 @@ + + + + + + packages/@interactjs/auto-start/InteractableMethods.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/auto-start/InteractableMethods.ts

+ + + + + + + +
+
+
import type { Interactable } from '@interactjs/core/Interactable'
+import type { Interaction } from '@interactjs/core/Interaction'
+import type { Scope } from '@interactjs/core/scope'
+import type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'
+import is from '@interactjs/utils/is'
+import { warnOnce } from '@interactjs/utils/misc'
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    getAction: (
+      this: Interactable,
+      pointer: PointerType,
+      event: PointerEventType,
+      interaction: Interaction,
+      element: Element,
+    ) => ActionProps | null
+    styleCursor: typeof styleCursor
+    actionChecker: typeof actionChecker
+    ignoreFrom: {
+      (...args: any[]): Interactable
+      (): boolean
+    }
+    allowFrom: {
+      (...args: any[]): Interactable
+      (): boolean
+    }
+  }
+}
+
+function install (scope: Scope) {
+  const {
+    /** @lends Interactable */
+    Interactable, // tslint:disable-line no-shadowed-variable
+  } = scope
+
+  Interactable.prototype.getAction = function getAction (
+    this: Interactable,
+    pointer: PointerType,
+    event: PointerEventType,
+    interaction: Interaction,
+    element: Element,
+  ): 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
+  }
+
+  /**
+   * 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.
+   *
+   * @deprecated
+   * Don't use this method. Instead set the `ignoreFrom` option for each action
+   * or for `pointerEvents`
+   *
+   * ```js
+   * 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: Interactable, newValue) {
+    return this._backCompatOption('ignoreFrom', newValue)
+  }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')
+
+  /**
+   *
+   * 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.
+   *
+   * @deprecated
+   * Don't use this method. Instead set the `allowFrom` option for each action
+   * or for `pointerEvents`
+   *
+   * ```js
+   * 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: 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: Interactable,
+  event: PointerEventType,
+  interaction: Interaction,
+  element: Element,
+  scope: 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: Interactable): boolean
+function styleCursor(this: Interactable, newValue: boolean): typeof this
+function styleCursor (this: 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: 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/packages/interactjs/dist/api/packages_@interactjs_auto-start_base.ts.html b/packages/interactjs/dist/api/packages_@interactjs_auto-start_base.ts.html new file mode 100644 index 000000000..f024f36ed --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_auto-start_base.ts.html @@ -0,0 +1,476 @@ + + + + + + packages/@interactjs/auto-start/base.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/auto-start/base.ts

+ + + + + + + +
+
+
import type { Interactable } from '@interactjs/core/Interactable'
+import type { Interaction } from '@interactjs/core/Interaction'
+import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'
+import type {
+  CursorChecker,
+  PointerType,
+  PointerEventType,
+  Element,
+  ActionName,
+  ActionProps,
+} from '@interactjs/core/types'
+import * as domUtils from '@interactjs/utils/domUtils'
+import extend from '@interactjs/utils/extend'
+import is from '@interactjs/utils/is'
+import { copyAction } from '@interactjs/utils/misc'
+
+/* eslint-disable import/no-duplicates -- for typescript module augmentations */
+import './InteractableMethods'
+import InteractableMethods from './InteractableMethods'
+/* eslint-enable import/no-duplicates */
+
+declare module '@interactjs/core/InteractStatic' {
+  export interface InteractStatic {
+    maxInteractions: (newValue: any) => any
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface Scope {
+    autoStart: AutoStart
+  }
+
+  interface SignalArgs {
+    'autoStart:before-start': Omit<SignalArgs['interactions:move'], 'interaction'> & {
+      interaction: Interaction<ActionName>
+    }
+    'autoStart:prepared': { interaction: Interaction }
+    'auto-start:check': CheckSignalArg
+  }
+}
+
+declare module '@interactjs/core/options' {
+  interface BaseDefaults {
+    actionChecker?: any
+    cursorChecker?: any
+    styleCursor?: any
+  }
+
+  interface PerActionDefaults {
+    manualStart?: boolean
+    max?: number
+    maxPerElement?: number
+    allowFrom?: string | Element
+    ignoreFrom?: string | Element
+    cursorChecker?: CursorChecker
+
+    // only allow left button by default
+    // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value
+    // TODO: docst
+    mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16
+  }
+}
+
+interface CheckSignalArg {
+  interactable: Interactable
+  interaction: Interaction
+  element: Element
+  action: ActionProps<ActionName>
+  buttons: number
+}
+
+export interface AutoStart {
+  // Allow this many interactions to happen simultaneously
+  maxInteractions: number
+  withinInteractionLimit: typeof withinInteractionLimit
+  cursorElement: Element
+}
+
+function install (scope: Scope) {
+  const { interactStatic: interact, defaults } = scope
+
+  scope.usePlugin(InteractableMethods)
+
+  defaults.base.actionChecker = null
+  defaults.base.styleCursor = true
+
+  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: number) => maxInteractions(newValue, scope)
+
+  scope.autoStart = {
+    // Allow this many interactions to happen simultaneously
+    maxInteractions: Infinity,
+    withinInteractionLimit,
+    cursorElement: null,
+  }
+}
+
+function prepareOnDown (
+  { interaction, pointer, event, eventTarget }: SignalArgs['interactions:down'],
+  scope: Scope,
+) {
+  if (interaction.interacting()) return
+
+  const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)
+  prepare(interaction, actionInfo, scope)
+}
+
+function prepareOnMove (
+  { interaction, pointer, event, eventTarget }: SignalArgs['interactions:move'],
+  scope: Scope,
+) {
+  if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) return
+
+  const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Element, scope)
+  prepare(interaction, actionInfo, scope)
+}
+
+function startOnMove (arg: SignalArgs['interactions:move'], scope: 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 as Interaction<ActionName>).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: Interaction }, scope: 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 ActionName> (
+  action: ActionProps<T>,
+  interactable: Interactable,
+  element: Element,
+  eventTarget: Node,
+  scope: 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: Interaction,
+  pointer: PointerType,
+  event: PointerEventType,
+  matches: Interactable[],
+  matchElements: Element[],
+  eventTarget: Node,
+  scope: 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<ActionName>(matchAction, match, matchElement, eventTarget, scope)
+
+    if (action) {
+      return {
+        action,
+        interactable: match,
+        element: matchElement,
+      }
+    }
+  }
+
+  return { action: null, interactable: null, element: null }
+}
+
+function getActionInfo (
+  interaction: Interaction,
+  pointer: PointerType,
+  event: PointerEventType,
+  eventTarget: Node,
+  scope: Scope,
+) {
+  let matches: Interactable[] = []
+  let matchElements: Element[] = []
+
+  let element = eventTarget as Element
+
+  function pushMatches (interactable: Interactable) {
+    matches.push(interactable)
+    matchElements.push(element)
+  }
+
+  while (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 = domUtils.parentNode(element) as Element
+  }
+
+  return { action: null, interactable: null, element: null }
+}
+
+function prepare (
+  interaction: Interaction,
+  {
+    action,
+    interactable,
+    element,
+  }: {
+    action: ActionProps<any>
+    interactable: Interactable
+    element: Element
+  },
+  scope: Scope,
+) {
+  action = action || { name: null }
+
+  interaction.interactable = interactable
+  interaction.element = element
+  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 ActionName> (
+  interactable: Interactable,
+  element: Element,
+  action: ActionProps<T>,
+  scope: 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: Scope) {
+  if (is.number(newValue)) {
+    scope.autoStart.maxInteractions = newValue
+
+    return this
+  }
+
+  return scope.autoStart.maxInteractions
+}
+
+function setCursor (element: Element, cursor: string, scope: 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 ActionName> (interaction: Interaction<T>, scope: 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 (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: Plugin = {
+  id: 'auto-start/base',
+  before: ['actions'],
+  install,
+  listeners: {
+    'interactions:down': prepareOnDown,
+    'interactions:move': (arg, scope) => {
+      prepareOnMove(arg, scope)
+      startOnMove(arg, scope)
+    },
+    'interactions:stop': clearCursorOnStop,
+  },
+  maxInteractions,
+  withinInteractionLimit,
+  validateAction,
+}
+
+export default autoStart
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_core_BaseEvent.ts.html b/packages/interactjs/dist/api/packages_@interactjs_core_BaseEvent.ts.html new file mode 100644 index 000000000..9b2779082 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_core_BaseEvent.ts.html @@ -0,0 +1,105 @@ + + + + + + packages/@interactjs/core/BaseEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/core/BaseEvent.ts

+ + + + + + + +
+
+
import type { Interactable } from '@interactjs/core/Interactable'
+import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'
+import type { ActionName } from '@interactjs/core/types'
+
+export class BaseEvent<T extends ActionName | null = never> {
+  declare type: string
+  declare target: EventTarget
+  declare currentTarget: Node
+  declare interactable: Interactable
+  declare _interaction: Interaction<T>
+  declare timeStamp: number
+  immediatePropagationStopped = false
+  propagationStopped = false
+
+  constructor (interaction: Interaction<T>) {
+    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
+  }
+}
+
+// defined outside of class definition to avoid assignment of undefined during
+// construction
+export interface BaseEvent<T extends ActionName> {
+  interaction: InteractionProxy<T>
+}
+
+// getters and setters defined here to support typescript 3.6 and below which
+// don't support getter and setters in .d.ts files
+Object.defineProperty(BaseEvent.prototype, 'interaction', {
+  get (this: BaseEvent) {
+    return this._interaction._proxy
+  },
+  set (this: BaseEvent) {},
+})
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_core_InteractEvent.ts.html b/packages/interactjs/dist/api/packages_@interactjs_core_InteractEvent.ts.html new file mode 100644 index 000000000..dfd26447e --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_core_InteractEvent.ts.html @@ -0,0 +1,322 @@ + + + + + + packages/@interactjs/core/InteractEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/core/InteractEvent.ts

+ + + + + + + +
+
+
import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'
+import extend from '@interactjs/utils/extend'
+import getOriginXY from '@interactjs/utils/getOriginXY'
+import hypot from '@interactjs/utils/hypot'
+
+import { BaseEvent } from './BaseEvent'
+import type { Interaction } from './Interaction'
+import { defaults } from './options'
+import type { ActionName } from './types'
+
+export type EventPhase = keyof PhaseMap
+
+export interface PhaseMap {
+  start: true
+  move: true
+  end: true
+}
+
+// defined outside of class definition to avoid assignment of undefined during
+// construction
+export interface InteractEvent {
+  pageX: number
+  pageY: number
+
+  clientX: number
+  clientY: number
+
+  dx: number
+  dy: number
+
+  velocityX: number
+  velocityY: number
+}
+
+export class InteractEvent<
+  T extends ActionName = never,
+  P extends EventPhase = EventPhase,
+> extends BaseEvent<T> {
+  declare target: Element
+  declare currentTarget: Element
+  relatedTarget: Element | null = null
+  screenX?: number
+  screenY?: number
+  button: number
+  buttons: number
+  ctrlKey: boolean
+  shiftKey: boolean
+  altKey: boolean
+  metaKey: boolean
+  page: Point
+  client: Point
+  delta: Point
+  rect: FullRect
+  x0: number
+  y0: number
+  t0: number
+  dt: number
+  duration: number
+  clientX0: number
+  clientY0: number
+  velocity: Point
+  speed: number
+  swipe: ReturnType<InteractEvent<T>['getSwipe']>
+  // resize
+  axes?: 'x' | 'y' | 'xy'
+  preEnd?: boolean
+
+  /** */
+  constructor (
+    interaction: Interaction<T>,
+    event: PointerEventType,
+    actionName: T,
+    phase: P,
+    element: 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
+  }
+
+  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
+  }
+}
+
+// getters and setters defined here to support typescript 3.6 and below which
+// don't support getter and setters in .d.ts files
+Object.defineProperties(InteractEvent.prototype, {
+  pageX: {
+    get () {
+      return this.page.x
+    },
+    set (value) {
+      this.page.x = value
+    },
+  },
+  pageY: {
+    get () {
+      return this.page.y
+    },
+    set (value) {
+      this.page.y = value
+    },
+  },
+
+  clientX: {
+    get () {
+      return this.client.x
+    },
+    set (value) {
+      this.client.x = value
+    },
+  },
+  clientY: {
+    get () {
+      return this.client.y
+    },
+    set (value) {
+      this.client.y = value
+    },
+  },
+
+  dx: {
+    get () {
+      return this.delta.x
+    },
+    set (value) {
+      this.delta.x = value
+    },
+  },
+  dy: {
+    get () {
+      return this.delta.y
+    },
+    set (value) {
+      this.delta.y = value
+    },
+  },
+
+  velocityX: {
+    get () {
+      return this.velocity.x
+    },
+    set (value) {
+      this.velocity.x = value
+    },
+  },
+  velocityY: {
+    get () {
+      return this.velocity.y
+    },
+    set (value) {
+      this.velocity.y = value
+    },
+  },
+})
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_core_InteractStatic.ts.html b/packages/interactjs/dist/api/packages_@interactjs_core_InteractStatic.ts.html new file mode 100644 index 000000000..b31b429c5 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_core_InteractStatic.ts.html @@ -0,0 +1,348 @@ + + + + + + packages/@interactjs/core/InteractStatic.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/core/InteractStatic.ts

+ + + + + + + +
+
+
/** @module interact */
+import type { Scope, Plugin } from '@interactjs/core/scope'
+import type { Context, EventTypes, Listener, ListenersArg, Target } from '@interactjs/core/types'
+import browser from '@interactjs/utils/browser'
+import * as domUtils from '@interactjs/utils/domUtils'
+import is from '@interactjs/utils/is'
+import isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'
+import { warnOnce } from '@interactjs/utils/misc'
+import * as pointerUtils from '@interactjs/utils/pointerUtils'
+
+import type { Interactable } from './Interactable'
+import type { Options } from './options'
+
+declare module '@interactjs/core/InteractStatic' {
+  export interface InteractStatic {
+    (target: Target, options?: Options): Interactable
+    getPointerAverage: typeof pointerUtils.pointerAverage
+    getTouchBBox: typeof pointerUtils.touchBBox
+    getTouchDistance: typeof pointerUtils.touchDistance
+    getTouchAngle: typeof pointerUtils.touchAngle
+    getElementRect: typeof domUtils.getElementRect
+    getElementClientRect: typeof domUtils.getElementClientRect
+    matchesSelector: typeof domUtils.matchesSelector
+    closest: typeof domUtils.closest
+    /** @internal */ globalEvents: any
+    version: string
+    /** @internal */ scope: Scope
+    use(
+      plugin: Plugin,
+      options?: {
+        [key: string]: any
+      },
+    ): any
+    isSet(target: Target, options?: any): boolean
+    on(type: string | EventTypes, listener: ListenersArg, options?: object): any
+    off(type: EventTypes, listener: any, options?: object): any
+    debug(): any
+    supportsTouch(): boolean
+    supportsPointerEvent(): boolean
+    stop(): any
+    pointerMoveTolerance(newValue?: number): any
+    addDocument(doc: Document, options?: object): void
+    removeDocument(doc: Document): void
+  }
+}
+
+// eslint-disable-next-line @typescript-eslint/consistent-type-imports
+type _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic
+
+export function createInteractStatic (scope: Scope): _InteractStatic {
+  /**
+   * ```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}
+   */
+  const interact = ((target: Target, options: Options) => {
+    let interactable = scope.interactables.getExisting(target, options)
+
+    if (!interactable) {
+      interactable = scope.interactables.new(target, options)
+      interactable.events.global = interact.globalEvents
+    }
+
+    return interactable
+  }) as _InteractStatic
+
+  // expose the functions used to calculate multi-touch properties
+  interact.getPointerAverage = pointerUtils.pointerAverage
+  interact.getTouchBBox = pointerUtils.touchBBox
+  interact.getTouchDistance = pointerUtils.touchDistance
+  interact.getTouchAngle = pointerUtils.touchAngle
+
+  interact.getElementRect = domUtils.getElementRect
+  interact.getElementClientRect = domUtils.getElementClientRect
+  interact.matchesSelector = domUtils.matchesSelector
+  interact.closest = domUtils.closest
+
+  interact.globalEvents = {} as any
+
+  // eslint-disable-next-line no-undef
+  interact.version = process.env.npm_package_version
+  interact.scope = scope
+  /**
+   * Use a plugin
+   *
+   * @alias module:interact.use
+   *
+   */
+  interact.use = function (plugin, options) {
+    this.scope.usePlugin(plugin, options)
+
+    return this
+  }
+
+  /**
+   * Check if an element or selector has been set with the {@link interact}
+   * function
+   *
+   * @alias module:interact.isSet
+   *
+   * @param {Target} target The Element or string being searched for
+   * @param {object} options
+   * @return {boolean} Indicates if the element or CSS selector was previously
+   * passed to interact
+   */
+  interact.isSet = function (target: Target, options?: { context?: Context }): boolean {
+    return !!this.scope.interactables.get(target, options && options.context)
+  }
+
+  /**
+   * @deprecated
+   * 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 = warnOnce(function on (type: string | EventTypes, listener: ListenersArg, options?: object) {
+    if (is.string(type) && type.search(' ') !== -1) {
+      type = type.trim().split(/ +/)
+    }
+
+    if (is.array(type)) {
+      for (const eventType of type as any[]) {
+        this.on(eventType, listener, options)
+      }
+
+      return this
+    }
+
+    if (is.object(type)) {
+      for (const prop in type) {
+        this.on(prop, (type as any)[prop], listener)
+      }
+
+      return this
+    }
+
+    // if it is an InteractEvent type, add listener to globalEvents
+    if (isNonNativeEvent(type, this.scope.actions)) {
+      // if this type of event was never bound
+      if (!this.globalEvents[type]) {
+        this.globalEvents[type] = [listener]
+      } else {
+        this.globalEvents[type].push(listener)
+      }
+    }
+    // If non InteractEvent type, addEventListener to document
+    else {
+      this.scope.events.add(this.scope.document, type, listener as Listener, { options })
+    }
+
+    return this
+  }, 'The interact.on() method is being deprecated')
+
+  /**
+   * @deprecated
+   * 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 = warnOnce(function off (type: EventTypes, listener: any, options?: object) {
+    if (is.string(type) && type.search(' ') !== -1) {
+      type = type.trim().split(/ +/)
+    }
+
+    if (is.array(type)) {
+      for (const eventType of type) {
+        this.off(eventType, listener, options)
+      }
+
+      return this
+    }
+
+    if (is.object(type)) {
+      for (const prop in type) {
+        this.off(prop, type[prop], listener)
+      }
+
+      return this
+    }
+
+    if (isNonNativeEvent(type, this.scope.actions)) {
+      let index: number
+
+      if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {
+        this.globalEvents[type].splice(index, 1)
+      }
+    } else {
+      this.scope.events.remove(this.scope.document, type, listener, options)
+    }
+
+    return this
+  }, 'The interact.off() method is being deprecated')
+
+  interact.debug = function () {
+    return this.scope
+  }
+
+  /**
+   * @alias module:interact.supportsTouch
+   *
+   * @return {boolean} Whether or not the browser supports touch input
+   */
+  interact.supportsTouch = function () {
+    return browser.supportsTouch
+  }
+
+  /**
+   * @alias module:interact.supportsPointerEvent
+   *
+   * @return {boolean} Whether or not the browser supports PointerEvents
+   */
+  interact.supportsPointerEvent = function () {
+    return browser.supportsPointerEvent
+  }
+
+  /**
+   * Cancels all interactions (end events are not fired)
+   *
+   * @alias module:interact.stop
+   *
+   * @return {object} interact
+   */
+  interact.stop = function () {
+    for (const interaction of this.scope.interactions.list) {
+      interaction.stop()
+    }
+
+    return this
+  }
+
+  /**
+   * 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 = function (newValue?: number) {
+    if (is.number(newValue)) {
+      this.scope.interactions.pointerMoveTolerance = newValue
+
+      return this
+    }
+
+    return this.scope.interactions.pointerMoveTolerance
+  }
+
+  interact.addDocument = function (doc: Document, options?: object) {
+    this.scope.addDocument(doc, options)
+  }
+
+  interact.removeDocument = function (doc: Document) {
+    this.scope.removeDocument(doc)
+  }
+
+  return interact
+}
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_core_Interactable.ts.html b/packages/interactjs/dist/api/packages_@interactjs_core_Interactable.ts.html new file mode 100644 index 000000000..a391f8335 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_core_Interactable.ts.html @@ -0,0 +1,540 @@ + + + + + + packages/@interactjs/core/Interactable.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/core/Interactable.ts

+ + + + + + + +
+
+
/* eslint-disable no-dupe-class-members */
+import type { Scope } from '@interactjs/core/scope'
+import type {
+  ActionMap,
+  ActionMethod,
+  ActionName,
+  Actions,
+  Context,
+  Element,
+  EventTypes,
+  Listeners,
+  ListenersArg,
+  OrBoolean,
+  Target,
+} from '@interactjs/core/types'
+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 extend from '@interactjs/utils/extend'
+import is from '@interactjs/utils/is'
+import isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'
+import normalizeListeners from '@interactjs/utils/normalizeListeners'
+import { getWindow } from '@interactjs/utils/window'
+
+import { Eventable } from './Eventable'
+import type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'
+
+type IgnoreValue = string | Element | boolean
+type DeltaSource = 'page' | 'client'
+
+const enum OnOffMethod {
+  On,
+  Off,
+}
+
+/** */
+export class Interactable implements Partial<Eventable> {
+  /** @internal */ get _defaults (): Defaults {
+    return {
+      base: {},
+      perAction: {},
+      actions: {} as ActionDefaults,
+    }
+  }
+
+  readonly options!: Required<Options>
+  readonly _actions: Actions
+  readonly target: Target
+  readonly events = new Eventable()
+  readonly _context: Context
+  readonly _win: Window
+  readonly _doc: Document
+  readonly _scopeEvents: Scope['events']
+
+  /** */
+  constructor (
+    target: Target,
+    options: any,
+    defaultContext: Document | Element,
+    scopeEvents: Scope['events'],
+  ) {
+    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._scopeEvents = scopeEvents
+
+    this.set(options)
+  }
+
+  setOnEvents (actionName: 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: ActionName, prev: Listeners | undefined, cur: Listeners | undefined) {
+    const actionFilter = (this._actions.map[actionName] as { filterEventType?: (type: string) => boolean })
+      ?.filterEventType
+    const filter = (type: string) =>
+      (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions)
+
+    if (is.array(prev) || is.object(prev)) {
+      this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter)
+    }
+
+    if (is.array(cur) || is.object(cur)) {
+      this._onOff(OnOffMethod.On, actionName, cur, undefined, filter)
+    }
+  }
+
+  setPerAction (actionName: ActionName, options: OrBoolean<Options>) {
+    const defaults = this._defaults
+
+    // for all the default per-action options
+    for (const optionName_ in options) {
+      const optionName = optionName_ as keyof 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 Listeners)
+      }
+
+      // if the option value is an array
+      if (is.array(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 {Rect} The object's bounding rectangle.
+   */
+  getRect (element: 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(): (element: Element) => any | null
+  rectChecker(checker: (element: Element) => any): this
+  rectChecker (checker?: (element: Element) => any) {
+    if (is.func(checker)) {
+      this.getRect = (element) => {
+        const rect = extend({}, checker.apply(this, element))
+
+        if (!(('width' in rect) as unknown)) {
+          rect.width = rect.right - rect.left
+          rect.height = rect.bottom - rect.top
+        }
+
+        return rect
+      }
+
+      return this
+    }
+
+    if (checker === null) {
+      delete (this as Partial<typeof this>).getRect
+
+      return this
+    }
+
+    return this.getRect
+  }
+
+  _backCompatOption (optionName: keyof 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 as keyof ActionMap] as any)[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: 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(): DeltaSource
+  deltaSource(newValue: DeltaSource): this
+  deltaSource (newValue?: DeltaSource) {
+    if (newValue === 'page' || newValue === 'client') {
+      this.options.deltaSource = newValue
+
+      return this
+    }
+
+    return this.options.deltaSource
+  }
+
+  /** @internal */
+  getAllElements (): Element[] {
+    const { target } = this
+
+    if (is.string(target)) {
+      return Array.from(this._context.querySelectorAll(target))
+    }
+
+    if (is.func(target) && (target as any).getAllElements) {
+      return (target as any).getAllElements()
+    }
+
+    return is.element(target) ? [target] : []
+  }
+
+  /**
+   * 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: Node,
+  ) {
+    return (
+      !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&
+      this.testAllow(options.allowFrom, targetNode, eventTarget)
+    )
+  }
+
+  testAllow (this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {
+    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 | undefined, targetNode: Node, element: Node) {
+    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<E extends { type: string }> (iEvent: E) {
+    this.events.fire(iEvent)
+
+    return this
+  }
+
+  _onOff (
+    method: OnOffMethod,
+    typeArg: EventTypes,
+    listenerArg?: ListenersArg | null,
+    options?: any,
+    filter?: (type: string) => boolean,
+  ) {
+    if (is.object(typeArg) && !is.array(typeArg)) {
+      options = listenerArg
+      listenerArg = null
+    }
+
+    const listeners = normalizeListeners(typeArg, listenerArg, filter)
+
+    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 === OnOffMethod.On ? 'on' : 'off'](type, listener)
+        }
+        // delegated event
+        else if (is.string(this.target)) {
+          this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](
+            this.target,
+            this._context,
+            type,
+            listener,
+            options,
+          )
+        }
+        // remove listener from this Interactable's element
+        else {
+          this._scopeEvents[method === OnOffMethod.On ? 'add' : '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: EventTypes, listener?: ListenersArg, options?: any) {
+    return this._onOff(OnOffMethod.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[] | EventTypes, listener?: ListenersArg, options?: any) {
+    return this._onOff(OnOffMethod.Off, types, listener, options)
+  }
+
+  /**
+   * Reset the options of this Interactable
+   *
+   * @param {object} options The new settings to apply
+   * @return {object} This Interactable
+   */
+  set (options: 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 ActionName
+      const methodName = this._actions.methodDict[actionName]
+
+      this.options[actionName] = {}
+      this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName]))
+      ;(this[methodName] as ActionMethod<unknown>)(options[actionName])
+    }
+
+    for (const setting in options) {
+      if (setting === 'getRect') {
+        this.rectChecker(options.getRect)
+        continue
+      }
+
+      if (is.func((this as any)[setting])) {
+        ;(this as any)[setting](options[setting as keyof typeof options])
+      }
+    }
+
+    return this
+  }
+
+  /**
+   * Remove this interactable from the list of interactables and remove it's
+   * action capabilities and event listeners
+   */
+  unset () {
+    if (is.string(this.target)) {
+      // remove delegated events
+      for (const type in this._scopeEvents.delegatedEvents) {
+        const delegated = this._scopeEvents.delegatedEvents[type]
+
+        for (let i = delegated.length - 1; i >= 0; i--) {
+          const { selector, context, listeners } = delegated[i]
+
+          if (selector === this.target && context === this._context) {
+            delegated.splice(i, 1)
+          }
+
+          for (let l = listeners.length - 1; l >= 0; l--) {
+            this._scopeEvents.removeDelegate(
+              this.target,
+              this._context,
+              type,
+              listeners[l][0],
+              listeners[l][1],
+            )
+          }
+        }
+      }
+    } else {
+      this._scopeEvents.remove(this.target, 'all')
+    }
+  }
+}
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_core_Interaction.ts.html b/packages/interactjs/dist/api/packages_@interactjs_core_Interaction.ts.html new file mode 100644 index 000000000..aef9a5461 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_core_Interaction.ts.html @@ -0,0 +1,688 @@ + + + + + + packages/@interactjs/core/Interaction.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/core/Interaction.ts

+ + + + + + + +
+
+
import type {
+  Element,
+  EdgeOptions,
+  PointerEventType,
+  PointerType,
+  FullRect,
+  CoordsSet,
+} from '@interactjs/core/types'
+import * as arr from '@interactjs/utils/arr'
+import extend from '@interactjs/utils/extend'
+import hypot from '@interactjs/utils/hypot'
+import { warnOnce, copyAction } from '@interactjs/utils/misc'
+import * as pointerUtils from '@interactjs/utils/pointerUtils'
+import * as rectUtils from '@interactjs/utils/rect'
+
+import type { EventPhase } from './InteractEvent'
+import { InteractEvent } from './InteractEvent'
+import type { Interactable } from './Interactable'
+import { PointerInfo } from './PointerInfo'
+import type { ActionDefaults } from './options'
+import type { Scope } from './scope'
+import type { ActionName, ActionProps } from './types'
+
+export enum _ProxyValues {
+  interactable = '',
+  element = '',
+  prepared = '',
+  pointerIsDown = '',
+  pointerWasMoved = '',
+  _proxy = '',
+}
+
+export enum _ProxyMethods {
+  start = '',
+  move = '',
+  end = '',
+  stop = '',
+  interacting = '',
+}
+
+export type PointerArgProps<T extends {} = {}> = {
+  pointer: PointerType
+  event: PointerEventType
+  eventTarget: Node
+  pointerIndex: number
+  pointerInfo: PointerInfo
+  interaction: Interaction<never>
+} & T
+
+export interface DoPhaseArg<T extends ActionName, P extends EventPhase> {
+  event: 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<ActionName> }
+    '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': { interaction: Interaction<never>, event: Event, type: '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<T extends ActionName | null = never> = Pick<
+Interaction<T>,
+keyof typeof _ProxyValues | keyof typeof _ProxyMethods
+>
+
+let idCounter = 0
+
+export class Interaction<T extends ActionName | null = ActionName> {
+  // current interactable being interacted with
+  interactable: Interactable | null = null
+
+  // the target element of the interactable
+  element: Element | null = null
+  rect: FullRect | null = null
+  _rects?: {
+    start: FullRect
+    corrected: FullRect
+    previous: FullRect
+    delta: FullRect
+  }
+  edges: EdgeOptions | null = null
+
+  _scopeFire: 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: PointerEventType | null = null
+
+  downPointer: PointerType = {} as PointerType
+
+  _latestPointer: {
+    pointer: PointerType
+    event: 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<T>
+
+  simulation = null
+
+  /** @internal */ get pointerMoveTolerance () {
+    return 1
+  }
+
+  /**
+   * @alias Interaction.prototype.move
+   */
+  doMove = warnOnce(function (this: Interaction, signalArg: any) {
+    this.move(signalArg)
+  }, 'The interaction.doMove() method has been renamed to interaction.move()')
+
+  coords: CoordsSet = {
+    // Starting InteractEvent pointer coordinates
+    start: pointerUtils.newCoords(),
+    // Previous native pointer move event coordinates
+    prev: pointerUtils.newCoords(),
+    // current native pointer move event coordinates
+    cur: pointerUtils.newCoords(),
+    // Change in coordinates and time of the pointer
+    delta: pointerUtils.newCoords(),
+    // pointer velocity
+    velocity: pointerUtils.newCoords(),
+  }
+
+  readonly _id: number = idCounter++
+
+  /** */
+  constructor ({ pointerType, scopeFire }: { pointerType?: string, scopeFire: Scope['fire'] }) {
+    this._scopeFire = scopeFire
+    this.pointerType = pointerType
+
+    const that = this
+
+    this._proxy = {} as InteractionProxy<T>
+
+    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: any[]) => that[key](...args),
+      })
+    }
+
+    this._scopeFire('interactions:new', { interaction: this })
+  }
+
+  pointerDown (pointer: PointerType, event: PointerEventType, eventTarget: Node) {
+    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 as unknown as Interaction<never>,
+    })
+  }
+
+  /**
+   * ```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 {Boolean} Whether the interaction was successfully started
+   */
+  start<A extends ActionName> (action: ActionProps<A>, interactable: Interactable, element: Element): boolean {
+    if (
+      this.interacting() ||
+      !this.pointerIsDown ||
+      this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||
+      !interactable.options[action.name as keyof ActionDefaults].enabled
+    ) {
+      return false
+    }
+
+    copyAction(this.prepared, action)
+
+    this.interactable = interactable
+    this.element = element
+    this.rect = interactable.getRect(element)
+    this.edges = this.prepared.edges
+      ? 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: PointerType, event: PointerEventType, eventTarget: Node) {
+    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: number
+    let dy: number
+
+    // 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 = 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 as unknown as Interaction<never>,
+    }
+
+    if (!duplicateMove) {
+      // set pointer coordinate, time changes and velocity
+      pointerUtils.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) {
+        pointerUtils.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?: any) {
+    if (!signalArg || !signalArg.event) {
+      pointerUtils.setZeroCoords(this.coords.delta)
+    }
+
+    signalArg = 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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: 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 as unknown as Interaction<never>,
+    })
+
+    if (!this.simulation) {
+      this.end(event)
+    }
+
+    this.removePointer(pointer, event)
+  }
+
+  documentBlur (event: Event) {
+    this.end(event as any)
+    this._scopeFire('interactions:blur', {
+      event,
+      type: 'blur',
+      interaction: this as unknown as Interaction<never>,
+    })
+  }
+
+  /**
+   * ```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?: PointerEventType) {
+    this._ending = true
+    event = event || this._latestPointer.event
+    let endPhaseResult: boolean
+
+    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: any) {
+    const pointerId = pointerUtils.getPointerId(pointer)
+
+    // mouse and pen interactions may have only one pointer
+    return this.pointerType === 'mouse' || this.pointerType === 'pen'
+      ? this.pointers.length - 1
+      : arr.findIndex(this.pointers, (curPointer) => curPointer.id === pointerId)
+  }
+
+  getPointerInfo (pointer: any) {
+    return this.pointers[this.getPointerIndex(pointer)]
+  }
+
+  updatePointer (pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {
+    const id = pointerUtils.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
+    }
+
+    pointerUtils.setCoords(
+      this.coords.cur,
+      this.pointers.map((p) => p.pointer),
+      this._now(),
+    )
+    pointerUtils.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur)
+
+    if (down) {
+      this.pointerIsDown = true
+
+      pointerInfo.downTime = this.coords.cur.timeStamp
+      pointerInfo.downTarget = eventTarget
+      pointerUtils.pointerExtend(this.downPointer, pointer)
+
+      if (!this.interacting()) {
+        pointerUtils.copyCoords(this.coords.start, this.coords.cur)
+        pointerUtils.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 as unknown as Interaction<never>,
+    })
+
+    return pointerIndex
+  }
+
+  removePointer (pointer: PointerType, event: 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 as unknown as Interaction<never>,
+    })
+
+    this.pointers.splice(pointerIndex, 1)
+    this.pointerIsDown = false
+  }
+
+  _updateLatestPointer (pointer: PointerType, event: PointerEventType, eventTarget: Node) {
+    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: 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
+      rectUtils.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/packages/interactjs/dist/api/packages_@interactjs_core_interactablePreventDefault.ts.html b/packages/interactjs/dist/api/packages_@interactjs_core_interactablePreventDefault.ts.html new file mode 100644 index 000000000..a3e8ee96b --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_core_interactablePreventDefault.ts.html @@ -0,0 +1,179 @@ + + + + + + packages/@interactjs/core/interactablePreventDefault.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/core/interactablePreventDefault.ts

+ + + + + + + +
+
+
import type { Interactable } from '@interactjs/core/Interactable'
+import type Interaction from '@interactjs/core/Interaction'
+import type { Scope } from '@interactjs/core/scope'
+import type { PointerEventType } from '@interactjs/core/types'
+import { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'
+import 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
+  }
+}
+
+type PreventDefaultValue = 'always' | 'never' | 'auto'
+function preventDefault(this: Interactable): PreventDefaultValue
+function preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this
+function preventDefault (this: Interactable, newValue?: PreventDefaultValue) {
+  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: Interactable, scope: 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 (scope.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: Interaction, event: PointerEventType }) {
+  if (interaction.interactable) {
+    interaction.interactable.checkAndPreventDefault(event as Event)
+  }
+}
+
+export function install (scope: 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/packages/interactjs/dist/api/packages_@interactjs_modifiers_aspectRatio.ts.html b/packages/interactjs/dist/api/packages_@interactjs_modifiers_aspectRatio.ts.html new file mode 100644 index 000000000..50563fbd2 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_modifiers_aspectRatio.ts.html @@ -0,0 +1,235 @@ + + + + + + packages/@interactjs/modifiers/aspectRatio.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/modifiers/aspectRatio.ts

+ + + + + + + +
+
+
/**
+ * @module modifiers/aspectRatio
+ *
+ * @description
+ * This module forces elements to be resized with a specified dx/dy ratio.
+ *
+ * ```js
+ * interact(target).resizable({
+ *   modifiers: [
+ *     interact.modifiers.snapSize({
+ *       targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],
+ *     }),
+ *     interact.aspectRatio({ ratio: 'preserve' }),
+ *   ],
+ * });
+ * ```
+ */
+
+import type { Point, Rect, EdgeOptions } from '@interactjs/core/types'
+import extend from '@interactjs/utils/extend'
+import { addEdges } from '@interactjs/utils/rect'
+
+import Modification from './Modification'
+import { makeModifier } from './base'
+import type { Modifier, ModifierModule, ModifierState } from './types'
+
+export interface AspectRatioOptions {
+  ratio?: number | 'preserve'
+  equalDelta?: boolean
+  modifiers?: Modifier[]
+  enabled?: boolean
+}
+
+export type AspectRatioState = ModifierState<
+AspectRatioOptions,
+{
+  startCoords: Point
+  startRect: Rect
+  linkedEdges: EdgeOptions
+  ratio: number
+  equalDelta: boolean
+  xIsPrimaryAxis: boolean
+  edgeSign: {
+    x: number
+    y: number
+  }
+  subModification: Modification
+}
+>
+
+const aspectRatio: ModifierModule<AspectRatioOptions, AspectRatioState> = {
+  start (arg) {
+    const { state, rect, edges, pageCoords: coords } = arg
+    let { ratio, enabled } = 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: edges.top || (edges.left && !edges.bottom),
+      left: edges.left || (edges.top && !edges.right),
+      bottom: edges.bottom || (edges.right && !edges.top),
+      right: edges.right || (edges.bottom && !edges.left),
+    })
+
+    state.xIsPrimaryAxis = !!(edges.left || edges.right)
+
+    if (state.equalDelta) {
+      const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)
+      state.edgeSign = {
+        x: sign,
+        y: sign,
+      }
+    } else {
+      state.edgeSign = {
+        x: linkedEdges.left ? -1 : 1,
+        y: linkedEdges.top ? -1 : 1,
+      }
+    }
+
+    if (enabled !== false) {
+      extend(edges, linkedEdges)
+    }
+
+    if (!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 { linkedEdges } = state
+    const initialCoords = extend({}, coords)
+    const aspectMethod = state.equalDelta ? setEqualDelta : setRatio
+
+    extend(arg.edges, linkedEdges)
+    aspectMethod(state, state.xIsPrimaryAxis, coords, rect)
+
+    if (!state.subModification) {
+      return null
+    }
+
+    const correctedRect = extend({}, rect)
+
+    addEdges(linkedEdges, correctedRect, {
+      x: coords.x - initialCoords.x,
+      y: coords.y - initialCoords.y,
+    })
+
+    const result = state.subModification.setAll({
+      ...arg,
+      rect: correctedRect,
+      edges: 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: Point) {
+  if (xIsPrimaryAxis) {
+    coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y
+  } else {
+    coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x
+  }
+}
+
+function setRatio (
+  { startRect, startCoords, ratio, edgeSign }: AspectRatioState,
+  xIsPrimaryAxis: boolean,
+  coords: Point,
+  rect: Rect,
+) {
+  if (xIsPrimaryAxis) {
+    const newHeight = rect.width / ratio
+
+    coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y
+  } else {
+    const newWidth = rect.height * ratio
+
+    coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x
+  }
+}
+
+export default makeModifier(aspectRatio, 'aspectRatio')
+export { aspectRatio }
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_modifiers_snap_edges.ts.html b/packages/interactjs/dist/api/packages_@interactjs_modifiers_snap_edges.ts.html new file mode 100644 index 000000000..3b7793c5e --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_modifiers_snap_edges.ts.html @@ -0,0 +1,122 @@ + + + + + + packages/@interactjs/modifiers/snap/edges.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/modifiers/snap/edges.ts

+ + + + + + + +
+
+
/**
+ * @module modifiers/snapEdges
+ *
+ * @description
+ * WOW> This module allows snapping of the edges of targets during resize
+ * interactions.
+ *
+ * ```js
+ * 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 { makeModifier } from '../base'
+import type { ModifierArg, ModifierModule } from '../types'
+
+import type { 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, ReturnType<typeof snapSize.set>> = {
+  start,
+  set: snapSize.set,
+  defaults: extend(clone(snapSize.defaults), {
+    targets: undefined,
+    range: undefined,
+    offset: { x: 0, y: 0 },
+  } as const),
+}
+
+export default makeModifier(snapEdges, 'snapEdges')
+export { snapEdges }
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/packages_@interactjs_pointer-events_PointerEvent.ts.html b/packages/interactjs/dist/api/packages_@interactjs_pointer-events_PointerEvent.ts.html new file mode 100644 index 000000000..045d9226d --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_pointer-events_PointerEvent.ts.html @@ -0,0 +1,143 @@ + + + + + + packages/@interactjs/pointer-events/PointerEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/pointer-events/PointerEvent.ts

+ + + + + + + +
+
+
import { BaseEvent } from '@interactjs/core/BaseEvent'
+import type Interaction from '@interactjs/core/Interaction'
+import type { PointerEventType, PointerType, Point } from '@interactjs/core/types'
+import * as pointerUtils from '@interactjs/utils/pointerUtils'
+
+export default class PointerEvent<T extends string = any> extends BaseEvent<never> {
+  declare type: T
+  declare originalEvent: PointerEventType
+  declare pointerId: number
+  declare pointerType: string
+  declare double: boolean
+  declare pageX: number
+  declare pageY: number
+  declare clientX: number
+  declare clientY: number
+  declare dt: number
+  declare eventable: any;
+  [key: string]: any
+
+  /** */
+  constructor (
+    type: T,
+    pointer: PointerType | PointerEvent<any>,
+    event: PointerEventType,
+    eventTarget: Node,
+    interaction: Interaction<never>,
+    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
+      this.double = true
+    }
+  }
+
+  _subtractOrigin ({ x: originX, y: originY }: Point) {
+    this.pageX -= originX
+    this.pageY -= originY
+    this.clientX -= originX
+    this.clientY -= originY
+
+    return this
+  }
+
+  _addOrigin ({ x: originX, y: originY }: 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/packages/interactjs/dist/api/packages_@interactjs_reflow_plugin.ts.html b/packages/interactjs/dist/api/packages_@interactjs_reflow_plugin.ts.html new file mode 100644 index 000000000..d146a5ca3 --- /dev/null +++ b/packages/interactjs/dist/api/packages_@interactjs_reflow_plugin.ts.html @@ -0,0 +1,245 @@ + + + + + + packages/@interactjs/reflow/plugin.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

packages/@interactjs/reflow/plugin.ts

+ + + + + + + +
+
+
import type { Interactable } from '@interactjs/core/Interactable'
+import type { DoAnyPhaseArg, Interaction } from '@interactjs/core/Interaction'
+import type { Scope, Plugin } from '@interactjs/core/scope'
+import type { ActionName, ActionProps, Element } from '@interactjs/core/types'
+import * as arr from '@interactjs/utils/arr'
+import { copyAction } from '@interactjs/utils/misc'
+import * as pointerUtils from '@interactjs/utils/pointerUtils'
+import { tlbrToXywh } from '@interactjs/utils/rect'
+
+declare module '@interactjs/core/scope' {
+  interface SignalArgs {
+    'interactions:before-action-reflow': Omit<DoAnyPhaseArg, 'iEvent'>
+    'interactions:action-reflow': DoAnyPhaseArg
+    'interactions:after-action-reflow': DoAnyPhaseArg
+  }
+}
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    reflow: <T extends ActionName>(action: ActionProps<T>) => ReturnType<typeof doReflow>
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    _reflowPromise: Promise<void>
+    _reflowResolve: (...args: unknown[]) => void
+  }
+}
+
+declare module '@interactjs/core/InteractEvent' {
+  interface PhaseMap {
+    reflow?: true
+  }
+}
+
+export function install (scope: Scope) {
+  const {
+    /** @lends Interactable */
+    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: ActionProps) {
+    return doReflow(this, action, scope)
+  }
+}
+
+function doReflow<T extends ActionName> (
+  interactable: Interactable,
+  action: ActionProps<T>,
+  scope: Scope,
+): Promise<Interactable> {
+  const elements = interactable.getAllElements()
+
+  // tslint:disable-next-line variable-name
+  const Promise = (scope.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 = 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 ActionName> (
+  scope: Scope,
+  interactable: Interactable,
+  element: 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.prevEvent = event
+  interaction.updatePointer(event, event, element, true)
+  pointerUtils.setZeroCoords(interaction.coords.delta)
+
+  copyAction(interaction.prepared, action)
+  interaction._doPhase(signalArg)
+
+  const { Promise } = scope.window as unknown as { Promise: PromiseConstructor }
+  const reflowPromise = Promise
+    ? new Promise<undefined>((resolve) => {
+      interaction._reflowResolve = resolve
+    })
+    : undefined
+
+  interaction._reflowPromise = reflowPromise
+  interaction.start(action, interactable, element)
+
+  if (interaction._interacting) {
+    interaction.move(signalArg)
+    interaction.end(event)
+  } else {
+    interaction.stop()
+    interaction._reflowResolve()
+  }
+
+  interaction.removePointer(event, event)
+
+  return reflowPromise
+}
+
+const reflow: Plugin = {
+  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)
+      }
+    },
+  },
+}
+
+export default reflow
+
+
+
+ + + + +
+ + + + + diff --git a/packages/interactjs/dist/api/scripts/linenumber.js b/packages/interactjs/dist/api/scripts/linenumber.js new file mode 100644 index 000000000..8d52f7eaf --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/scripts/prettify/Apache-License-2.0.txt b/packages/interactjs/dist/api/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/scripts/prettify/lang-css.js b/packages/interactjs/dist/api/scripts/prettify/lang-css.js new file mode 100644 index 000000000..041e1f590 --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/scripts/prettify/prettify.js b/packages/interactjs/dist/api/scripts/prettify/prettify.js new file mode 100644 index 000000000..eef5ad7e6 --- /dev/null +++ b/packages/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 *:not(section, ol, ul), #main .article > *:not(section, ol, ul) { + 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: hsl(0deg, 0%, 28%); + 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 hsla(0deg, 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: 0.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: 0.825rem; +} +.navicon-button:hover .navicon:after { + top: -0.825rem; +} + +/* navicon */ +.navicon { + position: relative; + width: 2.5em; + height: 0.3125rem; + background: #000; + transition: 0.3s; + border-radius: 2.5rem; +} +.navicon:before, .navicon:after { + display: block; + content: ""; + height: 0.3125rem; + width: 2.5rem; + background: #000; + position: absolute; + z-index: -1; + transition: 0.3s 0.25s; + border-radius: 1rem; +} +.navicon:before { + top: 0.625rem; +} +.navicon:after { + top: -0.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: hsla(0deg, 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, .description, .prettyprint, ol, ul), +.description > *:not(.prettyprint, ol, 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) { + .subsection-title, +.section-examples, +.section-method > *:not(.params):not(.description), +.description > *, +.article > *, +footer, #main .prettyprint:not(.source), #main > *:not(section) { + 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; +} + +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../sass/bulma/elements/box.sass%22,%22../../sass/bulma/utilities/variables.sass%22,%22../../sass/_config.sass%22,%22../../sass/bulma/utilities/mixins.sass%22,%22../../sass/bulma/elements/title.sass%22,%22../../sass/jsdoc-default.sass%22%5D,%22names%22:%5B%5D,%22mappings%22:%22;AASA;EAEE,kBCMa;EDLb,eERa;EFSb,YAVW;EAWX,OCJa;EDKb;EACA,SETY;;ACMZ;EACE;;;AHKF;EAEE,YAfoB;;AAgBtB;EACE,YAhBqB;;;AIKzB;AAAA;EAGE;;ADFA;AAAA;EACE;;ACEF;AAAA;AAAA;AAAA;EAEE;;AACF;AAAA;EACE;;;AAEJ;EACE,OHda;EGeb,WHUO;EGTP,aHiBgB;EGhBhB;;AACA;EACE,OAzBiB;EA0BjB,aAzBkB;;AA0BpB;EACE;;AACF;EACE;;AAIA;EACE,WH+GE;;AGhHJ;EACE,WH+GE;;AGhHJ;EACE,WH+GE;;AGhHJ;EACE,WH+GE;;AGhHJ;EACE,WH+GE;;AGhHJ;EACE,WH+GE;;AGhHJ;EACE,WH+GE;;;AG7GR;EACE,OH/Ba;EGgCb,WHNO;EGOP,aHFc;EGGd;;AACA;EACE,OHrCW;EGsCX,aHLc;;AGMhB;EACE;;AAIA;EACE,WH+FE;;AGhGJ;EACE,WH+FE;;AGhGJ;EACE,WH+FE;;AGhGJ;EACE,WH+FE;;AGhGJ;EACE,WH+FE;;AGhGJ;EACE,WH+FE;;AGhGJ;EACE,WH+FE;;;AIhJR;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;;AAEA;EACE;EACA;;AAEF;EACE;;;AAEJ;EACE;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEJ;EACE;EACA;EACA;;;AAEF;AACE;AACA;AACA;EACA;EACA;EACA;AAEA;AACA;;;AAEF;EACE;EACA;EACA;AAEA;EACA;;;AAEF;EACE;AAEA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAEJ;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE,cHvHS;EGwHT,eHxHS;;;AG0Hf;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;AAEA;EACE;;AAEA;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;;AAEN;AAEA;EACE;EACA;EACA,OH9MU;EG+MV;EACA;EACA;EACA;EACA;EACA;AAEA;;AAEA;EACE;EACA;EACA;;;AAEJ;EACE;EACA;;AAEA;EACE;EACA;EACA;;;AAEJ;AACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAEJ;EACE;;;AAGA;EACE;;;AAEJ;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;AAEA;EACE;EACA,aHhRU;EGiRV;EACA;EACA;EACA;EACA;;;AAEF;EACE;;AAEA;EACE;EACA;;;AAEJ;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;;AAEJ;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEJ;EACE;;AAGA;EACE;;AAEF;EACE;;AAEJ;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;;;AAER;EACE;EACA;EACA;EACA;EACA;EACA;EACA;AAEA;;;AAEF;EACE;EACA;EACA;;;AAGA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;;AAEF;EACE;EACA;;;AAEJ;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;AACE;EACA;EACA;EACA;;;AAGA;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEJ;EACE;;;AAEF;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAGE;EACE;;AAEJ;EACE;EACA;;AAGE;EACE;;AAEF;EACE;;AAEF;EACE;;;AAER;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;;AAEJ;AAEA;EAkCE;EACA;EACA;;AAlCE;EASE;;AAPE;EACE;;AAGF;EACE;;AAIJ;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAGF;EACE;;AAEF;EACE;;;AAMR;AAEA;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;IACE;;EAEF;IACE,OHzkBQ;IG0kBR;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEA;IACE;;EAEF;IACE;;EAEJ;IACE;;;AAEJ;EACE;IACE;;EAEF;IACE;IACA;;;AAEJ;AAAA;AAAA;AAAA;AAAA;EAKE,cHzmBa;EG0mBb,eH1mBa;EG2mBb;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;AAAA;AAAA;AAAA;AAAA;AAAA;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;;EAIE;IACE;;EAgBN;IACE;IACA;;EAGA;IACE;;EAOJ;IACE;;EAEF;IACE;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA,aH7sBQ;IG8sBR;IACA;IACA;;;AAEJ;AACA;EACE%22,%22file%22:%22jsdoc-default.css%22,%22sourcesContent%22:%5B%22$box-color:%20$text%20!default%5Cn$box-background-color:%20$white%20!default%5Cn$box-radius:%20$radius-large%20!default%5Cn$box-shadow:%200%202px%203px%20rgba($black,%200.1),%200%200%200%201px%20rgba($black,%200.1)%20!default%5Cn$box-padding:%201.25rem%20!default%5Cn%5Cn$box-link-hover-shadow:%200%202px%203px%20rgba($black,%200.1),%200%200%200%201px%20$link%20!default%5Cn$box-link-active-shadow:%20inset%200%201px%202px%20rgba($black,%200.2),%200%200%200%201px%20$link%20!default%5Cn%5Cn.box%5Cn%20%20+block%5Cn%20%20background-color:%20$box-background-color%5Cn%20%20border-radius:%20$box-radius%5Cn%20%20box-shadow:%20$box-shadow%5Cn%20%20color:%20$box-color%5Cn%20%20display:%20block%5Cn%20%20padding:%20$box-padding%5Cn%5Cna.box%5Cn%20%20&:hover,%5Cn%20%20&:focus%5Cn%20%20%20%20box-shadow:%20$box-link-hover-shadow%5Cn%20%20&:active%5Cn%20%20%20%20box-shadow:%20$box-link-active-shadow%5Cn%22,%22////////////////////////////////////////////////%5Cn////////////////////////////////////////////////%5Cn//%201.%20Initial%20variables%5Cn%5Cn//%20Colors%5Cn$black:%20%20%20%20%20%20%20%20hsl(0,%200%25,%204%25)%20!default%5Cn$black-bis:%20%20%20%20hsl(0,%200%25,%207%25)%20!default%5Cn$black-ter:%20%20%20%20hsl(0,%200%25,%2014%25)%20!default%5Cn%5Cn$grey-darker:%20%20hsl(0,%200%25,%2021%25)%20!default%5Cn$grey-dark:%20%20%20%20hsl(0,%200%25,%2029%25)%20!default%5Cn$grey:%20%20%20%20%20%20%20%20%20hsl(0,%200%25,%2048%25)%20!default%5Cn$grey-light:%20%20%20hsl(0,%200%25,%2071%25)%20!default%5Cn$grey-lighter:%20hsl(0,%200%25,%2086%25)%20!default%5Cn%5Cn$white-ter:%20%20%20%20hsl(0,%200%25,%2096%25)%20!default%5Cn$white-bis:%20%20%20%20hsl(0,%200%25,%2098%25)%20!default%5Cn$white:%20%20%20%20%20%20%20%20hsl(0,%200%25,%20100%25)%20!default%5Cn%5Cn$orange:%20%20%20%20%20%20%20hsl(14,%20%20100%25,%2053%25)%20!default%5Cn$yellow:%20%20%20%20%20%20%20hsl(48,%20%20100%25,%2067%25)%20!default%5Cn$green:%20%20%20%20%20%20%20%20hsl(141,%2071%25,%20%2048%25)%20!default%5Cn$turquoise:%20%20%20%20hsl(171,%20100%25,%2041%25)%20!default%5Cn$blue:%20%20%20%20%20%20%20%20%20hsl(217,%2071%25,%20%2053%25)%20!default%5Cn$purple:%20%20%20%20%20%20%20hsl(271,%20100%25,%2071%25)%20!default%5Cn$red:%20%20%20%20%20%20%20%20%20%20hsl(348,%20100%25,%2061%25)%20!default%5Cn%5Cn//%20Typography%5Cn$family-sans-serif:%20BlinkMacSystemFont,%20-apple-system,%20%5C%22Segoe%20UI%5C%22,%20%5C%22Roboto%5C%22,%20%5C%22Oxygen%5C%22,%20%5C%22Ubuntu%5C%22,%20%5C%22Cantarell%5C%22,%20%5C%22Fira%20Sans%5C%22,%20%5C%22Droid%20Sans%5C%22,%20%5C%22Helvetica%20Neue%5C%22,%20%5C%22Helvetica%5C%22,%20%5C%22Arial%5C%22,%20sans-serif%20!default%5Cn$family-monospace:%20monospace%20!default%5Cn$render-mode:%20optimizeLegibility%20!default%5Cn%5Cn$size-1:%203rem%20!default%5Cn$size-2:%202.5rem%20!default%5Cn$size-3:%202rem%20!default%5Cn$size-4:%201.5rem%20!default%5Cn$size-5:%201.25rem%20!default%5Cn$size-6:%201rem%20!default%5Cn$size-7:%200.75rem%20!default%5Cn%5Cn$weight-light:%20300%20!default%5Cn$weight-normal:%20400%20!default%5Cn$weight-semibold:%20500%20!default%5Cn$weight-bold:%20700%20!default%5Cn%5Cn//%20Body%5Cn$body-background:%20%23fff%20!default%5Cn$body-size:%2016px%20!default%5Cn%5Cn//%20Responsiveness%5Cn//%20960,%201152,%20and%201344%20have%20been%20chosen%20because%20they%20are%20divisible%20by%20both%2012%20and%2016%5Cn$tablet:%20769px%20!default%5Cn//%20960px%20container%20+%2040px%5Cn$desktop:%201000px%20!default%5Cn//%201152px%20container%20+%2040%5Cn$widescreen:%201192px%20!default%5Cn//%201344px%20container%20+%2040%5Cn$fullhd:%201384px%20!default%5Cn%5Cn//%20Miscellaneous%5Cn$easing:%20ease-out%20!default%5Cn$radius-small:%202px%20!default%5Cn$radius:%203px%20!default%5Cn$radius-large:%205px%20!default%5Cn$speed:%2086ms%20!default%5Cn%5Cn////////////////////////////////////////////////%5Cn////////////////////////////////////////////////%5Cn//%202.%20Primary%20colors%5Cn%5Cn$primary:%20$turquoise%20!default%5Cn%5Cn$info:%20$blue%20!default%5Cn$success:%20$green%20!default%5Cn$warning:%20$yellow%20!default%5Cn$danger:%20$red%20!default%5Cn%5Cn$light:%20$white-ter%20!default%5Cn$dark:%20$grey-darker%20!default%5Cn%5Cn////////////////////////////////////////////////%5Cn////////////////////////////////////////////////%5Cn//%203.%20Applied%20variables%5Cn%5Cn//%20Invert%20colors%5Cn$orange-invert:%20findColorInvert($orange)%20!default%5Cn$yellow-invert:%20findColorInvert($yellow)%20!default%5Cn$green-invert:%20findColorInvert($green)%20!default%5Cn$turquoise-invert:%20findColorInvert($turquoise)%20!default%5Cn$blue-invert:%20findColorInvert($blue)%20!default%5Cn$purple-invert:%20findColorInvert($purple)%20!default%5Cn$red-invert:%20findColorInvert($red)%20!default%5Cn%5Cn$primary-invert:%20$turquoise-invert%20!default%5Cn$info-invert:%20$blue-invert%20!default%5Cn$success-invert:%20$green-invert%20!default%5Cn$warning-invert:%20$yellow-invert%20!default%5Cn$danger-invert:%20$red-invert%20!default%5Cn$light-invert:%20$dark%20!default%5Cn$dark-invert:%20$light%20!default%5Cn%5Cn//%20General%20colors%5Cn$background:%20$white-ter%20!default%5Cn%5Cn$border:%20$grey-lighter%20!default%5Cn$border-hover:%20$grey-light%20!default%5Cn%5Cn//%20Text%20colors%5Cn$text:%20$grey-dark%20!default%5Cn$text-invert:%20findColorInvert($text)%20!default%5Cn$text-light:%20$grey%20!default%5Cn$text-strong:%20$grey-darker%20!default%5Cn%5Cn//%20Code%20colors%5Cn$code:%20$red%20!default%5Cn$code-background:%20$background%20!default%5Cn%5Cn$pre:%20$text%20!default%5Cn$pre-background:%20$background%20!default%5Cn%5Cn//%20Link%20colors%5Cn$link:%20$primary%20!default%5Cn$link-invert:%20$primary-invert%20!default%5Cn$link-visited:%20$purple%20!default%5Cn%5Cn$link-hover:%20$grey-darker%20!default%5Cn$link-hover-border:%20$grey-light%20!default%5Cn%5Cn$link-focus:%20$grey-darker%20!default%5Cn$link-focus-border:%20$primary%20!default%5Cn%5Cn$link-active:%20$grey-darker%20!default%5Cn$link-active-border:%20$grey-dark%20!default%5Cn%5Cn//%20Typography%5Cn$family-primary:%20$family-sans-serif%20!default%5Cn$family-code:%20$family-monospace%20!default%5Cn%5Cn$size-small:%20$size-7%20!default%5Cn$size-normal:%20$size-6%20!default%5Cn$size-medium:%20$size-5%20!default%5Cn$size-large:%20$size-4%20!default%5Cn%5Cn////////////////////////////////////////////////%5Cn////////////////////////////////////////////////%5Cn//%204.%20Lists%20and%20maps%5Cn%5Cn$colors:%20(%5C%22white%5C%22:%20($white,%20$black),%20%5C%22black%5C%22:%20($black,%20$white),%20%5C%22light%5C%22:%20($light,%20$light-invert),%20%5C%22dark%5C%22:%20($dark,%20$dark-invert),%20%5C%22primary%5C%22:%20($primary,%20$primary-invert),%20%5C%22info%5C%22:%20($info,%20$info-invert),%20%5C%22success%5C%22:%20($success,%20$success-invert),%20%5C%22warning%5C%22:%20($warning,%20$warning-invert),%20%5C%22danger%5C%22:%20($danger,%20$danger-invert))%20!default%5Cn%5Cn$sizes:%20$size-1%20$size-2%20$size-3%20$size-4%20$size-5%20$size-6%20$size-7%20!default%5Cn%22,%22$grid:%204px%5Cn$body-size:%204%20*%20$grid%5Cn$nav-width:%2060%20*%20$grid%5Cn%5Cn$radius-small:%200.5%20*%20$grid%5Cn$radius-large:%201%20*%20$grid%5Cn%5Cn$box-padding:%202%20*%20$grid%5Cn$box-radius:%20$radius-small%5Cn%5Cn$main-padding:%202%20*%20$grid%5Cn%5Cn@import%20bulma/utilities/variables%5Cn@import%20bulma/utilities/mixins%5Cn@import%20bulma/elements/box%5Cn@import%20bulma/elements/title%5Cn%22,%22=arrow($color)%5Cn%20%20border:%201px%20solid%20$color%5Cn%20%20border-right:%200%5Cn%20%20border-top:%200%5Cn%20%20content:%20%5C%22%20%5C%22%5Cn%20%20display:%20block%5Cn%20%20height:%200.5em%5Cn%20%20pointer-events:%20none%5Cn%20%20position:%20absolute%5Cn%20%20transform:%20rotate(-45deg)%5Cn%20%20width:%200.5em%5Cn%5Cn=block%5Cn%20%20&:not(:last-child)%5Cn%20%20%20%20margin-bottom:%201.5rem%5Cn%5Cn=clearfix%5Cn%20%20&:after%5Cn%20%20%20%20clear:%20both%5Cn%20%20%20%20content:%20%5C%22%20%5C%22%5Cn%20%20%20%20display:%20table%5Cn%5Cn=center($width,%20$height:%200)%5Cn%20%20position:%20absolute%5Cn%20%20@if%20$height%20!=%200%5Cn%20%20%20%20left:%20calc(50%25%20-%20(%23%7B$width%7D%20/%202))%5Cn%20%20%20%20top:%20calc(50%25%20-%20(%23%7B$height%7D%20/%202))%5Cn%20%20@else%5Cn%20%20%20%20left:%20calc(50%25%20-%20(%23%7B$width%7D%20/%202))%5Cn%20%20%20%20top:%20calc(50%25%20-%20(%23%7B$width%7D%20/%202))%5Cn%5Cn=delete%5Cn%20%20+unselectable%5Cn%20%20-moz-appearance:%20none%5Cn%20%20-webkit-appearance:%20none%5Cn%20%20background-color:%20rgba($black,%200.2)%5Cn%20%20border:%20none%5Cn%20%20border-radius:%20290486px%5Cn%20%20cursor:%20pointer%5Cn%20%20display:%20inline-block%5Cn%20%20flex-grow:%200%5Cn%20%20flex-shrink:%200%5Cn%20%20font-size:%20$size-normal%5Cn%20%20height:%2020px%5Cn%20%20max-height:%2020px%5Cn%20%20max-width:%2020px%5Cn%20%20min-height:%2020px%5Cn%20%20min-width:%2020px%5Cn%20%20outline:%20none%5Cn%20%20position:%20relative%5Cn%20%20vertical-align:%20top%5Cn%20%20width:%2020px%5Cn%20%20&:before,%5Cn%20%20&:after%5Cn%20%20%20%20background-color:%20$white%5Cn%20%20%20%20content:%20%5C%22%5C%22%5Cn%20%20%20%20display:%20block%5Cn%20%20%20%20left:%2050%25%5Cn%20%20%20%20position:%20absolute%5Cn%20%20%20%20top:%2050%25%5Cn%20%20%20%20transform:%20translateX(-50%25)%20translateY(-50%25)%20rotate(45deg)%5Cn%20%20%20%20transform-origin:%20center%20center%5Cn%20%20&:before%5Cn%20%20%20%20height:%202px%5Cn%20%20%20%20width:%2050%25%5Cn%20%20&:after%5Cn%20%20%20%20height:%2050%25%5Cn%20%20%20%20width:%202px%5Cn%20%20&:hover,%5Cn%20%20&:focus%5Cn%20%20%20%20background-color:%20rgba($black,%200.3)%5Cn%20%20&:active%5Cn%20%20%20%20background-color:%20rgba($black,%200.4)%5Cn%20%20//%20Sizes%5Cn%20%20&.is-small%5Cn%20%20%20%20height:%2016px%5Cn%20%20%20%20max-height:%2016px%5Cn%20%20%20%20max-width:%2016px%5Cn%20%20%20%20min-height:%2016px%5Cn%20%20%20%20min-width:%2016px%5Cn%20%20%20%20width:%2016px%5Cn%20%20&.is-medium%5Cn%20%20%20%20height:%2024px%5Cn%20%20%20%20max-height:%2024px%5Cn%20%20%20%20max-width:%2024px%5Cn%20%20%20%20min-height:%2024px%5Cn%20%20%20%20min-width:%2024px%5Cn%20%20%20%20width:%2024px%5Cn%20%20&.is-large%5Cn%20%20%20%20height:%2032px%5Cn%20%20%20%20max-height:%2032px%5Cn%20%20%20%20max-width:%2032px%5Cn%20%20%20%20min-height:%2032px%5Cn%20%20%20%20min-width:%2032px%5Cn%20%20%20%20width:%2032px%5Cn%5Cn=fa($size,%20$dimensions)%5Cn%20%20display:%20inline-block%5Cn%20%20font-size:%20$size%5Cn%20%20height:%20$dimensions%5Cn%20%20line-height:%20$dimensions%5Cn%20%20text-align:%20center%5Cn%20%20vertical-align:%20top%5Cn%20%20width:%20$dimensions%5Cn%5Cn=hamburger($dimensions)%5Cn%20%20cursor:%20pointer%5Cn%20%20display:%20block%5Cn%20%20height:%20$dimensions%5Cn%20%20position:%20relative%5Cn%20%20width:%20$dimensions%5Cn%20%20span%5Cn%20%20%20%20background-color:%20currentColor%5Cn%20%20%20%20display:%20block%5Cn%20%20%20%20height:%201px%5Cn%20%20%20%20left:%2050%25%5Cn%20%20%20%20margin-left:%20-7px%5Cn%20%20%20%20position:%20absolute%5Cn%20%20%20%20top:%2050%25%5Cn%20%20%20%20transition:%20none%20$speed%20$easing%5Cn%20%20%20%20transition-property:%20background,%20left,%20opacity,%20transform%5Cn%20%20%20%20width:%2015px%5Cn%20%20%20%20&:nth-child(1)%5Cn%20%20%20%20%20%20margin-top:%20-6px%5Cn%20%20%20%20&:nth-child(2)%5Cn%20%20%20%20%20%20margin-top:%20-1px%5Cn%20%20%20%20&:nth-child(3)%5Cn%20%20%20%20%20%20margin-top:%204px%5Cn%20%20&:hover%5Cn%20%20%20%20background-color:%20rgba(black,%200.05)%5Cn%20%20//%20Modifers%5Cn%20%20&.is-active%5Cn%20%20%20%20span%5Cn%20%20%20%20%20%20&:nth-child(1)%5Cn%20%20%20%20%20%20%20%20margin-left:%20-5px%5Cn%20%20%20%20%20%20%20%20transform:%20rotate(45deg)%5Cn%20%20%20%20%20%20%20%20transform-origin:%20left%20top%5Cn%20%20%20%20%20%20&:nth-child(2)%5Cn%20%20%20%20%20%20%20%20opacity:%200%5Cn%20%20%20%20%20%20&:nth-child(3)%5Cn%20%20%20%20%20%20%20%20margin-left:%20-5px%5Cn%20%20%20%20%20%20%20%20transform:%20rotate(-45deg)%5Cn%20%20%20%20%20%20%20%20transform-origin:%20left%20bottom%5Cn%5Cn=loader%5Cn%20%20animation:%20spinAround%20500ms%20infinite%20linear%5Cn%20%20border:%202px%20solid%20$border%5Cn%20%20border-radius:%20290486px%5Cn%20%20border-right-color:%20transparent%5Cn%20%20border-top-color:%20transparent%5Cn%20%20content:%20%5C%22%5C%22%5Cn%20%20display:%20block%5Cn%20%20height:%201em%5Cn%20%20position:%20relative%5Cn%20%20width:%201em%5Cn%5Cn=overflow-touch%5Cn%20%20-webkit-overflow-scrolling:%20touch%5Cn%5Cn=overlay($offset:%200)%5Cn%20%20bottom:%20$offset%5Cn%20%20left:%20$offset%5Cn%20%20position:%20absolute%5Cn%20%20right:%20$offset%5Cn%20%20top:%20$offset%5Cn%5Cn=placeholder%5Cn%20%20$placeholders:%20':-moz'%20':-webkit-input'%20'-moz'%20'-ms-input'%5Cn%20%20@each%20$placeholder%20in%20$placeholders%5Cn%20%20%20%20&:%23%7B$placeholder%7D-placeholder%5Cn%20%20%20%20%20%20@content%5Cn%5Cn=unselectable%5Cn%20%20-webkit-touch-callout:%20none%5Cn%20%20-webkit-user-select:%20none%5Cn%20%20-moz-user-select:%20none%5Cn%20%20-ms-user-select:%20none%5Cn%20%20user-select:%20none%5Cn%5Cn//%20Responsiveness%5Cn%5Cn=from($device)%5Cn%20%20@media%20screen%20and%20(min-width:%20$device)%5Cn%20%20%20%20@content%5Cn%5Cn=until($device)%5Cn%20%20@media%20screen%20and%20(max-width:%20$device%20-%201px)%5Cn%20%20%20%20@content%5Cn%5Cn=mobile%5Cn%20%20@media%20screen%20and%20(max-width:%20$tablet%20-%201px)%5Cn%20%20%20%20@content%5Cn%5Cn=tablet%5Cn%20%20@media%20screen%20and%20(min-width:%20$tablet),%20print%5Cn%20%20%20%20@content%5Cn%5Cn=tablet-only%5Cn%20%20@media%20screen%20and%20(min-width:%20$tablet)%20and%20(max-width:%20$desktop%20-%201px)%5Cn%20%20%20%20@content%5Cn%5Cn=touch%5Cn%20%20@media%20screen%20and%20(max-width:%20$desktop%20-%201px)%5Cn%20%20%20%20@content%5Cn%5Cn=desktop%5Cn%20%20@media%20screen%20and%20(min-width:%20$desktop)%5Cn%20%20%20%20@content%5Cn%5Cn=desktop-only%5Cn%20%20@media%20screen%20and%20(min-width:%20$desktop)%20and%20(max-width:%20$widescreen%20-%201px)%5Cn%20%20%20%20@content%5Cn%5Cn=widescreen%5Cn%20%20@media%20screen%20and%20(min-width:%20$widescreen)%5Cn%20%20%20%20@content%5Cn%5Cn=widescreen-only%5Cn%20%20@media%20screen%20and%20(min-width:%20$widescreen)%20and%20(max-width:%20$fullhd%20-%201px)%5Cn%20%20%20%20@content%5Cn%5Cn=fullhd%5Cn%20%20@media%20screen%20and%20(min-width:%20$fullhd)%5Cn%20%20%20%20@content%5Cn%22,%22$title-color:%20$grey-darker%20!default%5Cn$title-size:%20$size-3%20!default%5Cn$title-weight:%20$weight-semibold%20!default%5Cn$title-strong-color:%20inherit%20!default%5Cn$title-strong-weight:%20inherit%20!default%5Cn%5Cn$subtitle-color:%20$grey-dark%20!default%5Cn$subtitle-size:%20$size-5%20!default%5Cn$subtitle-weight:%20$weight-normal%20!default%5Cn$subtitle-strong-color:%20$grey-darker%20!default%5Cn$subtitle-strong-weight:%20$weight-semibold%20!default%5Cn%5Cn.title,%5Cn.subtitle%5Cn%20%20+block%5Cn%20%20word-break:%20break-word%5Cn%20%20em,%5Cn%20%20span%5Cn%20%20%20%20font-weight:%20inherit%5Cn%20%20.tag%5Cn%20%20%20%20vertical-align:%20middle%5Cn%5Cn.title%5Cn%20%20color:%20$title-color%5Cn%20%20font-size:%20$title-size%5Cn%20%20font-weight:%20$title-weight%5Cn%20%20line-height:%201.125%5Cn%20%20strong%5Cn%20%20%20%20color:%20$title-strong-color%5Cn%20%20%20%20font-weight:%20$title-strong-weight%5Cn%20%20&%20+%20.highlight%5Cn%20%20%20%20margin-top:%20-0.75rem%5Cn%20%20&:not(.is-spaced)%20+%20.subtitle%5Cn%20%20%20%20margin-top:%20-1.5rem%5Cn%20%20//%20Sizes%5Cn%20%20@each%20$size%20in%20$sizes%5Cn%20%20%20%20$i:%20index($sizes,%20$size)%5Cn%20%20%20%20&.is-%23%7B$i%7D%5Cn%20%20%20%20%20%20font-size:%20$size%5Cn%5Cn.subtitle%5Cn%20%20color:%20$subtitle-color%5Cn%20%20font-size:%20$subtitle-size%5Cn%20%20font-weight:%20$subtitle-weight%5Cn%20%20line-height:%201.25%5Cn%20%20strong%5Cn%20%20%20%20color:%20$subtitle-strong-color%5Cn%20%20%20%20font-weight:%20$subtitle-strong-weight%5Cn%20%20&:not(.is-spaced)%20+%20.title%5Cn%20%20%20%20margin-top:%20-1.5rem%5Cn%20%20//%20Sizes%5Cn%20%20@each%20$size%20in%20$sizes%5Cn%20%20%20%20$i:%20index($sizes,%20$size)%5Cn%20%20%20%20&.is-%23%7B$i%7D%5Cn%20%20%20%20%20%20font-size:%20$size%5Cn%22,%22//%20@import%20url(%5C%22https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,500i,500,600,600i%7CRoboto%5C%22);%5Cn%5Cn@import%20config%5Cn//%20@import%20hover-cards%5Cn%5Cn*%5Cn%20%20box-sizing:%20border-box%5Cn%5Cnhtml%5Cn%20%20height:%20100%25%5Cn%20%20width:%20100%25%5Cn%5Cnbody%5Cn%20%20height:%20100%25%5Cn%20%20width:%20100%25%5Cn%20%20color:%20%23333%5Cn%20%20background-color:%20white%5Cn%20%20margin:%200%20auto%5Cn%20%20padding:%200%5Cn%20%20font-family:%20'Source%20Sans%20Pro',%20Helvetica,%20sans-serif%5Cn%20%20font-size:%2016px%5Cn%20%20line-height:%20160%25%5Cn%5Cna%5Cn%20%20color:%20%230095dd%5Cn%20%20text-decoration:%20none%5Cn%5Cn%20%20&:active%5Cn%20%20%20%20color:%20%230095dd%5Cn%20%20%20%20text-decoration:%20none%5Cn%5Cn%20%20&:hover%5Cn%20%20%20%20text-decoration:%20underline%5Cn%5Cnp,%20ul,%20ol,%20blockquote%5Cn%20%20margin-bottom:%201em%5Cn%5Cnh1,%20h2,%20h3,%20h4,%20h5,%20h6%5Cn%20%20font-family:%20'Roboto',%20sans-serif%5Cn%5Cnh1,%20h2,%20h3,%20h4,%20h5,%20h6%5Cn%20%20color:%20%23000%5Cn%20%20font-weight:%20400%5Cn%20%20margin:%200%5Cn%20%20line-height:%20initial%5Cn%5Cnh1%5Cn%20%20font-weight:%20300%5Cn%20%20font-size:%2048px%5Cn%20%20margin:%201em%200%20.5em%5Cn%5Cn%20%20&.page-title%5Cn%20%20%20%20margin-bottom:%2010px%5Cn%20%20%20%20font-size:%2034px%5Cn%20%20%20%20font-weight:%20300%5Cn%20%20%20%20border-bottom:%20solid%202px%20%23ddd%5Cn%20%20%20%20padding:%20.5em%200%20.5em%5Cn%20%20%20%20margin-top:%200%5Cn%5Cnh2%5Cn%20%20font-size:%2032px%5Cn%20%20margin:%201.2em%200%20.8em%5Cn%20%20font-weight:%20bold%5Cn%5Cnh3%5Cn%20%20/*%20margin-top:%201em;%5Cn%20%20/*%20margin-bottom:%2016px;%5Cn%20%20/*%20font-weight:%20bold;%5Cn%20%20padding:%200%5Cn%20%20margin:%201em%200%20.6em%5Cn%20%20font-size:%2028px%5Cn%5Cn%20%20/*%20border-bottom:%201px%20solid%20%23eee;%5Cn%20%20/*%20padding-bottom:%2015px;%5Cn%5Cnh4%5Cn%20%20font-size:%2018px%5Cn%20%20margin:%201em%200%20.2em%5Cn%20%20color:%20%23333%5Cn%5Cn%20%20/*%20border-bottom:%201px%20solid%20%23eee;%5Cn%20%20padding-bottom:%208px%5Cn%5Cnh5,%20.container-overview%20.subsection-title%5Cn%20%20font-size:%20120%25%5Cn%5Cn%20%20/*%20letter-spacing:%20-0.01em;%5Cn%20%20margin:%2020px%200%205px%5Cn%5Cnh6%5Cn%20%20font-size:%20100%25%5Cn%20%20letter-spacing:%20-0.01em%5Cn%20%20margin:%206px%200%203px%200%5Cn%20%20font-style:%20italic%5Cn%5Cntt,%20code,%20kbd,%20samp%5Cn%20%20font-family:%20Consolas,%20Monaco,%20'Andale%20Mono',%20monospace%5Cn%20%20background:%20%23f4f4f4%5Cn%20%20padding:%201px%205px%5Cn%20%20border-radius:%205px%5Cn%20%20font-size:%200.875em%5Cn%5Cnblockquote%5Cn%20%20display:%20block%5Cn%20%20border-left:%204px%20solid%20%23eee%5Cn%20%20margin:%200%5Cn%20%20padding-left:%201em%5Cn%20%20color:%20%23eee%5Cn%5Cn.class-description%5Cn%20%20font-size:%20130%25%5Cn%20%20line-height:%20140%25%5Cn%20%20margin-bottom:%201em%5Cn%20%20margin-top:%201em%5Cn%5Cn%20%20&:empty%5Cn%20%20%20%20margin:%200%5Cn%5Cn/**%20Container%20*%5Cn%5Cn%23main%5Cn%20%20float:%20right%5Cn%20%20min-width:%20360px%5Cn%20%20width:%20calc(100%25%20-%20%23%7B$nav-width%7D)%5Cn%20%20padding:%200%5Cn%20%20min-width:%20initial%5Cn%5Cn%20%20&,%20&%20.article%5Cn%20%20%20%20%3E%20*:not(section,ol,ul)%5Cn%20%20%20%20%20%20padding-left:%20$main-padding%5Cn%20%20%20%20%20%20padding-right:%20$main-padding%5Cn%5Cnheader%5Cn%20%20display:%20block%5Cn%5Cnsection%5Cn%20%20display:%20block%5Cn%20%20background-color:%20%23fff%5Cn%20%20padding:%200%5Cn%5Cn.variation%5Cn%20%20display:%20none%5Cn%5Cn.signature-attributes%5Cn%20%20font-size:%2060%25%5Cn%20%20color:%20%23aaa%5Cn%20%20font-style:%20italic%5Cn%20%20font-weight:%20lighter%5Cn%5Cn/**%20Readme%20%20*%5Cn%5Cn.readme%5Cn%20%20font-size:%2016px%5Cn%5Cn%20%20h1,%20h2,%20h3,%20h4,%20h5%5Cn%20%20%20%20margin-top:%201em%5Cn%20%20%20%20margin-bottom:%2016px%5Cn%20%20%20%20font-weight:%20bold%5Cn%20%20%20%20padding:%200%5Cn%5Cn%20%20h1%5Cn%20%20%20%20font-size:%202em%5Cn%20%20%20%20padding-bottom:%200.3em%5Cn%5Cn%20%20h2%5Cn%20%20%20%20font-size:%201.75em%5Cn%20%20%20%20padding-bottom:%200.3em%5Cn%5Cn%20%20h3%5Cn%20%20%20%20font-size:%201.5em%5Cn%20%20%20%20background-color:%20transparent%5Cn%5Cn%20%20h4%5Cn%20%20%20%20font-size:%201.25em%5Cn%5Cn%20%20h5%5Cn%20%20%20%20font-size:%201em%5Cn%5Cn%20%20img%5Cn%20%20%20%20max-width:%20100%25%5Cn%5Cn%20%20ul,%20ol%5Cn%20%20%20%20padding-left:%202em%5Cn%5Cn%20%20pre%20%3E%20code%5Cn%20%20%20%20font-size:%200.85em%5Cn%5Cn%20%20table%5Cn%20%20%20%20margin-bottom:%201em%5Cn%20%20%20%20border-collapse:%20collapse%5Cn%20%20%20%20border-spacing:%200%5Cn%5Cn%20%20%20%20tr%5Cn%20%20%20%20%20%20background-color:%20%23fff%5Cn%20%20%20%20%20%20border-top:%201px%20solid%20%23ccc%5Cn%5Cn%20%20%20%20th,%20td%5Cn%20%20%20%20%20%20padding:%206px%2013px%5Cn%20%20%20%20%20%20border:%201px%20solid%20%23ddd%5Cn%5Cn%20%20%20%20tr:nth-child(2n)%5Cn%20%20%20%20%20%20background-color:%20%23f8f8f8%5Cn%5Cn/**%20Nav%20*%5Cn%5Cnnav%5Cn%20%20float:%20left%5Cn%20%20display:%20block%5Cn%20%20width:%20$nav-width%5Cn%20%20background:%20%23333%5Cn%20%20color:%20%23eee%5Cn%20%20overflow:%20auto%5Cn%20%20position:%20fixed%5Cn%20%20height:%20100%25%5Cn%20%20padding:%2010px%5Cn%5Cn%20%20/*%20box-shadow:%200%200%203px%20rgba(0,0,0,0.1);%5Cn%5Cn%20%20li%5Cn%20%20%20%20list-style:%20none%5Cn%20%20%20%20padding:%200%5Cn%20%20%20%20margin:%200%5Cn%5Cn.nav-heading%5Cn%20%20margin-top:%2010px%5Cn%20%20font-weight:%20bold%5Cn%5Cn%20%20a%5Cn%20%20%20%20color:%20%23eee%5Cn%20%20%20%20font-size:%2014px%5Cn%20%20%20%20display:%20inline-block%5Cn%5Cn.nav-item-type%5Cn%20%20/*%20margin-left:%205px;%5Cn%20%20width:%2018px%5Cn%20%20height:%2018px%5Cn%20%20display:%20inline-block%5Cn%20%20text-align:%20center%5Cn%20%20border-radius:%200.2em%5Cn%20%20margin-right:%205px%5Cn%20%20font-weight:%20bold%5Cn%20%20line-height:%2020px%5Cn%20%20font-size:%2013px%5Cn%5Cn%20%20&.type-article%5Cn%20%20%20%20display:%20none%5Cn%5Cn.nav-item%5Cn%20%20margin-left:%203%20*%20$grid%5Cn%5Cn.nav-item-name%20a%5Cn%20%20&,%20&:visited,%20&:hover%5Cn%20%20%20%20color:%20%23eee%5Cn%5Cn.type-function%5Cn%20%20background:%20%23B3E5FC%5Cn%20%20color:%20%230288D1%5Cn%5Cn.type-class%5Cn%20%20background:%20%23D1C4E9%5Cn%20%20color:%20%234527A0%5Cn%5Cn.type-member%5Cn%20%20background:%20%23C8E6C9%5Cn%20%20color:%20%23388E3C%5Cn%5Cn.type-module%5Cn%20%20background:%20%23E1BEE7%5Cn%20%20color:%20%237B1FA2%5Cn%5Cn/**%20Footer%20*%5Cn%5Cnfooter%5Cn%20%20color:%20hsl(0,%200%25,%2028%25)%5Cn%20%20margin-left:%20$nav-width%5Cn%20%20display:%20block%5Cn%20%20padding:%2030px%5Cn%20%20font-style:%20italic%5Cn%20%20font-size:%2090%25%5Cn%20%20border-top:%201px%20solid%20%23eee%5Cn%5Cn.ancestors%5Cn%20%20color:%20%23999%5Cn%5Cn%20%20a%5Cn%20%20%20%20color:%20%23999%20!important%5Cn%20%20%20%20text-decoration:%20none%5Cn%5Cn.clear%5Cn%20%20clear:%20both%5Cn%5Cn.important%5Cn%20%20font-weight:%20bold%5Cn%20%20color:%20%23950B02%5Cn%5Cn.yes-def%5Cn%20%20text-indent:%20-1000px%5Cn%5Cn.type-signature%5Cn%20%20color:%20%23aaa%5Cn%5Cn.name,%20.signature%5Cn%20%20font-family:%20Consolas,%20Monaco,%20%5C%22Andale%20Mono%5C%22,%20monospace%5Cn%5Cn.details%5Cn%20%20margin-top:%2014px%5Cn%20%20border-left:%202px%20solid%20%23DDD%5Cn%20%20line-height:%2030px%5Cn%5Cn%20%20dt%5Cn%20%20%20%20width:%20120px%5Cn%20%20%20%20float:%20left%5Cn%20%20%20%20padding-left:%2010px%5Cn%5Cn%20%20dd%5Cn%20%20%20%20margin-left:%2070px%5Cn%5Cn%20%20ul%5Cn%20%20%20%20margin:%200%5Cn%20%20%20%20list-style-type:%20none%5Cn%5Cn%20%20li%5Cn%20%20%20%20margin-left:%2030px%5Cn%5Cn%20%20pre.prettyprint%5Cn%20%20%20%20margin:%200%5Cn%5Cn%20%20.object-value%5Cn%20%20%20%20padding-top:%200%5Cn%5Cn.description%5Cn%20%20margin-bottom:%201em%5Cn%20%20margin-top:%201em%5Cn%5Cn.code-caption%5Cn%20%20font-style:%20italic%5Cn%20%20font-size:%20107%25%5Cn%20%20margin:%200%5Cn%5Cn.prettyprint%5Cn%20%20font-size:%2013px%5Cn%20%20border:%201px%20solid%20%23ddd%5Cn%20%20border-radius:%203px%5Cn%20%20box-shadow:%200%201px%203px%20hsla(0,%200%25,%200%25,%200.05)%5Cn%20%20overflow:%20auto%5Cn%5Cn%20%20&.source%5Cn%20%20%20%20width:%20inherit%5Cn%5Cn%20%20code%5Cn%20%20%20%20font-size:%2012px%5Cn%20%20%20%20line-height:%2018px%5Cn%20%20%20%20display:%20block%5Cn%20%20%20%20color:%20%234D4E53%5Cn%5Cn%20%20%20%20&:empty:before%5Cn%20%20%20%20%20%20content:%20''%5Cn%5Cn%20%20%3E%20code%5Cn%20%20%20%20padding:%2015px%5Cn%5Cn%20%20.linenums%5Cn%20%20%20%20code%5Cn%20%20%20%20%20%20padding:%200%2015px%5Cn%5Cn%20%20%20%20li:first-of-type%20code%5Cn%20%20%20%20%20%20padding-top:%2015px%5Cn%5Cn%20%20code%20span.line%5Cn%20%20%20%20display:%20inline-block%5Cn%5Cn%20%20&.linenums%5Cn%20%20%20%20padding-left:%2070px%5Cn%20%20%20%20-webkit-user-select:%20none%5Cn%20%20%20%20-moz-user-select:%20none%5Cn%20%20%20%20-ms-user-select:%20none%5Cn%20%20%20%20user-select:%20none%5Cn%5Cn%20%20%20%20ol%5Cn%20%20%20%20%20%20padding-left:%200%5Cn%5Cn%20%20%20%20li%5Cn%20%20%20%20%20%20border-left:%202px%20%23444%20solid%5Cn%5Cn%20%20%20%20%20%20&.selected%5Cn%20%20%20%20%20%20%20%20background-color:%20%23555%5Cn%5Cn%20%20%20%20%20%20*%5Cn%20%20%20%20%20%20%20%20-webkit-user-select:%20text%5Cn%20%20%20%20%20%20%20%20-moz-user-select:%20text%5Cn%20%20%20%20%20%20%20%20-ms-user-select:%20text%5Cn%20%20%20%20%20%20%20%20user-select:%20text%5Cn%5Cn.params,%20.props%5Cn%20%20border-spacing:%200%5Cn%20%20border:%201px%20solid%20%23ddd%5Cn%20%20border-collapse:%20collapse%5Cn%20%20border-radius:%203px%5Cn%20%20box-shadow:%200%201px%203px%20rgba(0,%200,%200,%200.1)%5Cn%20%20width:%20100%25%5Cn%20%20font-size:%2014px%5Cn%5Cn%20%20/*%20margin-left:%2015px;%5Cn%5Cn.params%20.name,%20.props%20.name,%20.name%20code%5Cn%20%20color:%20%234D4E53%5Cn%20%20font-family:%20Consolas,%20Monaco,%20'Andale%20Mono',%20monospace%5Cn%20%20font-size:%20100%25%5Cn%5Cn.params%5Cn%20%20td,%20th%5Cn%20%20%20%20margin:%200px%5Cn%20%20%20%20text-align:%20left%5Cn%20%20%20%20vertical-align:%20top%5Cn%20%20%20%20padding:%2010px%5Cn%20%20%20%20display:%20table-cell%5Cn%5Cn.props%5Cn%20%20td,%20th%5Cn%20%20%20%20margin:%200px%5Cn%20%20%20%20text-align:%20left%5Cn%20%20%20%20vertical-align:%20top%5Cn%20%20%20%20padding:%2010px%5Cn%20%20%20%20display:%20table-cell%5Cn%5Cn.params%5Cn%20%20td%5Cn%20%20%20%20border-top:%201px%20solid%20%23eee%5Cn%5Cn%20%20thead%20tr%5Cn%20%20%20%20background-color:%20%23fff%5Cn%20%20%20%20font-weight:%20bold%5Cn%5Cn.props%20thead%20tr,%20.params%20.params%20thead%20tr,%20.props%20.props%20thead%20tr%5Cn%20%20background-color:%20%23fff%5Cn%20%20font-weight:%20bold%5Cn%5Cn.params%20param-description%20%3E%20p:first-child,%20.props%20param-description%20%3E%20p:first-child%5Cn%20%20margin-top:%200%5Cn%20%20padding-top:%200%5Cn%5Cn.params%20param-description%20%3E%20p:last-child,%20.props%20param-description%20%3E%20p:last-child%5Cn%20%20margin-bottom:%200%5Cn%20%20padding-bottom:%200%5Cn%5Cndl.param-type%5Cn%20%20/*%20border-bottom:%201px%20solid%20hsl(0,%200%25,%2087%25);%5Cn%20%20margin:%200%5Cn%20%20padding:%200%5Cn%20%20font-size:%2016px%5Cn%5Cn.param-type%5Cn%20%20dt%5Cn%20%20%20%20display:%20inline-block%5Cn%5Cn%20%20dd%5Cn%20%20%20%20display:%20inline-block%5Cn%20%20%20%20font-family:%20Consolas,%20Monaco,%20'Andale%20Mono',%20monospace%5Cn%20%20%20%20display:%20inline-block%5Cn%20%20%20%20padding:%200%5Cn%20%20%20%20margin:%200%5Cn%20%20%20%20font-size:%2014px%5Cn%5Cn.disabled%5Cn%20%20color:%20%23454545%5Cn%5Cn/*%20navicon%20button%5Cn%5Cn.navicon-button%5Cn%20%20display:%20none%5Cn%20%20position:%20relative%5Cn%20%20padding:%202.0625rem%201.5rem%5Cn%20%20cursor:%20pointer%5Cn%20%20user-select:%20none%5Cn%20%20opacity:%20.8%5Cn%5Cn%20%20.navicon%5Cn%20%20%20%20&:before,%20&:after%5Cn%20%20%20%20%20%20transition:%200.25s%5Cn%5Cn%20%20&:hover%5Cn%20%20%20%20transition:%200.5s%5Cn%20%20%20%20opacity:%201%5Cn%5Cn%20%20%20%20.navicon%5Cn%20%20%20%20%20%20&:before,%20&:after%5Cn%20%20%20%20%20%20%20%20transition:%200.25s%5Cn%5Cn%20%20%20%20%20%20&:before%5Cn%20%20%20%20%20%20%20%20top:%20.825rem%5Cn%5Cn%20%20%20%20%20%20&:after%5Cn%20%20%20%20%20%20%20%20top:%20-.825rem%5Cn%5Cn/*%20navicon%5Cn%5Cn.navicon%5Cn%20%20position:%20relative%5Cn%20%20width:%202.5em%5Cn%20%20height:%20.3125rem%5Cn%20%20background:%20%23000%5Cn%20%20transition:%200.3s%5Cn%20%20border-radius:%202.5rem%5Cn%5Cn%20%20&:before,%20&:after%5Cn%20%20%20%20display:%20block%5Cn%20%20%20%20content:%20%5C%22%5C%22%5Cn%20%20%20%20height:%20.3125rem%5Cn%20%20%20%20width:%202.5rem%5Cn%20%20%20%20background:%20%23000%5Cn%20%20%20%20position:%20absolute%5Cn%20%20%20%20z-index:%20-1%5Cn%20%20%20%20transition:%200.3s%200.25s%5Cn%20%20%20%20border-radius:%201rem%5Cn%5Cn%20%20&:before%5Cn%20%20%20%20top:%20.625rem%5Cn%5Cn%20%20&:after%5Cn%20%20%20%20top:%20-.625rem%5Cn%5Cn/*%20open%5Cn%5Cn.nav-trigger%5Cn%20%20&:checked%5Cn%20%20%20%20+%20label%5Cn%20%20%20%20%20%20&:not(.steps)%20.navicon%5Cn%20%20%20%20%20%20%20%20&:before,%20&:after%5Cn%20%20%20%20%20%20%20%20%20%20top:%200%20!important%5Cn%5Cn%20%20%20%20%20%20.navicon%5Cn%20%20%20%20%20%20%20%20&:before,%20&:after%5Cn%20%20%20%20%20%20%20%20%20%20transition:%200.5s%5Cn%5Cn%20%20%20%20%20%20transform:%20scale(0.75)%5Cn%5Cn%20%20%20%20%20%20&.plus%20.navicon,%20&.x%20.navicon%5Cn%20%20%20%20%20%20%20%20background:%20transparent%5Cn%5Cn%20%20%20%20%20%20&.plus%20.navicon:before,%20&.x%20.navicon:before%5Cn%20%20%20%20%20%20%20%20transform:%20rotate(-45deg)%5Cn%20%20%20%20%20%20%20%20background:%20%23FFF%5Cn%5Cn%20%20%20%20%20%20&.plus%20.navicon:after,%20&.x%20.navicon:after%5Cn%20%20%20%20%20%20%20%20transform:%20rotate(45deg)%5Cn%20%20%20%20%20%20%20%20background:%20%23FFF%5Cn%5Cn%20%20%20%20%20%20&.plus%5Cn%20%20%20%20%20%20%20%20transform:%20scale(0.75)%20rotate(45deg)%5Cn%5Cn%20%20%20%20~%5Cn%20%20%20%20%20%20nav%5Cn%20%20%20%20%20%20%20%20transform:%20none%20!important%5Cn%5Cn%20%20%20%20%20%20.overlay%5Cn%20%20%20%20%20%20%20%20display:%20block%5Cn%5Cn%20%20position:%20fixed%5Cn%20%20top:%200%5Cn%20%20clip:%20rect(0,%200,%200,%200)%5Cn%5Cn/*%20Minus%5Cn%5Cn/*%20%C3%83%C6%92%C3%86%E2%80%99%C3%83%C2%A2%C3%A2%E2%80%9A%C2%AC%C3%A2%E2%82%AC%C2%9D%20and%20+%5Cn%5Cn.overlay%5Cn%20%20display:%20none%5Cn%20%20position:%20fixed%5Cn%20%20top:%200%5Cn%20%20bottom:%200%5Cn%20%20left:%200%5Cn%20%20right:%200%5Cn%20%20width:%20100%25%5Cn%20%20height:%20100%25%5Cn%20%20background:%20hsla(0,%200%25,%200%25,%200.5)%5Cn%20%20z-index:%201%5Cn%5Cn.section-method%5Cn%20%20margin-bottom:%2030px%5Cn%20%20padding-bottom:%2030px%5Cn%20%20border-bottom:%201px%20solid%20%23eee%5Cn%5Cn@media%20only%20screen%20and%20(max-width:%20700px)%5Cn%20%20body%5Cn%20%20%20%20overflow-x:%20hidden%5Cn%5Cn%20%20nav%5Cn%20%20%20%20width:%20$nav-width%5Cn%20%20%20%20height:%20100%25%5Cn%20%20%20%20transform:%20translateX(-$nav-width)%5Cn%20%20%20%20z-index:%203%5Cn%20%20%20%20padding:%200%2010px%5Cn%20%20%20%20transition:%20transform%200.2s%5Cn%5Cn%20%20.navicon-button%5Cn%20%20%20%20display:%20inline-block%5Cn%20%20%20%20position:%20fixed%5Cn%20%20%20%20top:%201.5em%5Cn%20%20%20%20right:%200%5Cn%20%20%20%20z-index:%202%5Cn%5Cn%20%20%23main%5Cn%20%20%20%20width:%20100%25%5Cn%20%20%20%20min-width:%20360px%5Cn%5Cn%20%20%20%20h1.page-title%5Cn%20%20%20%20%20%20margin:%201em%200%5Cn%5Cn%20%20%20%20section%5Cn%20%20%20%20%20%20padding:%200%5Cn%5Cn%20%20footer%5Cn%20%20%20%20margin-left:%200%5Cn%5Cn@media%20only%20print%5Cn%20%20nav%5Cn%20%20%20%20display:%20none%5Cn%5Cn%20%20%23main%5Cn%20%20%20%20float:%20none%5Cn%20%20%20%20width:%20100%25%5Cn%5Cnsection%20%3E%20header,%5Cn.subsection-title,%5Cn.section-method%20%3E%20*:not(.params,%20.description,%20.prettyprint,%20ol,%20ul),%5Cn.description%20%3E%20*:not(.prettyprint,%20ol,%20ul),%5Cnfooter%5Cn%20%20padding-left:%20$main-padding%5Cn%20%20padding-right:%20$main-padding%5Cn%20%20margin:%200%5Cn%5Cntable.params%5Cn%20%20width:%20auto%5Cn%20%20margin:%200%2010px%5Cn%5Cn.prettyprint.source,%20%23main%20blockquote%5Cn%20%20width:%20100%25%5Cn%5Cn.prettyprint%5Cn%20%20position:%20relative%5Cn%20%20border:%20none%5Cn%20%20border-radius:%200%5Cn%20%20width:%20100%25%5Cn%20%20background-color:%20%23292929%5Cn%20%20color:%20%23c5c8c6%5Cn%20%20border-radius:%200%5Cn%5Cn%20%20code%5Cn%20%20%20%20position:%20relative%5Cn%20%20%20%20border:%20none%5Cn%20%20%20%20border-radius:%200%5Cn%20%20%20%20width:%20100%25%5Cn%20%20%20%20background-color:%20transparent%5Cn%20%20%20%20color:%20%23c5c8c6%5Cn%20%20%20%20border-radius:%200%5Cn%5Cn%23main%20blockquote%5Cn%20%20position:%20relative%5Cn%20%20border:%20none%5Cn%20%20border-radius:%200%5Cn%20%20background-color:%20%23292929%5Cn%20%20color:%20%23c5c8c6%5Cn%20%20border-radius:%200%5Cn%5Cn@media%20only%20screen%20and%20(min-width:%201001px)%5Cn%20%20%25pull-left%5Cn%20%20%20%20width:%20calc(50%25%20-%20%23%7B$main-padding%7D)%5Cn%20%20%20%20margin-right:%20calc(50%25%20+%20%23%7B$main-padding%7D)%5Cn%5Cn%20%20%25pull-right%5Cn%20%20%20%20width:%2050%25%5Cn%20%20%20%20margin:%200%200%2010px%5Cn%20%20%20%20float:%20right%5Cn%20%20%20%20clear:%20right%5Cn%5Cn%20%20%23main%5Cn%20%20%20%20%3E%5Cn%20%20%20%20%20%20section%5Cn%20%20%20%20%20%20%20%20background-color:%20transparent%5Cn%5Cn%20%20%20%20%20%20*:not(section)%5Cn%20%20%20%20%20%20%20%20@extend%20%25pull-left%5Cn%5Cn%20%20%20%20.prettyprint:not(.source)%5Cn%20%20%20%20%20%20%20%20@extend%20%25pull-left%5Cn%5Cn%20%20.subsection-title,%5Cn%20%20.section-examples,%5Cn%20%20.section-method%20%3E%20*:not(.params):not(.description),%5Cn%20%20.description%20%3E%20*,%5Cn%20%20.article%20%3E%20*,%5Cn%20%20footer%5Cn%20%20%20%20@extend%20%25pull-left%5Cn%5Cn%20%20table.params%5Cn%20%20%20%20margin:%200%20calc(50%25%20+%2010px)%200%2010px%5Cn%20%20%20%20min-width:%20200px%5Cn%5Cn%20%20.section-method%20%3E%5Cn%20%20%20%20h1,%20h2%5Cn%20%20%20%20%20%20clear:%20both%5Cn%5Cn%20%20%23main%5Cn%20%20%20%20.description,%20.article%20%3E%5Cn%20%20%20%20%20%20.prettyprint.source,%20blockquote%5Cn%20%20%20%20%20%20%20%20@extend%20%25pull-right%5Cn%5Cn%20%20.prettyprint%20%3E%20code%5Cn%20%20%20%20white-space:%20pre-wrap%5Cn%5Cn%20%20.code-col-bg%5Cn%20%20%20%20position:%20fixed%5Cn%20%20%20%20right:%200%5Cn%20%20%20%20width:%20calc(50%25%20-%20%23%7B$nav-width%7D%20/%202)%5Cn%20%20%20%20height:%20100%25%5Cn%20%20%20%20background-color:%20%23333%5Cn%5Cn%20%20footer%5Cn%20%20%20%20position:%20relative%5Cn%20%20%20%20margin-left:%20$nav-width%5Cn%20%20%20%20margin-right:%20calc(50%25%20-%20%23%7B$nav-width%7D%20/%202)%5Cn%20%20%20%20border:%20none%5Cn%20%20%20%20clear:%20right%5Cn%5Cn/*%20make%20comments%20more%20legible%5Cn.prettyprint%20.com%5Cn%20%20color:%20%237699b2%5Cn%22%5D%7D */ diff --git a/packages/interactjs/dist/api/styles/prettify-jsdoc.css b/packages/interactjs/dist/api/styles/prettify-jsdoc.css new file mode 100644 index 000000000..834a866d4 --- /dev/null +++ b/packages/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/packages/interactjs/dist/api/styles/prettify.css b/packages/interactjs/dist/api/styles/prettify.css new file mode 100644 index 000000000..c9b714eb2 --- /dev/null +++ b/packages/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/packages/interactjs/dist/interact.js b/packages/interactjs/dist/interact.js new file mode 100644 index 000000000..f347f0b09 --- /dev/null +++ b/packages/interactjs/dist/interact.js @@ -0,0 +1,12042 @@ +"use strict"; + +function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); } + +/** + * interact.js 1.10.23 + * + * Copyright (c) 2012-present Taye Adeyemi + * https://interactjs.io/license + */ +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _typeof2(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 _$isWindow_71 = {}; + "use strict"; + + Object.defineProperty(_$isWindow_71, "__esModule", { + value: true + }); + _$isWindow_71.default = void 0; + + var _default = function _default(thing) { + return !!(thing && thing.Window) && thing instanceof thing.Window; + }; + + _$isWindow_71.default = _default; + var _$window_78 = {}; + "use strict"; + + Object.defineProperty(_$window_78, "__esModule", { + value: true + }); + _$window_78.getWindow = getWindow; + _$window_78.init = init; + _$window_78.window = _$window_78.realWindow = void 0; + /* removed: var _$isWindow_71 = require("./isWindow"); */ + + ; + var realWindow = undefined; + _$window_78.realWindow = realWindow; + var win = undefined; + _$window_78.window = win; + + function init(window) { + // get wrapped window if using Shadow DOM polyfill + _$window_78.realWindow = 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); + } + + _$window_78.window = win = window; + } + + if (typeof window !== 'undefined' && !!window) { + init(window); + } + + function getWindow(node) { + if ((0, _$isWindow_71.default)(node)) { + return node; + } + + var rootNode = node.ownerDocument || node; + return rootNode.defaultView || win.window; + } + + var _$is_69 = {}; + "use strict"; + + Object.defineProperty(_$is_69, "__esModule", { + value: true + }); + _$is_69.default = void 0; + /* removed: var _$isWindow_71 = require("./isWindow"); */ + + ; + /* removed: var _$window_78 = require("./window"); */ + + ; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + var __window_69 = function window(thing) { + return thing === _$window_78.window || (0, _$isWindow_71.default)(thing); + }; + + var docFrag = function docFrag(thing) { + return object(thing) && thing.nodeType === 11; + }; + + var object = function object(thing) { + return !!thing && _typeof(thing) === 'object'; + }; + + var func = function func(thing) { + return typeof thing === 'function'; + }; + + var number = function number(thing) { + return typeof thing === 'number'; + }; + + var bool = function bool(thing) { + return typeof thing === 'boolean'; + }; + + var string = function string(thing) { + return typeof thing === 'string'; + }; + + var element = function element(thing) { + if (!thing || _typeof(thing) !== 'object') { + return false; + } + + var _window = _$window_78.getWindow(thing) || _$window_78.window; + + return /object|function/.test(typeof Element === "undefined" ? "undefined" : _typeof(Element)) ? thing instanceof Element || thing instanceof _window.Element : thing.nodeType === 1 && typeof thing.nodeName === 'string'; + }; + + var plainObject = function plainObject(thing) { + return object(thing) && !!thing.constructor && /function Object\b/.test(thing.constructor.toString()); + }; + + var array = function array(thing) { + return object(thing) && typeof thing.length !== 'undefined' && func(thing.splice); + }; + + var ___default_69 = { + window: __window_69, + docFrag: docFrag, + object: object, + func: func, + number: number, + bool: bool, + string: string, + element: element, + plainObject: plainObject, + array: array + }; + _$is_69.default = ___default_69; + var _$plugin_1 = {}; + "use strict"; + + Object.defineProperty(_$plugin_1, "__esModule", { + value: true + }); + _$plugin_1.default = void 0; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + + 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_69.default.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_69.default.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'; + }, + filterEventType: function filterEventType(type) { + return type.search('drag') === 0; + } + }; + var ___default_1 = drag; + _$plugin_1.default = ___default_1; + var _$domObjects_64 = {}; + "use strict"; + + Object.defineProperty(_$domObjects_64, "__esModule", { + value: true + }); + _$domObjects_64.default = void 0; + var domObjects = { + init: __init_64, + document: null, + DocumentFragment: null, + SVGElement: null, + SVGSVGElement: null, + SVGElementInstance: null, + Element: null, + HTMLElement: null, + Event: null, + Touch: null, + PointerEvent: null + }; + + function blank() {} + + var ___default_64 = domObjects; + _$domObjects_64.default = ___default_64; + + function __init_64(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_62 = {}; + "use strict"; + + Object.defineProperty(_$browser_62, "__esModule", { + value: true + }); + _$browser_62.default = void 0; + /* removed: var _$domObjects_64 = require("./domObjects"); */ + + ; + /* removed: var _$is_69 = require("./is"); */ + + ; + var browser = { + init: __init_62, + supportsTouch: null, + supportsPointerEvent: null, + isIOS7: null, + isIOS: null, + isIe9: null, + isOperaMobile: null, + prefixedMatchesSelector: null, + pEventTypes: null, + wheelEvent: null + }; + + function __init_62(window) { + var Element = _$domObjects_64.default.Element; + var navigator = window.navigator || {}; // Does the browser support touch input? + + browser.supportsTouch = 'ontouchstart' in window || _$is_69.default.func(window.DocumentTouch) && _$domObjects_64.default.document instanceof window.DocumentTouch; // Does the browser support PointerEvents + // https://github.com/taye/interact.js/issues/703#issuecomment-471570492 + + browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!_$domObjects_64.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_64.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 = _$domObjects_64.default.document && 'onmousewheel' in _$domObjects_64.default.document ? 'mousewheel' : 'wheel'; + } + + var ___default_62 = browser; + _$browser_62.default = ___default_62; + var _$domUtils_65 = {}; + "use strict"; + + Object.defineProperty(_$domUtils_65, "__esModule", { + value: true + }); + _$domUtils_65.closest = closest; + _$domUtils_65.getActualElement = getActualElement; + _$domUtils_65.getElementClientRect = getElementClientRect; + _$domUtils_65.getElementRect = getElementRect; + _$domUtils_65.getPath = getPath; + _$domUtils_65.getScrollXY = getScrollXY; + _$domUtils_65.indexOfDeepestElement = indexOfDeepestElement; + _$domUtils_65.matchesSelector = matchesSelector; + _$domUtils_65.matchesUpTo = matchesUpTo; + _$domUtils_65.nodeContains = nodeContains; + _$domUtils_65.parentNode = parentNode; + _$domUtils_65.trySelector = trySelector; + /* removed: var _$browser_62 = require("./browser"); */ + + ; + /* removed: var _$domObjects_64 = require("./domObjects"); */ + + ; + /* removed: var _$is_69 = require("./is"); */ + + ; + /* removed: var _$window_78 = require("./window"); */ + + ; + + function nodeContains(parent, child) { + if (parent.contains) { + return parent.contains(child); + } + + while (child) { + if (child === parent) { + return true; + } + + child = child.parentNode; + } + + return false; + } + + function closest(element, selector) { + while (_$is_69.default.element(element)) { + if (matchesSelector(element, selector)) { + return element; + } + + element = parentNode(element); + } + + return null; + } + + function parentNode(node) { + var parent = node.parentNode; + + if (_$is_69.default.docFrag(parent)) { + // skip past #shado-root fragments + // tslint:disable-next-line + while ((parent = parent.host) && _$is_69.default.docFrag(parent)) { + continue; + } + + return parent; + } + + return parent; + } + + function matchesSelector(element, selector) { + // remove /deep/ from selectors if shadowDOM polyfill is used + if (_$window_78.window !== _$window_78.realWindow) { + selector = selector.replace(/\/deep\//g, ' '); + } + + return element[_$browser_62.default.prefixedMatchesSelector](selector); + } + + var getParent = function getParent(el) { + return el.parentNode || el.host; + }; // Test for the element that's "above" all other qualifiers + + + function indexOfDeepestElement(elements) { + var deepestNodeParents = []; + var deepestNodeIndex; + + for (var i = 0; i < elements.length; i++) { + var currentNode = elements[i]; + var deepestNode = elements[deepestNodeIndex]; // node may appear in elements array multiple times + + if (!currentNode || i === deepestNodeIndex) { + continue; + } + + if (!deepestNode) { + deepestNodeIndex = i; + continue; + } + + var currentNodeParent = getParent(currentNode); + var deepestNodeParent = getParent(deepestNode); // check if the deepest or current are document.documentElement/rootElement + // - if the current node is, do nothing and continue + + if (currentNodeParent === currentNode.ownerDocument) { + continue; + } // - if deepest is, update with the current node and continue to next + else if (deepestNodeParent === currentNode.ownerDocument) { + deepestNodeIndex = i; + continue; + } // compare zIndex of siblings + + + if (currentNodeParent === deepestNodeParent) { + if (zIndexIsHigherThan(currentNode, deepestNode)) { + deepestNodeIndex = i; + } + + continue; + } // populate the ancestry array for the latest deepest node + + + deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode); + var ancestryStart = void 0; // if the deepest node is an HTMLElement and the current node is a non root svg element + + if (deepestNode instanceof _$domObjects_64.default.HTMLElement && currentNode instanceof _$domObjects_64.default.SVGElement && !(currentNode instanceof _$domObjects_64.default.SVGSVGElement)) { + // TODO: is this check necessary? Was this for HTML elements embedded in SVG? + if (currentNode === deepestNodeParent) { + continue; + } + + ancestryStart = currentNode.ownerSVGElement; + } else { + ancestryStart = currentNode; + } + + var currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument); + var commonIndex = 0; // get (position of closest common ancestor) + 1 + + while (currentNodeParents[commonIndex] && currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]) { + commonIndex++; + } + + var parents = [currentNodeParents[commonIndex - 1], currentNodeParents[commonIndex], deepestNodeParents[commonIndex]]; + + if (parents[0]) { + var child = parents[0].lastChild; + + while (child) { + if (child === parents[1]) { + deepestNodeIndex = i; + deepestNodeParents = currentNodeParents; + break; + } else if (child === parents[2]) { + break; + } + + child = child.previousSibling; + } + } + } + + return deepestNodeIndex; + } + + function getNodeParents(node, limit) { + var parents = []; + var parent = node; + var parentParent; + + while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) { + parents.unshift(parent); + parent = parentParent; + } + + return parents; + } + + function zIndexIsHigherThan(higherNode, lowerNode) { + var higherIndex = parseInt(_$window_78.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0; + var lowerIndex = parseInt(_$window_78.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0; + return higherIndex >= lowerIndex; + } + + function matchesUpTo(element, selector, limit) { + while (_$is_69.default.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.correspondingUseElement || element; + } + + function getScrollXY(relevantWindow) { + relevantWindow = relevantWindow || _$window_78.window; + return { + x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft, + y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop + }; + } + + function getElementClientRect(element) { + var clientRect = element instanceof _$domObjects_64.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_62.default.isIOS7 && clientRect) { + var scroll = getScrollXY(_$window_78.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_69.default.string(value)) { + return false; + } // an exception will be raised if it is invalid + + + _$domObjects_64.default.document.querySelector(value); + + return true; + } + + var _$extend_66 = {}; + "use strict"; + + Object.defineProperty(_$extend_66, "__esModule", { + value: true + }); + _$extend_66.default = extend; + + function extend(dest, source) { + for (var prop in source) { + ; + dest[prop] = source[prop]; + } + + var ret = dest; + return ret; + } + + var _$rect_77 = {}; + "use strict"; + + Object.defineProperty(_$rect_77, "__esModule", { + value: true + }); + _$rect_77.addEdges = addEdges; + _$rect_77.getStringOptionResult = getStringOptionResult; + _$rect_77.rectToXY = rectToXY; + _$rect_77.resolveRectLike = resolveRectLike; + _$rect_77.tlbrToXywh = tlbrToXywh; + _$rect_77.toFullRect = toFullRect; + _$rect_77.xywhToTlbr = xywhToTlbr; + /* removed: var _$domUtils_65 = require("./domUtils"); */ + + ; + /* removed: var _$extend_66 = require("./extend"); */ + + ; + /* removed: var _$is_69 = require("./is"); */ + + ; + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function getStringOptionResult(value, target, element) { + if (value === 'parent') { + return (0, _$domUtils_65.parentNode)(element); + } + + if (value === 'self') { + return target.getRect(element); + } + + return (0, _$domUtils_65.closest)(element, value); + } + + function resolveRectLike(value, target, element, functionArgs) { + var returnValue = value; + + if (_$is_69.default.string(returnValue)) { + returnValue = getStringOptionResult(returnValue, target, element); + } else if (_$is_69.default.func(returnValue)) { + returnValue = returnValue.apply(void 0, _toConsumableArray(functionArgs)); + } + + if (_$is_69.default.element(returnValue)) { + returnValue = (0, _$domUtils_65.getElementRect)(returnValue); + } + + return returnValue; + } + + function toFullRect(rect) { + var _rect$width, _rect$height; + + var top = rect.top, + left = rect.left, + bottom = rect.bottom, + right = rect.right; + var width = (_rect$width = rect.width) != null ? _rect$width : rect.right - rect.left; + var height = (_rect$height = rect.height) != null ? _rect$height : rect.bottom - rect.top; + return { + top: top, + left: left, + bottom: bottom, + right: right, + width: width, + height: height + }; + } + + 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_66.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_66.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_67 = {}; + "use strict"; + + Object.defineProperty(_$getOriginXY_67, "__esModule", { + value: true + }); + _$getOriginXY_67.default = getOriginXY; + /* removed: var _$rect_77 = require("./rect"); */ + + ; + + function getOriginXY(target, element, actionName) { + var actionOptions = actionName && target.options[actionName]; + var actionOrigin = actionOptions && actionOptions.origin; + var origin = actionOrigin || target.options.origin; + var originRect = (0, _$rect_77.resolveRectLike)(origin, target, element, [target && element]); + return (0, _$rect_77.rectToXY)(originRect) || { + x: 0, + y: 0 + }; + } + + var _$normalizeListeners_73 = {}; + "use strict"; + + Object.defineProperty(_$normalizeListeners_73, "__esModule", { + value: true + }); + _$normalizeListeners_73.default = normalize; + /* removed: var _$is_69 = require("./is"); */ + + ; + + function normalize(type, listeners) { + var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (_typeOrPrefix) { + return true; + }; + var result = arguments.length > 3 ? arguments[3] : undefined; + result = result || {}; + + if (_$is_69.default.string(type) && type.search(' ') !== -1) { + type = split(type); + } + + if (_$is_69.default.array(type)) { + type.forEach(function (t) { + return normalize(t, listeners, filter, result); + }); + return result; + } // before: type = [{ drag: () => {} }], listeners = undefined + // after: type = '' , listeners = [{ drag: () => {} }] + + + if (_$is_69.default.object(type)) { + listeners = type; + type = ''; + } + + if (_$is_69.default.func(listeners) && filter(type)) { + result[type] = result[type] || []; + result[type].push(listeners); + } else if (_$is_69.default.array(listeners)) { + for (var _i = 0; _i < listeners.length; _i++) { + var _ref; + + _ref = listeners[_i]; + var l = _ref; + normalize(type, l, filter, result); + } + } else if (_$is_69.default.object(listeners)) { + for (var prefix in listeners) { + var combinedTypes = split(prefix).map(function (p) { + return "".concat(type).concat(p); + }); + normalize(combinedTypes, listeners[prefix], filter, result); + } + } + + return result; + } + + function split(type) { + return type.trim().split(/ +/); + } + + var _$hypot_68 = {}; + "use strict"; + + Object.defineProperty(_$hypot_68, "__esModule", { + value: true + }); + _$hypot_68.default = void 0; + + var ___default_68 = function _default(x, y) { + return Math.sqrt(x * x + y * y); + }; + + _$hypot_68.default = ___default_68; + var _$pointerExtend_74 = {}; + "use strict"; + + Object.defineProperty(_$pointerExtend_74, "__esModule", { + value: true + }); + _$pointerExtend_74.default = pointerExtend; + var VENDOR_PREFIXES = ['webkit', 'moz']; + + function pointerExtend(dest, source) { + dest.__set || (dest.__set = {}); + + var _loop = function _loop(prop) { + // skip deprecated prefixed properties + if (VENDOR_PREFIXES.some(function (prefix) { + return prop.indexOf(prefix) === 0; + })) return "continue"; + + if (typeof dest[prop] !== 'function' && prop !== '__set') { + Object.defineProperty(dest, prop, { + get: function get() { + if (prop in dest.__set) return dest.__set[prop]; + return dest.__set[prop] = source[prop]; + }, + set: function set(value) { + dest.__set[prop] = value; + }, + configurable: true + }); + } + }; + + for (var prop in source) { + var _ret = _loop(prop); + + if (_ret === "continue") continue; + } + + return dest; + } + + var _$pointerUtils_75 = {}; + "use strict"; + + Object.defineProperty(_$pointerUtils_75, "__esModule", { + value: true + }); + _$pointerUtils_75.coordsToEvent = coordsToEvent; + _$pointerUtils_75.copyCoords = copyCoords; + _$pointerUtils_75.getClientXY = getClientXY; + _$pointerUtils_75.getEventTargets = getEventTargets; + _$pointerUtils_75.getPageXY = getPageXY; + _$pointerUtils_75.getPointerId = getPointerId; + _$pointerUtils_75.getPointerType = getPointerType; + _$pointerUtils_75.getTouchPair = getTouchPair; + _$pointerUtils_75.getXY = getXY; + _$pointerUtils_75.isNativePointer = isNativePointer; + _$pointerUtils_75.newCoords = newCoords; + _$pointerUtils_75.pointerAverage = pointerAverage; + Object.defineProperty(_$pointerUtils_75, "pointerExtend", { + enumerable: true, + get: function get() { + return _$pointerExtend_74.default; + } + }); + _$pointerUtils_75.setCoordDeltas = setCoordDeltas; + _$pointerUtils_75.setCoordVelocity = setCoordVelocity; + _$pointerUtils_75.setCoords = setCoords; + _$pointerUtils_75.setZeroCoords = setZeroCoords; + _$pointerUtils_75.touchAngle = touchAngle; + _$pointerUtils_75.touchBBox = touchBBox; + _$pointerUtils_75.touchDistance = touchDistance; + /* removed: var _$browser_62 = require("./browser"); */ + + ; + /* removed: var _$domObjects_64 = require("./domObjects"); */ + + ; + /* removed: var _$domUtils_65 = require("./domUtils"); */ + + ; + /* removed: var _$hypot_68 = require("./hypot"); */ + + ; + /* removed: var _$is_69 = require("./is"); */ + + ; + /* removed: var _$pointerExtend_74 = require("./pointerExtend"); */ + + ; + + 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_64.default.Event || pointer instanceof _$domObjects_64.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_62.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_62.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_69.default.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier; + } + + function setCoords(dest, pointers, timeStamp) { + var pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]; + getPageXY(pointer, dest.page); + getClientXY(pointer, dest.client); + dest.timeStamp = timeStamp; + } + + function getTouchPair(event) { + var touches = []; // array of touches is supplied + + if (_$is_69.default.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) { + 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_68.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_69.default.string(pointer.pointerType) ? pointer.pointerType : _$is_69.default.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_64.default.Touch ? 'touch' : 'mouse'; + } // [ event.target, event.currentTarget ] + + + function getEventTargets(event) { + var path = _$is_69.default.func(event.composedPath) ? event.composedPath() : event.path; + return [_$domUtils_65.getActualElement(path ? path[0] : event.target), _$domUtils_65.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; + }, + + preventDefault: function preventDefault() {} + }; + return event; + } + + var _$BaseEvent_13 = {}; + "use strict"; + + Object.defineProperty(_$BaseEvent_13, "__esModule", { + value: true + }); + _$BaseEvent_13.BaseEvent = void 0; + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + 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 BaseEvent = /*#__PURE__*/function () { + function BaseEvent(interaction) { + _classCallCheck(this, BaseEvent); + + _defineProperty(this, "immediatePropagationStopped", false); + + _defineProperty(this, "propagationStopped", false); + + this._interaction = interaction; + } + + _createClass(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; + }(); // defined outside of class definition to avoid assignment of undefined during + // construction + + + _$BaseEvent_13.BaseEvent = BaseEvent; // getters and setters defined here to support typescript 3.6 and below which + // don't support getter and setters in .d.ts files + + Object.defineProperty(BaseEvent.prototype, 'interaction', { + get: function get() { + return this._interaction._proxy; + }, + set: function set() {} + }); + var _$arr_61 = {}; + "use strict"; + + Object.defineProperty(_$arr_61, "__esModule", { + value: true + }); + _$arr_61.remove = _$arr_61.merge = _$arr_61.from = _$arr_61.findIndex = _$arr_61.find = _$arr_61.contains = void 0; + + var contains = function contains(array, target) { + return array.indexOf(target) !== -1; + }; + + _$arr_61.contains = contains; + + var remove = function remove(array, target) { + return array.splice(array.indexOf(target), 1); + }; + + _$arr_61.remove = remove; + + var merge = 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; + }; + + _$arr_61.merge = merge; + + var from = function from(source) { + return merge([], source); + }; + + _$arr_61.from = from; + + var findIndex = function findIndex(array, func) { + for (var i = 0; i < array.length; i++) { + if (func(array[i], i, array)) { + return i; + } + } + + return -1; + }; + + _$arr_61.findIndex = findIndex; + + var find = function find(array, func) { + return array[findIndex(array, func)]; + }; + + _$arr_61.find = find; + var _$DropEvent_2 = {}; + "use strict"; + + function ___typeof_2(obj) { + "@babel/helpers - typeof"; + + return ___typeof_2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, ___typeof_2(obj); + } + + Object.defineProperty(_$DropEvent_2, "__esModule", { + value: true + }); + _$DropEvent_2.DropEvent = void 0; + /* removed: var _$BaseEvent_13 = require("@interactjs/core/BaseEvent"); */ + + ; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + 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 + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + + function _createSuper(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct(); + + return function _createSuperInternal() { + var Super = _getPrototypeOf(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possibleConstructorReturn(this, result); + }; + } + + function _possibleConstructorReturn(self, call) { + if (call && (___typeof_2(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + + 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 _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + 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(DropEvent, _BaseEvent); + + var _super = _createSuper(DropEvent); + /** + * Class of events fired on dropzones during drags with acceptable targets. + */ + + + function DropEvent(dropState, dragEvent, type) { + var _this; + + ___classCallCheck_2(this, DropEvent); + + _this = _super.call(this, dragEvent._interaction); + + ___defineProperty_2(_assertThisInitialized(_this), "dropzone", void 0); + + ___defineProperty_2(_assertThisInitialized(_this), "dragEvent", void 0); + + ___defineProperty_2(_assertThisInitialized(_this), "relatedTarget", void 0); + + ___defineProperty_2(_assertThisInitialized(_this), "draggable", void 0); + + ___defineProperty_2(_assertThisInitialized(_this), "propagationStopped", false); + + ___defineProperty_2(_assertThisInitialized(_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_61.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; + }(_$BaseEvent_13.BaseEvent); + + _$DropEvent_2.DropEvent = DropEvent; + var _$plugin_3 = {}; + "use strict"; + + Object.defineProperty(_$plugin_3, "__esModule", { + value: true + }); + _$plugin_3.default = void 0; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$getOriginXY_67 = require("@interactjs/utils/getOriginXY"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$normalizeListeners_73 = require("@interactjs/utils/normalizeListeners"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + /* removed: var _$plugin_1 = require("../drag/plugin"); */ + + ; + /* removed: var _$DropEvent_2 = require("./DropEvent"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + /* eslint-enable import/no-duplicates */ + + function __install_3(scope) { + var actions = scope.actions, + interact = scope.interactStatic, + Interactable = scope.Interactable, + defaults = scope.defaults; + scope.usePlugin(_$plugin_1.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 {object | 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 (_$is_69.default.bool(newValue)) { + // if (dragging && scope.dynamicDrop !== newValue && !newValue) { + // calcRects(dropzones) + // } + scope.dynamicDrop = newValue; + return interact; + } + + return scope.dynamicDrop; + }; + + (0, _$extend_66.default)(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 collectDropzones(_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 (_$is_69.default.element(accept) && accept !== draggableElement || _$is_69.default.string(accept) && !_$domUtils_65.matchesSelector(draggableElement, accept) || _$is_69.default.func(accept) && !accept({ + dropzone: _dropzone, + draggableElement: draggableElement + })) { + continue; + } + + for (var _i2 = 0; _i2 < _dropzone.getAllElements().length; _i2++) { + var _ref3; + + _ref3 = _dropzone.getAllElements()[_i2]; + var dropzoneElement = _ref3; + + if (dropzoneElement !== draggableElement) { + drops.push({ + dropzone: _dropzone, + element: dropzoneElement, + rect: _dropzone.getRect(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, + _dropzone2 = _ref5.dropzone, + element = _ref5.element; + event.dropzone = _dropzone2; // set current element as event target + + event.target = element; + + _dropzone2.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 = collectDropzones(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, + _dropzone3 = _ref9.dropzone, + dropzoneElement = _ref9.element, + _rect = _ref9.rect; + + var isValid = _dropzone3.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, _rect); + + validDrops.push(isValid ? dropzoneElement : null); + } // get the most appropriate dropzone based on DOM depth and order + + + var dropIndex = _$domUtils_65.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_2.DropEvent(dropState, dragEvent, 'dropactivate'); + dropEvents.activate.target = null; + dropEvents.activate.dropzone = null; + } + + if (dragEvent.type === 'dragend') { + dropEvents.deactivate = new _$DropEvent_2.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_2.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_2.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_2.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_2.DropEvent(dropState, dragEvent, 'dropmove'); + 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.enter) { + cur.dropzone.fire(events.enter); + } + + if (events.move) { + cur.dropzone.fire(events.move); + } + + 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 (_$is_69.default.object(options)) { + interactable.options.drop.enabled = options.enabled !== false; + + if (options.listeners) { + var normalized = (0, _$normalizeListeners_73.default)(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; + }, {}); + var prevListeners = interactable.options.drop.listeners; + prevListeners && interactable.off(prevListeners); + interactable.on(corrected); + interactable.options.drop.listeners = corrected; + } + + if (_$is_69.default.func(options.ondrop)) { + interactable.on('drop', options.ondrop); + } + + if (_$is_69.default.func(options.ondropactivate)) { + interactable.on('dropactivate', options.ondropactivate); + } + + if (_$is_69.default.func(options.ondropdeactivate)) { + interactable.on('dropdeactivate', options.ondropdeactivate); + } + + if (_$is_69.default.func(options.ondragenter)) { + interactable.on('dragenter', options.ondragenter); + } + + if (_$is_69.default.func(options.ondragleave)) { + interactable.on('dragleave', options.ondragleave); + } + + if (_$is_69.default.func(options.ondropmove)) { + interactable.on('dropmove', options.ondropmove); + } + + if (/^(pointer|center)$/.test(options.overlap)) { + interactable.options.drop.overlap = options.overlap; + } else if (_$is_69.default.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 (_$is_69.default.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 = (0, _$getOriginXY_67.default)(draggable, draggableElement, 'drag'); + + var page = _$pointerUtils_75.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 && _$is_69.default.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 = []; + dropState.events = {}; + 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 + }); + } + }, + 'interactions:action-move': onEventCreated, + 'interactions:after-action-move': function interactionsAfterActionMove(_ref13, scope) { + var interaction = _ref13.interaction, + dragEvent = _ref13.iEvent; + + if (interaction.prepared.name !== 'drag') { + return; + } + + var dropState = interaction.dropState; + fireDropEvents(interaction, dropState.events); + scope.fire('actions/drop:move', { + interaction: interaction, + dragEvent: dragEvent + }); + dropState.events = {}; + }, + 'interactions:action-end': function interactionsActionEnd(arg, scope) { + if (arg.interaction.prepared.name !== 'drag') { + return; + } + + var interaction = arg.interaction, + dragEvent = arg.iEvent; + onEventCreated(arg, scope); + fireDropEvents(interaction, interaction.dropState.events); + scope.fire('actions/drop:end', { + interaction: interaction, + dragEvent: dragEvent + }); + }, + 'interactions:stop': function interactionsStop(_ref14) { + var interaction = _ref14.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, + filterEventType: function filterEventType(type) { + return type.search('drag') === 0 || type.search('drop') === 0; + }, + defaults: { + enabled: false, + accept: null, + overlap: 'pointer' + } + }; + var ___default_3 = drop; + _$plugin_3.default = ___default_3; + var _$plugin_4 = {}; + "use strict"; + + Object.defineProperty(_$plugin_4, "__esModule", { + value: true + }); + _$plugin_4.default = void 0; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + + 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 (_$is_69.default.object(options)) { + this.options.gesture.enabled = options.enabled !== false; + this.setPerAction('gesture', options); + this.setOnEvents('gesture', options); + return this; + } + + if (_$is_69.default.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 = _$pointerUtils_75.touchDistance(pointers, deltaSource); + iEvent.box = _$pointerUtils_75.touchBBox(pointers); + iEvent.scale = 1; + iEvent.ds = 0; + iEvent.angle = _$pointerUtils_75.touchAngle(pointers, deltaSource); + iEvent.da = 0; + interaction.gesture.startDistance = iEvent.distance; + interaction.gesture.startAngle = iEvent.angle; + } else if (ending || interaction.pointers.length < 2) { + 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 = _$pointerUtils_75.touchDistance(pointers, deltaSource); + iEvent.box = _$pointerUtils_75.touchBBox(pointers); + iEvent.scale = iEvent.distance / interaction.gesture.startDistance; + iEvent.angle = _$pointerUtils_75.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 (_$is_69.default.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 ''; + }, + filterEventType: function filterEventType(type) { + return type.search('gesture') === 0; + } + }; + var ___default_4 = gesture; + _$plugin_4.default = ___default_4; + var _$plugin_6 = {}; + "use strict"; + + Object.defineProperty(_$plugin_6, "__esModule", { + value: true + }); + _$plugin_6.default = void 0; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + + 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_66.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_69.default.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_69.default.object(options)) { + interactable.options.resize.enabled = options.enabled !== false; + interactable.setPerAction('resize', options); + interactable.setOnEvents('resize', options); + + if (_$is_69.default.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_69.default.bool(options.preserveAspectRatio)) { + interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio; + } else if (_$is_69.default.bool(options.square)) { + interactable.options.resize.square = options.square; + } + + return interactable; + } + + if (_$is_69.default.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_69.default.number(rect.width) ? rect.width : rect.right - rect.left; + var height = _$is_69.default.number(rect.height) ? rect.height : rect.bottom - rect.top; // don't use margin greater than half the relevent dimension + + margin = Math.min(margin, Math.abs((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') { + var edge = width >= 0 ? rect.left : rect.right; + return page.x < edge + margin; + } + + if (name === 'top') { + var _edge = height >= 0 ? rect.top : rect.bottom; + + return page.y < _edge + 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_69.default.element(element)) { + return false; + } + + return _$is_69.default.element(value) ? // the value is an element to use as a resize handle + value === element : // otherwise check if element matches value as selector + _$domUtils_65.matchesUpTo(element, value, interactableElement); + } + /* eslint-disable multiline-ternary */ + // eslint-disable-next-line @typescript-eslint/consistent-type-imports + + + 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' + }; + } + /* eslint-enable multiline-ternary */ + + + 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_66.default)({}, rect), + corrected: (0, _$extend_66.default)({}, rect), + previous: (0, _$extend_66.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'; + 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_66.default)(previous, corrected); + + if (invertible) { + // if invertible, copy the current rect + (0, _$extend_66.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; + }, + filterEventType: function filterEventType(type) { + return type.search('resize') === 0; + }, + defaultMargin: null + }; + var ___default_6 = resize; + _$plugin_6.default = ___default_6; + var _$plugin_5 = {}; + "use strict"; + + Object.defineProperty(_$plugin_5, "__esModule", { + value: true + }); + _$plugin_5.default = void 0; + /* removed: var _$plugin_1 = require("./drag/plugin"); */ + + ; + /* removed: var _$plugin_3 = require("./drop/plugin"); */ + + ; + /* removed: var _$plugin_4 = require("./gesture/plugin"); */ + + ; + /* removed: var _$plugin_6 = require("./resize/plugin"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + /* eslint-enable import/no-duplicates */ + + var ___default_5 = { + id: 'actions', + install: function install(scope) { + scope.usePlugin(_$plugin_4.default); + scope.usePlugin(_$plugin_6.default); + scope.usePlugin(_$plugin_1.default); + scope.usePlugin(_$plugin_3.default); + } + }; + _$plugin_5.default = ___default_5; + var _$raf_76 = {}; + "use strict"; + + Object.defineProperty(_$raf_76, "__esModule", { + value: true + }); + _$raf_76.default = void 0; + var lastTime = 0; + + var _request; + + var _cancel; + + function __init_76(global) { + _request = global.requestAnimationFrame; + _cancel = global.cancelAnimationFrame; + + if (!_request) { + var vendors = ['ms', 'moz', 'webkit', 'o']; + + for (var _i = 0; _i < vendors.length; _i++) { + var vendor = vendors[_i]; + _request = global["".concat(vendor, "RequestAnimationFrame")]; + _cancel = global["".concat(vendor, "CancelAnimationFrame")] || global["".concat(vendor, "CancelRequestAnimationFrame")]; + } + } + + _request = _request && _request.bind(global); + _cancel = _cancel && _cancel.bind(global); + + if (!_request) { + _request = function request(callback) { + var currTime = Date.now(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); + var token = global.setTimeout(function () { + // eslint-disable-next-line n/no-callback-literal + callback(currTime + timeToCall); + }, timeToCall); + lastTime = currTime + timeToCall; + return token; + }; + + _cancel = function cancel(token) { + return clearTimeout(token); + }; + } + } + + var ___default_76 = { + request: function request(callback) { + return _request(callback); + }, + cancel: function cancel(token) { + return _cancel(token); + }, + init: __init_76 + }; + _$raf_76.default = ___default_76; + var _$plugin_7 = {}; + "use strict"; + + Object.defineProperty(_$plugin_7, "__esModule", { + value: true + }); + _$plugin_7.default = void 0; + _$plugin_7.getContainer = getContainer; + _$plugin_7.getScroll = getScroll; + _$plugin_7.getScrollSize = getScrollSize; + _$plugin_7.getScrollSizeDelta = getScrollSizeDelta; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$raf_76 = require("@interactjs/utils/raf"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$window_78 = require("@interactjs/utils/window"); */ + + ; + + 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 + // Direction each pulse is to scroll in + x: 0, + y: 0, + isScrolling: false, + prevTime: 0, + margin: 0, + speed: 0, + start: function start(interaction) { + autoScroll.isScrolling = true; + + _$raf_76.default.cancel(autoScroll.i); + + interaction.autoScroll = autoScroll; + autoScroll.interaction = interaction; + autoScroll.prevTime = autoScroll.now(); + autoScroll.i = _$raf_76.default.request(autoScroll.scroll); + }, + stop: function stop() { + autoScroll.isScrolling = false; + + if (autoScroll.interaction) { + autoScroll.interaction.autoScroll = null; + } + + _$raf_76.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_69.default.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_76.default.cancel(autoScroll.i); + + autoScroll.i = _$raf_76.default.request(autoScroll.scroll); + } + }, + check: function check(interactable, actionName) { + var _options$actionName$a; + + var options = interactable.options; + return (_options$actionName$a = options[actionName].autoScroll) == null ? void 0 : _options$actionName$a.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_69.default.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_65.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_69.default.string(value) ? (0, _$rect_77.getStringOptionResult)(value, interactable, element) : value) || (0, _$window_78.getWindow)(element); + } + + function getScroll(container) { + if (_$is_69.default.window(container)) { + container = window.document.body; + } + + return { + x: container.scrollLeft, + y: container.scrollTop + }; + } + + function getScrollSize(container) { + if (_$is_69.default.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; + _$plugin_7.default = ___default_7; + var _$misc_72 = {}; + "use strict"; + + Object.defineProperty(_$misc_72, "__esModule", { + value: true + }); + _$misc_72.copyAction = copyAction; + _$misc_72.sign = void 0; + _$misc_72.warnOnce = warnOnce; + /* removed: var _$window_78 = require("./window"); */ + + ; + + function warnOnce(method, message) { + var warned = false; + return function () { + if (!warned) { + ; + + _$window_78.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 sign = function sign(n) { + return n >= 0 ? 1 : -1; + }; + + _$misc_72.sign = sign; + var _$InteractableMethods_8 = {}; + "use strict"; + + Object.defineProperty(_$InteractableMethods_8, "__esModule", { + value: true + }); + _$InteractableMethods_8.default = void 0; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$misc_72 = require("@interactjs/utils/misc"); */ + + ; + + 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; + }; + /** + * 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. + * + * @deprecated + * Don't use this method. Instead set the `ignoreFrom` option for each action + * or for `pointerEvents` + * + * ```js + * 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, _$misc_72.warnOnce)(function (newValue) { + return this._backCompatOption('ignoreFrom', newValue); + }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).'); + /** + * + * 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. + * + * @deprecated + * Don't use this method. Instead set the `allowFrom` option for each action + * or for `pointerEvents` + * + * ```js + * 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, _$misc_72.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_69.default.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_69.default.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"; + + Object.defineProperty(_$base_9, "__esModule", { + value: true + }); + _$base_9.default = void 0; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$misc_72 = require("@interactjs/utils/misc"); */ + + ; + /* removed: var _$InteractableMethods_8 = require("./InteractableMethods"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + function __install_9(scope) { + var interact = scope.interactStatic, + defaults = scope.defaults; + scope.usePlugin(_$InteractableMethods_8.default); + defaults.base.actionChecker = null; + defaults.base.styleCursor = true; + (0, _$extend_66.default)(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 (_$is_69.default.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 = _$domUtils_65.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; + (0, _$misc_72.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 (_$is_69.default.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 (_$is_69.default.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'], + 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"; + + Object.defineProperty(_$dragAxis_10, "__esModule", { + value: true + }); + _$dragAxis_10.default = void 0; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$base_9 = require("./base"); */ + + ; + + 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_9.default.validateAction(action, interactable, element, eventTarget, scope)) { + return interactable; + } + } + }; // check all interactables + + + while (_$is_69.default.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_65.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; + /* removed: var _$base_9 = require("./base"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + function __install_11(scope) { + var defaults = scope.defaults; + scope.usePlugin(_$base_9.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 hold = { + 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.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) { + clearTimeout(interaction.autoStartHoldTimer); + interaction.autoStartHoldTimer = null; + } + }, + // prevent regular down->move autoStart + 'autoStart:before-start': function autoStartBeforeStart(_ref4) { + var interaction = _ref4.interaction; + var holdDuration = getHoldDuration(interaction); + + if (holdDuration > 0) { + interaction.prepared.name = null; + } + } + }, + getHoldDuration: getHoldDuration + }; + var ___default_11 = hold; + _$hold_11.default = ___default_11; + var _$plugin_12 = {}; + "use strict"; + + Object.defineProperty(_$plugin_12, "__esModule", { + value: true + }); + _$plugin_12.default = void 0; + /* removed: var _$base_9 = require("./base"); */ + + ; + /* removed: var _$dragAxis_10 = require("./dragAxis"); */ + + ; + /* removed: var _$hold_11 = require("./hold"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + /* eslint-enable import/no-duplicates */ + + var ___default_12 = { + id: 'auto-start', + install: function install(scope) { + scope.usePlugin(_$base_9.default); + scope.usePlugin(_$hold_11.default); + scope.usePlugin(_$dragAxis_10.default); + } + }; + _$plugin_12.default = ___default_12; + var _$interactablePreventDefault_22 = {}; + "use strict"; + + Object.defineProperty(_$interactablePreventDefault_22, "__esModule", { + value: true + }); + _$interactablePreventDefault_22.default = void 0; + _$interactablePreventDefault_22.install = __install_22; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$window_78 = require("@interactjs/utils/window"); */ + + ; + + function preventDefault(newValue) { + if (/^(always|never|auto)$/.test(newValue)) { + this.options.preventDefault = newValue; + return this; + } + + if (_$is_69.default.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 (scope.events.supportsPassive && /^touch(start|move)$/.test(event.type)) { + var doc = (0, _$window_78.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_69.default.element(event.target) && (0, _$domUtils_65.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_22(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_65.nodeContains)(interaction.element, event.target))) { + interaction.interactable.checkAndPreventDefault(event); + return; + } + } + } + }); + } + + var ___default_22 = { + id: 'core/interactablePreventDefault', + install: __install_22, + listeners: ['down', 'move', 'up', 'cancel'].reduce(function (acc, eventType) { + acc["interactions:".concat(eventType)] = onInteractionEvent; + return acc; + }, {}) + }; + _$interactablePreventDefault_22.default = ___default_22; + var _$plugin_28 = {}; + "use strict"; + + Object.defineProperty(_$plugin_28, "__esModule", { + value: true + }); + _$plugin_28.default = void 0; + var ___default_28 = {}; + _$plugin_28.default = ___default_28; + var _$isNonNativeEvent_70 = {}; + "use strict"; + + Object.defineProperty(_$isNonNativeEvent_70, "__esModule", { + value: true + }); + _$isNonNativeEvent_70.default = isNonNativeEvent; + + 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; + } + + var _$plugin_27 = {}; + "use strict"; + + Object.defineProperty(_$plugin_27, "__esModule", { + value: true + }); + _$plugin_27.default = void 0; + /* removed: var _$plugin_28 = require("@interactjs/dev-tools/visualizer/plugin"); */ + + ; + /* removed: var _$domObjects_64 = require("@interactjs/utils/domObjects"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$isNonNativeEvent_70 = require("@interactjs/utils/isNonNativeEvent"); */ + + ; + /* removed: var _$normalizeListeners_73 = require("@interactjs/utils/normalizeListeners"); */ + + ; + /* removed: var _$window_78 = require("@interactjs/utils/window"); */ + + ; + + function ___toConsumableArray_27(arr) { + return ___arrayWithoutHoles_27(arr) || ___iterableToArray_27(arr) || ___unsupportedIterableToArray_27(arr) || ___nonIterableSpread_27(); + } + + function ___nonIterableSpread_27() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function ___unsupportedIterableToArray_27(o, minLen) { + if (!o) return; + if (typeof o === "string") return ___arrayLikeToArray_27(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ___arrayLikeToArray_27(o, minLen); + } + + function ___iterableToArray_27(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + + function ___arrayWithoutHoles_27(arr) { + if (Array.isArray(arr)) return ___arrayLikeToArray_27(arr); + } + + function ___arrayLikeToArray_27(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; 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' + }; // eslint-disable-next-line no-undef + + var isProduction = "development" === 'production'; + + function __install_27(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_66.default)(this.options.devTools, options); + return this; + } + + return this.options.devTools; + }; // can't set native events on non string targets without `addEventListener` prop + + + var _onOff = Interactable.prototype._onOff; + + Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) { + if (_$is_69.default.string(this.target) || this.target.addEventListener) { + return _onOff.call(this, method, typeArg, listenerArg, options, filter); + } + + if (_$is_69.default.object(typeArg) && !_$is_69.default.array(typeArg)) { + options = listenerArg; + listenerArg = null; + } + + var normalizedListeners = (0, _$normalizeListeners_73.default)(typeArg, listenerArg, filter); + + for (var type in normalizedListeners) { + if ((0, _$isNonNativeEvent_70.default)(type, scope.actions)) continue; + scope.logger.warn(prefix + "Can't add native \"".concat(type, "\" event listener to target without `addEventListener(type, listener, options)` prop.")); + } + + return _onOff.call(this, method, normalizedListeners, options); + }; + + scope.usePlugin(_$plugin_28.default); + } + + var checks = [{ + name: CheckName.touchAction, + perform: function perform(_ref2) { + var element = _ref2.element; + return !!element && !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_64.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 _interaction$interact; + + var actionName = interaction.prepared.name; + var moveListeners = ((_interaction$interact = interaction.interactable) == null ? void 0 : _interaction$interact.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) { + var value = element.style[prop] || _$window_78.window.getComputedStyle(element)[prop]; + + return styleRe.test((value || '').toString()); + } + + function parentHasStyle(element, prop, styleRe) { + var parent = element; + + while (_$is_69.default.element(parent)) { + if (hasStyle(parent, prop, styleRe)) { + return true; + } + + parent = (0, _$domUtils_65.parentNode)(parent); + } + + return false; + } + + var id = 'dev-tools'; + var defaultExport = isProduction ? { + id: id, + install: function install() {} + } : { + id: id, + install: __install_27, + 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_27(check.getInfo(interaction)))); + } + } + } + }, + checks: checks, + CheckName: CheckName, + links: links, + prefix: prefix + }; + var ___default_27 = defaultExport; + _$plugin_27.default = ___default_27; + var _$clone_63 = {}; + "use strict"; + + Object.defineProperty(_$clone_63, "__esModule", { + value: true + }); + _$clone_63.default = clone; + /* removed: var _$arr_61 = require("./arr"); */ + + ; + /* removed: var _$is_69 = require("./is"); */ + + ; // tslint:disable-next-line ban-types + + function clone(source) { + var dest = {}; + + for (var prop in source) { + var value = source[prop]; + + if (_$is_69.default.plainObject(value)) { + dest[prop] = clone(value); + } else if (_$is_69.default.array(value)) { + dest[prop] = _$arr_61.from(value); + } else { + dest[prop] = value; + } + } + + return dest; + } + + var _$Modification_32 = {}; + "use strict"; + + Object.defineProperty(_$Modification_32, "__esModule", { + value: true + }); + _$Modification_32.default = void 0; + _$Modification_32.getRectOffset = getRectOffset; + /* removed: var _$clone_63 = require("@interactjs/utils/clone"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || ___unsupportedIterableToArray_32(arr, i) || _nonIterableRest(); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function ___unsupportedIterableToArray_32(o, minLen) { + if (!o) return; + if (typeof o === "string") return ___arrayLikeToArray_32(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ___arrayLikeToArray_32(o, minLen); + } + + function ___arrayLikeToArray_32(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function _iterableToArrayLimit(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_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_32(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperties_32(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_32(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_32(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_32(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___defineProperty_32(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_32(this, Modification); + + ___defineProperty_32(this, "states", []); + + ___defineProperty_32(this, "startOffset", { + left: 0, + right: 0, + top: 0, + bottom: 0 + }); + + ___defineProperty_32(this, "startDelta", void 0); + + ___defineProperty_32(this, "result", void 0); + + ___defineProperty_32(this, "endResult", void 0); + + ___defineProperty_32(this, "startEdges", void 0); + + ___defineProperty_32(this, "edges", void 0); + + ___defineProperty_32(this, "interaction", void 0); + + this.interaction = interaction; + this.result = createResult(); + this.edges = { + left: false, + right: false, + top: false, + bottom: false + }; + } + + ___createClass_32(Modification, [{ + key: "start", + value: function start(_ref, pageCoords) { + var phase = _ref.phase; + var interaction = this.interaction; + var modifierList = getModifierList(interaction); + this.prepareStates(modifierList); + this.startEdges = (0, _$extend_66.default)({}, interaction.edges); + this.edges = (0, _$extend_66.default)({}, this.startEdges); + this.startOffset = getRectOffset(interaction.rect, pageCoords); + this.startDelta = { + x: 0, + y: 0 + }; + var arg = this.fillArg({ + 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 || (arg.edges = this.startEdges); + arg.startOffset = this.startOffset; + return arg; + } + }, { + key: "startAll", + value: function startAll(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) { + var phase = arg.phase, + preEnd = arg.preEnd, + skipModifiers = arg.skipModifiers, + unmodifiedRect = arg.rect, + unmodifiedEdges = arg.edges; + arg.coords = (0, _$extend_66.default)({}, arg.pageCoords); + arg.rect = (0, _$extend_66.default)({}, unmodifiedRect); + arg.edges = (0, _$extend_66.default)({}, unmodifiedEdges); + 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 _state$methods; + + var _ref3; + + _ref3 = states[_i2]; + var state = _ref3; + var options = state.options; + var lastModifierCoords = (0, _$extend_66.default)({}, arg.coords); + var returnValue = null; + + if ((_state$methods = state.methods) != null && _state$methods.set && this.shouldDo(options, preEnd, phase)) { + arg.state = state; + returnValue = state.methods.set(arg); + + _$rect_77.addEdges(arg.edges, arg.rect, { + x: arg.coords.x - lastModifierCoords.x, + y: arg.coords.y - lastModifierCoords.y + }); + } + + newResult.eventProps.push(returnValue); + } + + (0, _$extend_66.default)(this.edges, arg.edges); + 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; + + if (prevCoords && prevRect) { + var rectChanged = 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; + } + + 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_66.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(_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(this.fillArg({ + 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, arg.phase, 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_66.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; + 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(_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, requireEndOnly) { + if ( // ignore disabled modifiers + !options || options.enabled === false || // check if we require endOnly option to fire move before end + requireEndOnly && !options.endOnly || // don't apply endOnly modifiers when not ending + options.endOnly && !preEnd || // check if modifier should run be applied on start + phase === 'start' && !options.setStart) { + return false; + } + + return true; + } + }, { + key: "copyFrom", + value: function copyFrom(other) { + this.startOffset = other.startOffset; + this.startDelta = other.startDelta; + this.startEdges = other.startEdges; + this.edges = other.edges; + this.states = other.states.map(function (s) { + return (0, _$clone_63.default)(s); + }); + this.result = createResult((0, _$extend_66.default)({}, other.result.coords), (0, _$extend_66.default)({}, other.result.rect)); + } + }, { + key: "destroy", + value: function destroy() { + for (var prop in this) { + this[prop] = null; + } + } + }]); + + return Modification; + }(); + + _$Modification_32.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; + } + + 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_36 = {}; + "use strict"; + + Object.defineProperty(_$base_36, "__esModule", { + value: true + }); + _$base_36.addEventModifiers = addEventModifiers; + _$base_36.default = void 0; + _$base_36.makeModifier = makeModifier; + /* removed: var _$Modification_32 = require("./Modification"); */ + + ; + + 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, + enable: function enable() { + options.enabled = true; + return m; + }, + disable: function disable() { + options.enabled = false; + return m; + } + }; + 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, + interaction = _ref.interaction; + var result = interaction.modification.result; + + if (result) { + iEvent.modifiers = result.eventProps; + } + } + + var modifiersBase = { + id: 'modifiers/base', + before: ['actions'], + install: function install(scope) { + scope.defaults.perAction.modifiers = []; + }, + listeners: { + 'interactions:new': function interactionsNew(_ref2) { + var interaction = _ref2.interaction; + interaction.modification = new _$Modification_32.default(interaction); + }, + 'interactions:before-action-start': function interactionsBeforeActionStart(arg) { + var interaction = arg.interaction; + var modification = arg.interaction.modification; + modification.start(arg, interaction.coords.start.page); + interaction.edges = modification.edges; + modification.applyToInteraction(arg); + }, + 'interactions:before-action-move': function interactionsBeforeActionMove(arg) { + var interaction = arg.interaction; + var modification = interaction.modification; + var ret = modification.setAndApply(arg); + interaction.edges = modification.edges; + return ret; + }, + 'interactions:before-action-end': function interactionsBeforeActionEnd(arg) { + var interaction = arg.interaction; + var modification = interaction.modification; + var ret = modification.beforeEnd(arg); + interaction.edges = modification.startEdges; + return ret; + }, + '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); + } + } + }; + var ___default_36 = modifiersBase; + _$base_36.default = ___default_36; + var _$options_25 = {}; + "use strict"; + + Object.defineProperty(_$options_25, "__esModule", { + value: true + }); + _$options_25.defaults = void 0; // eslint-disable-next-line @typescript-eslint/no-empty-interface + + var defaults = { + base: { + preventDefault: 'auto', + deltaSource: 'page' + }, + perAction: { + enabled: false, + origin: { + x: 0, + y: 0 + } + }, + actions: {} + }; + _$options_25.defaults = defaults; + var _$InteractEvent_15 = {}; + "use strict"; + + function ___typeof_15(obj) { + "@babel/helpers - typeof"; + + return ___typeof_15 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, ___typeof_15(obj); + } + + Object.defineProperty(_$InteractEvent_15, "__esModule", { + value: true + }); + _$InteractEvent_15.InteractEvent = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$getOriginXY_67 = require("@interactjs/utils/getOriginXY"); */ + + ; + /* removed: var _$hypot_68 = require("@interactjs/utils/hypot"); */ + + ; + /* removed: var _$BaseEvent_13 = require("./BaseEvent"); */ + + ; + /* removed: var _$options_25 = require("./options"); */ + + ; + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___inherits_15(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 + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) ___setPrototypeOf_15(subClass, superClass); + } + + function ___setPrototypeOf_15(o, p) { + ___setPrototypeOf_15 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return ___setPrototypeOf_15(o, p); + } + + function ___createSuper_15(Derived) { + var hasNativeReflectConstruct = ___isNativeReflectConstruct_15(); + + return function _createSuperInternal() { + var Super = ___getPrototypeOf_15(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = ___getPrototypeOf_15(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return ___possibleConstructorReturn_15(this, result); + }; + } + + function ___possibleConstructorReturn_15(self, call) { + if (call && (___typeof_15(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + + return ___assertThisInitialized_15(self); + } + + function ___assertThisInitialized_15(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function ___isNativeReflectConstruct_15() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function ___getPrototypeOf_15(o) { + ___getPrototypeOf_15 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return ___getPrototypeOf_15(o); + } + + 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_15(InteractEvent, _BaseEvent); + + var _super = ___createSuper_15(InteractEvent); // resize + + /** */ + + + function InteractEvent(interaction, event, actionName, phase, element, preEnd, type) { + var _this; + + ___classCallCheck_15(this, InteractEvent); + + _this = _super.call(this, interaction); + + ___defineProperty_15(___assertThisInitialized_15(_this), "relatedTarget", null); + + ___defineProperty_15(___assertThisInitialized_15(_this), "screenX", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "screenY", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "button", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "buttons", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "ctrlKey", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "shiftKey", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "altKey", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "metaKey", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "page", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "client", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "delta", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "rect", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "x0", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "y0", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "t0", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "dt", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "duration", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "clientX0", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "clientY0", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "velocity", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "speed", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "swipe", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "axes", void 0); + + ___defineProperty_15(___assertThisInitialized_15(_this), "preEnd", void 0); + + element = element || interaction.element; + var target = interaction.interactable; + var deltaSource = (target && target.options || _$options_25.defaults).deltaSource; + var origin = (0, _$getOriginXY_67.default)(target, element, actionName); + var starting = phase === 'start'; + var ending = phase === 'end'; + var prevEvent = starting ? ___assertThisInitialized_15(_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_66.default)({}, coords.page); + _this.client = (0, _$extend_66.default)({}, coords.client); + _this.rect = (0, _$extend_66.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_66.default)({}, interaction.coords.velocity[deltaSource]); + _this.speed = (0, _$hypot_68.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; + } + }]); + + return InteractEvent; + }(_$BaseEvent_13.BaseEvent); // getters and setters defined here to support typescript 3.6 and below which + // don't support getter and setters in .d.ts files + + + _$InteractEvent_15.InteractEvent = InteractEvent; + Object.defineProperties(InteractEvent.prototype, { + pageX: { + get: function get() { + return this.page.x; + }, + set: function set(value) { + this.page.x = value; + } + }, + pageY: { + get: function get() { + return this.page.y; + }, + set: function set(value) { + this.page.y = value; + } + }, + clientX: { + get: function get() { + return this.client.x; + }, + set: function set(value) { + this.client.x = value; + } + }, + clientY: { + get: function get() { + return this.client.y; + }, + set: function set(value) { + this.client.y = value; + } + }, + dx: { + get: function get() { + return this.delta.x; + }, + set: function set(value) { + this.delta.x = value; + } + }, + dy: { + get: function get() { + return this.delta.y; + }, + set: function set(value) { + this.delta.y = value; + } + }, + velocityX: { + get: function get() { + return this.velocity.x; + }, + set: function set(value) { + this.velocity.x = value; + } + }, + velocityY: { + get: function get() { + return this.velocity.y; + }, + set: function set(value) { + this.velocity.y = value; + } + } + }); + var _$PointerInfo_20 = {}; + "use strict"; + + Object.defineProperty(_$PointerInfo_20, "__esModule", { + value: true + }); + _$PointerInfo_20.PointerInfo = void 0; + + function ___defineProperties_20(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_20(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_20(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_20(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___classCallCheck_20(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperty_20(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 PointerInfo = /*#__PURE__*/___createClass_20(function PointerInfo(id, pointer, event, downTime, downTarget) { + ___classCallCheck_20(this, PointerInfo); + + ___defineProperty_20(this, "id", void 0); + + ___defineProperty_20(this, "pointer", void 0); + + ___defineProperty_20(this, "event", void 0); + + ___defineProperty_20(this, "downTime", void 0); + + ___defineProperty_20(this, "downTarget", void 0); + + this.id = id; + this.pointer = pointer; + this.event = event; + this.downTime = downTime; + this.downTarget = downTarget; + }); + + _$PointerInfo_20.PointerInfo = PointerInfo; + var _$Interaction_19 = {}; + "use strict"; + + Object.defineProperty(_$Interaction_19, "__esModule", { + value: true + }); + _$Interaction_19.Interaction = void 0; + Object.defineProperty(_$Interaction_19, "PointerInfo", { + enumerable: true, + get: function get() { + return _$PointerInfo_20.PointerInfo; + } + }); + _$Interaction_19.default = _$Interaction_19._ProxyValues = _$Interaction_19._ProxyMethods = void 0; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$hypot_68 = require("@interactjs/utils/hypot"); */ + + ; + /* removed: var _$misc_72 = require("@interactjs/utils/misc"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$InteractEvent_15 = require("./InteractEvent"); */ + + ; + /* removed: var _$PointerInfo_20 = require("./PointerInfo"); */ + + ; + + function ___classCallCheck_19(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperties_19(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_19(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_19(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_19(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___defineProperty_19(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_19._ProxyValues = _ProxyValues; + + (function (_ProxyValues) { + _ProxyValues["interactable"] = ""; + _ProxyValues["element"] = ""; + _ProxyValues["prepared"] = ""; + _ProxyValues["pointerIsDown"] = ""; + _ProxyValues["pointerWasMoved"] = ""; + _ProxyValues["_proxy"] = ""; + })(_ProxyValues || (_$Interaction_19._ProxyValues = _ProxyValues = {})); + + var _ProxyMethods; + + _$Interaction_19._ProxyMethods = _ProxyMethods; + + (function (_ProxyMethods) { + _ProxyMethods["start"] = ""; + _ProxyMethods["move"] = ""; + _ProxyMethods["end"] = ""; + _ProxyMethods["stop"] = ""; + _ProxyMethods["interacting"] = ""; + })(_ProxyMethods || (_$Interaction_19._ProxyMethods = _ProxyMethods = {})); + + var idCounter = 0; + + var Interaction = /*#__PURE__*/function () { + /** */ + function Interaction(_ref) { + var _this = this; + + var pointerType = _ref.pointerType, + scopeFire = _ref.scopeFire; + + ___classCallCheck_19(this, Interaction); + + ___defineProperty_19(this, "interactable", null); + + ___defineProperty_19(this, "element", null); + + ___defineProperty_19(this, "rect", null); + + ___defineProperty_19(this, "_rects", void 0); + + ___defineProperty_19(this, "edges", null); + + ___defineProperty_19(this, "_scopeFire", void 0); + + ___defineProperty_19(this, "prepared", { + name: null, + axis: null, + edges: null + }); + + ___defineProperty_19(this, "pointerType", void 0); + + ___defineProperty_19(this, "pointers", []); + + ___defineProperty_19(this, "downEvent", null); + + ___defineProperty_19(this, "downPointer", {}); + + ___defineProperty_19(this, "_latestPointer", { + pointer: null, + event: null, + eventTarget: null + }); + + ___defineProperty_19(this, "prevEvent", null); + + ___defineProperty_19(this, "pointerIsDown", false); + + ___defineProperty_19(this, "pointerWasMoved", false); + + ___defineProperty_19(this, "_interacting", false); + + ___defineProperty_19(this, "_ending", false); + + ___defineProperty_19(this, "_stopped", true); + + ___defineProperty_19(this, "_proxy", void 0); + + ___defineProperty_19(this, "simulation", null); + + ___defineProperty_19(this, "doMove", (0, _$misc_72.warnOnce)(function (signalArg) { + this.move(signalArg); + }, 'The interaction.doMove() method has been renamed to interaction.move()')); + + ___defineProperty_19(this, "coords", { + // Starting InteractEvent pointer coordinates + start: _$pointerUtils_75.newCoords(), + // Previous native pointer move event coordinates + prev: _$pointerUtils_75.newCoords(), + // current native pointer move event coordinates + cur: _$pointerUtils_75.newCoords(), + // Change in coordinates and time of the pointer + delta: _$pointerUtils_75.newCoords(), + // pointer velocity + velocity: _$pointerUtils_75.newCoords() + }); + + ___defineProperty_19(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_19(Interaction, [{ + key: "pointerMoveTolerance", + get: // 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 + + /** @internal */ + function get() { + return 1; + } + /** + * @alias Interaction.prototype.move + */ + + }, { + 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 {Boolean} Whether the interaction was successfully started + */ + + }, { + 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; + } + + (0, _$misc_72.copyAction)(this.prepared, action); + this.interactable = interactable; + this.element = element; + this.rect = interactable.getRect(element); + this.edges = this.prepared.edges ? (0, _$extend_66.default)({}, 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 = (0, _$hypot_68.default)(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 + _$pointerUtils_75.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) { + _$pointerUtils_75.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) { + _$pointerUtils_75.setZeroCoords(this.coords.delta); + } + + signalArg = (0, _$extend_66.default)({ + 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.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 = _$pointerUtils_75.getPointerId(pointer); // mouse and pen interactions may have only one pointer + + + return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : _$arr_61.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 = _$pointerUtils_75.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_20.PointerInfo(id, pointer, event, null, null); + pointerIndex = this.pointers.length; + this.pointers.push(pointerInfo); + } else { + pointerInfo.pointer = pointer; + } + + _$pointerUtils_75.setCoords(this.coords.cur, this.pointers.map(function (p) { + return p.pointer; + }), this._now()); + + _$pointerUtils_75.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur); + + if (down) { + this.pointerIsDown = true; + pointerInfo.downTime = this.coords.cur.timeStamp; + pointerInfo.downTarget = eventTarget; + + _$pointerUtils_75.pointerExtend(this.downPointer, pointer); + + if (!this.interacting()) { + _$pointerUtils_75.copyCoords(this.coords.start, this.coords.cur); + + _$pointerUtils_75.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); + this.pointerIsDown = false; + } + }, { + 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_15.InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type); + } + }, { + key: "_fireEvent", + value: function _fireEvent(iEvent) { + var _this$interactable; + + (_this$interactable = this.interactable) == null ? void 0 : _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 + _$rect_77.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_19.Interaction = Interaction; + var ___default_19 = Interaction; + _$Interaction_19.default = ___default_19; + var _$plugin_49 = {}; + "use strict"; + + Object.defineProperty(_$plugin_49, "__esModule", { + value: true + }); + _$plugin_49.addTotal = addTotal; + _$plugin_49.applyPending = applyPending; + _$plugin_49.default = void 0; + /* removed: var _$Interaction_19 = require("@interactjs/core/Interaction"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + ; + _$Interaction_19._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_49(_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); + + _$rect_77.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', + before: ['modifiers', 'pointer-events', 'actions', 'inertia'], + 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_49 + } + }; + var ___default_49 = offset; + _$plugin_49.default = ___default_49; + var _$plugin_29 = {}; + "use strict"; + + Object.defineProperty(_$plugin_29, "__esModule", { + value: true + }); + _$plugin_29.default = _$plugin_29.InertiaState = void 0; + /* removed: var _$Modification_32 = require("@interactjs/modifiers/Modification"); */ + + ; + /* removed: var _$base_36 = require("@interactjs/modifiers/base"); */ + + ; + /* removed: var _$plugin_49 = require("@interactjs/offset/plugin"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$hypot_68 = require("@interactjs/utils/hypot"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + /* removed: var _$raf_76 = require("@interactjs/utils/raf"); */ + + ; + + function ___classCallCheck_29(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperties_29(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_29(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_29(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_29(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___defineProperty_29(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_29(scope) { + var defaults = scope.defaults; + scope.usePlugin(_$plugin_49.default); + scope.usePlugin(_$base_36.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_29(this, InertiaState); + + ___defineProperty_29(this, "active", false); + + ___defineProperty_29(this, "isModified", false); + + ___defineProperty_29(this, "smoothEnd", false); + + ___defineProperty_29(this, "allowResume", false); + + ___defineProperty_29(this, "modification", void 0); + + ___defineProperty_29(this, "modifierCount", 0); + + ___defineProperty_29(this, "modifierArg", void 0); + + ___defineProperty_29(this, "startCoords", void 0); + + ___defineProperty_29(this, "t0", 0); + + ___defineProperty_29(this, "v0", 0); + + ___defineProperty_29(this, "te", 0); + + ___defineProperty_29(this, "targetOffset", void 0); + + ___defineProperty_29(this, "modifiedOffset", void 0); + + ___defineProperty_29(this, "currentOffset", void 0); + + ___defineProperty_29(this, "lambda_v0", 0); + + ___defineProperty_29(this, "one_ve_v0", 0); + + ___defineProperty_29(this, "timeout", void 0); + + ___defineProperty_29(this, "interaction", void 0); + + this.interaction = interaction; + } + + ___createClass_29(InertiaState, [{ + key: "start", + value: function start(event) { + var interaction = this.interaction; + var options = getOptions(interaction); + + if (!options || !options.enabled) { + return false; + } + + var velocityClient = interaction.coords.velocity.client; + var pointerSpeed = (0, _$hypot_68.default)(velocityClient.x, velocityClient.y); + var modification = this.modification || (this.modification = new _$Modification_32.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 = modification.fillArg({ + 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(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.onNextFrame(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.onNextFrame(function () { + return _this2.smoothEndTick(); + }); + } + }, { + key: "onNextFrame", + value: function onNextFrame(tickFn) { + var _this3 = this; + + this.timeout = _$raf_76.default.request(function () { + if (_this3.active) { + tickFn(); + } + }); + } + }, { + key: "inertiaTick", + value: function inertiaTick() { + var _this4 = this; + + var interaction = this.interaction; + var options = getOptions(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.onNextFrame(function () { + return _this4.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 _this5 = this; + + var interaction = this.interaction; + var t = interaction._now() - this.t0; + + var _getOptions = getOptions(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.onNextFrame(function () { + return _this5.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_75.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_76.default.cancel(this.timeout); + } + }]); + + return InertiaState; + }(); + + _$plugin_29.InertiaState = InertiaState; + + function __start_29(_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_69.default.element(element)) { + // if interaction element is the current inertia target element + if (element === interaction.element) { + state.resume(arg); + break; + } + + element = _$domUtils_65.parentNode(element); + } + } + + function stop(_ref3) { + var interaction = _ref3.interaction; + var state = interaction.inertia; + + if (state.active) { + state.stop(); + } + } + + function getOptions(_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', 'actions'], + install: __install_29, + listeners: { + 'interactions:new': function interactionsNew(_ref5) { + var interaction = _ref5.interaction; + interaction.inertia = new InertiaState(interaction); + }, + 'interactions:before-action-end': __start_29, + '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': _$base_36.addEventModifiers, + 'interactions:action-inertiastart': _$base_36.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_29 = inertia; + _$plugin_29.default = ___default_29; + var _$Eventable_14 = {}; + "use strict"; + + Object.defineProperty(_$Eventable_14, "__esModule", { + value: true + }); + _$Eventable_14.Eventable = void 0; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$normalizeListeners_73 = require("@interactjs/utils/normalizeListeners"); */ + + ; + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + 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_66.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_73.default)(type, listener); + + for (type in listeners) { + this.types[type] = _$arr_61.merge(this.types[type] || [], listeners[type]); + } + } + }, { + key: "off", + value: function off(type, listener) { + var listeners = (0, _$normalizeListeners_73.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; + }(); + + _$Eventable_14.Eventable = Eventable; + var _$InteractStatic_16 = {}; + "use strict"; + + Object.defineProperty(_$InteractStatic_16, "__esModule", { + value: true + }); + _$InteractStatic_16.createInteractStatic = createInteractStatic; + /* removed: var _$browser_62 = require("@interactjs/utils/browser"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$isNonNativeEvent_70 = require("@interactjs/utils/isNonNativeEvent"); */ + + ; + /* removed: var _$misc_72 = require("@interactjs/utils/misc"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + /** @module interact */ + + function createInteractStatic(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} + */ + var interact = function interact(target, options) { + var interactable = scope.interactables.getExisting(target, options); + + if (!interactable) { + interactable = scope.interactables.new(target, options); + interactable.events.global = interact.globalEvents; + } + + return interactable; + }; // expose the functions used to calculate multi-touch properties + + + interact.getPointerAverage = _$pointerUtils_75.pointerAverage; + interact.getTouchBBox = _$pointerUtils_75.touchBBox; + interact.getTouchDistance = _$pointerUtils_75.touchDistance; + interact.getTouchAngle = _$pointerUtils_75.touchAngle; + interact.getElementRect = _$domUtils_65.getElementRect; + interact.getElementClientRect = _$domUtils_65.getElementClientRect; + interact.matchesSelector = _$domUtils_65.matchesSelector; + interact.closest = _$domUtils_65.closest; + interact.globalEvents = {}; // eslint-disable-next-line no-undef + + interact.version = "1.10.23"; + interact.scope = scope; + /** + * Use a plugin + * + * @alias module:interact.use + * + */ + + interact.use = function (plugin, options) { + this.scope.usePlugin(plugin, options); + return this; + }; + /** + * Check if an element or selector has been set with the {@link interact} + * function + * + * @alias module:interact.isSet + * + * @param {Target} target The Element or string being searched for + * @param {object} options + * @return {boolean} Indicates if the element or CSS selector was previously + * passed to interact + */ + + + interact.isSet = function (target, options) { + return !!this.scope.interactables.get(target, options && options.context); + }; + /** + * @deprecated + * 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 = (0, _$misc_72.warnOnce)(function on(type, listener, options) { + if (_$is_69.default.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (_$is_69.default.array(type)) { + for (var _i = 0; _i < type.length; _i++) { + var _ref; + + _ref = type[_i]; + var eventType = _ref; + this.on(eventType, listener, options); + } + + return this; + } + + if (_$is_69.default.object(type)) { + for (var prop in type) { + this.on(prop, type[prop], listener); + } + + return this; + } // if it is an InteractEvent type, add listener to globalEvents + + + if ((0, _$isNonNativeEvent_70.default)(type, this.scope.actions)) { + // if this type of event was never bound + if (!this.globalEvents[type]) { + this.globalEvents[type] = [listener]; + } else { + this.globalEvents[type].push(listener); + } + } // If non InteractEvent type, addEventListener to document + else { + this.scope.events.add(this.scope.document, type, listener, { + options: options + }); + } + + return this; + }, 'The interact.on() method is being deprecated'); + /** + * @deprecated + * 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 = (0, _$misc_72.warnOnce)(function off(type, listener, options) { + if (_$is_69.default.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (_$is_69.default.array(type)) { + for (var _i2 = 0; _i2 < type.length; _i2++) { + var _ref2; + + _ref2 = type[_i2]; + var eventType = _ref2; + this.off(eventType, listener, options); + } + + return this; + } + + if (_$is_69.default.object(type)) { + for (var prop in type) { + this.off(prop, type[prop], listener); + } + + return this; + } + + if ((0, _$isNonNativeEvent_70.default)(type, this.scope.actions)) { + var index; + + if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) { + this.globalEvents[type].splice(index, 1); + } + } else { + this.scope.events.remove(this.scope.document, type, listener, options); + } + + return this; + }, 'The interact.off() method is being deprecated'); + + interact.debug = function () { + return this.scope; + }; + /** + * @alias module:interact.supportsTouch + * + * @return {boolean} Whether or not the browser supports touch input + */ + + + interact.supportsTouch = function () { + return _$browser_62.default.supportsTouch; + }; + /** + * @alias module:interact.supportsPointerEvent + * + * @return {boolean} Whether or not the browser supports PointerEvents + */ + + + interact.supportsPointerEvent = function () { + return _$browser_62.default.supportsPointerEvent; + }; + /** + * Cancels all interactions (end events are not fired) + * + * @alias module:interact.stop + * + * @return {object} interact + */ + + + interact.stop = function () { + for (var _i3 = 0; _i3 < this.scope.interactions.list.length; _i3++) { + var _ref3; + + _ref3 = this.scope.interactions.list[_i3]; + var interaction = _ref3; + interaction.stop(); + } + + return this; + }; + /** + * 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 = function (newValue) { + if (_$is_69.default.number(newValue)) { + this.scope.interactions.pointerMoveTolerance = newValue; + return this; + } + + return this.scope.interactions.pointerMoveTolerance; + }; + + interact.addDocument = function (doc, options) { + this.scope.addDocument(doc, options); + }; + + interact.removeDocument = function (doc) { + this.scope.removeDocument(doc); + }; + + return interact; + } + + var _$Interactable_17 = {}; + "use strict"; + + Object.defineProperty(_$Interactable_17, "__esModule", { + value: true + }); + _$Interactable_17.Interactable = void 0; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + /* removed: var _$browser_62 = require("@interactjs/utils/browser"); */ + + ; + /* removed: var _$clone_63 = require("@interactjs/utils/clone"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$isNonNativeEvent_70 = require("@interactjs/utils/isNonNativeEvent"); */ + + ; + /* removed: var _$normalizeListeners_73 = require("@interactjs/utils/normalizeListeners"); */ + + ; + /* removed: var _$window_78 = require("@interactjs/utils/window"); */ + + ; + /* removed: var _$Eventable_14 = require("./Eventable"); */ + + ; + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + 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 OnOffMethod; + /** */ + + (function (OnOffMethod) { + OnOffMethod[OnOffMethod["On"] = 0] = "On"; + OnOffMethod[OnOffMethod["Off"] = 1] = "Off"; + })(OnOffMethod || (OnOffMethod = {})); + + var Interactable = /*#__PURE__*/function () { + /** */ + function Interactable(target, options, defaultContext, scopeEvents) { + ___classCallCheck_17(this, Interactable); + + ___defineProperty_17(this, "options", void 0); + + ___defineProperty_17(this, "_actions", void 0); + + ___defineProperty_17(this, "target", void 0); + + ___defineProperty_17(this, "events", new _$Eventable_14.Eventable()); + + ___defineProperty_17(this, "_context", void 0); + + ___defineProperty_17(this, "_win", void 0); + + ___defineProperty_17(this, "_doc", void 0); + + ___defineProperty_17(this, "_scopeEvents", void 0); + + this._actions = options.actions; + this.target = target; + this._context = options.context || defaultContext; + this._win = (0, _$window_78.getWindow)((0, _$domUtils_65.trySelector)(target) ? this._context : target); + this._doc = this._win.document; + this._scopeEvents = scopeEvents; + this.set(options); + } + + ___createClass_17(Interactable, [{ + key: "_defaults", + get: + /** @internal */ + function get() { + return { + base: {}, + perAction: {}, + actions: {} + }; + } + }, { + key: "setOnEvents", + value: function setOnEvents(actionName, phases) { + if (_$is_69.default.func(phases.onstart)) { + this.on("".concat(actionName, "start"), phases.onstart); + } + + if (_$is_69.default.func(phases.onmove)) { + this.on("".concat(actionName, "move"), phases.onmove); + } + + if (_$is_69.default.func(phases.onend)) { + this.on("".concat(actionName, "end"), phases.onend); + } + + if (_$is_69.default.func(phases.oninertiastart)) { + this.on("".concat(actionName, "inertiastart"), phases.oninertiastart); + } + + return this; + } + }, { + key: "updatePerActionListeners", + value: function updatePerActionListeners(actionName, prev, cur) { + var _this$_actions$map$ac, + _this = this; + + var actionFilter = (_this$_actions$map$ac = this._actions.map[actionName]) == null ? void 0 : _this$_actions$map$ac.filterEventType; + + var filter = function filter(type) { + return (actionFilter == null || actionFilter(type)) && (0, _$isNonNativeEvent_70.default)(type, _this._actions); + }; + + if (_$is_69.default.array(prev) || _$is_69.default.object(prev)) { + this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter); + } + + if (_$is_69.default.array(cur) || _$is_69.default.object(cur)) { + this._onOff(OnOffMethod.On, actionName, cur, undefined, filter); + } + } + }, { + 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_69.default.array(optionValue)) { + ; + actionOptions[optionName] = _$arr_61.from(optionValue); + } // if the option value is an object + else if (_$is_69.default.plainObject(optionValue)) { + // copy the object + ; + actionOptions[optionName] = (0, _$extend_66.default)(actionOptions[optionName] || {}, (0, _$clone_63.default)(optionValue)); // set anabled field to true if it exists in the defaults + + if (_$is_69.default.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_69.default.bool(optionValue) && _$is_69.default.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 {Rect} The object's bounding rectangle. + */ + + }, { + key: "getRect", + value: function getRect(element) { + element = element || (_$is_69.default.element(this.target) ? this.target : null); + + if (_$is_69.default.string(this.target)) { + element = element || this._context.querySelector(this.target); + } + + return (0, _$domUtils_65.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) { + var _this2 = this; + + if (_$is_69.default.func(checker)) { + this.getRect = function (element) { + var rect = (0, _$extend_66.default)({}, checker.apply(_this2, element)); + + if (!('width' in rect)) { + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + } + + return rect; + }; + + return this; + } + + if (checker === null) { + delete this.getRect; + return this; + } + + return this.getRect; + } + }, { + key: "_backCompatOption", + value: function _backCompatOption(optionName, newValue) { + if ((0, _$domUtils_65.trySelector)(newValue) || _$is_69.default.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; + } + /** @internal */ + + }, { + key: "getAllElements", + value: function getAllElements() { + var target = this.target; + + if (_$is_69.default.string(target)) { + return Array.from(this._context.querySelectorAll(target)); + } + + if (_$is_69.default.func(target) && target.getAllElements) { + return target.getAllElements(); + } + + return _$is_69.default.element(target) ? [target] : []; + } + /** + * 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_65.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_69.default.element(element)) { + return false; + } + + if (_$is_69.default.string(allowFrom)) { + return (0, _$domUtils_65.matchesUpTo)(element, allowFrom, targetNode); + } else if (_$is_69.default.element(allowFrom)) { + return (0, _$domUtils_65.nodeContains)(allowFrom, element); + } + + return false; + } + }, { + key: "testIgnore", + value: function testIgnore(ignoreFrom, targetNode, element) { + if (!ignoreFrom || !_$is_69.default.element(element)) { + return false; + } + + if (_$is_69.default.string(ignoreFrom)) { + return (0, _$domUtils_65.matchesUpTo)(element, ignoreFrom, targetNode); + } else if (_$is_69.default.element(ignoreFrom)) { + return (0, _$domUtils_65.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, filter) { + if (_$is_69.default.object(typeArg) && !_$is_69.default.array(typeArg)) { + options = listenerArg; + listenerArg = null; + } + + var listeners = (0, _$normalizeListeners_73.default)(typeArg, listenerArg, filter); + + for (var _type in listeners) { + if (_type === 'wheel') { + _type = _$browser_62.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, _$isNonNativeEvent_70.default)(_type, this._actions)) { + this.events[method === OnOffMethod.On ? 'on' : 'off'](_type, listener); + } // delegated event + else if (_$is_69.default.string(this.target)) { + this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](this.target, this._context, _type, listener, options); + } // remove listener from this Interactable's element + else { + this._scopeEvents[method === OnOffMethod.On ? 'add' : '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 + */ + + }, { + key: "on", + value: function on(types, listener, options) { + return this._onOff(OnOffMethod.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(OnOffMethod.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_69.default.object(options)) { + options = {}; + } + + ; + this.options = (0, _$clone_63.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_66.default)((0, _$extend_66.default)({}, defaults.perAction), defaults.actions[actionName])); + this[methodName](options[actionName]); + } + + for (var setting in options) { + if (setting === 'getRect') { + this.rectChecker(options.getRect); + continue; + } + + if (_$is_69.default.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 + */ + + }, { + key: "unset", + value: function unset() { + if (_$is_69.default.string(this.target)) { + // remove delegated events + for (var _type2 in this._scopeEvents.delegatedEvents) { + var delegated = this._scopeEvents.delegatedEvents[_type2]; + + for (var i = delegated.length - 1; i >= 0; i--) { + var _delegated$i = delegated[i], + selector = _delegated$i.selector, + context = _delegated$i.context, + listeners = _delegated$i.listeners; + + if (selector === this.target && context === this._context) { + delegated.splice(i, 1); + } + + for (var l = listeners.length - 1; l >= 0; l--) { + this._scopeEvents.removeDelegate(this.target, this._context, _type2, listeners[l][0], listeners[l][1]); + } + } + } + } else { + this._scopeEvents.remove(this.target, 'all'); + } + } + }]); + + return Interactable; + }(); + + _$Interactable_17.Interactable = Interactable; + var _$InteractableSet_18 = {}; + "use strict"; + + Object.defineProperty(_$InteractableSet_18, "__esModule", { + value: true + }); + _$InteractableSet_18.InteractableSet = void 0; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + 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 InteractableSet = /*#__PURE__*/function () { + // all set interactables + function InteractableSet(scope) { + var _this = this; + + ___classCallCheck_18(this, InteractableSet); + + ___defineProperty_18(this, "list", []); + + ___defineProperty_18(this, "selectorMap", {}); + + ___defineProperty_18(this, "scope", void 0); + + this.scope = scope; + scope.addListeners({ + 'interactable:unset': function interactableUnset(_ref) { + var interactable = _ref.interactable; + var target = interactable.target; + var interactablesOnTarget = _$is_69.default.string(target) ? _this.selectorMap[target] : target[_this.scope.id]; + + var targetIndex = _$arr_61.findIndex(interactablesOnTarget, function (i) { + return i === interactable; + }); + + interactablesOnTarget.splice(targetIndex, 1); + } + }); + } + + ___createClass_18(InteractableSet, [{ + key: "new", + value: function _new(target, options) { + options = (0, _$extend_66.default)(options || {}, { + actions: this.scope.actions + }); + var interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events); + this.scope.addDocument(interactable._doc); + this.list.push(interactable); + + if (_$is_69.default.string(target)) { + if (!this.selectorMap[target]) { + this.selectorMap[target] = []; + } + + this.selectorMap[target].push(interactable); + } else { + if (!interactable.target[this.scope.id]) { + Object.defineProperty(target, this.scope.id, { + value: [], + configurable: true + }); + } + + ; + target[this.scope.id].push(interactable); + } + + this.scope.fire('interactable:new', { + target: target, + options: options, + interactable: interactable, + win: this.scope._win + }); + return interactable; + } + }, { + key: "getExisting", + value: function getExisting(target, options) { + var context = options && options.context || this.scope.document; + + var isSelector = _$is_69.default.string(target); + + var interactablesOnTarget = isSelector ? this.selectorMap[target] : target[this.scope.id]; + if (!interactablesOnTarget) return undefined; + return _$arr_61.find(interactablesOnTarget, function (interactable) { + return interactable._context === context && (isSelector || interactable.inContext(target)); + }); + } + }, { + 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_69.default.string(_interactable.target) ? // target is a selector and the element matches + _$is_69.default.element(node) && _$domUtils_65.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_18.InteractableSet = InteractableSet; + var _$events_21 = {}; + "use strict"; + + Object.defineProperty(_$events_21, "__esModule", { + value: true + }); + _$events_21.default = void 0; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$pointerExtend_74 = require("@interactjs/utils/pointerExtend"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + + function ___classCallCheck_21(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperties_21(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_21(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_21(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_21(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___defineProperty_21(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_21(arr, i) { + return ___arrayWithHoles_21(arr) || ___iterableToArrayLimit_21(arr, i) || ___unsupportedIterableToArray_21(arr, i) || ___nonIterableRest_21(); + } + + function ___nonIterableRest_21() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function ___unsupportedIterableToArray_21(o, minLen) { + if (!o) return; + if (typeof o === "string") return ___arrayLikeToArray_21(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ___arrayLikeToArray_21(o, minLen); + } + + function ___arrayLikeToArray_21(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function ___iterableToArrayLimit_21(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_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_21(arr) { + if (Array.isArray(arr)) return arr; + } + + function __install_21(scope) { + var _scope$document; + + var targets = []; + var delegatedEvents = {}; + var documents = []; + var eventsMethods = { + add: add, + remove: remove, + addDelegate: addDelegate, + removeDelegate: removeDelegate, + delegateListener: delegateListener, + delegateUseCapture: delegateUseCapture, + delegatedEvents: delegatedEvents, + documents: documents, + targets: targets, + supportsOptions: false, + supportsPassive: false + }; // check if browser supports passive events and options arg + + (_scope$document = scope.document) == null ? void 0 : _scope$document.createElement('div').addEventListener('test', null, { + get capture() { + return eventsMethods.supportsOptions = true; + }, + + get passive() { + return eventsMethods.supportsPassive = true; + } + + }); + scope.events = eventsMethods; + + function add(eventTarget, type, listener, optionalArg) { + if (!eventTarget.addEventListener) return; + + var options = __getOptions_21(optionalArg); + + var target = _$arr_61.find(targets, function (t) { + return t.eventTarget === eventTarget; + }); + + if (!target) { + target = { + eventTarget: eventTarget, + events: {} + }; + targets.push(target); + } + + if (!target.events[type]) { + target.events[type] = []; + } + + if (!_$arr_61.find(target.events[type], function (l) { + return l.func === listener && optionsMatch(l.options, options); + })) { + eventTarget.addEventListener(type, listener, eventsMethods.supportsOptions ? options : options.capture); + target.events[type].push({ + func: listener, + options: options + }); + } + } + + function remove(eventTarget, type, listener, optionalArg) { + if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return; + + var targetIndex = _$arr_61.findIndex(targets, function (t) { + return t.eventTarget === eventTarget; + }); + + var target = targets[targetIndex]; + + if (!target || !target.events) { + return; + } + + if (type === 'all') { + for (type in target.events) { + if (target.events.hasOwnProperty(type)) { + remove(eventTarget, type, 'all'); + } + } + + return; + } + + var typeIsEmpty = false; + var typeListeners = target.events[type]; + + if (typeListeners) { + if (listener === 'all') { + for (var i = typeListeners.length - 1; i >= 0; i--) { + var entry = typeListeners[i]; + remove(eventTarget, type, entry.func, entry.options); + } + + return; + } else { + var options = __getOptions_21(optionalArg); + + for (var _i = 0; _i < typeListeners.length; _i++) { + var _entry = typeListeners[_i]; + + if (_entry.func === listener && optionsMatch(_entry.options, options)) { + eventTarget.removeEventListener(type, listener, eventsMethods.supportsOptions ? options : options.capture); + typeListeners.splice(_i, 1); + + if (typeListeners.length === 0) { + delete target.events[type]; + typeIsEmpty = true; + } + + break; + } + } + } + } + + if (typeIsEmpty && !Object.keys(target.events).length) { + targets.splice(targetIndex, 1); + } + } + + function addDelegate(selector, context, type, listener, optionalArg) { + var options = __getOptions_21(optionalArg); + + if (!delegatedEvents[type]) { + delegatedEvents[type] = []; // 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 delegates = delegatedEvents[type]; + + var delegate = _$arr_61.find(delegates, function (d) { + return d.selector === selector && d.context === context; + }); + + if (!delegate) { + delegate = { + selector: selector, + context: context, + listeners: [] + }; + delegates.push(delegate); + } + + delegate.listeners.push({ + func: listener, + options: options + }); + } + + function removeDelegate(selector, context, type, listener, optionalArg) { + var options = __getOptions_21(optionalArg); + + var delegates = delegatedEvents[type]; + var matchFound = false; + var index; + if (!delegates) return; // count from last index of delegated to 0 + + for (index = delegates.length - 1; index >= 0; index--) { + var cur = delegates[index]; // look for matching selector and context Node + + if (cur.selector === selector && cur.context === context) { + var listeners = cur.listeners; // each item of the listeners array is an array: [function, capture, passive] + + for (var i = listeners.length - 1; i >= 0; i--) { + var entry = listeners[i]; // check if the listener functions and capture and passive flags match + + if (entry.func === listener && optionsMatch(entry.options, options)) { + // remove the listener from the array of listeners + listeners.splice(i, 1); // if all listeners for this target have been removed + // remove the target from the delegates array + + if (!listeners.length) { + delegates.splice(index, 1); // remove delegate function from context + + remove(context, type, delegateListener); + remove(context, type, delegateUseCapture, true); + } // 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_21(optionalArg); + + var fakeEvent = new FakeEvent(event); + var delegates = delegatedEvents[event.type]; + + var _pointerUtils$getEven = _$pointerUtils_75.getEventTargets(event), + _pointerUtils$getEven2 = ___slicedToArray_21(_pointerUtils$getEven, 1), + eventTarget = _pointerUtils$getEven2[0]; + + var element = eventTarget; // climb up document tree looking for selector matches + + while (_$is_69.default.element(element)) { + for (var i = 0; i < delegates.length; i++) { + var cur = delegates[i]; + var selector = cur.selector, + context = cur.context; + + if (_$domUtils_65.matchesSelector(element, selector) && _$domUtils_65.nodeContains(context, eventTarget) && _$domUtils_65.nodeContains(context, element)) { + var listeners = cur.listeners; + fakeEvent.currentTarget = element; + + for (var _i3 = 0; _i3 < listeners.length; _i3++) { + var _ref2; + + _ref2 = listeners[_i3]; + var entry = _ref2; + + if (optionsMatch(entry.options, options)) { + entry.func(fakeEvent); + } + } + } + } + + element = _$domUtils_65.parentNode(element); + } + } + + function delegateUseCapture(event) { + return delegateListener.call(this, event, true); + } // for type inferrence + + + return eventsMethods; + } + + var FakeEvent = /*#__PURE__*/function () { + function FakeEvent(originalEvent) { + ___classCallCheck_21(this, FakeEvent); + + ___defineProperty_21(this, "currentTarget", void 0); + + ___defineProperty_21(this, "originalEvent", void 0); + + ___defineProperty_21(this, "type", void 0); + + this.originalEvent = originalEvent; // duplicate the event so that currentTarget can be changed + + (0, _$pointerExtend_74.default)(this, originalEvent); + } + + ___createClass_21(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; + }(); + + function __getOptions_21(param) { + if (!_$is_69.default.object(param)) { + return { + capture: !!param, + passive: false + }; + } + + return { + capture: !!param.capture, + passive: !!param.passive + }; + } + + function optionsMatch(a, b) { + if (a === b) return true; + if (typeof a === 'boolean') return !!b.capture === a && !!b.passive === false; + return !!a.capture === !!b.capture && !!a.passive === !!b.passive; + } + + var ___default_21 = { + id: 'events', + install: __install_21 + }; + _$events_21.default = ___default_21; + var _$interactionFinder_23 = {}; + "use strict"; + + Object.defineProperty(_$interactionFinder_23, "__esModule", { + value: true + }); + _$interactionFinder_23.default = void 0; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + 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 = _$domUtils_65.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_23 = finder; + _$interactionFinder_23.default = ___default_23; + var _$interactions_24 = {}; + "use strict"; + + function ___typeof_24(obj) { + "@babel/helpers - typeof"; + + return ___typeof_24 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, ___typeof_24(obj); + } + + Object.defineProperty(_$interactions_24, "__esModule", { + value: true + }); + _$interactions_24.default = void 0; + /* removed: var _$browser_62 = require("@interactjs/utils/browser"); */ + + ; + /* removed: var _$domObjects_64 = require("@interactjs/utils/domObjects"); */ + + ; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + /* removed: var _$Interaction_19 = require("./Interaction"); */ + + ; + /* removed: var _$interactablePreventDefault_22 = require("./interactablePreventDefault"); */ + + ; + /* removed: var _$interactionFinder_23 = require("./interactionFinder"); */ + + ; + + function ___slicedToArray_24(arr, i) { + return ___arrayWithHoles_24(arr) || ___iterableToArrayLimit_24(arr, i) || ___unsupportedIterableToArray_24(arr, i) || ___nonIterableRest_24(); + } + + function ___nonIterableRest_24() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function ___unsupportedIterableToArray_24(o, minLen) { + if (!o) return; + if (typeof o === "string") return ___arrayLikeToArray_24(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ___arrayLikeToArray_24(o, minLen); + } + + function ___arrayLikeToArray_24(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function ___iterableToArrayLimit_24(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_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_24(arr) { + if (Array.isArray(arr)) return arr; + } + + function ___classCallCheck_24(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperties_24(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_24(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_24(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_24(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___inherits_24(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 + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) ___setPrototypeOf_24(subClass, superClass); + } + + function ___setPrototypeOf_24(o, p) { + ___setPrototypeOf_24 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return ___setPrototypeOf_24(o, p); + } + + function ___createSuper_24(Derived) { + var hasNativeReflectConstruct = ___isNativeReflectConstruct_24(); + + return function _createSuperInternal() { + var Super = ___getPrototypeOf_24(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = ___getPrototypeOf_24(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return ___possibleConstructorReturn_24(this, result); + }; + } + + function ___possibleConstructorReturn_24(self, call) { + if (call && (___typeof_24(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + + return ___assertThisInitialized_24(self); + } + + function ___assertThisInitialized_24(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function ___isNativeReflectConstruct_24() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function ___getPrototypeOf_24(o) { + ___getPrototypeOf_24 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return ___getPrototypeOf_24(o); + } + + var methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur']; + + function __install_24(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_62.default.pEventTypes; + var docEvents; + + if (_$domObjects_64.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_24(_class, _InteractionBase); + + var _super = ___createSuper_24(_class); + + function _class() { + ___classCallCheck_24(this, _class); + + return _super.apply(this, arguments); + } + + ___createClass_24(_class, [{ + key: "pointerMoveTolerance", + get: function get() { + return scope.interactions.pointerMoveTolerance; + }, + set: function set(value) { + scope.interactions.pointerMoveTolerance = value; + } + }, { + key: "_now", + value: function _now() { + return scope.now(); + } + }]); + + return _class; + }(_$Interaction_19.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_65.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(); + } + } + } + + scope.usePlugin(_$interactablePreventDefault_22.default); + } + + function doOnInteractions(method, scope) { + return function (event) { + var interactions = scope.interactions.list; + + var pointerType = _$pointerUtils_75.getPointerType(event); + + var _pointerUtils$getEven = _$pointerUtils_75.getEventTargets(event), + _pointerUtils$getEven2 = ___slicedToArray_24(_pointerUtils$getEven, 2), + eventTarget = _pointerUtils$getEven2[0], + curEventTarget = _pointerUtils$getEven2[1]; + + var matches = []; // [ [pointer, interaction], ...] + + if (/^touch/.test(event.type)) { + scope.prevTouchTime = scope.now(); // @ts-expect-error + + for (var _i5 = 0; _i5 < event.changedTouches.length; _i5++) { + var _ref6; + + _ref6 = event.changedTouches[_i5]; + var changedTouch = _ref6; + var pointer = changedTouch; + + var pointerId = _$pointerUtils_75.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_62.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_75.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_24(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_23.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, + events = scope.events; + var eventMethod = events[eventMethodName]; + + if (scope.browser.isIOS && !options.events) { + options.events = { + passive: false + }; + } // delegate event listener + + + for (var eventType in events.delegatedEvents) { + eventMethod(doc, eventType, events.delegateListener); + eventMethod(doc, eventType, events.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 interactions = { + id: 'core/interactions', + install: __install_24, + listeners: { + 'scope:add-document': function scopeAddDocument(arg) { + return onDocSignal(arg, 'add'); + }, + 'scope:remove-document': function scopeRemoveDocument(arg) { + return onDocSignal(arg, 'remove'); + }, + 'interactable:unset': function interactableUnset(_ref10, scope) { + var interactable = _ref10.interactable; // Stop and destroy related interactions when an Interactable is unset + + for (var i = scope.interactions.list.length - 1; i >= 0; i--) { + var interaction = scope.interactions.list[i]; + + if (interaction.interactable !== interactable) { + continue; + } + + interaction.stop(); + scope.fire('interactions:destroy', { + interaction: interaction + }); + interaction.destroy(); + + if (scope.interactions.list.length > 2) { + scope.interactions.list.splice(i, 1); + } + } + } + }, + onDocSignal: onDocSignal, + doOnInteractions: doOnInteractions, + methodNames: methodNames + }; + var ___default_24 = interactions; + _$interactions_24.default = ___default_24; + var _$scope_26 = {}; + "use strict"; + + function ___typeof_26(obj) { + "@babel/helpers - typeof"; + + return ___typeof_26 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, ___typeof_26(obj); + } + + Object.defineProperty(_$scope_26, "__esModule", { + value: true + }); + _$scope_26.Scope = void 0; + _$scope_26.initScope = initScope; + /* removed: var _$browser_62 = require("@interactjs/utils/browser"); */ + + ; + /* removed: var _$clone_63 = require("@interactjs/utils/clone"); */ + + ; + /* removed: var _$domObjects_64 = require("@interactjs/utils/domObjects"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$raf_76 = require("@interactjs/utils/raf"); */ + + ; + /* removed: var _$window_78 = require("@interactjs/utils/window"); */ + + ; + /* removed: var _$Eventable_14 = require("./Eventable"); */ + + ; + /* removed: var _$InteractEvent_15 = require("./InteractEvent"); */ + + ; + /* removed: var _$InteractStatic_16 = require("./InteractStatic"); */ + + ; + /* removed: var _$Interactable_17 = require("./Interactable"); */ + + ; + /* removed: var _$InteractableSet_18 = require("./InteractableSet"); */ + + ; + /* removed: var _$events_21 = require("./events"); */ + + ; + /* removed: var _$interactions_24 = require("./interactions"); */ + + ; + /* removed: var _$options_25 = require("./options"); */ + + ; + + function _get() { + if (typeof Reflect !== "undefined" && Reflect.get) { + _get = Reflect.get.bind(); + } 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(arguments.length < 3 ? target : receiver); + } + + return desc.value; + }; + } + + return _get.apply(this, arguments); + } + + function _superPropBase(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = ___getPrototypeOf_26(object); + if (object === null) break; + } + + return object; + } + + function ___inherits_26(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 + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) ___setPrototypeOf_26(subClass, superClass); + } + + function ___setPrototypeOf_26(o, p) { + ___setPrototypeOf_26 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return ___setPrototypeOf_26(o, p); + } + + function ___createSuper_26(Derived) { + var hasNativeReflectConstruct = ___isNativeReflectConstruct_26(); + + return function _createSuperInternal() { + var Super = ___getPrototypeOf_26(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = ___getPrototypeOf_26(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return ___possibleConstructorReturn_26(this, result); + }; + } + + function ___possibleConstructorReturn_26(self, call) { + if (call && (___typeof_26(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + + return ___assertThisInitialized_26(self); + } + + function ___assertThisInitialized_26(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function ___isNativeReflectConstruct_26() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function ___getPrototypeOf_26(o) { + ___getPrototypeOf_26 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return ___getPrototypeOf_26(o); + } + + 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); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + 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; + } + + var Scope = /*#__PURE__*/function () { + // main window + // main document + // main window + // all documents being listened to + function Scope() { + var _this = this; + + ___classCallCheck_26(this, Scope); + + ___defineProperty_26(this, "id", "__interact_scope_".concat(Math.floor(Math.random() * 100))); + + ___defineProperty_26(this, "isInitialized", false); + + ___defineProperty_26(this, "listenerMaps", []); + + ___defineProperty_26(this, "browser", _$browser_62.default); + + ___defineProperty_26(this, "defaults", (0, _$clone_63.default)(_$options_25.defaults)); + + ___defineProperty_26(this, "Eventable", _$Eventable_14.Eventable); + + ___defineProperty_26(this, "actions", { + map: {}, + phases: { + start: true, + move: true, + end: true + }, + methodDict: {}, + phaselessTypes: {} + }); + + ___defineProperty_26(this, "interactStatic", (0, _$InteractStatic_16.createInteractStatic)(this)); + + ___defineProperty_26(this, "InteractEvent", _$InteractEvent_15.InteractEvent); + + ___defineProperty_26(this, "Interactable", void 0); + + ___defineProperty_26(this, "interactables", new _$InteractableSet_18.InteractableSet(this)); + + ___defineProperty_26(this, "_win", void 0); + + ___defineProperty_26(this, "document", void 0); + + ___defineProperty_26(this, "window", void 0); + + ___defineProperty_26(this, "documents", []); + + ___defineProperty_26(this, "_plugins", { + list: [], + map: {} + }); + + ___defineProperty_26(this, "onWindowUnload", function (event) { + return _this.removeDocument(event.target); + }); + + var scope = this; + + this.Interactable = /*#__PURE__*/function (_InteractableBase) { + ___inherits_26(_class, _InteractableBase); + + var _super = ___createSuper_26(_class); + + function _class() { + ___classCallCheck_26(this, _class); + + return _super.apply(this, arguments); + } + + ___createClass_26(_class, [{ + key: "_defaults", + get: function get() { + return scope.defaults; + } + }, { + key: "set", + value: function set(options) { + _get(___getPrototypeOf_26(_class.prototype), "set", this).call(this, options); + + scope.fire('interactable:set', { + options: options, + interactable: this + }); + return this; + } + }, { + key: "unset", + value: function unset() { + _get(___getPrototypeOf_26(_class.prototype), "unset", this).call(this); + + var index = scope.interactables.list.indexOf(this); + if (index < 0) return; + scope.interactables.list.splice(index, 1); + scope.fire('interactable:unset', { + interactable: this + }); + } + }]); + + return _class; + }(_$Interactable_17.Interactable); + } + + ___createClass_26(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 this.isInitialized ? this : initScope(this, window); + } + }, { + key: "pluginIsInstalled", + value: function pluginIsInstalled(plugin) { + var id = plugin.id; + return id ? !!this._plugins.map[id] : this._plugins.list.indexOf(plugin) !== -1; + } + }, { + key: "usePlugin", + value: function usePlugin(plugin, options) { + if (!this.isInitialized) { + return this; + } + + 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; + acc[pluginIdRoot(id)] = true; + return acc; + }, {}); + + for (; index < len; index++) { + var otherId = this.listenerMaps[index].id; + + if (otherId && (before[otherId] || before[pluginIdRoot(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 = _$window_78.getWindow(doc); + + options = options ? (0, _$extend_66.default)({}, options) : {}; + this.documents.push({ + doc: doc, + options: options + }); + this.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) { + this.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 = _$window_78.getWindow(doc); + + var options = this.documents[index].options; + this.events.remove(window, 'unload', this.onWindowUnload); + this.documents.splice(index, 1); + this.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; + }(); + + _$scope_26.Scope = Scope; + + function initScope(scope, window) { + scope.isInitialized = true; + + if (_$is_69.default.window(window)) { + _$window_78.init(window); + } + + _$domObjects_64.default.init(window); + + _$browser_62.default.init(window); + + _$raf_76.default.init(window); // @ts-expect-error + + + scope.window = window; + scope.document = window.document; + scope.usePlugin(_$interactions_24.default); + scope.usePlugin(_$events_21.default); + return scope; + } + + function pluginIdRoot(id) { + return id && id.replace(/\/.*$/, ''); + } + + var _$index_30 = {}; + "use strict"; + + Object.defineProperty(_$index_30, "__esModule", { + value: true + }); + _$index_30.default = void 0; + /* removed: var _$scope_26 = require("@interactjs/core/scope"); */ + + ; + var scope = new _$scope_26.Scope(); + var interact = scope.interactStatic; + var ___default_30 = interact; + _$index_30.default = ___default_30; + + var _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : void 0; + + scope.init(_global); + var _$edgeTarget_57 = {}; + "use strict"; + + Object.defineProperty(_$edgeTarget_57, "__esModule", { + value: true + }); + _$edgeTarget_57.default = void 0; + + var ___default_57 = function _default() {}; + + _$edgeTarget_57.default = ___default_57; + var _$elements_58 = {}; + "use strict"; + + Object.defineProperty(_$elements_58, "__esModule", { + value: true + }); + _$elements_58.default = void 0; + + var ___default_58 = function _default() {}; + + _$elements_58.default = ___default_58; + var _$grid_59 = {}; + "use strict"; + + Object.defineProperty(_$grid_59, "__esModule", { + value: true + }); + _$grid_59.default = void 0; + + function ___slicedToArray_59(arr, i) { + return ___arrayWithHoles_59(arr) || ___iterableToArrayLimit_59(arr, i) || ___unsupportedIterableToArray_59(arr, i) || ___nonIterableRest_59(); + } + + function ___nonIterableRest_59() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function ___unsupportedIterableToArray_59(o, minLen) { + if (!o) return; + if (typeof o === "string") return ___arrayLikeToArray_59(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ___arrayLikeToArray_59(o, minLen); + } + + function ___arrayLikeToArray_59(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function ___iterableToArrayLimit_59(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_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_59(arr) { + if (Array.isArray(arr)) return arr; + } + + var ___default_59 = function _default(grid) { + var coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(function (_ref) { + var _ref2 = ___slicedToArray_59(_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_59(_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; + }; + + _$grid_59.default = ___default_59; + var _$all_56 = {}; + "use strict"; + + Object.defineProperty(_$all_56, "__esModule", { + value: true + }); + Object.defineProperty(_$all_56, "edgeTarget", { + enumerable: true, + get: function get() { + return _$edgeTarget_57.default; + } + }); + Object.defineProperty(_$all_56, "elements", { + enumerable: true, + get: function get() { + return _$elements_58.default; + } + }); + Object.defineProperty(_$all_56, "grid", { + enumerable: true, + get: function get() { + return _$grid_59.default; + } + }); + /* removed: var _$edgeTarget_57 = require("./edgeTarget"); */ + + ; + /* removed: var _$elements_58 = require("./elements"); */ + + ; + /* removed: var _$grid_59 = require("./grid"); */ + + ; + var _$plugin_60 = {}; + "use strict"; + + Object.defineProperty(_$plugin_60, "__esModule", { + value: true + }); + _$plugin_60.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$all_56 = require("./all"); */ + + ; + var snappersPlugin = { + id: 'snappers', + install: function install(scope) { + var interact = scope.interactStatic; + interact.snappers = (0, _$extend_66.default)(interact.snappers || {}, _$all_56); + interact.createSnapGrid = interact.snappers.grid; + } + }; + var ___default_60 = snappersPlugin; + _$plugin_60.default = ___default_60; + var _$aspectRatio_34 = {}; + "use strict"; + + Object.defineProperty(_$aspectRatio_34, "__esModule", { + value: true + }); + _$aspectRatio_34.default = _$aspectRatio_34.aspectRatio = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$Modification_32 = require("./Modification"); */ + + ; + /* removed: var _$base_36 = require("./base"); */ + + ; + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + 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 = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { + ___defineProperty_34(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; + } + + function ___defineProperty_34(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, + edges = arg.edges, + coords = arg.pageCoords; + var _state$options = state.options, + ratio = _state$options.ratio, + enabled = _state$options.enabled; + var _state$options2 = state.options, + equalDelta = _state$options2.equalDelta, + modifiers = _state$options2.modifiers; + + if (ratio === 'preserve') { + ratio = rect.width / rect.height; + } + + state.startCoords = (0, _$extend_66.default)({}, coords); + state.startRect = (0, _$extend_66.default)({}, rect); + state.ratio = ratio; + state.equalDelta = equalDelta; + var linkedEdges = state.linkedEdges = { + top: edges.top || edges.left && !edges.bottom, + left: edges.left || edges.top && !edges.right, + bottom: edges.bottom || edges.right && !edges.top, + right: edges.right || edges.bottom && !edges.left + }; + state.xIsPrimaryAxis = !!(edges.left || edges.right); + + if (state.equalDelta) { + var sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1); + state.edgeSign = { + x: sign, + y: sign + }; + } else { + state.edgeSign = { + x: linkedEdges.left ? -1 : 1, + y: linkedEdges.top ? -1 : 1 + }; + } + + if (enabled !== false) { + (0, _$extend_66.default)(edges, linkedEdges); + } + + if (!(modifiers != null && modifiers.length)) return; + var subModification = new _$Modification_32.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 linkedEdges = state.linkedEdges; + var initialCoords = (0, _$extend_66.default)({}, coords); + var aspectMethod = state.equalDelta ? setEqualDelta : setRatio; + (0, _$extend_66.default)(arg.edges, linkedEdges); + aspectMethod(state, state.xIsPrimaryAxis, coords, rect); + + if (!state.subModification) { + return null; + } + + var correctedRect = (0, _$extend_66.default)({}, rect); + (0, _$rect_77.addEdges)(linkedEdges, correctedRect, { + x: coords.x - initialCoords.x, + y: coords.y - initialCoords.y + }); + var result = state.subModification.setAll(_objectSpread(_objectSpread({}, arg), {}, { + rect: correctedRect, + edges: 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_66.default)(coords, result.coords); + } + + return result.eventProps; + }, + defaults: { + ratio: 'preserve', + equalDelta: false, + modifiers: [], + enabled: false + } + }; + _$aspectRatio_34.aspectRatio = aspectRatio; + + function setEqualDelta(_ref, xIsPrimaryAxis, coords) { + var startCoords = _ref.startCoords, + edgeSign = _ref.edgeSign; + + if (xIsPrimaryAxis) { + coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y; + } else { + coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x; + } + } + + 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.y; + } else { + var newWidth = rect.height * ratio; + coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x; + } + } + + var ___default_34 = (0, _$base_36.makeModifier)(aspectRatio, 'aspectRatio'); + + _$aspectRatio_34.default = ___default_34; + var _$noop_37 = {}; + "use strict"; + + Object.defineProperty(_$noop_37, "__esModule", { + value: true + }); + _$noop_37.default = void 0; + + var noop = function noop() {}; + + noop._defaults = {}; + var ___default_37 = noop; + _$noop_37.default = ___default_37; + var _$avoid_35 = {}; + "use strict"; + + Object.defineProperty(_$avoid_35, "__esModule", { + value: true + }); + Object.defineProperty(_$avoid_35, "default", { + enumerable: true, + get: function get() { + return _$noop_37.default; + } + }); + /* removed: var _$noop_37 = require("../noop"); */ + + ; + var _$pointer_40 = {}; + "use strict"; + + Object.defineProperty(_$pointer_40, "__esModule", { + value: true + }); + _$pointer_40.default = void 0; + _$pointer_40.getRestrictionRect = getRestrictionRect; + _$pointer_40.restrict = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + + function __start_40(_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_66.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 = _$rect_77.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_69.default.func(value)) { + return _$rect_77.resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction]); + } else { + return _$rect_77.resolveRectLike(value, interaction.interactable, interaction.element); + } + } + + var __defaults_40 = { + restriction: null, + elementRect: null, + offset: null, + endOnly: false, + enabled: false + }; + var restrict = { + start: __start_40, + set: set, + defaults: __defaults_40 + }; + _$pointer_40.restrict = restrict; + + var ___default_40 = (0, _$base_36.makeModifier)(restrict, 'restrict'); + + _$pointer_40.default = ___default_40; + var _$edges_39 = {}; + "use strict"; + + Object.defineProperty(_$edges_39, "__esModule", { + value: true + }); + _$edges_39.restrictEdges = _$edges_39.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + /* removed: var _$pointer_40 = require("./pointer"); */ + + ; // 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_39(_ref) { + var interaction = _ref.interaction, + startOffset = _ref.startOffset, + state = _ref.state; + var options = state.options; + var offset; + + if (options) { + var offsetRect = (0, _$pointer_40.getRestrictionRect)(options.offset, interaction, interaction.coords.start.page); + offset = _$rect_77.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_39(_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_66.default)({}, coords); + var inner = (0, _$pointer_40.getRestrictionRect)(options.inner, interaction, page) || {}; + var outer = (0, _$pointer_40.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_39 = { + inner: null, + outer: null, + offset: null, + endOnly: false, + enabled: false + }; + var restrictEdges = { + noInner: noInner, + noOuter: noOuter, + start: __start_39, + set: __set_39, + defaults: __defaults_39 + }; + _$edges_39.restrictEdges = restrictEdges; + + var ___default_39 = (0, _$base_36.makeModifier)(restrictEdges, 'restrictEdges'); + + _$edges_39.default = ___default_39; + var _$rect_41 = {}; + "use strict"; + + Object.defineProperty(_$rect_41, "__esModule", { + value: true + }); + _$rect_41.restrictRect = _$rect_41.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + /* removed: var _$pointer_40 = require("./pointer"); */ + + ; + + var __defaults_41 = (0, _$extend_66.default)({ + get elementRect() { + return { + top: 0, + left: 0, + bottom: 1, + right: 1 + }; + }, + + set elementRect(_) {} + + }, _$pointer_40.restrict.defaults); + + var restrictRect = { + start: _$pointer_40.restrict.start, + set: _$pointer_40.restrict.set, + defaults: __defaults_41 + }; + _$rect_41.restrictRect = restrictRect; + + var ___default_41 = (0, _$base_36.makeModifier)(restrictRect, 'restrictRect'); + + _$rect_41.default = ___default_41; + var _$size_42 = {}; + "use strict"; + + Object.defineProperty(_$size_42, "__esModule", { + value: true + }); + _$size_42.restrictSize = _$size_42.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + /* removed: var _$edges_39 = require("./edges"); */ + + ; + /* removed: var _$pointer_40 = require("./pointer"); */ + + ; + var noMin = { + width: -Infinity, + height: -Infinity + }; + var noMax = { + width: +Infinity, + height: +Infinity + }; + + function __start_42(arg) { + return _$edges_39.restrictEdges.start(arg); + } + + function __set_42(arg) { + var interaction = arg.interaction, + state = arg.state, + rect = arg.rect, + edges = arg.edges; + var options = state.options; + + if (!edges) { + return; + } + + var minSize = _$rect_77.tlbrToXywh((0, _$pointer_40.getRestrictionRect)(options.min, interaction, arg.coords)) || noMin; + var maxSize = _$rect_77.tlbrToXywh((0, _$pointer_40.getRestrictionRect)(options.max, interaction, arg.coords)) || noMax; + state.options = { + endOnly: options.endOnly, + inner: (0, _$extend_66.default)({}, _$edges_39.restrictEdges.noInner), + outer: (0, _$extend_66.default)({}, _$edges_39.restrictEdges.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_39.restrictEdges.set(arg); + + state.options = options; + } + + var __defaults_42 = { + min: null, + max: null, + endOnly: false, + enabled: false + }; + var restrictSize = { + start: __start_42, + set: __set_42, + defaults: __defaults_42 + }; + _$size_42.restrictSize = restrictSize; + + var ___default_42 = (0, _$base_36.makeModifier)(restrictSize, 'restrictSize'); + + _$size_42.default = ___default_42; + var _$rubberband_43 = {}; + "use strict"; + + Object.defineProperty(_$rubberband_43, "__esModule", { + value: true + }); + Object.defineProperty(_$rubberband_43, "default", { + enumerable: true, + get: function get() { + return _$noop_37.default; + } + }); + /* removed: var _$noop_37 = require("../noop"); */ + + ; + var _$pointer_45 = {}; + "use strict"; + + Object.defineProperty(_$pointer_45, "__esModule", { + value: true + }); + _$pointer_45.snap = _$pointer_45.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$getOriginXY_67 = require("@interactjs/utils/getOriginXY"); */ + + ; + /* removed: var _$hypot_68 = require("@interactjs/utils/hypot"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + + function __start_45(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 = (0, _$rect_77.resolveRectLike)(options.offset, interactable, element, [interaction]); + snapOffset = (0, _$rect_77.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 + }; + }) : [{ + index: 0, + relativePoint: null, + x: snapOffset.x, + y: snapOffset.y + }]; + } + + function __set_45(arg) { + var interaction = arg.interaction, + coords = arg.coords, + state = arg.state; + var options = state.options, + offsets = state.offsets; + var origin = (0, _$getOriginXY_67.default)(interaction.interactable, interaction.element, interaction.prepared.name); + var page = (0, _$extend_66.default)({}, 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 (_$is_69.default.func(snapTarget)) { + target = snapTarget(relativeX, relativeY, interaction._proxy, _offset, _index); + } else { + target = snapTarget; + } + + if (!target) { + continue; + } + + targets.push({ + x: (_$is_69.default.number(target.x) ? target.x : relativeX) + _offset.x, + y: (_$is_69.default.number(target.y) ? target.y : relativeY) + _offset.y, + range: _$is_69.default.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 = (0, _$hypot_68.default)(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 = (0, _$rect_77.rectToXY)((0, _$rect_77.resolveRectLike)(arg.state.options.origin, null, null, [element])); + var origin = optionsOrigin || (0, _$getOriginXY_67.default)(arg.interactable, element, arg.interaction.prepared.name); + return origin; + } + + var __defaults_45 = { + range: Infinity, + targets: null, + offset: null, + offsetWithOrigin: true, + origin: null, + relativePoints: null, + endOnly: false, + enabled: false + }; + var snap = { + start: __start_45, + set: __set_45, + defaults: __defaults_45 + }; + _$pointer_45.snap = snap; + + var ___default_45 = (0, _$base_36.makeModifier)(snap, 'snap'); + + _$pointer_45.default = ___default_45; + var _$size_46 = {}; + "use strict"; + + Object.defineProperty(_$size_46, "__esModule", { + value: true + }); + _$size_46.snapSize = _$size_46.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$is_69 = require("@interactjs/utils/is"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + /* removed: var _$pointer_45 = require("./pointer"); */ + + ; + + function ___slicedToArray_46(arr, i) { + return ___arrayWithHoles_46(arr) || ___iterableToArrayLimit_46(arr, i) || ___unsupportedIterableToArray_46(arr, i) || ___nonIterableRest_46(); + } + + function ___nonIterableRest_46() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function ___unsupportedIterableToArray_46(o, minLen) { + if (!o) return; + if (typeof o === "string") return ___arrayLikeToArray_46(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ___arrayLikeToArray_46(o, minLen); + } + + function ___arrayLikeToArray_46(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function ___iterableToArrayLimit_46(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_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_46(arr) { + if (Array.isArray(arr)) return arr; + } + + function __start_46(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_45.snap.start(arg); + + state.offsets = arg.state.offsets; + arg.state = state; + } + + function __set_46(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_66.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_69.default.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_46(_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_45.snap.set(arg); + + state.options = options; + return returnValue; + } + + var __defaults_46 = { + range: Infinity, + targets: null, + offset: null, + endOnly: false, + enabled: false + }; + var snapSize = { + start: __start_46, + set: __set_46, + defaults: __defaults_46 + }; + _$size_46.snapSize = snapSize; + + var ___default_46 = (0, _$base_36.makeModifier)(snapSize, 'snapSize'); + + _$size_46.default = ___default_46; + var _$edges_44 = {}; + "use strict"; + + Object.defineProperty(_$edges_44, "__esModule", { + value: true + }); + _$edges_44.snapEdges = _$edges_44.default = void 0; + /* removed: var _$clone_63 = require("@interactjs/utils/clone"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$base_36 = require("../base"); */ + + ; + /* removed: var _$size_46 = require("./size"); */ + + ; + /** + * @module modifiers/snapEdges + * + * @description + * WOW> This module allows snapping of the edges of targets during resize + * interactions. + * + * ```js + * 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_44(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_46.snapSize.start(arg); + } + + var snapEdges = { + start: __start_44, + set: _$size_46.snapSize.set, + defaults: (0, _$extend_66.default)((0, _$clone_63.default)(_$size_46.snapSize.defaults), { + targets: undefined, + range: undefined, + offset: { + x: 0, + y: 0 + } + }) + }; + _$edges_44.snapEdges = snapEdges; + + var ___default_44 = (0, _$base_36.makeModifier)(snapEdges, 'snapEdges'); + + _$edges_44.default = ___default_44; + var _$spring_47 = {}; + "use strict"; + + Object.defineProperty(_$spring_47, "__esModule", { + value: true + }); + Object.defineProperty(_$spring_47, "default", { + enumerable: true, + get: function get() { + return _$noop_37.default; + } + }); + /* removed: var _$noop_37 = require("../noop"); */ + + ; + var _$transform_48 = {}; + "use strict"; + + Object.defineProperty(_$transform_48, "__esModule", { + value: true + }); + Object.defineProperty(_$transform_48, "default", { + enumerable: true, + get: function get() { + return _$noop_37.default; + } + }); + /* removed: var _$noop_37 = require("../noop"); */ + + ; + var _$all_33 = {}; + "use strict"; + + Object.defineProperty(_$all_33, "__esModule", { + value: true + }); + _$all_33.default = void 0; + /* removed: var _$aspectRatio_34 = require("./aspectRatio"); */ + + ; + /* removed: var _$avoid_35 = require("./avoid/avoid"); */ + + ; + /* removed: var _$edges_39 = require("./restrict/edges"); */ + + ; + /* removed: var _$pointer_40 = require("./restrict/pointer"); */ + + ; + /* removed: var _$rect_41 = require("./restrict/rect"); */ + + ; + /* removed: var _$size_42 = require("./restrict/size"); */ + + ; + /* removed: var _$rubberband_43 = require("./rubberband/rubberband"); */ + + ; + /* removed: var _$edges_44 = require("./snap/edges"); */ + + ; + /* removed: var _$pointer_45 = require("./snap/pointer"); */ + + ; + /* removed: var _$size_46 = require("./snap/size"); */ + + ; + /* removed: var _$spring_47 = require("./spring/spring"); */ + + ; + /* removed: var _$transform_48 = require("./transform/transform"); */ + + ; + /* eslint-disable n/no-extraneous-import, import/no-unresolved */ + + var ___default_33 = { + aspectRatio: _$aspectRatio_34.default, + restrictEdges: _$edges_39.default, + restrict: _$pointer_40.default, + restrictRect: _$rect_41.default, + restrictSize: _$size_42.default, + snapEdges: _$edges_44.default, + snap: _$pointer_45.default, + snapSize: _$size_46.default, + spring: _$spring_47.default, + avoid: _$avoid_35.default, + transform: _$transform_48.default, + rubberband: _$rubberband_43.default + }; + _$all_33.default = ___default_33; + var _$plugin_38 = {}; + "use strict"; + + Object.defineProperty(_$plugin_38, "__esModule", { + value: true + }); + _$plugin_38.default = void 0; + /* removed: var _$plugin_60 = require("@interactjs/snappers/plugin"); */ + + ; + /* removed: var _$all_33 = require("./all"); */ + + ; + /* removed: var _$base_36 = require("./base"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + var __modifiers_38 = { + id: 'modifiers', + install: function install(scope) { + var interact = scope.interactStatic; + scope.usePlugin(_$base_36.default); + scope.usePlugin(_$plugin_60.default); + interact.modifiers = _$all_33.default; // for backwrads compatibility + + for (var type in _$all_33.default) { + var _all = _$all_33.default[type], + _defaults = _all._defaults, + _methods = _all._methods; + _defaults._methods = _methods; + scope.defaults.perAction[type] = _defaults; + } + } + }; + var ___default_38 = __modifiers_38; + _$plugin_38.default = ___default_38; + var _$PointerEvent_50 = {}; + "use strict"; + + function ___typeof_50(obj) { + "@babel/helpers - typeof"; + + return ___typeof_50 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, ___typeof_50(obj); + } + + Object.defineProperty(_$PointerEvent_50, "__esModule", { + value: true + }); + _$PointerEvent_50.default = _$PointerEvent_50.PointerEvent = void 0; + /* removed: var _$BaseEvent_13 = require("@interactjs/core/BaseEvent"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + + function ___classCallCheck_50(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function ___defineProperties_50(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_50(Constructor, protoProps, staticProps) { + if (protoProps) ___defineProperties_50(Constructor.prototype, protoProps); + if (staticProps) ___defineProperties_50(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function ___inherits_50(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 + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) ___setPrototypeOf_50(subClass, superClass); + } + + function ___setPrototypeOf_50(o, p) { + ___setPrototypeOf_50 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return ___setPrototypeOf_50(o, p); + } + + function ___createSuper_50(Derived) { + var hasNativeReflectConstruct = ___isNativeReflectConstruct_50(); + + return function _createSuperInternal() { + var Super = ___getPrototypeOf_50(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = ___getPrototypeOf_50(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return ___possibleConstructorReturn_50(this, result); + }; + } + + function ___possibleConstructorReturn_50(self, call) { + if (call && (___typeof_50(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + + return ___assertThisInitialized_50(self); + } + + function ___assertThisInitialized_50(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function ___isNativeReflectConstruct_50() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function ___getPrototypeOf_50(o) { + ___getPrototypeOf_50 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return ___getPrototypeOf_50(o); + } + + var PointerEvent = /*#__PURE__*/function (_BaseEvent) { + ___inherits_50(PointerEvent, _BaseEvent); + + var _super = ___createSuper_50(PointerEvent); + /** */ + + + function PointerEvent(type, pointer, event, eventTarget, interaction, timeStamp) { + var _this; + + ___classCallCheck_50(this, PointerEvent); + + _this = _super.call(this, interaction); + + _$pointerUtils_75.pointerExtend(___assertThisInitialized_50(_this), event); + + if (event !== pointer) { + _$pointerUtils_75.pointerExtend(___assertThisInitialized_50(_this), pointer); + } + + _this.timeStamp = timeStamp; + _this.originalEvent = event; + _this.type = type; + _this.pointerId = _$pointerUtils_75.getPointerId(pointer); + _this.pointerType = _$pointerUtils_75.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; + _this.double = true; + } + + return _this; + } + + ___createClass_50(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; + }(_$BaseEvent_13.BaseEvent); + + _$PointerEvent_50.PointerEvent = _$PointerEvent_50.default = PointerEvent; + var _$base_51 = {}; + "use strict"; + + Object.defineProperty(_$base_51, "__esModule", { + value: true + }); + _$base_51.default = void 0; + /* removed: var _$domUtils_65 = require("@interactjs/utils/domUtils"); */ + + ; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + /* removed: var _$getOriginXY_67 = require("@interactjs/utils/getOriginXY"); */ + + ; + /* removed: var _$PointerEvent_50 = require("./PointerEvent"); */ + + ; + var __defaults_51 = { + holdDuration: 600, + ignoreFrom: null, + allowFrom: null, + origin: { + x: 0, + y: 0 + } + }; + var pointerEvents = { + id: 'pointer-events/base', + before: ['inertia', 'modifiers', 'auto-start', 'actions'], + install: __install_51, + 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_50.PointerEvent, + fire: fire, + collectEventTargets: collectEventTargets, + defaults: __defaults_51, + 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_50.PointerEvent(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 = (0, _$getOriginXY_67.default)(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 = _$domUtils_65.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) { + var _interaction$pointers, _interaction$pointers2; + + return target.eventable.options.holdDuration === ((_interaction$pointers = interaction.pointers[pointerIndex]) == null ? void 0 : (_interaction$pointers2 = _interaction$pointers.hold) == null ? void 0 : _interaction$pointers2.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; + var hold = interaction.pointers[pointerIndex].hold; + + if (hold && hold.timeout) { + clearTimeout(hold.timeout); + hold.timeout = null; + } + } + + function moveAndClearHold(arg, scope) { + var interaction = arg.interaction, + pointer = arg.pointer, + event = arg.event, + eventTarget = arg.eventTarget, + duplicate = arg.duplicate; + + if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) { + if (interaction.pointerIsDown) { + clearHold(arg); + } + + fire({ + interaction: interaction, + pointer: pointer, + event: event, + eventTarget: eventTarget, + type: 'move' + }, scope); + } + } + + function downAndStartHold(_ref6, scope) { + var interaction = _ref6.interaction, + pointer = _ref6.pointer, + event = _ref6.event, + eventTarget = _ref6.eventTarget, + pointerIndex = _ref6.pointerIndex; + var timer = interaction.pointers[pointerIndex].hold; + + var path = _$domUtils_65.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 _ref7; + + _ref7 = path[_i2]; + var node = _ref7; + 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 _ref8; + + _ref8 = signalArg.targets[_i3]; + var target = _ref8; + 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(_ref9, scope) { + var interaction = _ref9.interaction, + pointer = _ref9.pointer, + event = _ref9.event, + eventTarget = _ref9.eventTarget; + + if (!interaction.pointerWasMoved) { + fire({ + interaction: interaction, + eventTarget: eventTarget, + pointer: pointer, + event: event, + type: 'tap' + }, scope); + } + } + + function __install_51(scope) { + scope.pointerEvents = pointerEvents; + scope.defaults.actions.pointerEvents = pointerEvents.defaults; + (0, _$extend_66.default)(scope.actions.phaselessTypes, pointerEvents.types); + } + + var ___default_51 = pointerEvents; + _$base_51.default = ___default_51; + var _$holdRepeat_52 = {}; + "use strict"; + + Object.defineProperty(_$holdRepeat_52, "__esModule", { + value: true + }); + _$holdRepeat_52.default = void 0; + /* removed: var _$base_51 = require("./base"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + function __install_52(scope) { + scope.usePlugin(_$base_51.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_52, + listeners: ['move', 'up', 'cancel', 'endall'].reduce(function (acc, enderTypes) { + ; + acc["pointerEvents:".concat(enderTypes)] = endHoldRepeat; + return acc; + }, { + 'pointerEvents:new': onNew, + 'pointerEvents:fired': onFired + }) + }; + var ___default_52 = holdRepeat; + _$holdRepeat_52.default = ___default_52; + var _$interactableTargets_53 = {}; + "use strict"; + + Object.defineProperty(_$interactableTargets_53, "__esModule", { + value: true + }); + _$interactableTargets_53.default = void 0; + /* removed: var _$extend_66 = require("@interactjs/utils/extend"); */ + + ; + + function __install_53(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_66.default)(this.events.options, options); + return this; + } + + var plugin = { + id: 'pointer-events/interactableTargets', + install: __install_53, + 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_66.default)(interactable.events.options, scope.pointerEvents.defaults); + (0, _$extend_66.default)(interactable.events.options, options.pointerEvents || {}); + } + } + }; + var ___default_53 = plugin; + _$interactableTargets_53.default = ___default_53; + var _$plugin_54 = {}; + "use strict"; + + Object.defineProperty(_$plugin_54, "__esModule", { + value: true + }); + _$plugin_54.default = void 0; + /* removed: var _$base_51 = require("./base"); */ + + ; + /* removed: var _$holdRepeat_52 = require("./holdRepeat"); */ + + ; + /* removed: var _$interactableTargets_53 = require("./interactableTargets"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + /* eslint-enable import/no-duplicates */ + + var __plugin_54 = { + id: 'pointer-events', + install: function install(scope) { + scope.usePlugin(_$base_51); + scope.usePlugin(_$holdRepeat_52.default); + scope.usePlugin(_$interactableTargets_53.default); + } + }; + var ___default_54 = __plugin_54; + _$plugin_54.default = ___default_54; + var _$plugin_55 = {}; + "use strict"; + + Object.defineProperty(_$plugin_55, "__esModule", { + value: true + }); + _$plugin_55.default = void 0; + _$plugin_55.install = __install_55; + /* removed: var _$arr_61 = require("@interactjs/utils/arr"); */ + + ; + /* removed: var _$misc_72 = require("@interactjs/utils/misc"); */ + + ; + /* removed: var _$pointerUtils_75 = require("@interactjs/utils/pointerUtils"); */ + + ; + /* removed: var _$rect_77 = require("@interactjs/utils/rect"); */ + + ; + + function __install_55(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 doReflow(this, action, scope); + }; + } + + function doReflow(interactable, action, scope) { + var elements = interactable.getAllElements(); // tslint:disable-next-line variable-name + + var Promise = scope.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 = _$arr_61.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 = (0, _$rect_77.tlbrToXywh)(rect); + var coords = { + page: { + x: xywh.x, + y: xywh.y + }, + client: { + x: xywh.x, + y: xywh.y + }, + timeStamp: scope.now() + }; + + var event = _$pointerUtils_75.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.prevEvent = event; + interaction.updatePointer(event, event, element, true); + + _$pointerUtils_75.setZeroCoords(interaction.coords.delta); + + (0, _$misc_72.copyAction)(interaction.prepared, action); + + interaction._doPhase(signalArg); + + var _ref2 = scope.window, + Promise = _ref2.Promise; + var reflowPromise = Promise ? new Promise(function (resolve) { + interaction._reflowResolve = resolve; + }) : undefined; + interaction._reflowPromise = reflowPromise; + interaction.start(action, interactable, element); + + if (interaction._interacting) { + interaction.move(signalArg); + interaction.end(event); + } else { + interaction.stop(); + + interaction._reflowResolve(); + } + + interaction.removePointer(event, event); + return reflowPromise; + } + + var reflow = { + id: 'reflow', + install: __install_55, + listeners: { + // remove completed reflow interactions + 'interactions:stop': function interactionsStop(_ref3, scope) { + var interaction = _ref3.interaction; + + if (interaction.pointerType === 'reflow') { + if (interaction._reflowResolve) { + interaction._reflowResolve(); + } + + _$arr_61.remove(scope.interactions.list, interaction); + } + } + } + }; + var ___default_55 = reflow; + _$plugin_55.default = ___default_55; + var _$index_31 = {}; + "use strict"; + + Object.defineProperty(_$index_31, "__esModule", { + value: true + }); + _$index_31.default = void 0; + /* removed: var _$plugin_5 = require("@interactjs/actions/plugin"); */ + + ; + /* removed: var _$plugin_7 = require("@interactjs/auto-scroll/plugin"); */ + + ; + /* removed: var _$plugin_12 = require("@interactjs/auto-start/plugin"); */ + + ; + /* removed: var _$interactablePreventDefault_22 = require("@interactjs/core/interactablePreventDefault"); */ + + ; + /* removed: var _$plugin_27 = require("@interactjs/dev-tools/plugin"); */ + + ; + /* removed: var _$plugin_29 = require("@interactjs/inertia/plugin"); */ + + ; + /* removed: var _$index_30 = require("@interactjs/interact"); */ + + ; + /* removed: var _$plugin_38 = require("@interactjs/modifiers/plugin"); */ + + ; + /* removed: var _$plugin_49 = require("@interactjs/offset/plugin"); */ + + ; + /* removed: var _$plugin_54 = require("@interactjs/pointer-events/plugin"); */ + + ; + /* removed: var _$plugin_55 = require("@interactjs/reflow/plugin"); */ + + ; + /* eslint-disable import/no-duplicates -- for typescript module augmentations */ + + /* eslint-enable import/no-duplicates */ + + _$index_30.default.use(_$interactablePreventDefault_22.default); + + _$index_30.default.use(_$plugin_49.default); // pointerEvents + + + _$index_30.default.use(_$plugin_54.default); // inertia + + + _$index_30.default.use(_$plugin_29.default); // snap, resize, etc. + + + _$index_30.default.use(_$plugin_38.default); // autoStart, hold + + + _$index_30.default.use(_$plugin_12.default); // drag and drop, resize, gesture + + + _$index_30.default.use(_$plugin_5.default); // autoScroll + + + _$index_30.default.use(_$plugin_7.default); // reflow + + + _$index_30.default.use(_$plugin_55.default); // eslint-disable-next-line no-undef + + + if ("development" !== 'production') { + _$index_30.default.use(_$plugin_27.default); + } + + var ___default_31 = _$index_30.default; + _$index_31.default = ___default_31; + _$index_30.default.default = _$index_30.default; + var _$index_79 = { + exports: {} + }; + "use strict"; + + Object.defineProperty(_$index_79.exports, "__esModule", { + value: true + }); + _$index_79.exports.default = void 0; + /* removed: var _$index_31 = require("@interactjs/interactjs"); */ + + ; + + function ___typeof_79(obj) { + "@babel/helpers - typeof"; + + return ___typeof_79 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, ___typeof_79(obj); + } + + var ___default_79 = _$index_31.default; + _$index_79.exports.default = ___default_79; + + if (("object" === "undefined" ? "undefined" : ___typeof_79(_$index_79)) === 'object' && !!_$index_79) { + try { + _$index_79.exports = _$index_31.default; + } catch (_unused) {} + } + + ; + _$index_31.default.default = _$index_31.default; + _$index_79 = _$index_79.exports; + return _$index_79; +}); //# sourceMappingURL=interact.js.map \ No newline at end of file diff --git a/packages/interactjs/dist/interact.js.map b/packages/interactjs/dist/interact.js.map new file mode 100644 index 000000000..4ebf77f93 --- /dev/null +++ b/packages/interactjs/dist/interact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interact.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA,CCLA;EAAA;IAAAA;EAAA;IAAAC;EAAA;IAAA;;IAAA;MAAAC;IAAA;MAAAA;IAAA;MAAAA;IAAA;MAAAA;IAAA;;IAAAA;EAAA;AAAA,CDKA,ECLA;EAAA;EDMA,ICLAC,kBDKA;;;;;;;;iBENe,kBAACC,KAAD;IAAA,OAAgB,CAAC,EAAEA,KAAK,IAAIA,KAAK,CAACC,MAAjB,CAAD,IAA6BD,KAAK,YAAYA,KAAK,CAACC,MAApE;;;;;;;;;;;;;ECAf;;EAAA;EAEO,IAAIC,UAAU,GAAGC,SAAjB;;EAEP,IAAIC,GAAG,GAAGD,SAAV;;;EAGO,SAASE,IAAT,CAAeC,MAAf,EAAoE;;IAGzEC,mCAAU,GAAGD,MAAb,CAHyE;;IAMzE,IAAME,EAAE,GAAGF,MAAM,CAACG,QAAP,CAAgBC,cAAhB,CAA+B,EAA/B,CAAX,CANyE;;IASzE,IAAIF,EAAE,CAACG,aAAH,KAAqBL,MAAM,CAACG,QAA5B,IAAwC,OAAOH,MAAM,CAACM,IAAd,KAAuB,UAA/D,IAA6EN,MAAM,CAACM,IAAP,CAAYJ,EAAZ,MAAoBA,EAArG,EAAyG;;MAEvGF,MAAM,GAAGA,MAAM,CAACM,IAAP,CAAYN,MAAZ,CAAT;IACD;;IAED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EqCA;;;EAGAH,mBAASxT,GAAT,CAAa4T,mBAAb,E9ExCA,C8EwCA;;;EAGAJ,mBAASxT,GAAT,CAAa6T,kBAAb,E9E3CA,C8E2CA;;;EAGAL,mBAASxT,GAAT,CAAa8T,kBAAb,E9E9CA,C8E8CA;;;EAGAN,mBAASxT,GAAT,CAAa+T,mBAAb,E9EjDA,C8EiDA;;;EAGA,IAAI,kBAAyB,YAA7B,EAA2C;IACzCP,mBAASxT,GAAT,CAAagU,mBAAb;EACD;;sBAEcR;;EACbA,mBAAiBzY,OAAjB,GAA2ByY,kBAA3B;;;;;;;;;;ECxDF;;EAAA;;;;;;;;;;;;sBAEeS;;;EAEf,IAAI,uDAAOC,UAAP,OAAkB,QAAlB,IAA8B,CAAC,CAACA,UAApC,EAA4C;IAC1C,IAAI;MACFA,qBAAiBD,kBAAjB;IADF,EAEE,gBAAM,CAAE;EACX;;EAED;EAAEA,mBAAiBlZ,OAAjB,GAA2BkZ,kBAA3B;ECXFC;EACA;AAEA,CjFEA,E","names":["module","define","g","_$isWindow_71","thing","Window","realWindow","undefined","win","init","window","_$window_78","el","document","createTextNode","ownerDocument","wrap","getWindow","node","rootNode","defaultView","__window_69","docFrag","object","nodeType","_typeof","func","number","bool","string","element","_window","test","Element","nodeName","plainObject","constructor","toString","array","length","splice","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","_$is_69","enabled","setPerAction","setOnEvents","lockAxis","startAxis","id","listeners","arg","interactable","buttons","dragOptions","pointerIsDown","pointerType","mouseButtons","action","getCursor","filterEventType","type","search","domObjects","__init_64","DocumentFragment","SVGElement","SVGSVGElement","SVGElementInstance","HTMLElement","Event","Touch","PointerEvent","blank","MSPointerEvent","browser","__init_62","supportsTouch","supportsPointerEvent","isIOS7","isIOS","isIe9","isOperaMobile","prefixedMatchesSelector","pEventTypes","wheelEvent","_$domObjects_64","navigator","DocumentTouch","pointerEnabled","platform","appVersion","userAgent","appName","up","down","over","out","cancel","nodeContains","parent","child","contains","parentNode","closest","selector","matchesSelector","host","replace","_$browser_62","getParent","indexOfDeepestElement","elements","deepestNodeParents","deepestNodeIndex","i","currentNode","deepestNode","currentNodeParent","deepestNodeParent","zIndexIsHigherThan","getNodeParents","ancestryStart","ownerSVGElement","currentNodeParents","commonIndex","parents","lastChild","previousSibling","limit","parentParent","unshift","higherNode","lowerNode","higherIndex","parseInt","getComputedStyle","zIndex","lowerIndex","matchesUpTo","getActualElement","correspondingUseElement","getScrollXY","relevantWindow","scrollX","documentElement","scrollLeft","scrollY","scrollTop","getElementClientRect","clientRect","getBoundingClientRect","getClientRects","left","right","top","bottom","width","height","getElementRect","scroll","getPath","path","push","trySelector","value","querySelector","extend","dest","source","prop","ret","getStringOptionResult","target","getRect","resolveRectLike","functionArgs","returnValue","toFullRect","rect","rectToXY","xywhToTlbr","tlbrToXywh","addEdges","edges","getOriginXY","actionName","actionOptions","actionOrigin","origin","originRect","normalize","filter","_typeOrPrefix","result","split","forEach","t","_ref","l","prefix","combinedTypes","p","trim","Math","sqrt","VENDOR_PREFIXES","pointerExtend","__set","some","indexOf","Object","defineProperty","get","set","configurable","copyCoords","src","timeStamp","setCoordDeltas","targetObj","prev","setCoordVelocity","dt","max","setZeroCoords","isNativePointer","pointer","getXY","xy","getPageXY","getClientXY","getPointerId","pointerId","identifier","setCoords","pointers","pointerAverage","getTouchPair","event","touches","changedTouches","average","pageX","pageY","clientX","clientY","screenX","screenY","_prop","touchBBox","minX","min","minY","maxX","maxY","touchDistance","deltaSource","sourceX","sourceY","dx","dy","touchAngle","angle","atan2","PI","getPointerType","getEventTargets","composedPath","_$domUtils_65","currentTarget","newCoords","coordsToEvent","preventDefault","BaseEvent","_classCallCheck","_defineProperty","_interaction","propagationStopped","immediatePropagationStopped","_proxy","remove","merge","item","from","findIndex","find","DropEvent","dropState","dragEvent","___classCallCheck_2","_this","___defineProperty_2","dropzone","relatedTarget","rejected","events","enter","stopImmediatePropagation","activeDrops","index","_$arr_61","_this2","deactivateEvent","fire","_$BaseEvent_13","__install_3","interact","interactStatic","usePlugin","_$plugin_1","dropzoneMethod","dropCheck","draggableElement","dropElement","dropCheckMethod","dynamicDrop","newValue","phaselessTypes","dragenter","dragleave","dropactivate","dropdeactivate","dropmove","drop","collectDropzones","interactables","drops","list","_ref2","_i","_dropzone","accept","getAllElements","_ref3","_i2","dropzoneElement","fireActivationEvents","slice","_ref4","_i3","_dropzone2","getActiveDrops","dragElement","_ref6","activeDrop","getDrop","pointerEvent","validDrops","_ref8","_i5","_dropzone3","_rect","isValid","dropIndex","getDropEvents","_pointerEvent","dropEvents","leave","activate","deactivate","_$DropEvent_2","dragLeave","prevDropzone","dragEnter","fireDropEvents","onEventCreated","dropResult","normalized","corrected","keys","reduce","acc","correctedType","prevListeners","off","on","ondrop","ondropactivate","ondropdeactivate","ondragenter","ondragleave","ondropmove","overlap","checker","dropped","dropOverlap","_$pointerUtils_75","horizontal","vertical","dragRect","cx","cy","overlapArea","overlapRatio","__install_4","gesturable","gesture","updateGestureProps","phase","starting","ending","distance","box","scale","ds","da","startDistance","startAngle","prevEvent","Infinity","isNaN","before","gestureOptions","__install_6","resize","cursors","initCursors","defaultMargin","resizable","resizeChecker","resizeOptions","resizeEdges","edge","checkResizeEdge","_latestPointer","eventTarget","margin","axes","preserveAspectRatio","square","interactableElement","abs","_edge","topleft","bottomright","topright","bottomleft","resizeEvent","_rects","previous","deltaRect","__move_6","invert","invertible","current","startRect","swap","_swap","end","updateEventAxes","resizeAxes","NaN","cursorKey","_$plugin_4","_$plugin_6","_$plugin_3","lastTime","_request","_cancel","__init_76","global","requestAnimationFrame","cancelAnimationFrame","vendors","vendor","bind","callback","currTime","Date","now","timeToCall","token","setTimeout","clearTimeout","request","__install_7","autoScroll","autoscroll","perAction","container","speed","isScrolling","prevTime","_$raf_76","stop","getContainer","s","scrollBy","prevScroll","getScroll","curScroll","check","_options$actionName$a","onInteractionMove","interacting","simulation","innerWidth","innerHeight","body","getScrollSize","scrollWidth","scrollHeight","getScrollSizeDelta","scrollOptions","scrollContainer","prevSize","curSize","autoScrollPlugin","warnOnce","method","message","warned","console","warn","apply","arguments","copyAction","sign","n","__install_8","getAction","defaultActionChecker","actionChecker","ignoreFrom","_backCompatOption","allowFrom","styleCursor","button","__install_9","_$InteractableMethods_8","base","manualStart","maxPerElement","maxInteractions","autoStart","withinInteractionLimit","cursorElement","prepareOnDown","actionInfo","getActionInfo","prepare","prepareOnMove","startOnMove","pointerWasMoved","setInteractionCursor","clearCursorOnStop","setCursor","validateAction","testIgnoreAllow","validateMatches","matches","matchElements","len","match","matchElement","matchAction","pushMatches","forEachMatch","maxActions","autoStartMax","activeInteractions","interactableCount","elementCount","interactions","_ref5","otherAction","cursor","prevCursorElement","style","cursorChecker","_interacting","beforeStart","absX","absY","targetOptions","currentAxis","getDraggable","downPointer","downEvent","checkStartAxis","_$base_9","thisAxis","__install_11","hold","delay","getHoldDuration","autoStartHoldTimer","duplicate","holdDuration","_$hold_11","_$dragAxis_10","checkAndPreventDefault","setting","supportsPassive","doc","docOptions","getDocOptions","passive","onInteractionEvent","__install_22","docEvents","listener","eventType","isNonNativeEvent","substr","phases","CheckName","links","touchAction","boxSizing","isProduction","__install_27","logger","devTools","ignore","_onOff","typeArg","listenerArg","addEventListener","call","normalizedListeners","_$plugin_28","checks","perform","parentHasStyle","getInfo","text","hasStyle","noListeners","moveListeners","types","styleRe","defaultExport","clone","Modification","___classCallCheck_32","___defineProperty_32","createResult","pageCoords","modifierList","getModifierList","prepareStates","startEdges","startOffset","getRectOffset","startDelta","fillArg","preEnd","startAll","setAll","states","state","methods","skipModifiers","unmodifiedRect","unmodifiedEdges","newResult","lastModifierCoords","shouldDo","_$rect_77","eventProps","rectDelta","prevCoords","prevRect","rectChanged","changed","curCoords","startCoords","curDelta","coordsSet","modifiedCoords","adjustment","applyToInteraction","doPreend","_ref7","endPosition","beforeEnd","endResult","modifierArg","modification","coordsAndDeltas","_ref10","requireEndOnly","endOnly","setStart","other","actionModifiers","modifiers","_methods","m","makeModifier","modifier","_options","enable","disable","_defaults","addEventModifiers","modifiersBase","_$Modification_32","setAndApply","restoreInteractionCoords","InteractEvent","___classCallCheck_15","___defineProperty_15","_$options_25","ctrlKey","altKey","shiftKey","metaKey","t0","downTime","x0","y0","clientX0","clientY0","duration","swipe","getSwipe","velocityY","velocityX","defineProperties","PointerInfo","downTarget","___classCallCheck_20","___defineProperty_20","_ProxyValues","_ProxyMethods","idCounter","Interaction","scopeFire","___classCallCheck_19","___defineProperty_19","signalArg","_scopeFire","that","key","_loop","_key","_loop2","pointerIndex","updatePointer","pointerInfo","_stopped","_doPhase","duplicateMove","pointerMoveTolerance","getPointerIndex","curEventTarget","removePointer","_ending","endPhaseResult","curPointer","_$PointerInfo_20","_now","_updateLatestPointer","_$InteractEvent_15","beforeResult","_createPreparedEvent","_fireEvent","_$Interaction_19","offsetBy","addTotal","addToCoords","offset","total","pending","beforeAction","applyPending","hadPending","__end_49","hasPending","__install_29","_$plugin_49","_$base_36","default","inertiastart","resume","inertia","resistance","minSpeed","endSpeed","allowResume","smoothEndDuration","InertiaState","___classCallCheck_29","___defineProperty_29","getOptions","velocityClient","pointerSpeed","copyFrom","v0","currentOffset","thrown","startInertia","startSmoothEnd","targetOffset","active","startVelocity","lambda","inertiaDur","log","te","lambda_v0","one_ve_v0","isModified","modifiedOffset","onNextFrame","inertiaTick","smoothEnd","smoothEndTick","tickFn","timeout","_this3","progress","exp","newOffset","getQuadraticCurvePoint","_this4","easeOutQuad","modifierCount","_this5","__start_29","started","_getQBezierValue","p1","p2","p3","iT","startX","startY","cpX","cpY","endX","endY","position","b","c","d","fireUntilImmediateStopped","Eventable","___classCallCheck_14","___defineProperty_14","eventList","subListener","_index","_element","createInteractStatic","getExisting","new","globalEvents","getPointerAverage","getTouchBBox","getTouchDistance","getTouchAngle","version","use","plugin","isSet","context","add","debug","addDocument","removeDocument","OnOffMethod","defaultContext","scopeEvents","___classCallCheck_17","___defineProperty_17","_$Eventable_14","_actions","_context","_win","_doc","_scopeEvents","onstart","onmove","onend","oninertiastart","actionFilter","_this$_actions$map$ac","Off","On","optionName_","optionName","optionValue","updatePerActionListeners","Array","querySelectorAll","targetNode","testIgnore","testAllow","_type","actionName_","methodName","rectChecker","_type2","delegatedEvents","delegated","removeDelegate","InteractableSet","___classCallCheck_18","___defineProperty_18","addListeners","interactablesOnTarget","selectorMap","targetIndex","isSelector","inContext","_interactable","__install_21","targets","documents","eventsMethods","addDelegate","delegateListener","delegateUseCapture","supportsOptions","createElement","capture","optionalArg","__getOptions_21","optionsMatch","removeEventListener","hasOwnProperty","typeIsEmpty","typeListeners","entry","_entry","delegates","delegate","matchFound","fakeEvent","FakeEvent","originalEvent","___classCallCheck_21","___defineProperty_21","stopPropagation","param","a","finder","methodOrder","details","simulationResume","mouseOrPen","firstNonActive","hasPointerId","_i4","hasPointer","idle","_i6","methodNames","__install_24","doOnInteractions","releasePointersOnRemovedEls","pointerDown","pointerMove","pointerUp","documentBlur","prevTouchTime","___inherits_24","___classCallCheck_24","___createClass_24","_$interactablePreventDefault_22","changedTouch","searchDetails","getInteraction","invalidPointer","_searchDetails","_pointer","_eventTarget","_curEventTarget","_interaction2","foundInteraction","_$interactionFinder_23","onDocSignal","eventMethodName","eventMethod","eventOptions","destroy","Scope","___classCallCheck_26","___defineProperty_26","floor","random","_$InteractableSet_18","___inherits_26","___createClass_26","_get","_$Interactable_17","listenerMaps","isInitialized","initScope","_plugins","pluginIsInstalled","pluginIdRoot","otherId","getDocIndex","onWindowUnload","docIndex","_$interactions_24","_$events_21","_$scope_26","_global","globalThis","grid","coordFields","xField","yField","gridFunc","range","limits","gridx","round","gridy","snappersPlugin","snappers","_$all_56","createSnapGrid","aspectRatio","ratio","equalDelta","linkedEdges","xIsPrimaryAxis","edgeSign","subModification","initialCoords","aspectMethod","setEqualDelta","setRatio","correctedRect","xIsCriticalAxis","newHeight","newWidth","noop","__start_40","elementRect","restriction","getRestrictionRect","widthDiff","heightDiff","__defaults_40","restrict","noInner","noOuter","__start_39","offsetRect","__set_39","inner","outer","fixRect","__defaults_39","restrictEdges","__defaults_41","_","_$pointer_40","restrictRect","noMin","noMax","__start_42","_$edges_39","__set_42","minSize","maxSize","__defaults_42","restrictSize","__start_45","offsetWithOrigin","getOrigin","snapOffset","relativePoints","offsets","relativePoint","__set_45","_offset","relativeX","relativeY","snapTarget","inRange","_target","optionsOrigin","__defaults_45","snap","__start_46","targetFields","_$pointer_45","__set_46","relative","__defaults_46","snapSize","__start_44","_$size_46","snapEdges","_$aspectRatio_34","_$rect_41","_$size_42","_$edges_44","spring","_$spring_47","avoid","_$avoid_35","transform","_$transform_48","rubberband","_$rubberband_43","__modifiers_38","_$plugin_60","_$all_33","___classCallCheck_50","interval","tapTime","double","prevTap","originX","originY","__defaults_51","pointerEvents","__install_51","addInteractionProps","addHoldInfo","moveAndClearHold","downAndStartHold","clearHold","tapAfterUp","_$PointerEvent_50","collectEventTargets","tap","doubletap","props","eventable","_subtractOrigin","_addOrigin","_interaction$pointers","_interaction$pointers2","timer","minDuration","__install_52","_$base_51","holdRepeatInterval","holdrepeat","onNew","count","onFired","holdIntervalHandle","endHoldRepeat","clearInterval","holdRepeat","enderTypes","__install_53","pointerEventsMethod","__backCompatOption","__plugin_54","_$holdRepeat_52","_$interactableTargets_53","__install_55","reflow","doReflow","Promise","promises","runningInteraction","reflowPromise","_reflowPromise","resolve","_reflowResolve","xywh","startReflow","all","then","_$index_30","_$plugin_54","_$plugin_29","_$plugin_38","_$plugin_12","_$plugin_5","_$plugin_7","_$plugin_55","_$plugin_27","_$index_31","_$index_79"],"sourceRoot":"","sources":["_header.js","node_modules/browser-pack-flat/_prelude","packages/@interactjs/utils/isWindow.ts","packages/@interactjs/utils/window.ts","packages/@interactjs/utils/is.ts","packages/@interactjs/actions/drag/plugin.ts","packages/@interactjs/utils/domObjects.ts","packages/@interactjs/utils/browser.ts","packages/@interactjs/utils/domUtils.ts","packages/@interactjs/utils/extend.ts","packages/@interactjs/utils/rect.ts","packages/@interactjs/utils/getOriginXY.ts","packages/@interactjs/utils/normalizeListeners.ts","packages/@interactjs/utils/hypot.ts","packages/@interactjs/utils/pointerExtend.ts","packages/@interactjs/utils/pointerUtils.ts","packages/@interactjs/core/BaseEvent.ts","packages/@interactjs/utils/arr.ts","packages/@interactjs/actions/drop/DropEvent.ts","packages/@interactjs/actions/drop/plugin.ts","packages/@interactjs/actions/gesture/plugin.ts","packages/@interactjs/actions/resize/plugin.ts","packages/@interactjs/actions/plugin.ts","packages/@interactjs/utils/raf.ts","packages/@interactjs/auto-scroll/plugin.ts","packages/@interactjs/utils/misc.ts","packages/@interactjs/auto-start/InteractableMethods.ts","packages/@interactjs/auto-start/base.ts","packages/@interactjs/auto-start/dragAxis.ts","packages/@interactjs/auto-start/hold.ts","packages/@interactjs/auto-start/plugin.ts","packages/@interactjs/core/interactablePreventDefault.ts","packages/@interactjs/dev-tools/visualizer/plugin.ts","packages/@interactjs/utils/isNonNativeEvent.ts","packages/@interactjs/dev-tools/plugin.ts","packages/@interactjs/utils/clone.ts","packages/@interactjs/modifiers/Modification.ts","packages/@interactjs/modifiers/base.ts","packages/@interactjs/core/options.ts","packages/@interactjs/core/InteractEvent.ts","packages/@interactjs/core/PointerInfo.ts","packages/@interactjs/core/Interaction.ts","packages/@interactjs/offset/plugin.ts","packages/@interactjs/inertia/plugin.ts","packages/@interactjs/core/Eventable.ts","packages/@interactjs/core/InteractStatic.ts","packages/@interactjs/core/Interactable.ts","packages/@interactjs/core/InteractableSet.ts","packages/@interactjs/core/events.ts","packages/@interactjs/core/interactionFinder.ts","packages/@interactjs/core/interactions.ts","packages/@interactjs/core/scope.ts","packages/@interactjs/interact/index.ts","packages/@interactjs/snappers/edgeTarget.ts","packages/@interactjs/snappers/elements.ts","packages/@interactjs/snappers/grid.ts","packages/@interactjs/snappers/all.ts","packages/@interactjs/snappers/plugin.ts","packages/@interactjs/modifiers/aspectRatio.ts","packages/@interactjs/modifiers/noop.ts","packages/@interactjs/modifiers/avoid/avoid.ts","packages/@interactjs/modifiers/restrict/pointer.ts","packages/@interactjs/modifiers/restrict/edges.ts","packages/@interactjs/modifiers/restrict/rect.ts","packages/@interactjs/modifiers/restrict/size.ts","packages/@interactjs/modifiers/rubberband/rubberband.ts","packages/@interactjs/modifiers/snap/pointer.ts","packages/@interactjs/modifiers/snap/size.ts","packages/@interactjs/modifiers/snap/edges.ts","packages/@interactjs/modifiers/spring/spring.ts","packages/@interactjs/modifiers/transform/transform.ts","packages/@interactjs/modifiers/all.ts","packages/@interactjs/modifiers/plugin.ts","packages/@interactjs/pointer-events/PointerEvent.ts","packages/@interactjs/pointer-events/base.ts","packages/@interactjs/pointer-events/holdRepeat.ts","packages/@interactjs/pointer-events/interactableTargets.ts","packages/@interactjs/pointer-events/plugin.ts","packages/@interactjs/reflow/plugin.ts","packages/@interactjs/interactjs/index.ts","packages/interactjs/index.ts","node_modules/browser-pack-flat/_postlude"],"sourcesContent":["/**\n * interact.js 1.10.23\n *\n * Copyright (c) 2012-present Taye Adeyemi \n * https://interactjs.io/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;\n","export default (thing: any) => !!(thing && thing.Window) && thing instanceof thing.Window\n","import isWindow from './isWindow'\n\nexport let realWindow = undefined as Window\n\nlet win = undefined as Window\nexport { win as window }\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n 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 && typeof window.wrap === 'function' && window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win = window\n}\n\nif (typeof window !== 'undefined' && !!window) {\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","import isWindow from './isWindow'\nimport * as win from './window'\n\nconst window = (thing: any): thing is Window => thing === win.window || isWindow(thing)\n\nconst docFrag = (thing: any): thing is DocumentFragment => object(thing) && thing.nodeType === 11\n\nconst object = (thing: any): thing is { [index: string]: any } => !!thing && typeof thing === 'object'\n\nconst func = (thing: any): thing is (...args: any[]) => any => typeof thing === 'function'\n\nconst number = (thing: any): thing is number => typeof thing === 'number'\n\nconst bool = (thing: any): thing is boolean => typeof thing === 'boolean'\n\nconst string = (thing: any): thing is string => typeof thing === 'string'\n\nconst element = (thing: any): thing is HTMLElement | SVGElement => {\n if (!thing || typeof thing !== 'object') {\n return false\n }\n\n const _window = win.getWindow(thing) || win.window\n\n return /object|function/.test(typeof Element)\n ? thing instanceof Element || thing instanceof _window.Element\n : thing.nodeType === 1 && typeof thing.nodeName === 'string'\n}\n\nconst plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) && !!thing.constructor && /function Object\\b/.test(thing.constructor.toString())\n\nconst array = (thing: any): thing is T[] =>\n object(thing) && typeof thing.length !== 'undefined' && func(thing.splice)\n\nexport default {\n window,\n docFrag,\n object,\n func,\n number,\n bool,\n string,\n element,\n plainObject,\n array,\n}\n","import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drag: DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = InteractEvent<'drag'>\n\nexport type DraggableMethod = ActionMethod\n\nexport interface DraggableOptions extends PerActionDefaults {\n startAxis?: 'x' | 'y' | 'xy'\n lockAxis?: 'x' | 'y' | 'xy' | 'start'\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 } 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 (\n this: Interactable,\n options?: DraggableOptions | boolean,\n): 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 as DraggableOptions\n}\n\nconst drag: 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' ? dragOptions.startAxis : 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 DraggableOptions,\n\n getCursor () {\n return 'move'\n },\n\n filterEventType: (type: string) => type.search('drag') === 0,\n}\n\nexport default drag\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 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 is from './is'\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 'matches',\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: Partial = window.navigator || {}\n\n // Does the browser support touch input?\n browser.supportsTouch =\n 'ontouchstart' in window ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n // https://github.com/taye/interact.js/issues/703#issuecomment-471570492\n browser.supportsPointerEvent = (navigator as any).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) && /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 =\n navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent)\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = (\n '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 ) as 'matches'\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 = domObjects.document && 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n","import type { Rect, Target, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport domObjects from './domObjects'\nimport is from './is'\nimport * as win from './window'\n\nexport function nodeContains (parent: Node, child: Node) {\n if (parent.contains) {\n return parent.contains(child as Node)\n }\n\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)) {\n return element\n }\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: 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: Node | Document | ShadowRoot) => el.parentNode || (el as ShadowRoot).host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Element[] | NodeListOf) {\n let deepestNodeParents: Node[] = []\n let deepestNodeIndex: number\n\n for (let i = 0; i < elements.length; i++) {\n const currentNode = elements[i]\n const deepestNode: Node = elements[deepestNodeIndex]\n\n // node may appear in elements array multiple times\n if (!currentNode || i === deepestNodeIndex) {\n continue\n }\n\n if (!deepestNode) {\n deepestNodeIndex = i\n continue\n }\n\n const currentNodeParent = getParent(currentNode)\n const deepestNodeParent = getParent(deepestNode)\n\n // check if the deepest or current are document.documentElement/rootElement\n // - if the current node is, do nothing and continue\n if (currentNodeParent === currentNode.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current node and continue to next\n else if (deepestNodeParent === currentNode.ownerDocument) {\n deepestNodeIndex = i\n continue\n }\n\n // compare zIndex of siblings\n if (currentNodeParent === deepestNodeParent) {\n if (zIndexIsHigherThan(currentNode, deepestNode)) {\n deepestNodeIndex = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest node\n deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode)\n\n let ancestryStart: Node\n\n // if the deepest node is an HTMLElement and the current node is a non root svg element\n if (\n deepestNode instanceof domObjects.HTMLElement &&\n currentNode instanceof domObjects.SVGElement &&\n !(currentNode instanceof domObjects.SVGSVGElement)\n ) {\n // TODO: is this check necessary? Was this for HTML elements embedded in SVG?\n if (currentNode === deepestNodeParent) {\n continue\n }\n\n ancestryStart = currentNode.ownerSVGElement\n } else {\n ancestryStart = currentNode\n }\n\n const currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument)\n let commonIndex = 0\n\n // get (position of closest common ancestor) + 1\n while (\n currentNodeParents[commonIndex] &&\n currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]\n ) {\n commonIndex++\n }\n\n const parents = [\n currentNodeParents[commonIndex - 1],\n currentNodeParents[commonIndex],\n deepestNodeParents[commonIndex],\n ]\n\n if (parents[0]) {\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestNodeIndex = i\n deepestNodeParents = currentNodeParents\n\n break\n } else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n }\n\n return deepestNodeIndex\n}\n\nfunction getNodeParents (node: Node, limit?: Node) {\n const parents: Node[] = []\n let parent: Node = node\n let parentParent: Node\n\n while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) {\n parents.unshift(parent)\n parent = parentParent\n }\n\n return parents\n}\n\nfunction zIndexIsHigherThan (higherNode: Node, lowerNode: Node) {\n const higherIndex = parseInt(win.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0\n const lowerIndex = parseInt(win.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0\n\n return higherIndex >= lowerIndex\n}\n\nexport function matchesUpTo (element: 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 Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Element) {\n return (element as any).correspondingUseElement || element\n}\n\nexport function getScrollXY (relevantWindow?: Window) {\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: Element): Required {\n const clientRect =\n element instanceof domObjects.SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]\n\n return (\n 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}\n\nexport function getElementRect (element: 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: Target) {\n if (!is.string(value)) {\n return false\n }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\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 type {\n HasGetRect,\n RectResolvable,\n Rect,\n Element,\n Point,\n FullRect,\n EdgeOptions,\n} from '@interactjs/core/types'\n\nimport { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport is from './is'\n\nexport function getStringOptionResult (value: any, target: HasGetRect, element: Node) {\n if (value === 'parent') {\n return parentNode(element)\n }\n\n if (value === 'self') {\n return target.getRect(element as Element)\n }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: RectResolvable,\n target?: 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 } 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 Rect\n}\n\nexport function toFullRect (rect: Rect): FullRect {\n const { top, left, bottom, right } = rect\n const width = rect.width ?? rect.right - rect.left\n const height = rect.height ?? rect.bottom - rect.top\n\n return { top, left, bottom, right, width, height }\n}\n\nexport function rectToXY (rect: Rect | Point) {\n return (\n rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n )\n}\n\nexport function xywhToTlbr> (rect: T) {\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 as Rect & T\n}\n\nexport function tlbrToXywh (rect: Rect & Partial) {\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 as FullRect & Point\n}\n\nexport function addEdges (edges: EdgeOptions, rect: Rect, delta: Point) {\n if (edges.left) {\n rect.left += delta.x\n }\n if (edges.right) {\n rect.right += delta.x\n }\n if (edges.top) {\n rect.top += delta.y\n }\n if (edges.bottom) {\n rect.bottom += delta.y\n }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n","import type { PerActionDefaults } from '@interactjs/core/options'\nimport type { ActionName, HasGetRect } from '@interactjs/core/types'\n\nimport { rectToXY, resolveRectLike } from './rect'\n\nexport default function getOriginXY (\n target: HasGetRect & { options: PerActionDefaults },\n element: Node,\n actionName?: ActionName,\n) {\n const actionOptions = actionName && (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","import type { EventTypes, Listener, ListenersArg } from '@interactjs/core/types'\n\nimport is from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Listener[]\n}\n\nexport default function normalize (\n type: EventTypes,\n listeners?: ListenersArg | ListenersArg[] | null,\n filter = (_typeOrPrefix: string) => true,\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 type.forEach((t) => normalize(t, listeners, filter, result))\n return result\n }\n\n // before: type = [{ drag: () => {} }], listeners = undefined\n // after: type = '' , listeners = [{ drag: () => {} }]\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners) && filter(type)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n } else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, filter, result)\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], filter, result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n","export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n","const VENDOR_PREFIXES = ['webkit', 'moz']\n\nexport default function pointerExtend (dest: Partial }>, source: T) {\n dest.__set ||= {} as any\n\n for (const prop in source) {\n // skip deprecated prefixed properties\n if (VENDOR_PREFIXES.some((prefix) => prop.indexOf(prefix) === 0)) continue\n\n if (typeof dest[prop] !== 'function' && prop !== '__set') {\n Object.defineProperty(dest, prop, {\n get () {\n if (prop in dest.__set) return dest.__set[prop]\n\n return (dest.__set[prop] = source[prop] as any)\n },\n set (value: any) {\n dest.__set[prop] = value\n },\n configurable: true,\n })\n }\n }\n return dest\n}\n","import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { CoordsSetMember, PointerType, Point, PointerEventType, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: CoordsSetMember, src: 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: CoordsSetMember, prev: CoordsSetMember, cur: 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: CoordsSetMember, delta: 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: 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: string, pointer: PointerType | InteractEvent, xy: Point) {\n xy = xy || ({} as Point)\n type = type || 'page'\n\n xy.x = pointer[(type + 'X') as 'pageX']\n xy.y = pointer[(type + 'Y') as 'pageY']\n\n return xy\n}\n\nexport function getPageXY (pointer: PointerType | InteractEvent, page?: 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 } else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer: PointerType, client: Point) {\n client = client || ({} as any)\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n } else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer: { pointerId?: number, identifier?: number, type?: string }) {\n return is.number(pointer.pointerId) ? pointer.pointerId! : pointer.identifier!\n}\n\nexport function setCoords (dest: CoordsSetMember, pointers: any[], timeStamp: number) {\n const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]\n\n getPageXY(pointer, dest.page)\n getClientXY(pointer, dest.client)\n\n dest.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event: TouchEvent | PointerType[]) {\n const touches: PointerType[] = []\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 } else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\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: PointerType[]) {\n const average = {\n pageX: 0,\n pageY: 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n type CoordKeys = keyof typeof average\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop as CoordKeys] += pointer[prop as CoordKeys]\n }\n }\n for (const prop in average) {\n average[prop as CoordKeys] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: PointerType[]) {\n if (!event.length) {\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: { pointerType?: string, identifier?: number, type?: string }) {\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: Event) {\n const path = is.func(event.composedPath)\n ? (event.composedPath() as Element[])\n : (event as unknown as { path: Element[] }).path\n\n return [\n domUtils.getActualElement(path ? path[0] : (event.target as Element)),\n domUtils.getActualElement(event.currentTarget as Element),\n ]\n}\n\nexport function newCoords (): 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 () {\n return this.coords.page\n },\n get client () {\n return this.coords.client\n },\n get timeStamp () {\n return this.coords.timeStamp\n },\n get pageX () {\n return this.coords.page.x\n },\n get pageY () {\n return this.coords.page.y\n },\n get clientX () {\n return this.coords.client.x\n },\n get clientY () {\n return this.coords.client.y\n },\n get pointerId () {\n return this.coords.pointerId\n },\n get target () {\n return this.coords.target\n },\n get type () {\n return this.coords.type\n },\n get pointerType () {\n return this.coords.pointerType\n },\n get buttons () {\n return this.coords.buttons\n },\n preventDefault () {},\n }\n\n return event as typeof event & PointerType & PointerEventType\n}\n\nexport interface MockCoords {\n page: Point\n client: 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 type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName } from '@interactjs/core/types'\n\nexport class BaseEvent {\n declare type: string\n declare target: EventTarget\n declare currentTarget: Node\n declare interactable: Interactable\n declare _interaction: Interaction\n declare timeStamp: number\n immediatePropagationStopped = false\n propagationStopped = false\n\n constructor (interaction: 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\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface BaseEvent {\n interaction: InteractionProxy\n}\n\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperty(BaseEvent.prototype, 'interaction', {\n get (this: BaseEvent) {\n return this._interaction._proxy\n },\n set (this: BaseEvent) {},\n})\n","type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport const contains = (array: T[], target: T) => array.indexOf(target) !== -1\n\nexport const remove = (array: T[], target: T) => array.splice(array.indexOf(target), 1)\n\nexport const merge = (target: Array, source: U[]) => {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport const from = (source: ArrayLike) => merge([] as T[], source as T[])\n\nexport const 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 const find = (array: T[], func: Filter): T | undefined => array[findIndex(array, func)]\n","import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\n\nimport type { DropState } from './plugin'\n\nexport class DropEvent extends BaseEvent<'drag'> {\n declare target: Element\n dropzone: Interactable\n dragEvent: InteractEvent<'drag'>\n relatedTarget: Element\n draggable: Interactable\n propagationStopped = false\n immediatePropagationStopped = false\n\n /**\n * Class of events fired on dropzones during drags with acceptable targets.\n */\n constructor (dropState: DropState, dragEvent: InteractEvent<'drag'>, type: string) {\n super(dragEvent._interaction)\n\n const { element, dropzone } = type === 'dragleave' ? dropState.prev : 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 || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)\n ) {\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(\n activeDrops,\n ({ dropzone, element }) => dropzone === this.dropzone && element === this.target,\n )\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 } 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","import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, PointerEventType, Rect, ListenersArg } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '../drag/plugin'\n\nimport type { DragEvent } from '../drag/plugin'\nimport drag from '../drag/plugin'\n/* eslint-enable import/no-duplicates */\n\nimport { DropEvent } from './DropEvent'\n\nexport type DropFunctionChecker = (\n dragEvent: any, // related drag operation\n event: any, // touch or mouse EventEmitter\n dropped: boolean, // default checker result\n dropzone: Interactable, // dropzone interactable\n dropElement: Element, // drop zone element\n draggable: Interactable, // draggable's Interactable\n draggableElement: Element, // dragged element\n) => boolean\n\nexport interface DropzoneOptions extends PerActionDefaults {\n accept?:\n | string\n | Element\n | (({ dropzone, draggableElement }: { dropzone: Interactable, draggableElement: Element }) => boolean)\n // How the overlap is checked on the drop zone\n overlap?: 'pointer' | 'center' | number\n checker?: DropFunctionChecker\n\n ondropactivate?: ListenersArg\n ondropdeactivate?: ListenersArg\n ondragenter?: ListenersArg\n ondragleave?: ListenersArg\n ondropmove?: ListenersArg\n ondrop?: ListenersArg\n}\n\nexport interface DropzoneMethod {\n (this: Interactable, options: DropzoneOptions | boolean): Interactable\n (): DropzoneOptions\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n dropzone: DropzoneMethod\n dropCheck: (\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElemen: 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/InteractEvent' {\n interface InteractEvent {\n prevDropzone?: Interactable\n dropzone?: Interactable\n dragEnter?: Element\n dragLeave?: Element\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drop: DropzoneOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\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\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drop?: typeof drop\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n interface InteractStatic {\n dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this\n }\n}\n\ninterface DropSignalArg {\n interaction: Interaction<'drag'>\n dragEvent: DragEvent\n}\n\nexport interface ActiveDrop {\n dropzone: Interactable\n element: Element\n rect: Rect\n}\n\nexport interface DropState {\n cur: {\n // the dropzone a drag target might be dropped into\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n prev: {\n // the dropzone that was recently dragged away from\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n // wheather the potential drop was rejected from a listener\n rejected: boolean\n // the drop events related to the current drag event\n events: FiredDropEvents\n activeDrops: ActiveDrop[]\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n /** @lends module:interact */\n interactStatic: interact,\n /** @lends Interactable */\n Interactable,\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 {object | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.dropzone = function (this: Interactable, options) {\n return dropzoneMethod(this, options)\n } as Interactable['dropzone']\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 (\n this: Interactable,\n dragEvent,\n event,\n draggable,\n draggableElement,\n dropElement,\n rect,\n ) {\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 (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 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 collectDropzones ({ interactables }: Scope, draggableElement: Element) {\n const drops: ActiveDrop[] = []\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) {\n continue\n }\n\n const accept = dropzone.options.drop.accept\n\n // test the draggable draggableElement against the dropzone's accept setting\n if (\n (is.element(accept) && accept !== draggableElement) ||\n (is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||\n (is.func(accept) && !accept({ dropzone, draggableElement }))\n ) {\n continue\n }\n\n for (const dropzoneElement of dropzone.getAllElements()) {\n if (dropzoneElement !== draggableElement) {\n drops.push({\n dropzone,\n element: dropzoneElement,\n rect: dropzone.getRect(dropzoneElement),\n })\n }\n }\n }\n\n return drops\n}\n\nfunction fireActivationEvents (activeDrops: ActiveDrop[], event: DropEvent) {\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: Element) {\n // get dropzones and their elements that could receive the draggable\n const activeDrops = collectDropzones(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 (\n { dropState, interactable: draggable, element: dragElement }: Interaction,\n dragEvent,\n pointerEvent,\n) {\n const validDrops: Element[] = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {\n const isValid = dropzone.dropCheck(\n dragEvent,\n pointerEvent,\n draggable!,\n dragElement!,\n dropzoneElement,\n rect,\n )\n validDrops.push(isValid ? dropzoneElement : null)\n }\n\n // get the most appropriate dropzone based on DOM depth and order\n const dropIndex = domUtils.indexOfDeepestElement(validDrops)\n\n return dropState!.activeDrops[dropIndex] || null\n}\n\nfunction getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {\n const dropState = interaction.dropState!\n const dropEvents: Record = {\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 as never\n dropEvents.activate.dropzone = null as never\n }\n if (dragEvent.type === 'dragend') {\n dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')\n\n dropEvents.deactivate.target = null as never\n dropEvents.deactivate.dropzone = null as never\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 dragEvent.dropzone = dropState.cur.dropzone\n }\n\n return dropEvents\n}\n\ntype FiredDropEvents = Partial<\nRecord<'leave' | 'enter' | 'move' | 'drop' | 'activate' | 'deactivate', DropEvent>\n>\n\nfunction fireDropEvents (interaction: Interaction, events: FiredDropEvents) {\n const dropState = interaction.dropState!\n const { activeDrops, cur, prev } = dropState\n\n if (events.leave) {\n prev.dropzone.fire(events.leave)\n }\n if (events.enter) {\n cur.dropzone.fire(events.enter)\n }\n if (events.move) {\n cur.dropzone.fire(events.move)\n }\n if (events.drop) {\n cur.dropzone.fire(events.drop)\n }\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 }: DoPhaseArg<'drag', EventPhase>, scope: Scope) {\n if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') {\n return\n }\n\n const dropState = interaction.dropState!\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 =\n 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: Interactable): DropzoneOptions\nfunction dropzoneMethod(interactable: Interactable, options: DropzoneOptions | boolean): Interactable\nfunction dropzoneMethod (interactable: Interactable, options?: DropzoneOptions | boolean) {\n if (is.object(options)) {\n interactable.options.drop.enabled = options.enabled !== false\n\n if (options.listeners) {\n const normalized = 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 const prevListeners = interactable.options.drop.listeners\n prevListeners && interactable.off(prevListeners)\n\n interactable.on(corrected)\n interactable.options.drop.listeners = corrected\n }\n\n if (is.func(options.ondrop)) {\n interactable.on('drop', options.ondrop)\n }\n if (is.func(options.ondropactivate)) {\n interactable.on('dropactivate', options.ondropactivate)\n }\n if (is.func(options.ondropdeactivate)) {\n interactable.on('dropdeactivate', options.ondropdeactivate)\n }\n if (is.func(options.ondragenter)) {\n interactable.on('dragenter', options.ondragenter)\n }\n if (is.func(options.ondragleave)) {\n interactable.on('dragleave', options.ondragleave)\n }\n if (is.func(options.ondropmove)) {\n interactable.on('dropmove', options.ondropmove)\n }\n\n if (/^(pointer|center)$/.test(options.overlap as string)) {\n interactable.options.drop.overlap = options.overlap\n } else if (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 (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: Interactable,\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElement: 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n : false\n }\n\n const dropOverlap = interactable.options.drop.overlap\n\n if (dropOverlap === 'pointer') {\n const origin = getOriginXY(draggable, draggableElement, 'drag')\n const page = pointerUtils.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 && is.number(dropOverlap)) {\n const overlapArea =\n 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n }\n\n return dropped\n}\n\nconst drop: Plugin = {\n id: 'actions/drop',\n install,\n listeners: {\n 'interactions:before-action-start': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\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': (\n { interaction, event, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n\n // reset active dropzones\n dropState.activeDrops = []\n dropState.events = {}\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 'interactions:action-move': onEventCreated,\n\n 'interactions:after-action-move': (\n { interaction, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n fireDropEvents(interaction, dropState.events)\n\n scope.fire('actions/drop:move', { interaction, dragEvent })\n dropState.events = {}\n },\n\n 'interactions:action-end': (arg: DoPhaseArg<'drag', EventPhase>, scope) => {\n if (arg.interaction.prepared.name !== 'drag') {\n return\n }\n\n const { interaction, iEvent: dragEvent } = arg\n\n onEventCreated(arg, scope)\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') {\n return\n }\n\n const { dropState } = interaction\n\n if (dropState) {\n dropState.activeDrops = null as never\n dropState.events = null as never\n dropState.cur.dropzone = null as never\n dropState.cur.element = null as never\n dropState.prev.dropzone = null as never\n dropState.prev.element = null as never\n dropState.rejected = false\n }\n },\n },\n getActiveDrops,\n getDrop,\n getDropEvents,\n fireDropEvents,\n\n filterEventType: (type: string) => type.search('drag') === 0 || type.search('drop') === 0,\n\n defaults: {\n enabled: false,\n accept: null as never,\n overlap: 'pointer',\n } as DropzoneOptions,\n}\n\nexport default drop\n","import type { InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, Rect, PointerType, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport type GesturableMethod = 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/options' {\n interface ActionDefaults {\n gesture: GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GesturableOptions extends PerActionDefaults {\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface GestureEvent extends 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: Rect // enclosing box of all points\n touches: PointerType[]\n}\n\nexport interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> {\n iEvent: GestureEvent\n interaction: Interaction<'gesture'>\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 (\n this: InstanceType,\n options: GesturableOptions | boolean,\n ) {\n if (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 (is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as GesturableOptions\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 = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = pointerUtils.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n } else if (ending || interaction.pointers.length < 2) {\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 } else {\n iEvent.distance = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = pointerUtils.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 (is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: 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 getCursor () {\n return ''\n },\n\n filterEventType: (type: string) => type.search('gesture') === 0,\n}\n\nexport default gesture\n","import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type {\n ActionName,\n ActionProps,\n ActionMethod,\n EdgeOptions,\n FullRect,\n ListenersArg,\n OrBoolean,\n Point,\n Rect,\n} from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = 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/options' {\n interface ActionDefaults {\n resize: ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizableOptions extends PerActionDefaults {\n square?: boolean\n preserveAspectRatio?: boolean\n edges?: EdgeOptions | null\n axis?: 'x' | 'y' | 'xy' // deprecated\n invert?: 'none' | 'negate' | 'reposition'\n margin?: number\n squareResize?: boolean\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface ResizeEvent

extends InteractEvent<'resize', P> {\n deltaRect?: FullRect\n edges?: 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: Interactable, options: 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) {\n return undefined\n }\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(\n edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin,\n )\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 } 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: Interactable, options: 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 } 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 } 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: Point,\n element: Node,\n interactableElement: Element,\n rect: Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) {\n return false\n }\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, Math.abs((name === 'left' || name === 'right' ? width : height) / 2))\n\n if (width < 0) {\n if (name === 'left') {\n name = 'right'\n } else if (name === 'right') {\n name = 'left'\n }\n }\n if (height < 0) {\n if (name === 'top') {\n name = 'bottom'\n } else if (name === 'bottom') {\n name = 'top'\n }\n }\n\n if (name === 'left') {\n const edge = width >= 0 ? rect.left : rect.right\n return page.x < edge + margin\n }\n if (name === 'top') {\n const edge = height >= 0 ? rect.top : rect.bottom\n return page.y < edge + margin\n }\n\n if (name === 'right') {\n return page.x > (width >= 0 ? rect.right : rect.left) - margin\n }\n if (name === 'bottom') {\n return page.y > (height >= 0 ? rect.bottom : rect.top) - margin\n }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) {\n return false\n }\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\n/* eslint-disable multiline-ternary */\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nfunction initCursors (browser: typeof import('@interactjs/utils/browser').default) {\n return browser.isIe9\n ? {\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 : {\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/* eslint-enable multiline-ternary */\n\nfunction start ({ iEvent, interaction }: { iEvent: 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: 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 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 } 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: 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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\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 } else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n } else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n } else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: 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 ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\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 filterEventType: (type: string) => type.search('resize') === 0,\n\n defaultMargin: null as number,\n}\n\nexport default resize\n","import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './drag/plugin'\nimport './drop/plugin'\nimport './gesture/plugin'\nimport './resize/plugin'\n\nimport drag from './drag/plugin'\nimport drop from './drop/plugin'\nimport gesture from './gesture/plugin'\nimport resize from './resize/plugin'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'actions',\n install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n },\n}\n","let lastTime = 0\nlet request: typeof requestAnimationFrame\nlet cancel: typeof cancelAnimationFrame\n\nfunction init (global: Window | typeof globalThis) {\n request = global.requestAnimationFrame\n cancel = global.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = global[`${vendor}RequestAnimationFrame` as 'requestAnimationFrame']\n cancel =\n global[`${vendor}CancelAnimationFrame` as 'cancelAnimationFrame'] ||\n global[`${vendor}CancelRequestAnimationFrame` as 'cancelAnimationFrame']\n }\n }\n\n request = request && request.bind(global)\n cancel = cancel && cancel.bind(global)\n\n if (!request) {\n request = (callback) => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n const token = global.setTimeout(() => {\n // eslint-disable-next-line n/no-callback-literal\n callback(currTime + timeToCall)\n }, timeToCall)\n\n lastTime = currTime + timeToCall\n return token as any\n }\n\n cancel = (token) => clearTimeout(token)\n }\n}\n\nexport default {\n request: (callback: FrameRequestCallback) => request(callback),\n cancel: (token: number) => cancel(token),\n init,\n}\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, PointerType } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\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/options' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement | string\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const { defaults, actions } = 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 Interaction | null,\n i: 0, // the handle returned by window.setInterval\n\n // Direction each pulse is to scroll in\n x: 0,\n y: 0,\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: 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 = 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 } 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: Interactable, actionName: ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll?.enabled\n },\n onInteractionMove ({\n interaction,\n pointer,\n }: {\n interaction: Interaction\n pointer: PointerType\n }) {\n if (\n !(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))\n ) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top: boolean\n let right: boolean\n let bottom: boolean\n let left: boolean\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 } 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: Interactable, element: Element) {\n return (\n (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n )\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta (\n {\n interaction,\n element,\n }: {\n interaction: Partial>\n element: Element\n },\n func: any,\n) {\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(scrollOptions.container, interaction.interactable, element)\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: 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 type { ActionName, ActionProps } from '@interactjs/core/types'\n\nimport { window } from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n return function (this: T) {\n if (!warned) {\n ;(window as any).console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: ActionProps, src: ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport const sign = (n: number) => (n >= 0 ? 1 : -1)\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport { warnOnce } from '@interactjs/utils/misc'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ) => 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\nfunction install (scope: 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: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ): 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 * 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 * @deprecated\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\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: Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\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 * @deprecated\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\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: 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: Interactable,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n scope: Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons =\n (event as MouseEvent).buttons ||\n {\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: Interactable): boolean\nfunction styleCursor(this: Interactable, newValue: boolean): typeof this\nfunction styleCursor (this: 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: 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 type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type {\n CursorChecker,\n PointerType,\n PointerEventType,\n Element,\n ActionName,\n ActionProps,\n} from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport { copyAction } from '@interactjs/utils/misc'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './InteractableMethods'\nimport InteractableMethods from './InteractableMethods'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Omit & {\n interaction: Interaction\n }\n 'autoStart:prepared': { interaction: Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/options' {\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 | Element\n ignoreFrom?: string | Element\n cursorChecker?: 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 // TODO: docst\n mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interactable\n interaction: Interaction\n element: Element\n action: 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: Element\n}\n\nfunction install (scope: Scope) {\n const { interactStatic: interact, defaults } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n 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: number) => 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 (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n if (interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:move'],\n scope: Scope,\n) {\n if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction } = arg\n\n if (\n !interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name\n ) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName = (interaction as Interaction).prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (\n interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)\n ) {\n interaction.stop()\n } else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interaction }, scope: 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: ActionProps,\n interactable: Interactable,\n element: Element,\n eventTarget: Node,\n scope: Scope,\n) {\n if (\n interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)\n ) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n matches: Interactable[],\n matchElements: Element[],\n eventTarget: Node,\n scope: 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) {\n continue\n }\n\n const action = validateAction(matchAction, match, matchElement, eventTarget, 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: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n eventTarget: Node,\n scope: Scope,\n) {\n let matches: Interactable[] = []\n let matchElements: Element[] = []\n\n let element = eventTarget as Element\n\n function pushMatches (interactable: Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(\n interaction,\n pointer,\n event,\n matches,\n matchElements,\n eventTarget,\n scope,\n )\n\n if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = domUtils.parentNode(element) as Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interaction,\n {\n action,\n interactable,\n element,\n }: {\n action: ActionProps\n interactable: Interactable\n element: Element\n },\n scope: Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name ? interactable.getRect(element) : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n scope: 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)) {\n return false\n }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) {\n continue\n }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) {\n continue\n }\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: Scope) {\n if (is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Element, cursor: string, scope: 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: Interaction, scope: 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 = interactable.options[prepared.name].cursorChecker\n\n if (is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n } else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Plugin = {\n id: 'auto-start/base',\n before: ['actions'],\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}\n\nexport default autoStart\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { SignalArgs, Scope } from '@interactjs/core/scope'\nimport type { ActionName, Element } from '@interactjs/core/types'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\n\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: 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 =\n 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 as Interaction).prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Element\n\n const getDraggable = function (interactable: Interactable): Interactable | void {\n if (interactable === interaction.interactable) return\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer,\n interaction.downEvent,\n interaction,\n element,\n )\n\n if (\n action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)\n ) {\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 as Interaction).prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interactable) {\n if (!interactable) {\n return false\n }\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 type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable */\n\ndeclare module '@interactjs/core/options' {\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: Scope) {\n const { defaults } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction: Interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) {\n return null\n }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nconst hold: Plugin = {\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.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n interaction.autoStartHoldTimer = null\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const holdDuration = getHoldDuration(interaction)\n\n if (holdDuration > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\nexport default hold\n","import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './dragAxis'\nimport './hold'\n\nimport autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'auto-start',\n install (scope: Scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n },\n}\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerEventType } from '@interactjs/core/types'\nimport { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport 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\ntype PreventDefaultValue = 'always' | 'never' | 'auto'\nfunction preventDefault(this: Interactable): PreventDefaultValue\nfunction preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this\nfunction preventDefault (this: Interactable, newValue?: PreventDefaultValue) {\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: Interactable, scope: 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 (scope.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 (\n is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')\n ) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interaction, event: PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: 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 (\n interaction.element &&\n (interaction.element === event.target || nodeContains(interaction.element, event.target))\n ) {\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","export default {}\n","import type { Actions } from '@interactjs/core/types'\n\nexport default function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) {\n return true\n }\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","// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport '@interactjs/dev-tools/visualizer/plugin'\n\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, OptionMethod } from '@interactjs/core/types'\n// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport visualizer from '@interactjs/dev-tools/visualizer/plugin'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n visializer: typeof visualizer\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools: 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: Interaction) => boolean\n getInfo: (interaction: 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\n// eslint-disable-next-line no-undef\nconst isProduction = process.env.NODE_ENV === 'production'\n\nfunction install (scope: Scope, { logger }: { logger?: Logger } = {}) {\n const { Interactable, defaults } = 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 // can't set native events on non string targets without `addEventListener` prop\n const { _onOff } = Interactable.prototype\n Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) {\n if (is.string(this.target) || this.target.addEventListener) {\n return _onOff.call(this, method, typeArg, listenerArg, options, filter)\n }\n\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const normalizedListeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (const type in normalizedListeners) {\n if (isNonNativeEvent(type, scope.actions)) continue\n scope.logger.warn(\n prefix +\n `Can't add native \"${type}\" event listener to target without \\`addEventListener(type, listener, options)\\` prop.`,\n )\n }\n\n return _onOff.call(this, method, normalizedListeners, options)\n }\n scope.usePlugin(visualizer)\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !!element && !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [element, links.touchAction]\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 (\n interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n )\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [element, links.boxSizing]\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 [interaction.prepared.name, interaction.interactable]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n const value = element.style[prop] || win.window.getComputedStyle(element)[prop]\n return styleRe.test((value || '').toString())\n}\n\nfunction parentHasStyle (element: 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: 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 * as arr from './arr'\nimport 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 } else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n } else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n","import type { EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { Modifier, ModifierArg, ModifierState } from './types'\n\nexport interface ModificationResult {\n delta: Point\n rectDelta: Rect\n coords: Point\n rect: FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: EventPhase\n pageCoords: Point\n rect: FullRect\n coords: Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta!: Point\n result!: ModificationResult\n endResult!: Point\n startEdges!: EdgeOptions\n edges: EdgeOptions\n readonly interaction: Readonly\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n this.result = createResult()\n this.edges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n }\n\n start ({ phase }: { phase: EventPhase }, pageCoords: Point) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.startEdges = extend({}, interaction.edges)\n this.edges = extend({}, this.startEdges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg = this.fillArg({\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 ||= interaction.rect\n arg.edges ||= this.startEdges\n arg.startOffset = this.startOffset\n\n return arg as ModifierArg\n }\n\n startAll (arg: MethodArg & Partial) {\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 const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n arg.edges = extend({}, unmodifiedEdges)\n\n const states = skipModifiers ? this.states.slice(skipModifiers) : 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(arg.edges, arg.rect, {\n x: arg.coords.x - lastModifierCoords.x,\n y: arg.coords.y - lastModifierCoords.y,\n })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n extend(this.edges, arg.edges)\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\n if (prevCoords && prevRect) {\n const rectChanged =\n 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 =\n rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y\n }\n\n return newResult\n }\n\n applyToInteraction (arg: { phase: EventPhase, rect?: 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 [\n [startCoords, startDelta],\n [curCoords, curDelta],\n ] 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 (\n arg: Partial & {\n phase: EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Point\n },\n ): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll(\n this.fillArg({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n }),\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 (\n !result.changed &&\n (!skipModifiers || skipModifiers < this.states.length) &&\n interaction.interacting()\n ) {\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, arg.phase, 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: Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend(\n {\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n },\n arg,\n )\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) {\n state.methods.stop(modifierArg as ModifierArg)\n }\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 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: 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, requireEndOnly?: boolean) {\n if (\n // ignore disabled modifiers\n !options ||\n options.enabled === false ||\n // check if we require endOnly option to fire move before end\n (requireEndOnly && !options.endOnly) ||\n // don't apply endOnly modifiers when not ending\n (options.endOnly && !preEnd) ||\n // check if modifier should run be applied on start\n (phase === 'start' && !options.setStart)\n ) {\n return false\n }\n\n return true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.startEdges = other.startEdges\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?: Point, rect?: 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\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map((type) => {\n const options = actionOptions[type]\n\n return (\n options &&\n options.enabled && {\n options,\n methods: options._methods,\n }\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 type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\n\nimport Modification from './Modification'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\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}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n Result,\n> (module: ModifierModule, name?: Name) {\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 = (_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 as any)[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = {\n options,\n methods,\n name,\n enable: () => {\n options.enabled = true\n return m\n },\n disable: () => {\n options.enabled = false\n return m\n },\n }\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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\n const result = interaction.modification!.result\n\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Plugin = {\n id: 'modifiers/base',\n before: ['actions'],\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 { interaction } = arg\n const modification = arg.interaction.modification!\n\n modification.start(arg, interaction.coords.start.page)\n interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.setAndApply(arg)\n interaction.edges = modification.edges\n\n return ret\n },\n\n 'interactions:before-action-end': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.beforeEnd(arg)\n interaction.edges = modification.startEdges\n\n return ret\n },\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}\n\nexport default modifiersBase\n","import type { Point, Listeners, OrBoolean, Element, Rect } from '@interactjs/core/types'\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\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Node\n getRect?: (element: Element) => Rect\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Point | string | Element\n listeners?: Listeners\n allowFrom?: string | Element\n ignoreFrom?: string | Element\n}\n\nexport type Options = Partial &\nPartial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\nexport interface OptionsArg extends BaseDefaults, 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","import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\n\nimport { BaseEvent } from './BaseEvent'\nimport type { Interaction } from './Interaction'\nimport { defaults } from './options'\nimport type { ActionName } from './types'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface InteractEvent {\n pageX: number\n pageY: number\n\n clientX: number\n clientY: number\n\n dx: number\n dy: number\n\n velocityX: number\n velocityY: number\n}\n\nexport class InteractEvent<\n T extends ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n declare target: Element\n declare currentTarget: Element\n relatedTarget: Element | 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: Point\n client: Point\n delta: Point\n rect: FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Point\n speed: number\n swipe: ReturnType['getSwipe']>\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: PointerEventType,\n actionName: T,\n phase: P,\n element: 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 ? interaction.pointers[interaction.pointers.length - 1].downTime : 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 } 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 getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 || 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\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperties(InteractEvent.prototype, {\n pageX: {\n get () {\n return this.page.x\n },\n set (value) {\n this.page.x = value\n },\n },\n pageY: {\n get () {\n return this.page.y\n },\n set (value) {\n this.page.y = value\n },\n },\n\n clientX: {\n get () {\n return this.client.x\n },\n set (value) {\n this.client.x = value\n },\n },\n clientY: {\n get () {\n return this.client.y\n },\n set (value) {\n this.client.y = value\n },\n },\n\n dx: {\n get () {\n return this.delta.x\n },\n set (value) {\n this.delta.x = value\n },\n },\n dy: {\n get () {\n return this.delta.y\n },\n set (value) {\n this.delta.y = value\n },\n },\n\n velocityX: {\n get () {\n return this.velocity.x\n },\n set (value) {\n this.velocity.x = value\n },\n },\n velocityY: {\n get () {\n return this.velocity.y\n },\n set (value) {\n this.velocity.y = value\n },\n },\n})\n","import type { PointerEventType, PointerType } from '@interactjs/core/types'\n\nexport class PointerInfo {\n id: number\n pointer: PointerType\n event: PointerEventType\n downTime: number\n downTarget: Node\n\n constructor (id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node) {\n this.id = id\n this.pointer = pointer\n this.event = event\n this.downTime = downTime\n this.downTarget = downTarget\n }\n}\n","import type {\n Element,\n EdgeOptions,\n PointerEventType,\n PointerType,\n FullRect,\n CoordsSet,\n} from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport hypot from '@interactjs/utils/hypot'\nimport { warnOnce, copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { EventPhase } from './InteractEvent'\nimport { InteractEvent } from './InteractEvent'\nimport type { Interactable } from './Interactable'\nimport { PointerInfo } from './PointerInfo'\nimport type { ActionDefaults } from './options'\nimport type { Scope } from './scope'\nimport type { ActionName, ActionProps } from './types'\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: PointerType\n event: PointerEventType\n eventTarget: Node\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: 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': { interaction: Interaction, event: Event, type: '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 = null\n\n // the target element of the interactable\n element: Element | null = null\n rect: FullRect | null = null\n _rects?: {\n start: FullRect\n corrected: FullRect\n previous: FullRect\n delta: FullRect\n }\n edges: EdgeOptions | null = null\n\n _scopeFire: 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: PointerEventType | null = null\n\n downPointer: PointerType = {} as PointerType\n\n _latestPointer: {\n pointer: PointerType\n event: 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\n\n simulation = null\n\n /** @internal */ get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = warnOnce(function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n }, 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: pointerUtils.newCoords(),\n // Previous native pointer move event coordinates\n prev: pointerUtils.newCoords(),\n // current native pointer move event coordinates\n cur: pointerUtils.newCoords(),\n // Change in coordinates and time of the pointer\n delta: pointerUtils.newCoords(),\n // pointer velocity\n velocity: pointerUtils.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: { pointerType?: string, scopeFire: Scope['fire'] }) {\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 () {\n return that[key]\n },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args: any[]) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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 as unknown as Interaction,\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 {Boolean} Whether the interaction was successfully started\n */\n start (action: ActionProps, interactable: Interactable, element: Element): boolean {\n if (\n this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name as keyof ActionDefaults].enabled\n ) {\n return false\n }\n\n 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 ? extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting =\n 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: PointerType, event: PointerEventType, eventTarget: Node) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove =\n 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: number\n let dy: number\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 = 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 as unknown as Interaction,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n pointerUtils.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 pointerUtils.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?: any) {\n if (!signalArg || !signalArg.event) {\n pointerUtils.setZeroCoords(this.coords.delta)\n }\n\n signalArg = extend(\n {\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n },\n signalArg || {},\n )\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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: 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 as unknown as Interaction,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.removePointer(pointer, event)\n }\n\n documentBlur (event: Event) {\n this.end(event as any)\n this._scopeFire('interactions:blur', {\n event,\n type: 'blur',\n interaction: this as unknown as Interaction,\n })\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?: PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult: boolean\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: any) {\n const pointerId = pointerUtils.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 : arr.findIndex(this.pointers, (curPointer) => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer: any) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {\n const id = pointerUtils.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false ? false : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(id, pointer, event, null, null)\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n } else {\n pointerInfo.pointer = pointer\n }\n\n pointerUtils.setCoords(\n this.coords.cur,\n this.pointers.map((p) => p.pointer),\n this._now(),\n )\n pointerUtils.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 pointerUtils.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n pointerUtils.copyCoords(this.coords.start, this.coords.cur)\n pointerUtils.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 as unknown as Interaction,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: PointerType, event: 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 as unknown as Interaction,\n })\n\n this.pointers.splice(pointerIndex, 1)\n this.pointerIsDown = false\n }\n\n _updateLatestPointer (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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

(\n event: PointerEventType,\n phase: P,\n preEnd?: boolean,\n type?: string,\n ) {\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

(\n signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent },\n ) {\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 rectUtils.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') {\n this.prevEvent = iEvent\n }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () {\n return Date.now()\n }\n}\n\nexport default Interaction\nexport { PointerInfo }\n","import type Interaction from '@interactjs/core/Interaction'\nimport { _ProxyMethods } from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\nimport type { Point } from '@interactjs/core/types'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Point\n pending: Point\n }\n }\n\n enum _ProxyMethods {\n offsetBy = '',\n }\n}\n\n;(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interaction) {\n if (!interaction.pointerIsDown) {\n return\n }\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: Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: 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: 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: 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: Interaction, { x, y }: 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 }: Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction: Interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Plugin = {\n id: 'offset',\n before: ['modifiers', 'pointer-events', 'actions', 'inertia'],\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 type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Point, PointerEventType } from '@interactjs/core/types'\nimport Modification from '@interactjs/modifiers/Modification'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/modifiers/base'\nimport '@interactjs/offset/plugin'\nimport * as modifiers from '@interactjs/modifiers/base'\nimport type { ModifierArg } from '@interactjs/modifiers/types'\nimport offset from '@interactjs/offset/plugin'\n/* eslint-enable import/no-duplicates */\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\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/options' {\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': DoPhaseArg\n 'interactions:after-action-inertiastart': DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': DoPhaseArg\n 'interactions:after-action-resume': DoPhaseArg\n }\n}\n\nfunction install (scope: Scope) {\n const { defaults } = 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\n modifierCount = 0\n modifierArg!: ModifierArg\n\n startCoords!: Point\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset!: Point\n modifiedOffset!: Point\n currentOffset!: Point\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout!: number\n readonly interaction: Interaction\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n }\n\n start (event: 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 = modification.fillArg({\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 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.onNextFrame(() => 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.onNextFrame(() => this.smoothEndTick())\n }\n\n onNextFrame (tickFn: () => void) {\n this.timeout = raf.request(() => {\n if (this.active) {\n tickFn()\n }\n })\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: Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0,\n 0,\n this.targetOffset.x,\n this.targetOffset.y,\n this.modifiedOffset.x,\n this.modifiedOffset.y,\n progress,\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.onNextFrame(() => this.inertiaTick())\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.onNextFrame(() => this.smoothEndTick())\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 }: 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 }: 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: 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: Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interaction) {\n return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia\n}\n\nconst inertia: Plugin = {\n id: 'inertia',\n before: ['modifiers', 'actions'],\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) =>\n 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,\n startY: number,\n cpX: number,\n cpY: number,\n endX: number,\n endY: number,\n position: number,\n) {\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","import type { Listener, ListenersArg, Rect } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport type { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\nimport normalize from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped (event: any, listeners: Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) {\n break\n }\n\n listener(event)\n }\n}\n\nexport class 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: T) {\n let listeners: Listener[]\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: 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: 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) {\n continue\n }\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: Element): Rect {\n return null\n }\n}\n","/** @module interact */\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Context, EventTypes, Listener, ListenersArg, Target } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport { warnOnce } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { Interactable } from './Interactable'\nimport type { Options } from './options'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n (target: Target, options?: Options): Interactable\n getPointerAverage: typeof pointerUtils.pointerAverage\n getTouchBBox: typeof pointerUtils.touchBBox\n getTouchDistance: typeof pointerUtils.touchDistance\n getTouchAngle: typeof pointerUtils.touchAngle\n getElementRect: typeof domUtils.getElementRect\n getElementClientRect: typeof domUtils.getElementClientRect\n matchesSelector: typeof domUtils.matchesSelector\n closest: typeof domUtils.closest\n /** @internal */ globalEvents: any\n version: string\n /** @internal */ scope: Scope\n use(\n plugin: Plugin,\n options?: {\n [key: string]: any\n },\n ): any\n isSet(target: Target, options?: any): boolean\n on(type: string | EventTypes, listener: ListenersArg, options?: object): any\n off(type: EventTypes, listener: any, options?: object): any\n debug(): any\n supportsTouch(): boolean\n supportsPointerEvent(): boolean\n stop(): any\n pointerMoveTolerance(newValue?: number): any\n addDocument(doc: Document, options?: object): void\n removeDocument(doc: Document): void\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic\n\nexport function createInteractStatic (scope: Scope): _InteractStatic {\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 */\n const interact = ((target: Target, options: Options) => {\n let interactable = scope.interactables.getExisting(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = interact.globalEvents\n }\n\n return interactable\n }) as _InteractStatic\n\n // expose the functions used to calculate multi-touch properties\n interact.getPointerAverage = pointerUtils.pointerAverage\n interact.getTouchBBox = pointerUtils.touchBBox\n interact.getTouchDistance = pointerUtils.touchDistance\n interact.getTouchAngle = pointerUtils.touchAngle\n\n interact.getElementRect = domUtils.getElementRect\n interact.getElementClientRect = domUtils.getElementClientRect\n interact.matchesSelector = domUtils.matchesSelector\n interact.closest = domUtils.closest\n\n interact.globalEvents = {} as any\n\n // eslint-disable-next-line no-undef\n interact.version = process.env.npm_package_version\n interact.scope = scope\n /**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n */\n interact.use = function (plugin, options) {\n this.scope.usePlugin(plugin, options)\n\n return this\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 {Target} target The Element or string being searched for\n * @param {object} options\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\n interact.isSet = function (target: Target, options?: { context?: Context }): boolean {\n return !!this.scope.interactables.get(target, options && options.context)\n }\n\n /**\n * @deprecated\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 */\n interact.on = warnOnce(function on (type: string | EventTypes, listener: ListenersArg, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type as any[]) {\n this.on(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.on(prop, (type as any)[prop], listener)\n }\n\n return this\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, this.scope.actions)) {\n // if this type of event was never bound\n if (!this.globalEvents[type]) {\n this.globalEvents[type] = [listener]\n } else {\n this.globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n this.scope.events.add(this.scope.document, type, listener as Listener, { options })\n }\n\n return this\n }, 'The interact.on() method is being deprecated')\n\n /**\n * @deprecated\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 */\n interact.off = warnOnce(function off (type: EventTypes, listener: any, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type) {\n this.off(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.off(prop, type[prop], listener)\n }\n\n return this\n }\n\n if (isNonNativeEvent(type, this.scope.actions)) {\n let index: number\n\n if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {\n this.globalEvents[type].splice(index, 1)\n }\n } else {\n this.scope.events.remove(this.scope.document, type, listener, options)\n }\n\n return this\n }, 'The interact.off() method is being deprecated')\n\n interact.debug = function () {\n return this.scope\n }\n\n /**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\n interact.supportsTouch = function () {\n return browser.supportsTouch\n }\n\n /**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\n interact.supportsPointerEvent = function () {\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 */\n interact.stop = function () {\n for (const interaction of this.scope.interactions.list) {\n interaction.stop()\n }\n\n return this\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 */\n interact.pointerMoveTolerance = function (newValue?: number) {\n if (is.number(newValue)) {\n this.scope.interactions.pointerMoveTolerance = newValue\n\n return this\n }\n\n return this.scope.interactions.pointerMoveTolerance\n }\n\n interact.addDocument = function (doc: Document, options?: object) {\n this.scope.addDocument(doc, options)\n }\n\n interact.removeDocument = function (doc: Document) {\n this.scope.removeDocument(doc)\n }\n\n return interact\n}\n","/* eslint-disable no-dupe-class-members */\nimport type { Scope } from '@interactjs/core/scope'\nimport type {\n ActionMap,\n ActionMethod,\n ActionName,\n Actions,\n Context,\n Element,\n EventTypes,\n Listeners,\n ListenersArg,\n OrBoolean,\n Target,\n} from '@interactjs/core/types'\nimport * 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 extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'\n\ntype IgnoreValue = string | Element | boolean\ntype DeltaSource = 'page' | 'client'\n\nconst enum OnOffMethod {\n On,\n Off,\n}\n\n/** */\nexport class Interactable implements Partial {\n /** @internal */ 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: Target\n readonly events = new Eventable()\n readonly _context: Context\n readonly _win: Window\n readonly _doc: Document\n readonly _scopeEvents: Scope['events']\n\n /** */\n constructor (\n target: Target,\n options: any,\n defaultContext: Document | Element,\n scopeEvents: Scope['events'],\n ) {\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 this._scopeEvents = scopeEvents\n\n this.set(options)\n }\n\n setOnEvents (actionName: ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) {\n this.on(`${actionName}start`, phases.onstart)\n }\n if (is.func(phases.onmove)) {\n this.on(`${actionName}move`, phases.onmove)\n }\n if (is.func(phases.onend)) {\n this.on(`${actionName}end`, phases.onend)\n }\n if (is.func(phases.oninertiastart)) {\n this.on(`${actionName}inertiastart`, phases.oninertiastart)\n }\n\n return this\n }\n\n updatePerActionListeners (actionName: ActionName, prev: Listeners | undefined, cur: Listeners | undefined) {\n const actionFilter = (this._actions.map[actionName] as { filterEventType?: (type: string) => boolean })\n ?.filterEventType\n const filter = (type: string) =>\n (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions)\n\n if (is.array(prev) || is.object(prev)) {\n this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this._onOff(OnOffMethod.On, actionName, cur, undefined, filter)\n }\n }\n\n setPerAction (actionName: ActionName, options: 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 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 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\n // set anabled field to true if it exists in the defaults\n if (\n is.object(defaults.perAction[optionName]) &&\n 'enabled' in (defaults.perAction[optionName] as any)\n ) {\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 {Rect} The object's bounding rectangle.\n */\n getRect (element: Element) {\n element = element || (is.element(this.target) ? this.target : 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(): (element: Element) => any | null\n rectChecker(checker: (element: Element) => any): this\n rectChecker (checker?: (element: Element) => any) {\n if (is.func(checker)) {\n this.getRect = (element) => {\n const rect = extend({}, checker.apply(this, element))\n\n if (!(('width' in rect) as unknown)) {\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n return rect\n }\n\n return this\n }\n\n if (checker === null) {\n delete (this as Partial).getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof 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 as keyof ActionMap] as any)[optionName] = 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(): DeltaSource\n deltaSource(newValue: DeltaSource): this\n deltaSource (newValue?: DeltaSource) {\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 /** @internal */\n getAllElements (): Element[] {\n const { target } = this\n\n if (is.string(target)) {\n return Array.from(this._context.querySelectorAll(target))\n }\n\n if (is.func(target) && (target as any).getAllElements) {\n return (target as any).getAllElements()\n }\n\n return is.element(target) ? [target] : []\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 || nodeContains(this._context, element)\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Node,\n ) {\n return (\n !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget)\n )\n }\n\n testAllow (this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!allowFrom) {\n return true\n }\n\n if (!is.element(element)) {\n return false\n }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n } else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!ignoreFrom || !is.element(element)) {\n return false\n }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\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: E) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (\n method: OnOffMethod,\n typeArg: EventTypes,\n listenerArg?: ListenersArg | null,\n options?: any,\n filter?: (type: string) => boolean,\n ) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const listeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (let type in listeners) {\n if (type === 'wheel') {\n type = browser.wheelEvent\n }\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 === OnOffMethod.On ? 'on' : 'off'](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](\n this.target,\n this._context,\n type,\n listener,\n options,\n )\n }\n // remove listener from this Interactable's element\n else {\n this._scopeEvents[method === OnOffMethod.On ? 'add' : 'remove'](\n this.target,\n type,\n listener,\n options,\n )\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: EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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[] | EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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: 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 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 ;(this[methodName] as ActionMethod)(options[actionName])\n }\n\n for (const setting in options) {\n if (setting === 'getRect') {\n this.rectChecker(options.getRect)\n continue\n }\n\n if (is.func((this as any)[setting])) {\n ;(this as any)[setting](options[setting as keyof typeof options])\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 unset () {\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in this._scopeEvents.delegatedEvents) {\n const delegated = this._scopeEvents.delegatedEvents[type]\n\n for (let i = delegated.length - 1; i >= 0; i--) {\n const { selector, context, listeners } = delegated[i]\n\n if (selector === this.target && context === this._context) {\n delegated.splice(i, 1)\n }\n\n for (let l = listeners.length - 1; l >= 0; l--) {\n this._scopeEvents.removeDelegate(\n this.target,\n this._context,\n type,\n listeners[l][0],\n listeners[l][1],\n )\n }\n }\n }\n } else {\n this._scopeEvents.remove(this.target, 'all')\n }\n }\n}\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type { OptionsArg, Options } from '@interactjs/core/options'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { Target } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interactable\n target: Target\n options: OptionsArg\n win: Window\n }\n }\n}\n\nexport class InteractableSet {\n // all set interactables\n list: Interactable[] = []\n\n selectorMap: {\n [selector: string]: Interactable[]\n } = {}\n\n scope: Scope\n\n constructor (scope: Scope) {\n this.scope = scope\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target } = interactable\n const interactablesOnTarget: Interactable[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = arr.findIndex(interactablesOnTarget, (i) => i === interactable)\n interactablesOnTarget.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Target, options?: any): Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) {\n this.selectorMap[target] = []\n }\n this.selectorMap[target].push(interactable)\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(interactable)\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 getExisting (target: Target, options?: Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const interactablesOnTarget: Interactable[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!interactablesOnTarget) return undefined\n\n return arr.find(\n interactablesOnTarget,\n (interactable) =>\n interactable._context === context && (isSelector || interactable.inContext(target as any)),\n )\n }\n\n forEachMatch (node: Node, callback: (interactable: Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret: T\n\n if (\n (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 ) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n","import type { Scope } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport pExtend from '@interactjs/utils/pointerExtend'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { NativeEventTarget } from './NativeTypes'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n events: ReturnType\n }\n}\n\ninterface EventOptions {\n capture: boolean\n passive: boolean\n}\n\ntype PartialEventTarget = Partial\n\ntype ListenerEntry = { func: (event: Event | FakeEvent) => any, options: EventOptions }\n\nfunction install (scope: Scope) {\n const targets: Array<{\n eventTarget: PartialEventTarget\n events: { [type: string]: ListenerEntry[] }\n }> = []\n\n const delegatedEvents: {\n [type: string]: Array<{\n selector: string\n context: Node\n listeners: ListenerEntry[]\n }>\n } = {}\n const documents: Document[] = []\n\n const eventsMethods = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n targets,\n\n supportsOptions: false,\n supportsPassive: false,\n }\n\n // check if browser supports passive events and options arg\n scope.document?.createElement('div').addEventListener('test', null, {\n get capture () {\n return (eventsMethods.supportsOptions = true)\n },\n get passive () {\n return (eventsMethods.supportsPassive = true)\n },\n })\n\n scope.events = eventsMethods\n\n function add (\n eventTarget: PartialEventTarget,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener) return\n\n const options = getOptions(optionalArg)\n let target = arr.find(targets, (t) => t.eventTarget === eventTarget)\n\n if (!target) {\n target = {\n eventTarget,\n events: {},\n }\n\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n }\n\n if (!arr.find(target.events[type], (l) => l.func === listener && optionsMatch(l.options, options))) {\n eventTarget.addEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n target.events[type].push({ func: listener, options })\n }\n }\n\n function remove (\n eventTarget: PartialEventTarget,\n type: string,\n listener?: 'all' | ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return\n\n const targetIndex = arr.findIndex(targets, (t) => t.eventTarget === eventTarget)\n const target = targets[targetIndex]\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(eventTarget, type, 'all')\n }\n }\n return\n }\n\n let typeIsEmpty = false\n const typeListeners = target.events[type]\n\n if (typeListeners) {\n if (listener === 'all') {\n for (let i = typeListeners.length - 1; i >= 0; i--) {\n const entry = typeListeners[i]\n remove(eventTarget, type, entry.func, entry.options)\n }\n return\n } else {\n const options = getOptions(optionalArg)\n\n for (let i = 0; i < typeListeners.length; i++) {\n const entry = typeListeners[i]\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n eventTarget.removeEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n typeListeners.splice(i, 1)\n\n if (typeListeners.length === 0) {\n delete target.events[type]\n typeIsEmpty = true\n }\n\n break\n }\n }\n }\n }\n\n if (typeIsEmpty && !Object.keys(target.events).length) {\n targets.splice(targetIndex, 1)\n }\n }\n\n function addDelegate (\n selector: string,\n context: Node,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = []\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 delegates = delegatedEvents[type]\n let delegate = arr.find(delegates, (d) => d.selector === selector && d.context === context)\n\n if (!delegate) {\n delegate = { selector, context, listeners: [] }\n delegates.push(delegate)\n }\n\n delegate.listeners.push({ func: listener, options })\n }\n\n function removeDelegate (\n selector: string,\n context: Document | Element,\n type: string,\n listener?: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n const delegates = delegatedEvents[type]\n let matchFound = false\n let index: number\n\n if (!delegates) return\n\n // count from last index of delegated to 0\n for (index = delegates.length - 1; index >= 0; index--) {\n const cur = delegates[index]\n // look for matching selector and context Node\n if (cur.selector === selector && cur.context === context) {\n const { listeners } = cur\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 entry = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this target have been removed\n // remove the target from the delegates array\n if (!listeners.length) {\n delegates.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) {\n break\n }\n }\n }\n }\n\n // bound to the interactable context when a DOM event\n // listener is added to a selector interactable\n function delegateListener (event: Event | FakeEvent, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event as Event)\n const delegates = delegatedEvents[event.type]\n const [eventTarget] = pointerUtils.getEventTargets(event as 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 < delegates.length; i++) {\n const cur = delegates[i]\n const { selector, context } = cur\n\n if (\n domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)\n ) {\n const { listeners } = cur\n\n fakeEvent.currentTarget = element\n\n for (const entry of listeners) {\n if (optionsMatch(entry.options, options)) {\n entry.func(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n }\n\n function delegateUseCapture (this: Element, event: Event | FakeEvent) {\n return delegateListener.call(this, event, true)\n }\n\n // for type inferrence\n return eventsMethods\n}\n\nclass FakeEvent implements Partial {\n currentTarget: Node\n originalEvent: Event\n type: string\n\n constructor (originalEvent: Event) {\n this.originalEvent = originalEvent\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\nfunction getOptions (param: { [index: string]: any } | boolean): { capture: boolean, passive: boolean } {\n if (!is.object(param)) {\n return { capture: !!param, passive: false }\n }\n\n return {\n capture: !!param.capture,\n passive: !!param.passive,\n }\n}\n\nfunction optionsMatch (a: Partial | boolean, b: Partial) {\n if (a === b) return true\n\n if (typeof a === 'boolean') return !!b.capture === a && !!b.passive === false\n\n return !!a.capture === !!b.capture && !!a.passive === !!b.passive\n}\n\nexport default {\n id: 'events',\n install,\n}\n","import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerType } from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: EventTarget\n curEventTarget: EventTarget\n scope: 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 (\n interaction.simulation &&\n interaction.simulation.allowResume &&\n interaction.pointerType === pointerType\n ) {\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)) {\n continue\n }\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: Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n","import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Listener } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport InteractionBase from './Interaction'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './interactablePreventDefault'\nimport interactablePreventDefault from './interactablePreventDefault'\n/* eslint-enable import/no-duplicates */\nimport type { SearchDetails } from './interactionFinder'\nimport finder from './interactionFinder'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: Array>\n listeners: { [type: string]: Listener }\n docEvents: Array<{ type: string, listener: Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown',\n 'pointerMove',\n 'pointerUp',\n 'updatePointer',\n 'removePointer',\n '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 } 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 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 () {\n return scope.now()\n }\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 || interaction.pointerType !== 'touch' || 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 scope.usePlugin(interactablePreventDefault)\n}\n\nfunction doOnInteractions (method: string, scope: Scope) {\n return function (event: Event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches: any[] = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n // @ts-expect-error\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 } 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 =\n 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 as PointerEvent,\n pointerId: pointerUtils.getPointerId(event as PointerEvent),\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 (\n { doc, scope, options }: SignalArgs[T],\n eventMethodName: 'add' | 'remove',\n) {\n const {\n interactions: { docEvents },\n events,\n } = scope\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\nconst interactions: Plugin = {\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 'interactable:unset': ({ interactable }, scope) => {\n // Stop and destroy related interactions when an Interactable is 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 !== interactable) {\n continue\n }\n\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 onDocSignal,\n doOnInteractions,\n methodNames,\n}\n\nexport default interactions\n","import type Interaction from '@interactjs/core/Interaction'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport domObjects from '@interactjs/utils/domObjects'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport * as win from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport { InteractEvent } from './InteractEvent'\nimport { createInteractStatic } from './InteractStatic'\nimport { Interactable as InteractableBase } from './Interactable'\nimport { InteractableSet } from './InteractableSet'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './events'\nimport './interactions'\nimport events from './events'\nimport interactions from './interactions'\n/* eslint-enable import/no-duplicates */\nimport type { OptionsArg } from './options'\nimport { defaults } from './options'\nimport type { Actions } from './types'\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: OptionsArg }\n 'interactions:destroy': { interaction: 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: Record\n}\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 isInitialized = false\n listenerMaps: Array<{\n map: ListenerMap\n id?: string\n }> = []\n\n browser = browser\n defaults = clone(defaults) as typeof defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {} as any,\n phaselessTypes: {},\n }\n\n interactStatic = createInteractStatic(this)\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\n\n this.Interactable = class extends InteractableBase {\n get _defaults () {\n return scope.defaults\n }\n\n set (this: T, options: OptionsArg) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset (this: InteractableBase) {\n super.unset()\n\n const index = scope.interactables.list.indexOf(this)\n if (index < 0) return\n\n scope.interactables.list.splice(index, 1)\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 {\n map: { [name]: listener },\n } 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 | typeof globalThis) {\n return this.isInitialized ? this : initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n const { id } = plugin\n return id ? !!this._plugins.map[id] : this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (!this.isInitialized) {\n return this\n }\n\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) {\n this._plugins.map[plugin.id] = plugin\n }\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 acc[pluginIdRoot(id)] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (otherId && (before[otherId] || before[pluginIdRoot(otherId)])) {\n break\n }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\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) {\n return false\n }\n\n const window = win.getWindow(doc)\n\n options = options ? extend({}, options) : {}\n\n this.documents.push({ doc, options })\n this.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 this.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 this.events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n this.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 initScope (scope: Scope, window: Window | typeof globalThis) {\n scope.isInitialized = true\n\n if (is.window(window)) {\n win.init(window)\n }\n\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n\n // @ts-expect-error\n scope.window = window\n scope.document = window.document\n\n scope.usePlugin(interactions)\n scope.usePlugin(events)\n\n return scope\n}\n\nfunction pluginIdRoot (id: string) {\n return id && id.replace(/\\/.*$/, '')\n}\n","import { Scope } from '@interactjs/core/scope'\n\nconst scope = new Scope()\n\nconst interact = scope.interactStatic\n\nexport default interact\n\nconst _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this\nscope.init(_global)\n","export default () => {}\n","export default () => {}\n","import type { Rect, Point } from '@interactjs/core/types'\nimport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type GridOptions = (Partial | Point) & {\n range?: number\n limits?: Rect\n offset?: Point\n}\n\nexport default (grid: GridOptions) => {\n const coordFields = (\n [\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const\n ).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: 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: 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","/* eslint-disable import/no-named-as-default, import/no-unresolved */\nexport { default as edgeTarget } from './edgeTarget'\nexport { default as elements } from './elements'\nexport { default as grid } from './grid'\n","import type { Plugin } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\nimport * as allSnappers from './all'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n snappers: typeof allSnappers\n createSnapGrid: typeof allSnappers.grid\n }\n}\n\nconst snappersPlugin: Plugin = {\n id: 'snappers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n interact.snappers = extend(interact.snappers || {}, allSnappers)\n interact.createSnapGrid = interact.snappers.grid\n },\n}\n\nexport default snappersPlugin\n","/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */\n\nimport type { Point, Rect, EdgeOptions } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\n\nimport Modification from './Modification'\nimport { makeModifier } from './base'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState<\nAspectRatioOptions,\n{\n startCoords: Point\n startRect: Rect\n linkedEdges: EdgeOptions\n ratio: number\n equalDelta: boolean\n xIsPrimaryAxis: boolean\n edgeSign: {\n x: number\n y: number\n }\n subModification: Modification\n}\n>\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges, pageCoords: coords } = arg\n let { ratio, enabled } = 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: edges.top || (edges.left && !edges.bottom),\n left: edges.left || (edges.top && !edges.right),\n bottom: edges.bottom || (edges.right && !edges.top),\n right: edges.right || (edges.bottom && !edges.left),\n })\n\n state.xIsPrimaryAxis = !!(edges.left || edges.right)\n\n if (state.equalDelta) {\n const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)\n state.edgeSign = {\n x: sign,\n y: sign,\n }\n } else {\n state.edgeSign = {\n x: linkedEdges.left ? -1 : 1,\n y: linkedEdges.top ? -1 : 1,\n }\n }\n\n if (enabled !== false) {\n extend(edges, linkedEdges)\n }\n\n if (!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 { linkedEdges } = state\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n extend(arg.edges, linkedEdges)\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) {\n return null\n }\n\n const correctedRect = extend({}, rect)\n\n addEdges(linkedEdges, correctedRect, {\n x: coords.x - initialCoords.x,\n y: coords.y - initialCoords.y,\n })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: 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: Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y\n } else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x\n }\n}\n\nfunction setRatio (\n { startRect, startCoords, ratio, edgeSign }: AspectRatioState,\n xIsPrimaryAxis: boolean,\n coords: Point,\n rect: Rect,\n) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y\n } else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x\n }\n}\n\nexport default makeModifier(aspectRatio, 'aspectRatio')\nexport { aspectRatio }\n","import type { ModifierFunction } from './types'\n\nconst noop = (() => {}) as unknown as ModifierFunction\n\nnoop._defaults = {}\n\nexport default noop\n","export { default } from '../noop'\n","import type Interaction from '@interactjs/core/Interaction'\nimport type { RectResolvable, Rect, Point } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule, ModifierState } from '../types'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: RectResolvable<[number, number, Interaction]>\n // what part of self is allowed to drag over\n elementRect: Rect\n offset: Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState<\nRestrictOptions,\n{\n offset: Rect\n}\n>\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Rect = extend(\n {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n options.offset || {},\n )\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: RectResolvable<[number, number, Interaction]>,\n interaction: Interaction,\n coords?: Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [\n coords.x,\n coords.y,\n interaction,\n ])\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 makeModifier(restrict, 'restrict')\nexport { 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 type { Point, Rect } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } 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<\nRestrictEdgesOptions,\n{\n inner: Rect\n outer: Rect\n offset: RestrictEdgesOptions['offset']\n}\n>\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: Point\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 Rect)\n const outer = getRestrictionRect(options.outer, interaction, page) || ({} as 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 } 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 } 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: Rect, defaults: Rect) {\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 makeModifier(restrictEdges, 'restrictEdges')\nexport { restrictEdges }\n","import extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\n\nimport { restrict } from './pointer'\n\nconst defaults = extend(\n {\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n },\n restrict.defaults,\n)\n\nconst restrictRect = {\n start: restrict.start,\n set: restrict.set,\n defaults,\n}\n\nexport default makeModifier(restrictRect, 'restrictRect')\nexport { restrictRect }\n","import type { Point, Rect, Size } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictEdgesState } from './edges'\nimport { restrictEdges } from './edges'\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Size | Point | RestrictOptions['restriction']\n max?: Size | 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 = RestrictEdgesState &\nModifierState<\nRestrictSizeOptions & { inner: Rect, outer: Rect },\n{\n min: Rect\n max: Rect\n}\n>\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 =\n rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize =\n 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 } 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 } 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 makeModifier(restrictSize, 'restrictSize')\nexport { restrictSize }\n","export { default } from '../noop'\n","import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName, Point, RectResolvable, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { resolveRectLike, rectToXY } from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nexport interface Offset {\n x: number\n y: number\n index: number\n relativePoint?: Point | null\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: InteractionProxy,\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?: Point[]\n // startCoords = offset snapping from drag start page position\n offset?: Point | RectResolvable<[Interaction]> | 'startCoords'\n offsetWithOrigin?: boolean\n origin?: RectResolvable<[Element]> | Point\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState<\nSnapOptions,\n{\n offsets?: Offset[]\n closest?: any\n targetFields?: string[][]\n}\n>\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }\n\n let snapOffset: 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 } else {\n const offsetRect = resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = 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 =\n 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 : [\n {\n index: 0,\n relativePoint: null,\n x: snapOffset.x,\n y: snapOffset.y,\n },\n ]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = getOriginXY(interaction.interactable!, interaction.element!, interaction.prepared.name)\n const page = extend({}, coords)\n const targets: SnapPosition[] = []\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: SnapPosition\n\n if (is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction._proxy, offset, index)\n } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\n\n targets.push({\n x: (is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: 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 = 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 (\n !closest.target ||\n (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 ) {\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 = rectToXY(resolveRectLike(arg.state.options.origin as any, null, null, [element]))\n const origin = optionsOrigin || getOriginXY(arg.interactable, element, arg.interaction.prepared.name)\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 makeModifier(snap, 'snap')\nexport { snap }\n","// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg } from '../types'\n\nimport type { SnapOptions, SnapState } from './pointer'\nimport { snap } from './pointer'\n\nexport type SnapSizeOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) {\n return null\n }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [\n {\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n },\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 } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\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 makeModifier(snapSize, 'snapSize')\nexport { snapSize }\n","/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\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 */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule } from '../types'\n\nimport type { 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) {\n return null\n }\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(clone(snapSize.defaults), {\n targets: undefined,\n range: undefined,\n offset: { x: 0, y: 0 },\n } as const),\n}\n\nexport default makeModifier(snapEdges, 'snapEdges')\nexport { snapEdges }\n","export { default } from '../noop'\n","export { default } from '../noop'\n","/* eslint-disable n/no-extraneous-import, import/no-unresolved */\nimport aspectRatio from './aspectRatio'\nimport avoid from './avoid/avoid'\nimport restrictEdges from './restrict/edges'\nimport restrict from './restrict/pointer'\nimport restrictRect from './restrict/rect'\nimport restrictSize from './restrict/size'\nimport rubberband from './rubberband/rubberband'\nimport snapEdges from './snap/edges'\nimport snap from './snap/pointer'\nimport snapSize from './snap/size'\nimport spring from './spring/spring'\nimport transform from './transform/transform'\n\nexport default {\n aspectRatio,\n restrictEdges,\n restrict,\n restrictRect,\n restrictSize,\n snapEdges,\n snap,\n snapSize,\n\n spring,\n avoid,\n transform,\n rubberband,\n}\n","import type { Plugin } from '@interactjs/core/scope'\nimport snappers from '@interactjs/snappers/plugin'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './all'\nimport './base'\n\nimport all from './all'\nimport base from './base'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n modifiers: typeof all\n }\n}\n\nconst modifiers: Plugin = {\n id: 'modifiers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n scope.usePlugin(base)\n scope.usePlugin(snappers)\n\n interact.modifiers = all\n\n // for backwrads compatibility\n for (const type in all) {\n const { _defaults, _methods } = all[type as keyof typeof all]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n },\n}\n\nexport default modifiers\n","import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { PointerEventType, PointerType, Point } from '@interactjs/core/types'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n declare type: T\n declare originalEvent: PointerEventType\n declare pointerId: number\n declare pointerType: string\n declare double: boolean\n declare pageX: number\n declare pageY: number\n declare clientX: number\n declare clientY: number\n declare dt: number\n declare eventable: any;\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: PointerType | PointerEvent,\n event: PointerEventType,\n eventTarget: Node,\n interaction: 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 =\n !!interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500\n } else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n this.double = true\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: 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 }: 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 type { Eventable } from '@interactjs/core/Eventable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\n\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?: Point | string | 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/options' {\n interface ActionDefaults {\n pointerEvents: 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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\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: Plugin = {\n id: 'pointer-events/base',\n before: ['inertia', 'modifiers', 'auto-start', 'actions'],\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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Scope,\n) {\n const { interaction, pointer, event, eventTarget, type, targets = collectEventTargets(arg, scope) } = 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 = 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 (\n pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n i + 1 < targets.length &&\n targets[i + 1].node !== pointerEvent.currentTarget)\n ) {\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 {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n },\n scope,\n )\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets (\n {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n }: {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n type: T\n },\n scope: Scope,\n) {\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 (\n type === 'tap' &&\n (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))\n ) {\n return []\n }\n\n const path = domUtils.getPath(eventTarget as 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(\n (target) => target.eventable.options.holdDuration === interaction.pointers[pointerIndex]?.hold?.duration,\n )\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 }: 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 const hold = interaction.pointers[pointerIndex].hold\n\n if (hold && hold.timeout) {\n clearTimeout(hold.timeout)\n hold.timeout = null\n }\n}\n\nfunction moveAndClearHold (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction, pointer, event, eventTarget, duplicate } = arg\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearHold(arg)\n }\n\n fire(\n {\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Element,\n type: 'move',\n },\n scope,\n )\n }\n}\n\nfunction downAndStartHold (\n { interaction, pointer, event, eventTarget, pointerIndex }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n const timer = interaction.pointers[pointerIndex].hold!\n const path = domUtils.getPath(eventTarget as 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 {\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n },\n scope,\n )\n }, minDuration)\n}\n\nfunction tapAfterUp (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:up'],\n scope: Scope,\n) {\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 extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n","import type Interaction from '@interactjs/core/Interaction'\nimport type { ListenerMap, Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\n\nimport type PointerEvent from './PointerEvent'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable import/no-duplicates */\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: Scope) {\n scope.usePlugin(basePlugin)\n\n const { pointerEvents } = 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 }: SignalArgs['pointerEvents:fired'],\n scope: 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 {\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n },\n scope,\n )\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: 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: 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 type { Interactable } from '@interactjs/core/Interactable'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\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: Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({ targets, node, type, eventTarget }, 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 ) {\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: 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 type { Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './holdRepeat'\nimport './interactableTargets'\n\nimport * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n/* eslint-enable import/no-duplicates */\n\nconst plugin: Plugin = {\n id: 'pointer-events',\n install (scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n },\n}\n\nexport default plugin\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type { DoAnyPhaseArg, Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, ActionProps, Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport { copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport { tlbrToXywh } from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-reflow': Omit\n 'interactions:action-reflow': DoAnyPhaseArg\n 'interactions:after-action-reflow': DoAnyPhaseArg\n }\n}\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: (...args: unknown[]) => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\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: ActionProps) {\n return doReflow(this, action, scope)\n }\n}\n\nfunction doReflow (\n interactable: Interactable,\n action: ActionProps,\n scope: Scope,\n): Promise {\n const elements = interactable.getAllElements()\n\n // tslint:disable-next-line variable-name\n const Promise = (scope.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) {\n break\n }\n\n const runningInteraction = arr.find(scope.interactions.list, (interaction: Interaction) => {\n return (\n interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n )\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise =\n runningInteraction._reflowPromise ||\n new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n } else {\n const xywh = 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 (\n scope: Scope,\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n event: any,\n) {\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.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n pointerUtils.setZeroCoords(interaction.coords.delta)\n\n copyAction(interaction.prepared, action)\n interaction._doPhase(signalArg)\n\n const { Promise } = scope.window as unknown as { Promise: PromiseConstructor }\n const reflowPromise = Promise\n ? new Promise((resolve) => {\n interaction._reflowResolve = resolve\n })\n : undefined\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 } else {\n interaction.stop()\n interaction._reflowResolve()\n }\n\n interaction.removePointer(event, event)\n\n return reflowPromise\n}\n\nconst reflow: Plugin = {\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}\n\nexport default reflow\n","/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/actions/plugin'\nimport '@interactjs/auto-scroll/plugin'\nimport '@interactjs/auto-start/plugin'\nimport '@interactjs/core/interactablePreventDefault'\nimport '@interactjs/dev-tools/plugin'\nimport '@interactjs/inertia/plugin'\nimport '@interactjs/interact'\nimport '@interactjs/modifiers/plugin'\nimport '@interactjs/offset/plugin'\nimport '@interactjs/pointer-events/plugin'\nimport '@interactjs/reflow/plugin'\n\nimport actions from '@interactjs/actions/plugin'\nimport autoScroll from '@interactjs/auto-scroll/plugin'\nimport autoStart from '@interactjs/auto-start/plugin'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/plugin'\nimport inertia from '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact'\nimport modifiers from '@interactjs/modifiers/plugin'\nimport offset from '@interactjs/offset/plugin'\nimport pointerEvents from '@interactjs/pointer-events/plugin'\nimport reflow from '@interactjs/reflow/plugin'\n/* eslint-enable import/no-duplicates */\n\ninteract.use(interactablePreventDefault)\n\ninteract.use(offset)\n\n// pointerEvents\ninteract.use(pointerEvents)\n\n// inertia\ninteract.use(inertia)\n\n// snap, resize, etc.\ninteract.use(modifiers)\n\n// autoStart, hold\ninteract.use(autoStart)\n\n// drag and drop, resize, gesture\ninteract.use(actions)\n\n// autoScroll\ninteract.use(autoScroll)\n\n// reflow\ninteract.use(reflow)\n\n// eslint-disable-next-line no-undef\nif (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n}\n\nexport default interact\n;(interact as any).default = interact\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport interact from '@interactjs/interactjs'\n\nexport default interact\n\nif (typeof module === 'object' && !!module) {\n try {\n module.exports = interact\n } catch {}\n}\n\n;(interact as any).default = interact\n","\nreturn _$index_79;\n\n});\n"]} \ No newline at end of file diff --git a/packages/interactjs/dist/interact.min.js b/packages/interactjs/dist/interact.min.js new file mode 100644 index 000000000..09534f65a --- /dev/null +++ b/packages/interactjs/dist/interact.min.js @@ -0,0 +1,3 @@ +/* interact.js 1.10.23 | https://interactjs.io/license */ +!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).interact=t()}((function(){var t={};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(t){return!(!t||!t.Window)&&t instanceof t.Window};var e={};Object.defineProperty(e,"__esModule",{value:!0}),e.getWindow=function(e){return(0,t.default)(e)?e:(e.ownerDocument||e).defaultView||r.window},e.init=o,e.window=e.realWindow=void 0;var n=void 0;e.realWindow=n;var r=void 0;function o(t){e.realWindow=n=t;var o=t.document.createTextNode("");o.ownerDocument!==t.document&&"function"==typeof t.wrap&&t.wrap(o)===o&&(t=t.wrap(t)),e.window=r=t}e.window=r,"undefined"!=typeof window&&window&&o(window);var i={};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},a(t)}Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var s=function(t){return!!t&&"object"===a(t)},l=function(t){return"function"==typeof t},u={window:function(n){return n===e.window||(0,t.default)(n)},docFrag:function(t){return s(t)&&11===t.nodeType},object:s,func:l,number:function(t){return"number"==typeof t},bool:function(t){return"boolean"==typeof t},string:function(t){return"string"==typeof t},element:function(t){if(!t||"object"!==a(t))return!1;var n=e.getWindow(t)||e.window;return/object|function/.test("undefined"==typeof Element?"undefined":a(Element))?t instanceof Element||t instanceof n.Element:1===t.nodeType&&"string"==typeof t.nodeName},plainObject:function(t){return s(t)&&!!t.constructor&&/function Object\b/.test(t.constructor.toString())},array:function(t){return s(t)&&void 0!==t.length&&l(t.splice)}};i.default=u;var c={};function f(t){var e=t.interaction;if("drag"===e.prepared.name){var n=e.prepared.axis;"x"===n?(e.coords.cur.page.y=e.coords.start.page.y,e.coords.cur.client.y=e.coords.start.client.y,e.coords.velocity.client.y=0,e.coords.velocity.page.y=0):"y"===n&&(e.coords.cur.page.x=e.coords.start.page.x,e.coords.cur.client.x=e.coords.start.client.x,e.coords.velocity.client.x=0,e.coords.velocity.page.x=0)}}function d(t){var e=t.iEvent,n=t.interaction;if("drag"===n.prepared.name){var r=n.prepared.axis;if("x"===r||"y"===r){var o="x"===r?"y":"x";e.page[o]=n.coords.start.page[o],e.client[o]=n.coords.start.client[o],e.delta[o]=0}}}Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var p={id:"actions/drag",install:function(t){var e=t.actions,n=t.Interactable,r=t.defaults;n.prototype.draggable=p.draggable,e.map.drag=p,e.methodDict.drag="draggable",r.actions.drag=p.defaults},listeners:{"interactions:before-action-move":f,"interactions:action-resume":f,"interactions:action-move":d,"auto-start:check":function(t){var e=t.interaction,n=t.interactable,r=t.buttons,o=n.options.drag;if(o&&o.enabled&&(!e.pointerIsDown||!/mouse|pointer/.test(e.pointerType)||0!=(r&n.options.drag.mouseButtons)))return t.action={name:"drag",axis:"start"===o.lockAxis?o.startAxis:o.lockAxis},!1}},draggable:function(t){return i.default.object(t)?(this.options.drag.enabled=!1!==t.enabled,this.setPerAction("drag",t),this.setOnEvents("drag",t),/^(xy|x|y|start)$/.test(t.lockAxis)&&(this.options.drag.lockAxis=t.lockAxis),/^(xy|x|y)$/.test(t.startAxis)&&(this.options.drag.startAxis=t.startAxis),this):i.default.bool(t)?(this.options.drag.enabled=t,this):this.options.drag},beforeMove:f,move:d,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor:function(){return"move"},filterEventType:function(t){return 0===t.search("drag")}},v=p;c.default=v;var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.default=void 0;var g={init:function(t){var e=t;g.document=e.document,g.DocumentFragment=e.DocumentFragment||y,g.SVGElement=e.SVGElement||y,g.SVGSVGElement=e.SVGSVGElement||y,g.SVGElementInstance=e.SVGElementInstance||y,g.Element=e.Element||y,g.HTMLElement=e.HTMLElement||g.Element,g.Event=e.Event,g.Touch=e.Touch||y,g.PointerEvent=e.PointerEvent||e.MSPointerEvent},document:null,DocumentFragment:null,SVGElement:null,SVGSVGElement:null,SVGElementInstance:null,Element:null,HTMLElement:null,Event:null,Touch:null,PointerEvent:null};function y(){}var m=g;h.default=m;var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var x={init:function(t){var e=h.default.Element,n=t.navigator||{};x.supportsTouch="ontouchstart"in t||i.default.func(t.DocumentTouch)&&h.default.document instanceof t.DocumentTouch,x.supportsPointerEvent=!1!==n.pointerEnabled&&!!h.default.PointerEvent,x.isIOS=/iP(hone|od|ad)/.test(n.platform),x.isIOS7=/iP(hone|od|ad)/.test(n.platform)&&/OS 7[^\d]/.test(n.appVersion),x.isIe9=/MSIE 9/.test(n.userAgent),x.isOperaMobile="Opera"===n.appName&&x.supportsTouch&&/Presto/.test(n.userAgent),x.prefixedMatchesSelector="matches"in e.prototype?"matches":"webkitMatchesSelector"in e.prototype?"webkitMatchesSelector":"mozMatchesSelector"in e.prototype?"mozMatchesSelector":"oMatchesSelector"in e.prototype?"oMatchesSelector":"msMatchesSelector",x.pEventTypes=x.supportsPointerEvent?h.default.PointerEvent===t.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,x.wheelEvent=h.default.document&&"onmousewheel"in h.default.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null},w=x;b.default=w;var _={};function O(t){var e=t.parentNode;if(i.default.docFrag(e)){for(;(e=e.host)&&i.default.docFrag(e););return e}return e}function P(t,n){return e.window!==e.realWindow&&(n=n.replace(/\/deep\//g," ")),t[b.default.prefixedMatchesSelector](n)}Object.defineProperty(_,"__esModule",{value:!0}),_.closest=function(t,e){for(;i.default.element(t);){if(P(t,e))return t;t=O(t)}return null},_.getActualElement=function(t){return t.correspondingUseElement||t},_.getElementClientRect=j,_.getElementRect=function(t){var n=j(t);if(!b.default.isIOS7&&n){var r=T(e.getWindow(t));n.left+=r.x,n.right+=r.x,n.top+=r.y,n.bottom+=r.y}return n},_.getPath=function(t){for(var e=[];t;)e.push(t),t=O(t);return e},_.getScrollXY=T,_.indexOfDeepestElement=function(t){for(var n,r=[],o=0;o=(parseInt(e.getWindow(g).getComputedStyle(g).zIndex,10)||0)&&(n=o);else n=o}else n=o}var v,g;return n},_.matchesSelector=P,_.matchesUpTo=function(t,e,n){for(;i.default.element(t);){if(P(t,e))return!0;if((t=O(t))===n)return P(t,e)}return!1},_.nodeContains=function(t,e){if(t.contains)return t.contains(e);for(;e;){if(e===t)return!0;e=e.parentNode}return!1},_.parentNode=O,_.trySelector=function(t){return!!i.default.string(t)&&(h.default.document.querySelector(t),!0)};var E=function(t){return t.parentNode||t.host};function S(t,e){for(var n,r=[],o=t;(n=E(o))&&o!==e&&n!==o.ownerDocument;)r.unshift(o),o=n;return r}function T(t){return{x:(t=t||e.window).scrollX||t.document.documentElement.scrollLeft,y:t.scrollY||t.document.documentElement.scrollTop}}function j(t){var e=t instanceof h.default.SVGElement?t.getBoundingClientRect():t.getClientRects()[0];return e&&{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width||e.right-e.left,height:e.height||e.bottom-e.top}}var M={};Object.defineProperty(M,"__esModule",{value:!0}),M.default=function(t,e){for(var n in e)t[n]=e[n];return t};var k={};function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&void 0!==arguments[2]?arguments[2]:function(t){return!0},o=arguments.length>3?arguments[3]:void 0;if(o=o||{},i.default.string(e)&&-1!==e.search(" ")&&(e=R(e)),i.default.array(e))return e.forEach((function(e){return t(e,n,r,o)})),o;if(i.default.object(e)&&(n=e,e=""),i.default.func(n)&&r(e))o[e]=o[e]||[],o[e].push(n);else if(i.default.array(n))for(var a=0;a1?N(e):e[0];L(r,t.page),U(r,t.client),t.timeStamp=n},B.setZeroCoords=function(t){t.page.x=0,t.page.y=0,t.client.x=0,t.client.y=0},B.touchAngle=function(t,e){var n=e+"X",r=e+"Y",o=V(t),i=o[1][n]-o[0][n],a=o[1][r]-o[0][r];return 180*Math.atan2(a,i)/Math.PI},B.touchBBox=function(t){if(!t.length)return null;var e=V(t),n=Math.min(e[0].pageX,e[1].pageX),r=Math.min(e[0].pageY,e[1].pageY),o=Math.max(e[0].pageX,e[1].pageX),i=Math.max(e[0].pageY,e[1].pageY);return{x:n,y:r,left:n,top:r,right:o,bottom:i,width:o-n,height:i-r}},B.touchDistance=function(t,e){var n=e+"X",r=e+"Y",o=V(t),i=o[0][n]-o[1][n],a=o[0][r]-o[1][r];return(0,C.default)(i,a)};var q={};function G(t,e){for(var n=0;ns.left&&f.xs.top&&f.y=s.left&&h<=s.right&&g>=s.top&&g<=s.bottom}return v&&i.default.number(u)&&(l=Math.max(0,Math.min(s.right,v.right)-Math.max(s.left,v.left))*Math.max(0,Math.min(s.bottom,v.bottom)-Math.max(s.top,v.top))/(v.width*v.height)>=u),t.options.drop.checker&&(l=t.options.drop.checker(e,n,l,t,a,r,o)),l}(this,t,e,n,r,o,a)},n.dynamicDrop=function(e){return i.default.bool(e)?(t.dynamicDrop=e,n):t.dynamicDrop},(0,M.default)(e.phaselessTypes,{dragenter:!0,dragleave:!0,dropactivate:!0,dropdeactivate:!0,dropmove:!0,drop:!0}),e.methodDict.drop="dropzone",t.dynamicDrop=!1,o.actions.drop=ht.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=[],o.events={},o.activeDrops=ct(e,n.element),o.events=dt(n,0,r),o.events.activate&&(ut(o.activeDrops,o.events.activate),e.fire("actions/drop:start",{interaction:n,dragEvent:r}))}},"interactions:action-move":vt,"interactions:after-action-move":function(t,e){var n=t.interaction,r=t.iEvent;if("drag"===n.prepared.name){var o=n.dropState;pt(n,o.events),e.fire("actions/drop:move",{interaction:n,dragEvent:r}),o.events={}}},"interactions:action-end":function(t,e){if("drag"===t.interaction.prepared.name){var n=t.interaction,r=t.iEvent;vt(t,e),pt(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:ct,getDrop:ft,getDropEvents:dt,fireDropEvents:pt,filterEventType:function(t){return 0===t.search("drag")||0===t.search("drop")},defaults:{enabled:!1,accept:null,overlap:"pointer"}},gt=ht;lt.default=gt;var yt={};function mt(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})),a="start"===r,s="end"===r,l=e.interactable.options.deltaSource;if(n.touches=[o[0],o[1]],a)n.distance=B.touchDistance(o,l),n.box=B.touchBBox(o),n.scale=1,n.ds=0,n.angle=B.touchAngle(o,l),n.da=0,e.gesture.startDistance=n.distance,e.gesture.startAngle=n.angle;else if(s||e.pointers.length<2){var u=e.prevEvent;n.distance=u.distance,n.box=u.box,n.scale=u.scale,n.ds=0,n.angle=u.angle,n.da=0}else n.distance=B.touchDistance(o,l),n.box=B.touchBBox(o),n.scale=n.distance/e.gesture.startDistance,n.angle=B.touchAngle(o,l),n.ds=n.scale-e.gesture.scale,n.da=n.angle-e.gesture.angle;e.gesture.distance=n.distance,e.gesture.angle=n.angle,i.default.number(n.scale)&&n.scale!==1/0&&!isNaN(n.scale)&&(e.gesture.scale=n.scale)}}Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=void 0;var bt={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 i.default.object(t)?(this.options.gesture.enabled=!1!==t.enabled,this.setPerAction("gesture",t),this.setOnEvents("gesture",t),this):i.default.bool(t)?(this.options.gesture.enabled=t,this):this.options.gesture},e.map.gesture=bt,e.methodDict.gesture="gesturable",r.actions.gesture=bt.defaults},listeners:{"interactions:action-start":mt,"interactions:action-move":mt,"interactions:action-end":mt,"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"},!1}}},defaults:{},getCursor:function(){return""},filterEventType:function(t){return 0===t.search("gesture")}},xt=bt;yt.default=xt;var wt={};function _t(t,e,n,r,o,a,s){if(!e)return!1;if(!0===e){var l=i.default.number(a.width)?a.width:a.right-a.left,u=i.default.number(a.height)?a.height:a.bottom-a.top;if(s=Math.min(s,Math.abs(("left"===t||"right"===t?l:u)/2)),l<0&&("left"===t?t="right":"right"===t&&(t="left")),u<0&&("top"===t?t="bottom":"bottom"===t&&(t="top")),"left"===t){var c=l>=0?a.left:a.right;return n.x=0?a.top:a.bottom;return n.y(l>=0?a.right:a.left)-s;if("bottom"===t)return n.y>(u>=0?a.bottom:a.top)-s}return!!i.default.element(r)&&(i.default.element(e)?e===r:_.matchesUpTo(r,e,o))}function Ot(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))}}Object.defineProperty(wt,"__esModule",{value:!0}),wt.default=void 0;var Pt={id:"actions/resize",before:["actions/drag"],install:function(t){var e=t.actions,n=t.browser,r=t.Interactable,o=t.defaults;Pt.cursors=function(t){return t.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"}}(n),Pt.defaultMargin=n.supportsTouch||n.supportsPointerEvent?20:10,r.prototype.resizable=function(e){return function(t,e,n){return i.default.object(e)?(t.options.resize.enabled=!1!==e.enabled,t.setPerAction("resize",e),t.setOnEvents("resize",e),i.default.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),i.default.bool(e.preserveAspectRatio)?t.options.resize.preserveAspectRatio=e.preserveAspectRatio:i.default.bool(e.square)&&(t.options.resize.square=e.square),t):i.default.bool(e)?(t.options.resize.enabled=e,t):t.options.resize}(this,e,t)},e.map.resize=Pt,e.methodDict.resize="resizable",o.actions.resize=Pt.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,M.default)({},o),corrected:(0,M.default)({},o),previous:(0,M.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),Ot(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,s=n._rects,l=s.start,u=s.corrected,c=s.delta,f=s.previous;if((0,M.default)(f,u),i){if((0,M.default)(u,a),"reposition"===o){if(u.top>u.bottom){var d=u.top;u.top=u.bottom,u.bottom=d}if(u.left>u.right){var p=u.left;u.left=u.right,u.right=p}}}else u.top=Math.min(a.top,l.bottom),u.bottom=Math.max(a.bottom,l.top),u.left=Math.min(a.left,l.right),u.right=Math.max(a.right,l.left);for(var v in u.width=u.right-u.left,u.height=u.bottom-u.top,u)c[v]=u[v]-f[v];r.edges=n.prepared.edges,r.rect=u,r.deltaRect=c}}(t),Ot(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,a=t.buttons;if(o){var s=(0,M.default)({},e.coords.cur.page),l=n.options.resize;if(l&&l.enabled&&(!e.pointerIsDown||!/mouse|pointer/.test(e.pointerType)||0!=(a&l.mouseButtons))){if(i.default.object(l.edges)){var u={left:!1,right:!1,top:!1,bottom:!1};for(var c in u)u[c]=_t(c,l.edges[c],s,e._latestPointer.eventTarget,r,o,l.margin||Pt.defaultMargin);u.left=u.left&&!u.right,u.top=u.top&&!u.bottom,(u.left||u.right||u.top||u.bottom)&&(t.action={name:"resize",edges:u})}else{var f="y"!==l.axis&&s.x>o.right-Pt.defaultMargin,d="x"!==l.axis&&s.y>o.bottom-Pt.defaultMargin;(f||d)&&(t.action={name:"resize",axes:(f?"x":"")+(d?"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=Pt.cursors,i=null;if(n)i=o[r+n];else if(e){for(var a="",s=["top","bottom","left","right"],l=0;l=1){var c={x:zt.x*u,y:zt.y*u};if(c.x||c.y){var f=Ct(a);i.default.window(a)?a.scrollBy(c.x,c.y):a&&(a.scrollLeft+=c.x,a.scrollTop+=c.y);var d=Ct(a),p={x:d.x-f.x,y:d.y-f.y};(p.x||p.y)&&e.fire({type:"autoscroll",target:n,interactable:e,delta:p,interaction:t,container:a})}zt.prevTime=s}zt.isScrolling&&(jt.default.cancel(zt.i),zt.i=jt.default.request(zt.scroll))},check:function(t,e){var n;return null==(n=t.options[e].autoScroll)?void 0:n.enabled},onInteractionMove:function(t){var e=t.interaction,n=t.pointer;if(e.interacting()&&zt.check(e.interactable,e.prepared.name))if(e.simulation)zt.x=zt.y=0;else{var r,o,a,s,l=e.interactable,u=e.element,c=e.prepared.name,f=l.options[c].autoScroll,d=Rt(f.container,l,u);if(i.default.window(d))s=n.clientXd.innerWidth-zt.margin,a=n.clientY>d.innerHeight-zt.margin;else{var p=_.getElementClientRect(d);s=n.clientXp.right-zt.margin,a=n.clientY>p.bottom-zt.margin}zt.x=o?1:s?-1:0,zt.y=a?1:r?-1:0,zt.isScrolling||(zt.margin=f.margin,zt.speed=f.speed,zt.start(e))}}};function Rt(t,n,r){return(i.default.string(t)?(0,k.getStringOptionResult)(t,n,r):t)||(0,e.getWindow)(r)}function Ct(t){return i.default.window(t)&&(t=window.document.body),{x:t.scrollLeft,y:t.scrollTop}}var Ft={id:"auto-scroll",install:function(t){var e=t.defaults,n=t.actions;t.autoScroll=zt,zt.now=function(){return t.now()},n.phaselessTypes.autoscroll=!0,e.perAction.autoScroll=zt.defaults},listeners:{"interactions:new":function(t){t.interaction.autoScroll=null},"interactions:destroy":function(t){t.interaction.autoScroll=null,zt.stop(),zt.interaction&&(zt.interaction=null)},"interactions:stop":zt.stop,"interactions:action-move":function(t){return zt.onInteractionMove(t)}}},Xt=Ft;At.default=Xt;var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.copyAction=function(t,e){return t.name=e.name,t.axis=e.axis,t.edges=e.edges,t},Bt.sign=void 0,Bt.warnOnce=function(t,n){var r=!1;return function(){return r||(e.window.console.warn(n),r=!0),t.apply(this,arguments)}},Bt.sign=function(t){return t>=0?1:-1};var Yt={};function Wt(t){return i.default.bool(t)?(this.options.styleCursor=t,this):null===t?(delete this.options.styleCursor,this):this.options.styleCursor}function Lt(t){return i.default.func(t)?(this.options.actionChecker=t,this):null===t?(delete this.options.actionChecker,this):this.options.actionChecker}Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.default=void 0;var Ut={id:"auto-start/interactableMethods",install:function(t){var e=t.Interactable;e.prototype.getAction=function(e,n,r,o){var i=function(t,e,n,r,o){var i=t.getRect(r),a={action:null,interactable:t,interaction:n,element:r,rect:i,buttons:e.buttons||{0:1,1:4,3:8,4:16}[e.button]};return o.fire("auto-start:check",a),a.action}(this,n,r,o,t);return this.options.actionChecker?this.options.actionChecker(e,n,i,this,o,r):i},e.prototype.ignoreFrom=(0,Bt.warnOnce)((function(t){return this._backCompatOption("ignoreFrom",t)}),"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),e.prototype.allowFrom=(0,Bt.warnOnce)((function(t){return this._backCompatOption("allowFrom",t)}),"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),e.prototype.actionChecker=Lt,e.prototype.styleCursor=Wt}};Yt.default=Ut;var Vt={};function Nt(t,e,n,r,o){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&Ht(e,n,t,o)?t:null}function qt(t,e,n,r,o,i,a){for(var s=0,l=r.length;s=s)return!1;if(d.interactable===t){if((u+=p===n.name?1:0)>=i)return!1;if(d.element===e&&(c++,p===n.name&&c>=a))return!1}}}return s>0}function Kt(t,e){return i.default.number(t)?(e.autoStart.maxInteractions=t,this):e.autoStart.maxInteractions}function Zt(t,e,n){var r=n.autoStart.cursorElement;r&&r!==t&&(r.style.cursor=""),t.ownerDocument.documentElement.style.cursor=e,t.style.cursor=e,n.autoStart.cursorElement=e?t:null}function Jt(t,e){var n=t.interactable,r=t.element,o=t.prepared;if("mouse"===t.pointerType&&n&&n.options.styleCursor){var a="";if(o.name){var s=n.options[o.name].cursorChecker;a=i.default.func(s)?s(o,n,r,t._interacting):e.actions.map[o.name].getCursor(o)}Zt(t.element,a||"",e)}else e.autoStart.cursorElement&&Zt(e.autoStart.cursorElement,"",e)}Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.default=void 0;var Qt={id:"auto-start/base",before:["actions"],install:function(t){var e=t.interactStatic,n=t.defaults;t.usePlugin(Yt.default),n.base.actionChecker=null,n.base.styleCursor=!0,(0,M.default)(n.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),e.maxInteractions=function(e){return Kt(e,t)},t.autoStart={maxInteractions:1/0,withinInteractionLimit:Ht,cursorElement:null}},listeners:{"interactions:down":function(t,e){var n=t.interaction,r=t.pointer,o=t.event,i=t.eventTarget;n.interacting()||$t(n,Gt(n,r,o,i,e),e)},"interactions:move":function(t,e){!function(t,e){var n=t.interaction,r=t.pointer,o=t.event,i=t.eventTarget;"mouse"!==n.pointerType||n.pointerIsDown||n.interacting()||$t(n,Gt(n,r,o,i,e),e)}(t,e),function(t,e){var n=t.interaction;if(n.pointerIsDown&&!n.interacting()&&n.pointerWasMoved&&n.prepared.name){e.fire("autoStart:before-start",t);var r=n.interactable,o=n.prepared.name;o&&r&&(r.options[o].manualStart||!Ht(r,n.element,n.prepared,e)?n.stop():(n.start(n.prepared,r,n.element),Jt(n,e)))}}(t,e)},"interactions:stop":function(t,e){var n=t.interaction,r=n.interactable;r&&r.options.styleCursor&&Zt(n.element,"",e)}},maxInteractions:Kt,withinInteractionLimit:Ht,validateAction:Nt},te=Qt;Vt.default=te;var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.default=void 0;var ne={id:"auto-start/dragAxis",listeners:{"autoStart:before-start":function(t,e){var n=t.interaction,r=t.eventTarget,o=t.dx,a=t.dy;if("drag"===n.prepared.name){var s=Math.abs(o),l=Math.abs(a),u=n.interactable.options.drag,c=u.startAxis,f=s>l?"x":s0&&(e.autoStartHoldTimer=setTimeout((function(){e.start(e.prepared,e.interactable,e.element)}),n))},"interactions:move":function(t){var e=t.interaction,n=t.duplicate;e.autoStartHoldTimer&&e.pointerWasMoved&&!n&&(clearTimeout(e.autoStartHoldTimer),e.autoStartHoldTimer=null)},"autoStart:before-start":function(t){var e=t.interaction;oe(e)>0&&(e.prepared.name=null)}},getHoldDuration:oe},ae=ie;re.default=ae;var se={};Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var le={id:"auto-start",install:function(t){t.usePlugin(Vt.default),t.usePlugin(re.default),t.usePlugin(ee.default)}};se.default=le;var ue={};function ce(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):i.default.bool(t)?(this.options.preventDefault=t?"always":"never",this):this.options.preventDefault}function fe(t){var e=t.interaction,n=t.event;e.interactable&&e.interactable.checkAndPreventDefault(n)}function de(t){var n=t.Interactable;n.prototype.preventDefault=ce,n.prototype.checkAndPreventDefault=function(n){return function(t,n,r){var o=t.options.preventDefault;if("never"!==o)if("always"!==o){if(n.events.supportsPassive&&/^touch(start|move)$/.test(r.type)){var a=(0,e.getWindow)(r.target).document,s=n.getDocOptions(a);if(!s||!s.events||!1!==s.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(r.type)||i.default.element(r.target)&&(0,_.matchesSelector)(r.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||r.preventDefault()}else r.preventDefault()}(this,t,n)},t.interactions.docEvents.push({type:"dragstart",listener:function(e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n150)return null;var e=180*Math.atan2(t.prevEvent.velocityY,t.prevEvent.velocityX)/Math.PI;e<0&&(e+=360);var n=112.5<=e&&e<247.5,r=202.5<=e&&e<337.5;return{up:r,down:!r&&22.5<=e&&e<157.5,left:n,right:!n&&(292.5<=e||e<67.5),angle:e,speed:t.prevEvent.speed,velocity:{x:t.prevEvent.velocityX,y:t.prevEvent.velocityY}}}},{key:"preventDefault",value:function(){}},{key:"stopImmediatePropagation",value:function(){this.immediatePropagationStopped=this.propagationStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}}])&&Re(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(q.BaseEvent);Ae.InteractEvent=We,Object.defineProperties(We.prototype,{pageX:{get:function(){return this.page.x},set:function(t){this.page.x=t}},pageY:{get:function(){return this.page.y},set:function(t){this.page.y=t}},clientX:{get:function(){return this.client.x},set:function(t){this.client.x=t}},clientY:{get:function(){return this.client.y},set:function(t){this.client.y=t}},dx:{get:function(){return this.delta.x},set:function(t){this.delta.x=t}},dy:{get:function(){return this.delta.y},set:function(t){this.delta.y=t}},velocityX:{get:function(){return this.velocity.x},set:function(t){this.velocity.x=t}},velocityY:{get:function(){return this.velocity.y},set:function(t){this.velocity.y=t}}});var Le={};function Ue(t,e){for(var n=0;nthis.pointerMoveTolerance);var a=this.getPointerIndex(t),s={pointer:t,pointerIndex:a,pointerInfo:this.pointers[a],event:e,type:"move",eventTarget:n,dx:r,dy:o,duplicate:i,interaction:this};i||B.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",s),i||this.simulation||(this.interacting()&&(s.type=null,this.move(s)),this.pointerWasMoved&&B.copyCoords(this.coords.prev,this.coords.cur))}},{key:"move",value:function(t){t&&t.event||B.setZeroCoords(this.coords.delta),(t=(0,M.default)({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.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,!0===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=B.getPointerId(t);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:K.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=B.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 Le.PointerInfo(o,t,e,null,null),i=this.pointers.length,this.pointers.push(a)),B.setCoords(this.coords.cur,this.pointers.map((function(t){return t.pointer})),this._now()),B.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),r&&(this.pointerIsDown=!0,a.downTime=this.coords.cur.timeStamp,a.downTarget=n,B.pointerExtend(this.downPointer,t),this.interacting()||(B.copyCoords(this.coords.start,this.coords.cur),B.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),this.pointerIsDown=!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 Ae.InteractEvent(this,t,this.prepared.name,e,this.element,n,r)}},{key:"_fireEvent",value:function(t){var e;null==(e=this.interactable)||e.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&&(k.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()}}],n&&Ke(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();He.Interaction=Qe;var tn=Qe;He.default=tn;var en={};function nn(t){t.pointerIsDown&&(sn(t.coords.cur,t.offset.total),t.offset.pending.x=0,t.offset.pending.y=0)}function rn(t){on(t.interaction)}function on(t){if(!function(t){return!(!t.offset.pending.x&&!t.offset.pending.y)}(t))return!1;var e=t.offset.pending;return sn(t.coords.cur,e),sn(t.coords.delta,e),k.addEdges(t.edges,t.rect,e),e.x=0,e.y=0,!0}function an(t){var e=t.x,n=t.y;this.offset.pending.x+=e,this.offset.pending.y+=n,this.offset.total.x+=e,this.offset.total.y+=n}function sn(t,e){var n=t.page,r=t.client,o=e.x,i=e.y;n.x+=o,n.y+=i,r.x+=o,r.y+=i}Object.defineProperty(en,"__esModule",{value:!0}),en.addTotal=nn,en.applyPending=on,en.default=void 0,He._ProxyMethods.offsetBy="";var ln={id:"offset",before:["modifiers","pointer-events","actions","inertia"],install:function(t){t.Interaction.prototype.offsetBy=an},listeners:{"interactions:new":function(t){t.interaction.offset={total:{x:0,y:0},pending:{x:0,y:0}}},"interactions:update-pointer":function(t){return nn(t.interaction)},"interactions:before-action-start":rn,"interactions:before-action-move":rn,"interactions:before-action-end":function(t){var e=t.interaction;if(on(e))return e.move({offset:!0}),e.end(),!1},"interactions:stop":function(t){var e=t.interaction;e.offset.total.x=0,e.offset.total.y=0,e.offset.pending.x=0,e.offset.pending.y=0}}},un=ln;en.default=un;var cn={};function fn(t,e){for(var n=0;nn.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=vn(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.onNextFrame((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.onNextFrame((function(){return t.smoothEndTick()}))}},{key:"onNextFrame",value:function(t){var e=this;this.timeout=jt.default.request((function(){e.active&&t()}))}},{key:"inertiaTick",value:function(){var t,e,n,r,o,i=this,a=this.interaction,s=vn(a).resistance,l=(a._now()-this.t0)/1e3;if(l=0;n--){var r=e[n],o=r.selector,a=r.context,s=r.listeners;o===this.target&&a===this._context&&e.splice(n,1);for(var l=s.length-1;l>=0;l--)this._scopeEvents.removeDelegate(this.target,this._context,t,s[l][0],s[l][1])}else this._scopeEvents.remove(this.target,"all")}}])&&Tn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),t}();Sn.Interactable=Mn;var kn={};function In(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n=0;a--){var p=f[a];if(p.selector===t&&p.context===e){for(var v=p.listeners,h=v.length-1;h>=0;h--){var g=v[h];if(g.func===o&&Yn(g.options,s)){v.splice(h,1),v.length||(f.splice(a,1),l(e,n,u),l(e,n,c,!0)),d=!0;break}}if(d)break}}},delegateListener:u,delegateUseCapture:c,delegatedEvents:r,documents:o,targets:n,supportsOptions:!1,supportsPassive:!1};function s(t,e,r,o){if(t.addEventListener){var i=Bn(o),s=K.find(n,(function(e){return e.eventTarget===t}));s||(s={eventTarget:t,events:{}},n.push(s)),s.events[e]||(s.events[e]=[]),K.find(s.events[e],(function(t){return t.func===r&&Yn(t.options,i)}))||(t.addEventListener(e,r,a.supportsOptions?i:i.capture),s.events[e].push({func:r,options:i}))}}function l(t,e,r,o){if(t.addEventListener&&t.removeEventListener){var i=K.findIndex(n,(function(e){return e.eventTarget===t})),s=n[i];if(s&&s.events)if("all"!==e){var u=!1,c=s.events[e];if(c){if("all"===r){for(var f=c.length-1;f>=0;f--){var d=c[f];l(t,e,d.func,d.options)}return}for(var p=Bn(o),v=0;v=2)continue;if(!o.interacting()&&e===o.pointerType)return o}return null}};function Vn(t,e){return t.pointers.some((function(t){return t.id===e}))}var Nn=Un;Ln.default=Nn;var qn={};function Gn(t){return Gn="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},Gn(t)}function $n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Hn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=0;r--){var o=e.interactions.list[r];o.interactable===n&&(o.stop(),e.fire("interactions:destroy",{interaction:o}),o.destroy(),e.interactions.list.length>2&&e.interactions.list.splice(r,1))}}},onDocSignal:or,doOnInteractions:nr,methodNames:er},ar=ir;qn.default=ar;var sr={};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},lr(t)}function ur(){return ur="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=cr(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},ur.apply(this,arguments)}function cr(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=pr(t)););return t}function fr(t,e){return fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fr(t,e)}function dr(t,e){if(e&&("object"===lr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function pr(t){return pr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pr(t)}function vr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hr(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);nMath.abs(u.y),l.coords,l.rect),(0,M.default)(r,l.coords)),l.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function Br(t,e,n){var r=t.startCoords,o=t.edgeSign;e?n.y=r.y+(n.x-r.x)*o.y:n.x=r.x+(n.y-r.y)*o.x}function Yr(t,e,n,r){var o=t.startRect,i=t.startCoords,a=t.ratio,s=t.edgeSign;if(e){var l=r.width/a;n.y=i.y+(l-o.height)*s.y}else{var u=r.height*a;n.x=i.x+(u-o.width)*s.x}}zr.aspectRatio=Xr;var Wr=(0,je.makeModifier)(Xr,"aspectRatio");zr.default=Wr;var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.default=void 0;var Ur=function(){};Ur._defaults={};var Vr=Ur;Lr.default=Vr;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Object.defineProperty(Nr,"default",{enumerable:!0,get:function(){return Lr.default}});var qr={};function Gr(t,e,n){return i.default.func(t)?k.resolveRectLike(t,e.interactable,e.element,[n.x,n.y,e]):k.resolveRectLike(t,e.interactable,e.element)}Object.defineProperty(qr,"__esModule",{value:!0}),qr.default=void 0,qr.getRestrictionRect=Gr,qr.restrict=void 0;var $r={start:function(t){var e=t.rect,n=t.startOffset,r=t.state,o=t.interaction,i=t.pageCoords,a=r.options,s=a.elementRect,l=(0,M.default)({left:0,top:0,right:0,bottom:0},a.offset||{});if(e&&s){var u=Gr(a.restriction,o,i);if(u){var c=u.right-u.left-e.width,f=u.bottom-u.top-e.height;c<0&&(l.left+=c,l.right+=c),f<0&&(l.top+=f,l.bottom+=f)}l.left+=n.left-e.width*s.left,l.top+=n.top-e.height*s.top,l.right+=n.right-e.width*(1-s.right),l.bottom+=n.bottom-e.height*(1-s.bottom)}r.offset=l},set:function(t){var e=t.coords,n=t.interaction,r=t.state,o=r.options,i=r.offset,a=Gr(o.restriction,n,e);if(a){var s=k.xywhToTlbr(a);e.x=Math.max(Math.min(s.right-i.right,e.x),s.left+i.left),e.y=Math.max(Math.min(s.bottom-i.bottom,e.y),s.top+i.top)}},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}};qr.restrict=$r;var Hr=(0,je.makeModifier)($r,"restrict");qr.default=Hr;var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.restrictEdges=Kr.default=void 0;var Zr={top:1/0,left:1/0,bottom:-1/0,right:-1/0},Jr={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function Qr(t,e){for(var n=["top","left","bottom","right"],r=0;rt.length)&&(e=t.length);for(var n=0,r=Array(e);n\n * https://interactjs.io/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;\n","export default (thing: any) => !!(thing && thing.Window) && thing instanceof thing.Window\n","import isWindow from './isWindow'\n\nexport let realWindow = undefined as Window\n\nlet win = undefined as Window\nexport { win as window }\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n 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 && typeof window.wrap === 'function' && window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win = window\n}\n\nif (typeof window !== 'undefined' && !!window) {\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","import isWindow from './isWindow'\nimport * as win from './window'\n\nconst window = (thing: any): thing is Window => thing === win.window || isWindow(thing)\n\nconst docFrag = (thing: any): thing is DocumentFragment => object(thing) && thing.nodeType === 11\n\nconst object = (thing: any): thing is { [index: string]: any } => !!thing && typeof thing === 'object'\n\nconst func = (thing: any): thing is (...args: any[]) => any => typeof thing === 'function'\n\nconst number = (thing: any): thing is number => typeof thing === 'number'\n\nconst bool = (thing: any): thing is boolean => typeof thing === 'boolean'\n\nconst string = (thing: any): thing is string => typeof thing === 'string'\n\nconst element = (thing: any): thing is HTMLElement | SVGElement => {\n if (!thing || typeof thing !== 'object') {\n return false\n }\n\n const _window = win.getWindow(thing) || win.window\n\n return /object|function/.test(typeof Element)\n ? thing instanceof Element || thing instanceof _window.Element\n : thing.nodeType === 1 && typeof thing.nodeName === 'string'\n}\n\nconst plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) && !!thing.constructor && /function Object\\b/.test(thing.constructor.toString())\n\nconst array = (thing: any): thing is T[] =>\n object(thing) && typeof thing.length !== 'undefined' && func(thing.splice)\n\nexport default {\n window,\n docFrag,\n object,\n func,\n number,\n bool,\n string,\n element,\n plainObject,\n array,\n}\n","import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drag: DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = InteractEvent<'drag'>\n\nexport type DraggableMethod = ActionMethod\n\nexport interface DraggableOptions extends PerActionDefaults {\n startAxis?: 'x' | 'y' | 'xy'\n lockAxis?: 'x' | 'y' | 'xy' | 'start'\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 } 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 (\n this: Interactable,\n options?: DraggableOptions | boolean,\n): 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 as DraggableOptions\n}\n\nconst drag: 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' ? dragOptions.startAxis : 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 DraggableOptions,\n\n getCursor () {\n return 'move'\n },\n\n filterEventType: (type: string) => type.search('drag') === 0,\n}\n\nexport default drag\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 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 is from './is'\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 'matches',\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: Partial = window.navigator || {}\n\n // Does the browser support touch input?\n browser.supportsTouch =\n 'ontouchstart' in window ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n // https://github.com/taye/interact.js/issues/703#issuecomment-471570492\n browser.supportsPointerEvent = (navigator as any).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) && /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 =\n navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent)\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = (\n '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 ) as 'matches'\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 = domObjects.document && 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n","import type { Rect, Target, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport domObjects from './domObjects'\nimport is from './is'\nimport * as win from './window'\n\nexport function nodeContains (parent: Node, child: Node) {\n if (parent.contains) {\n return parent.contains(child as Node)\n }\n\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)) {\n return element\n }\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: 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: Node | Document | ShadowRoot) => el.parentNode || (el as ShadowRoot).host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Element[] | NodeListOf) {\n let deepestNodeParents: Node[] = []\n let deepestNodeIndex: number\n\n for (let i = 0; i < elements.length; i++) {\n const currentNode = elements[i]\n const deepestNode: Node = elements[deepestNodeIndex]\n\n // node may appear in elements array multiple times\n if (!currentNode || i === deepestNodeIndex) {\n continue\n }\n\n if (!deepestNode) {\n deepestNodeIndex = i\n continue\n }\n\n const currentNodeParent = getParent(currentNode)\n const deepestNodeParent = getParent(deepestNode)\n\n // check if the deepest or current are document.documentElement/rootElement\n // - if the current node is, do nothing and continue\n if (currentNodeParent === currentNode.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current node and continue to next\n else if (deepestNodeParent === currentNode.ownerDocument) {\n deepestNodeIndex = i\n continue\n }\n\n // compare zIndex of siblings\n if (currentNodeParent === deepestNodeParent) {\n if (zIndexIsHigherThan(currentNode, deepestNode)) {\n deepestNodeIndex = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest node\n deepestNodeParents = deepestNodeParents.length ? deepestNodeParents : getNodeParents(deepestNode)\n\n let ancestryStart: Node\n\n // if the deepest node is an HTMLElement and the current node is a non root svg element\n if (\n deepestNode instanceof domObjects.HTMLElement &&\n currentNode instanceof domObjects.SVGElement &&\n !(currentNode instanceof domObjects.SVGSVGElement)\n ) {\n // TODO: is this check necessary? Was this for HTML elements embedded in SVG?\n if (currentNode === deepestNodeParent) {\n continue\n }\n\n ancestryStart = currentNode.ownerSVGElement\n } else {\n ancestryStart = currentNode\n }\n\n const currentNodeParents = getNodeParents(ancestryStart, deepestNode.ownerDocument)\n let commonIndex = 0\n\n // get (position of closest common ancestor) + 1\n while (\n currentNodeParents[commonIndex] &&\n currentNodeParents[commonIndex] === deepestNodeParents[commonIndex]\n ) {\n commonIndex++\n }\n\n const parents = [\n currentNodeParents[commonIndex - 1],\n currentNodeParents[commonIndex],\n deepestNodeParents[commonIndex],\n ]\n\n if (parents[0]) {\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestNodeIndex = i\n deepestNodeParents = currentNodeParents\n\n break\n } else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n }\n\n return deepestNodeIndex\n}\n\nfunction getNodeParents (node: Node, limit?: Node) {\n const parents: Node[] = []\n let parent: Node = node\n let parentParent: Node\n\n while ((parentParent = getParent(parent)) && parent !== limit && parentParent !== parent.ownerDocument) {\n parents.unshift(parent)\n parent = parentParent\n }\n\n return parents\n}\n\nfunction zIndexIsHigherThan (higherNode: Node, lowerNode: Node) {\n const higherIndex = parseInt(win.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0\n const lowerIndex = parseInt(win.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0\n\n return higherIndex >= lowerIndex\n}\n\nexport function matchesUpTo (element: 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 Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Element) {\n return (element as any).correspondingUseElement || element\n}\n\nexport function getScrollXY (relevantWindow?: Window) {\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: Element): Required {\n const clientRect =\n element instanceof domObjects.SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]\n\n return (\n 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}\n\nexport function getElementRect (element: 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: Target) {\n if (!is.string(value)) {\n return false\n }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\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 type {\n HasGetRect,\n RectResolvable,\n Rect,\n Element,\n Point,\n FullRect,\n EdgeOptions,\n} from '@interactjs/core/types'\n\nimport { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport is from './is'\n\nexport function getStringOptionResult (value: any, target: HasGetRect, element: Node) {\n if (value === 'parent') {\n return parentNode(element)\n }\n\n if (value === 'self') {\n return target.getRect(element as Element)\n }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: RectResolvable,\n target?: 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 } 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 Rect\n}\n\nexport function toFullRect (rect: Rect): FullRect {\n const { top, left, bottom, right } = rect\n const width = rect.width ?? rect.right - rect.left\n const height = rect.height ?? rect.bottom - rect.top\n\n return { top, left, bottom, right, width, height }\n}\n\nexport function rectToXY (rect: Rect | Point) {\n return (\n rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n )\n}\n\nexport function xywhToTlbr> (rect: T) {\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 as Rect & T\n}\n\nexport function tlbrToXywh (rect: Rect & Partial) {\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 as FullRect & Point\n}\n\nexport function addEdges (edges: EdgeOptions, rect: Rect, delta: Point) {\n if (edges.left) {\n rect.left += delta.x\n }\n if (edges.right) {\n rect.right += delta.x\n }\n if (edges.top) {\n rect.top += delta.y\n }\n if (edges.bottom) {\n rect.bottom += delta.y\n }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n","import type { PerActionDefaults } from '@interactjs/core/options'\nimport type { ActionName, HasGetRect } from '@interactjs/core/types'\n\nimport { rectToXY, resolveRectLike } from './rect'\n\nexport default function getOriginXY (\n target: HasGetRect & { options: PerActionDefaults },\n element: Node,\n actionName?: ActionName,\n) {\n const actionOptions = actionName && (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","import type { EventTypes, Listener, ListenersArg } from '@interactjs/core/types'\n\nimport is from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Listener[]\n}\n\nexport default function normalize (\n type: EventTypes,\n listeners?: ListenersArg | ListenersArg[] | null,\n filter = (_typeOrPrefix: string) => true,\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 type.forEach((t) => normalize(t, listeners, filter, result))\n return result\n }\n\n // before: type = [{ drag: () => {} }], listeners = undefined\n // after: type = '' , listeners = [{ drag: () => {} }]\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners) && filter(type)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n } else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, filter, result)\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], filter, result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n","export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n","const VENDOR_PREFIXES = ['webkit', 'moz']\n\nexport default function pointerExtend (dest: Partial }>, source: T) {\n dest.__set ||= {} as any\n\n for (const prop in source) {\n // skip deprecated prefixed properties\n if (VENDOR_PREFIXES.some((prefix) => prop.indexOf(prefix) === 0)) continue\n\n if (typeof dest[prop] !== 'function' && prop !== '__set') {\n Object.defineProperty(dest, prop, {\n get () {\n if (prop in dest.__set) return dest.__set[prop]\n\n return (dest.__set[prop] = source[prop] as any)\n },\n set (value: any) {\n dest.__set[prop] = value\n },\n configurable: true,\n })\n }\n }\n return dest\n}\n","import type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { CoordsSetMember, PointerType, Point, PointerEventType, Element } from '@interactjs/core/types'\n\nimport browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: CoordsSetMember, src: 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: CoordsSetMember, prev: CoordsSetMember, cur: 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: CoordsSetMember, delta: 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: 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: string, pointer: PointerType | InteractEvent, xy: Point) {\n xy = xy || ({} as Point)\n type = type || 'page'\n\n xy.x = pointer[(type + 'X') as 'pageX']\n xy.y = pointer[(type + 'Y') as 'pageY']\n\n return xy\n}\n\nexport function getPageXY (pointer: PointerType | InteractEvent, page?: 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 } else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer: PointerType, client: Point) {\n client = client || ({} as any)\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n } else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer: { pointerId?: number, identifier?: number, type?: string }) {\n return is.number(pointer.pointerId) ? pointer.pointerId! : pointer.identifier!\n}\n\nexport function setCoords (dest: CoordsSetMember, pointers: any[], timeStamp: number) {\n const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]\n\n getPageXY(pointer, dest.page)\n getClientXY(pointer, dest.client)\n\n dest.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event: TouchEvent | PointerType[]) {\n const touches: PointerType[] = []\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 } else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\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: PointerType[]) {\n const average = {\n pageX: 0,\n pageY: 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n type CoordKeys = keyof typeof average\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop as CoordKeys] += pointer[prop as CoordKeys]\n }\n }\n for (const prop in average) {\n average[prop as CoordKeys] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: PointerType[]) {\n if (!event.length) {\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: PointerType[] | TouchEvent, deltaSource: string) {\n const sourceX = (deltaSource + 'X') as 'pageX'\n const sourceY = (deltaSource + 'Y') as 'pageY'\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: { pointerType?: string, identifier?: number, type?: string }) {\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: Event) {\n const path = is.func(event.composedPath)\n ? (event.composedPath() as Element[])\n : (event as unknown as { path: Element[] }).path\n\n return [\n domUtils.getActualElement(path ? path[0] : (event.target as Element)),\n domUtils.getActualElement(event.currentTarget as Element),\n ]\n}\n\nexport function newCoords (): 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 () {\n return this.coords.page\n },\n get client () {\n return this.coords.client\n },\n get timeStamp () {\n return this.coords.timeStamp\n },\n get pageX () {\n return this.coords.page.x\n },\n get pageY () {\n return this.coords.page.y\n },\n get clientX () {\n return this.coords.client.x\n },\n get clientY () {\n return this.coords.client.y\n },\n get pointerId () {\n return this.coords.pointerId\n },\n get target () {\n return this.coords.target\n },\n get type () {\n return this.coords.type\n },\n get pointerType () {\n return this.coords.pointerType\n },\n get buttons () {\n return this.coords.buttons\n },\n preventDefault () {},\n }\n\n return event as typeof event & PointerType & PointerEventType\n}\n\nexport interface MockCoords {\n page: Point\n client: 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 type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName } from '@interactjs/core/types'\n\nexport class BaseEvent {\n declare type: string\n declare target: EventTarget\n declare currentTarget: Node\n declare interactable: Interactable\n declare _interaction: Interaction\n declare timeStamp: number\n immediatePropagationStopped = false\n propagationStopped = false\n\n constructor (interaction: 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\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface BaseEvent {\n interaction: InteractionProxy\n}\n\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperty(BaseEvent.prototype, 'interaction', {\n get (this: BaseEvent) {\n return this._interaction._proxy\n },\n set (this: BaseEvent) {},\n})\n","type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport const contains = (array: T[], target: T) => array.indexOf(target) !== -1\n\nexport const remove = (array: T[], target: T) => array.splice(array.indexOf(target), 1)\n\nexport const merge = (target: Array, source: U[]) => {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport const from = (source: ArrayLike) => merge([] as T[], source as T[])\n\nexport const 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 const find = (array: T[], func: Filter): T | undefined => array[findIndex(array, func)]\n","import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\n\nimport type { DropState } from './plugin'\n\nexport class DropEvent extends BaseEvent<'drag'> {\n declare target: Element\n dropzone: Interactable\n dragEvent: InteractEvent<'drag'>\n relatedTarget: Element\n draggable: Interactable\n propagationStopped = false\n immediatePropagationStopped = false\n\n /**\n * Class of events fired on dropzones during drags with acceptable targets.\n */\n constructor (dropState: DropState, dragEvent: InteractEvent<'drag'>, type: string) {\n super(dragEvent._interaction)\n\n const { element, dropzone } = type === 'dragleave' ? dropState.prev : 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 || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)\n ) {\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(\n activeDrops,\n ({ dropzone, element }) => dropzone === this.dropzone && element === this.target,\n )\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 } 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","import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, PointerEventType, Rect, ListenersArg } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '../drag/plugin'\n\nimport type { DragEvent } from '../drag/plugin'\nimport drag from '../drag/plugin'\n/* eslint-enable import/no-duplicates */\n\nimport { DropEvent } from './DropEvent'\n\nexport type DropFunctionChecker = (\n dragEvent: any, // related drag operation\n event: any, // touch or mouse EventEmitter\n dropped: boolean, // default checker result\n dropzone: Interactable, // dropzone interactable\n dropElement: Element, // drop zone element\n draggable: Interactable, // draggable's Interactable\n draggableElement: Element, // dragged element\n) => boolean\n\nexport interface DropzoneOptions extends PerActionDefaults {\n accept?:\n | string\n | Element\n | (({ dropzone, draggableElement }: { dropzone: Interactable, draggableElement: Element }) => boolean)\n // How the overlap is checked on the drop zone\n overlap?: 'pointer' | 'center' | number\n checker?: DropFunctionChecker\n\n ondropactivate?: ListenersArg\n ondropdeactivate?: ListenersArg\n ondragenter?: ListenersArg\n ondragleave?: ListenersArg\n ondropmove?: ListenersArg\n ondrop?: ListenersArg\n}\n\nexport interface DropzoneMethod {\n (this: Interactable, options: DropzoneOptions | boolean): Interactable\n (): DropzoneOptions\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n dropzone: DropzoneMethod\n dropCheck: (\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElemen: 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/InteractEvent' {\n interface InteractEvent {\n prevDropzone?: Interactable\n dropzone?: Interactable\n dragEnter?: Element\n dragLeave?: Element\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n drop: DropzoneOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\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\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n drop?: typeof drop\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n interface InteractStatic {\n dynamicDrop: (this: InteractStatic, newValue?: boolean) => boolean | this\n }\n}\n\ninterface DropSignalArg {\n interaction: Interaction<'drag'>\n dragEvent: DragEvent\n}\n\nexport interface ActiveDrop {\n dropzone: Interactable\n element: Element\n rect: Rect\n}\n\nexport interface DropState {\n cur: {\n // the dropzone a drag target might be dropped into\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n prev: {\n // the dropzone that was recently dragged away from\n dropzone: Interactable\n // the element at the time of checking\n element: Element\n }\n // wheather the potential drop was rejected from a listener\n rejected: boolean\n // the drop events related to the current drag event\n events: FiredDropEvents\n activeDrops: ActiveDrop[]\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n /** @lends module:interact */\n interactStatic: interact,\n /** @lends Interactable */\n Interactable,\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 {object | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.dropzone = function (this: Interactable, options) {\n return dropzoneMethod(this, options)\n } as Interactable['dropzone']\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 (\n this: Interactable,\n dragEvent,\n event,\n draggable,\n draggableElement,\n dropElement,\n rect,\n ) {\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 (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 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 collectDropzones ({ interactables }: Scope, draggableElement: Element) {\n const drops: ActiveDrop[] = []\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) {\n continue\n }\n\n const accept = dropzone.options.drop.accept\n\n // test the draggable draggableElement against the dropzone's accept setting\n if (\n (is.element(accept) && accept !== draggableElement) ||\n (is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||\n (is.func(accept) && !accept({ dropzone, draggableElement }))\n ) {\n continue\n }\n\n for (const dropzoneElement of dropzone.getAllElements()) {\n if (dropzoneElement !== draggableElement) {\n drops.push({\n dropzone,\n element: dropzoneElement,\n rect: dropzone.getRect(dropzoneElement),\n })\n }\n }\n }\n\n return drops\n}\n\nfunction fireActivationEvents (activeDrops: ActiveDrop[], event: DropEvent) {\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: Element) {\n // get dropzones and their elements that could receive the draggable\n const activeDrops = collectDropzones(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 (\n { dropState, interactable: draggable, element: dragElement }: Interaction,\n dragEvent,\n pointerEvent,\n) {\n const validDrops: Element[] = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {\n const isValid = dropzone.dropCheck(\n dragEvent,\n pointerEvent,\n draggable!,\n dragElement!,\n dropzoneElement,\n rect,\n )\n validDrops.push(isValid ? dropzoneElement : null)\n }\n\n // get the most appropriate dropzone based on DOM depth and order\n const dropIndex = domUtils.indexOfDeepestElement(validDrops)\n\n return dropState!.activeDrops[dropIndex] || null\n}\n\nfunction getDropEvents (interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {\n const dropState = interaction.dropState!\n const dropEvents: Record = {\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 as never\n dropEvents.activate.dropzone = null as never\n }\n if (dragEvent.type === 'dragend') {\n dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')\n\n dropEvents.deactivate.target = null as never\n dropEvents.deactivate.dropzone = null as never\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 dragEvent.dropzone = dropState.cur.dropzone\n }\n\n return dropEvents\n}\n\ntype FiredDropEvents = Partial<\nRecord<'leave' | 'enter' | 'move' | 'drop' | 'activate' | 'deactivate', DropEvent>\n>\n\nfunction fireDropEvents (interaction: Interaction, events: FiredDropEvents) {\n const dropState = interaction.dropState!\n const { activeDrops, cur, prev } = dropState\n\n if (events.leave) {\n prev.dropzone.fire(events.leave)\n }\n if (events.enter) {\n cur.dropzone.fire(events.enter)\n }\n if (events.move) {\n cur.dropzone.fire(events.move)\n }\n if (events.drop) {\n cur.dropzone.fire(events.drop)\n }\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 }: DoPhaseArg<'drag', EventPhase>, scope: Scope) {\n if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') {\n return\n }\n\n const dropState = interaction.dropState!\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 =\n 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: Interactable): DropzoneOptions\nfunction dropzoneMethod(interactable: Interactable, options: DropzoneOptions | boolean): Interactable\nfunction dropzoneMethod (interactable: Interactable, options?: DropzoneOptions | boolean) {\n if (is.object(options)) {\n interactable.options.drop.enabled = options.enabled !== false\n\n if (options.listeners) {\n const normalized = 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 const prevListeners = interactable.options.drop.listeners\n prevListeners && interactable.off(prevListeners)\n\n interactable.on(corrected)\n interactable.options.drop.listeners = corrected\n }\n\n if (is.func(options.ondrop)) {\n interactable.on('drop', options.ondrop)\n }\n if (is.func(options.ondropactivate)) {\n interactable.on('dropactivate', options.ondropactivate)\n }\n if (is.func(options.ondropdeactivate)) {\n interactable.on('dropdeactivate', options.ondropdeactivate)\n }\n if (is.func(options.ondragenter)) {\n interactable.on('dragenter', options.ondragenter)\n }\n if (is.func(options.ondragleave)) {\n interactable.on('dragleave', options.ondragleave)\n }\n if (is.func(options.ondropmove)) {\n interactable.on('dropmove', options.ondropmove)\n }\n\n if (/^(pointer|center)$/.test(options.overlap as string)) {\n interactable.options.drop.overlap = options.overlap\n } else if (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 (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: Interactable,\n dragEvent: InteractEvent,\n event: PointerEventType,\n draggable: Interactable,\n draggableElement: Element,\n dropElement: 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n : false\n }\n\n const dropOverlap = interactable.options.drop.overlap\n\n if (dropOverlap === 'pointer') {\n const origin = getOriginXY(draggable, draggableElement, 'drag')\n const page = pointerUtils.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 && is.number(dropOverlap)) {\n const overlapArea =\n 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(\n dragEvent,\n event,\n dropped,\n interactable,\n dropElement,\n draggable,\n draggableElement,\n )\n }\n\n return dropped\n}\n\nconst drop: Plugin = {\n id: 'actions/drop',\n install,\n listeners: {\n 'interactions:before-action-start': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\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': (\n { interaction, event, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n\n // reset active dropzones\n dropState.activeDrops = []\n dropState.events = {}\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 'interactions:action-move': onEventCreated,\n\n 'interactions:after-action-move': (\n { interaction, iEvent: dragEvent }: DoPhaseArg<'drag', EventPhase>,\n scope,\n ) => {\n if (interaction.prepared.name !== 'drag') {\n return\n }\n\n const dropState = interaction.dropState!\n fireDropEvents(interaction, dropState.events)\n\n scope.fire('actions/drop:move', { interaction, dragEvent })\n dropState.events = {}\n },\n\n 'interactions:action-end': (arg: DoPhaseArg<'drag', EventPhase>, scope) => {\n if (arg.interaction.prepared.name !== 'drag') {\n return\n }\n\n const { interaction, iEvent: dragEvent } = arg\n\n onEventCreated(arg, scope)\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') {\n return\n }\n\n const { dropState } = interaction\n\n if (dropState) {\n dropState.activeDrops = null as never\n dropState.events = null as never\n dropState.cur.dropzone = null as never\n dropState.cur.element = null as never\n dropState.prev.dropzone = null as never\n dropState.prev.element = null as never\n dropState.rejected = false\n }\n },\n },\n getActiveDrops,\n getDrop,\n getDropEvents,\n fireDropEvents,\n\n filterEventType: (type: string) => type.search('drag') === 0 || type.search('drop') === 0,\n\n defaults: {\n enabled: false,\n accept: null as never,\n overlap: 'pointer',\n } as DropzoneOptions,\n}\n\nexport default drop\n","import type { InteractEvent, EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionMethod, Rect, PointerType, ListenersArg } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport type GesturableMethod = 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/options' {\n interface ActionDefaults {\n gesture: GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GesturableOptions extends PerActionDefaults {\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface GestureEvent extends 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: Rect // enclosing box of all points\n touches: PointerType[]\n}\n\nexport interface GestureSignalArg extends DoPhaseArg<'gesture', EventPhase> {\n iEvent: GestureEvent\n interaction: Interaction<'gesture'>\n}\n\nfunction install (scope: Scope) {\n const { actions, Interactable, defaults } = 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 (\n this: InstanceType,\n options: GesturableOptions | boolean,\n ) {\n if (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 (is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as GesturableOptions\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 = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = pointerUtils.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n } else if (ending || interaction.pointers.length < 2) {\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 } else {\n iEvent.distance = pointerUtils.touchDistance(pointers, deltaSource)\n iEvent.box = pointerUtils.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = pointerUtils.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 (is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: 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 getCursor () {\n return ''\n },\n\n filterEventType: (type: string) => type.search('gesture') === 0,\n}\n\nexport default gesture\n","import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type {\n ActionName,\n ActionProps,\n ActionMethod,\n EdgeOptions,\n FullRect,\n ListenersArg,\n OrBoolean,\n Point,\n Rect,\n} from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = 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/options' {\n interface ActionDefaults {\n resize: ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/types' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizableOptions extends PerActionDefaults {\n square?: boolean\n preserveAspectRatio?: boolean\n edges?: EdgeOptions | null\n axis?: 'x' | 'y' | 'xy' // deprecated\n invert?: 'none' | 'negate' | 'reposition'\n margin?: number\n squareResize?: boolean\n oninertiastart?: ListenersArg\n onstart?: ListenersArg\n onmove?: ListenersArg\n onend?: ListenersArg\n}\n\nexport interface ResizeEvent

extends InteractEvent<'resize', P> {\n deltaRect?: FullRect\n edges?: 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: Interactable, options: 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) {\n return undefined\n }\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(\n edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin,\n )\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 } 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: Interactable, options: 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 } 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 } 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: Point,\n element: Node,\n interactableElement: Element,\n rect: Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) {\n return false\n }\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, Math.abs((name === 'left' || name === 'right' ? width : height) / 2))\n\n if (width < 0) {\n if (name === 'left') {\n name = 'right'\n } else if (name === 'right') {\n name = 'left'\n }\n }\n if (height < 0) {\n if (name === 'top') {\n name = 'bottom'\n } else if (name === 'bottom') {\n name = 'top'\n }\n }\n\n if (name === 'left') {\n const edge = width >= 0 ? rect.left : rect.right\n return page.x < edge + margin\n }\n if (name === 'top') {\n const edge = height >= 0 ? rect.top : rect.bottom\n return page.y < edge + margin\n }\n\n if (name === 'right') {\n return page.x > (width >= 0 ? rect.right : rect.left) - margin\n }\n if (name === 'bottom') {\n return page.y > (height >= 0 ? rect.bottom : rect.top) - margin\n }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) {\n return false\n }\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\n/* eslint-disable multiline-ternary */\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nfunction initCursors (browser: typeof import('@interactjs/utils/browser').default) {\n return browser.isIe9\n ? {\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 : {\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/* eslint-enable multiline-ternary */\n\nfunction start ({ iEvent, interaction }: { iEvent: 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: 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 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 } 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: 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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\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 } else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n } else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n } else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: 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 ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\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 filterEventType: (type: string) => type.search('resize') === 0,\n\n defaultMargin: null as number,\n}\n\nexport default resize\n","import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './drag/plugin'\nimport './drop/plugin'\nimport './gesture/plugin'\nimport './resize/plugin'\n\nimport drag from './drag/plugin'\nimport drop from './drop/plugin'\nimport gesture from './gesture/plugin'\nimport resize from './resize/plugin'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'actions',\n install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n },\n}\n","let lastTime = 0\nlet request: typeof requestAnimationFrame\nlet cancel: typeof cancelAnimationFrame\n\nfunction init (global: Window | typeof globalThis) {\n request = global.requestAnimationFrame\n cancel = global.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = global[`${vendor}RequestAnimationFrame` as 'requestAnimationFrame']\n cancel =\n global[`${vendor}CancelAnimationFrame` as 'cancelAnimationFrame'] ||\n global[`${vendor}CancelRequestAnimationFrame` as 'cancelAnimationFrame']\n }\n }\n\n request = request && request.bind(global)\n cancel = cancel && cancel.bind(global)\n\n if (!request) {\n request = (callback) => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n const token = global.setTimeout(() => {\n // eslint-disable-next-line n/no-callback-literal\n callback(currTime + timeToCall)\n }, timeToCall)\n\n lastTime = currTime + timeToCall\n return token as any\n }\n\n cancel = (token) => clearTimeout(token)\n }\n}\n\nexport default {\n request: (callback: FrameRequestCallback) => request(callback),\n cancel: (token: number) => cancel(token),\n init,\n}\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, PointerType } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\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/options' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement | string\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const { defaults, actions } = 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 Interaction | null,\n i: 0, // the handle returned by window.setInterval\n\n // Direction each pulse is to scroll in\n x: 0,\n y: 0,\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: 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 = 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 } 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: Interactable, actionName: ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll?.enabled\n },\n onInteractionMove ({\n interaction,\n pointer,\n }: {\n interaction: Interaction\n pointer: PointerType\n }) {\n if (\n !(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))\n ) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top: boolean\n let right: boolean\n let bottom: boolean\n let left: boolean\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 } 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: Interactable, element: Element) {\n return (\n (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n )\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta (\n {\n interaction,\n element,\n }: {\n interaction: Partial>\n element: Element\n },\n func: any,\n) {\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(scrollOptions.container, interaction.interactable, element)\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: 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 type { ActionName, ActionProps } from '@interactjs/core/types'\n\nimport { window } from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n return function (this: T) {\n if (!warned) {\n ;(window as any).console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: ActionProps, src: ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport const sign = (n: number) => (n >= 0 ? 1 : -1)\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport { warnOnce } from '@interactjs/utils/misc'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ) => 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\nfunction install (scope: 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: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ): 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 * 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 * @deprecated\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\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: Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\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 * @deprecated\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\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: 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: Interactable,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n scope: Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons =\n (event as MouseEvent).buttons ||\n {\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: Interactable): boolean\nfunction styleCursor(this: Interactable, newValue: boolean): typeof this\nfunction styleCursor (this: 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: 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 type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type {\n CursorChecker,\n PointerType,\n PointerEventType,\n Element,\n ActionName,\n ActionProps,\n} from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport { copyAction } from '@interactjs/utils/misc'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './InteractableMethods'\nimport InteractableMethods from './InteractableMethods'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Omit & {\n interaction: Interaction\n }\n 'autoStart:prepared': { interaction: Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/options' {\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 | Element\n ignoreFrom?: string | Element\n cursorChecker?: 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 // TODO: docst\n mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interactable\n interaction: Interaction\n element: Element\n action: 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: Element\n}\n\nfunction install (scope: Scope) {\n const { interactStatic: interact, defaults } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n 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: number) => 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 (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n if (interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:move'],\n scope: Scope,\n) {\n if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction } = arg\n\n if (\n !interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name\n ) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName = (interaction as Interaction).prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (\n interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)\n ) {\n interaction.stop()\n } else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interaction }, scope: 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: ActionProps,\n interactable: Interactable,\n element: Element,\n eventTarget: Node,\n scope: Scope,\n) {\n if (\n interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)\n ) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n matches: Interactable[],\n matchElements: Element[],\n eventTarget: Node,\n scope: 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) {\n continue\n }\n\n const action = validateAction(matchAction, match, matchElement, eventTarget, 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: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n eventTarget: Node,\n scope: Scope,\n) {\n let matches: Interactable[] = []\n let matchElements: Element[] = []\n\n let element = eventTarget as Element\n\n function pushMatches (interactable: Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(\n interaction,\n pointer,\n event,\n matches,\n matchElements,\n eventTarget,\n scope,\n )\n\n if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = domUtils.parentNode(element) as Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interaction,\n {\n action,\n interactable,\n element,\n }: {\n action: ActionProps\n interactable: Interactable\n element: Element\n },\n scope: Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name ? interactable.getRect(element) : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n scope: 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)) {\n return false\n }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) {\n continue\n }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) {\n continue\n }\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: Scope) {\n if (is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Element, cursor: string, scope: 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: Interaction, scope: 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 = interactable.options[prepared.name].cursorChecker\n\n if (is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n } else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Plugin = {\n id: 'auto-start/base',\n before: ['actions'],\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}\n\nexport default autoStart\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { SignalArgs, Scope } from '@interactjs/core/scope'\nimport type { ActionName, Element } from '@interactjs/core/types'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\n\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: 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 =\n 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 as Interaction).prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Element\n\n const getDraggable = function (interactable: Interactable): Interactable | void {\n if (interactable === interaction.interactable) return\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer,\n interaction.downEvent,\n interaction,\n element,\n )\n\n if (\n action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)\n ) {\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 as Interaction).prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interactable) {\n if (!interactable) {\n return false\n }\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 type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable */\n\ndeclare module '@interactjs/core/options' {\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: Scope) {\n const { defaults } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction: Interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) {\n return null\n }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nconst hold: Plugin = {\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.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n interaction.autoStartHoldTimer = null\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const holdDuration = getHoldDuration(interaction)\n\n if (holdDuration > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\nexport default hold\n","import type { Scope } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './dragAxis'\nimport './hold'\n\nimport autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n/* eslint-enable import/no-duplicates */\n\nexport default {\n id: 'auto-start',\n install (scope: Scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n },\n}\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerEventType } from '@interactjs/core/types'\nimport { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport 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\ntype PreventDefaultValue = 'always' | 'never' | 'auto'\nfunction preventDefault(this: Interactable): PreventDefaultValue\nfunction preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this\nfunction preventDefault (this: Interactable, newValue?: PreventDefaultValue) {\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: Interactable, scope: 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 (scope.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 (\n is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')\n ) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interaction, event: PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: 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 (\n interaction.element &&\n (interaction.element === event.target || nodeContains(interaction.element, event.target))\n ) {\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","export default {}\n","import type { Actions } from '@interactjs/core/types'\n\nexport default function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) {\n return true\n }\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","// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport '@interactjs/dev-tools/visualizer/plugin'\n\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, OptionMethod } from '@interactjs/core/types'\n// eslint-disable-next-line import/no-extraneous-dependencies, import/no-duplicates\nimport visualizer from '@interactjs/dev-tools/visualizer/plugin'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport * as win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n visializer: typeof visualizer\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools: 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: Interaction) => boolean\n getInfo: (interaction: 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\n// eslint-disable-next-line no-undef\nconst isProduction = process.env.NODE_ENV === 'production'\n\nfunction install (scope: Scope, { logger }: { logger?: Logger } = {}) {\n const { Interactable, defaults } = 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 // can't set native events on non string targets without `addEventListener` prop\n const { _onOff } = Interactable.prototype\n Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) {\n if (is.string(this.target) || this.target.addEventListener) {\n return _onOff.call(this, method, typeArg, listenerArg, options, filter)\n }\n\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const normalizedListeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (const type in normalizedListeners) {\n if (isNonNativeEvent(type, scope.actions)) continue\n scope.logger.warn(\n prefix +\n `Can't add native \"${type}\" event listener to target without \\`addEventListener(type, listener, options)\\` prop.`,\n )\n }\n\n return _onOff.call(this, method, normalizedListeners, options)\n }\n scope.usePlugin(visualizer)\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !!element && !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [element, links.touchAction]\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 (\n interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n )\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [element, links.boxSizing]\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 [interaction.prepared.name, interaction.interactable]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n const value = element.style[prop] || win.window.getComputedStyle(element)[prop]\n return styleRe.test((value || '').toString())\n}\n\nfunction parentHasStyle (element: 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: 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 * as arr from './arr'\nimport 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 } else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n } else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n","import type { EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { Modifier, ModifierArg, ModifierState } from './types'\n\nexport interface ModificationResult {\n delta: Point\n rectDelta: Rect\n coords: Point\n rect: FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: EventPhase\n pageCoords: Point\n rect: FullRect\n coords: Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta!: Point\n result!: ModificationResult\n endResult!: Point\n startEdges!: EdgeOptions\n edges: EdgeOptions\n readonly interaction: Readonly\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n this.result = createResult()\n this.edges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n }\n\n start ({ phase }: { phase: EventPhase }, pageCoords: Point) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.startEdges = extend({}, interaction.edges)\n this.edges = extend({}, this.startEdges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg = this.fillArg({\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 ||= interaction.rect\n arg.edges ||= this.startEdges\n arg.startOffset = this.startOffset\n\n return arg as ModifierArg\n }\n\n startAll (arg: MethodArg & Partial) {\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 const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n arg.edges = extend({}, unmodifiedEdges)\n\n const states = skipModifiers ? this.states.slice(skipModifiers) : 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(arg.edges, arg.rect, {\n x: arg.coords.x - lastModifierCoords.x,\n y: arg.coords.y - lastModifierCoords.y,\n })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n extend(this.edges, arg.edges)\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\n if (prevCoords && prevRect) {\n const rectChanged =\n 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 =\n rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y\n }\n\n return newResult\n }\n\n applyToInteraction (arg: { phase: EventPhase, rect?: 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 [\n [startCoords, startDelta],\n [curCoords, curDelta],\n ] 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 (\n arg: Partial & {\n phase: EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Point\n },\n ): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll(\n this.fillArg({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n }),\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 (\n !result.changed &&\n (!skipModifiers || skipModifiers < this.states.length) &&\n interaction.interacting()\n ) {\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, arg.phase, 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: Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend(\n {\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n },\n arg,\n )\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) {\n state.methods.stop(modifierArg as ModifierArg)\n }\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 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: 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, requireEndOnly?: boolean) {\n if (\n // ignore disabled modifiers\n !options ||\n options.enabled === false ||\n // check if we require endOnly option to fire move before end\n (requireEndOnly && !options.endOnly) ||\n // don't apply endOnly modifiers when not ending\n (options.endOnly && !preEnd) ||\n // check if modifier should run be applied on start\n (phase === 'start' && !options.setStart)\n ) {\n return false\n }\n\n return true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.startEdges = other.startEdges\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?: Point, rect?: 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\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map((type) => {\n const options = actionOptions[type]\n\n return (\n options &&\n options.enabled && {\n options,\n methods: options._methods,\n }\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 type { InteractEvent } from '@interactjs/core/InteractEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\n\nimport Modification from './Modification'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\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}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n Result,\n> (module: ModifierModule, name?: Name) {\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 = (_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 as any)[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = {\n options,\n methods,\n name,\n enable: () => {\n options.enabled = true\n return m\n },\n disable: () => {\n options.enabled = false\n return m\n },\n }\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 ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\n const result = interaction.modification!.result\n\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Plugin = {\n id: 'modifiers/base',\n before: ['actions'],\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 { interaction } = arg\n const modification = arg.interaction.modification!\n\n modification.start(arg, interaction.coords.start.page)\n interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.setAndApply(arg)\n interaction.edges = modification.edges\n\n return ret\n },\n\n 'interactions:before-action-end': (arg) => {\n const { interaction } = arg\n const { modification } = interaction\n const ret = modification.beforeEnd(arg)\n interaction.edges = modification.startEdges\n\n return ret\n },\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}\n\nexport default modifiersBase\n","import type { Point, Listeners, OrBoolean, Element, Rect } from '@interactjs/core/types'\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\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Node\n getRect?: (element: Element) => Rect\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Point | string | Element\n listeners?: Listeners\n allowFrom?: string | Element\n ignoreFrom?: string | Element\n}\n\nexport type Options = Partial &\nPartial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\nexport interface OptionsArg extends BaseDefaults, 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","import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\n\nimport { BaseEvent } from './BaseEvent'\nimport type { Interaction } from './Interaction'\nimport { defaults } from './options'\nimport type { ActionName } from './types'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface InteractEvent {\n pageX: number\n pageY: number\n\n clientX: number\n clientY: number\n\n dx: number\n dy: number\n\n velocityX: number\n velocityY: number\n}\n\nexport class InteractEvent<\n T extends ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n declare target: Element\n declare currentTarget: Element\n relatedTarget: Element | 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: Point\n client: Point\n delta: Point\n rect: FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Point\n speed: number\n swipe: ReturnType['getSwipe']>\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: PointerEventType,\n actionName: T,\n phase: P,\n element: 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 ? interaction.pointers[interaction.pointers.length - 1].downTime : 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 } 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 getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 || 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\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperties(InteractEvent.prototype, {\n pageX: {\n get () {\n return this.page.x\n },\n set (value) {\n this.page.x = value\n },\n },\n pageY: {\n get () {\n return this.page.y\n },\n set (value) {\n this.page.y = value\n },\n },\n\n clientX: {\n get () {\n return this.client.x\n },\n set (value) {\n this.client.x = value\n },\n },\n clientY: {\n get () {\n return this.client.y\n },\n set (value) {\n this.client.y = value\n },\n },\n\n dx: {\n get () {\n return this.delta.x\n },\n set (value) {\n this.delta.x = value\n },\n },\n dy: {\n get () {\n return this.delta.y\n },\n set (value) {\n this.delta.y = value\n },\n },\n\n velocityX: {\n get () {\n return this.velocity.x\n },\n set (value) {\n this.velocity.x = value\n },\n },\n velocityY: {\n get () {\n return this.velocity.y\n },\n set (value) {\n this.velocity.y = value\n },\n },\n})\n","import type { PointerEventType, PointerType } from '@interactjs/core/types'\n\nexport class PointerInfo {\n id: number\n pointer: PointerType\n event: PointerEventType\n downTime: number\n downTarget: Node\n\n constructor (id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node) {\n this.id = id\n this.pointer = pointer\n this.event = event\n this.downTime = downTime\n this.downTarget = downTarget\n }\n}\n","import type {\n Element,\n EdgeOptions,\n PointerEventType,\n PointerType,\n FullRect,\n CoordsSet,\n} from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport hypot from '@interactjs/utils/hypot'\nimport { warnOnce, copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { EventPhase } from './InteractEvent'\nimport { InteractEvent } from './InteractEvent'\nimport type { Interactable } from './Interactable'\nimport { PointerInfo } from './PointerInfo'\nimport type { ActionDefaults } from './options'\nimport type { Scope } from './scope'\nimport type { ActionName, ActionProps } from './types'\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: PointerType\n event: PointerEventType\n eventTarget: Node\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: 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': { interaction: Interaction, event: Event, type: '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 = null\n\n // the target element of the interactable\n element: Element | null = null\n rect: FullRect | null = null\n _rects?: {\n start: FullRect\n corrected: FullRect\n previous: FullRect\n delta: FullRect\n }\n edges: EdgeOptions | null = null\n\n _scopeFire: 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: PointerEventType | null = null\n\n downPointer: PointerType = {} as PointerType\n\n _latestPointer: {\n pointer: PointerType\n event: 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\n\n simulation = null\n\n /** @internal */ get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = warnOnce(function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n }, 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: pointerUtils.newCoords(),\n // Previous native pointer move event coordinates\n prev: pointerUtils.newCoords(),\n // current native pointer move event coordinates\n cur: pointerUtils.newCoords(),\n // Change in coordinates and time of the pointer\n delta: pointerUtils.newCoords(),\n // pointer velocity\n velocity: pointerUtils.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: { pointerType?: string, scopeFire: Scope['fire'] }) {\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 () {\n return that[key]\n },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args: any[]) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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 as unknown as Interaction,\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 {Boolean} Whether the interaction was successfully started\n */\n start (action: ActionProps, interactable: Interactable, element: Element): boolean {\n if (\n this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name as keyof ActionDefaults].enabled\n ) {\n return false\n }\n\n 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 ? extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting =\n 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: PointerType, event: PointerEventType, eventTarget: Node) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove =\n 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: number\n let dy: number\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 = 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 as unknown as Interaction,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n pointerUtils.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 pointerUtils.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?: any) {\n if (!signalArg || !signalArg.event) {\n pointerUtils.setZeroCoords(this.coords.delta)\n }\n\n signalArg = extend(\n {\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n },\n signalArg || {},\n )\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: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: 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 as unknown as Interaction,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.removePointer(pointer, event)\n }\n\n documentBlur (event: Event) {\n this.end(event as any)\n this._scopeFire('interactions:blur', {\n event,\n type: 'blur',\n interaction: this as unknown as Interaction,\n })\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?: PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult: boolean\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: any) {\n const pointerId = pointerUtils.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 : arr.findIndex(this.pointers, (curPointer) => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer: any) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {\n const id = pointerUtils.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false ? false : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(id, pointer, event, null, null)\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n } else {\n pointerInfo.pointer = pointer\n }\n\n pointerUtils.setCoords(\n this.coords.cur,\n this.pointers.map((p) => p.pointer),\n this._now(),\n )\n pointerUtils.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 pointerUtils.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n pointerUtils.copyCoords(this.coords.start, this.coords.cur)\n pointerUtils.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 as unknown as Interaction,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: PointerType, event: 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 as unknown as Interaction,\n })\n\n this.pointers.splice(pointerIndex, 1)\n this.pointerIsDown = false\n }\n\n _updateLatestPointer (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\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

(\n event: PointerEventType,\n phase: P,\n preEnd?: boolean,\n type?: string,\n ) {\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

(\n signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent },\n ) {\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 rectUtils.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') {\n this.prevEvent = iEvent\n }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () {\n return Date.now()\n }\n}\n\nexport default Interaction\nexport { PointerInfo }\n","import type Interaction from '@interactjs/core/Interaction'\nimport { _ProxyMethods } from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\nimport type { Point } from '@interactjs/core/types'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Point\n pending: Point\n }\n }\n\n enum _ProxyMethods {\n offsetBy = '',\n }\n}\n\n;(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interaction) {\n if (!interaction.pointerIsDown) {\n return\n }\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: Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: 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: 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: 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: Interaction, { x, y }: 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 }: Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction: Interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Plugin = {\n id: 'offset',\n before: ['modifiers', 'pointer-events', 'actions', 'inertia'],\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 type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Point, PointerEventType } from '@interactjs/core/types'\nimport Modification from '@interactjs/modifiers/Modification'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/modifiers/base'\nimport '@interactjs/offset/plugin'\nimport * as modifiers from '@interactjs/modifiers/base'\nimport type { ModifierArg } from '@interactjs/modifiers/types'\nimport offset from '@interactjs/offset/plugin'\n/* eslint-enable import/no-duplicates */\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\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/options' {\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': DoPhaseArg\n 'interactions:after-action-inertiastart': DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': DoPhaseArg\n 'interactions:after-action-resume': DoPhaseArg\n }\n}\n\nfunction install (scope: Scope) {\n const { defaults } = 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\n modifierCount = 0\n modifierArg!: ModifierArg\n\n startCoords!: Point\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset!: Point\n modifiedOffset!: Point\n currentOffset!: Point\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout!: number\n readonly interaction: Interaction\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n }\n\n start (event: 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 = modification.fillArg({\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 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.onNextFrame(() => 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.onNextFrame(() => this.smoothEndTick())\n }\n\n onNextFrame (tickFn: () => void) {\n this.timeout = raf.request(() => {\n if (this.active) {\n tickFn()\n }\n })\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: Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0,\n 0,\n this.targetOffset.x,\n this.targetOffset.y,\n this.modifiedOffset.x,\n this.modifiedOffset.y,\n progress,\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.onNextFrame(() => this.inertiaTick())\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.onNextFrame(() => this.smoothEndTick())\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 }: 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 }: 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: 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: Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interaction) {\n return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia\n}\n\nconst inertia: Plugin = {\n id: 'inertia',\n before: ['modifiers', 'actions'],\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) =>\n 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,\n startY: number,\n cpX: number,\n cpY: number,\n endX: number,\n endY: number,\n position: number,\n) {\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","import type { Listener, ListenersArg, Rect } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport type { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\nimport normalize from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped (event: any, listeners: Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) {\n break\n }\n\n listener(event)\n }\n}\n\nexport class 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: T) {\n let listeners: Listener[]\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: 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: 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) {\n continue\n }\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: Element): Rect {\n return null\n }\n}\n","/** @module interact */\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Context, EventTypes, Listener, ListenersArg, Target } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport { warnOnce } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { Interactable } from './Interactable'\nimport type { Options } from './options'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n (target: Target, options?: Options): Interactable\n getPointerAverage: typeof pointerUtils.pointerAverage\n getTouchBBox: typeof pointerUtils.touchBBox\n getTouchDistance: typeof pointerUtils.touchDistance\n getTouchAngle: typeof pointerUtils.touchAngle\n getElementRect: typeof domUtils.getElementRect\n getElementClientRect: typeof domUtils.getElementClientRect\n matchesSelector: typeof domUtils.matchesSelector\n closest: typeof domUtils.closest\n /** @internal */ globalEvents: any\n version: string\n /** @internal */ scope: Scope\n use(\n plugin: Plugin,\n options?: {\n [key: string]: any\n },\n ): any\n isSet(target: Target, options?: any): boolean\n on(type: string | EventTypes, listener: ListenersArg, options?: object): any\n off(type: EventTypes, listener: any, options?: object): any\n debug(): any\n supportsTouch(): boolean\n supportsPointerEvent(): boolean\n stop(): any\n pointerMoveTolerance(newValue?: number): any\n addDocument(doc: Document, options?: object): void\n removeDocument(doc: Document): void\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic\n\nexport function createInteractStatic (scope: Scope): _InteractStatic {\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 */\n const interact = ((target: Target, options: Options) => {\n let interactable = scope.interactables.getExisting(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = interact.globalEvents\n }\n\n return interactable\n }) as _InteractStatic\n\n // expose the functions used to calculate multi-touch properties\n interact.getPointerAverage = pointerUtils.pointerAverage\n interact.getTouchBBox = pointerUtils.touchBBox\n interact.getTouchDistance = pointerUtils.touchDistance\n interact.getTouchAngle = pointerUtils.touchAngle\n\n interact.getElementRect = domUtils.getElementRect\n interact.getElementClientRect = domUtils.getElementClientRect\n interact.matchesSelector = domUtils.matchesSelector\n interact.closest = domUtils.closest\n\n interact.globalEvents = {} as any\n\n // eslint-disable-next-line no-undef\n interact.version = process.env.npm_package_version\n interact.scope = scope\n /**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n */\n interact.use = function (plugin, options) {\n this.scope.usePlugin(plugin, options)\n\n return this\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 {Target} target The Element or string being searched for\n * @param {object} options\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\n interact.isSet = function (target: Target, options?: { context?: Context }): boolean {\n return !!this.scope.interactables.get(target, options && options.context)\n }\n\n /**\n * @deprecated\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 */\n interact.on = warnOnce(function on (type: string | EventTypes, listener: ListenersArg, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type as any[]) {\n this.on(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.on(prop, (type as any)[prop], listener)\n }\n\n return this\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, this.scope.actions)) {\n // if this type of event was never bound\n if (!this.globalEvents[type]) {\n this.globalEvents[type] = [listener]\n } else {\n this.globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n this.scope.events.add(this.scope.document, type, listener as Listener, { options })\n }\n\n return this\n }, 'The interact.on() method is being deprecated')\n\n /**\n * @deprecated\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 */\n interact.off = warnOnce(function off (type: EventTypes, listener: any, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type) {\n this.off(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.off(prop, type[prop], listener)\n }\n\n return this\n }\n\n if (isNonNativeEvent(type, this.scope.actions)) {\n let index: number\n\n if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {\n this.globalEvents[type].splice(index, 1)\n }\n } else {\n this.scope.events.remove(this.scope.document, type, listener, options)\n }\n\n return this\n }, 'The interact.off() method is being deprecated')\n\n interact.debug = function () {\n return this.scope\n }\n\n /**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\n interact.supportsTouch = function () {\n return browser.supportsTouch\n }\n\n /**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\n interact.supportsPointerEvent = function () {\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 */\n interact.stop = function () {\n for (const interaction of this.scope.interactions.list) {\n interaction.stop()\n }\n\n return this\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 */\n interact.pointerMoveTolerance = function (newValue?: number) {\n if (is.number(newValue)) {\n this.scope.interactions.pointerMoveTolerance = newValue\n\n return this\n }\n\n return this.scope.interactions.pointerMoveTolerance\n }\n\n interact.addDocument = function (doc: Document, options?: object) {\n this.scope.addDocument(doc, options)\n }\n\n interact.removeDocument = function (doc: Document) {\n this.scope.removeDocument(doc)\n }\n\n return interact\n}\n","/* eslint-disable no-dupe-class-members */\nimport type { Scope } from '@interactjs/core/scope'\nimport type {\n ActionMap,\n ActionMethod,\n ActionName,\n Actions,\n Context,\n Element,\n EventTypes,\n Listeners,\n ListenersArg,\n OrBoolean,\n Target,\n} from '@interactjs/core/types'\nimport * 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 extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport isNonNativeEvent from '@interactjs/utils/isNonNativeEvent'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'\n\ntype IgnoreValue = string | Element | boolean\ntype DeltaSource = 'page' | 'client'\n\nconst enum OnOffMethod {\n On,\n Off,\n}\n\n/** */\nexport class Interactable implements Partial {\n /** @internal */ 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: Target\n readonly events = new Eventable()\n readonly _context: Context\n readonly _win: Window\n readonly _doc: Document\n readonly _scopeEvents: Scope['events']\n\n /** */\n constructor (\n target: Target,\n options: any,\n defaultContext: Document | Element,\n scopeEvents: Scope['events'],\n ) {\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 this._scopeEvents = scopeEvents\n\n this.set(options)\n }\n\n setOnEvents (actionName: ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) {\n this.on(`${actionName}start`, phases.onstart)\n }\n if (is.func(phases.onmove)) {\n this.on(`${actionName}move`, phases.onmove)\n }\n if (is.func(phases.onend)) {\n this.on(`${actionName}end`, phases.onend)\n }\n if (is.func(phases.oninertiastart)) {\n this.on(`${actionName}inertiastart`, phases.oninertiastart)\n }\n\n return this\n }\n\n updatePerActionListeners (actionName: ActionName, prev: Listeners | undefined, cur: Listeners | undefined) {\n const actionFilter = (this._actions.map[actionName] as { filterEventType?: (type: string) => boolean })\n ?.filterEventType\n const filter = (type: string) =>\n (actionFilter == null || actionFilter(type)) && isNonNativeEvent(type, this._actions)\n\n if (is.array(prev) || is.object(prev)) {\n this._onOff(OnOffMethod.Off, actionName, prev, undefined, filter)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this._onOff(OnOffMethod.On, actionName, cur, undefined, filter)\n }\n }\n\n setPerAction (actionName: ActionName, options: 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 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 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\n // set anabled field to true if it exists in the defaults\n if (\n is.object(defaults.perAction[optionName]) &&\n 'enabled' in (defaults.perAction[optionName] as any)\n ) {\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 {Rect} The object's bounding rectangle.\n */\n getRect (element: Element) {\n element = element || (is.element(this.target) ? this.target : 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(): (element: Element) => any | null\n rectChecker(checker: (element: Element) => any): this\n rectChecker (checker?: (element: Element) => any) {\n if (is.func(checker)) {\n this.getRect = (element) => {\n const rect = extend({}, checker.apply(this, element))\n\n if (!(('width' in rect) as unknown)) {\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n return rect\n }\n\n return this\n }\n\n if (checker === null) {\n delete (this as Partial).getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof 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 as keyof ActionMap] as any)[optionName] = 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(): DeltaSource\n deltaSource(newValue: DeltaSource): this\n deltaSource (newValue?: DeltaSource) {\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 /** @internal */\n getAllElements (): Element[] {\n const { target } = this\n\n if (is.string(target)) {\n return Array.from(this._context.querySelectorAll(target))\n }\n\n if (is.func(target) && (target as any).getAllElements) {\n return (target as any).getAllElements()\n }\n\n return is.element(target) ? [target] : []\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 || nodeContains(this._context, element)\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Node,\n ) {\n return (\n !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget)\n )\n }\n\n testAllow (this: Interactable, allowFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!allowFrom) {\n return true\n }\n\n if (!is.element(element)) {\n return false\n }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n } else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (this: Interactable, ignoreFrom: IgnoreValue | undefined, targetNode: Node, element: Node) {\n if (!ignoreFrom || !is.element(element)) {\n return false\n }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\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: E) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (\n method: OnOffMethod,\n typeArg: EventTypes,\n listenerArg?: ListenersArg | null,\n options?: any,\n filter?: (type: string) => boolean,\n ) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const listeners = normalizeListeners(typeArg, listenerArg, filter)\n\n for (let type in listeners) {\n if (type === 'wheel') {\n type = browser.wheelEvent\n }\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 === OnOffMethod.On ? 'on' : 'off'](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n this._scopeEvents[method === OnOffMethod.On ? 'addDelegate' : 'removeDelegate'](\n this.target,\n this._context,\n type,\n listener,\n options,\n )\n }\n // remove listener from this Interactable's element\n else {\n this._scopeEvents[method === OnOffMethod.On ? 'add' : 'remove'](\n this.target,\n type,\n listener,\n options,\n )\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: EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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[] | EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff(OnOffMethod.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: 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 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 ;(this[methodName] as ActionMethod)(options[actionName])\n }\n\n for (const setting in options) {\n if (setting === 'getRect') {\n this.rectChecker(options.getRect)\n continue\n }\n\n if (is.func((this as any)[setting])) {\n ;(this as any)[setting](options[setting as keyof typeof options])\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 unset () {\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in this._scopeEvents.delegatedEvents) {\n const delegated = this._scopeEvents.delegatedEvents[type]\n\n for (let i = delegated.length - 1; i >= 0; i--) {\n const { selector, context, listeners } = delegated[i]\n\n if (selector === this.target && context === this._context) {\n delegated.splice(i, 1)\n }\n\n for (let l = listeners.length - 1; l >= 0; l--) {\n this._scopeEvents.removeDelegate(\n this.target,\n this._context,\n type,\n listeners[l][0],\n listeners[l][1],\n )\n }\n }\n }\n } else {\n this._scopeEvents.remove(this.target, 'all')\n }\n }\n}\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type { OptionsArg, Options } from '@interactjs/core/options'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { Target } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interactable\n target: Target\n options: OptionsArg\n win: Window\n }\n }\n}\n\nexport class InteractableSet {\n // all set interactables\n list: Interactable[] = []\n\n selectorMap: {\n [selector: string]: Interactable[]\n } = {}\n\n scope: Scope\n\n constructor (scope: Scope) {\n this.scope = scope\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target } = interactable\n const interactablesOnTarget: Interactable[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = arr.findIndex(interactablesOnTarget, (i) => i === interactable)\n interactablesOnTarget.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Target, options?: any): Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) {\n this.selectorMap[target] = []\n }\n this.selectorMap[target].push(interactable)\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(interactable)\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 getExisting (target: Target, options?: Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const interactablesOnTarget: Interactable[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!interactablesOnTarget) return undefined\n\n return arr.find(\n interactablesOnTarget,\n (interactable) =>\n interactable._context === context && (isSelector || interactable.inContext(target as any)),\n )\n }\n\n forEachMatch (node: Node, callback: (interactable: Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret: T\n\n if (\n (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 ) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n","import type { Scope } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport pExtend from '@interactjs/utils/pointerExtend'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { NativeEventTarget } from './NativeTypes'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n events: ReturnType\n }\n}\n\ninterface EventOptions {\n capture: boolean\n passive: boolean\n}\n\ntype PartialEventTarget = Partial\n\ntype ListenerEntry = { func: (event: Event | FakeEvent) => any, options: EventOptions }\n\nfunction install (scope: Scope) {\n const targets: Array<{\n eventTarget: PartialEventTarget\n events: { [type: string]: ListenerEntry[] }\n }> = []\n\n const delegatedEvents: {\n [type: string]: Array<{\n selector: string\n context: Node\n listeners: ListenerEntry[]\n }>\n } = {}\n const documents: Document[] = []\n\n const eventsMethods = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n targets,\n\n supportsOptions: false,\n supportsPassive: false,\n }\n\n // check if browser supports passive events and options arg\n scope.document?.createElement('div').addEventListener('test', null, {\n get capture () {\n return (eventsMethods.supportsOptions = true)\n },\n get passive () {\n return (eventsMethods.supportsPassive = true)\n },\n })\n\n scope.events = eventsMethods\n\n function add (\n eventTarget: PartialEventTarget,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener) return\n\n const options = getOptions(optionalArg)\n let target = arr.find(targets, (t) => t.eventTarget === eventTarget)\n\n if (!target) {\n target = {\n eventTarget,\n events: {},\n }\n\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n }\n\n if (!arr.find(target.events[type], (l) => l.func === listener && optionsMatch(l.options, options))) {\n eventTarget.addEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n target.events[type].push({ func: listener, options })\n }\n }\n\n function remove (\n eventTarget: PartialEventTarget,\n type: string,\n listener?: 'all' | ListenerEntry['func'],\n optionalArg?: boolean | EventOptions,\n ) {\n if (!eventTarget.addEventListener || !eventTarget.removeEventListener) return\n\n const targetIndex = arr.findIndex(targets, (t) => t.eventTarget === eventTarget)\n const target = targets[targetIndex]\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(eventTarget, type, 'all')\n }\n }\n return\n }\n\n let typeIsEmpty = false\n const typeListeners = target.events[type]\n\n if (typeListeners) {\n if (listener === 'all') {\n for (let i = typeListeners.length - 1; i >= 0; i--) {\n const entry = typeListeners[i]\n remove(eventTarget, type, entry.func, entry.options)\n }\n return\n } else {\n const options = getOptions(optionalArg)\n\n for (let i = 0; i < typeListeners.length; i++) {\n const entry = typeListeners[i]\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n eventTarget.removeEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n typeListeners.splice(i, 1)\n\n if (typeListeners.length === 0) {\n delete target.events[type]\n typeIsEmpty = true\n }\n\n break\n }\n }\n }\n }\n\n if (typeIsEmpty && !Object.keys(target.events).length) {\n targets.splice(targetIndex, 1)\n }\n }\n\n function addDelegate (\n selector: string,\n context: Node,\n type: string,\n listener: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = []\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 delegates = delegatedEvents[type]\n let delegate = arr.find(delegates, (d) => d.selector === selector && d.context === context)\n\n if (!delegate) {\n delegate = { selector, context, listeners: [] }\n delegates.push(delegate)\n }\n\n delegate.listeners.push({ func: listener, options })\n }\n\n function removeDelegate (\n selector: string,\n context: Document | Element,\n type: string,\n listener?: ListenerEntry['func'],\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n const delegates = delegatedEvents[type]\n let matchFound = false\n let index: number\n\n if (!delegates) return\n\n // count from last index of delegated to 0\n for (index = delegates.length - 1; index >= 0; index--) {\n const cur = delegates[index]\n // look for matching selector and context Node\n if (cur.selector === selector && cur.context === context) {\n const { listeners } = cur\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 entry = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (entry.func === listener && optionsMatch(entry.options, options)) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this target have been removed\n // remove the target from the delegates array\n if (!listeners.length) {\n delegates.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) {\n break\n }\n }\n }\n }\n\n // bound to the interactable context when a DOM event\n // listener is added to a selector interactable\n function delegateListener (event: Event | FakeEvent, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event as Event)\n const delegates = delegatedEvents[event.type]\n const [eventTarget] = pointerUtils.getEventTargets(event as 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 < delegates.length; i++) {\n const cur = delegates[i]\n const { selector, context } = cur\n\n if (\n domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)\n ) {\n const { listeners } = cur\n\n fakeEvent.currentTarget = element\n\n for (const entry of listeners) {\n if (optionsMatch(entry.options, options)) {\n entry.func(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n }\n\n function delegateUseCapture (this: Element, event: Event | FakeEvent) {\n return delegateListener.call(this, event, true)\n }\n\n // for type inferrence\n return eventsMethods\n}\n\nclass FakeEvent implements Partial {\n currentTarget: Node\n originalEvent: Event\n type: string\n\n constructor (originalEvent: Event) {\n this.originalEvent = originalEvent\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\nfunction getOptions (param: { [index: string]: any } | boolean): { capture: boolean, passive: boolean } {\n if (!is.object(param)) {\n return { capture: !!param, passive: false }\n }\n\n return {\n capture: !!param.capture,\n passive: !!param.passive,\n }\n}\n\nfunction optionsMatch (a: Partial | boolean, b: Partial) {\n if (a === b) return true\n\n if (typeof a === 'boolean') return !!b.capture === a && !!b.passive === false\n\n return !!a.capture === !!b.capture && !!a.passive === !!b.passive\n}\n\nexport default {\n id: 'events',\n install,\n}\n","import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerType } from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: EventTarget\n curEventTarget: EventTarget\n scope: 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 (\n interaction.simulation &&\n interaction.simulation.allowResume &&\n interaction.pointerType === pointerType\n ) {\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)) {\n continue\n }\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: Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n","import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Listener } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport InteractionBase from './Interaction'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './interactablePreventDefault'\nimport interactablePreventDefault from './interactablePreventDefault'\n/* eslint-enable import/no-duplicates */\nimport type { SearchDetails } from './interactionFinder'\nimport finder from './interactionFinder'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: Array>\n listeners: { [type: string]: Listener }\n docEvents: Array<{ type: string, listener: Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown',\n 'pointerMove',\n 'pointerUp',\n 'updatePointer',\n 'removePointer',\n '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 } 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 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 () {\n return scope.now()\n }\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 || interaction.pointerType !== 'touch' || 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 scope.usePlugin(interactablePreventDefault)\n}\n\nfunction doOnInteractions (method: string, scope: Scope) {\n return function (event: Event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches: any[] = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n // @ts-expect-error\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 } 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 =\n 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 as PointerEvent,\n pointerId: pointerUtils.getPointerId(event as PointerEvent),\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 (\n { doc, scope, options }: SignalArgs[T],\n eventMethodName: 'add' | 'remove',\n) {\n const {\n interactions: { docEvents },\n events,\n } = scope\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\nconst interactions: Plugin = {\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 'interactable:unset': ({ interactable }, scope) => {\n // Stop and destroy related interactions when an Interactable is 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 !== interactable) {\n continue\n }\n\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 onDocSignal,\n doOnInteractions,\n methodNames,\n}\n\nexport default interactions\n","import type Interaction from '@interactjs/core/Interaction'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport domObjects from '@interactjs/utils/domObjects'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport * as win from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport { InteractEvent } from './InteractEvent'\nimport { createInteractStatic } from './InteractStatic'\nimport { Interactable as InteractableBase } from './Interactable'\nimport { InteractableSet } from './InteractableSet'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './events'\nimport './interactions'\nimport events from './events'\nimport interactions from './interactions'\n/* eslint-enable import/no-duplicates */\nimport type { OptionsArg } from './options'\nimport { defaults } from './options'\nimport type { Actions } from './types'\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: OptionsArg }\n 'interactions:destroy': { interaction: 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: Record\n}\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 isInitialized = false\n listenerMaps: Array<{\n map: ListenerMap\n id?: string\n }> = []\n\n browser = browser\n defaults = clone(defaults) as typeof defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {} as any,\n phaselessTypes: {},\n }\n\n interactStatic = createInteractStatic(this)\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\n\n this.Interactable = class extends InteractableBase {\n get _defaults () {\n return scope.defaults\n }\n\n set (this: T, options: OptionsArg) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset (this: InteractableBase) {\n super.unset()\n\n const index = scope.interactables.list.indexOf(this)\n if (index < 0) return\n\n scope.interactables.list.splice(index, 1)\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 {\n map: { [name]: listener },\n } 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 | typeof globalThis) {\n return this.isInitialized ? this : initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n const { id } = plugin\n return id ? !!this._plugins.map[id] : this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (!this.isInitialized) {\n return this\n }\n\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) {\n this._plugins.map[plugin.id] = plugin\n }\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 acc[pluginIdRoot(id)] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (otherId && (before[otherId] || before[pluginIdRoot(otherId)])) {\n break\n }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\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) {\n return false\n }\n\n const window = win.getWindow(doc)\n\n options = options ? extend({}, options) : {}\n\n this.documents.push({ doc, options })\n this.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 this.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 this.events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n this.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 initScope (scope: Scope, window: Window | typeof globalThis) {\n scope.isInitialized = true\n\n if (is.window(window)) {\n win.init(window)\n }\n\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n\n // @ts-expect-error\n scope.window = window\n scope.document = window.document\n\n scope.usePlugin(interactions)\n scope.usePlugin(events)\n\n return scope\n}\n\nfunction pluginIdRoot (id: string) {\n return id && id.replace(/\\/.*$/, '')\n}\n","import { Scope } from '@interactjs/core/scope'\n\nconst scope = new Scope()\n\nconst interact = scope.interactStatic\n\nexport default interact\n\nconst _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this\nscope.init(_global)\n","export default () => {}\n","export default () => {}\n","import type { Rect, Point } from '@interactjs/core/types'\nimport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type GridOptions = (Partial | Point) & {\n range?: number\n limits?: Rect\n offset?: Point\n}\n\nexport default (grid: GridOptions) => {\n const coordFields = (\n [\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const\n ).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: 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: 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","import type { Plugin } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\nimport * as allSnappers from './all'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n snappers: typeof allSnappers\n createSnapGrid: typeof allSnappers.grid\n }\n}\n\nconst snappersPlugin: Plugin = {\n id: 'snappers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n interact.snappers = extend(interact.snappers || {}, allSnappers)\n interact.createSnapGrid = interact.snappers.grid\n },\n}\n\nexport default snappersPlugin\n","/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */\n\nimport type { Point, Rect, EdgeOptions } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\n\nimport Modification from './Modification'\nimport { makeModifier } from './base'\nimport type { Modifier, ModifierModule, ModifierState } from './types'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState<\nAspectRatioOptions,\n{\n startCoords: Point\n startRect: Rect\n linkedEdges: EdgeOptions\n ratio: number\n equalDelta: boolean\n xIsPrimaryAxis: boolean\n edgeSign: {\n x: number\n y: number\n }\n subModification: Modification\n}\n>\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges, pageCoords: coords } = arg\n let { ratio, enabled } = 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: edges.top || (edges.left && !edges.bottom),\n left: edges.left || (edges.top && !edges.right),\n bottom: edges.bottom || (edges.right && !edges.top),\n right: edges.right || (edges.bottom && !edges.left),\n })\n\n state.xIsPrimaryAxis = !!(edges.left || edges.right)\n\n if (state.equalDelta) {\n const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)\n state.edgeSign = {\n x: sign,\n y: sign,\n }\n } else {\n state.edgeSign = {\n x: linkedEdges.left ? -1 : 1,\n y: linkedEdges.top ? -1 : 1,\n }\n }\n\n if (enabled !== false) {\n extend(edges, linkedEdges)\n }\n\n if (!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 { linkedEdges } = state\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n extend(arg.edges, linkedEdges)\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) {\n return null\n }\n\n const correctedRect = extend({}, rect)\n\n addEdges(linkedEdges, correctedRect, {\n x: coords.x - initialCoords.x,\n y: coords.y - initialCoords.y,\n })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: 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: Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y\n } else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x\n }\n}\n\nfunction setRatio (\n { startRect, startCoords, ratio, edgeSign }: AspectRatioState,\n xIsPrimaryAxis: boolean,\n coords: Point,\n rect: Rect,\n) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y\n } else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x\n }\n}\n\nexport default makeModifier(aspectRatio, 'aspectRatio')\nexport { aspectRatio }\n","import type { ModifierFunction } from './types'\n\nconst noop = (() => {}) as unknown as ModifierFunction\n\nnoop._defaults = {}\n\nexport default noop\n","import type Interaction from '@interactjs/core/Interaction'\nimport type { RectResolvable, Rect, Point } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule, ModifierState } from '../types'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: RectResolvable<[number, number, Interaction]>\n // what part of self is allowed to drag over\n elementRect: Rect\n offset: Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState<\nRestrictOptions,\n{\n offset: Rect\n}\n>\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Rect = extend(\n {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n options.offset || {},\n )\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: RectResolvable<[number, number, Interaction]>,\n interaction: Interaction,\n coords?: Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [\n coords.x,\n coords.y,\n interaction,\n ])\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 makeModifier(restrict, 'restrict')\nexport { 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 type { Point, Rect } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } 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<\nRestrictEdgesOptions,\n{\n inner: Rect\n outer: Rect\n offset: RestrictEdgesOptions['offset']\n}\n>\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: Point\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 Rect)\n const outer = getRestrictionRect(options.outer, interaction, page) || ({} as 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 } 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 } 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: Rect, defaults: Rect) {\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 makeModifier(restrictEdges, 'restrictEdges')\nexport { restrictEdges }\n","import extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\n\nimport { restrict } from './pointer'\n\nconst defaults = extend(\n {\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n },\n restrict.defaults,\n)\n\nconst restrictRect = {\n start: restrict.start,\n set: restrict.set,\n defaults,\n}\n\nexport default makeModifier(restrictRect, 'restrictRect')\nexport { restrictRect }\n","import type { Point, Rect, Size } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nimport type { RestrictEdgesState } from './edges'\nimport { restrictEdges } from './edges'\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Size | Point | RestrictOptions['restriction']\n max?: Size | 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 = RestrictEdgesState &\nModifierState<\nRestrictSizeOptions & { inner: Rect, outer: Rect },\n{\n min: Rect\n max: Rect\n}\n>\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 =\n rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize =\n 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 } 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 } 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 makeModifier(restrictSize, 'restrictSize')\nexport { restrictSize }\n","import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName, Point, RectResolvable, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { resolveRectLike, rectToXY } from '@interactjs/utils/rect'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierState } from '../types'\n\nexport interface Offset {\n x: number\n y: number\n index: number\n relativePoint?: Point | null\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: InteractionProxy,\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?: Point[]\n // startCoords = offset snapping from drag start page position\n offset?: Point | RectResolvable<[Interaction]> | 'startCoords'\n offsetWithOrigin?: boolean\n origin?: RectResolvable<[Element]> | Point\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState<\nSnapOptions,\n{\n offsets?: Offset[]\n closest?: any\n targetFields?: string[][]\n}\n>\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }\n\n let snapOffset: 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 } else {\n const offsetRect = resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = 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 =\n 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 : [\n {\n index: 0,\n relativePoint: null,\n x: snapOffset.x,\n y: snapOffset.y,\n },\n ]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = getOriginXY(interaction.interactable!, interaction.element!, interaction.prepared.name)\n const page = extend({}, coords)\n const targets: SnapPosition[] = []\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: SnapPosition\n\n if (is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction._proxy, offset, index)\n } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\n\n targets.push({\n x: (is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: 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 = 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 (\n !closest.target ||\n (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 ) {\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 = rectToXY(resolveRectLike(arg.state.options.origin as any, null, null, [element]))\n const origin = optionsOrigin || getOriginXY(arg.interactable, element, arg.interaction.prepared.name)\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 makeModifier(snap, 'snap')\nexport { snap }\n","// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg } from '../types'\n\nimport type { SnapOptions, SnapState } from './pointer'\nimport { snap } from './pointer'\n\nexport type SnapSizeOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) {\n return null\n }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [\n {\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n },\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 } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\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 makeModifier(snapSize, 'snapSize')\nexport { snapSize }\n","/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\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 */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\nimport type { ModifierArg, ModifierModule } from '../types'\n\nimport type { 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) {\n return null\n }\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(clone(snapSize.defaults), {\n targets: undefined,\n range: undefined,\n offset: { x: 0, y: 0 },\n } as const),\n}\n\nexport default makeModifier(snapEdges, 'snapEdges')\nexport { snapEdges }\n","/* eslint-disable n/no-extraneous-import, import/no-unresolved */\nimport aspectRatio from './aspectRatio'\nimport avoid from './avoid/avoid'\nimport restrictEdges from './restrict/edges'\nimport restrict from './restrict/pointer'\nimport restrictRect from './restrict/rect'\nimport restrictSize from './restrict/size'\nimport rubberband from './rubberband/rubberband'\nimport snapEdges from './snap/edges'\nimport snap from './snap/pointer'\nimport snapSize from './snap/size'\nimport spring from './spring/spring'\nimport transform from './transform/transform'\n\nexport default {\n aspectRatio,\n restrictEdges,\n restrict,\n restrictRect,\n restrictSize,\n snapEdges,\n snap,\n snapSize,\n\n spring,\n avoid,\n transform,\n rubberband,\n}\n","import type { Plugin } from '@interactjs/core/scope'\nimport snappers from '@interactjs/snappers/plugin'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './all'\nimport './base'\n\nimport all from './all'\nimport base from './base'\n/* eslint-enable import/no-duplicates */\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n modifiers: typeof all\n }\n}\n\nconst modifiers: Plugin = {\n id: 'modifiers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n scope.usePlugin(base)\n scope.usePlugin(snappers)\n\n interact.modifiers = all\n\n // for backwrads compatibility\n for (const type in all) {\n const { _defaults, _methods } = all[type as keyof typeof all]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n },\n}\n\nexport default modifiers\n","import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { PointerEventType, PointerType, Point } from '@interactjs/core/types'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n declare type: T\n declare originalEvent: PointerEventType\n declare pointerId: number\n declare pointerType: string\n declare double: boolean\n declare pageX: number\n declare pageY: number\n declare clientX: number\n declare clientY: number\n declare dt: number\n declare eventable: any;\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: PointerType | PointerEvent,\n event: PointerEventType,\n eventTarget: Node,\n interaction: 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 =\n !!interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500\n } else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n this.double = true\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: 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 }: 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 type { Eventable } from '@interactjs/core/Eventable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\n\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?: Point | string | 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/options' {\n interface ActionDefaults {\n pointerEvents: 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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\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: Plugin = {\n id: 'pointer-events/base',\n before: ['inertia', 'modifiers', 'auto-start', 'actions'],\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: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Scope,\n) {\n const { interaction, pointer, event, eventTarget, type, targets = collectEventTargets(arg, scope) } = 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 = 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 (\n pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n i + 1 < targets.length &&\n targets[i + 1].node !== pointerEvent.currentTarget)\n ) {\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 {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n },\n scope,\n )\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets (\n {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n }: {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n type: T\n },\n scope: Scope,\n) {\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 (\n type === 'tap' &&\n (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))\n ) {\n return []\n }\n\n const path = domUtils.getPath(eventTarget as 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(\n (target) => target.eventable.options.holdDuration === interaction.pointers[pointerIndex]?.hold?.duration,\n )\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 }: 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 const hold = interaction.pointers[pointerIndex].hold\n\n if (hold && hold.timeout) {\n clearTimeout(hold.timeout)\n hold.timeout = null\n }\n}\n\nfunction moveAndClearHold (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction, pointer, event, eventTarget, duplicate } = arg\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearHold(arg)\n }\n\n fire(\n {\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Element,\n type: 'move',\n },\n scope,\n )\n }\n}\n\nfunction downAndStartHold (\n { interaction, pointer, event, eventTarget, pointerIndex }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n const timer = interaction.pointers[pointerIndex].hold!\n const path = domUtils.getPath(eventTarget as 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 {\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n },\n scope,\n )\n }, minDuration)\n}\n\nfunction tapAfterUp (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:up'],\n scope: Scope,\n) {\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 extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n","import type Interaction from '@interactjs/core/Interaction'\nimport type { ListenerMap, Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\n\nimport type PointerEvent from './PointerEvent'\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport basePlugin from './base'\n/* eslint-enable import/no-duplicates */\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: Scope) {\n scope.usePlugin(basePlugin)\n\n const { pointerEvents } = 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 }: SignalArgs['pointerEvents:fired'],\n scope: 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 {\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n },\n scope,\n )\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: 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: 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 type { Interactable } from '@interactjs/core/Interactable'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\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: Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({ targets, node, type, eventTarget }, 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 ) {\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: 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 type { Plugin } from '@interactjs/core/scope'\n\n/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport './base'\nimport './holdRepeat'\nimport './interactableTargets'\n\nimport * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n/* eslint-enable import/no-duplicates */\n\nconst plugin: Plugin = {\n id: 'pointer-events',\n install (scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n },\n}\n\nexport default plugin\n","import type { Interactable } from '@interactjs/core/Interactable'\nimport type { DoAnyPhaseArg, Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, ActionProps, Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport { copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport { tlbrToXywh } from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-reflow': Omit\n 'interactions:action-reflow': DoAnyPhaseArg\n 'interactions:after-action-reflow': DoAnyPhaseArg\n }\n}\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: (...args: unknown[]) => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\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: ActionProps) {\n return doReflow(this, action, scope)\n }\n}\n\nfunction doReflow (\n interactable: Interactable,\n action: ActionProps,\n scope: Scope,\n): Promise {\n const elements = interactable.getAllElements()\n\n // tslint:disable-next-line variable-name\n const Promise = (scope.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) {\n break\n }\n\n const runningInteraction = arr.find(scope.interactions.list, (interaction: Interaction) => {\n return (\n interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n )\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise =\n runningInteraction._reflowPromise ||\n new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n } else {\n const xywh = 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 (\n scope: Scope,\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n event: any,\n) {\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.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n pointerUtils.setZeroCoords(interaction.coords.delta)\n\n copyAction(interaction.prepared, action)\n interaction._doPhase(signalArg)\n\n const { Promise } = scope.window as unknown as { Promise: PromiseConstructor }\n const reflowPromise = Promise\n ? new Promise((resolve) => {\n interaction._reflowResolve = resolve\n })\n : undefined\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 } else {\n interaction.stop()\n interaction._reflowResolve()\n }\n\n interaction.removePointer(event, event)\n\n return reflowPromise\n}\n\nconst reflow: Plugin = {\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}\n\nexport default reflow\n","/* eslint-disable import/no-duplicates -- for typescript module augmentations */\nimport '@interactjs/actions/plugin'\nimport '@interactjs/auto-scroll/plugin'\nimport '@interactjs/auto-start/plugin'\nimport '@interactjs/core/interactablePreventDefault'\nimport '@interactjs/dev-tools/plugin'\nimport '@interactjs/inertia/plugin'\nimport '@interactjs/interact'\nimport '@interactjs/modifiers/plugin'\nimport '@interactjs/offset/plugin'\nimport '@interactjs/pointer-events/plugin'\nimport '@interactjs/reflow/plugin'\n\nimport actions from '@interactjs/actions/plugin'\nimport autoScroll from '@interactjs/auto-scroll/plugin'\nimport autoStart from '@interactjs/auto-start/plugin'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/plugin'\nimport inertia from '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact'\nimport modifiers from '@interactjs/modifiers/plugin'\nimport offset from '@interactjs/offset/plugin'\nimport pointerEvents from '@interactjs/pointer-events/plugin'\nimport reflow from '@interactjs/reflow/plugin'\n/* eslint-enable import/no-duplicates */\n\ninteract.use(interactablePreventDefault)\n\ninteract.use(offset)\n\n// pointerEvents\ninteract.use(pointerEvents)\n\n// inertia\ninteract.use(inertia)\n\n// snap, resize, etc.\ninteract.use(modifiers)\n\n// autoStart, hold\ninteract.use(autoStart)\n\n// drag and drop, resize, gesture\ninteract.use(actions)\n\n// autoScroll\ninteract.use(autoScroll)\n\n// reflow\ninteract.use(reflow)\n\n// eslint-disable-next-line no-undef\nif (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n}\n\nexport default interact\n;(interact as any).default = interact\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport interact from '@interactjs/interactjs'\n\nexport default interact\n\nif (typeof module === 'object' && !!module) {\n try {\n module.exports = interact\n } catch {}\n}\n\n;(interact as any).default = interact\n","\nreturn _$index_79;\n\n});\n"]} \ No newline at end of file diff --git a/packages/interactjs/index.js b/packages/interactjs/index.js new file mode 100644 index 000000000..f0077ef90 --- /dev/null +++ b/packages/interactjs/index.js @@ -0,0 +1,13 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import interact from "../@interactjs/interactjs/index.js"; +export default interact; + +if (typeof module === 'object' && !!module) { + try { + module.exports = interact; + } catch (_unused) {} +} + +; +interact.default = interact; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/interactjs/index.js.map b/packages/interactjs/index.js.map new file mode 100644 index 000000000..e8b691741 --- /dev/null +++ b/packages/interactjs/index.js.map @@ -0,0 +1,16 @@ +{ + "version": 3, + "names": [ + "interact", + "module", + "exports", + "default" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "// eslint-disable-next-line import/no-extraneous-dependencies\nimport interact from '@interactjs/interactjs'\n\nexport default interact\n\nif (typeof module === 'object' && !!module) {\n try {\n module.exports = interact\n } catch {}\n}\n\n;(interact as any).default = interact\n" + ], + "mappings": "AAAA;AACA,OAAOA,QAAP,MAAqB,oCAArB;AAEA,eAAeA,QAAf;;AAEA,IAAI,OAAOC,MAAP,KAAkB,QAAlB,IAA8B,CAAC,CAACA,MAApC,EAA4C;EAC1C,IAAI;IACFA,MAAM,CAACC,OAAP,GAAiBF,QAAjB;EACD,CAFD,CAEE,gBAAM,CAAE;AACX;;AAED;AAAEA,QAAD,CAAkBG,OAAlB,GAA4BH,QAA5B" +} \ No newline at end of file diff --git a/packages/interactjs/index.prod.js b/packages/interactjs/index.prod.js new file mode 100644 index 000000000..1ea906483 --- /dev/null +++ b/packages/interactjs/index.prod.js @@ -0,0 +1,2 @@ +import t from"../@interactjs/interactjs/index.prod.js";export default t;if("object"==typeof module&&module)try{module.exports=t}catch(t){}t.default=t; +//# sourceMappingURL=index.prod.js.map \ No newline at end of file diff --git a/packages/interactjs/index.prod.js.map b/packages/interactjs/index.prod.js.map new file mode 100644 index 000000000..64e56223d --- /dev/null +++ b/packages/interactjs/index.prod.js.map @@ -0,0 +1,17 @@ +{ + "version": 3, + "names": [ + "interact", + "module", + "exports", + "_unused", + "default" + ], + "sources": [ + "index.ts" + ], + "sourcesContent": [ + "// eslint-disable-next-line import/no-extraneous-dependencies\nimport interact from '@interactjs/interactjs'\n\nexport default interact\n\nif (typeof module === 'object' && !!module) {\n try {\n module.exports = interact\n } catch {}\n}\n\n;(interact as any).default = interact\n" + ], + "mappings": "OACOA,MAAc,yDAENA,EAEf,GAAsB,iBAAXC,QAAyBA,OAClC,IACEA,OAAOC,QAAUF,EACjB,MAAAG,IAGFH,EAAiBI,QAAUJ" +} \ No newline at end of file diff --git a/packages/interactjs/package.json b/packages/interactjs/package.json index 239ea48a2..46c757ee4 100644 --- a/packages/interactjs/package.json +++ b/packages/interactjs/package.json @@ -44,5 +44,8 @@ "**/index.js", "**/index.prod.js" ], - "license": "MIT" + "license": "MIT", + "publishConfig": { + "access": "public" + } }