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

use-descendants

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-descendants - npm Package Compare versions

Comparing version 0.0.2-beta.0 to 0.0.2-beta.1

2

dist/index.js

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

var e,r,t=require("react");function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u="undefined"!=typeof window&&(null==(e=window)||null==(r=e.document)?void 0:r.createElement)?t.useLayoutEffect:t.useEffect;exports.createDescendants=function(){return t.createContext({})},exports.useDescendant=function(e,r){var c,a=t.useRef(-1),o=t.useRef(),i=t.useContext(e),f=i.list,s=i.map,d=i.force,l=t.useRef("_"+Math.random().toString(36).substr(2,9));return u(function(){return s.current[l.current]=n({},r,{_internalId:l.current}),d({}),function(){delete s.current[l.current],f.current=f.current.filter(function(e){return e._internalId!==l.current}),a.current=-1,l.current=void 0,d({})}},[]),u(function(){o.current&&o.current.setAttribute("data-descendant",l.current)}),(null==(c=s.current)?void 0:c[l.current])&&(s.current[l.current]=n({},r,{_internalId:l.current})),a.current=f.current.findIndex(function(e){return e._internalId===l.current}),{index:a.current,ref:o,id:l.current}},exports.useDescendants=function(){var e=t.useRef([]),r=t.useRef({}),c=t.useState()[1],a=t.useRef();return u(function(){if(a.current){var t=Array.from(a.current.querySelectorAll("[data-descendant]"));(t.length!==e.current.length||!t.every(function(r,t){return e.current[t].element===r}))&&(e.current=t.map(function(e){var t=r.current[e.getAttribute("data-descendant")];return n({element:e},t)}),c({}))}}),{ref:a,list:e,map:r,force:c}},exports.useIsomorphicLayoutEffect=u;
var e,r,t=require("react");function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u="undefined"!=typeof window&&(null==(e=window)||null==(r=e.document)?void 0:r.createElement)?t.useLayoutEffect:t.useEffect;exports.createDescendants=function(){return t.createContext({})},exports.useDescendant=function(e,r){var c=t.useRef(-1),a=t.useRef(),o=t.useContext(e),i=o.list,f=o.map,s=o.force,d=t.useRef(null);return u(function(){return null===d.current&&(d.current="_"+Math.random().toString(36).substr(2,9)),f.current[d.current]=n({},r,{_internalId:d.current}),s({}),function(){delete f.current[d.current],i.current=i.current.filter(function(e){return e._internalId!==d.current}),c.current=-1,d.current=void 0,s({})}},[]),u(function(){var e;a.current&&a.current.setAttribute("data-descendant",d.current),(null==(e=f.current)?void 0:e[d.current])&&(f.current[d.current]=n({},r,{_internalId:d.current})),c.current=i.current.findIndex(function(e){return e._internalId===d.current})}),{index:c.current,ref:a,id:d.current}},exports.useDescendants=function(){var e=t.useRef([]),r=t.useRef({}),c=t.useState()[1],a=t.useRef();return u(function(){if(a.current){var t=Array.from(a.current.querySelectorAll("[data-descendant]"));(t.length!==e.current.length||!t.every(function(r,t){return e.current[t].element===r}))&&(e.current=t.map(function(e){var t=r.current[e.getAttribute("data-descendant")];return n({element:e},t)}),c({}))}}),{ref:a,list:e,map:r,force:c}},exports.useIsomorphicLayoutEffect=u;

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

