Socket
Socket
Sign inDemoInstall

@use-gesture/core

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@use-gesture/core - npm Package Compare versions

Comparing version 10.0.0-beta.15 to 10.0.0-beta.16

dist/actions-0774537c.cjs.dev.js

2

actions/dist/use-gesture-core-actions.cjs.dev.js

@@ -5,3 +5,3 @@ 'use strict';

var actions_dist_useGestureCoreActions = require('../../dist/actions-a3bd90aa.cjs.dev.js');
var actions_dist_useGestureCoreActions = require('../../dist/actions-0774537c.cjs.dev.js');
require('../../dist/maths-125ca19a.cjs.dev.js');

@@ -8,0 +8,0 @@

@@ -5,3 +5,3 @@ 'use strict';

var actions_dist_useGestureCoreActions = require('../../dist/actions-259a6821.cjs.prod.js');
var actions_dist_useGestureCoreActions = require('../../dist/actions-e957bb67.cjs.prod.js');
require('../../dist/maths-a42ecce1.cjs.prod.js');

@@ -8,0 +8,0 @@

@@ -1,2 +0,2 @@

export { C as ConfigResolverMap, E as EngineMap, e as dragAction, h as hoverAction, m as moveAction, p as pinchAction, r as registerAction, s as scrollAction, w as wheelAction } from '../../dist/actions-b9513ee3.esm.js';
export { C as ConfigResolverMap, E as EngineMap, e as dragAction, h as hoverAction, m as moveAction, p as pinchAction, r as registerAction, s as scrollAction, w as wheelAction } from '../../dist/actions-6cc22183.esm.js';
import '../../dist/maths-b2a210f4.esm.js';

@@ -1,2 +0,2 @@

import { GestureKey, EngineClass, Action } from '../types';
import { GestureKey, EngineClass, Action } from './types';
import { ResolverMap } from './config/resolver';

@@ -3,0 +3,0 @@ export declare const EngineMap: Map<GestureKey, EngineClass<any>>;

import { Vector2 } from '../types';
export declare function toReactHandlerProp(device: string, action?: string, capture?: boolean): string;
export declare function toHandlerProp(device: string, action?: string, capture?: boolean): string;
export declare function toDomEventType(device: string, action?: string): string;

@@ -4,0 +4,0 @@ export declare function isTouch(event: UIEvent): boolean;

@@ -5,3 +5,3 @@ 'use strict';

var actions_dist_useGestureCoreActions = require('./actions-a3bd90aa.cjs.dev.js');
var actions_dist_useGestureCoreActions = require('./actions-0774537c.cjs.dev.js');
require('./maths-125ca19a.cjs.dev.js');

@@ -147,3 +147,5 @@

const type = actions_dist_useGestureCoreActions.toDomEventType(device, action);
const eventOptions = options || this._ctrl.config.shared.eventOptions;
const eventOptions = actions_dist_useGestureCoreActions._objectSpread2(actions_dist_useGestureCoreActions._objectSpread2({}, this._ctrl.config.shared.eventOptions), options);
element.addEventListener(type, handler, eventOptions);

@@ -259,3 +261,3 @@

const bindFunction = target ? bindToEventStore(this._targetEventStore, target) : bindToProps(props, eventOptions);
const bindFunction = bindToProps(props, eventOptions, !!target);

