Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nosferatu500/react-dnd-scrollzone

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nosferatu500/react-dnd-scrollzone - npm Package Compare versions

Comparing version 2.0.10 to 3.0.0-alpha.0

6

esm/index.d.ts

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

import hoist from 'hoist-non-react-statics';
/// <reference types="react" />
export declare type Point = {

@@ -14,6 +14,4 @@ x: number;

export declare const createVerticalStrength: (_buffer: number) => ({ y, h, x, w }: Size, point: Point) => number;
export declare const defaultHorizontalStrength: ({ x, w, y, h }: Size, point: Point) => number;
export declare const defaultVerticalStrength: ({ y, h, x, w }: Size, point: Point) => number;
export declare const createScrollingComponent: (WrappedComponent: any) => ((props: any) => JSX.Element) & hoist.NonReactStatics<any, {}>;
export declare const createScrollingComponent: (WrappedComponent: any) => (props: any) => JSX.Element;
declare const createScrollingComponentWithConsumer: (WrappedComponent: any) => (props: any) => JSX.Element;
export default createScrollingComponentWithConsumer;
import React, { createRef, useEffect } from 'react';
import hoist from 'hoist-non-react-statics';
import throttle from 'lodash.throttle';

@@ -78,12 +77,10 @@ import { DndContext } from 'react-dnd';

};
const defaultHorizontalStrength = createHorizontalStrength(DEFAULT_BUFFER);
const defaultVerticalStrength = createVerticalStrength(DEFAULT_BUFFER);
const defaultProps = {
onScrollChange: noop,
verticalStrength: defaultVerticalStrength,
horizontalStrength: defaultHorizontalStrength,
verticalStrength: createVerticalStrength(DEFAULT_BUFFER),
horizontalStrength: createHorizontalStrength(DEFAULT_BUFFER),
strengthMultiplier: 30
};
const createScrollingComponent = (WrappedComponent) => {
const ScrollingComponent = (props) => {
return (props) => {
props = __spreadValues(__spreadValues({}, defaultProps), props);

@@ -117,2 +114,10 @@ let container;

}, 100, { trailing: false });
const handleEvent = (evt) => {
if (dragging && !attached) {
attached = true;
window.document.body.addEventListener("dragover", updateScrolling);
window.document.body.addEventListener("touchmove", updateScrolling);
updateScrolling(evt);
}
};
useEffect(() => {

@@ -124,3 +129,3 @@ container = wrappedInstance.current;

window.document.body.addEventListener("touchmove", handleEvent);
const clearMonitorSubscription = props.dragDropManager.getMonitor().subscribeToStateChange(() => handleMonitorChange());
const clearMonitorSubscription = props.dragDropManager.getMonitor().subscribeToStateChange(handleMonitorChange);
return () => {

@@ -135,8 +140,2 @@ if (container && typeof container.removeEventListener === "function") {

}, []);
const handleEvent = (evt) => {
if (dragging && !attached) {
attach();
updateScrolling(evt);
}
};
const handleMonitorChange = () => {

@@ -151,12 +150,2 @@ const isDragging = props.dragDropManager.getMonitor().isDragging();

};
const attach = () => {
attached = true;
window.document.body.addEventListener("dragover", updateScrolling);
window.document.body.addEventListener("touchmove", updateScrolling);
};
const detach = () => {
attached = false;
window.document.body.removeEventListener("dragover", updateScrolling);
window.document.body.removeEventListener("touchmove", updateScrolling);
};
const startScrolling = () => {

@@ -188,3 +177,5 @@ let i = 0;

const stopScrolling = () => {
detach();
attached = false;
window.document.body.removeEventListener("dragover", updateScrolling);
window.document.body.removeEventListener("touchmove", updateScrolling);
scaleX = 0;

@@ -207,3 +198,2 @@ scaleY = 0;

};
return hoist(ScrollingComponent, WrappedComponent);
};

@@ -213,3 +203,3 @@ const createScrollingComponentWithConsumer = (WrappedComponent) => {

return (props) => {
return /* @__PURE__ */ React.createElement(DndContext.Consumer, null, ({ dragDropManager }) => dragDropManager === void 0 ? void 0 : /* @__PURE__ */ React.createElement(ScrollingComponent, __spreadProps(__spreadValues({}, props), {
return /* @__PURE__ */ React.createElement(DndContext.Consumer, null, ({ dragDropManager }) => !dragDropManager ? void 0 : /* @__PURE__ */ React.createElement(ScrollingComponent, __spreadProps(__spreadValues({}, props), {
dragDropManager

@@ -220,2 +210,2 @@ })));

export { createHorizontalStrength, createScrollingComponent, createVerticalStrength, createScrollingComponentWithConsumer as default, defaultHorizontalStrength, defaultVerticalStrength };
export { createHorizontalStrength, createScrollingComponent, createVerticalStrength, createScrollingComponentWithConsumer as default };

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

import hoist from 'hoist-non-react-statics';
/// <reference types="react" />
export declare type Point = {

@@ -14,6 +14,4 @@ x: number;

export declare const createVerticalStrength: (_buffer: number) => ({ y, h, x, w }: Size, point: Point) => number;
export declare const defaultHorizontalStrength: ({ x, w, y, h }: Size, point: Point) => number;
export declare const defaultVerticalStrength: ({ y, h, x, w }: Size, point: Point) => number;
export declare const createScrollingComponent: (WrappedComponent: any) => ((props: any) => JSX.Element) & hoist.NonReactStatics<any, {}>;
export declare const createScrollingComponent: (WrappedComponent: any) => (props: any) => JSX.Element;
declare const createScrollingComponentWithConsumer: (WrappedComponent: any) => (props: any) => JSX.Element;
export default createScrollingComponentWithConsumer;

@@ -7,3 +7,2 @@ 'use strict';

var react = require('react');
var hoist = require('hoist-non-react-statics');
var throttle = require('lodash.throttle');

@@ -14,3 +13,2 @@ var reactDnd = require('react-dnd');

var hoist__default = /*#__PURE__*/_interopDefaultLegacy(hoist);
var throttle__default = /*#__PURE__*/_interopDefaultLegacy(throttle);

@@ -81,12 +79,10 @@

};
const defaultHorizontalStrength = createHorizontalStrength(DEFAULT_BUFFER);
const defaultVerticalStrength = createVerticalStrength(DEFAULT_BUFFER);
const defaultProps = {
onScrollChange: noop,
verticalStrength: defaultVerticalStrength,
horizontalStrength: defaultHorizontalStrength,
verticalStrength: createVerticalStrength(DEFAULT_BUFFER),
horizontalStrength: createHorizontalStrength(DEFAULT_BUFFER),
strengthMultiplier: 30
};
const createScrollingComponent = WrappedComponent => {
const ScrollingComponent = props => {
return props => {
props = { ...defaultProps,

@@ -125,2 +121,12 @@ ...props

});
const handleEvent = evt => {
if (dragging && !attached) {
attached = true;
window.document.body.addEventListener('dragover', updateScrolling);
window.document.body.addEventListener('touchmove', updateScrolling);
updateScrolling(evt);
}
};
react.useEffect(() => {

@@ -134,3 +140,3 @@ container = wrappedInstance.current;

window.document.body.addEventListener('touchmove', handleEvent);
const clearMonitorSubscription = props.dragDropManager.getMonitor().subscribeToStateChange(() => handleMonitorChange());
const clearMonitorSubscription = props.dragDropManager.getMonitor().subscribeToStateChange(handleMonitorChange);
return () => {

@@ -147,9 +153,2 @@ if (container && typeof container.removeEventListener === 'function') {

const handleEvent = evt => {
if (dragging && !attached) {
attach();
updateScrolling(evt);
}
};
const handleMonitorChange = () => {

@@ -166,14 +165,2 @@ const isDragging = props.dragDropManager.getMonitor().isDragging();

const attach = () => {
attached = true;
window.document.body.addEventListener('dragover', updateScrolling);
window.document.body.addEventListener('touchmove', updateScrolling);
};
const detach = () => {
attached = false;
window.document.body.removeEventListener('dragover', updateScrolling);
window.document.body.removeEventListener('touchmove', updateScrolling);
};
const startScrolling = () => {

@@ -211,3 +198,5 @@ let i = 0;

const stopScrolling = () => {
detach();
attached = false;
window.document.body.removeEventListener('dragover', updateScrolling);
window.document.body.removeEventListener('touchmove', updateScrolling);
scaleX = 0;

@@ -234,4 +223,2 @@ scaleY = 0;

};
return hoist__default["default"](ScrollingComponent, WrappedComponent);
};

@@ -245,3 +232,3 @@

dragDropManager
}) => dragDropManager === undefined ? undefined : jsxRuntime.jsx(ScrollingComponent, { ...props,
}) => !dragDropManager ? undefined : jsxRuntime.jsx(ScrollingComponent, { ...props,
dragDropManager: dragDropManager

@@ -257,3 +244,1 @@ })

exports["default"] = createScrollingComponentWithConsumer;
exports.defaultHorizontalStrength = defaultHorizontalStrength;
exports.defaultVerticalStrength = defaultVerticalStrength;
{
"name": "@nosferatu500/react-dnd-scrollzone",
"version": "2.0.10",
"version": "3.0.0-alpha.0",
"description": "A cross browser solution to scrolling during drag and drop.",

@@ -47,3 +47,2 @@ "main": "./index.js",

"dependencies": {
"hoist-non-react-statics": "^3.3.2",
"lodash.throttle": "^4.1.1"

@@ -53,3 +52,3 @@ },

"react": ">=17.0.2",
"react-dnd": "14.0.4",
"react-dnd": ">=15.1.2",
"react-dom": ">=17.0.2"

@@ -56,0 +55,0 @@ },

Sorry, the diff of this file is not supported yet

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