New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dnd-kit/utilities

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnd-kit/utilities - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2-next-20211113141216

6

CHANGELOG.md
# @dnd-kit/utilities
## 3.0.2-next-20211113141216
### Patch Changes
- [#532](https://github.com/clauderic/dnd-kit/pull/532) [`dfa8d69`](https://github.com/clauderic/dnd-kit/commit/dfa8d69d98e8f271b29fa516cc13b8cd0c01d371) Thanks [@Nauss](https://github.com/Nauss)! - fix: `isWindow` has been updated to support checking wether an element is a window object in Electron applications.
## 3.0.1

@@ -4,0 +10,0 @@

4

dist/utilities.cjs.development.js

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

function isWindow(element) {
return Object.prototype.toString.call(element) === '[object Window]';
const elementString = Object.prototype.toString.call(element);
return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global]
elementString === '[object global]';
}

@@ -21,0 +23,0 @@

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");const t="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function n(e){return"[object Window]"===Object.prototype.toString.call(e)}function r(e){return"nodeType"in e}function o(e){var t,o;return e?n(e)?e:r(e)&&null!=(t=null==(o=e.ownerDocument)?void 0:o.defaultView)?t:window:window}function u(e){const{Document:t}=o(e);return e instanceof t}function c(e){return!n(e)&&e instanceof o(e).HTMLElement}const s=t?e.useLayoutEffect:e.useEffect;let i={};function a(e){return(t,...n)=>n.reduce((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t},{...t})}const l=a(1),f=a(-1);function d(e){return"clientX"in e&&"clientY"in e}function p(e){if(!e)return!1;const{TouchEvent:t}=o(e.target);return t&&e instanceof t}const x=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return`translate3d(${t?Math.round(t):0}px, ${n?Math.round(n):0}px, 0)`}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return`scaleX(${t}) scaleY(${n})`}},Transform:{toString(e){if(e)return[x.Translate.toString(e),x.Scale.toString(e)].join(" ")}},Transition:{toString:({property:e,duration:t,easing:n})=>`${e} ${t}ms ${n}`}});exports.CSS=x,exports.add=l,exports.canUseDOM=t,exports.getEventCoordinates=function(e){if(p(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return d(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}},exports.getOwnerDocument=function(e){return e?n(e)?e.document:r(e)?u(e)?e:c(e)?e.ownerDocument:document:document:document},exports.getWindow=o,exports.hasViewportRelativeCoordinates=d,exports.isDocument=u,exports.isHTMLElement=c,exports.isKeyboardEvent=function(e){if(!e)return!1;const{KeyboardEvent:t}=o(e.target);return t&&e instanceof t},exports.isNode=r,exports.isSVGElement=function(e){return e instanceof o(e).SVGElement},exports.isTouchEvent=p,exports.isWindow=n,exports.subtract=f,exports.useCombinedRefs=function(...t){return e.useMemo(()=>e=>{t.forEach(t=>t(e))},t)},exports.useInterval=function(){const t=e.useRef(null);return[e.useCallback((e,n)=>{t.current=setInterval(e,n)},[]),e.useCallback(()=>{null!==t.current&&(clearInterval(t.current),t.current=null)},[])]},exports.useIsomorphicLayoutEffect=s,exports.useLazyMemo=function(t,n){const r=e.useRef();return e.useMemo(()=>{const e=t(r.current);return r.current=e,e},[...n])},exports.useNodeRef=function(){const t=e.useRef(null),n=e.useCallback(e=>{t.current=e},[]);return[t,n]},exports.useUniqueId=function(t,n){return e.useMemo(()=>{if(n)return n;const e=null==i[t]?0:i[t]+1;return i[t]=e,`${t}-${e}`},[t,n])};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");const t="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function n(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function r(e){return"nodeType"in e}function o(e){var t,o;return e?n(e)?e:r(e)&&null!=(t=null==(o=e.ownerDocument)?void 0:o.defaultView)?t:window:window}function u(e){const{Document:t}=o(e);return e instanceof t}function c(e){return!n(e)&&e instanceof o(e).HTMLElement}const s=t?e.useLayoutEffect:e.useEffect;let i={};function a(e){return(t,...n)=>n.reduce((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t},{...t})}const l=a(1),f=a(-1);function d(e){return"clientX"in e&&"clientY"in e}function p(e){if(!e)return!1;const{TouchEvent:t}=o(e.target);return t&&e instanceof t}const x=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return`translate3d(${t?Math.round(t):0}px, ${n?Math.round(n):0}px, 0)`}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return`scaleX(${t}) scaleY(${n})`}},Transform:{toString(e){if(e)return[x.Translate.toString(e),x.Scale.toString(e)].join(" ")}},Transition:{toString:({property:e,duration:t,easing:n})=>`${e} ${t}ms ${n}`}});exports.CSS=x,exports.add=l,exports.canUseDOM=t,exports.getEventCoordinates=function(e){if(p(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return d(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}},exports.getOwnerDocument=function(e){return e?n(e)?e.document:r(e)?u(e)?e:c(e)?e.ownerDocument:document:document:document},exports.getWindow=o,exports.hasViewportRelativeCoordinates=d,exports.isDocument=u,exports.isHTMLElement=c,exports.isKeyboardEvent=function(e){if(!e)return!1;const{KeyboardEvent:t}=o(e.target);return t&&e instanceof t},exports.isNode=r,exports.isSVGElement=function(e){return e instanceof o(e).SVGElement},exports.isTouchEvent=p,exports.isWindow=n,exports.subtract=f,exports.useCombinedRefs=function(...t){return e.useMemo(()=>e=>{t.forEach(t=>t(e))},t)},exports.useInterval=function(){const t=e.useRef(null);return[e.useCallback((e,n)=>{t.current=setInterval(e,n)},[]),e.useCallback(()=>{null!==t.current&&(clearInterval(t.current),t.current=null)},[])]},exports.useIsomorphicLayoutEffect=s,exports.useLazyMemo=function(t,n){const r=e.useRef();return e.useMemo(()=>{const e=t(r.current);return r.current=e,e},[...n])},exports.useNodeRef=function(){const t=e.useRef(null),n=e.useCallback(e=>{t.current=e},[]);return[t,n]},exports.useUniqueId=function(t,n){return e.useMemo(()=>{if(n)return n;const e=null==i[t]?0:i[t]+1;return i[t]=e,`${t}-${e}`},[t,n])};
//# sourceMappingURL=utilities.cjs.production.min.js.map

@@ -14,3 +14,5 @@ import { useMemo, useLayoutEffect, useEffect, useRef, useCallback } from 'react';

function isWindow(element) {
return Object.prototype.toString.call(element) === '[object Window]';
const elementString = Object.prototype.toString.call(element);
return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global]
elementString === '[object global]';
}

@@ -17,0 +19,0 @@

{
"name": "@dnd-kit/utilities",
"version": "3.0.1",
"version": "3.0.2-next-20211113141216",
"description": "Internal utilities to bee shared between `@dnd-kit` packages",

@@ -5,0 +5,0 @@ "author": "Claudéric Demers",

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

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