diff --git a/dist/dde-with-observables.js b/dist/dde-with-observables.js
index cc578f9..aade2f8 100644
--- a/dist/dde-with-observables.js
+++ b/dist/dde-with-observables.js
@@ -1,31 +1,31 @@
//deka-dom-el library is available via global namespace `dde`
(()=> {
-var D={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function $(t,e=!0){return e?Object.assign(D,t):(Object.setPrototypeOf(t,D),t)}function P(t){return D.isPrototypeOf(t)&&t!==D?t:D}function w(t){return typeof t>"u"}function Z(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function T(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function j(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,it(o),e(t,o)),r},{})}function it(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:ut,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function ut(t,e,n){if(Reflect.set(t,e,n),!!w(n)){if(Reflect.deleteProperty(t,e),t instanceof d.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var A="__dde_lifecycleToEvents";var x=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,prevent:!0}],v={get current(){return x[x.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...x]},push(t={}){return x.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return x.push(x[0])},pop(){if(x.length!==1)return x.pop()}};function G(...t){return this.appendOriginal(...t),this}function ft(t){return t.append===G||(t.appendOriginal=t.append,t.append=G),t}var M;function L(t,e,...n){let r=P(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,v.push({scope:t,host:(...l)=>l.length?(o===1?n.unshift(...l):l.forEach(b=>b(s)),void 0):s}),c=t(e||void 0);let f=c instanceof d.F;if(c.nodeName==="#comment")break;let p=L.mark({type:"component",name:t.name,host:f?"this":"parentElement"});c.prepend(p),f&&(s=p);break}case t==="#text":c=k.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=k.call(this,d.D.createDocumentFragment(),e);break;case!!M:c=k.call(this,d.D.createElementNS(M,t),e);break;case!c:c=k.call(this,d.D.createElement(t),e)}return ft(c),s||(s=c),n.forEach(f=>f(s)),o&&v.pop(),o=2,c}function Lt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,f)=>Reflect.set(s,f.name||r,f)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,f,p){if(!p.length)return t;let l=d.D.createDocumentFragment();for(let b of p){if(!b||!b.slot){c&&l.appendChild(b);continue}let R=b.slot,N=o[R];pt(b,"remove","slot"),N&&(at(N,b,n),Reflect.deleteProperty(o,R))}return c&&(o[r].replaceWith(l),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(f=>f.remove()),t.append(...s)}return e}function at(t,e,n){n&&n(t,e);try{t.replaceWith(k(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}L.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=d.D.createComment(``);return e&&(r.end=d.D.createComment("")),r};function Nt(t){let e=this;return function(...r){M=t;let o=L.call(e,...r);return M=void 0,o}}var W=new WeakMap,{setDeleteAttr:V}=d;function k(t,...e){if(!e.length)return t;W.set(t,X(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))Q.call(this,t,n,r);return W.delete(t),t}function Q(t,e,n){let{setRemoveAttr:r,s:o}=X(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(f,p)=>Q.call(c,t,f,p));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return K(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return V(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return U(o,n,K.bind(null,t[e]));case"ariaset":return U(o,n,(f,p)=>r("aria-"+f,p));case"classList":return dt.call(c,t,n)}return lt(t,e)?V(t,e,n):r(e,n)}function X(t,e){if(W.has(t))return W.get(t);let r=(t instanceof d.S?bt:ht).bind(null,t,"Attribute"),o=P(e);return{setRemoveAttr:r,s:o}}function dt(t,e){let n=P(this);return U(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Pt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function pt(t,e,n,r){return t instanceof d.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function lt(t,e){if(!Reflect.has(t,e))return!1;let n=Y(t,e);return!w(n.set)}function Y(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||Y(t,e)}function U(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function tt(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function ht(t,e,n,r){return t[(w(r)?"remove":"set")+e](n,tt(r))}function bt(t,e,n,r,o=null){return t[(w(r)?"remove":"set")+e+"NS"](o,n,tt(r))}function K(t,e,n){if(Reflect.set(t,e,n),!!w(n))return Reflect.deleteProperty(t,e)}var O=d.M?vt():new Proxy({},{get(){return()=>{}}});function vt(){let t=new Map,e=!1,n=i=>function(a){for(let u of a)if(u.type==="childList"){if(b(u.addedNodes,!0)){i();continue}R(u.removedNodes,!0)&&i()}},r=new d.M(n(f));return{observe(i){let a=new d.M(n(()=>{}));return a.observe(i,{childList:!0,subtree:!0}),()=>a.disconnect()},onConnected(i,a){s();let u=c(i);u.connected.has(a)||(u.connected.add(a),u.length_c+=1)},offConnected(i,a){if(!t.has(i))return;let u=t.get(i);u.connected.has(a)&&(u.connected.delete(a),u.length_c-=1,o(i,u))},onDisconnected(i,a){s();let u=c(i);u.disconnected.has(a)||(u.disconnected.add(a),u.length_d+=1)},offDisconnected(i,a){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(a)&&(u.disconnected.delete(a),u.length_d-=1,o(i,u))}};function o(i,a){a.length_c||a.length_d||(t.delete(i),f())}function c(i){if(t.has(i))return t.get(i);let a={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,a),a}function s(){e||(e=!0,r.observe(d.D.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function l(i){t.size>30&&await p();let a=[];if(!(i instanceof Node))return a;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&a.push(u);return a}function b(i,a){let u=!1;for(let m of i){if(a&&l(m).then(b),!t.has(m))continue;let S=t.get(m);S.length_c&&(m.dispatchEvent(new Event("dde:connected")),S.connected=new WeakSet,S.length_c=0,S.length_d||t.delete(m),u=!0)}return u}function R(i,a){let u=!1;for(let m of i)a&&l(m).then(R),!(!t.has(m)||!t.get(m).length_d)&&((queueMicrotask||setTimeout)(N(m)),u=!0);return u}function N(i){return()=>{i.isConnected||(i.dispatchEvent(new Event("dde:disconnected")),t.delete(i))}}}function Ut(t,e,n,r=Et){v.push({scope:t,host:(...s)=>s.length?s.forEach(f=>f(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[A];o||gt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event("dde:connected")),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener("dde:disconnected",O.observe(e),{once:!0}),v.pop(),e.append(c)}function gt(t){return z(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),z(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),z(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent("dde:attributeChanged",{detail:[o,c]})),e.apply(n,r)}),t.prototype[A]=!0,t}function z(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function Et(t){return j(t,(e,n)=>e.getAttribute(n))}function It(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function y(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var mt=new WeakSet;y.connected=function(t,e){let{custom_element:n}=v.current,r="connected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[A]?c:c.isConnected?(c.dispatchEvent(new Event(s)),c):(T(e.signal,()=>O.offConnected(c,t))&&O.onConnected(c,t),c)}};y.disconnected=function(t,e){let{custom_element:n}=v.current,r="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[A]||T(e.signal,()=>O.offDisconnected(c,t))&&O.onDisconnected(c,t),c}};var H=new WeakMap;y.disconnectedAsAbort=function(t){if(H.has(t))return H.get(t);let e=new AbortController;return H.set(t,e),t(y.disconnected(()=>e.abort())),e};y.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o[A]||mt.has(o)||!d.M)return o;let s=new d.M(function(p){for(let{attributeName:l,target:b}of p)b.dispatchEvent(new CustomEvent(c,{detail:[l,b.getAttribute(l)]}))});return T(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};var h=Symbol.for("observable");function q(t){try{return Reflect.has(t,h)}catch{return!1}}var F=[],g=new WeakMap;function E(t,e){if(typeof t!="function")return et(!1,t,e);if(q(t))return t;let n=et(!0),r=function(){let[o,...c]=g.get(r);if(g.set(r,new Set([o])),F.push(r),st(n,t()),F.pop(),!c.length)return;let s=g.get(r);for(let f of c)s.has(f)||C(f,r)};return g.set(n[h],r),g.set(r,new Set([n])),r(),n}E.action=function(t,e,...n){let r=t[h],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};E.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));J(e,n),o&&o.addEventListener("abort",()=>C(e,n))}};E.symbols={onclear:Symbol.for("Observable.onclear")};E.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[h];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,h)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!g.has(o))return;let c=g.get(o);c.delete(n),!(c.size>1)&&(n.clear(...c),g.delete(o))})}};var _="__dde_reactive";E.el=function(t,e){let n=L.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=v,s=f=>{if(!n.parentNode||!r.parentNode)return C(t,s);v.push(c);let p=e(f);v.pop(),Array.isArray(p)||(p=[p]);let l=n;for(;(l=n.nextSibling)!==r;)l.remove();n.after(...p),n.isConnected&&yt(c.host())};return J(t,s),ot(t,s,n,e),s(t()),o};function yt(t){!t||!t[_]||(requestIdleCallback||setTimeout)(function(){t[_]=t[_].filter(([e,n])=>n.isConnected?!0:(C(...e),!1))})}var xt={_set(t){this.value=t}};function wt(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ct(r,r(),xt);return t[n]=o,o}}var B="__dde_attributes";E.observedAttributes=function(t){let e=t[B]={},n=j(t,wt(e));return y.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,f=this[B][c];if(f)return E.action(f,"_set",s)})(t),y.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/E.clear(...Object.values(this[B]))})(t),n};var rt={isObservable:q,processReactiveAttribute(t,e,n,r){if(!q(n))return n;let o=c=>{if(!t.isConnected)return C(n,o);r(e,c)};return J(n,o),ot(n,o,t,e),n()}};function ot(t,e,...n){let{current:r}=v;r.prevent||r.host(function(o){o[_]||(o[_]=[],y.disconnected(()=>o[_].forEach(([[c,s]])=>C(c,s,c[h]?.host()===o)))(o)),o[_].push([[t,e],...n])})}function et(t,e,n){let r=t?()=>nt(r):(...o)=>o.length?st(r,...o):nt(r);return ct(r,e,n)}var At=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),I=class extends Error{constructor(){super();let[e,...n]=this.stack.split(`
-`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ct(t,e,n){let r=[];Z(n)!=="[object Object]"&&(n={});let{onclear:o}=E.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=v;return Reflect.defineProperty(t,h,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new I},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[h],At),t}function Ot(){return F[F.length-1]}function nt(t){if(!t[h])return;let{value:e,listeners:n}=t[h],r=Ot();return r&&n.add(r),g.has(r)&&g.get(r).add(t),e}function st(t,e,n){if(!t[h])return;let r=t[h];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function J(t,e){if(t[h])return t[h].listeners.add(e)}function C(t,e,n){let r=t[h];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(E.clear(t),!g.has(r))return o;let c=g.get(r);if(!g.has(c))return o;g.get(c).forEach(s=>C(s,c,!0))}return o}$(rt);
-globalThis.dde= {O: E,
-assign: k,
-assignAttribute: Q,
-chainableAppend: ft,
-classListDeclarative: dt,
-createElement: L,
-createElementNS: Nt,
-customElementRender: Ut,
-customElementWithDDE: gt,
-dispatchEvent: It,
-el: L,
-elNS: Nt,
-elementAttribute: pt,
-empty: Pt,
-isObservable: q,
-lifecycleToEvents: gt,
-observable: E,
-observedAttributes: Et,
-on: y,
-registerReactivity: $,
-scope: v,
-simulateSlots: Lt
+var L={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function H(t,e=!0){return e?Object.assign(L,t):(Object.setPrototypeOf(t,L),t)}function M(t){return L.isPrototypeOf(t)&&t!==L?t:L}function w(t){return typeof t>"u"}function K(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function W(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function q(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,dt(o),e(t,o)),r},{})}function dt(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:pt,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function pt(t,e,n){if(Reflect.set(t,e,n),!!w(n)){if(Reflect.deleteProperty(t,e),t instanceof d.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var A="__dde_lifecycleToEvents",y="dde:connected",_="dde:disconnected",N="dde:attributeChanged";var O=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,prevent:!0}],E={get current(){return O[O.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...O]},push(t={}){return O.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return O.push(O[0])},pop(){if(O.length!==1)return O.pop()}};function Q(...t){return this.appendOriginal(...t),this}function lt(t){return t.append===Q||(t.appendOriginal=t.append,t.append=Q),t}var F;function T(t,e,...n){let r=M(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,E.push({scope:t,host:(...b)=>b.length?(o===1?n.unshift(...b):b.forEach(g=>g(s)),void 0):s}),c=t(e||void 0);let f=c instanceof d.F;if(c.nodeName==="#comment")break;let p=T.mark({type:"component",name:t.name,host:f?"this":"parentElement"});c.prepend(p),f&&(s=p);break}case t==="#text":c=P.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=P.call(this,d.D.createDocumentFragment(),e);break;case!!F:c=P.call(this,d.D.createElementNS(F,t),e);break;case!c:c=P.call(this,d.D.createElement(t),e)}return lt(c),s||(s=c),n.forEach(f=>f(s)),o&&E.pop(),o=2,c}function jt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,f)=>Reflect.set(s,f.name||r,f)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,f,p){if(!p.length)return t;let b=d.D.createDocumentFragment();for(let g of p){if(!g||!g.slot){c&&b.appendChild(g);continue}let D=g.slot,j=o[D];vt(g,"remove","slot"),j&&(ht(j,g,n),Reflect.deleteProperty(o,D))}return c&&(o[r].replaceWith(b),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(f=>f.remove()),t.append(...s)}return e}function ht(t,e,n){n&&n(t,e);try{t.replaceWith(P(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}T.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=d.D.createComment(``);return e&&(r.end=d.D.createComment("")),r};function Mt(t){let e=this;return function(...r){F=t;let o=T.call(e,...r);return F=void 0,o}}var $=new WeakMap,{setDeleteAttr:X}=d;function P(t,...e){if(!e.length)return t;$.set(t,et(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))tt.call(this,t,n,r);return $.delete(t),t}function tt(t,e,n){let{setRemoveAttr:r,s:o}=et(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(f,p)=>tt.call(c,t,f,p));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return Y(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return X(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return B(o,n,Y.bind(null,t[e]));case"ariaset":return B(o,n,(f,p)=>r("aria-"+f,p));case"classList":return bt.call(c,t,n)}return gt(t,e)?X(t,e,n):r(e,n)}function et(t,e){if($.has(t))return $.get(t);let r=(t instanceof d.S?xt:Et).bind(null,t,"Attribute"),o=M(e);return{setRemoveAttr:r,s:o}}function bt(t,e){let n=M(this);return B(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Wt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function vt(t,e,n,r){return t instanceof d.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function gt(t,e){if(!Reflect.has(t,e))return!1;let n=nt(t,e);return!w(n.set)}function nt(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||nt(t,e)}function B(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function rt(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Et(t,e,n,r){return t[(w(r)?"remove":"set")+e](n,rt(r))}function xt(t,e,n,r,o=null){return t[(w(r)?"remove":"set")+e+"NS"](o,n,rt(r))}function Y(t,e,n){if(Reflect.set(t,e,n),!!w(n))return Reflect.deleteProperty(t,e)}var C=d.M?mt():new Proxy({},{get(){return()=>{}}});function mt(){let t=new Map,e=!1,n=i=>function(a){for(let u of a)if(u.type==="childList"){if(g(u.addedNodes,!0)){i();continue}D(u.removedNodes,!0)&&i()}},r=new d.M(n(f));return{observe(i){let a=new d.M(n(()=>{}));return a.observe(i,{childList:!0,subtree:!0}),()=>a.disconnect()},onConnected(i,a){s();let u=c(i);u.connected.has(a)||(u.connected.add(a),u.length_c+=1)},offConnected(i,a){if(!t.has(i))return;let u=t.get(i);u.connected.has(a)&&(u.connected.delete(a),u.length_c-=1,o(i,u))},onDisconnected(i,a){s();let u=c(i);u.disconnected.has(a)||(u.disconnected.add(a),u.length_d+=1)},offDisconnected(i,a){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(a)&&(u.disconnected.delete(a),u.length_d-=1,o(i,u))}};function o(i,a){a.length_c||a.length_d||(t.delete(i),f())}function c(i){if(t.has(i))return t.get(i);let a={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,a),a}function s(){e||(e=!0,r.observe(d.D.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function b(i){t.size>30&&await p();let a=[];if(!(i instanceof Node))return a;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&a.push(u);return a}function g(i,a){let u=!1;for(let x of i){if(a&&b(x).then(g),!t.has(x))continue;let k=t.get(x);k.length_c&&(x.dispatchEvent(new Event(y)),k.connected=new WeakSet,k.length_c=0,k.length_d||t.delete(x),u=!0)}return u}function D(i,a){let u=!1;for(let x of i)a&&b(x).then(D),!(!t.has(x)||!t.get(x).length_d)&&((queueMicrotask||setTimeout)(j(x)),u=!0);return u}function j(i){return()=>{i.isConnected||(i.dispatchEvent(new Event(_)),t.delete(i))}}}function It(t,e,n,r=Ot){E.push({scope:t,host:(...s)=>s.length?s.forEach(f=>f(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[A];o||yt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event(y)),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener(_,C.observe(e),{once:!0}),E.pop(),e.append(c)}function yt(t){return I(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event(y))}),I(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event(_)))}),I(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent(N,{detail:[o,c]})),e.apply(n,r)}),t.prototype[A]=!0,t}function I(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function Ot(t){return q(t,(e,n)=>e.getAttribute(n))}function Vt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function m(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var ot=t=>Object.assign({},typeof t=="object"?t:null,{once:!0});m.connected=function(t,e){return e=ot(e),function(r){return r.addEventListener(y,t,e),r[A]?r:r.isConnected?(r.dispatchEvent(new Event(y)),r):(W(e.signal,()=>C.offConnected(r,t))&&C.onConnected(r,t),r)}};m.disconnected=function(t,e){return e=ot(e),function(r){return r.addEventListener(_,t,e),r[A]||W(e.signal,()=>C.offDisconnected(r,t))&&C.onDisconnected(r,t),r}};var J=new WeakMap;m.disconnectedAsAbort=function(t){if(J.has(t))return J.get(t);let e=new AbortController;return J.set(t,e),t(m.disconnected(()=>e.abort())),e};var wt=new WeakSet;m.attributeChanged=function(t,e){return typeof e!="object"&&(e={}),function(r){if(r.addEventListener(N,t,e),r[A]||wt.has(r)||!d.M)return r;let o=new d.M(function(s){for(let{attributeName:f,target:p}of s)p.dispatchEvent(new CustomEvent(N,{detail:[f,p.getAttribute(f)]}))});return W(e.signal,()=>o.disconnect())&&o.observe(r,{attributes:!0}),r}};var l=Symbol.for("observable");function U(t){try{return Reflect.has(t,l)}catch{return!1}}var z=[],h=new WeakMap;function v(t,e){if(typeof t!="function")return ct(!1,t,e);if(U(t))return t;let n=ct(!0),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),z.push(r),at(n,t()),z.pop(),!c.length)return;let s=h.get(r);for(let f of c)s.has(f)||S(f,r)};return h.set(n[l],r),h.set(r,new Set([n])),r(),n}v.action=function(t,e,...n){let r=t[l],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};v.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));V(e,n),o&&o.addEventListener("abort",()=>S(e,n))}};v.symbols={onclear:Symbol.for("Observable.onclear")};v.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[l];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,l)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(n.clear(...c),h.delete(o))})}};var R="__dde_reactive";v.el=function(t,e){let n=T.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=E,s=f=>{if(!n.parentNode||!r.parentNode)return S(t,s);E.push(c);let p=e(f);E.pop(),Array.isArray(p)||(p=[p]);let b=n;for(;(b=n.nextSibling)!==r;)b.remove();n.after(...p),n.isConnected&&At(c.host())};return V(t,s),ut(t,s,n,e),s(t()),o};function At(t){!t||!t[R]||(requestIdleCallback||setTimeout)(function(){t[R]=t[R].filter(([e,n])=>n.isConnected?!0:(S(...e),!1))})}var _t={_set(t){this.value=t}};function Ct(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ft(r,r(),_t);return t[n]=o,o}}var Z="__dde_attributes";v.observedAttributes=function(t){let e=t[Z]={},n=q(t,Ct(e));return m.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`).
+ * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,f=this[Z][c];if(f)return v.action(f,"_set",s)})(t),m.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`).
+ * Investigate `__dde_attributes` key of the element.*/v.clear(...Object.values(this[Z]))})(t),n};var it={isObservable:U,processReactiveAttribute(t,e,n,r){if(!U(n))return n;let o=c=>{if(!t.isConnected)return S(n,o);r(e,c)};return V(n,o),ut(n,o,t,e),n()}};function ut(t,e,...n){let{current:r}=E;r.prevent||r.host(function(o){o[R]||(o[R]=[],m.disconnected(()=>o[R].forEach(([[c,s]])=>S(c,s,c[l]?.host()===o)))(o)),o[R].push([[t,e],...n])})}function ct(t,e,n){let r=t?()=>st(r):(...o)=>o.length?at(r,...o):st(r);return ft(r,e,n)}var Rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),G=class extends Error{constructor(){super();let[e,...n]=this.stack.split(`
+`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ft(t,e,n){let r=[];K(n)!=="[object Object]"&&(n={});let{onclear:o}=v.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=E;return Reflect.defineProperty(t,l,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new G},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[l],Rt),t}function St(){return z[z.length-1]}function st(t){if(!t[l])return;let{value:e,listeners:n}=t[l],r=St();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function at(t,e,n){if(!t[l])return;let r=t[l];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function V(t,e){if(t[l])return t[l].listeners.add(e)}function S(t,e,n){let r=t[l];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(v.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>S(s,c,!0))}return o}H(it);
+globalThis.dde= {O: v,
+assign: P,
+assignAttribute: tt,
+chainableAppend: lt,
+classListDeclarative: bt,
+createElement: T,
+createElementNS: Mt,
+customElementRender: It,
+customElementWithDDE: yt,
+dispatchEvent: Vt,
+el: T,
+elNS: Mt,
+elementAttribute: vt,
+empty: Wt,
+isObservable: U,
+lifecycleToEvents: yt,
+observable: v,
+observedAttributes: Ot,
+on: m,
+registerReactivity: H,
+scope: E,
+simulateSlots: jt
};
})();
\ No newline at end of file
diff --git a/dist/dde.js b/dist/dde.js
index cea6ee4..ea8511a 100644
--- a/dist/dde.js
+++ b/dist/dde.js
@@ -1,25 +1,25 @@
//deka-dom-el library is available via global namespace `dde`
(()=> {
-var A={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function z(t,e=!0){return e?Object.assign(A,t):(Object.setPrototypeOf(t,A),t)}function _(t){return A.isPrototypeOf(t)&&t!==A?t:A}function E(t){return typeof t>"u"}function O(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function k(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,B(o),e(t,o)),r},{})}function B(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var a={setDeleteAttr:I,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function I(t,e,n){if(Reflect.set(t,e,n),!!E(n)){if(Reflect.deleteProperty(t,e),t instanceof a.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var x="__dde_lifecycleToEvents";var v=[{get scope(){return a.D.body},host:t=>t?t(a.D.body):a.D.body,prevent:!0}],g={get current(){return v[v.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...v]},push(t={}){return v.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return v.push(v[0])},pop(){if(v.length!==1)return v.pop()}};function W(...t){return this.appendOriginal(...t),this}function Z(t){return t.append===W||(t.appendOriginal=t.append,t.append=W),t}var S;function T(t,e,...n){let r=_(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,g.push({scope:t,host:(...l)=>l.length?(o===1?n.unshift(...l):l.forEach(p=>p(s)),void 0):s}),c=t(e||void 0);let d=c instanceof a.F;if(c.nodeName==="#comment")break;let h=T.mark({type:"component",name:t.name,host:d?"this":"parentElement"});c.prepend(h),d&&(s=h);break}case t==="#text":c=C.call(this,a.D.createTextNode(""),e);break;case(t==="<>"||!t):c=C.call(this,a.D.createDocumentFragment(),e);break;case!!S:c=C.call(this,a.D.createElementNS(S,t),e);break;case!c:c=C.call(this,a.D.createElement(t),e)}return Z(c),s||(s=c),n.forEach(d=>d(s)),o&&g.pop(),o=2,c}function ft(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,d)=>Reflect.set(s,d.name||r,d)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,d,h){if(!h.length)return t;let l=a.D.createDocumentFragment();for(let p of h){if(!p||!p.slot){c&&l.appendChild(p);continue}let y=p.slot,R=o[y];J(p,"remove","slot"),R&&(G(R,p,n),Reflect.deleteProperty(o,y))}return c&&(o[r].replaceWith(l),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(d=>d.remove()),t.append(...s)}return e}function G(t,e,n){n&&n(t,e);try{t.replaceWith(C(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}T.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=a.D.createComment(``);return e&&(r.end=a.D.createComment("")),r};function at(t){let e=this;return function(...r){S=t;let o=T.call(e,...r);return S=void 0,o}}var L=new WeakMap,{setDeleteAttr:j}=a;function C(t,...e){if(!e.length)return t;L.set(t,$(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))F.call(this,t,n,r);return L.delete(t),t}function F(t,e,n){let{setRemoveAttr:r,s:o}=$(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,h)=>F.call(c,t,d,h));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return q(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return j(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return N(o,n,q.bind(null,t[e]));case"ariaset":return N(o,n,(d,h)=>r("aria-"+d,h));case"classList":return V.call(c,t,n)}return K(t,e)?j(t,e,n):r(e,n)}function $(t,e){if(L.has(t))return L.get(t);let r=(t instanceof a.S?X:Q).bind(null,t,"Attribute"),o=_(e);return{setRemoveAttr:r,s:o}}function V(t,e){let n=_(this);return N(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function dt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function J(t,e,n,r){return t instanceof a.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function K(t,e){if(!Reflect.has(t,e))return!1;let n=U(t,e);return!E(n.set)}function U(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||U(t,e)}function N(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function H(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Q(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,H(r))}function X(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,H(r))}function q(t,e,n){if(Reflect.set(t,e,n),!!E(n))return Reflect.deleteProperty(t,e)}var m=a.M?Y():new Proxy({},{get(){return()=>{}}});function Y(){let t=new Map,e=!1,n=i=>function(f){for(let u of f)if(u.type==="childList"){if(p(u.addedNodes,!0)){i();continue}y(u.removedNodes,!0)&&i()}},r=new a.M(n(d));return{observe(i){let f=new a.M(n(()=>{}));return f.observe(i,{childList:!0,subtree:!0}),()=>f.disconnect()},onConnected(i,f){s();let u=c(i);u.connected.has(f)||(u.connected.add(f),u.length_c+=1)},offConnected(i,f){if(!t.has(i))return;let u=t.get(i);u.connected.has(f)&&(u.connected.delete(f),u.length_c-=1,o(i,u))},onDisconnected(i,f){s();let u=c(i);u.disconnected.has(f)||(u.disconnected.add(f),u.length_d+=1)},offDisconnected(i,f){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(f)&&(u.disconnected.delete(f),u.length_d-=1,o(i,u))}};function o(i,f){f.length_c||f.length_d||(t.delete(i),d())}function c(i){if(t.has(i))return t.get(i);let f={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,f),f}function s(){e||(e=!0,r.observe(a.D.body,{childList:!0,subtree:!0}))}function d(){!e||t.size||(e=!1,r.disconnect())}function h(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function l(i){t.size>30&&await h();let f=[];if(!(i instanceof Node))return f;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&f.push(u);return f}function p(i,f){let u=!1;for(let b of i){if(f&&l(b).then(p),!t.has(b))continue;let w=t.get(b);w.length_c&&(b.dispatchEvent(new Event("dde:connected")),w.connected=new WeakSet,w.length_c=0,w.length_d||t.delete(b),u=!0)}return u}function y(i,f){let u=!1;for(let b of i)f&&l(b).then(y),!(!t.has(b)||!t.get(b).length_d)&&((queueMicrotask||setTimeout)(R(b)),u=!0);return u}function R(i){return()=>{i.isConnected||(i.dispatchEvent(new Event("dde:disconnected")),t.delete(i))}}}function xt(t,e,n,r=et){g.push({scope:t,host:(...s)=>s.length?s.forEach(d=>d(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[x];o||tt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event("dde:connected")),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener("dde:disconnected",m.observe(e),{once:!0}),g.pop(),e.append(c)}function tt(t){return M(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),M(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),M(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent("dde:attributeChanged",{detail:[o,c]})),e.apply(n,r)}),t.prototype[x]=!0,t}function M(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function et(t){return k(t,(e,n)=>e.getAttribute(n))}function At(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function D(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var nt=new WeakSet;D.connected=function(t,e){let{custom_element:n}=g.current,r="connected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[x]?c:c.isConnected?(c.dispatchEvent(new Event(s)),c):(O(e.signal,()=>m.offConnected(c,t))&&m.onConnected(c,t),c)}};D.disconnected=function(t,e){let{custom_element:n}=g.current,r="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[x]||O(e.signal,()=>m.offDisconnected(c,t))&&m.onDisconnected(c,t),c}};var P=new WeakMap;D.disconnectedAsAbort=function(t){if(P.has(t))return P.get(t);let e=new AbortController;return P.set(t,e),t(D.disconnected(()=>e.abort())),e};D.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o[x]||nt.has(o)||!a.M)return o;let s=new a.M(function(h){for(let{attributeName:l,target:p}of h)p.dispatchEvent(new CustomEvent(c,{detail:[l,p.getAttribute(l)]}))});return O(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};
-globalThis.dde= {assign: C,
-assignAttribute: F,
-chainableAppend: Z,
-classListDeclarative: V,
-createElement: T,
-createElementNS: at,
-customElementRender: xt,
-customElementWithDDE: tt,
-dispatchEvent: At,
-el: T,
-elNS: at,
-elementAttribute: J,
-empty: dt,
-lifecycleToEvents: tt,
-observedAttributes: et,
-on: D,
-registerReactivity: z,
-scope: g,
-simulateSlots: ft
+var C={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function G(t,e=!0){return e?Object.assign(C,t):(Object.setPrototypeOf(t,C),t)}function L(t){return C.isPrototypeOf(t)&&t!==C?t:C}function E(t){return typeof t>"u"}function N(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function q(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,V(o),e(t,o)),r},{})}function V(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var a={setDeleteAttr:J,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function J(t,e,n){if(Reflect.set(t,e,n),!!E(n)){if(Reflect.deleteProperty(t,e),t instanceof a.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var x="__dde_lifecycleToEvents",v="dde:connected",y="dde:disconnected",D="dde:attributeChanged";var g=[{get scope(){return a.D.body},host:t=>t?t(a.D.body):a.D.body,prevent:!0}],R={get current(){return g[g.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...g]},push(t={}){return g.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return g.push(g[0])},pop(){if(g.length!==1)return g.pop()}};function F(...t){return this.appendOriginal(...t),this}function K(t){return t.append===F||(t.appendOriginal=t.append,t.append=F),t}var T;function k(t,e,...n){let r=L(this),o=0,c,f;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,R.push({scope:t,host:(...b)=>b.length?(o===1?n.unshift(...b):b.forEach(l=>l(f)),void 0):f}),c=t(e||void 0);let d=c instanceof a.F;if(c.nodeName==="#comment")break;let p=k.mark({type:"component",name:t.name,host:d?"this":"parentElement"});c.prepend(p),d&&(f=p);break}case t==="#text":c=O.call(this,a.D.createTextNode(""),e);break;case(t==="<>"||!t):c=O.call(this,a.D.createDocumentFragment(),e);break;case!!T:c=O.call(this,a.D.createElementNS(T,t),e);break;case!c:c=O.call(this,a.D.createElement(t),e)}return K(c),f||(f=c),n.forEach(d=>d(f)),o&&R.pop(),o=2,c}function lt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((f,d)=>Reflect.set(f,d.name||r,d)&&f,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(f,d,p){if(!p.length)return t;let b=a.D.createDocumentFragment();for(let l of p){if(!l||!l.slot){c&&b.appendChild(l);continue}let A=l.slot,_=o[A];Y(l,"remove","slot"),_&&(Q(_,l,n),Reflect.deleteProperty(o,A))}return c&&(o[r].replaceWith(b),Reflect.deleteProperty(o,r)),t.append=f,t}}),t!==e){let f=Array.from(t.childNodes);f.forEach(d=>d.remove()),t.append(...f)}return e}function Q(t,e,n){n&&n(t,e);try{t.replaceWith(O(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}k.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=a.D.createComment(``);return e&&(r.end=a.D.createComment("")),r};function ht(t){let e=this;return function(...r){T=t;let o=k.call(e,...r);return T=void 0,o}}var M=new WeakMap,{setDeleteAttr:$}=a;function O(t,...e){if(!e.length)return t;M.set(t,z(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))H.call(this,t,n,r);return M.delete(t),t}function H(t,e,n){let{setRemoveAttr:r,s:o}=z(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,p)=>H.call(c,t,d,p));let[f]=e;if(f==="=")return r(e.slice(1),n);if(f===".")return U(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return $(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return P(o,n,U.bind(null,t[e]));case"ariaset":return P(o,n,(d,p)=>r("aria-"+d,p));case"classList":return X.call(c,t,n)}return tt(t,e)?$(t,e,n):r(e,n)}function z(t,e){if(M.has(t))return M.get(t);let r=(t instanceof a.S?nt:et).bind(null,t,"Attribute"),o=L(e);return{setRemoveAttr:r,s:o}}function X(t,e){let n=L(this);return P(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function bt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function Y(t,e,n,r){return t instanceof a.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function tt(t,e){if(!Reflect.has(t,e))return!1;let n=B(t,e);return!E(n.set)}function B(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||B(t,e)}function P(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function I(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function et(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,I(r))}function nt(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,I(r))}function U(t,e,n){if(Reflect.set(t,e,n),!!E(n))return Reflect.deleteProperty(t,e)}var w=a.M?rt():new Proxy({},{get(){return()=>{}}});function rt(){let t=new Map,e=!1,n=i=>function(u){for(let s of u)if(s.type==="childList"){if(l(s.addedNodes,!0)){i();continue}A(s.removedNodes,!0)&&i()}},r=new a.M(n(d));return{observe(i){let u=new a.M(n(()=>{}));return u.observe(i,{childList:!0,subtree:!0}),()=>u.disconnect()},onConnected(i,u){f();let s=c(i);s.connected.has(u)||(s.connected.add(u),s.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let s=t.get(i);s.connected.has(u)&&(s.connected.delete(u),s.length_c-=1,o(i,s))},onDisconnected(i,u){f();let s=c(i);s.disconnected.has(u)||(s.disconnected.add(u),s.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let s=t.get(i);s.disconnected.has(u)&&(s.disconnected.delete(u),s.length_d-=1,o(i,s))}};function o(i,u){u.length_c||u.length_d||(t.delete(i),d())}function c(i){if(t.has(i))return t.get(i);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,u),u}function f(){e||(e=!0,r.observe(a.D.body,{childList:!0,subtree:!0}))}function d(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function b(i){t.size>30&&await p();let u=[];if(!(i instanceof Node))return u;for(let s of t.keys())s===i||!(s instanceof Node)||i.contains(s)&&u.push(s);return u}function l(i,u){let s=!1;for(let h of i){if(u&&b(h).then(l),!t.has(h))continue;let m=t.get(h);m.length_c&&(h.dispatchEvent(new Event(v)),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(h),s=!0)}return s}function A(i,u){let s=!1;for(let h of i)u&&b(h).then(A),!(!t.has(h)||!t.get(h).length_d)&&((queueMicrotask||setTimeout)(_(h)),s=!0);return s}function _(i){return()=>{i.isConnected||(i.dispatchEvent(new Event(y)),t.delete(i))}}}function mt(t,e,n,r=ct){R.push({scope:t,host:(...f)=>f.length?f.forEach(d=>d(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[x];o||ot(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event(v)),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener(y,w.observe(e),{once:!0}),R.pop(),e.append(c)}function ot(t){return W(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event(v))}),W(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event(y)))}),W(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent(D,{detail:[o,c]})),e.apply(n,r)}),t.prototype[x]=!0,t}function W(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function ct(t){return q(t,(e,n)=>e.getAttribute(n))}function Rt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let f=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(f)}}function S(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var Z=t=>Object.assign({},typeof t=="object"?t:null,{once:!0});S.connected=function(t,e){return e=Z(e),function(r){return r.addEventListener(v,t,e),r[x]?r:r.isConnected?(r.dispatchEvent(new Event(v)),r):(N(e.signal,()=>w.offConnected(r,t))&&w.onConnected(r,t),r)}};S.disconnected=function(t,e){return e=Z(e),function(r){return r.addEventListener(y,t,e),r[x]||N(e.signal,()=>w.offDisconnected(r,t))&&w.onDisconnected(r,t),r}};var j=new WeakMap;S.disconnectedAsAbort=function(t){if(j.has(t))return j.get(t);let e=new AbortController;return j.set(t,e),t(S.disconnected(()=>e.abort())),e};var it=new WeakSet;S.attributeChanged=function(t,e){return typeof e!="object"&&(e={}),function(r){if(r.addEventListener(D,t,e),r[x]||it.has(r)||!a.M)return r;let o=new a.M(function(f){for(let{attributeName:d,target:p}of f)p.dispatchEvent(new CustomEvent(D,{detail:[d,p.getAttribute(d)]}))});return N(e.signal,()=>o.disconnect())&&o.observe(r,{attributes:!0}),r}};
+globalThis.dde= {assign: O,
+assignAttribute: H,
+chainableAppend: K,
+classListDeclarative: X,
+createElement: k,
+createElementNS: ht,
+customElementRender: mt,
+customElementWithDDE: ot,
+dispatchEvent: Rt,
+el: k,
+elNS: ht,
+elementAttribute: Y,
+empty: bt,
+lifecycleToEvents: ot,
+observedAttributes: ct,
+on: S,
+registerReactivity: G,
+scope: R,
+simulateSlots: lt
};
})();
\ No newline at end of file
diff --git a/dist/esm-with-observables.js b/dist/esm-with-observables.js
index e45d52c..e24f370 100644
--- a/dist/esm-with-observables.js
+++ b/dist/esm-with-observables.js
@@ -1,4 +1,4 @@
-var D={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function $(t,e=!0){return e?Object.assign(D,t):(Object.setPrototypeOf(t,D),t)}function P(t){return D.isPrototypeOf(t)&&t!==D?t:D}function w(t){return typeof t>"u"}function Z(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function T(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function j(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,it(o),e(t,o)),r},{})}function it(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:ut,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function ut(t,e,n){if(Reflect.set(t,e,n),!!w(n)){if(Reflect.deleteProperty(t,e),t instanceof d.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var A="__dde_lifecycleToEvents";var x=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,prevent:!0}],v={get current(){return x[x.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...x]},push(t={}){return x.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return x.push(x[0])},pop(){if(x.length!==1)return x.pop()}};function G(...t){return this.appendOriginal(...t),this}function ft(t){return t.append===G||(t.appendOriginal=t.append,t.append=G),t}var M;function L(t,e,...n){let r=P(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,v.push({scope:t,host:(...l)=>l.length?(o===1?n.unshift(...l):l.forEach(b=>b(s)),void 0):s}),c=t(e||void 0);let f=c instanceof d.F;if(c.nodeName==="#comment")break;let p=L.mark({type:"component",name:t.name,host:f?"this":"parentElement"});c.prepend(p),f&&(s=p);break}case t==="#text":c=k.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=k.call(this,d.D.createDocumentFragment(),e);break;case!!M:c=k.call(this,d.D.createElementNS(M,t),e);break;case!c:c=k.call(this,d.D.createElement(t),e)}return ft(c),s||(s=c),n.forEach(f=>f(s)),o&&v.pop(),o=2,c}function Lt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,f)=>Reflect.set(s,f.name||r,f)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,f,p){if(!p.length)return t;let l=d.D.createDocumentFragment();for(let b of p){if(!b||!b.slot){c&&l.appendChild(b);continue}let R=b.slot,N=o[R];pt(b,"remove","slot"),N&&(at(N,b,n),Reflect.deleteProperty(o,R))}return c&&(o[r].replaceWith(l),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(f=>f.remove()),t.append(...s)}return e}function at(t,e,n){n&&n(t,e);try{t.replaceWith(k(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}L.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=d.D.createComment(``);return e&&(r.end=d.D.createComment("")),r};function Nt(t){let e=this;return function(...r){M=t;let o=L.call(e,...r);return M=void 0,o}}var W=new WeakMap,{setDeleteAttr:V}=d;function k(t,...e){if(!e.length)return t;W.set(t,X(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))Q.call(this,t,n,r);return W.delete(t),t}function Q(t,e,n){let{setRemoveAttr:r,s:o}=X(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(f,p)=>Q.call(c,t,f,p));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return K(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return V(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return U(o,n,K.bind(null,t[e]));case"ariaset":return U(o,n,(f,p)=>r("aria-"+f,p));case"classList":return dt.call(c,t,n)}return lt(t,e)?V(t,e,n):r(e,n)}function X(t,e){if(W.has(t))return W.get(t);let r=(t instanceof d.S?bt:ht).bind(null,t,"Attribute"),o=P(e);return{setRemoveAttr:r,s:o}}function dt(t,e){let n=P(this);return U(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Pt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function pt(t,e,n,r){return t instanceof d.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function lt(t,e){if(!Reflect.has(t,e))return!1;let n=Y(t,e);return!w(n.set)}function Y(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||Y(t,e)}function U(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function tt(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function ht(t,e,n,r){return t[(w(r)?"remove":"set")+e](n,tt(r))}function bt(t,e,n,r,o=null){return t[(w(r)?"remove":"set")+e+"NS"](o,n,tt(r))}function K(t,e,n){if(Reflect.set(t,e,n),!!w(n))return Reflect.deleteProperty(t,e)}var O=d.M?vt():new Proxy({},{get(){return()=>{}}});function vt(){let t=new Map,e=!1,n=i=>function(a){for(let u of a)if(u.type==="childList"){if(b(u.addedNodes,!0)){i();continue}R(u.removedNodes,!0)&&i()}},r=new d.M(n(f));return{observe(i){let a=new d.M(n(()=>{}));return a.observe(i,{childList:!0,subtree:!0}),()=>a.disconnect()},onConnected(i,a){s();let u=c(i);u.connected.has(a)||(u.connected.add(a),u.length_c+=1)},offConnected(i,a){if(!t.has(i))return;let u=t.get(i);u.connected.has(a)&&(u.connected.delete(a),u.length_c-=1,o(i,u))},onDisconnected(i,a){s();let u=c(i);u.disconnected.has(a)||(u.disconnected.add(a),u.length_d+=1)},offDisconnected(i,a){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(a)&&(u.disconnected.delete(a),u.length_d-=1,o(i,u))}};function o(i,a){a.length_c||a.length_d||(t.delete(i),f())}function c(i){if(t.has(i))return t.get(i);let a={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,a),a}function s(){e||(e=!0,r.observe(d.D.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function l(i){t.size>30&&await p();let a=[];if(!(i instanceof Node))return a;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&a.push(u);return a}function b(i,a){let u=!1;for(let m of i){if(a&&l(m).then(b),!t.has(m))continue;let S=t.get(m);S.length_c&&(m.dispatchEvent(new Event("dde:connected")),S.connected=new WeakSet,S.length_c=0,S.length_d||t.delete(m),u=!0)}return u}function R(i,a){let u=!1;for(let m of i)a&&l(m).then(R),!(!t.has(m)||!t.get(m).length_d)&&((queueMicrotask||setTimeout)(N(m)),u=!0);return u}function N(i){return()=>{i.isConnected||(i.dispatchEvent(new Event("dde:disconnected")),t.delete(i))}}}function Ut(t,e,n,r=Et){v.push({scope:t,host:(...s)=>s.length?s.forEach(f=>f(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[A];o||gt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event("dde:connected")),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener("dde:disconnected",O.observe(e),{once:!0}),v.pop(),e.append(c)}function gt(t){return z(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),z(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),z(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent("dde:attributeChanged",{detail:[o,c]})),e.apply(n,r)}),t.prototype[A]=!0,t}function z(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function Et(t){return j(t,(e,n)=>e.getAttribute(n))}function It(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function y(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var mt=new WeakSet;y.connected=function(t,e){let{custom_element:n}=v.current,r="connected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[A]?c:c.isConnected?(c.dispatchEvent(new Event(s)),c):(T(e.signal,()=>O.offConnected(c,t))&&O.onConnected(c,t),c)}};y.disconnected=function(t,e){let{custom_element:n}=v.current,r="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[A]||T(e.signal,()=>O.offDisconnected(c,t))&&O.onDisconnected(c,t),c}};var H=new WeakMap;y.disconnectedAsAbort=function(t){if(H.has(t))return H.get(t);let e=new AbortController;return H.set(t,e),t(y.disconnected(()=>e.abort())),e};y.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o[A]||mt.has(o)||!d.M)return o;let s=new d.M(function(p){for(let{attributeName:l,target:b}of p)b.dispatchEvent(new CustomEvent(c,{detail:[l,b.getAttribute(l)]}))});return T(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};var h=Symbol.for("observable");function q(t){try{return Reflect.has(t,h)}catch{return!1}}var F=[],g=new WeakMap;function E(t,e){if(typeof t!="function")return et(!1,t,e);if(q(t))return t;let n=et(!0),r=function(){let[o,...c]=g.get(r);if(g.set(r,new Set([o])),F.push(r),st(n,t()),F.pop(),!c.length)return;let s=g.get(r);for(let f of c)s.has(f)||C(f,r)};return g.set(n[h],r),g.set(r,new Set([n])),r(),n}E.action=function(t,e,...n){let r=t[h],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};E.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));J(e,n),o&&o.addEventListener("abort",()=>C(e,n))}};E.symbols={onclear:Symbol.for("Observable.onclear")};E.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[h];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,h)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!g.has(o))return;let c=g.get(o);c.delete(n),!(c.size>1)&&(n.clear(...c),g.delete(o))})}};var _="__dde_reactive";E.el=function(t,e){let n=L.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=v,s=f=>{if(!n.parentNode||!r.parentNode)return C(t,s);v.push(c);let p=e(f);v.pop(),Array.isArray(p)||(p=[p]);let l=n;for(;(l=n.nextSibling)!==r;)l.remove();n.after(...p),n.isConnected&&yt(c.host())};return J(t,s),ot(t,s,n,e),s(t()),o};function yt(t){!t||!t[_]||(requestIdleCallback||setTimeout)(function(){t[_]=t[_].filter(([e,n])=>n.isConnected?!0:(C(...e),!1))})}var xt={_set(t){this.value=t}};function wt(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ct(r,r(),xt);return t[n]=o,o}}var B="__dde_attributes";E.observedAttributes=function(t){let e=t[B]={},n=j(t,wt(e));return y.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,f=this[B][c];if(f)return E.action(f,"_set",s)})(t),y.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/E.clear(...Object.values(this[B]))})(t),n};var rt={isObservable:q,processReactiveAttribute(t,e,n,r){if(!q(n))return n;let o=c=>{if(!t.isConnected)return C(n,o);r(e,c)};return J(n,o),ot(n,o,t,e),n()}};function ot(t,e,...n){let{current:r}=v;r.prevent||r.host(function(o){o[_]||(o[_]=[],y.disconnected(()=>o[_].forEach(([[c,s]])=>C(c,s,c[h]?.host()===o)))(o)),o[_].push([[t,e],...n])})}function et(t,e,n){let r=t?()=>nt(r):(...o)=>o.length?st(r,...o):nt(r);return ct(r,e,n)}var At=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),I=class extends Error{constructor(){super();let[e,...n]=this.stack.split(`
-`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ct(t,e,n){let r=[];Z(n)!=="[object Object]"&&(n={});let{onclear:o}=E.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=v;return Reflect.defineProperty(t,h,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new I},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[h],At),t}function Ot(){return F[F.length-1]}function nt(t){if(!t[h])return;let{value:e,listeners:n}=t[h],r=Ot();return r&&n.add(r),g.has(r)&&g.get(r).add(t),e}function st(t,e,n){if(!t[h])return;let r=t[h];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function J(t,e){if(t[h])return t[h].listeners.add(e)}function C(t,e,n){let r=t[h];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(E.clear(t),!g.has(r))return o;let c=g.get(r);if(!g.has(c))return o;g.get(c).forEach(s=>C(s,c,!0))}return o}$(rt);export{E as O,k as assign,Q as assignAttribute,ft as chainableAppend,dt as classListDeclarative,L as createElement,Nt as createElementNS,Ut as customElementRender,gt as customElementWithDDE,It as dispatchEvent,L as el,Nt as elNS,pt as elementAttribute,Pt as empty,q as isObservable,gt as lifecycleToEvents,E as observable,Et as observedAttributes,y as on,$ as registerReactivity,v as scope,Lt as simulateSlots};
+var L={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function H(t,e=!0){return e?Object.assign(L,t):(Object.setPrototypeOf(t,L),t)}function M(t){return L.isPrototypeOf(t)&&t!==L?t:L}function w(t){return typeof t>"u"}function K(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function W(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function q(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,dt(o),e(t,o)),r},{})}function dt(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:pt,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function pt(t,e,n){if(Reflect.set(t,e,n),!!w(n)){if(Reflect.deleteProperty(t,e),t instanceof d.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var A="__dde_lifecycleToEvents",y="dde:connected",_="dde:disconnected",N="dde:attributeChanged";var O=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,prevent:!0}],E={get current(){return O[O.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...O]},push(t={}){return O.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return O.push(O[0])},pop(){if(O.length!==1)return O.pop()}};function Q(...t){return this.appendOriginal(...t),this}function lt(t){return t.append===Q||(t.appendOriginal=t.append,t.append=Q),t}var F;function T(t,e,...n){let r=M(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,E.push({scope:t,host:(...b)=>b.length?(o===1?n.unshift(...b):b.forEach(g=>g(s)),void 0):s}),c=t(e||void 0);let f=c instanceof d.F;if(c.nodeName==="#comment")break;let p=T.mark({type:"component",name:t.name,host:f?"this":"parentElement"});c.prepend(p),f&&(s=p);break}case t==="#text":c=P.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=P.call(this,d.D.createDocumentFragment(),e);break;case!!F:c=P.call(this,d.D.createElementNS(F,t),e);break;case!c:c=P.call(this,d.D.createElement(t),e)}return lt(c),s||(s=c),n.forEach(f=>f(s)),o&&E.pop(),o=2,c}function jt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,f)=>Reflect.set(s,f.name||r,f)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,f,p){if(!p.length)return t;let b=d.D.createDocumentFragment();for(let g of p){if(!g||!g.slot){c&&b.appendChild(g);continue}let D=g.slot,j=o[D];vt(g,"remove","slot"),j&&(ht(j,g,n),Reflect.deleteProperty(o,D))}return c&&(o[r].replaceWith(b),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(f=>f.remove()),t.append(...s)}return e}function ht(t,e,n){n&&n(t,e);try{t.replaceWith(P(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}T.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=d.D.createComment(``);return e&&(r.end=d.D.createComment("")),r};function Mt(t){let e=this;return function(...r){F=t;let o=T.call(e,...r);return F=void 0,o}}var $=new WeakMap,{setDeleteAttr:X}=d;function P(t,...e){if(!e.length)return t;$.set(t,et(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))tt.call(this,t,n,r);return $.delete(t),t}function tt(t,e,n){let{setRemoveAttr:r,s:o}=et(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(f,p)=>tt.call(c,t,f,p));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return Y(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return X(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return B(o,n,Y.bind(null,t[e]));case"ariaset":return B(o,n,(f,p)=>r("aria-"+f,p));case"classList":return bt.call(c,t,n)}return gt(t,e)?X(t,e,n):r(e,n)}function et(t,e){if($.has(t))return $.get(t);let r=(t instanceof d.S?xt:Et).bind(null,t,"Attribute"),o=M(e);return{setRemoveAttr:r,s:o}}function bt(t,e){let n=M(this);return B(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Wt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function vt(t,e,n,r){return t instanceof d.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function gt(t,e){if(!Reflect.has(t,e))return!1;let n=nt(t,e);return!w(n.set)}function nt(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||nt(t,e)}function B(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function rt(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Et(t,e,n,r){return t[(w(r)?"remove":"set")+e](n,rt(r))}function xt(t,e,n,r,o=null){return t[(w(r)?"remove":"set")+e+"NS"](o,n,rt(r))}function Y(t,e,n){if(Reflect.set(t,e,n),!!w(n))return Reflect.deleteProperty(t,e)}var C=d.M?mt():new Proxy({},{get(){return()=>{}}});function mt(){let t=new Map,e=!1,n=i=>function(a){for(let u of a)if(u.type==="childList"){if(g(u.addedNodes,!0)){i();continue}D(u.removedNodes,!0)&&i()}},r=new d.M(n(f));return{observe(i){let a=new d.M(n(()=>{}));return a.observe(i,{childList:!0,subtree:!0}),()=>a.disconnect()},onConnected(i,a){s();let u=c(i);u.connected.has(a)||(u.connected.add(a),u.length_c+=1)},offConnected(i,a){if(!t.has(i))return;let u=t.get(i);u.connected.has(a)&&(u.connected.delete(a),u.length_c-=1,o(i,u))},onDisconnected(i,a){s();let u=c(i);u.disconnected.has(a)||(u.disconnected.add(a),u.length_d+=1)},offDisconnected(i,a){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(a)&&(u.disconnected.delete(a),u.length_d-=1,o(i,u))}};function o(i,a){a.length_c||a.length_d||(t.delete(i),f())}function c(i){if(t.has(i))return t.get(i);let a={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,a),a}function s(){e||(e=!0,r.observe(d.D.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function b(i){t.size>30&&await p();let a=[];if(!(i instanceof Node))return a;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&a.push(u);return a}function g(i,a){let u=!1;for(let x of i){if(a&&b(x).then(g),!t.has(x))continue;let k=t.get(x);k.length_c&&(x.dispatchEvent(new Event(y)),k.connected=new WeakSet,k.length_c=0,k.length_d||t.delete(x),u=!0)}return u}function D(i,a){let u=!1;for(let x of i)a&&b(x).then(D),!(!t.has(x)||!t.get(x).length_d)&&((queueMicrotask||setTimeout)(j(x)),u=!0);return u}function j(i){return()=>{i.isConnected||(i.dispatchEvent(new Event(_)),t.delete(i))}}}function It(t,e,n,r=Ot){E.push({scope:t,host:(...s)=>s.length?s.forEach(f=>f(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[A];o||yt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event(y)),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener(_,C.observe(e),{once:!0}),E.pop(),e.append(c)}function yt(t){return I(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event(y))}),I(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event(_)))}),I(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent(N,{detail:[o,c]})),e.apply(n,r)}),t.prototype[A]=!0,t}function I(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function Ot(t){return q(t,(e,n)=>e.getAttribute(n))}function Vt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function m(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var ot=t=>Object.assign({},typeof t=="object"?t:null,{once:!0});m.connected=function(t,e){return e=ot(e),function(r){return r.addEventListener(y,t,e),r[A]?r:r.isConnected?(r.dispatchEvent(new Event(y)),r):(W(e.signal,()=>C.offConnected(r,t))&&C.onConnected(r,t),r)}};m.disconnected=function(t,e){return e=ot(e),function(r){return r.addEventListener(_,t,e),r[A]||W(e.signal,()=>C.offDisconnected(r,t))&&C.onDisconnected(r,t),r}};var J=new WeakMap;m.disconnectedAsAbort=function(t){if(J.has(t))return J.get(t);let e=new AbortController;return J.set(t,e),t(m.disconnected(()=>e.abort())),e};var wt=new WeakSet;m.attributeChanged=function(t,e){return typeof e!="object"&&(e={}),function(r){if(r.addEventListener(N,t,e),r[A]||wt.has(r)||!d.M)return r;let o=new d.M(function(s){for(let{attributeName:f,target:p}of s)p.dispatchEvent(new CustomEvent(N,{detail:[f,p.getAttribute(f)]}))});return W(e.signal,()=>o.disconnect())&&o.observe(r,{attributes:!0}),r}};var l=Symbol.for("observable");function U(t){try{return Reflect.has(t,l)}catch{return!1}}var z=[],h=new WeakMap;function v(t,e){if(typeof t!="function")return ct(!1,t,e);if(U(t))return t;let n=ct(!0),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),z.push(r),at(n,t()),z.pop(),!c.length)return;let s=h.get(r);for(let f of c)s.has(f)||S(f,r)};return h.set(n[l],r),h.set(r,new Set([n])),r(),n}v.action=function(t,e,...n){let r=t[l],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};v.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));V(e,n),o&&o.addEventListener("abort",()=>S(e,n))}};v.symbols={onclear:Symbol.for("Observable.onclear")};v.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[l];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,l)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(n.clear(...c),h.delete(o))})}};var R="__dde_reactive";v.el=function(t,e){let n=T.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=E,s=f=>{if(!n.parentNode||!r.parentNode)return S(t,s);E.push(c);let p=e(f);E.pop(),Array.isArray(p)||(p=[p]);let b=n;for(;(b=n.nextSibling)!==r;)b.remove();n.after(...p),n.isConnected&&At(c.host())};return V(t,s),ut(t,s,n,e),s(t()),o};function At(t){!t||!t[R]||(requestIdleCallback||setTimeout)(function(){t[R]=t[R].filter(([e,n])=>n.isConnected?!0:(S(...e),!1))})}var _t={_set(t){this.value=t}};function Ct(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ft(r,r(),_t);return t[n]=o,o}}var Z="__dde_attributes";v.observedAttributes=function(t){let e=t[Z]={},n=q(t,Ct(e));return m.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`).
+ * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,f=this[Z][c];if(f)return v.action(f,"_set",s)})(t),m.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`).
+ * Investigate `__dde_attributes` key of the element.*/v.clear(...Object.values(this[Z]))})(t),n};var it={isObservable:U,processReactiveAttribute(t,e,n,r){if(!U(n))return n;let o=c=>{if(!t.isConnected)return S(n,o);r(e,c)};return V(n,o),ut(n,o,t,e),n()}};function ut(t,e,...n){let{current:r}=E;r.prevent||r.host(function(o){o[R]||(o[R]=[],m.disconnected(()=>o[R].forEach(([[c,s]])=>S(c,s,c[l]?.host()===o)))(o)),o[R].push([[t,e],...n])})}function ct(t,e,n){let r=t?()=>st(r):(...o)=>o.length?at(r,...o):st(r);return ft(r,e,n)}var Rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),G=class extends Error{constructor(){super();let[e,...n]=this.stack.split(`
+`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ft(t,e,n){let r=[];K(n)!=="[object Object]"&&(n={});let{onclear:o}=v.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=E;return Reflect.defineProperty(t,l,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new G},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[l],Rt),t}function St(){return z[z.length-1]}function st(t){if(!t[l])return;let{value:e,listeners:n}=t[l],r=St();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function at(t,e,n){if(!t[l])return;let r=t[l];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function V(t,e){if(t[l])return t[l].listeners.add(e)}function S(t,e,n){let r=t[l];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(v.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>S(s,c,!0))}return o}H(it);export{v as O,P as assign,tt as assignAttribute,lt as chainableAppend,bt as classListDeclarative,T as createElement,Mt as createElementNS,It as customElementRender,yt as customElementWithDDE,Vt as dispatchEvent,T as el,Mt as elNS,vt as elementAttribute,Wt as empty,U as isObservable,yt as lifecycleToEvents,v as observable,Ot as observedAttributes,m as on,H as registerReactivity,E as scope,jt as simulateSlots};
diff --git a/dist/esm.js b/dist/esm.js
index 6fbed7e..f0a3ecf 100644
--- a/dist/esm.js
+++ b/dist/esm.js
@@ -1 +1 @@
-var A={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function z(t,e=!0){return e?Object.assign(A,t):(Object.setPrototypeOf(t,A),t)}function _(t){return A.isPrototypeOf(t)&&t!==A?t:A}function E(t){return typeof t>"u"}function O(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function k(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,B(o),e(t,o)),r},{})}function B(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var a={setDeleteAttr:I,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function I(t,e,n){if(Reflect.set(t,e,n),!!E(n)){if(Reflect.deleteProperty(t,e),t instanceof a.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var x="__dde_lifecycleToEvents";var v=[{get scope(){return a.D.body},host:t=>t?t(a.D.body):a.D.body,prevent:!0}],g={get current(){return v[v.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...v]},push(t={}){return v.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return v.push(v[0])},pop(){if(v.length!==1)return v.pop()}};function W(...t){return this.appendOriginal(...t),this}function Z(t){return t.append===W||(t.appendOriginal=t.append,t.append=W),t}var S;function T(t,e,...n){let r=_(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,g.push({scope:t,host:(...l)=>l.length?(o===1?n.unshift(...l):l.forEach(p=>p(s)),void 0):s}),c=t(e||void 0);let d=c instanceof a.F;if(c.nodeName==="#comment")break;let h=T.mark({type:"component",name:t.name,host:d?"this":"parentElement"});c.prepend(h),d&&(s=h);break}case t==="#text":c=C.call(this,a.D.createTextNode(""),e);break;case(t==="<>"||!t):c=C.call(this,a.D.createDocumentFragment(),e);break;case!!S:c=C.call(this,a.D.createElementNS(S,t),e);break;case!c:c=C.call(this,a.D.createElement(t),e)}return Z(c),s||(s=c),n.forEach(d=>d(s)),o&&g.pop(),o=2,c}function ft(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,d)=>Reflect.set(s,d.name||r,d)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,d,h){if(!h.length)return t;let l=a.D.createDocumentFragment();for(let p of h){if(!p||!p.slot){c&&l.appendChild(p);continue}let y=p.slot,R=o[y];J(p,"remove","slot"),R&&(G(R,p,n),Reflect.deleteProperty(o,y))}return c&&(o[r].replaceWith(l),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(d=>d.remove()),t.append(...s)}return e}function G(t,e,n){n&&n(t,e);try{t.replaceWith(C(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}T.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=a.D.createComment(``);return e&&(r.end=a.D.createComment("")),r};function at(t){let e=this;return function(...r){S=t;let o=T.call(e,...r);return S=void 0,o}}var L=new WeakMap,{setDeleteAttr:j}=a;function C(t,...e){if(!e.length)return t;L.set(t,$(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))F.call(this,t,n,r);return L.delete(t),t}function F(t,e,n){let{setRemoveAttr:r,s:o}=$(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,h)=>F.call(c,t,d,h));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return q(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return j(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return N(o,n,q.bind(null,t[e]));case"ariaset":return N(o,n,(d,h)=>r("aria-"+d,h));case"classList":return V.call(c,t,n)}return K(t,e)?j(t,e,n):r(e,n)}function $(t,e){if(L.has(t))return L.get(t);let r=(t instanceof a.S?X:Q).bind(null,t,"Attribute"),o=_(e);return{setRemoveAttr:r,s:o}}function V(t,e){let n=_(this);return N(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function dt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function J(t,e,n,r){return t instanceof a.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function K(t,e){if(!Reflect.has(t,e))return!1;let n=U(t,e);return!E(n.set)}function U(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||U(t,e)}function N(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function H(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Q(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,H(r))}function X(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,H(r))}function q(t,e,n){if(Reflect.set(t,e,n),!!E(n))return Reflect.deleteProperty(t,e)}var m=a.M?Y():new Proxy({},{get(){return()=>{}}});function Y(){let t=new Map,e=!1,n=i=>function(f){for(let u of f)if(u.type==="childList"){if(p(u.addedNodes,!0)){i();continue}y(u.removedNodes,!0)&&i()}},r=new a.M(n(d));return{observe(i){let f=new a.M(n(()=>{}));return f.observe(i,{childList:!0,subtree:!0}),()=>f.disconnect()},onConnected(i,f){s();let u=c(i);u.connected.has(f)||(u.connected.add(f),u.length_c+=1)},offConnected(i,f){if(!t.has(i))return;let u=t.get(i);u.connected.has(f)&&(u.connected.delete(f),u.length_c-=1,o(i,u))},onDisconnected(i,f){s();let u=c(i);u.disconnected.has(f)||(u.disconnected.add(f),u.length_d+=1)},offDisconnected(i,f){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(f)&&(u.disconnected.delete(f),u.length_d-=1,o(i,u))}};function o(i,f){f.length_c||f.length_d||(t.delete(i),d())}function c(i){if(t.has(i))return t.get(i);let f={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,f),f}function s(){e||(e=!0,r.observe(a.D.body,{childList:!0,subtree:!0}))}function d(){!e||t.size||(e=!1,r.disconnect())}function h(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function l(i){t.size>30&&await h();let f=[];if(!(i instanceof Node))return f;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&f.push(u);return f}function p(i,f){let u=!1;for(let b of i){if(f&&l(b).then(p),!t.has(b))continue;let w=t.get(b);w.length_c&&(b.dispatchEvent(new Event("dde:connected")),w.connected=new WeakSet,w.length_c=0,w.length_d||t.delete(b),u=!0)}return u}function y(i,f){let u=!1;for(let b of i)f&&l(b).then(y),!(!t.has(b)||!t.get(b).length_d)&&((queueMicrotask||setTimeout)(R(b)),u=!0);return u}function R(i){return()=>{i.isConnected||(i.dispatchEvent(new Event("dde:disconnected")),t.delete(i))}}}function xt(t,e,n,r=et){g.push({scope:t,host:(...s)=>s.length?s.forEach(d=>d(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[x];o||tt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event("dde:connected")),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener("dde:disconnected",m.observe(e),{once:!0}),g.pop(),e.append(c)}function tt(t){return M(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),M(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),M(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent("dde:attributeChanged",{detail:[o,c]})),e.apply(n,r)}),t.prototype[x]=!0,t}function M(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function et(t){return k(t,(e,n)=>e.getAttribute(n))}function At(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function D(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var nt=new WeakSet;D.connected=function(t,e){let{custom_element:n}=g.current,r="connected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[x]?c:c.isConnected?(c.dispatchEvent(new Event(s)),c):(O(e.signal,()=>m.offConnected(c,t))&&m.onConnected(c,t),c)}};D.disconnected=function(t,e){let{custom_element:n}=g.current,r="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(c){n&&(c=n);let s="dde:"+r;return c.addEventListener(s,t,e),c[x]||O(e.signal,()=>m.offDisconnected(c,t))&&m.onDisconnected(c,t),c}};var P=new WeakMap;D.disconnectedAsAbort=function(t){if(P.has(t))return P.get(t);let e=new AbortController;return P.set(t,e),t(D.disconnected(()=>e.abort())),e};D.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o[x]||nt.has(o)||!a.M)return o;let s=new a.M(function(h){for(let{attributeName:l,target:p}of h)p.dispatchEvent(new CustomEvent(c,{detail:[l,p.getAttribute(l)]}))});return O(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};export{C as assign,F as assignAttribute,Z as chainableAppend,V as classListDeclarative,T as createElement,at as createElementNS,xt as customElementRender,tt as customElementWithDDE,At as dispatchEvent,T as el,at as elNS,J as elementAttribute,dt as empty,tt as lifecycleToEvents,et as observedAttributes,D as on,z as registerReactivity,g as scope,ft as simulateSlots};
+var C={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function G(t,e=!0){return e?Object.assign(C,t):(Object.setPrototypeOf(t,C),t)}function L(t){return C.isPrototypeOf(t)&&t!==C?t:C}function E(t){return typeof t>"u"}function N(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function q(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,V(o),e(t,o)),r},{})}function V(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var a={setDeleteAttr:J,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function J(t,e,n){if(Reflect.set(t,e,n),!!E(n)){if(Reflect.deleteProperty(t,e),t instanceof a.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var x="__dde_lifecycleToEvents",v="dde:connected",y="dde:disconnected",D="dde:attributeChanged";var g=[{get scope(){return a.D.body},host:t=>t?t(a.D.body):a.D.body,prevent:!0}],R={get current(){return g[g.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...g]},push(t={}){return g.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return g.push(g[0])},pop(){if(g.length!==1)return g.pop()}};function F(...t){return this.appendOriginal(...t),this}function K(t){return t.append===F||(t.appendOriginal=t.append,t.append=F),t}var T;function k(t,e,...n){let r=L(this),o=0,c,f;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,R.push({scope:t,host:(...b)=>b.length?(o===1?n.unshift(...b):b.forEach(l=>l(f)),void 0):f}),c=t(e||void 0);let d=c instanceof a.F;if(c.nodeName==="#comment")break;let p=k.mark({type:"component",name:t.name,host:d?"this":"parentElement"});c.prepend(p),d&&(f=p);break}case t==="#text":c=O.call(this,a.D.createTextNode(""),e);break;case(t==="<>"||!t):c=O.call(this,a.D.createDocumentFragment(),e);break;case!!T:c=O.call(this,a.D.createElementNS(T,t),e);break;case!c:c=O.call(this,a.D.createElement(t),e)}return K(c),f||(f=c),n.forEach(d=>d(f)),o&&R.pop(),o=2,c}function lt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((f,d)=>Reflect.set(f,d.name||r,d)&&f,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(f,d,p){if(!p.length)return t;let b=a.D.createDocumentFragment();for(let l of p){if(!l||!l.slot){c&&b.appendChild(l);continue}let A=l.slot,_=o[A];Y(l,"remove","slot"),_&&(Q(_,l,n),Reflect.deleteProperty(o,A))}return c&&(o[r].replaceWith(b),Reflect.deleteProperty(o,r)),t.append=f,t}}),t!==e){let f=Array.from(t.childNodes);f.forEach(d=>d.remove()),t.append(...f)}return e}function Q(t,e,n){n&&n(t,e);try{t.replaceWith(O(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}k.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=a.D.createComment(``);return e&&(r.end=a.D.createComment("")),r};function ht(t){let e=this;return function(...r){T=t;let o=k.call(e,...r);return T=void 0,o}}var M=new WeakMap,{setDeleteAttr:$}=a;function O(t,...e){if(!e.length)return t;M.set(t,z(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))H.call(this,t,n,r);return M.delete(t),t}function H(t,e,n){let{setRemoveAttr:r,s:o}=z(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,p)=>H.call(c,t,d,p));let[f]=e;if(f==="=")return r(e.slice(1),n);if(f===".")return U(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return $(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return P(o,n,U.bind(null,t[e]));case"ariaset":return P(o,n,(d,p)=>r("aria-"+d,p));case"classList":return X.call(c,t,n)}return tt(t,e)?$(t,e,n):r(e,n)}function z(t,e){if(M.has(t))return M.get(t);let r=(t instanceof a.S?nt:et).bind(null,t,"Attribute"),o=L(e);return{setRemoveAttr:r,s:o}}function X(t,e){let n=L(this);return P(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function bt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function Y(t,e,n,r){return t instanceof a.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function tt(t,e){if(!Reflect.has(t,e))return!1;let n=B(t,e);return!E(n.set)}function B(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||B(t,e)}function P(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function I(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function et(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,I(r))}function nt(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,I(r))}function U(t,e,n){if(Reflect.set(t,e,n),!!E(n))return Reflect.deleteProperty(t,e)}var w=a.M?rt():new Proxy({},{get(){return()=>{}}});function rt(){let t=new Map,e=!1,n=i=>function(u){for(let s of u)if(s.type==="childList"){if(l(s.addedNodes,!0)){i();continue}A(s.removedNodes,!0)&&i()}},r=new a.M(n(d));return{observe(i){let u=new a.M(n(()=>{}));return u.observe(i,{childList:!0,subtree:!0}),()=>u.disconnect()},onConnected(i,u){f();let s=c(i);s.connected.has(u)||(s.connected.add(u),s.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let s=t.get(i);s.connected.has(u)&&(s.connected.delete(u),s.length_c-=1,o(i,s))},onDisconnected(i,u){f();let s=c(i);s.disconnected.has(u)||(s.disconnected.add(u),s.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let s=t.get(i);s.disconnected.has(u)&&(s.disconnected.delete(u),s.length_d-=1,o(i,s))}};function o(i,u){u.length_c||u.length_d||(t.delete(i),d())}function c(i){if(t.has(i))return t.get(i);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,u),u}function f(){e||(e=!0,r.observe(a.D.body,{childList:!0,subtree:!0}))}function d(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function b(i){t.size>30&&await p();let u=[];if(!(i instanceof Node))return u;for(let s of t.keys())s===i||!(s instanceof Node)||i.contains(s)&&u.push(s);return u}function l(i,u){let s=!1;for(let h of i){if(u&&b(h).then(l),!t.has(h))continue;let m=t.get(h);m.length_c&&(h.dispatchEvent(new Event(v)),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(h),s=!0)}return s}function A(i,u){let s=!1;for(let h of i)u&&b(h).then(A),!(!t.has(h)||!t.get(h).length_d)&&((queueMicrotask||setTimeout)(_(h)),s=!0);return s}function _(i){return()=>{i.isConnected||(i.dispatchEvent(new Event(y)),t.delete(i))}}}function mt(t,e,n,r=ct){R.push({scope:t,host:(...f)=>f.length?f.forEach(d=>d(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[x];o||ot(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event(v)),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener(y,w.observe(e),{once:!0}),R.pop(),e.append(c)}function ot(t){return W(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event(v))}),W(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event(y)))}),W(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent(D,{detail:[o,c]})),e.apply(n,r)}),t.prototype[x]=!0,t}function W(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function ct(t){return q(t,(e,n)=>e.getAttribute(n))}function Rt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let f=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(f)}}function S(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var Z=t=>Object.assign({},typeof t=="object"?t:null,{once:!0});S.connected=function(t,e){return e=Z(e),function(r){return r.addEventListener(v,t,e),r[x]?r:r.isConnected?(r.dispatchEvent(new Event(v)),r):(N(e.signal,()=>w.offConnected(r,t))&&w.onConnected(r,t),r)}};S.disconnected=function(t,e){return e=Z(e),function(r){return r.addEventListener(y,t,e),r[x]||N(e.signal,()=>w.offDisconnected(r,t))&&w.onDisconnected(r,t),r}};var j=new WeakMap;S.disconnectedAsAbort=function(t){if(j.has(t))return j.get(t);let e=new AbortController;return j.set(t,e),t(S.disconnected(()=>e.abort())),e};var it=new WeakSet;S.attributeChanged=function(t,e){return typeof e!="object"&&(e={}),function(r){if(r.addEventListener(D,t,e),r[x]||it.has(r)||!a.M)return r;let o=new a.M(function(f){for(let{attributeName:d,target:p}of f)p.dispatchEvent(new CustomEvent(D,{detail:[d,p.getAttribute(d)]}))});return N(e.signal,()=>o.disconnect())&&o.observe(r,{attributes:!0}),r}};export{O as assign,H as assignAttribute,K as chainableAppend,X as classListDeclarative,k as createElement,ht as createElementNS,mt as customElementRender,ot as customElementWithDDE,Rt as dispatchEvent,k as el,ht as elNS,Y as elementAttribute,bt as empty,ot as lifecycleToEvents,ct as observedAttributes,S as on,G as registerReactivity,R as scope,lt as simulateSlots};
diff --git a/examples/components/webComponent.js b/examples/components/webComponent.js
index 8f67f0d..4af23bd 100644
--- a/examples/components/webComponent.js
+++ b/examples/components/webComponent.js
@@ -21,7 +21,6 @@ export class CustomHTMLTestElement extends HTMLElement{
}
render({ name, preName, test }){
console.log(scope.state);
- console.log({ name, preName, test });
scope.host(
on.connected(()=> console.log(CustomHTMLTestElement)),
on.attributeChanged(e=> console.log(e)),
diff --git a/src/customElement.js b/src/customElement.js
index 64f3209..59f77ff 100644
--- a/src/customElement.js
+++ b/src/customElement.js
@@ -1,4 +1,4 @@
-import { keyLTE } from "./dom-common.js";
+import { keyLTE, evc, evd, eva } from "./dom-common.js";
import { scope } from "./dom.js";
import { c_ch_o } from "./events-observer.js";
export function customElementRender(custom_element, target, render, props= observedAttributes){
@@ -10,26 +10,26 @@ export function customElementRender(custom_element, target, render, props= obser
const is_lte= custom_element[keyLTE];
if(!is_lte) lifecycleToEvents(custom_element);
const out= render.call(custom_element, props);
- if(!is_lte) custom_element.dispatchEvent(new Event("dde:connected"));
+ if(!is_lte) custom_element.dispatchEvent(new Event(evc));
if(target.nodeType===11 && typeof target.mode==="string") // is ShadowRoot
- custom_element.addEventListener("dde:disconnected", c_ch_o.observe(target), { once: true });
+ custom_element.addEventListener(evd, c_ch_o.observe(target), { once: true });
scope.pop();
return target.append(out);
}
export function lifecycleToEvents(class_declaration){
wrapMethod(class_declaration.prototype, "connectedCallback", function(target, thisArg, detail){
target.apply(thisArg, detail);
- thisArg.dispatchEvent(new Event("dde:connected"));
+ thisArg.dispatchEvent(new Event(evc));
});
wrapMethod(class_declaration.prototype, "disconnectedCallback", function(target, thisArg, detail){
target.apply(thisArg, detail);
(queueMicrotask || setTimeout)(
- ()=> !thisArg.isConnected && thisArg.dispatchEvent(new Event("dde:disconnected"))
+ ()=> !thisArg.isConnected && thisArg.dispatchEvent(new Event(evd))
);
});
wrapMethod(class_declaration.prototype, "attributeChangedCallback", function(target, thisArg, detail){
const [ attribute, , value ]= detail;
- thisArg.dispatchEvent(new CustomEvent("dde:attributeChanged", {
+ thisArg.dispatchEvent(new CustomEvent(eva, {
detail: [ attribute, value ]
}));
target.apply(thisArg, detail);
@@ -45,4 +45,4 @@ function wrapMethod(obj, method, apply){
import { observedAttributes as oA } from "./helpers.js";
export function observedAttributes(instance){
return oA(instance, (i, n)=> i.getAttribute(n));
-}
\ No newline at end of file
+}
diff --git a/src/dom-common.js b/src/dom-common.js
index 73dbe6c..fa160f1 100644
--- a/src/dom-common.js
+++ b/src/dom-common.js
@@ -27,3 +27,6 @@ function setDeleteAttr(obj, prop, val){
return Reflect.set(obj, prop, "");
}
export const keyLTE= "__dde_lifecycleToEvents"; //boolean
+export const evc= "dde:connected";
+export const evd= "dde:disconnected";
+export const eva= "dde:attributeChanged";
diff --git a/src/events-observer.js b/src/events-observer.js
index a4d7376..a946c31 100644
--- a/src/events-observer.js
+++ b/src/events-observer.js
@@ -1,4 +1,4 @@
-import { enviroment as env } from './dom-common.js';
+import { enviroment as env, evc, evd } from './dom-common.js';
export const c_ch_o= env.M ? connectionsChangesObserverConstructor() : new Proxy({}, {
get(){ return ()=> {}; }
});
@@ -107,7 +107,7 @@ function connectionsChangesObserverConstructor(){
const ls= store.get(element);
if(!ls.length_c) continue;
- element.dispatchEvent(new Event("dde:connected"));
+ element.dispatchEvent(new Event(evc));
ls.connected= new WeakSet();
ls.length_c= 0;
if(!ls.length_d) store.delete(element);
@@ -131,7 +131,7 @@ function connectionsChangesObserverConstructor(){
function dispatchRemove(element){
return ()=> {
if(element.isConnected) return;
- element.dispatchEvent(new Event("dde:disconnected"));
+ element.dispatchEvent(new Event(evd));
store.delete(element);
};
}
diff --git a/src/events.js b/src/events.js
index 186f87b..bd07237 100644
--- a/src/events.js
+++ b/src/events.js
@@ -1,5 +1,5 @@
export { registerReactivity } from './observables-common.js';
-import { enviroment as env, keyLTE } from './dom-common.js';
+import { enviroment as env, keyLTE, evc, evd, eva } from './dom-common.js';
export function dispatchEvent(name, options, host){
if(!options) options= {};
@@ -20,23 +20,16 @@ export function on(event, listener, options){
}
import { c_ch_o } from "./events-observer.js";
-const els_attribute_store= new WeakSet();
-import { scope } from "./dom.js";
import { onAbort } from './helpers.js';
+const lifeOptions= obj=> Object.assign({}, typeof obj==="object" ? obj : null, { once: true });
//TODO: cleanUp when event before abort?
//TODO: docs (e.g.) https://nolanlawson.com/2024/01/13/web-component-gotcha-constructor-vs-connectedcallback/
on.connected= function(listener, options){
- const { custom_element }= scope.current;
- const name= "connected";
- if(typeof options !== "object")
- options= {};
- options.once= true;
+ options= lifeOptions(options);
return function registerElement(element){
- if(custom_element) element= custom_element;
- const event= "dde:"+name;
- element.addEventListener(event, listener, options);
+ element.addEventListener(evc, listener, options);
if(element[keyLTE]) return element;
- if(element.isConnected) return ( element.dispatchEvent(new Event(event)), element );
+ if(element.isConnected) return ( element.dispatchEvent(new Event(evc)), element );
const c= onAbort(options.signal, ()=> c_ch_o.offConnected(element, listener));
if(c) c_ch_o.onConnected(element, listener);
@@ -44,15 +37,9 @@ on.connected= function(listener, options){
};
};
on.disconnected= function(listener, options){
- const { custom_element }= scope.current;
- const name= "disconnected";
- if(typeof options !== "object")
- options= {};
- options.once= true;
+ options= lifeOptions(options);
return function registerElement(element){
- if(custom_element) element= custom_element;
- const event= "dde:"+name;
- element.addEventListener(event, listener, options);
+ element.addEventListener(evd, listener, options);
if(element[keyLTE]) return element;
const c= onAbort(options.signal, ()=> c_ch_o.offDisconnected(element, listener));
@@ -69,13 +56,12 @@ on.disconnectedAsAbort= function(host){
host(on.disconnected(()=> a.abort()));
return a;
};
+const els_attribute_store= new WeakSet();
on.attributeChanged= function(listener, options){
- const name= "attributeChanged";
if(typeof options !== "object")
options= {};
return function registerElement(element){
- const event= "dde:"+name;
- element.addEventListener(event, listener, options);
+ element.addEventListener(eva, listener, options);
if(element[keyLTE] || els_attribute_store.has(element))
return element;
@@ -84,7 +70,7 @@ on.attributeChanged= function(listener, options){
const observer= new env.M(function(mutations){
for(const { attributeName, target } of mutations)
target.dispatchEvent(
- new CustomEvent(event, { detail: [ attributeName, target.getAttribute(attributeName) ] }));
+ new CustomEvent(eva, { detail: [ attributeName, target.getAttribute(attributeName) ] }));
});
const c= onAbort(options.signal, ()=> observer.disconnect());
if(c) observer.observe(element, { attributes: true });