@@ -278,8 +280,18 @@ if (sharedConfig.enabled) {

if (!sharedConfig.target) {
for (const handlerProp in props) {
props[handlerProp] = actions_dist_useGestureCoreActions.chain(...props[handlerProp]);
}
for (const handlerProp in props) {
props[handlerProp] = actions_dist_useGestureCoreActions.chain(...props[handlerProp]);
}
return props;
if (!target) return props;
for (const handlerProp in props) {
let eventKey = handlerProp.substr(2).toLowerCase();
const capture = !!~eventKey.indexOf('capture');
const passive = !!~eventKey.indexOf('passive');
if (capture || passive) eventKey = eventKey.replace(/capture|passive/g, '');
this._targetEventStore.add(target, eventKey, '', props[handlerProp], {
capture,
passive
});
}

@@ -297,3 +309,2 @@ }

function resolveGestures(ctrl, internalHandlers) {
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
if (internalHandlers.drag) setupGesture(ctrl, 'drag');

@@ -304,14 +315,12 @@ if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');

if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
}
const bindToEventStore = (eventStore, target) => (device, action, handler, options, isNative = false) => {
if (isNative) device = device.slice(2).toLowerCase();
eventStore.add(target, device, action, handler, options);
};
const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture, _options$passive;
const bindToProps = (props, eventOptions) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture;
const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
const handlerProp = isNative ? device : actions_dist_useGestureCoreActions.toReactHandlerProp(device, action, capture);
const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
let handlerProp = isNative ? device : actions_dist_useGestureCoreActions.toHandlerProp(device, action, capture);
if (withPassiveOption && passive) handlerProp += 'Passive';
props[handlerProp] = props[handlerProp] || [];

@@ -318,0 +327,0 @@ props[handlerProp].push(handler);

@@ -5,3 +5,3 @@ 'use strict';

var actions_dist_useGestureCoreActions = require('./actions-259a6821.cjs.prod.js');
var actions_dist_useGestureCoreActions = require('./actions-e957bb67.cjs.prod.js');
require('./maths-a42ecce1.cjs.prod.js');

@@ -143,3 +143,5 @@

const type = actions_dist_useGestureCoreActions.toDomEventType(device, action);
const eventOptions = options || this._ctrl.config.shared.eventOptions;
const eventOptions = actions_dist_useGestureCoreActions._objectSpread2(actions_dist_useGestureCoreActions._objectSpread2({}, this._ctrl.config.shared.eventOptions), options);
element.addEventListener(type, handler, eventOptions);

@@ -255,3 +257,3 @@

const bindFunction = target ? bindToEventStore(this._targetEventStore, target) : bindToProps(props, eventOptions);
const bindFunction = bindToProps(props, eventOptions, !!target);

@@ -274,8 +276,18 @@ if (sharedConfig.enabled) {

if (!sharedConfig.target) {
for (const handlerProp in props) {
props[handlerProp] = actions_dist_useGestureCoreActions.chain(...props[handlerProp]);
}
for (const handlerProp in props) {
props[handlerProp] = actions_dist_useGestureCoreActions.chain(...props[handlerProp]);
}
return props;
if (!target) return props;
for (const handlerProp in props) {
let eventKey = handlerProp.substr(2).toLowerCase();
const capture = !!~eventKey.indexOf('capture');
const passive = !!~eventKey.indexOf('passive');
if (capture || passive) eventKey = eventKey.replace(/capture|passive/g, '');
this._targetEventStore.add(target, eventKey, '', props[handlerProp], {
capture,
passive
});
}

@@ -293,3 +305,2 @@ }

function resolveGestures(ctrl, internalHandlers) {
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
if (internalHandlers.drag) setupGesture(ctrl, 'drag');

@@ -300,14 +311,12 @@ if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');

if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
}
const bindToEventStore = (eventStore, target) => (device, action, handler, options, isNative = false) => {
if (isNative) device = device.slice(2).toLowerCase();
eventStore.add(target, device, action, handler, options);
};
const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture, _options$passive;
const bindToProps = (props, eventOptions) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture;
const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
const handlerProp = isNative ? device : actions_dist_useGestureCoreActions.toReactHandlerProp(device, action, capture);
const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
let handlerProp = isNative ? device : actions_dist_useGestureCoreActions.toHandlerProp(device, action, capture);
if (withPassiveOption && passive) handlerProp += 'Passive';
props[handlerProp] = props[handlerProp] || [];

@@ -314,0 +323,0 @@ props[handlerProp].push(handler);

@@ -1,2 +0,2 @@

import { S as SUPPORT, C as ConfigResolverMap, _ as _objectSpread2, a as _defineProperty, t as toDomEventType, i as isTouch, b as touchIds, c as toReactHandlerProp, E as EngineMap, d as chain } from './actions-b9513ee3.esm.js';
import { S as SUPPORT, C as ConfigResolverMap, _ as _objectSpread2, a as _defineProperty, t as toDomEventType, i as isTouch, b as touchIds, E as EngineMap, c as chain, d as toHandlerProp } from './actions-6cc22183.esm.js';
import './maths-b2a210f4.esm.js';

@@ -142,3 +142,5 @@

const type = toDomEventType(device, action);
const eventOptions = options || this._ctrl.config.shared.eventOptions;
const eventOptions = _objectSpread2(_objectSpread2({}, this._ctrl.config.shared.eventOptions), options);
element.addEventListener(type, handler, eventOptions);

@@ -254,3 +256,3 @@

const bindFunction = target ? bindToEventStore(this._targetEventStore, target) : bindToProps(props, eventOptions);
const bindFunction = bindToProps(props, eventOptions, !!target);

@@ -273,8 +275,18 @@ if (sharedConfig.enabled) {

if (!sharedConfig.target) {
for (const handlerProp in props) {
props[handlerProp] = chain(...props[handlerProp]);
}
for (const handlerProp in props) {
props[handlerProp] = chain(...props[handlerProp]);
}
return props;
if (!target) return props;
for (const handlerProp in props) {
let eventKey = handlerProp.substr(2).toLowerCase();
const capture = !!~eventKey.indexOf('capture');
const passive = !!~eventKey.indexOf('passive');
if (capture || passive) eventKey = eventKey.replace(/capture|passive/g, '');
this._targetEventStore.add(target, eventKey, '', props[handlerProp], {
capture,
passive
});
}

@@ -292,3 +304,2 @@ }

function resolveGestures(ctrl, internalHandlers) {
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
if (internalHandlers.drag) setupGesture(ctrl, 'drag');

@@ -299,14 +310,12 @@ if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');

if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
}
const bindToEventStore = (eventStore, target) => (device, action, handler, options, isNative = false) => {
if (isNative) device = device.slice(2).toLowerCase();
eventStore.add(target, device, action, handler, options);
};
const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture, _options$passive;
const bindToProps = (props, eventOptions) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture;
const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
const handlerProp = isNative ? device : toReactHandlerProp(device, action, capture);
const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
let handlerProp = isNative ? device : toHandlerProp(device, action, capture);
if (withPassiveOption && passive) handlerProp += 'Passive';
props[handlerProp] = props[handlerProp] || [];

@@ -313,0 +322,0 @@ props[handlerProp].push(handler);

{
"name": "@use-gesture/core",
"version": "10.0.0-beta.15",
"version": "10.0.0-beta.16",
"description": "Core engine for receiving gestures",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -1,2 +0,2 @@

import { GestureKey, EngineClass, Action } from '../types'
import { GestureKey, EngineClass, Action } from './types'
import { ResolverMap } from './config/resolver'

@@ -3,0 +3,0 @@

import { EngineMap } from './actions'
import { parse } from './config/resolver'
import { isTouch, toReactHandlerProp, touchIds } from './utils/events'
import { isTouch, toHandlerProp, touchIds } from './utils/events'
import { EventStore } from './EventStore'

@@ -105,3 +105,3 @@ import { TimeoutStore } from './TimeoutStore'

const bindFunction = target ? bindToEventStore(this._targetEventStore, target) : bindToProps(props, eventOptions)
const bindFunction = bindToProps(props, eventOptions, !!target)

@@ -133,8 +133,21 @@ if (sharedConfig.enabled) {

// mapped to props handler event keys.
if (!sharedConfig.target) {
for (const handlerProp in props) {
props[handlerProp] = chain(...props[handlerProp])
}
return props
for (const handlerProp in props) {
props[handlerProp] = chain(...props[handlerProp])
}
// When target isn't specified then return hanlder props.
if (!target) return props
// When target is specified, then add listeners to the controller target
// store.
for (const handlerProp in props) {
// onPointerMoveCapture => pointermovecapture
let eventKey = handlerProp.substr(2).toLowerCase()
// capture = true
const capture = !!~eventKey.indexOf('capture')
const passive = !!~eventKey.indexOf('passive')
// pointermovecapture => pointermove
if (capture || passive) eventKey = eventKey.replace(/capture|passive/g, '')
this._targetEventStore.add(target, eventKey, '', props[handlerProp], { capture, passive })
}
}

@@ -153,3 +166,2 @@ }

// pointerLeave, which prevents hovering: false to be fired.
if (internalHandlers.hover) setupGesture(ctrl, 'hover')
if (internalHandlers.drag) setupGesture(ctrl, 'drag')

@@ -160,19 +172,7 @@ if (internalHandlers.wheel) setupGesture(ctrl, 'wheel')

if (internalHandlers.pinch) setupGesture(ctrl, 'pinch')
if (internalHandlers.hover) setupGesture(ctrl, 'hover')
}
const bindToEventStore =
(eventStore: EventStore, target: EventTarget) =>
(
device: string,
action: string,
handler: (event: any) => void,
options?: AddEventListenerOptions,
isNative = false
) => {
if (isNative) device = device.slice(2).toLowerCase() // transforms onMouseDown into mousedown
eventStore.add(target, device, action, handler, options)
}
const bindToProps =
(props: any, eventOptions: AddEventListenerOptions) =>
(props: any, eventOptions: AddEventListenerOptions, withPassiveOption: boolean) =>
(

@@ -186,6 +186,8 @@ device: string,

const capture = options.capture ?? eventOptions.capture
const passive = options.passive ?? eventOptions.passive
// a native handler is already passed as a prop like "onMouseDown"
const handlerProp = isNative ? device : toReactHandlerProp(device, action, capture)
let handlerProp = isNative ? device : toHandlerProp(device, action, capture)
if (withPassiveOption && passive) handlerProp += 'Passive'
props[handlerProp] = props[handlerProp] || []
props[handlerProp].push(handler)
}

@@ -19,3 +19,3 @@ import type { Controller } from './Controller'

const type = toDomEventType(device, action)
const eventOptions = options || this._ctrl.config.shared.eventOptions
const eventOptions = { ...this._ctrl.config.shared.eventOptions, ...options }
element.addEventListener(type, handler, eventOptions)

@@ -22,0 +22,0 @@ this._listeners.push(() => element.removeEventListener(type, handler, eventOptions))

@@ -15,3 +15,3 @@ import { Vector2 } from '../types'

export function toReactHandlerProp(device: string, action = '', capture: boolean = false) {
export function toHandlerProp(device: string, action = '', capture: boolean = false) {
const deviceProps = EVENT_TYPE_MAP[device]

@@ -18,0 +18,0 @@ const actionKey = deviceProps ? deviceProps[action] || action : action

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc