Socket
Book a DemoInstallSign in
Socket

rescript-dnd

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rescript-dnd - npm Package Compare versions

Comparing version

to
5.0.0

2

bsconfig.json

@@ -16,3 +16,3 @@ {

"@rescript/react",
"bs-webapi",
"rescript-webapi",
"rescript-logger"

@@ -19,0 +19,0 @@ ],

{
"name": "rescript-dnd",
"version": "4.0.0",
"version": "5.0.0",
"description": "Drag-n-drop for @rescript/react",

@@ -45,12 +45,11 @@ "main": "src/Dnd.re",

"dependencies": {
"rescript-logger": "2.0.2"
"rescript-logger": "3.0.0"
},
"peerDependencies": {
"@rescript/react": ">=0.10.3",
"bs-webapi": ">=0.15.9"
"rescript-webapi": ">=0.6.0"
},
"devDependencies": {
"@rescript/react": "0.10.3",
"@rescript/react": ">=0.10.3",
"autoprefixer": "9.8.6",
"bs-webapi": "0.19.1",
"bsb-js": "1.1.7",

@@ -60,5 +59,6 @@ "parcel-bundler": "1.12.4",

"react-dom": "17.0.2",
"rescript": "9.1.4",
"rescript-classnames": "6.0.0"
"rescript": "10.0.1",
"rescript-classnames": "6.0.0",
"rescript-webapi": "0.6.1"
}
}

@@ -19,2 +19,7 @@ # rescript-dnd

> ### ShakaCode
> If you are looking for help with the development and optimization of your project, [ShakaCode](https://www.shakacode.com) can help you to take the reliability and performance of your app to the next level.
>
> If you are a developer interested in working on ReScript / TypeScript / Rust / Ruby on Rails projects, [we're hiring](https://www.shakacode.com/career/)!
## Installation

@@ -24,5 +29,5 @@

# yarn
yarn add rescript-dnd
yarn add rescript-dnd rescript-webapi
# or npm
npm install --save rescript-dnd
npm install --save rescript-dnd rescript-webapi
```

@@ -34,3 +39,4 @@

"bs-dependencies": [
"rescript-dnd"
"rescript-dnd",
"rescript-webapi"
]

@@ -65,1 +71,33 @@ ```

MIT.
## Supporters
<a href="https://www.jetbrains.com">
<img src="https://user-images.githubusercontent.com/4244251/184881139-42e4076b-024b-4b30-8c60-c3cd0e758c0a.png" alt="JetBrains" height="120px">
</a>
<a href="https://scoutapp.com">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/4244251/184881147-0d077438-3978-40da-ace9-4f650d2efe2e.png">
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png">
<img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px">
</picture>
</a>
<br />
<a href="https://www.browserstack.com">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/4244251/184881122-407dcc29-df78-4b20-a9ad-f597b56f6cdb.png">
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png">
<img alt="BrowserStack" src="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png" height="55px">
</picture>
</a>
<a href="https://railsautoscale.com">
<img src="https://user-images.githubusercontent.com/4244251/184881144-95c2c25c-9879-4069-864d-4e67d6ed39d2.png" alt="Rails Autoscale" height="55px">
</a>
<a href="https://www.honeybadger.io">
<img src="https://user-images.githubusercontent.com/4244251/184881133-79ee9c3c-8165-4852-958e-31687b9536f4.png" alt="Honeybadger" height="55px">
</a>
<br />
<br />
The following companies support our open source projects, and ShakaCode uses their products!

@@ -64,4 +64,3 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

Make ,
}
/* react Not a pure module */

@@ -17,3 +17,7 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

var clearSelection = function (param) {
window.getSelection().removeAllRanges();
var selection = window.getSelection();
if (!(selection == null)) {
selection.removeAllRanges();
return ;
}

@@ -65,3 +69,3 @@ };

dropInitialSubscriptions(undefined);
window.getSelection().removeAllRanges();
clearSelection(undefined);
return Curry._5(ctx.current.startDragging, itemId, containerId, start, current, "Mouse");

@@ -72,6 +76,6 @@ }

var onInitialMouseUp = function (param) {
return dropInitialSubscriptions(undefined);
dropInitialSubscriptions(undefined);
};
var onInitialDrag = function (param) {
return dropInitialSubscriptions(undefined);
dropInitialSubscriptions(undefined);
};

@@ -81,7 +85,7 @@ var dropInitialSubscriptions = function (param) {

Dnd__Events.unsubscribeFromMouseUp(onInitialMouseUp);
return Dnd__Events.unsubscribeFromDrag(onInitialDrag);
Dnd__Events.unsubscribeFromDrag(onInitialDrag);
};
Dnd__Events.subscribeToMouseMove(onInitialMouseMove);
Dnd__Events.subscribeToMouseUp(onInitialMouseUp);
return Dnd__Events.subscribeToDrag(onInitialDrag);
Dnd__Events.subscribeToDrag(onInitialDrag);
};

