Socket
Socket
Sign inDemoInstall

uhooks-dom

Package Overview
Dependencies
5
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.5 to 0.3.0

7

async.js

@@ -1,5 +0,4 @@

self.uhooksDOM=function(e){"use strict";var t=CustomEvent;const n=(e,t,n,c)=>{const o=new WeakMap,a=new WeakMap,r=new WeakMap,l=e=>o.has(e),i=e=>{l(e)&&(u(e,e.removeEventListener,o.get(e)),o.delete(e))},u=(e,t,n)=>{t.call(e,"disconnected",n),t.call(e,"connected",n)},h=(e,t,n,s)=>{for(let{length:c}=e,o=0;o<c;o++)d(e[o],t,n,s)},d=(e,s,c,o)=>{l(e)&&!c.has(e)&&(o.delete(e),c.set(e,0),e.dispatchEvent(new(n||CustomEvent)(s))),h(e[t||"children"]||[],s,c,o)},p=new(c||MutationObserver)((e=>{for(let{length:t}=e,n=0;n<t;n++){const{removedNodes:t,addedNodes:s}=e[n];h(t,"disconnected",r,a),h(s,"connected",a,r)}}));return p.observe(e||document,{subtree:!0,childList:!0}),{has:l,connect:(e,t)=>{i(e),(t||(t={})).handleEvent||(t.handleEvent=s),u(e,e.addEventListener,t),o.set(e,t)},disconnect:i,kill(){p.disconnect()}}};function s(e){e.type in this&&this[e.type](e)}var c=Promise;let o=null,a=new Set;const r=e=>{const{$:t,r:n,h:s}=e;f(n)&&(i.get(s).delete(e),n()),f(e.r=t())&&i.get(s).add(e)},l=()=>{const e=a;a=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},i=new WeakMap,u=[],h=[];function d(e,t){return e!==this[t]}const p=()=>o,f=e=>"function"==typeof e,v=e=>{const t={h:n,c:null,a:null,e:0,i:0,s:[]};return n;function n(){const n=o;o=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{o=n,u.length&&w.then(u.forEach.bind(u.splice(0),r)),h.length&&h.splice(0).forEach(r)}}},w=new c((e=>e()));function y(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const g=(e,t)=>{const n=p(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(d,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},E=e=>(t,n)=>{const s=p(),{i:c,s:o,h:a}=s,r=c===o.length;s.i++,r&&(i.has(a)||i.set(a,new Set),o[c]={$:t,_:n,r:null,h:a}),(r||!n||n.some(d,o[c]._))&&e.push(o[c]),o[c].$=t,o[c]._=n},k=E(u),m=E(h),M=(e,t)=>f(t)?t(e):t,$=(e,t,n)=>{const s=p(),{i:c,s:o}=s;c===o.length&&o.push({$:f(n)?n(t):M(void 0,t),set:t=>{o[c].$=e(o[c].$,t),(e=>{a.has(e)||(e.e=1,a.add(e),w.then(l))})(s)}});const{$:r,set:i}=o[s.i++];return[r,i]},_=new WeakMap,b=e=>(e=>{const t=i.get(e);t&&w.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))})(_.get(e)),S=e=>(e=>i.has(e))(_.get(e)),W=e=>{const t=v(e);return _.set(n,t),n;async function n(){return await t.apply(this,arguments)}};
self.uhooksDOM=function(e){"use strict";var t=CustomEvent;function n(e){this.observe(e,{subtree:!0,childList:!0})}function s(e){e.type in this&&this[e.type](e)}var c=Promise;let o=null,a=new Set;const r=e=>{const{$:t,r:n,h:s}=e;f(n)&&(i.get(s).delete(e),n()),f(e.r=t())&&i.get(s).add(e)},l=()=>{const e=a;a=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},i=new WeakMap,u=[],h=[];function d(e,t){return e!==this[t]}const p=()=>o,f=e=>"function"==typeof e,v=e=>{const t={h:n,c:null,a:null,e:0,i:0,s:[]};return n;function n(){const n=o;o=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{o=n,u.length&&w.then(u.forEach.bind(u.splice(0),r)),h.length&&h.splice(0).forEach(r)}}},w=new c((e=>e()));function y(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const E=(e,t)=>{const n=p(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(d,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},g=e=>(t,n)=>{const s=p(),{i:c,s:o,h:a}=s,r=c===o.length;s.i++,r&&(i.has(a)||i.set(a,new Set),o[c]={$:t,_:n,r:null,h:a}),(r||!n||n.some(d,o[c]._))&&e.push(o[c]),o[c].$=t,o[c]._=n},m=g(u),k=g(h),M=(e,t)=>f(t)?t(e):t,S=(e,t,n)=>{const s=p(),{i:c,s:o}=s;c===o.length&&o.push({$:f(n)?n(t):M(void 0,t),set:t=>{o[c].$=e(o[c].$,t),(e=>{a.has(e)||(e.e=1,a.add(e),w.then(l))})(s)}});const{$:r,set:i}=o[s.i++];return[r,i]},$=new WeakMap,_=e=>(e=>{const t=i.get(e);t&&w.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))})($.get(e)),b=e=>(e=>i.has(e))($.get(e)),W=e=>{const t=v(e);return $.set(n,t),n;async function n(){return await t.apply(this,arguments)}};
/*! (c) Andrea Giammarchi - ISC */
let C=null,L=null,x=null;const O=new WeakMap,D=new WeakMap,N=(e,t,n,s)=>{const c=c=>{O.has(e)||(O.set(e,0),w.then((()=>{O.delete(e),e.apply(t,n)}))),s(c)};return D.set(s,c),c},R=(e,t,n,s)=>e?[s[0],D.get(s[1])||N(e,t,n,s[1])]:s,T=(e,t)=>{const n=W(t?async function(){const[t,s,c]=[C,L,x];[C,L,x]=[n,this,arguments];try{return await e.apply(L,x)}finally{[C,L,x]=[t,s,c]}}:e);return n};
/*! (c) Andrea Giammarchi - ISC */
let P=null;const j=({firstChild:e})=>{if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},q=e=>{const{nodeType:t}=e;if(t)return 1===t?e:j(e);{const t=e.valueOf();return t!==e?q(t):j(t)}};return e.createContext=e=>({_:new Set,provide:y,value:e}),e.hooked=(e,s)=>{const c=T(e,s);return async function(){const e=await c.apply(this,arguments);if(S(c)){const s=q(e);P||(P=n(s.ownerDocument,"children",t)),P.has(s)||P.connect(s,{disconnected(){b(c)}})}return e}},e.useCallback=(e,t)=>g((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(p()),t),e.useEffect=k,e.useLayoutEffect=m,e.useMemo=g,e.useReducer=(e,t,n)=>R(C,L,x,$(e,t,n)),e.useRef=e=>{const t=p(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>R(C,L,x,(e=>$(M,e))(e)),e.wait=w,e}({});
let C=null,L=null,x=null;const O=new WeakMap,N=new WeakMap,R=(e,t,n,s)=>{const c=c=>{O.has(e)||(O.set(e,0),w.then((()=>{O.delete(e),e.apply(t,n)}))),s(c)};return N.set(s,c),c},T=(e,t,n,s)=>e?[s[0],N.get(s[1])||R(e,t,n,s[1])]:s,D=(e,t)=>{const n=W(t?async function(){const[t,s,c]=[C,L,x];[C,L,x]=[n,this,arguments];try{return await e.apply(L,x)}finally{[C,L,x]=[t,s,c]}}:e);return n},P=((e,t,c,o)=>{const a=new WeakMap,r=new WeakMap,l=new WeakMap,i=e=>a.has(e),u=e=>{i(e)&&(h(e,e.removeEventListener,a.get(e)),a.delete(e))},h=(e,t,n)=>{t.call(e,"disconnected",n),t.call(e,"connected",n)},d=(e,t,n,s)=>{for(let{length:c}=e,o=0;o<c;o++)p(e[o],t,n,s)},p=(e,n,s,o)=>{i(e)&&!s.has(e)&&(o.delete(e),s.set(e,0),e.dispatchEvent(new(c||CustomEvent)(n))),d(e[t||"children"]||[],n,s,o)},f=new(o||MutationObserver)((e=>{for(let{length:t}=e,n=0;n<t;n++){const{removedNodes:t,addedNodes:s}=e[n];d(t,"disconnected",l,r),d(s,"connected",r,l)}}));f.add=n,f.add(e||document);const{attachShadow:v}=Element.prototype;return v&&(Element.prototype.attachShadow=function(e){const t=v.call(this,e);return f.add(t),t}),{has:i,connect:(e,t)=>{u(e),(t||(t={})).handleEvent||(t.handleEvent=s),h(e,e.addEventListener,t),a.set(e,t)},disconnect:u,kill(){f.disconnect()}}})(document,"children",t),j=({firstChild:e})=>{if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},q=e=>{const{nodeType:t}=e;if(t)return 1===t?e:j(e);{const t=e.valueOf();return t!==e?q(t):j(t)}};return e.createContext=e=>({_:new Set,provide:y,value:e}),e.hooked=(e,t)=>{const n=D(e,t);return async function(){const e=await n.apply(this,arguments);if(b(n)){const t=q(e);P.has(t)||P.connect(t,{disconnected(){_(n)}})}return e}},e.useCallback=(e,t)=>E((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(p()),t),e.useEffect=m,e.useLayoutEffect=k,e.useMemo=E,e.useReducer=(e,t,n)=>T(C,L,x,S(e,t,n)),e.useRef=e=>{const t=p(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>T(C,L,x,(e=>S(M,e))(e))
/*! (c) Andrea Giammarchi - ISC */,e.wait=w,e}({});

@@ -6,7 +6,6 @@ 'use strict';

const {observe} = require('uconnect');
const observer = observe(document, 'children', CustomEvent);
const {hooked: $hooked, dropEffect, hasEffect} = require('uhooks-fx/async');
let observer = null;
const find = ({firstChild}) => {

@@ -39,4 +38,2 @@ if (

const element = get(node);
if (!observer)
observer = observe(element.ownerDocument, 'children', CustomEvent);
if (!observer.has(element))

@@ -43,0 +40,0 @@ observer.connect(element, {

@@ -6,7 +6,6 @@ 'use strict';

const {observe} = require('uconnect');
const observer = observe(document, 'children', CustomEvent);
const {hooked: $hooked, dropEffect, hasEffect} = require('uhooks-fx');
let observer = null;
const find = ({firstChild}) => {

@@ -39,4 +38,2 @@ if (

const element = get(node);
if (!observer)
observer = observe(element.ownerDocument, 'children', CustomEvent);
if (!observer.has(element))

@@ -43,0 +40,0 @@ observer.connect(element, {

@@ -1,5 +0,4 @@

self.uhooksDOM=function(e){"use strict";var t=CustomEvent;const n=(e,t,n,c)=>{const o=new WeakMap,r=new WeakMap,l=new WeakMap,a=e=>o.has(e),u=e=>{a(e)&&(i(e,e.removeEventListener,o.get(e)),o.delete(e))},i=(e,t,n)=>{t.call(e,"disconnected",n),t.call(e,"connected",n)},h=(e,t,n,s)=>{for(let{length:c}=e,o=0;o<c;o++)d(e[o],t,n,s)},d=(e,s,c,o)=>{a(e)&&!c.has(e)&&(o.delete(e),c.set(e,0),e.dispatchEvent(new(n||CustomEvent)(s))),h(e[t||"children"]||[],s,c,o)},p=new(c||MutationObserver)((e=>{for(let{length:t}=e,n=0;n<t;n++){const{removedNodes:t,addedNodes:s}=e[n];h(t,"disconnected",l,r),h(s,"connected",r,l)}}));return p.observe(e||document,{subtree:!0,childList:!0}),{has:a,connect:(e,t)=>{u(e),(t||(t={})).handleEvent||(t.handleEvent=s),i(e,e.addEventListener,t),o.set(e,t)},disconnect:u,kill(){p.disconnect()}}};function s(e){e.type in this&&this[e.type](e)}var c=Promise;let o=null,r=new Set;const l=e=>{const{$:t,r:n,h:s}=e;w(n)&&(u.get(s).delete(e),n()),w(e.r=t())&&u.get(s).add(e)},a=()=>{const e=r;r=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},u=new WeakMap,i=[],h=[];function d(e,t){return e!==this[t]}const p=e=>{const t=u.get(e);t&&E.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))},f=()=>o,v=e=>u.has(e),w=e=>"function"==typeof e,y=e=>{const t={h:n,c:null,a:null,e:0,i:0,s:[]};return n;function n(){const n=o;o=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{o=n,i.length&&E.then(i.forEach.bind(i.splice(0),l)),h.length&&h.splice(0).forEach(l)}}},E=new c((e=>e()));function g(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const m=(e,t)=>{const n=f(),{i:s,s:c}=n;return s!==c.length&&t&&!t.some(d,c[s]._)||(c[s]={$:e(),_:t}),c[n.i++].$},k=e=>(t,n)=>{const s=f(),{i:c,s:o,h:r}=s,l=c===o.length;s.i++,l&&(u.has(r)||u.set(r,new Set),o[c]={$:t,_:n,r:null,h:r}),(l||!n||n.some(d,o[c]._))&&e.push(o[c]),o[c].$=t,o[c]._=n},M=k(i),$=k(h),_=(e,t)=>w(t)?t(e):t,b=(e,t,n)=>{const s=f(),{i:c,s:o}=s;c===o.length&&o.push({$:w(n)?n(t):_(void 0,t),set:t=>{o[c].$=e(o[c].$,t),(e=>{r.has(e)||(e.e=1,r.add(e),E.then(a))})(s)}});const{$:l,set:u}=o[s.i++];return[l,u]};
self.uhooksDOM=function(e){"use strict";var t=CustomEvent;function n(e){this.observe(e,{subtree:!0,childList:!0})}function s(e){e.type in this&&this[e.type](e)}var o=Promise;let c=null,a=new Set;const r=e=>{const{$:t,r:n,h:s}=e;w(n)&&(i.get(s).delete(e),n()),w(e.r=t())&&i.get(s).add(e)},l=()=>{const e=a;a=new Set,e.forEach((({h:e,c:t,a:n,e:s})=>{s&&e.apply(t,n)}))},i=new WeakMap,u=[],h=[];function d(e,t){return e!==this[t]}const p=e=>{const t=i.get(e);t&&E.then((()=>{t.forEach((e=>{e.r(),e.r=null})),t.clear()}))},f=()=>c,v=e=>i.has(e),w=e=>"function"==typeof e,y=e=>{const t={h:n,c:null,a:null,e:0,i:0,s:[]};return n;function n(){const n=c;c=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{c=n,u.length&&E.then(u.forEach.bind(u.splice(0),r)),h.length&&h.splice(0).forEach(r)}}},E=new o((e=>e()));function g(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const m=(e,t)=>{const n=f(),{i:s,s:o}=n;return s!==o.length&&t&&!t.some(d,o[s]._)||(o[s]={$:e(),_:t}),o[n.i++].$},k=e=>(t,n)=>{const s=f(),{i:o,s:c,h:a}=s,r=o===c.length;s.i++,r&&(i.has(a)||i.set(a,new Set),c[o]={$:t,_:n,r:null,h:a}),(r||!n||n.some(d,c[o]._))&&e.push(c[o]),c[o].$=t,c[o]._=n},M=k(u),S=k(h),$=(e,t)=>w(t)?t(e):t,_=(e,t,n)=>{const s=f(),{i:o,s:c}=s;o===c.length&&c.push({$:w(n)?n(t):$(void 0,t),set:t=>{c[o].$=e(c[o].$,t),(e=>{a.has(e)||(e.e=1,a.add(e),E.then(l))})(s)}});const{$:r,set:i}=c[s.i++];return[r,i]};
/*! (c) Andrea Giammarchi - ISC */
let S=null,C=null,W=null;const L=new WeakMap,x=new WeakMap,O=(e,t,n,s)=>{const c=c=>{L.has(e)||(L.set(e,0),E.then((()=>{L.delete(e),e.apply(t,n)}))),s(c)};return x.set(s,c),c},D=(e,t,n,s)=>e?[s[0],x.get(s[1])||O(e,t,n,s[1])]:s,N=(e,t)=>{const n=y(t?function(){const[t,s,c]=[S,C,W];[S,C,W]=[n,this,arguments];try{return e.apply(C,W)}finally{[S,C,W]=[t,s,c]}}:e);return n};
/*! (c) Andrea Giammarchi - ISC */
let R=null;const T=({firstChild:e})=>{if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},P=e=>{const{nodeType:t}=e;if(t)return 1===t?e:T(e);{const t=e.valueOf();return t!==e?P(t):T(t)}};return e.createContext=e=>({_:new Set,provide:g,value:e}),e.hooked=(e,s)=>{const c=N(e,s);return function(){const e=c.apply(this,arguments);if(v(c)){const s=P(e);R||(R=n(s.ownerDocument,"children",t)),R.has(s)||R.connect(s,{disconnected(){p(c)}})}return e}},e.useCallback=(e,t)=>m((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(f()),t),e.useEffect=M,e.useLayoutEffect=$,e.useMemo=m,e.useReducer=(e,t,n)=>D(S,C,W,b(e,t,n)),e.useRef=e=>{const t=f(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>D(S,C,W,(e=>b(_,e))(e)),e.wait=E,e}({});
let b=null,C=null,W=null;const L=new WeakMap,x=new WeakMap,O=(e,t,n,s)=>{const o=o=>{L.has(e)||(L.set(e,0),E.then((()=>{L.delete(e),e.apply(t,n)}))),s(o)};return x.set(s,o),o},N=(e,t,n,s)=>e?[s[0],x.get(s[1])||O(e,t,n,s[1])]:s,R=(e,t)=>{const n=y(t?function(){const[t,s,o]=[b,C,W];[b,C,W]=[n,this,arguments];try{return e.apply(C,W)}finally{[b,C,W]=[t,s,o]}}:e);return n},T=((e,t,o,c)=>{const a=new WeakMap,r=new WeakMap,l=new WeakMap,i=e=>a.has(e),u=e=>{i(e)&&(h(e,e.removeEventListener,a.get(e)),a.delete(e))},h=(e,t,n)=>{t.call(e,"disconnected",n),t.call(e,"connected",n)},d=(e,t,n,s)=>{for(let{length:o}=e,c=0;c<o;c++)p(e[c],t,n,s)},p=(e,n,s,c)=>{i(e)&&!s.has(e)&&(c.delete(e),s.set(e,0),e.dispatchEvent(new(o||CustomEvent)(n))),d(e[t||"children"]||[],n,s,c)},f=new(c||MutationObserver)((e=>{for(let{length:t}=e,n=0;n<t;n++){const{removedNodes:t,addedNodes:s}=e[n];d(t,"disconnected",l,r),d(s,"connected",r,l)}}));f.add=n,f.add(e||document);const{attachShadow:v}=Element.prototype;return v&&(Element.prototype.attachShadow=function(e){const t=v.call(this,e);return f.add(t),t}),{has:i,connect:(e,t)=>{u(e),(t||(t={})).handleEvent||(t.handleEvent=s),h(e,e.addEventListener,t),a.set(e,t)},disconnect:u,kill(){f.disconnect()}}})(document,"children",t),D=({firstChild:e})=>{if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},P=e=>{const{nodeType:t}=e;if(t)return 1===t?e:D(e);{const t=e.valueOf();return t!==e?P(t):D(t)}};return e.createContext=e=>({_:new Set,provide:g,value:e}),e.hooked=(e,t)=>{const n=R(e,t);return function(){const e=n.apply(this,arguments);if(v(n)){const t=P(e);T.has(t)||T.connect(t,{disconnected(){p(n)}})}return e}},e.useCallback=(e,t)=>m((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(f()),t),e.useEffect=M,e.useLayoutEffect=S,e.useMemo=m,e.useReducer=(e,t,n)=>N(b,C,W,_(e,t,n)),e.useRef=e=>{const t=f(),{i:n,s:s}=t;return n===s.length&&s.push({current:e}),s[t.i++]},e.useState=e=>N(b,C,W,(e=>_($,e))(e))
/*! (c) Andrea Giammarchi - ISC */,e.wait=E,e}({});

@@ -5,7 +5,6 @@ /*! (c) Andrea Giammarchi - ISC */

import {observe} from 'uconnect';
const observer = observe(document, 'children', CustomEvent);
import {hooked as $hooked, dropEffect, hasEffect} from 'uhooks-fx/async';
let observer = null;
const find = ({firstChild}) => {

@@ -38,4 +37,2 @@ if (

const element = get(node);
if (!observer)
observer = observe(element.ownerDocument, 'children', CustomEvent);
if (!observer.has(element))

@@ -42,0 +39,0 @@ observer.connect(element, {

@@ -5,7 +5,6 @@ /*! (c) Andrea Giammarchi - ISC */

import {observe} from 'uconnect';
const observer = observe(document, 'children', CustomEvent);
import {hooked as $hooked, dropEffect, hasEffect} from 'uhooks-fx';
let observer = null;
const find = ({firstChild}) => {

@@ -38,4 +37,2 @@ if (

const element = get(node);
if (!observer)
observer = observe(element.ownerDocument, 'children', CustomEvent);
if (!observer.has(element))

@@ -42,0 +39,0 @@ observer.connect(element, {

@@ -94,6 +94,10 @@ self.uhooksDOM = (function (exports) {

});
mo.observe(root || document, {
subtree: true,
childList: true
});
mo.add = add;
mo.add(root || document);
var attachShadow = Element.prototype.attachShadow;
if (attachShadow) Element.prototype.attachShadow = function (init) {
var sd = attachShadow.call(this, init);
mo.add(sd);
return sd;
};
return {

@@ -109,2 +113,9 @@ has: has,

function add(node) {
this.observe(node, {
subtree: true,
childList: true
});
}
function handleEvent(event) {

@@ -141,7 +152,7 @@ if (event.type in this) this[event.type](event);

if (isFunction(r)) {
fx.get(h)["delete"](effect);
fx$1.get(h)["delete"](effect);
r();
}
if (isFunction(effect.r = $())) fx.get(h).add(effect);
if (isFunction(effect.r = $())) fx$1.get(h).add(effect);
};

@@ -163,3 +174,3 @@

var fx = new WeakMap();
var fx$1 = new WeakMap();
var effects = [];

@@ -171,3 +182,3 @@ var layoutEffects = [];

var dropEffect = function dropEffect(hook) {
var effects = fx.get(hook);
var effects = fx$1.get(hook);
if (effects) wait.then(function () {

@@ -185,3 +196,3 @@ effects.forEach(function (effect) {

var hasEffect = function hasEffect(hook) {
return fx.has(hook);
return fx$1.has(hook);
};

@@ -191,3 +202,3 @@ var isFunction = function isFunction(f) {

};
var hooked = function hooked(callback) {
var hooked$2 = function hooked(callback) {
var current = {

@@ -287,3 +298,3 @@ h: hook,

if (call) {
if (!fx.has(h)) fx.set(h, new Set());
if (!fx$1.has(h)) fx$1.set(h, new Set());
s[i] = {

@@ -310,3 +321,3 @@ $: callback,

var useReducer = function useReducer(reducer, value, init) {
var useReducer$1 = function useReducer(reducer, value, init) {
var info = getInfo();

@@ -327,4 +338,4 @@ var i = info.i,

};
var useState = function useState(value) {
return useReducer(getValue, value);
var useState$1 = function useState(value) {
return useReducer$1(getValue, value);
};

@@ -346,3 +357,3 @@

a = null;
var fx$1 = new WeakMap();
var fx = new WeakMap();
var states = new WeakMap();

@@ -352,6 +363,6 @@

var wrap = function wrap(value) {
if (!fx$1.has(h)) {
fx$1.set(h, 0);
if (!fx.has(h)) {
fx.set(h, 0);
wait.then(function () {
fx$1["delete"](h);
fx["delete"](h);
h.apply(c, a);

@@ -372,4 +383,4 @@ });

var hooked$1 = function hooked$1(callback, outer) {
var hook = hooked(outer ?
var hooked$1 = function hooked(callback, outer) {
var hook = hooked$2(outer ?
/*async*/

@@ -397,11 +408,11 @@ function () {

};
var useReducer$1 = function useReducer$1(reducer, value, init) {
return wrap(h, c, a, useReducer(reducer, value, init));
var useReducer = function useReducer(reducer, value, init) {
return wrap(h, c, a, useReducer$1(reducer, value, init));
};
var useState$1 = function useState$1(value) {
return wrap(h, c, a, useState(value));
var useState = function useState(value) {
return wrap(h, c, a, useState$1(value));
};
/*! (c) Andrea Giammarchi - ISC */
var observer = null;
var observer = observe(document, 'children', CustomEvent$1);

@@ -423,3 +434,3 @@ var find = function find(_ref) {

var hooked$2 = function hooked(fn, outer) {
var hooked = function hooked(fn, outer) {
var hook = hooked$1(fn, outer);

@@ -435,3 +446,2 @@ return (

var element = get(node);
if (!observer) observer = observe(element.ownerDocument, 'children', CustomEvent$1);
if (!observer.has(element)) observer.connect(element, {

@@ -450,3 +460,3 @@ disconnected: function disconnected() {

exports.createContext = createContext;
exports.hooked = hooked$2;
exports.hooked = hooked;
exports.useCallback = useCallback;

@@ -457,5 +467,5 @@ exports.useContext = useContext;

exports.useMemo = useMemo;
exports.useReducer = useReducer$1;
exports.useReducer = useReducer;
exports.useRef = useRef;
exports.useState = useState$1;
exports.useState = useState;
exports.wait = wait;

@@ -462,0 +472,0 @@

self.uhooksDOM=function(n){"use strict";
/*! (c) Andrea Giammarchi - ISC */var e={};e.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(n){return e[n]=new e("").constructor[n],e;function e(n,e){e||(e={});var t=document.createEvent("CustomEvent");return t.initCustomEvent(n,!!e.bubbles,!!e.cancelable,e.detail),t}}("prototype");var t=e.CustomEvent,r=function(n,e,t,r){var o=new WeakMap,i=new WeakMap,c=new WeakMap,a=function(n){return o.has(n)},f=function(n){a(n)&&(s(n,n.removeEventListener,o.get(n)),o.delete(n))},s=function(n,e,t){e.call(n,"disconnected",t),e.call(n,"connected",t)},l=function(n,e,t,r){for(var u=n.length,o=0;o<u;o++)v(n[o],e,t,r)},v=function(n,r,u,o){a(n)&&!u.has(n)&&(o.delete(n),u.set(n,0),n.dispatchEvent(new(t||CustomEvent)(r))),l(n[e||"children"]||[],r,u,o)},h=new(r||MutationObserver)((function(n){for(var e=n.length,t=0;t<e;t++){var r=n[t],u=r.removedNodes,o=r.addedNodes;l(u,"disconnected",c,i),l(o,"connected",i,c)}}));return h.observe(n||document,{subtree:!0,childList:!0}),{has:a,connect:function(n,e){f(n),(e||(e={})).handleEvent||(e.handleEvent=u),s(n,n.addEventListener,e),o.set(n,e)},disconnect:f,kill:function(){h.disconnect()}}};function u(n){n.type in this&&this[n.type](n)}var o="function"==typeof Promise?Promise:function(n){var e,t=[],r=0;return n((function(n){e=n,r=1,t.splice(0).forEach(u)})),{then:u};function u(n){return r?setTimeout(n,0,e):t.push(n),this}},i=null,c=new Set,a=function(n){var e=n.$,t=n.r,r=n.h;m(t)&&(s.get(r).delete(n),t()),m(n.r=e())&&s.get(r).add(n)},f=function(){var n=c;c=new Set,n.forEach((function(n){var e=n.h,t=n.c,r=n.a;n.e&&e.apply(t,r)}))},s=new WeakMap,l=[],v=[];function h(n,e){return n!==this[e]}var d=function(n){var e=s.get(n);e&&y.then((function(){e.forEach((function(n){n.r(),n.r=null})),e.clear()}))},p=function(){return i},E=function(n){return s.has(n)},m=function(n){return"function"==typeof n},y=new o((function(n){return n()}));function w(n){var e=this._;this.value!==n&&(this._=new Set,this.value=n,e.forEach((function(n){var e=n.h,t=n.c,r=n.a;e.apply(t,r)})))}var g=function(n,e){var t=p(),r=t.i,u=t.s;return r!==u.length&&e&&!e.some(h,u[r]._)||(u[r]={$:n(),_:e}),u[t.i++].$},b=function(n){return function(e,t){var r=p(),u=r.i,o=r.s,i=r.h,c=u===o.length;r.i++,c&&(s.has(i)||s.set(i,new Set),o[u]={$:e,_:t,r:null,h:i}),(c||!t||t.some(h,o[u]._))&&n.push(o[u]),o[u].$=e,o[u]._=t}},C=b(l),k=b(v),M=function(n,e){return m(e)?e(n):e},$=function(n,e,t){var r=p(),u=r.i,o=r.s;u===o.length&&o.push({$:m(t)?t(e):M(void 0,e),set:function(e){o[u].$=n(o[u].$,e),function(n){c.has(n)||(n.e=1,c.add(n),y.then(f))}(r)}});var i=o[r.i++];return[i.$,i.set]},_=null,S=null,W=null,L=new WeakMap,x=new WeakMap,O=function(n,e,t,r){var u=function(u){L.has(n)||(L.set(n,0),y.then((function(){L.delete(n),n.apply(e,t)}))),r(u)};return x.set(r,u),u},T=function(n,e,t,r){return n?[r[0],x.get(r[1])||O(n,e,t,r[1])]:r},D=function(n,e){var t=function(n){var e={h:t,c:null,a:null,e:0,i:0,s:[]};return t;function t(){var t=i;i=e,e.e=e.i=0;try{return n.apply(e.c=this,e.a=arguments)}finally{i=t,l.length&&y.then(l.forEach.bind(l.splice(0),a)),v.length&&v.splice(0).forEach(a)}}}(e?function(){var e=_,r=S,u=W;_=t,S=this,W=arguments;try{return n.apply(S,W)}finally{_=e,S=r,W=u}}:n);return t},N=null,P=function(n){var e=n.firstChild;if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},R=function n(e){var t=e.nodeType;if(t)return 1===t?e:P(e);var r=e.valueOf();return r!==e?n(r):P(r)};return n.createContext=function(n){return{_:new Set,provide:w,value:n}},n.hooked=function(n,e){var u=D(n,e);return function(){var n=u.apply(this,arguments);if(E(u)){var e=R(n);N||(N=r(e.ownerDocument,"children",t)),N.has(e)||N.connect(e,{disconnected:function(){d(u)}})}return n}},n.useCallback=function(n,e){return g((function(){return n}),e)},n.useContext=function(n){var e=n._,t=n.value;return e.add(p()),t},n.useEffect=C,n.useLayoutEffect=k,n.useMemo=g,n.useReducer=function(n,e,t){return T(_,S,W,$(n,e,t))},n.useRef=function(n){var e=p(),t=e.i,r=e.s;return t===r.length&&r.push({current:n}),r[e.i++]},n.useState=function(n){return T(_,S,W,function(n){return $(M,n)}(n))},n.wait=y,n}({});
/*! (c) Andrea Giammarchi - ISC */var t={};t.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(n){return t[n]=new t("").constructor[n],t;function t(n,t){t||(t={});var e=document.createEvent("CustomEvent");return e.initCustomEvent(n,!!t.bubbles,!!t.cancelable,t.detail),e}}("prototype");var e=t.CustomEvent;function r(n){this.observe(n,{subtree:!0,childList:!0})}function u(n){n.type in this&&this[n.type](n)}var o="function"==typeof Promise?Promise:function(n){var t,e=[],r=0;return n((function(n){t=n,r=1,e.splice(0).forEach(u)})),{then:u};function u(n){return r?setTimeout(n,0,t):e.push(n),this}},i=null,c=new Set,a=function(n){var t=n.$,e=n.r,r=n.h;m(e)&&(s.get(r).delete(n),e()),m(n.r=t())&&s.get(r).add(n)},f=function(){var n=c;c=new Set,n.forEach((function(n){var t=n.h,e=n.c,r=n.a;n.e&&t.apply(e,r)}))},s=new WeakMap,l=[],h=[];function v(n,t){return n!==this[t]}var d=function(n){var t=s.get(n);t&&y.then((function(){t.forEach((function(n){n.r(),n.r=null})),t.clear()}))},p=function(){return i},E=function(n){return s.has(n)},m=function(n){return"function"==typeof n},y=new o((function(n){return n()}));function w(n){var t=this._;this.value!==n&&(this._=new Set,this.value=n,t.forEach((function(n){var t=n.h,e=n.c,r=n.a;t.apply(e,r)})))}var g=function(n,t){var e=p(),r=e.i,u=e.s;return r!==u.length&&t&&!t.some(v,u[r]._)||(u[r]={$:n(),_:t}),u[e.i++].$},b=function(n){return function(t,e){var r=p(),u=r.i,o=r.s,i=r.h,c=u===o.length;r.i++,c&&(s.has(i)||s.set(i,new Set),o[u]={$:t,_:e,r:null,h:i}),(c||!e||e.some(v,o[u]._))&&n.push(o[u]),o[u].$=t,o[u]._=e}},C=b(l),k=b(h),M=function(n,t){return m(t)?t(n):t},S=function(n,t,e){var r=p(),u=r.i,o=r.s;u===o.length&&o.push({$:m(e)?e(t):M(void 0,t),set:function(t){o[u].$=n(o[u].$,t),function(n){c.has(n)||(n.e=1,c.add(n),y.then(f))}(r)}});var i=o[r.i++];return[i.$,i.set]},$=null,_=null,W=null,L=new WeakMap,x=new WeakMap,O=function(n,t,e,r){var u=function(u){L.has(n)||(L.set(n,0),y.then((function(){L.delete(n),n.apply(t,e)}))),r(u)};return x.set(r,u),u},T=function(n,t,e,r){return n?[r[0],x.get(r[1])||O(n,t,e,r[1])]:r},N=function(n,t){var e=function(n){var t={h:e,c:null,a:null,e:0,i:0,s:[]};return e;function e(){var e=i;i=t,t.e=t.i=0;try{return n.apply(t.c=this,t.a=arguments)}finally{i=e,l.length&&y.then(l.forEach.bind(l.splice(0),a)),h.length&&h.splice(0).forEach(a)}}}(t?function(){var t=$,r=_,u=W;$=e,_=this,W=arguments;try{return n.apply(_,W)}finally{$=t,_=r,W=u}}:n);return e},P=function(n,t,e,o){var i=new WeakMap,c=new WeakMap,a=new WeakMap,f=function(n){return i.has(n)},s=function(n){f(n)&&(l(n,n.removeEventListener,i.get(n)),i.delete(n))},l=function(n,t,e){t.call(n,"disconnected",e),t.call(n,"connected",e)},h=function(n,t,e,r){for(var u=n.length,o=0;o<u;o++)v(n[o],t,e,r)},v=function(n,r,u,o){f(n)&&!u.has(n)&&(o.delete(n),u.set(n,0),n.dispatchEvent(new(e||CustomEvent)(r))),h(n[t||"children"]||[],r,u,o)},d=new(o||MutationObserver)((function(n){for(var t=n.length,e=0;e<t;e++){var r=n[e],u=r.removedNodes,o=r.addedNodes;h(u,"disconnected",a,c),h(o,"connected",c,a)}}));d.add=r,d.add(n||document);var p=Element.prototype.attachShadow;return p&&(Element.prototype.attachShadow=function(n){var t=p.call(this,n);return d.add(t),t}),{has:f,connect:function(n,t){s(n),(t||(t={})).handleEvent||(t.handleEvent=u),l(n,n.addEventListener,t),i.set(n,t)},disconnect:s,kill:function(){d.disconnect()}}}(document,"children",e),R=function(n){var t=n.firstChild;if(t&&1!==t.nodeType&&!(t=t.nextElementSibling))throw"unobservable";return t},D=function n(t){var e=t.nodeType;if(e)return 1===e?t:R(t);var r=t.valueOf();return r!==t?n(r):R(r)};return n.createContext=function(n){return{_:new Set,provide:w,value:n}},n.hooked=function(n,t){var e=N(n,t);return function(){var n=e.apply(this,arguments);if(E(e)){var t=D(n);P.has(t)||P.connect(t,{disconnected:function(){d(e)}})}return n}},n.useCallback=function(n,t){return g((function(){return n}),t)},n.useContext=function(n){var t=n._,e=n.value;return t.add(p()),e},n.useEffect=C,n.useLayoutEffect=k,n.useMemo=g,n.useReducer=function(n,t,e){return T($,_,W,S(n,t,e))},n.useRef=function(n){var t=p(),e=t.i,r=t.s;return e===r.length&&r.push({current:n}),r[t.i++]},n.useState=function(n){return T($,_,W,function(n){return S(M,n)}(n))},n.wait=y,n}({});
{
"name": "uhooks-dom",
"version": "0.2.5",
"version": "0.3.0",
"description": "A uhooks + uconnect based alternative to dom-augmentor",

@@ -25,12 +25,12 @@ "main": "./cjs/index.js",

"devDependencies": {
"@babel/core": "^7.12.17",
"@babel/preset-env": "^7.12.17",
"@babel/core": "^7.14.0",
"@babel/preset-env": "^7.14.1",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@ungap/degap": "^0.2.4",
"@rollup/plugin-node-resolve": "^13.0.0",
"@ungap/degap": "^0.2.6",
"ascjs": "^5.0.1",
"rollup": "^2.39.0",
"rollup": "^2.47.0",
"rollup-plugin-includepaths": "^0.2.4",
"rollup-plugin-terser": "^7.0.2",
"terser": "^5.6.0"
"terser": "^5.7.0"
},

@@ -53,3 +53,3 @@ "module": "./esm/index.js",

"@ungap/custom-event": "^0.3.1",
"uconnect": "^0.2.8",
"uconnect": "^0.3.0",
"uhooks-fx": "^0.2.4"

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc