@interactjs/core
Advanced tools
Comparing version 1.9.0 to 1.9.1
@@ -1,2 +0,1 @@ | ||
import Interactable from './Interactable'; | ||
export declare class BaseEvent<T extends Interact.ActionName = any> { | ||
@@ -6,3 +5,3 @@ type: string; | ||
currentTarget: EventTarget; | ||
interactable: Interactable; | ||
interactable: Interact.Interactable; | ||
_interaction: Interact.Interaction<T>; | ||
@@ -12,3 +11,3 @@ timeStamp: any; | ||
propagationStopped: boolean; | ||
readonly interaction: Pick<import("@interactjs/core/Interaction").Interaction<"resize" | "drag" | "drop" | "gesture">, "end" | "stop" | "start" | "move" | "interactable" | "element" | "prepared" | "pointerIsDown" | "pointerWasMoved" | "_proxy" | "interacting" | "offsetBy">; | ||
readonly interaction: Interact.InteractionProxy<T>; | ||
constructor(interaction: Interact.Interaction); | ||
@@ -15,0 +14,0 @@ preventDefault(): void; |
@@ -1,3 +0,1 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
export class BaseEvent { | ||
@@ -9,18 +7,10 @@ get interaction() { | ||
constructor(interaction) { | ||
_defineProperty(this, "type", void 0); | ||
_defineProperty(this, "target", void 0); | ||
_defineProperty(this, "currentTarget", void 0); | ||
_defineProperty(this, "interactable", void 0); | ||
_defineProperty(this, "_interaction", void 0); | ||
_defineProperty(this, "timeStamp", void 0); | ||
_defineProperty(this, "immediatePropagationStopped", false); | ||
_defineProperty(this, "propagationStopped", false); | ||
this.type = void 0; | ||
this.target = void 0; | ||
this.currentTarget = void 0; | ||
this.interactable = void 0; | ||
this._interaction = void 0; | ||
this.timeStamp = void 0; | ||
this.immediatePropagationStopped = false; | ||
this.propagationStopped = false; | ||
this._interaction = interaction; | ||
@@ -27,0 +17,0 @@ } |
@@ -1,3 +0,1 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import * as arr from "../utils/arr.js"; | ||
@@ -19,12 +17,7 @@ import extend from "../utils/extend.js"; | ||
constructor(options) { | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "types", {}); | ||
_defineProperty(this, "propagationStopped", false); | ||
_defineProperty(this, "immediatePropagationStopped", false); | ||
_defineProperty(this, "global", void 0); | ||
this.options = void 0; | ||
this.types = {}; | ||
this.propagationStopped = false; | ||
this.immediatePropagationStopped = false; | ||
this.global = void 0; | ||
this.options = extend({}, options || {}); | ||
@@ -31,0 +24,0 @@ } |
@@ -1,3 +0,1 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import * as arr from "../utils/arr.js"; | ||
@@ -12,4 +10,4 @@ import browser from "../utils/browser.js"; | ||
import { getWindow } from "../utils/window.js"; | ||
import Eventable from "./Eventable.js"; | ||
import { isNonNativeEvent } from "./scope.js"; | ||
import Eventable from "Eventable.js"; | ||
import { isNonNativeEvent } from "scope.js"; | ||
@@ -28,16 +26,9 @@ /** */ | ||
constructor(target, options, defaultContext) { | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "_actions", void 0); | ||
_defineProperty(this, "target", void 0); | ||
_defineProperty(this, "events", new Eventable()); | ||
_defineProperty(this, "_context", void 0); | ||
_defineProperty(this, "_win", void 0); | ||
_defineProperty(this, "_doc", void 0); | ||
this.options = void 0; | ||
this._actions = void 0; | ||
this.target = void 0; | ||
this.events = new Eventable(); | ||
this._context = void 0; | ||
this._win = void 0; | ||
this._doc = void 0; | ||
this._actions = options.actions; | ||
@@ -44,0 +35,0 @@ this.target = target; |
@@ -1,3 +0,1 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import * as arr from "../utils/arr.js"; | ||
@@ -11,7 +9,4 @@ import * as domUtils from "../utils/domUtils.js"; | ||
this.scope = scope; | ||
_defineProperty(this, "list", []); | ||
_defineProperty(this, "selectorMap", {}); | ||
this.list = []; | ||
this.selectorMap = {}; | ||
scope.addListeners({ | ||
@@ -18,0 +13,0 @@ 'interactable:unset': ({ |
@@ -1,8 +0,6 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import extend from "../utils/extend.js"; | ||
import getOriginXY from "../utils/getOriginXY.js"; | ||
import hypot from "../utils/hypot.js"; | ||
import BaseEvent from "./BaseEvent.js"; | ||
import defaults from "./defaultOptions.js"; | ||
import BaseEvent from "BaseEvent.js"; | ||
import defaults from "defaultOptions.js"; | ||
export class InteractEvent extends BaseEvent { | ||
@@ -15,63 +13,32 @@ // drag | ||
super(interaction); | ||
_defineProperty(this, "target", void 0); | ||
_defineProperty(this, "currentTarget", void 0); | ||
_defineProperty(this, "relatedTarget", null); | ||
_defineProperty(this, "screenX", void 0); | ||
_defineProperty(this, "screenY", void 0); | ||
_defineProperty(this, "button", void 0); | ||
_defineProperty(this, "buttons", void 0); | ||
_defineProperty(this, "ctrlKey", void 0); | ||
_defineProperty(this, "shiftKey", void 0); | ||
_defineProperty(this, "altKey", void 0); | ||
_defineProperty(this, "metaKey", void 0); | ||
_defineProperty(this, "page", void 0); | ||
_defineProperty(this, "client", void 0); | ||
_defineProperty(this, "delta", void 0); | ||
_defineProperty(this, "rect", void 0); | ||
_defineProperty(this, "x0", void 0); | ||
_defineProperty(this, "y0", void 0); | ||
_defineProperty(this, "t0", void 0); | ||
_defineProperty(this, "dt", void 0); | ||
_defineProperty(this, "duration", void 0); | ||
_defineProperty(this, "clientX0", void 0); | ||
_defineProperty(this, "clientY0", void 0); | ||
_defineProperty(this, "velocity", void 0); | ||
_defineProperty(this, "speed", void 0); | ||
_defineProperty(this, "swipe", void 0); | ||
_defineProperty(this, "timeStamp", void 0); | ||
_defineProperty(this, "dragEnter", void 0); | ||
_defineProperty(this, "dragLeave", void 0); | ||
_defineProperty(this, "axes", void 0); | ||
_defineProperty(this, "preEnd", void 0); | ||
this.target = void 0; | ||
this.currentTarget = void 0; | ||
this.relatedTarget = null; | ||
this.screenX = void 0; | ||
this.screenY = void 0; | ||
this.button = void 0; | ||
this.buttons = void 0; | ||
this.ctrlKey = void 0; | ||
this.shiftKey = void 0; | ||
this.altKey = void 0; | ||
this.metaKey = void 0; | ||
this.page = void 0; | ||
this.client = void 0; | ||
this.delta = void 0; | ||
this.rect = void 0; | ||
this.x0 = void 0; | ||
this.y0 = void 0; | ||
this.t0 = void 0; | ||
this.dt = void 0; | ||
this.duration = void 0; | ||
this.clientX0 = void 0; | ||
this.clientY0 = void 0; | ||
this.velocity = void 0; | ||
this.speed = void 0; | ||
this.swipe = void 0; | ||
this.timeStamp = void 0; | ||
this.dragEnter = void 0; | ||
this.dragLeave = void 0; | ||
this.axes = void 0; | ||
this.preEnd = void 0; | ||
element = element || interaction.element; | ||
@@ -78,0 +45,0 @@ const target = interaction.interactable; |
@@ -87,3 +87,3 @@ import * as utils from '@interactjs/utils/index'; | ||
} | ||
export declare type _InteractionProxy = Pick<Interaction, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>; | ||
export declare type InteractionProxy<T extends ActionName = ActionName> = Pick<Interaction<T>, keyof typeof _ProxyValues | keyof typeof _ProxyMethods>; | ||
export declare class Interaction<T extends ActionName = ActionName> { | ||
@@ -117,3 +117,3 @@ interactable: Interactable; | ||
_stopped: boolean; | ||
_proxy: _InteractionProxy; | ||
_proxy: InteractionProxy<T>; | ||
simulation: any; | ||
@@ -120,0 +120,0 @@ readonly pointerMoveTolerance: number; |
@@ -1,6 +0,4 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import * as utils from "../utils/index.js"; | ||
import InteractEvent from "./InteractEvent.js"; | ||
import PointerInfo from "./PointerInfo.js"; | ||
import InteractEvent from "InteractEvent.js"; | ||
import PointerInfo from "PointerInfo.js"; | ||
export let _ProxyValues; | ||
@@ -48,55 +46,34 @@ | ||
}) { | ||
_defineProperty(this, "interactable", null); | ||
_defineProperty(this, "element", null); | ||
_defineProperty(this, "rect", void 0); | ||
_defineProperty(this, "_rects", void 0); | ||
_defineProperty(this, "edges", void 0); | ||
_defineProperty(this, "_scopeFire", void 0); | ||
_defineProperty(this, "prepared", { | ||
this.interactable = null; | ||
this.element = null; | ||
this.rect = void 0; | ||
this._rects = void 0; | ||
this.edges = void 0; | ||
this._scopeFire = void 0; | ||
this.prepared = { | ||
name: null, | ||
axis: null, | ||
edges: null | ||
}); | ||
_defineProperty(this, "pointerType", void 0); | ||
_defineProperty(this, "pointers", []); | ||
_defineProperty(this, "downEvent", null); | ||
_defineProperty(this, "downPointer", {}); | ||
_defineProperty(this, "_latestPointer", { | ||
}; | ||
this.pointerType = void 0; | ||
this.pointers = []; | ||
this.downEvent = null; | ||
this.downPointer = {}; | ||
this._latestPointer = { | ||
pointer: null, | ||
event: null, | ||
eventTarget: null | ||
}); | ||
_defineProperty(this, "prevEvent", null); | ||
_defineProperty(this, "pointerIsDown", false); | ||
_defineProperty(this, "pointerWasMoved", false); | ||
_defineProperty(this, "_interacting", false); | ||
_defineProperty(this, "_ending", false); | ||
_defineProperty(this, "_stopped", true); | ||
_defineProperty(this, "_proxy", null); | ||
_defineProperty(this, "simulation", null); | ||
_defineProperty(this, "doMove", utils.warnOnce(function (signalArg) { | ||
}; | ||
this.prevEvent = null; | ||
this.pointerIsDown = false; | ||
this.pointerWasMoved = false; | ||
this._interacting = false; | ||
this._ending = false; | ||
this._stopped = true; | ||
this._proxy = null; | ||
this.simulation = null; | ||
this.doMove = utils.warnOnce(function (signalArg) { | ||
this.move(signalArg); | ||
}, 'The interaction.doMove() method has been renamed to interaction.move()')); | ||
_defineProperty(this, "coords", { | ||
}, 'The interaction.doMove() method has been renamed to interaction.move()'); | ||
this.coords = { | ||
// Starting InteractEvent pointer coordinates | ||
@@ -112,6 +89,4 @@ start: utils.pointer.newCoords(), | ||
velocity: utils.pointer.newCoords() | ||
}); | ||
_defineProperty(this, "_id", idCounter++); | ||
}; | ||
this._id = idCounter++; | ||
this._scopeFire = scopeFire; | ||
@@ -118,0 +93,0 @@ this.pointerType = pointerType; |
@@ -6,6 +6,6 @@ import browser from "../utils/browser.js"; | ||
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
import InteractionBase from "./Interaction.js"; | ||
import finder from "./interactionFinder.js"; | ||
import { Scope } from "./scope.js"; | ||
import interactablePreventDefault from "./interactablePreventDefault.js"; | ||
import InteractionBase from "Interaction.js"; | ||
import finder from "interactionFinder.js"; | ||
import { Scope } from "scope.js"; | ||
import interactablePreventDefault from "interactablePreventDefault.js"; | ||
const methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur']; | ||
@@ -80,3 +80,3 @@ | ||
scope.prevTouchTime = 0; | ||
scope.Interaction = class Interaction extends InteractionBase { | ||
scope.Interaction = class extends InteractionBase { | ||
get pointerMoveTolerance() { | ||
@@ -83,0 +83,0 @@ return scope.interactions.pointerMoveTolerance; |
{ | ||
"name": "@interactjs/core", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@interactjs/dev-tools": "1.9.0", | ||
"@interactjs/utils": "1.9.0" | ||
"@interactjs/dev-tools": "1.9.1", | ||
"@interactjs/utils": "1.9.1" | ||
}, | ||
"devDependencies": { | ||
"@interactjs/_dev": "1.9.0", | ||
"@interactjs/actions": "1.9.0", | ||
"@interactjs/auto-start": "1.9.0" | ||
"@interactjs/_dev": "1.9.1", | ||
"@interactjs/actions": "1.9.1", | ||
"@interactjs/auto-start": "1.9.1" | ||
}, | ||
@@ -17,3 +17,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "cbd58434" | ||
"gitHead": "523820c6" | ||
} |
72
scope.js
@@ -1,11 +0,9 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import domObjects from "../utils/domObjects.js"; | ||
import * as utils from "../utils/index.js"; | ||
import defaults from "./defaultOptions.js"; | ||
import Eventable from "./Eventable.js"; | ||
import InteractableBase from "./Interactable.js"; | ||
import InteractableSet from "./InteractableSet.js"; | ||
import InteractEvent from "./InteractEvent.js"; | ||
import interactions from "./interactions.js"; | ||
import defaults from "defaultOptions.js"; | ||
import Eventable from "Eventable.js"; | ||
import InteractableBase from "Interactable.js"; | ||
import InteractableSet from "InteractableSet.js"; | ||
import InteractEvent from "InteractEvent.js"; | ||
import interactions from "interactions.js"; | ||
const { | ||
@@ -27,19 +25,11 @@ win, | ||
constructor() { | ||
_defineProperty(this, "id", `__interact_scope_${Math.floor(Math.random() * 100)}`); | ||
_defineProperty(this, "isInitialized", false); | ||
_defineProperty(this, "listenerMaps", []); | ||
_defineProperty(this, "browser", browser); | ||
_defineProperty(this, "events", events); | ||
_defineProperty(this, "utils", utils); | ||
_defineProperty(this, "defaults", utils.clone(defaults)); | ||
_defineProperty(this, "Eventable", Eventable); | ||
_defineProperty(this, "actions", { | ||
this.id = `__interact_scope_${Math.floor(Math.random() * 100)}`; | ||
this.isInitialized = false; | ||
this.listenerMaps = []; | ||
this.browser = browser; | ||
this.events = events; | ||
this.utils = utils; | ||
this.defaults = utils.clone(defaults); | ||
this.Eventable = Eventable; | ||
this.actions = { | ||
map: {}, | ||
@@ -53,27 +43,19 @@ phases: { | ||
phaselessTypes: {} | ||
}); | ||
_defineProperty(this, "InteractEvent", InteractEvent); | ||
_defineProperty(this, "Interactable", void 0); | ||
_defineProperty(this, "interactables", new InteractableSet(this)); | ||
_defineProperty(this, "_win", void 0); | ||
_defineProperty(this, "document", void 0); | ||
_defineProperty(this, "window", void 0); | ||
_defineProperty(this, "documents", []); | ||
_defineProperty(this, "_plugins", { | ||
}; | ||
this.InteractEvent = InteractEvent; | ||
this.Interactable = void 0; | ||
this.interactables = new InteractableSet(this); | ||
this._win = void 0; | ||
this.document = void 0; | ||
this.window = void 0; | ||
this.documents = []; | ||
this._plugins = { | ||
list: [], | ||
map: {} | ||
}); | ||
}; | ||
_defineProperty(this, "onWindowUnload", event => this.removeDocument(event.target)); | ||
this.onWindowUnload = event => this.removeDocument(event.target); | ||
const scope = this; | ||
this.Interactable = class Interactable extends InteractableBase { | ||
this.Interactable = class extends InteractableBase { | ||
get _defaults() { | ||
@@ -80,0 +62,0 @@ return scope.defaults; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
365510
71
3097