diff --git a/dist/dde-with-observables.js b/dist/dde-with-observables.js
index 6720c35..cc578f9 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 R={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function F(t,e=!0){return e?Object.assign(R,t):(Object.setPrototypeOf(t,R),t)}function N(t){return R.isPrototypeOf(t)&&t!==R?t:R}function A(t){return typeof t>"u"}function J(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function P(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function L(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,st(o),e(t,o)),r},{})}function st(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:it,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function it(t,e,n){if(Reflect.set(t,e,n),!!A(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 _="__dde_lifecycleToEvents";var y=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,custom_element:!1,prevent:!0}],v={get current(){return y[y.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...y]},push(t={}){return y.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return y.push(y[0])},pop(){if(y.length!==1)return y.pop()}};function Z(...t){return this.appendOriginal(...t),this}function ut(t){return t.append===Z||(t.appendOriginal=t.append,t.append=Z),t}var T;function D(t,e,...n){let r=N(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:(...p)=>p.length?(o===1?n.unshift(...p):p.forEach(b=>b(s)),void 0):s}),c=t(e||void 0);let a=c instanceof d.F;if(c.nodeName==="#comment")break;let l=D.mark({type:"component",name:t.name,host:a?"this":"parentElement"});c.prepend(l),a&&(s=l);break}case t==="#text":c=S.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=S.call(this,d.D.createDocumentFragment(),e);break;case!!T:c=S.call(this,d.D.createElementNS(T,t),e);break;case!c:c=S.call(this,d.D.createElement(t),e)}return ut(c),s||(s=c),n.forEach(a=>a(s)),o&&v.pop(),o=2,c}function Dt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,a)=>Reflect.set(s,a.name||r,a)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,a,l){if(!l.length)return t;let p=d.D.createDocumentFragment();for(let b of l){if(!b||!b.slot){c&&p.appendChild(b);continue}let k=b.slot,i=o[k];dt(b,"remove","slot"),i&&(ft(i,b,n),Reflect.deleteProperty(o,k))}return c&&(o[r].replaceWith(p),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(a=>a.remove()),t.append(...s)}return e}function ft(t,e,n){n&&n(t,e);try{t.replaceWith(S(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}D.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 kt(t){let e=this;return function(...r){T=t;let o=D.call(e,...r);return T=void 0,o}}var j=new WeakMap,{setDeleteAttr:G}=d;function S(t,...e){if(!e.length)return t;j.set(t,Q(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))K.call(this,t,n,r);return j.delete(t),t}function K(t,e,n){let{setRemoveAttr:r,s:o}=Q(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(a,l)=>K.call(c,t,a,l));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return V(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 G(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return $(o,n,V.bind(null,t[e]));case"ariaset":return $(o,n,(a,l)=>r("aria-"+a,l));case"classList":return at.call(c,t,n)}return lt(t,e)?G(t,e,n):r(e,n)}function Q(t,e){if(j.has(t))return j.get(t);let r=(t instanceof d.S?ht:pt).bind(null,t,"Attribute"),o=N(e);return{setRemoveAttr:r,s:o}}function at(t,e){let n=N(this);return $(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Nt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function dt(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=X(t,e);return!A(n.set)}function X(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||X(t,e)}function $(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 Y(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function pt(t,e,n,r){return t[(A(r)?"remove":"set")+e](n,Y(r))}function ht(t,e,n,r,o=null){return t[(A(r)?"remove":"set")+e+"NS"](o,n,Y(r))}function V(t,e,n){if(Reflect.set(t,e,n),!!A(n))return Reflect.deleteProperty(t,e)}function Mt(t,e,n=bt){v.push({scope:t,host:(...o)=>o.length?o.forEach(c=>c(t)):t,custom_element:t}),typeof n=="function"&&(n=n.call(t,t));let r=e.call(t,n);return v.pop(),r}function Wt(t){return U(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),U(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),U(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[_]=!0,t}function U(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function bt(t){return L(t,(e,n)=>e.getAttribute(n))}function Ut(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 x(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var M=d.M?gt():new Proxy({},{get(){return()=>{}}}),vt=new WeakSet;x.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[_]?c:c.isConnected?(c.dispatchEvent(new Event(s)),c):(P(e.signal,()=>M.offConnected(c,t))&&M.onConnected(c,t),c)}};x.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[_]||P(e.signal,()=>M.offDisconnected(c,t))&&M.onDisconnected(c,t),c}};var z=new WeakMap;x.disconnectedAsAbort=function(t){if(z.has(t))return z.get(t);let e=new AbortController;return z.set(t,e),t(x.disconnected(()=>e.abort())),e};x.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[_]||vt.has(o)||!d.M)return o;let s=new d.M(function(l){for(let{attributeName:p,target:b}of l)b.dispatchEvent(new CustomEvent(c,{detail:[p,b.getAttribute(p)]}))});return P(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function gt(){let t=new Map,e=!1,n=new d.M(function(i){for(let u of i)if(u.type==="childList"){if(p(u.addedNodes,!0)){s();continue}b(u.removedNodes,!0)&&s()}});return{onConnected(i,u){c();let f=o(i);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let f=t.get(i);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(i,f))},onDisconnected(i,u){c();let f=o(i);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let f=t.get(i);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(i,f))}};function r(i,u){u.length_c||u.length_d||(t.delete(i),s())}function o(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 c(){e||(e=!0,n.observe(d.D.body,{childList:!0,subtree:!0}))}function s(){!e||t.size||(e=!1,n.disconnect())}function a(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function l(i){t.size>30&&await a();let u=[];if(!(i instanceof Node))return u;for(let f of t.keys())f===i||!(f instanceof Node)||i.contains(f)&&u.push(f);return u}function p(i,u){let f=!1;for(let E of i){if(u&&l(E).then(p),!t.has(E))continue;let C=t.get(E);C.length_c&&(E.dispatchEvent(new Event("dde:connected")),C.connected=new WeakSet,C.length_c=0,C.length_d||t.delete(E),f=!0)}return f}function b(i,u){let f=!1;for(let E of i)u&&l(E).then(b),!(!t.has(E)||!t.get(E).length_d)&&((queueMicrotask||setTimeout)(k(E)),f=!0);return f}function k(i){return()=>{i.isConnected||(i.dispatchEvent(new Event("dde:disconnected")),t.delete(i))}}}var h=Symbol.for("observable");function W(t){try{return Reflect.has(t,h)}catch{return!1}}var q=[],g=new WeakMap;function m(t,e){if(typeof t!="function")return tt(!1,t,e);if(W(t))return t;let n=tt(!0),r=function(){let[o,...c]=g.get(r);if(g.set(r,new Set([o])),q.push(r),ct(n,t()),q.pop(),!c.length)return;let s=g.get(r);for(let a of c)s.has(a)||w(a,r)};return g.set(n[h],r),g.set(r,new Set([n])),r(),n}m.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))};m.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));I(e,n),o&&o.addEventListener("abort",()=>w(e,n))}};m.symbols={onclear:Symbol.for("Observable.onclear")};m.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 O="__dde_reactive";m.el=function(t,e){let n=D.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=v,s=a=>{if(!n.parentNode||!r.parentNode)return w(t,s);v.push(c);let l=e(a);v.pop(),Array.isArray(l)||(l=[l]);let p=n;for(;(p=n.nextSibling)!==r;)p.remove();n.after(...l),n.isConnected&&mt(c.host())};return I(t,s),rt(t,s,n,e),s(t()),o};function mt(t){!t||!t[O]||(requestIdleCallback||setTimeout)(function(){t[O]=t[O].filter(([e,n])=>n.isConnected?!0:(w(...e),!1))})}var Et={_set(t){this.value=t}};function xt(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ot(r,r(),Et);return t[n]=o,o}}var H="__dde_attributes";m.observedAttributes=function(t){let e=t[H]={},n=L(t,xt(e));return x.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,a=this[H][c];if(a)return m.action(a,"_set",s)})(t),x.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/m.clear(...Object.values(this[H]))})(t),n};var nt={isObservable:W,processReactiveAttribute(t,e,n,r){if(!W(n))return n;let o=c=>{if(!t.isConnected)return w(n,o);r(e,c)};return I(n,o),rt(n,o,t,e),n()}};function rt(t,e,...n){let{current:r}=v;r.prevent||r.host(function(o){o[O]||(o[O]=[],x.disconnected(()=>o[O].forEach(([[c,s]])=>w(c,s,c[h]?.host()===o)))(o)),o[O].push([[t,e],...n])})}function tt(t,e,n){let r=t?()=>et(r):(...o)=>o.length?ct(r,...o):et(r);return ot(r,e,n)}var yt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),B=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 ot(t,e,n){let r=[];J(n)!=="[object Object]"&&(n={});let{onclear:o}=m.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 B},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[h],yt),t}function At(){return q[q.length-1]}function et(t){if(!t[h])return;let{value:e,listeners:n}=t[h],r=At();return r&&n.add(r),g.has(r)&&g.get(r).add(t),e}function ct(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 I(t,e){if(t[h])return t[h].listeners.add(e)}function w(t,e,n){let r=t[h];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(m.clear(t),!g.has(r))return o;let c=g.get(r);if(!g.has(c))return o;g.get(c).forEach(s=>w(s,c,!0))}return o}F(nt);
-globalThis.dde= {O: m,
-assign: S,
-assignAttribute: K,
-chainableAppend: ut,
-classListDeclarative: at,
-createElement: D,
-createElementNS: kt,
-customElementRender: Mt,
-customElementWithDDE: Wt,
-dispatchEvent: Ut,
-el: D,
-elNS: kt,
-elementAttribute: dt,
-empty: Nt,
-isObservable: W,
-lifecycleToEvents: Wt,
-observable: m,
-observedAttributes: bt,
-on: x,
-registerReactivity: F,
+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: Dt
+simulateSlots: Lt
};
})();
\ No newline at end of file
diff --git a/dist/dde.js b/dist/dde.js
index 4005c82..cea6ee4 100644
--- a/dist/dde.js
+++ b/dist/dde.js
@@ -1,25 +1,25 @@
//deka-dom-el library is available via global namespace `dde`
(()=> {
-var y={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function H(t,e=!0){return e?Object.assign(y,t):(Object.setPrototypeOf(t,y),t)}function D(t){return y.isPrototypeOf(t)&&t!==y?t:y}function E(t){return typeof t>"u"}function R(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function M(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,z(o),e(t,o)),r},{})}function z(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var a={setDeleteAttr:B,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function B(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 g=[{get scope(){return a.D.body},host:t=>t?t(a.D.body):a.D.body,custom_element:!1,prevent:!0}],v={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 k(...t){return this.appendOriginal(...t),this}function I(t){return t.append===k||(t.appendOriginal=t.append,t.append=k),t}var O;function L(t,e,...n){let r=D(this),o=0,c,i;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,v.push({scope:t,host:(...h)=>h.length?(o===1?n.unshift(...h):h.forEach(l=>l(i)),void 0):i}),c=t(e||void 0);let d=c instanceof a.F;if(c.nodeName==="#comment")break;let p=L.mark({type:"component",name:t.name,host:d?"this":"parentElement"});c.prepend(p),d&&(i=p);break}case t==="#text":c=A.call(this,a.D.createTextNode(""),e);break;case(t==="<>"||!t):c=A.call(this,a.D.createDocumentFragment(),e);break;case!!O:c=A.call(this,a.D.createElementNS(O,t),e);break;case!c:c=A.call(this,a.D.createElement(t),e)}return I(c),i||(i=c),n.forEach(d=>d(i)),o&&v.pop(),o=2,c}function it(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((i,d)=>Reflect.set(i,d.name||r,d)&&i,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(i,d,p){if(!p.length)return t;let h=a.D.createDocumentFragment();for(let l of p){if(!l||!l.slot){c&&h.appendChild(l);continue}let C=l.slot,s=o[C];V(l,"remove","slot"),s&&(Z(s,l,n),Reflect.deleteProperty(o,C))}return c&&(o[r].replaceWith(h),Reflect.deleteProperty(o,r)),t.append=i,t}}),t!==e){let i=Array.from(t.childNodes);i.forEach(d=>d.remove()),t.append(...i)}return e}function Z(t,e,n){n&&n(t,e);try{t.replaceWith(A(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=a.D.createComment(``);return e&&(r.end=a.D.createComment("")),r};function ut(t){let e=this;return function(...r){O=t;let o=L.call(e,...r);return O=void 0,o}}var _=new WeakMap,{setDeleteAttr:W}=a;function A(t,...e){if(!e.length)return t;_.set(t,F(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))q.call(this,t,n,r);return _.delete(t),t}function q(t,e,n){let{setRemoveAttr:r,s:o}=F(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,p)=>q.call(c,t,d,p));let[i]=e;if(i==="=")return r(e.slice(1),n);if(i===".")return j(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 W(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return N(o,n,j.bind(null,t[e]));case"ariaset":return N(o,n,(d,p)=>r("aria-"+d,p));case"classList":return G.call(c,t,n)}return J(t,e)?W(t,e,n):r(e,n)}function F(t,e){if(_.has(t))return _.get(t);let r=(t instanceof a.S?Q:K).bind(null,t,"Attribute"),o=D(e);return{setRemoveAttr:r,s:o}}function G(t,e){let n=D(this);return N(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function ft(t){return Array.from(t.children).forEach(e=>e.remove()),t}function V(t,e,n,r){return t instanceof a.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function J(t,e){if(!Reflect.has(t,e))return!1;let n=$(t,e);return!E(n.set)}function $(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||$(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 U(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function K(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,U(r))}function Q(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,U(r))}function j(t,e,n){if(Reflect.set(t,e,n),!!E(n))return Reflect.deleteProperty(t,e)}function ht(t,e,n=X){v.push({scope:t,host:(...o)=>o.length?o.forEach(c=>c(t)):t,custom_element:t}),typeof n=="function"&&(n=n.call(t,t));let r=e.call(t,n);return v.pop(),r}function bt(t){return T(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),T(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),T(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 T(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function X(t){return M(t,(e,n)=>e.getAttribute(n))}function xt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let i=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(i)}}function w(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var S=a.M?tt():new Proxy({},{get(){return()=>{}}}),Y=new WeakSet;w.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 i="dde:"+r;return c.addEventListener(i,t,e),c[x]?c:c.isConnected?(c.dispatchEvent(new Event(i)),c):(R(e.signal,()=>S.offConnected(c,t))&&S.onConnected(c,t),c)}};w.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 i="dde:"+r;return c.addEventListener(i,t,e),c[x]||R(e.signal,()=>S.offDisconnected(c,t))&&S.onDisconnected(c,t),c}};var P=new WeakMap;w.disconnectedAsAbort=function(t){if(P.has(t))return P.get(t);let e=new AbortController;return P.set(t,e),t(w.disconnected(()=>e.abort())),e};w.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]||Y.has(o)||!a.M)return o;let i=new a.M(function(p){for(let{attributeName:h,target:l}of p)l.dispatchEvent(new CustomEvent(c,{detail:[h,l.getAttribute(h)]}))});return R(e.signal,()=>i.disconnect())&&i.observe(o,{attributes:!0}),o}};function tt(){let t=new Map,e=!1,n=new a.M(function(s){for(let u of s)if(u.type==="childList"){if(h(u.addedNodes,!0)){i();continue}l(u.removedNodes,!0)&&i()}});return{onConnected(s,u){c();let f=o(s);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(s,u){if(!t.has(s))return;let f=t.get(s);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(s,f))},onDisconnected(s,u){c();let f=o(s);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(s,u){if(!t.has(s))return;let f=t.get(s);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(s,f))}};function r(s,u){u.length_c||u.length_d||(t.delete(s),i())}function o(s){if(t.has(s))return t.get(s);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(s,u),u}function c(){e||(e=!0,n.observe(a.D.body,{childList:!0,subtree:!0}))}function i(){!e||t.size||(e=!1,n.disconnect())}function d(){return new Promise(function(s){(requestIdleCallback||requestAnimationFrame)(s)})}async function p(s){t.size>30&&await d();let u=[];if(!(s instanceof Node))return u;for(let f of t.keys())f===s||!(f instanceof Node)||s.contains(f)&&u.push(f);return u}function h(s,u){let f=!1;for(let b of s){if(u&&p(b).then(h),!t.has(b))continue;let m=t.get(b);m.length_c&&(b.dispatchEvent(new Event("dde:connected")),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(b),f=!0)}return f}function l(s,u){let f=!1;for(let b of s)u&&p(b).then(l),!(!t.has(b)||!t.get(b).length_d)&&((queueMicrotask||setTimeout)(C(b)),f=!0);return f}function C(s){return()=>{s.isConnected||(s.dispatchEvent(new Event("dde:disconnected")),t.delete(s))}}}
-globalThis.dde= {assign: A,
-assignAttribute: q,
-chainableAppend: I,
-classListDeclarative: G,
-createElement: L,
-createElementNS: ut,
-customElementRender: ht,
-customElementWithDDE: bt,
-dispatchEvent: xt,
-el: L,
-elNS: ut,
-elementAttribute: V,
-empty: ft,
-lifecycleToEvents: bt,
-observedAttributes: X,
-on: w,
-registerReactivity: H,
-scope: v,
-simulateSlots: it
+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
};
})();
\ No newline at end of file
diff --git a/dist/esm-with-observables.d.ts b/dist/esm-with-observables.d.ts
index 8e755e1..aba4ec8 100644
--- a/dist/esm-with-observables.d.ts
+++ b/dist/esm-with-observables.d.ts
@@ -3,6 +3,7 @@ type Action= (this: { value: V, stopPropagation(): void }, ...a: any[])=> typ
//type SymbolObservable= Symbol;
type SymbolOnclear= symbol;
type Actions= Record>;
+type OnListenerOptions= Pick & { first_time?: boolean };
interface observable{
_: Symbol
/**
@@ -40,7 +41,7 @@ interface observable{
...params: A[N] extends (...args: infer P)=> any ? P : never
): void;
clear(...observables: Observable[]): void;
- on(observable: Observable, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
+ on(observable: Observable, onchange: (a: T)=> void, options?: OnListenerOptions): void;
symbols: {
//observable: SymbolObservable;
onclear: SymbolOnclear;
@@ -239,6 +240,7 @@ export function customElementRender<
P extends any = Record
>(
custom_element: EL,
+ target: ShadowRoot | EL,
render: (props: P)=> SupportedElement,
props?: P | ((...args: any[])=> P)
): EL
diff --git a/dist/esm-with-observables.js b/dist/esm-with-observables.js
index 76ef113..e45d52c 100644
--- a/dist/esm-with-observables.js
+++ b/dist/esm-with-observables.js
@@ -1,4 +1,4 @@
-var R={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function F(t,e=!0){return e?Object.assign(R,t):(Object.setPrototypeOf(t,R),t)}function N(t){return R.isPrototypeOf(t)&&t!==R?t:R}function A(t){return typeof t>"u"}function J(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function P(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function L(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,st(o),e(t,o)),r},{})}function st(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:it,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function it(t,e,n){if(Reflect.set(t,e,n),!!A(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 _="__dde_lifecycleToEvents";var y=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,custom_element:!1,prevent:!0}],v={get current(){return y[y.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...y]},push(t={}){return y.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return y.push(y[0])},pop(){if(y.length!==1)return y.pop()}};function Z(...t){return this.appendOriginal(...t),this}function ut(t){return t.append===Z||(t.appendOriginal=t.append,t.append=Z),t}var T;function D(t,e,...n){let r=N(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:(...p)=>p.length?(o===1?n.unshift(...p):p.forEach(b=>b(s)),void 0):s}),c=t(e||void 0);let a=c instanceof d.F;if(c.nodeName==="#comment")break;let l=D.mark({type:"component",name:t.name,host:a?"this":"parentElement"});c.prepend(l),a&&(s=l);break}case t==="#text":c=S.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=S.call(this,d.D.createDocumentFragment(),e);break;case!!T:c=S.call(this,d.D.createElementNS(T,t),e);break;case!c:c=S.call(this,d.D.createElement(t),e)}return ut(c),s||(s=c),n.forEach(a=>a(s)),o&&v.pop(),o=2,c}function Dt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,a)=>Reflect.set(s,a.name||r,a)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,a,l){if(!l.length)return t;let p=d.D.createDocumentFragment();for(let b of l){if(!b||!b.slot){c&&p.appendChild(b);continue}let k=b.slot,i=o[k];dt(b,"remove","slot"),i&&(ft(i,b,n),Reflect.deleteProperty(o,k))}return c&&(o[r].replaceWith(p),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(a=>a.remove()),t.append(...s)}return e}function ft(t,e,n){n&&n(t,e);try{t.replaceWith(S(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}D.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 kt(t){let e=this;return function(...r){T=t;let o=D.call(e,...r);return T=void 0,o}}var j=new WeakMap,{setDeleteAttr:G}=d;function S(t,...e){if(!e.length)return t;j.set(t,Q(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))K.call(this,t,n,r);return j.delete(t),t}function K(t,e,n){let{setRemoveAttr:r,s:o}=Q(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(a,l)=>K.call(c,t,a,l));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return V(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 G(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return $(o,n,V.bind(null,t[e]));case"ariaset":return $(o,n,(a,l)=>r("aria-"+a,l));case"classList":return at.call(c,t,n)}return lt(t,e)?G(t,e,n):r(e,n)}function Q(t,e){if(j.has(t))return j.get(t);let r=(t instanceof d.S?ht:pt).bind(null,t,"Attribute"),o=N(e);return{setRemoveAttr:r,s:o}}function at(t,e){let n=N(this);return $(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Nt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function dt(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=X(t,e);return!A(n.set)}function X(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||X(t,e)}function $(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 Y(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function pt(t,e,n,r){return t[(A(r)?"remove":"set")+e](n,Y(r))}function ht(t,e,n,r,o=null){return t[(A(r)?"remove":"set")+e+"NS"](o,n,Y(r))}function V(t,e,n){if(Reflect.set(t,e,n),!!A(n))return Reflect.deleteProperty(t,e)}function Mt(t,e,n=bt){v.push({scope:t,host:(...o)=>o.length?o.forEach(c=>c(t)):t,custom_element:t}),typeof n=="function"&&(n=n.call(t,t));let r=e.call(t,n);return v.pop(),r}function Wt(t){return U(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),U(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),U(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[_]=!0,t}function U(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function bt(t){return L(t,(e,n)=>e.getAttribute(n))}function Ut(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 x(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var M=d.M?gt():new Proxy({},{get(){return()=>{}}}),vt=new WeakSet;x.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[_]?c:c.isConnected?(c.dispatchEvent(new Event(s)),c):(P(e.signal,()=>M.offConnected(c,t))&&M.onConnected(c,t),c)}};x.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[_]||P(e.signal,()=>M.offDisconnected(c,t))&&M.onDisconnected(c,t),c}};var z=new WeakMap;x.disconnectedAsAbort=function(t){if(z.has(t))return z.get(t);let e=new AbortController;return z.set(t,e),t(x.disconnected(()=>e.abort())),e};x.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[_]||vt.has(o)||!d.M)return o;let s=new d.M(function(l){for(let{attributeName:p,target:b}of l)b.dispatchEvent(new CustomEvent(c,{detail:[p,b.getAttribute(p)]}))});return P(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function gt(){let t=new Map,e=!1,n=new d.M(function(i){for(let u of i)if(u.type==="childList"){if(p(u.addedNodes,!0)){s();continue}b(u.removedNodes,!0)&&s()}});return{onConnected(i,u){c();let f=o(i);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let f=t.get(i);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(i,f))},onDisconnected(i,u){c();let f=o(i);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let f=t.get(i);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(i,f))}};function r(i,u){u.length_c||u.length_d||(t.delete(i),s())}function o(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 c(){e||(e=!0,n.observe(d.D.body,{childList:!0,subtree:!0}))}function s(){!e||t.size||(e=!1,n.disconnect())}function a(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function l(i){t.size>30&&await a();let u=[];if(!(i instanceof Node))return u;for(let f of t.keys())f===i||!(f instanceof Node)||i.contains(f)&&u.push(f);return u}function p(i,u){let f=!1;for(let E of i){if(u&&l(E).then(p),!t.has(E))continue;let C=t.get(E);C.length_c&&(E.dispatchEvent(new Event("dde:connected")),C.connected=new WeakSet,C.length_c=0,C.length_d||t.delete(E),f=!0)}return f}function b(i,u){let f=!1;for(let E of i)u&&l(E).then(b),!(!t.has(E)||!t.get(E).length_d)&&((queueMicrotask||setTimeout)(k(E)),f=!0);return f}function k(i){return()=>{i.isConnected||(i.dispatchEvent(new Event("dde:disconnected")),t.delete(i))}}}var h=Symbol.for("observable");function W(t){try{return Reflect.has(t,h)}catch{return!1}}var q=[],g=new WeakMap;function m(t,e){if(typeof t!="function")return tt(!1,t,e);if(W(t))return t;let n=tt(!0),r=function(){let[o,...c]=g.get(r);if(g.set(r,new Set([o])),q.push(r),ct(n,t()),q.pop(),!c.length)return;let s=g.get(r);for(let a of c)s.has(a)||w(a,r)};return g.set(n[h],r),g.set(r,new Set([n])),r(),n}m.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))};m.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));I(e,n),o&&o.addEventListener("abort",()=>w(e,n))}};m.symbols={onclear:Symbol.for("Observable.onclear")};m.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 O="__dde_reactive";m.el=function(t,e){let n=D.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=v,s=a=>{if(!n.parentNode||!r.parentNode)return w(t,s);v.push(c);let l=e(a);v.pop(),Array.isArray(l)||(l=[l]);let p=n;for(;(p=n.nextSibling)!==r;)p.remove();n.after(...l),n.isConnected&&mt(c.host())};return I(t,s),rt(t,s,n,e),s(t()),o};function mt(t){!t||!t[O]||(requestIdleCallback||setTimeout)(function(){t[O]=t[O].filter(([e,n])=>n.isConnected?!0:(w(...e),!1))})}var Et={_set(t){this.value=t}};function xt(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ot(r,r(),Et);return t[n]=o,o}}var H="__dde_attributes";m.observedAttributes=function(t){let e=t[H]={},n=L(t,xt(e));return x.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,a=this[H][c];if(a)return m.action(a,"_set",s)})(t),x.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`).
- * Investigate `__dde_attributes` key of the element.*/m.clear(...Object.values(this[H]))})(t),n};var nt={isObservable:W,processReactiveAttribute(t,e,n,r){if(!W(n))return n;let o=c=>{if(!t.isConnected)return w(n,o);r(e,c)};return I(n,o),rt(n,o,t,e),n()}};function rt(t,e,...n){let{current:r}=v;r.prevent||r.host(function(o){o[O]||(o[O]=[],x.disconnected(()=>o[O].forEach(([[c,s]])=>w(c,s,c[h]?.host()===o)))(o)),o[O].push([[t,e],...n])})}function tt(t,e,n){let r=t?()=>et(r):(...o)=>o.length?ct(r,...o):et(r);return ot(r,e,n)}var yt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),B=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 ot(t,e,n){let r=[];J(n)!=="[object Object]"&&(n={});let{onclear:o}=m.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 B},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[h],yt),t}function At(){return q[q.length-1]}function et(t){if(!t[h])return;let{value:e,listeners:n}=t[h],r=At();return r&&n.add(r),g.has(r)&&g.get(r).add(t),e}function ct(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 I(t,e){if(t[h])return t[h].listeners.add(e)}function w(t,e,n){let r=t[h];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(m.clear(t),!g.has(r))return o;let c=g.get(r);if(!g.has(c))return o;g.get(c).forEach(s=>w(s,c,!0))}return o}F(nt);export{m as O,S as assign,K as assignAttribute,ut as chainableAppend,at as classListDeclarative,D as createElement,kt as createElementNS,Mt as customElementRender,Wt as customElementWithDDE,Ut as dispatchEvent,D as el,kt as elNS,dt as elementAttribute,Nt as empty,W as isObservable,Wt as lifecycleToEvents,m as observable,bt as observedAttributes,x as on,F as registerReactivity,v as scope,Dt as simulateSlots};
+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};
diff --git a/dist/esm.d.ts b/dist/esm.d.ts
index 8e755e1..aba4ec8 100644
--- a/dist/esm.d.ts
+++ b/dist/esm.d.ts
@@ -3,6 +3,7 @@ type Action= (this: { value: V, stopPropagation(): void }, ...a: any[])=> typ
//type SymbolObservable= Symbol;
type SymbolOnclear= symbol;
type Actions= Record>;
+type OnListenerOptions= Pick & { first_time?: boolean };
interface observable{
_: Symbol
/**
@@ -40,7 +41,7 @@ interface observable{
...params: A[N] extends (...args: infer P)=> any ? P : never
): void;
clear(...observables: Observable[]): void;
- on(observable: Observable, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
+ on(observable: Observable, onchange: (a: T)=> void, options?: OnListenerOptions): void;
symbols: {
//observable: SymbolObservable;
onclear: SymbolOnclear;
@@ -239,6 +240,7 @@ export function customElementRender<
P extends any = Record
>(
custom_element: EL,
+ target: ShadowRoot | EL,
render: (props: P)=> SupportedElement,
props?: P | ((...args: any[])=> P)
): EL
diff --git a/dist/esm.js b/dist/esm.js
index 450f448..6fbed7e 100644
--- a/dist/esm.js
+++ b/dist/esm.js
@@ -1 +1 @@
-var y={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function H(t,e=!0){return e?Object.assign(y,t):(Object.setPrototypeOf(t,y),t)}function D(t){return y.isPrototypeOf(t)&&t!==y?t:y}function E(t){return typeof t>"u"}function R(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function M(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,z(o),e(t,o)),r},{})}function z(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var a={setDeleteAttr:B,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function B(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 g=[{get scope(){return a.D.body},host:t=>t?t(a.D.body):a.D.body,custom_element:!1,prevent:!0}],v={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 k(...t){return this.appendOriginal(...t),this}function I(t){return t.append===k||(t.appendOriginal=t.append,t.append=k),t}var O;function L(t,e,...n){let r=D(this),o=0,c,i;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,v.push({scope:t,host:(...h)=>h.length?(o===1?n.unshift(...h):h.forEach(l=>l(i)),void 0):i}),c=t(e||void 0);let d=c instanceof a.F;if(c.nodeName==="#comment")break;let p=L.mark({type:"component",name:t.name,host:d?"this":"parentElement"});c.prepend(p),d&&(i=p);break}case t==="#text":c=A.call(this,a.D.createTextNode(""),e);break;case(t==="<>"||!t):c=A.call(this,a.D.createDocumentFragment(),e);break;case!!O:c=A.call(this,a.D.createElementNS(O,t),e);break;case!c:c=A.call(this,a.D.createElement(t),e)}return I(c),i||(i=c),n.forEach(d=>d(i)),o&&v.pop(),o=2,c}function it(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((i,d)=>Reflect.set(i,d.name||r,d)&&i,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(i,d,p){if(!p.length)return t;let h=a.D.createDocumentFragment();for(let l of p){if(!l||!l.slot){c&&h.appendChild(l);continue}let C=l.slot,s=o[C];V(l,"remove","slot"),s&&(Z(s,l,n),Reflect.deleteProperty(o,C))}return c&&(o[r].replaceWith(h),Reflect.deleteProperty(o,r)),t.append=i,t}}),t!==e){let i=Array.from(t.childNodes);i.forEach(d=>d.remove()),t.append(...i)}return e}function Z(t,e,n){n&&n(t,e);try{t.replaceWith(A(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=a.D.createComment(``);return e&&(r.end=a.D.createComment("")),r};function ut(t){let e=this;return function(...r){O=t;let o=L.call(e,...r);return O=void 0,o}}var _=new WeakMap,{setDeleteAttr:W}=a;function A(t,...e){if(!e.length)return t;_.set(t,F(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))q.call(this,t,n,r);return _.delete(t),t}function q(t,e,n){let{setRemoveAttr:r,s:o}=F(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,p)=>q.call(c,t,d,p));let[i]=e;if(i==="=")return r(e.slice(1),n);if(i===".")return j(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 W(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return N(o,n,j.bind(null,t[e]));case"ariaset":return N(o,n,(d,p)=>r("aria-"+d,p));case"classList":return G.call(c,t,n)}return J(t,e)?W(t,e,n):r(e,n)}function F(t,e){if(_.has(t))return _.get(t);let r=(t instanceof a.S?Q:K).bind(null,t,"Attribute"),o=D(e);return{setRemoveAttr:r,s:o}}function G(t,e){let n=D(this);return N(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function ft(t){return Array.from(t.children).forEach(e=>e.remove()),t}function V(t,e,n,r){return t instanceof a.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function J(t,e){if(!Reflect.has(t,e))return!1;let n=$(t,e);return!E(n.set)}function $(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||$(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 U(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function K(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,U(r))}function Q(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,U(r))}function j(t,e,n){if(Reflect.set(t,e,n),!!E(n))return Reflect.deleteProperty(t,e)}function ht(t,e,n=X){v.push({scope:t,host:(...o)=>o.length?o.forEach(c=>c(t)):t,custom_element:t}),typeof n=="function"&&(n=n.call(t,t));let r=e.call(t,n);return v.pop(),r}function bt(t){return T(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event("dde:connected"))}),T(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event("dde:disconnected")))}),T(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 T(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function X(t){return M(t,(e,n)=>e.getAttribute(n))}function xt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let i=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(i)}}function w(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var S=a.M?tt():new Proxy({},{get(){return()=>{}}}),Y=new WeakSet;w.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 i="dde:"+r;return c.addEventListener(i,t,e),c[x]?c:c.isConnected?(c.dispatchEvent(new Event(i)),c):(R(e.signal,()=>S.offConnected(c,t))&&S.onConnected(c,t),c)}};w.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 i="dde:"+r;return c.addEventListener(i,t,e),c[x]||R(e.signal,()=>S.offDisconnected(c,t))&&S.onDisconnected(c,t),c}};var P=new WeakMap;w.disconnectedAsAbort=function(t){if(P.has(t))return P.get(t);let e=new AbortController;return P.set(t,e),t(w.disconnected(()=>e.abort())),e};w.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]||Y.has(o)||!a.M)return o;let i=new a.M(function(p){for(let{attributeName:h,target:l}of p)l.dispatchEvent(new CustomEvent(c,{detail:[h,l.getAttribute(h)]}))});return R(e.signal,()=>i.disconnect())&&i.observe(o,{attributes:!0}),o}};function tt(){let t=new Map,e=!1,n=new a.M(function(s){for(let u of s)if(u.type==="childList"){if(h(u.addedNodes,!0)){i();continue}l(u.removedNodes,!0)&&i()}});return{onConnected(s,u){c();let f=o(s);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(s,u){if(!t.has(s))return;let f=t.get(s);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(s,f))},onDisconnected(s,u){c();let f=o(s);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(s,u){if(!t.has(s))return;let f=t.get(s);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(s,f))}};function r(s,u){u.length_c||u.length_d||(t.delete(s),i())}function o(s){if(t.has(s))return t.get(s);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(s,u),u}function c(){e||(e=!0,n.observe(a.D.body,{childList:!0,subtree:!0}))}function i(){!e||t.size||(e=!1,n.disconnect())}function d(){return new Promise(function(s){(requestIdleCallback||requestAnimationFrame)(s)})}async function p(s){t.size>30&&await d();let u=[];if(!(s instanceof Node))return u;for(let f of t.keys())f===s||!(f instanceof Node)||s.contains(f)&&u.push(f);return u}function h(s,u){let f=!1;for(let b of s){if(u&&p(b).then(h),!t.has(b))continue;let m=t.get(b);m.length_c&&(b.dispatchEvent(new Event("dde:connected")),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(b),f=!0)}return f}function l(s,u){let f=!1;for(let b of s)u&&p(b).then(l),!(!t.has(b)||!t.get(b).length_d)&&((queueMicrotask||setTimeout)(C(b)),f=!0);return f}function C(s){return()=>{s.isConnected||(s.dispatchEvent(new Event("dde:disconnected")),t.delete(s))}}}export{A as assign,q as assignAttribute,I as chainableAppend,G as classListDeclarative,L as createElement,ut as createElementNS,ht as customElementRender,bt as customElementWithDDE,xt as dispatchEvent,L as el,ut as elNS,V as elementAttribute,ft as empty,bt as lifecycleToEvents,X as observedAttributes,w as on,H as registerReactivity,v as scope,it as simulateSlots};
+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};