as-custom-element
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -1,1 +0,1 @@ | ||
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a=((e,a)=>{const r=new WeakMap,l=new WeakMap,{filter:n}=[],c=(e,t)=>{for(let a=0,{length:r}=e;a<r;a++){const{target:r,attributeName:n,oldValue:c}=e[a],o=r.getAttribute(n);l.get(t).call(r,n,c,o)}},o=e=>"querySelectorAll"in e,s=e=>{for(let t=0,{length:a}=e;t<a;t++){const{addedNodes:a,removedNodes:r}=e[t];u(n.call(a,o),"c",new Set),u(n.call(r,o),"d",new Set)}},u=(e,l,n)=>{for(let c=0,{length:o}=e;c<o;c++){const o=e[c];n.has(o)||(n.add(o),r.has(o)?r.get(o)[l].forEach(t,o):"c"===l&&a(o),u(o.querySelectorAll("*"),l,n))}},d=new MutationObserver(s);return d.observe(e,{childList:!0,subtree:!0}),(e,{connectedCallback:t,disconnectedCallback:a,observedAttributes:n,attributeChangedCallback:o})=>{s(d.takeRecords());const{c:u,d:i}=r.get(e)||(e=>{const t={c:new Set,d:new Set};return r.set(e,t),t})(e);if(n){const t=new MutationObserver(c);t.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:n.map(t=>(e.hasAttribute(t)&&o.call(e,t,null,e.getAttribute(t)),t))}),l.set(t,o)}return a&&i.add(a),t&&(u.add(t),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||t.call(e)),e}})(document,()=>{});return e.default=a,e}({}).default; | ||
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a=((e,a,r)=>{const l=new WeakMap,n=new WeakMap,{filter:c}=[],o=(e,t)=>{for(let a=0,{length:r}=e;a<r;a++){const{target:r,attributeName:l,oldValue:c}=e[a],o=r.getAttribute(l);n.get(t).call(r,l,c,o)}},s=e=>"querySelectorAll"in e,u=e=>{if(r.length)for(let t=0,{length:a}=e;t<a;t++){const{addedNodes:a,removedNodes:r}=e[t];d(c.call(a,s),"c",new Set),d(c.call(r,s),"d",new Set)}},d=(e,n,c)=>{for(let o=0,{length:s}=e;o<s;o++){const s=e[o];c.has(s)||(c.add(s),l.has(s)?l.get(s)[n].forEach(t,s):"c"===n&&a(s),d(s.querySelectorAll(r),n,c))}},i=new MutationObserver(u);return i.observe(e,{childList:!0,subtree:!0}),(e,{connectedCallback:t,disconnectedCallback:a,observedAttributes:r,attributeChangedCallback:c})=>{u(i.takeRecords());const{c:s,d:d}=l.get(e)||(e=>{const t={c:new Set,d:new Set};return l.set(e,t),t})(e);if(r){const t=new MutationObserver(o);t.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:r.map(t=>(e.hasAttribute(t)&&c.call(e,t,null,e.getAttribute(t)),t))}),n.set(t,c)}return a&&d.add(a),t&&(s.add(t),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||t.call(e)),e}})(document,()=>{},["*"]);return e.default=a,e}({}).default; |
20
index.js
self.asCustomElement = (function (exports) { | ||
'use strict'; | ||
var asCE = (function (root, upgrade) { | ||
var asCE = (function (root, upgrade, query) { | ||
var wm = new WeakMap(); | ||
@@ -25,8 +25,10 @@ var ao = new WeakMap(); | ||
var mainLoop = function mainLoop(records) { | ||
for (var i = 0, length = records.length; i < length; i++) { | ||
var _records$i2 = records[i], | ||
addedNodes = _records$i2.addedNodes, | ||
removedNodes = _records$i2.removedNodes; | ||
parse(filter.call(addedNodes, elements), 'c', new Set()); | ||
parse(filter.call(removedNodes, elements), 'd', new Set()); | ||
if (query.length) { | ||
for (var i = 0, length = records.length; i < length; i++) { | ||
var _records$i2 = records[i], | ||
addedNodes = _records$i2.addedNodes, | ||
removedNodes = _records$i2.removedNodes; | ||
parse(filter.call(addedNodes, elements), 'c', new Set()); | ||
parse(filter.call(removedNodes, elements), 'd', new Set()); | ||
} | ||
} | ||
@@ -42,3 +44,3 @@ }; | ||
if (wm.has(target)) wm.get(target)[key].forEach(call, target);else if (key === 'c') upgrade(target); | ||
parse(target.querySelectorAll('*'), key, parsed); | ||
parse(target.querySelectorAll(query), key, parsed); | ||
} | ||
@@ -101,3 +103,3 @@ } | ||
var index = asCE(document, function () {}); | ||
var index = asCE(document, function () {}, ['*']); | ||
@@ -104,0 +106,0 @@ exports.default = index; |
@@ -1,1 +0,1 @@ | ||
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var r,a,n,l,u,c,o,i,d,s,b=(r=document,a=function(){},n=new WeakMap,l=new WeakMap,u=[].filter,c=function(e,t){for(var r=0,a=e.length;r<a;r++){var n=e[r],u=n.target,c=n.attributeName,o=n.oldValue,i=u.getAttribute(c);l.get(t).call(u,c,o,i)}},o=function(e){return"querySelectorAll"in e},i=function(e){for(var t=0,r=e.length;t<r;t++){var a=e[t],n=a.addedNodes,l=a.removedNodes;d(u.call(n,o),"c",new Set),d(u.call(l,o),"d",new Set)}},d=function e(r,l,u){for(var c=0,o=r.length;c<o;c++){var i=r[c];u.has(i)||(u.add(i),n.has(i)?n.get(i)[l].forEach(t,i):"c"===l&&a(i),e(i.querySelectorAll("*"),l,u))}},(s=new MutationObserver(i)).observe(r,{childList:!0,subtree:!0}),function(e,t){var r=t.connectedCallback,a=t.disconnectedCallback,u=t.observedAttributes,o=t.attributeChangedCallback;i(s.takeRecords());var d=n.get(e)||function(e){var t={c:new Set,d:new Set};return n.set(e,t),t}(e),b=d.c,f=d.d;if(u){var v=new MutationObserver(c);v.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:u.map((function(t){return e.hasAttribute(t)&&o.call(e,t,null,e.getAttribute(t)),t}))}),l.set(v,o)}return a&&f.add(a),r&&(b.add(r),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||r.call(e)),e});return e.default=b,e}({}).default; | ||
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var r,a,n,l,u,c,o,i,d,s,f,b=(r=document,a=function(){},n=["*"],l=new WeakMap,u=new WeakMap,c=[].filter,o=function(e,t){for(var r=0,a=e.length;r<a;r++){var n=e[r],l=n.target,c=n.attributeName,o=n.oldValue,i=l.getAttribute(c);u.get(t).call(l,c,o,i)}},i=function(e){return"querySelectorAll"in e},d=function(e){if(n.length)for(var t=0,r=e.length;t<r;t++){var a=e[t],l=a.addedNodes,u=a.removedNodes;s(c.call(l,i),"c",new Set),s(c.call(u,i),"d",new Set)}},s=function e(r,u,c){for(var o=0,i=r.length;o<i;o++){var d=r[o];c.has(d)||(c.add(d),l.has(d)?l.get(d)[u].forEach(t,d):"c"===u&&a(d),e(d.querySelectorAll(n),u,c))}},(f=new MutationObserver(d)).observe(r,{childList:!0,subtree:!0}),function(e,t){var r=t.connectedCallback,a=t.disconnectedCallback,n=t.observedAttributes,c=t.attributeChangedCallback;d(f.takeRecords());var i=l.get(e)||function(e){var t={c:new Set,d:new Set};return l.set(e,t),t}(e),s=i.c,b=i.d;if(n){var v=new MutationObserver(o);v.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:n.map((function(t){return e.hasAttribute(t)&&c.call(e,t,null,e.getAttribute(t)),t}))}),u.set(v,c)}return a&&b.add(a),r&&(s.add(r),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||r.call(e)),e});return e.default=b,e}({}).default; |
{ | ||
"name": "as-custom-element", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Setup any element as if it was a Custom Element", | ||
@@ -51,4 +51,4 @@ "main": "./cjs/index.js", | ||
"dependencies": { | ||
"@webreflection/as-custom-element": "^0.1.8" | ||
"@webreflection/as-custom-element": "^0.1.9" | ||
} | ||
} |
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
9628
99