dom-augmentor
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -192,8 +192,3 @@ var augmentor = (function (exports) { | ||
context = this; | ||
try { | ||
return augmented.apply(this, arguments); | ||
} finally { | ||
context = null; | ||
} | ||
return augmented.apply(this, arguments); | ||
}; | ||
@@ -200,0 +195,0 @@ }; |
/*! (c) Andrea Giammarchi - ISC */ | ||
var augmentor=function(e){"use strict";var n={};n.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(e){return n.prototype=new n("").constructor.prototype,n;function n(e,n){n||(n={});var t=document.createEvent("CustomEvent");return t.initCustomEvent(e,!!n.bubbles,!!n.cancelable,n.detail),t}}();var t=n.CustomEvent,r={};try{r.WeakSet=WeakSet}catch(e){!function(e){var n=new e,t=u.prototype;function u(t){n.set(this,new e),t&&t.forEach(this.add,this)}t.add=function(e){return n.get(this).set(e,1),this},t.delete=function(e){return n.get(this).delete(e)},t.has=function(e){return n.get(this).has(e)},r.WeakSet=u}(WeakMap)}var u=r.WeakSet;var a=null,o=function(e){e()},c=function(e){var n=[];return function t(){var r=a,u=[],c=0;a={hook:t,args:arguments,stack:n,get index(){return c++},after:u};try{return e.apply(null,arguments)}finally{a=r,u.forEach(o)}}},i=function(){return a};function s(e,n){return e!==this[n]}var f=function(e){return"function"==typeof e},l="function"==typeof cancelAnimationFrame,v=l?cancelAnimationFrame:clearTimeout,d=l?requestAnimationFrame:setTimeout;function h(e){var n,t,r,u,a;return c(),function(e,c,s){return r=e,u=c,a=s,t||(t=d(o)),--n<0&&i(!0),i};function o(){c(),r.apply(u,a||[])}function c(){n=e||1/0,t=l?0:null}function i(e){var n=!!t;return n&&(v(t),e&&o()),n}}var p=new WeakMap,m=function(e){var n=i(),t=n.hook,r=n.args,u=n.stack,a=n.index;return u.length<=a&&(u[a]=f(e)?e():e,p.has(t)||p.set(t,h())),[u[a],function(e){u[a]=f(e)?e(u[a]):e,p.get(t)(t,null,r)}]},g=new WeakMap,k=function(e){var n=e.hook,t=e.args;n.apply(null,t)};function y(e){this.value!==e&&(this.value=e,g.get(this).forEach(k))}function E(e){return e.hook===this.hook}var w=new WeakMap,b=function(){},W=function(e){return function(n,t){var r=i(),u=r.hook,a=r.stack,o=r.index,c=r.after;if(o<a.length){var f=a[o],l=f.clean,v=f.update,d=f.values;if(!t||t.some(s,d)){f.values=t,l&&(f.clean=null,l());var p=function(){f.clean=n()};e?c.push(p):v(p)}}else{w.has(u)||w.set(u,{stack:[],update:h()});var m=w.get(u),g={clean:null,stop:b,update:m.update,values:t};a[o]=g,m.stack.push(g);var k=function(){g.clean=n()};e?c.push(k):g.stop=m.update(k)}}},C=W(!1),N=W(!0),x=function(e,n){var t=i(),r=t.stack,u=t.index;return(!n||r.length<=u||n.some(s,r[u].values))&&(r[u]={current:e(),values:n}),r[u].current},M=function(e){var n=e.Event,t=e.WeakSet,r=!0,u=null;return function(e){return r&&(r=!r,u=new t,function(e){var r=new t,a=new t;try{new MutationObserver(s).observe(e,{subtree:!0,childList:!0})}catch(n){var o=0,c=[],i=function(e){c.push(e),clearTimeout(o),o=setTimeout(function(){s(c.splice(o=0,c.length))},0)};e.addEventListener("DOMNodeRemoved",function(e){i({addedNodes:[],removedNodes:[e.target]})},!0),e.addEventListener("DOMNodeInserted",function(e){i({addedNodes:[e.target],removedNodes:[]})},!0)}function s(e){for(var n,t=e.length,u=0;u<t;u++)f((n=e[u]).removedNodes,"disconnected",a,r),f(n.addedNodes,"connected",r,a)}function f(e,t,r,u){for(var a,o=new n(t),c=e.length,i=0;i<c;1===(a=e[i++]).nodeType&&l(a,o,t,r,u));}function l(e,n,t,r,a){u.has(e)&&!r.has(e)&&(a.delete(e),r.add(e),e.dispatchEvent(n));for(var o=e.children||[],c=o.length,i=0;i<c;l(o[i++],n,t,r,a));}}(e.ownerDocument)),u.add(e),e}}({Event:t,WeakSet:u});return e.augmentor=function(e){var n=c(e),t=function(e){w.has(e)&&w.get(e).stack.forEach(function(e){var n=e.clean;(0,e.stop)(),n&&(e.clean=null,n())})}.bind(null,n);return function(){return function e(n,t){var r=n.nodeType;if(r){var u=1===r?n:function(e){for(var n=e.childNodes,t=n.length,r=0;r<t;){var u=n[r++];if(1===u.nodeType)return u}throw"unobservable"}(n);M(u),u.addEventListener("disconnected",t,!1)}else{var a=n.valueOf();a!==n&&e(a,t)}return n}(n.apply(this,arguments),t)}},e.contextual=function(e){var n=null,t=c(function(){return e.apply(n,arguments)});return function(){n=this;try{return t.apply(this,arguments)}finally{n=null}}},e.createContext=function(e){var n={value:e,provide:y};return g.set(n,[]),n},e.useCallback=function(e,n){return x(function(){return e},n)},e.useContext=function(e){var n=i(),t=n.hook,r=n.args,u=g.get(e),a={hook:t,args:r};return u.some(E,a)||u.push(a),e.value},e.useEffect=C,e.useLayoutEffect=N,e.useMemo=x,e.useReducer=function(e,n,t){var r=m(t?t(n):n);return[r[0],function(n){r[1](e(r[0],n))}]},e.useRef=function(e){var n=i(),t=n.stack,r=n.index;return r<t.length?t[r]:t[r]={current:e}},e.useState=m,e}({}); | ||
var augmentor=function(e){"use strict";var n={};n.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(e){return n.prototype=new n("").constructor.prototype,n;function n(e,n){n||(n={});var t=document.createEvent("CustomEvent");return t.initCustomEvent(e,!!n.bubbles,!!n.cancelable,n.detail),t}}();var t=n.CustomEvent,r={};try{r.WeakSet=WeakSet}catch(e){!function(e){var n=new e,t=u.prototype;function u(t){n.set(this,new e),t&&t.forEach(this.add,this)}t.add=function(e){return n.get(this).set(e,1),this},t.delete=function(e){return n.get(this).delete(e)},t.has=function(e){return n.get(this).has(e)},r.WeakSet=u}(WeakMap)}var u=r.WeakSet;var a=null,o=function(e){e()},c=function(e){var n=[];return function t(){var r=a,u=[],c=0;a={hook:t,args:arguments,stack:n,get index(){return c++},after:u};try{return e.apply(null,arguments)}finally{a=r,u.forEach(o)}}},i=function(){return a};function s(e,n){return e!==this[n]}var f=function(e){return"function"==typeof e},l="function"==typeof cancelAnimationFrame,v=l?cancelAnimationFrame:clearTimeout,d=l?requestAnimationFrame:setTimeout;function h(e){var n,t,r,u,a;return c(),function(e,c,s){return r=e,u=c,a=s,t||(t=d(o)),--n<0&&i(!0),i};function o(){c(),r.apply(u,a||[])}function c(){n=e||1/0,t=l?0:null}function i(e){var n=!!t;return n&&(v(t),e&&o()),n}}var p=new WeakMap,m=function(e){var n=i(),t=n.hook,r=n.args,u=n.stack,a=n.index;return u.length<=a&&(u[a]=f(e)?e():e,p.has(t)||p.set(t,h())),[u[a],function(e){u[a]=f(e)?e(u[a]):e,p.get(t)(t,null,r)}]},g=new WeakMap,k=function(e){var n=e.hook,t=e.args;n.apply(null,t)};function y(e){this.value!==e&&(this.value=e,g.get(this).forEach(k))}function E(e){return e.hook===this.hook}var w=new WeakMap,b=function(){},W=function(e){return function(n,t){var r=i(),u=r.hook,a=r.stack,o=r.index,c=r.after;if(o<a.length){var f=a[o],l=f.clean,v=f.update,d=f.values;if(!t||t.some(s,d)){f.values=t,l&&(f.clean=null,l());var p=function(){f.clean=n()};e?c.push(p):v(p)}}else{w.has(u)||w.set(u,{stack:[],update:h()});var m=w.get(u),g={clean:null,stop:b,update:m.update,values:t};a[o]=g,m.stack.push(g);var k=function(){g.clean=n()};e?c.push(k):g.stop=m.update(k)}}},C=W(!1),N=W(!0),x=function(e,n){var t=i(),r=t.stack,u=t.index;return(!n||r.length<=u||n.some(s,r[u].values))&&(r[u]={current:e(),values:n}),r[u].current},M=function(e){var n=e.Event,t=e.WeakSet,r=!0,u=null;return function(e){return r&&(r=!r,u=new t,function(e){var r=new t,a=new t;try{new MutationObserver(s).observe(e,{subtree:!0,childList:!0})}catch(n){var o=0,c=[],i=function(e){c.push(e),clearTimeout(o),o=setTimeout(function(){s(c.splice(o=0,c.length))},0)};e.addEventListener("DOMNodeRemoved",function(e){i({addedNodes:[],removedNodes:[e.target]})},!0),e.addEventListener("DOMNodeInserted",function(e){i({addedNodes:[e.target],removedNodes:[]})},!0)}function s(e){for(var n,t=e.length,u=0;u<t;u++)f((n=e[u]).removedNodes,"disconnected",a,r),f(n.addedNodes,"connected",r,a)}function f(e,t,r,u){for(var a,o=new n(t),c=e.length,i=0;i<c;1===(a=e[i++]).nodeType&&l(a,o,t,r,u));}function l(e,n,t,r,a){u.has(e)&&!r.has(e)&&(a.delete(e),r.add(e),e.dispatchEvent(n));for(var o=e.children||[],c=o.length,i=0;i<c;l(o[i++],n,t,r,a));}}(e.ownerDocument)),u.add(e),e}}({Event:t,WeakSet:u});return e.augmentor=function(e){var n=c(e),t=function(e){w.has(e)&&w.get(e).stack.forEach(function(e){var n=e.clean;(0,e.stop)(),n&&(e.clean=null,n())})}.bind(null,n);return function(){return function e(n,t){var r=n.nodeType;if(r){var u=1===r?n:function(e){for(var n=e.childNodes,t=n.length,r=0;r<t;){var u=n[r++];if(1===u.nodeType)return u}throw"unobservable"}(n);M(u),u.addEventListener("disconnected",t,!1)}else{var a=n.valueOf();a!==n&&e(a,t)}return n}(n.apply(this,arguments),t)}},e.contextual=function(e){var n=null,t=c(function(){return e.apply(n,arguments)});return function(){return n=this,t.apply(this,arguments)}},e.createContext=function(e){var n={value:e,provide:y};return g.set(n,[]),n},e.useCallback=function(e,n){return x(function(){return e},n)},e.useContext=function(e){var n=i(),t=n.hook,r=n.args,u=g.get(e),a={hook:t,args:r};return u.some(E,a)||u.push(a),e.value},e.useEffect=C,e.useLayoutEffect=N,e.useMemo=x,e.useReducer=function(e,n,t){var r=m(t?t(n):n);return[r[0],function(n){r[1](e(r[0],n))}]},e.useRef=function(e){var n=i(),t=n.stack,r=n.index;return r<t.length?t[r]:t[r]={current:e}},e.useState=m,e}({}); |
{ | ||
"name": "dom-augmentor", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "DOM oriented useEffect hooks for the augmentor", | ||
@@ -35,3 +35,3 @@ "main": "cjs/index.js", | ||
"@ungap/weakset": "^0.1.5", | ||
"augmentor": "^1.2.0", | ||
"augmentor": "^1.2.2", | ||
"disconnected": "^0.2.1" | ||
@@ -38,0 +38,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25897
561
Updatedaugmentor@^1.2.2