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

as-custom-element

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

as-custom-element - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

2

es.js

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

self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a=((e,a)=>{const r=new WeakMap,n=e=>{for(let t=0,{length:a}=e;t<a;t++){const{target:a,attributeName:n,oldValue:o}=e[t],c=a.getAttribute(n);r.get(a).a[n].forEach(e=>{e.call(a,n,o,c)})}},o=(e,n,c,l)=>{for(let s=0,{length:d}=e;s<d;s++){const d=e[s];c.has(d)||!l&&!("querySelectorAll"in d)||(c.add(d),r.has(d)?r.get(d)[n].forEach(t,d):"c"===n&&a(d,c),o(d.querySelectorAll("*"),n,c,!0))}},c=e=>{for(let t=0,{length:a}=e;t<a;t++){const{addedNodes:a,removedNodes:r}=e[t];o(a,"c",new Set,!1),n(l.takeRecords()),o(r,"d",new Set,!1)}},l=new MutationObserver(n),s=new MutationObserver(c);return s.observe(e,{childList:!0,subtree:!0}),(e,{connectedCallback:t,disconnectedCallback:a,observedAttributes:n,attributeChangedCallback:o})=>{c(s.takeRecords());const{a:d,c:u,d:i}=r.get(e)||(e=>{const t={a:{},c:new Set,d:new Set};return r.set(e,t),t})(e);return n&&(l.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:n}),n.forEach(t=>{(d[t]||(d[t]=new Set)).add(o),e.hasAttribute(t)&&o.call(e,t,null,e.getAttribute(t))})),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 r=((e,r)=>{const a=new WeakMap,n=new WeakMap,l=(e,t)=>{for(let r=0,{length:a}=e;r<a;r++){const{target:a,attributeName:l,oldValue:o}=e[r],c=a.getAttribute(l);n.get(t).call(a,l,o,c)}},o=(e,n,l,c)=>{for(let s=0,{length:u}=e;s<u;s++){const u=e[s];l.has(u)||!c&&!("querySelectorAll"in u)||(l.add(u),a.has(u)?a.get(u)[n].forEach(t,u):"c"===n&&r(u),o(u.querySelectorAll("*"),n,l,!0))}},c=e=>{for(let t=0,{length:r}=e;t<r;t++){const{addedNodes:r,removedNodes:a}=e[t];o(r,"c",new Set,!1),o(a,"d",new Set,!1)}},s=new MutationObserver(c);return s.observe(e,{childList:!0,subtree:!0}),(e,{connectedCallback:t,disconnectedCallback:r,observedAttributes:o,attributeChangedCallback:u})=>{c(s.takeRecords());const{c:d,d:i}=a.get(e)||(e=>{const t={c:new Set,d:new Set};return a.set(e,t),t})(e);if(o){const t=new MutationObserver(l);t.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:o.map(t=>(e.hasAttribute(t)&&u.call(e,t,null,e.getAttribute(t)),t))}),n.set(t,u)}return r&&i.add(r),t&&(d.add(t),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||t.call(e)),e}})(document,()=>{});return e.default=r,e}({}).default;
self.asCustomElement = (function (exports) {
'use strict';
var asCE = (function (root, setup) {
var asCE = (function (root, upgrade) {
var wm = new WeakMap();
var ao = new WeakMap();
var attributeChanged = function attributeChanged(records) {
var _loop = function _loop(i, length) {
var attributeChanged = function attributeChanged(records, mo) {
for (var i = 0, length = records.length; i < length; i++) {
var _records$i = records[i],

@@ -14,9 +15,3 @@ target = _records$i.target,

var newValue = target.getAttribute(attributeName);
wm.get(target).a[attributeName].forEach(function (attributeChangedCallback) {
attributeChangedCallback.call(target, attributeName, oldValue, newValue);
});
};
for (var i = 0, length = records.length; i < length; i++) {
_loop(i);
ao.get(mo).call(target, attributeName, oldValue, newValue);
}

@@ -31,3 +26,3 @@ };

parsed.add(target);
if (wm.has(target)) wm.get(target)[key].forEach(call, target);else if (key === 'c') setup(target, parsed);
if (wm.has(target)) wm.get(target)[key].forEach(call, target);else if (key === 'c') upgrade(target);
invoke(target.querySelectorAll('*'), key, parsed, true);

@@ -44,3 +39,2 @@ }

invoke(addedNodes, 'c', new Set(), false);
attributeChanged(sao.takeRecords());
invoke(removedNodes, 'd', new Set(), false);

@@ -52,3 +46,2 @@ }

var sets = {
a: {},
c: new Set(),

@@ -61,3 +54,2 @@ d: new Set()

var sao = new MutationObserver(attributeChanged);
var sdo = new MutationObserver(mainLoop);

@@ -76,3 +68,2 @@ sdo.observe(root, {

var _ref2 = wm.get(target) || set(target),
a = _ref2.a,
c = _ref2.c,

@@ -82,11 +73,12 @@ d = _ref2.d;

if (observedAttributes) {
sao.observe(target, {
var mo = new MutationObserver(attributeChanged);
mo.observe(target, {
attributes: true,
attributeOldValue: true,
attributeFilter: observedAttributes
attributeFilter: observedAttributes.map(function (attributeName) {
if (target.hasAttribute(attributeName)) attributeChangedCallback.call(target, attributeName, null, target.getAttribute(attributeName));
return attributeName;
})
});
observedAttributes.forEach(function (attributeName) {
(a[attributeName] || (a[attributeName] = new Set())).add(attributeChangedCallback);
if (target.hasAttribute(attributeName)) attributeChangedCallback.call(target, attributeName, null, target.getAttribute(attributeName));
});
ao.set(mo, attributeChangedCallback);
}

@@ -93,0 +85,0 @@

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

self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a,n,r,o,c,u,l,i,d=(a=document,n=function(){},r=new WeakMap,o=function(e){for(var t=function(t,a){var n=e[t],o=n.target,c=n.attributeName,u=n.oldValue,l=o.getAttribute(c);r.get(o).a[c].forEach((function(e){e.call(o,c,u,l)}))},a=0,n=e.length;a<n;a++)t(a)},c=function e(a,o,c,u){for(var l=0,i=a.length;l<i;l++){var d=a[l];c.has(d)||!u&&!("querySelectorAll"in d)||(c.add(d),r.has(d)?r.get(d)[o].forEach(t,d):"c"===o&&n(d,c),e(d.querySelectorAll("*"),o,c,!0))}},u=function(e){for(var t=0,a=e.length;t<a;t++){var n=e[t],r=n.addedNodes,u=n.removedNodes;c(r,"c",new Set,!1),o(l.takeRecords()),c(u,"d",new Set,!1)}},l=new MutationObserver(o),(i=new MutationObserver(u)).observe(a,{childList:!0,subtree:!0}),function(e,t){var a=t.connectedCallback,n=t.disconnectedCallback,o=t.observedAttributes,c=t.attributeChangedCallback;u(i.takeRecords());var d=r.get(e)||function(e){var t={a:{},c:new Set,d:new Set};return r.set(e,t),t}(e),s=d.a,f=d.c,b=d.d;return o&&(l.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:o}),o.forEach((function(t){(s[t]||(s[t]=new Set)).add(c),e.hasAttribute(t)&&c.call(e,t,null,e.getAttribute(t))}))),n&&b.add(n),a&&(f.add(a),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||a.call(e)),e});return e.default=d,e}({}).default;
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var r,a,n,u,o,c,l,i,d=(r=document,a=function(){},n=new WeakMap,u=new WeakMap,o=function(e,t){for(var r=0,a=e.length;r<a;r++){var n=e[r],o=n.target,c=n.attributeName,l=n.oldValue,i=o.getAttribute(c);u.get(t).call(o,c,l,i)}},c=function e(r,u,o,c){for(var l=0,i=r.length;l<i;l++){var d=r[l];o.has(d)||!c&&!("querySelectorAll"in d)||(o.add(d),n.has(d)?n.get(d)[u].forEach(t,d):"c"===u&&a(d),e(d.querySelectorAll("*"),u,o,!0))}},l=function(e){for(var t=0,r=e.length;t<r;t++){var a=e[t],n=a.addedNodes,u=a.removedNodes;c(n,"c",new Set,!1),c(u,"d",new Set,!1)}},(i=new MutationObserver(l)).observe(r,{childList:!0,subtree:!0}),function(e,t){var r=t.connectedCallback,a=t.disconnectedCallback,c=t.observedAttributes,d=t.attributeChangedCallback;l(i.takeRecords());var s=n.get(e)||function(e){var t={c:new Set,d:new Set};return n.set(e,t),t}(e),b=s.c,v=s.d;if(c){var f=new MutationObserver(o);f.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:c.map((function(t){return e.hasAttribute(t)&&d.call(e,t,null,e.getAttribute(t)),t}))}),u.set(f,d)}return a&&v.add(a),r&&(b.add(r),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||r.call(e)),e});return e.default=d,e}({}).default;
{
"name": "as-custom-element",
"version": "0.3.3",
"version": "0.3.4",
"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.4"
"@webreflection/as-custom-element": "^0.1.6"
}
}
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