import{createContext as r,useRef as n,useState as t,useContext as e,useLayoutEffect as u,useEffect as c}from"react";function i(){return(i=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r}).apply(this,arguments)}var o,a,d=function(){return r({})},f=function(){var r=n([]),e=n({}),u=t()[1],c=n();return s(function(){if(c.current){var n=Array.from(c.current.querySelectorAll("[data-descendant]"));(n.length!==r.current.length||!n.every(function(n,t){return r.current[t].element===n}))&&(r.current=n.map(function(r){var n=e.current[r.getAttribute("data-descendant")];return i({element:r},n)}),u({}))}}),{ref:c,list:r,map:e,force:u}},l=function(r,t){var u,c=n(-1),o=n(),a=e(r),d=a.list,f=a.map,l=a.force,v=n("_"+Math.random().toString(36).substr(2,9));return s(function(){return f.current[v.current]=i({},t,{_internalId:v.current}),l({}),function(){delete f.current[v.current],d.current=d.current.filter(function(r){return r._internalId!==v.current}),c.current=-1,v.current=void 0,l({})}},[]),s(function(){o.current&&o.current.setAttribute("data-descendant",v.current)}),(null==(u=f.current)?void 0:u[v.current])&&(f.current[v.current]=i({},t,{_internalId:v.current})),c.current=d.current.findIndex(function(r){return r._internalId===v.current}),{index:c.current,ref:o,id:v.current}},s="undefined"!=typeof window&&(null==(o=window)||null==(a=o.document)?void 0:a.createElement)?u:c;export{d as createDescendants,l as useDescendant,f as useDescendants,s as useIsomorphicLayoutEffect};
import{createContext as r,useRef as n,useState as t,useContext as e,useLayoutEffect as u,useEffect as c}from"react";function i(){return(i=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r}).apply(this,arguments)}var a,o,l=function(){return r({})},d=function(){var r=n([]),e=n({}),u=t()[1],c=n();return v(function(){if(c.current){var n=Array.from(c.current.querySelectorAll("[data-descendant]"));(n.length!==r.current.length||!n.every(function(n,t){return r.current[t].element===n}))&&(r.current=n.map(function(r){var n=e.current[r.getAttribute("data-descendant")];return i({element:r},n)}),u({}))}}),{ref:c,list:r,map:e,force:u}},f=function(r,t){var u=n(-1),c=n(),a=e(r),o=a.list,l=a.map,d=a.force,f=n(null);return v(function(){return null===f.current&&(f.current="_"+Math.random().toString(36).substr(2,9)),l.current[f.current]=i({},t,{_internalId:f.current}),d({}),function(){delete l.current[f.current],o.current=o.current.filter(function(r){return r._internalId!==f.current}),u.current=-1,f.current=void 0,d({})}},[]),v(function(){var r;c.current&&c.current.setAttribute("data-descendant",f.current),(null==(r=l.current)?void 0:r[f.current])&&(l.current[f.current]=i({},t,{_internalId:f.current})),u.current=o.current.findIndex(function(r){return r._internalId===f.current})}),{index:u.current,ref:c,id:f.current}},v="undefined"!=typeof window&&(null==(a=window)||null==(o=a.document)?void 0:o.createElement)?u:c;export{l as createDescendants,f as useDescendant,d as useDescendants,v as useIsomorphicLayoutEffect};

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).useDescendants={},e.react)}(this,function(e,t){var r,n;function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var c="undefined"!=typeof window&&(null==(r=window)||null==(n=r.document)?void 0:n.createElement)?t.useLayoutEffect:t.useEffect;e.createDescendants=function(){return t.createContext({})},e.useDescendant=function(e,r){var n,f=t.useRef(-1),o=t.useRef(),a=t.useContext(e),i=a.list,s=a.map,d=a.force,l=t.useRef("_"+Math.random().toString(36).substr(2,9));return c(function(){return s.current[l.current]=u({},r,{_internalId:l.current}),d({}),function(){delete s.current[l.current],i.current=i.current.filter(function(e){return e._internalId!==l.current}),f.current=-1,l.current=void 0,d({})}},[]),c(function(){o.current&&o.current.setAttribute("data-descendant",l.current)}),(null==(n=s.current)?void 0:n[l.current])&&(s.current[l.current]=u({},r,{_internalId:l.current})),f.current=i.current.findIndex(function(e){return e._internalId===l.current}),{index:f.current,ref:o,id:l.current}},e.useDescendants=function(){var e=t.useRef([]),r=t.useRef({}),n=t.useState()[1],f=t.useRef();return c(function(){if(f.current){var t=Array.from(f.current.querySelectorAll("[data-descendant]"));(t.length!==e.current.length||!t.every(function(t,r){return e.current[r].element===t}))&&(e.current=t.map(function(e){var t=r.current[e.getAttribute("data-descendant")];return u({element:e},t)}),n({}))}}),{ref:f,list:e,map:r,force:n}},e.useIsomorphicLayoutEffect=c});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],r):r((e=e||self).useDescendants={},e.react)}(this,function(e,r){var t,n;function u(){return(u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var c="undefined"!=typeof window&&(null==(t=window)||null==(n=t.document)?void 0:n.createElement)?r.useLayoutEffect:r.useEffect;e.createDescendants=function(){return r.createContext({})},e.useDescendant=function(e,t){var n=r.useRef(-1),f=r.useRef(),o=r.useContext(e),a=o.list,i=o.map,s=o.force,d=r.useRef(null);return c(function(){return null===d.current&&(d.current="_"+Math.random().toString(36).substr(2,9)),i.current[d.current]=u({},t,{_internalId:d.current}),s({}),function(){delete i.current[d.current],a.current=a.current.filter(function(e){return e._internalId!==d.current}),n.current=-1,d.current=void 0,s({})}},[]),c(function(){var e;f.current&&f.current.setAttribute("data-descendant",d.current),(null==(e=i.current)?void 0:e[d.current])&&(i.current[d.current]=u({},t,{_internalId:d.current})),n.current=a.current.findIndex(function(e){return e._internalId===d.current})}),{index:n.current,ref:f,id:d.current}},e.useDescendants=function(){var e=r.useRef([]),t=r.useRef({}),n=r.useState()[1],f=r.useRef();return c(function(){if(f.current){var r=Array.from(f.current.querySelectorAll("[data-descendant]"));(r.length!==e.current.length||!r.every(function(r,t){return e.current[t].element===r}))&&(e.current=r.map(function(e){var r=t.current[e.getAttribute("data-descendant")];return u({element:e},r)}),n({}))}}),{ref:f,list:e,map:t,force:n}},e.useIsomorphicLayoutEffect=c});
{
"name": "use-descendants",
"version": "0.0.2-beta.0",
"version": "0.0.2-beta.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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