@@ -112,2 +116,11 @@ var MouseInteractions = {

};
var onInitialTouchEnd = function (param) {
cancelDrag(undefined);
};
var onInitialTouchMove = function (param) {
cancelDrag(undefined);
};
var onInitialDrag = function (param) {
cancelDrag(undefined);
};
var cancelDrag = function (param) {

@@ -121,15 +134,6 @@ var timeoutId$1 = timeoutId.contents;

};
var onInitialTouchEnd = function (param) {
return cancelDrag(undefined);
};
var onInitialDrag = function (param) {
return cancelDrag(undefined);
};
var onInitialTouchMove = function (param) {
return cancelDrag(undefined);
};
var dropInitialSubscriptions = function (param) {
Dnd__Events.unsubscribeFromTouchMove(onInitialTouchMove);
Dnd__Events.unsubscribeFromTouchEnd(onInitialTouchEnd);
return Dnd__Events.unsubscribeFromDrag(onInitialDrag);
Dnd__Events.unsubscribeFromDrag(onInitialDrag);
};

@@ -139,4 +143,4 @@ var startDragging = function (param) {

dropInitialSubscriptions(undefined);
window.getSelection().removeAllRanges();
return Curry._5(ctx.current.startDragging, itemId, containerId, start, start, "Touch");
clearSelection(undefined);
Curry._5(ctx.current.startDragging, itemId, containerId, start, start, "Touch");
}), 200);

@@ -148,3 +152,2 @@ };

timeoutId.contents = Caml_option.some(startDragging(undefined));
};

@@ -164,3 +167,2 @@ var TouchInteractions = {

ctxRef.current = ctx;
});

@@ -192,3 +194,2 @@ var element = React.useRef(null);

});
}), [

@@ -513,4 +514,3 @@ prevStatus,

Make ,
}
/* react Not a pure module */

@@ -82,3 +82,2 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

});
}), [

@@ -193,4 +192,3 @@ prevStatus,

Make ,
}
/* react Not a pure module */

@@ -17,3 +17,2 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

window.addEventListener("mousemove", handler, addOptions);
}

@@ -23,3 +22,2 @@

window.removeEventListener("mousemove", handler, removeOptions);
}

@@ -29,3 +27,2 @@

window.addEventListener("mouseup", handler, addOptions);
}

@@ -35,3 +32,2 @@

window.removeEventListener("mouseup", handler, removeOptions);
}

@@ -41,3 +37,2 @@

window.addEventListener("drag", handler, addOptions);
}

@@ -47,3 +42,2 @@

window.removeEventListener("drag", handler, removeOptions);
}

@@ -53,3 +47,2 @@

window.addEventListener("resize", handler, addOptions);
}

@@ -59,3 +52,2 @@

window.removeEventListener("resize", handler, removeOptions);
}

@@ -65,3 +57,2 @@

window.addEventListener("keyup", handler, addOptions);
}

@@ -71,3 +62,2 @@

window.removeEventListener("keyup", handler, removeOptions);
}

@@ -77,3 +67,2 @@

window.addEventListener("keydown", handler, addOptions);
}

@@ -83,3 +72,2 @@

window.removeEventListener("keydown", handler, removeOptions);
}

@@ -89,3 +77,2 @@

window.addEventListener("touchmove", handler, addOptions);
}

@@ -95,3 +82,2 @@

window.removeEventListener("touchmove", handler, removeOptions);
}

@@ -101,3 +87,2 @@

window.addEventListener("touchend", handler, addOptions);
}

@@ -107,3 +92,2 @@

window.removeEventListener("touchend", handler, removeOptions);
}

@@ -113,3 +97,2 @@

window.addEventListener("orientationchange", handler, addOptions);
}

@@ -119,3 +102,2 @@

window.removeEventListener("orientationchange", handler, removeOptions);
}

@@ -125,3 +107,2 @@

window.addEventListener("contextmenu", handler, addOptions);
}

@@ -131,3 +112,2 @@

window.removeEventListener("contextmenu", handler, removeOptions);
}

@@ -137,3 +117,2 @@

window.addEventListener("visibilitychange", handler, addOptions);
}

@@ -143,3 +122,2 @@

window.removeEventListener("visibilitychange", handler, removeOptions);
}

@@ -247,4 +225,3 @@

$$Touch$1 as $$Touch,
}
/* No side effect */

@@ -354,4 +354,3 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

isAforeAdjusted ,
}
/* No side effect */

@@ -12,3 +12,2 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

x.current = Caml_option.some(v);
});

@@ -70,6 +69,6 @@ return x.current;

Belt_Array.forEach(sideEffects.contents, (function (fn) {
return Curry._1(fn, {
state: state,
dispatch: dispatch
});
Curry._1(fn, {
state: state,
dispatch: dispatch
});
}));

@@ -102,4 +101,3 @@ sideEffects.contents = [];

useReducer ,
}
/* react Not a pure module */

@@ -7,3 +7,3 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

import * as Dnd__Geometry from "./Dnd__Geometry.bs.js";
import * as Webapi__Dom__HtmlElement from "bs-webapi/src/Webapi/Dom/Webapi__Dom__HtmlElement.bs.js";
import * as Webapi__Dom__HtmlElement from "rescript-webapi/src/Webapi/Dom/Webapi__Dom__HtmlElement.bs.js";

@@ -105,4 +105,3 @@ function getScrollPosition(param) {

$$Element ,
}
/* Webapi__Dom__HtmlElement Not a pure module */

@@ -94,11 +94,9 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

return Caml_option.some(requestAnimationFrame(function (param) {
var __x = window;
__x.scrollBy(x, y);
return Curry._1(onScroll, undefined);
window.scrollBy(x, y);
Curry._1(onScroll, undefined);
}));
} else {
return Caml_option.some(requestAnimationFrame(function (param) {
var __x = window;
__x.scrollBy(x, 0);
return Curry._1(onScroll, undefined);
window.scrollBy(x, 0);
Curry._1(onScroll, undefined);
}));

@@ -110,5 +108,4 @@ }

return Caml_option.some(requestAnimationFrame(function (param) {
var __x = window;
__x.scrollBy(0, y$1);
return Curry._1(onScroll, undefined);
window.scrollBy(0, y$1);
Curry._1(onScroll, undefined);
}));

@@ -133,3 +130,3 @@ }

scrollable.element.scrollTop = scrollable.scroll.current.y + y;
return Curry._1(onScroll, scrollable);
Curry._1(onScroll, scrollable);
}));

@@ -139,3 +136,3 @@ } else {

scrollable.element.scrollLeft = scrollable.scroll.current.x + x;
return Curry._1(onScroll, scrollable);
Curry._1(onScroll, scrollable);
}));

@@ -148,3 +145,3 @@ }

scrollable.element.scrollTop = scrollable.scroll.current.y + y$1;
return Curry._1(onScroll, scrollable);
Curry._1(onScroll, scrollable);
}));

@@ -214,4 +211,3 @@ }

getScroller ,
}
/* No side effect */

@@ -18,3 +18,2 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

});
}

@@ -84,5 +83,5 @@

_1: (function (param) {
return Belt_Option.mapWithDefault(Belt_Map.get(refs.current, id), undefined, (function (param) {
return adjust(param, topMarginFactor, bottomMarginFactor);
}));
Belt_Option.mapWithDefault(Belt_Map.get(refs.current, id), undefined, (function (param) {
return adjust(param, topMarginFactor, bottomMarginFactor);
}));
})

@@ -167,30 +166,30 @@ };

selectOne: (function (itemId) {
return Curry._1(dispatch, {
TAG: /* SelectOne */0,
_0: itemId
});
Curry._1(dispatch, {
TAG: /* SelectOne */0,
_0: itemId
});
}),
deselectOne: (function (itemId) {
return Curry._1(dispatch, {
TAG: /* DeselectOne */1,
_0: itemId
});
Curry._1(dispatch, {
TAG: /* DeselectOne */1,
_0: itemId
});
}),
concat: (function (items) {
return Curry._1(dispatch, {
TAG: /* Concat */2,
_0: items
});
Curry._1(dispatch, {
TAG: /* Concat */2,
_0: items
});
}),
fromArray: (function (items) {
return Curry._1(dispatch, {
TAG: /* FromArray */3,
_0: items
});
Curry._1(dispatch, {
TAG: /* FromArray */3,
_0: items
});
}),
restorePrevious: (function (param) {
return Curry._1(dispatch, /* RestorePrevious */0);
Curry._1(dispatch, /* RestorePrevious */0);
}),
clear: (function (param) {
return Curry._1(dispatch, /* Clear */1);
Curry._1(dispatch, /* Clear */1);
})

@@ -211,4 +210,3 @@ };

Make ,
}
/* react Not a pure module */
// Generated by ReScript, PLEASE EDIT WITH CARE
import * as Js_string from "rescript/lib/es6/js_string.js";
import * as Belt_Float from "rescript/lib/es6/belt_Float.js";

@@ -11,3 +12,3 @@ import * as Belt_Option from "rescript/lib/es6/belt_Option.js";

function stripPx(x) {
return Belt_Option.getExn(Belt_Float.fromString(x.replace("px", "")));
return Belt_Option.getExn(Belt_Float.fromString(Js_string.replace("px", "", x)));
}

@@ -18,3 +19,3 @@

function transition(prop) {
return prop + (" " + (String(200) + "ms cubic-bezier(0.2, 0, 0, 1)"));
return prop + (" " + (String(200) + ("ms " + animationFunction)));
}

@@ -49,4 +50,3 @@

getComputedStyle ,
}
/* No side effect */

@@ -83,4 +83,3 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

Status ,
}
/* No side effect */

@@ -139,4 +139,3 @@ // Generated by ReScript, PLEASE EDIT WITH CARE

$$Selection ,
}
/* Dnd__DndContext Not a pure module */

Sorry, the diff of this file is too big to display

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