@reactive-web-components/rwc 2.60.0 → 2.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reactive-web-components/rwc",
3
- "version": "2.60.0",
3
+ "version": "2.60.1",
4
4
  "type": "module",
5
5
  "types": "./shared/index.d.ts",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./shared/index.d.ts",
9
- "import": "./reactive-web-component.DJgS-YXP.js",
10
- "require": "./reactive-web-component.RIHd-K7B.umd.cjs"
9
+ "import": "./reactive-web-component.CROWiiEy.js",
10
+ "require": "./reactive-web-component.B_LM0pVV.umd.cjs"
11
11
  }
12
12
  },
13
13
  "author": "tamazyanarsen",
@@ -34,6 +34,6 @@
34
34
  "ui",
35
35
  "frontend"
36
36
  ],
37
- "module": "./reactive-web-component.DJgS-YXP.js",
38
- "main": "./reactive-web-component.RIHd-K7B.umd.cjs"
37
+ "module": "./reactive-web-component.CROWiiEy.js",
38
+ "main": "./reactive-web-component.B_LM0pVV.umd.cjs"
39
39
  }
@@ -0,0 +1,2 @@
1
+ (function(r,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(r=typeof globalThis<"u"?globalThis:r||self,S(r.ReactiveComponent={}))})(this,function(r){"use strict";var Qe=Object.defineProperty;var Ye=(r,S,g)=>S in r?Qe(r,S,{enumerable:!0,configurable:!0,writable:!0,value:g}):r[S]=g;var h=(r,S,g)=>Ye(r,typeof S!="symbol"?S+"":S,g);const S=n=>n&&typeof n=="object"&&("classList"in n||"attributes"in n||"customAttributes"in n||"reactiveClassList"in n||"listeners"in n||"customListeners"in n||"children"in n||"effects"in n||"style"in n||Object.keys(n).some(t=>t.startsWith(".")||t.startsWith("@")||t.startsWith("$")))&&!("hostElement"in n),g=n=>n&&typeof n=="object"&&"hostElement"in n&&"append"in n&&"set"in n&&"addStyle"in n&&"setAttribute"in n&&"addClass"in n&&"addEffect"in n&&"addReactiveContent"in n&&"setReactiveContent"in n&&"clear"in n,P=(n,t,...e)=>{t&&t.apply(n,e)};let _=!0;const p=(...n)=>{_&&console.debug(["[rwc]",...n].join(" | "),...Array.from(n.join("").matchAll(/%c/gm)).map((t,e)=>e%2===0?"color:red":"color:inherit"))},k=n=>n.replace(/([A-Z])/gm,t=>`-${t.toLowerCase()}`),X=n=>n.replace(/-(\w)/gm,(t,e)=>e.toUpperCase()),$=(n,...t)=>{if(!_)return;const e={r:"color: #ff0000",g:"color: #00ff00",b:"color: #0000ff",y:"color: #ffff00",p:"color: #800080",c:"color: #00ffff",o:"color: #ffa500",w:"color: #808080"},s=n.match(/@[rgbpycow]/g)||[],o=s.map(c=>{const l=c.slice(1);return e[l]||"color: inherit"});let i=n;s.forEach(c=>{const l=new RegExp(`\\${c}([^\\s,]+)`,"g");i=i.replace(l,"%c$1")}),console.log(i,...o,...t)},bt=()=>{_=!0},Z=()=>{_=!1};Z();const St=(n,t)=>{n.every(Boolean)&&t(n)},A=[],F=n=>{var t,e,s,o;(t=n.children)==null||t.forEach(i=>{var c;return(c=i.destroy)==null?void 0:c.call(i)}),(e=n.children)==null||e.clear(),(s=n.cleanupSet)==null||s.forEach(i=>i()),(o=n.cleanupSet)==null||o.clear()};function R(n,t){let e=(t==null?void 0:t.signalCompareFn)||(()=>!0);const s=new Set;function o(){var c;const i=A[A.length-1];return i&&!i.fake&&!s.has(i)&&i.status==="active"&&(s.add(i),(c=i.cleanupSet)==null||c.add(()=>s.delete(i))),!(t!=null&&t.name)&&(i!=null&&i.effectId)&&o.setName(i.effectId),n}return o.signalId=`${(t==null?void 0:t.name)||""}_${Math.random().toString(36).substring(2,15)}`,o.setName=function(i){return o.signalId=`${i}_${Math.random().toString(36).substring(2,15)}`,o},o.setCompareFn=function(i){return e=i,o},o.clearSubscribers=function(){s.clear()},o.getSubscribers=function(){return s},o.peek=function(){return Object.freeze(n)},o.initValue=Object.freeze(n),o.forceSet=function(i){n=i,s.forEach(c=>{F(c),Promise.resolve().then(()=>{A.push(c),c(),A.pop()})})},o.set=function(i,c=e){n!==i&&c(n,i)&&o.forceSet(i)},o.update=function(i){o.set(i(n))},o.pipe=(i,c)=>{c!=null&&c.name&&o.setName(c.name);const l=R(null);return b(()=>{const u=o();b(()=>{const d=i(u);d instanceof Promise?d.then(v=>l.set(v)):w(d)?b(()=>l.set(d()),{name:"pipe_effect_inner"}):l.set(d)},{name:"pipe_effect"})},{name:(c==null?void 0:c.name)||`pipe_${o.signalId}`}),l},o}function b(n,t){var i;const e=`${(t==null?void 0:t.name)||""}_${Math.random().toString(36).substring(2,15)}`;p("current effect",`%c${e}%c`);const s=n;s.status="active",s.children=new Set,s.effectId=e;const o=A[A.length-1];o&&((i=o.children)==null||i.add(s),s.parent=new WeakRef(o),s.destroy=()=>{var c;F(s),(c=o.children)==null||c.delete(s),s.destroy=void 0,s.status="inactive"}),s.cleanupSet=new Set,A.push(s),s(),A.pop()}const w=n=>!!n&&["object","function"].includes(typeof n)&&"set"in n&&"update"in n&&"forceSet"in n&&"signalId"in n;function yt(n,...t){const e=R("");return b(()=>{const s=t.map(i=>w(i)?String(i()):String(i)),o=[n[0]];s.forEach((i,c)=>{o.push(i,n[c+1])}),e.set(o.join(""))}),e}function vt(n,t){const e=R(t??null),s=o=>e.set(o);return n instanceof Promise?n.then(s):typeof n=="function"&&b(()=>{const o=n();o instanceof Promise?o.then(s):w(o)?b(()=>s(o())):s(o)}),e}function wt(n,t){let e=n(),s=t();b(()=>{const o=n(),i=t();o!==i&&(o!==e?t.set(o):i!==s&&n.set(i)),e=o,s=i})}function At(...n){let t=n.map(s=>s());const e=R(t);return n.forEach((s,o)=>{b(()=>{const i=()=>t.filter(c=>c!==void 0).length;i()===n.length&&(t=Array.from(t).fill(void 0)),t[o]=s(),i()===n.length&&e.set([...t])})}),e}const Rt=(...n)=>{const t=R([]);return b(()=>{t.set(n.map(e=>e()))}),t},B="eventProps",V="EVENT_CONFIG",W="observedAttributes",Lt=()=>(n,t)=>{Reflect.get(n,W)||Reflect.defineProperty(n,W,{value:[]}),Reflect.get(n,W).push(k(t))},gt=n=>(t,e)=>{Reflect.get(t,B)||Reflect.defineProperty(t,B,{value:[]}),Reflect.get(t,V)||Reflect.defineProperty(t,V,{value:{}}),Reflect.get(t,V)[e]={bubbles:(n==null?void 0:n.bubbles)??!1,composed:(n==null?void 0:n.composed)??!1},Reflect.get(t,B).push(e)},q=(n,t=!1)=>e=>{p(n,"start register static attr",e.prototype[W]);const s=[];if(e.styles){const i=e.styles,c=[];Array.isArray(i)?c.push(...i):c.push(i),c.forEach(l=>{const u=new CSSStyleSheet;u.replaceSync(l),s.push(u);const y=new CSSStyleSheet;y.replaceSync(l.slice(l.indexOf("@property"))),document.adoptedStyleSheets.push(y)})}class o extends e{constructor(...c){p("constructor",`%c${n}%c`),super(t,...c),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){return p("rwc: render from new class"),e.prototype.render.call(this)}attributeChangedCallback(c,l,u){p("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${l}, newValue: ${u}`,`%c${n}%c`);try{u=JSON.parse(u)}catch{}const y=X(c);if(y in this&&w(this[y])){const d=this[y];d.setName(c),u===null?(d.set(d.initValue),this.removeAttribute(c)):d.set(u)}P(this,e.prototype.attributeChangedCallback,c,l,u)}connectedCallback(){const c=()=>{var u,y;p("rwc: connectedCallback"),p("connectedCallback",`%c${n}%c`,this),(u=this.init)==null||u.call(this),this.providers&&Object.keys(this.providers).length>0&&(p("WRAPPER for providers",n),Object.entries(this.providers).forEach(([d,m])=>{p("register provider",d,m()),this.addEventListener(d,v=>{var f;p("send provider",d,m());const C=v;((f=C.detail)==null?void 0:f.context)===d&&(C.stopPropagation(),C.detail.callback(m))})})),this.checkInjects(),(y=e.prototype[B])==null||y.forEach(d=>{this[d]=m=>{const v=e.prototype[V][d],{bubbles:C,composed:f}=v;w(m)?b(()=>{$("@oemit reactive value",m()),this.dispatchEvent(new CustomEvent(d,{detail:m(),bubbles:C,composed:f}))}):($("@oemit value",m),this.dispatchEvent(new CustomEvent(d,{detail:m,bubbles:C,composed:f})))}}),p("start render",`%c${n}%c`,n);const l=()=>{p("rwc: insertRenderTemplate");const m=this.render().hostElement;m&&this.shadow.appendChild(m),P(this,e.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!e.styles){const d=C=>C instanceof Promise||Array.isArray(C)&&C.every(f=>f instanceof Promise),m=this.rootStyle,v=C=>{const f=new CSSStyleSheet;f.replaceSync(C),this.shadow.adoptedStyleSheets.push(f);const E=new CSSStyleSheet;E.replaceSync(C.slice(C.indexOf("@property"))),document.adoptedStyleSheets.push(E)};if(d(m)){const C=[];Array.isArray(m)?C.push(...m):C.push(m),Promise.all(C).then(f=>f.forEach(E=>v(E.default))).then(()=>l())}else{const C=[];Array.isArray(m)?C.push(...m):C.push(m),C.forEach(f=>v(f)),l()}}else l();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(d=>{p(this.slotContext,this.slotContext&&this.slotContext[d.name]),$("@bslot element",d,`name:${d.name};`,d.assignedElements()),d.assignedElements().forEach(m=>{const v=this.slotContext[d.name];this.slotContext&&w(v)&&($("@oslot element",d,`name:${d.name};`,d.assignedElements()),b(()=>{m.dispatchEvent(new CustomEvent("handleSlotContext",{detail:v()}))}))})})};c.fake=!0,c.component=new WeakRef(this),this.effectSet.add(new WeakRef(c)),b(c,{name:"FAKE_wrapperEffect"})}disconnectedCallback(){this.allSlotContent=[],this.slotContent={},this.htmlSlotContent={},this.effectSet.forEach(c=>{var l,u;return(u=(l=c.deref())==null?void 0:l.destroy)==null?void 0:u.call(l)}),this.effectSet.clear(),this.shadow.replaceChildren(),this.replaceChildren(),P(this,e.prototype.disconnectedCallback)}}return h(o,"observedAttributes",e.prototype[W]??[]),h(o,"renderTagName",n),o.toString=()=>n,customElements.get(n)?console.error(`название тега ${n} повторяется, компонент ${e.name} не зарегистрирован`):customElements.define(n,o),e.renderTagName=n,e};class j extends HTMLElement{constructor(e=!1){super();h(this,"init");h(this,"isSlotLazyLoading",!1);h(this,"slotTemplate");h(this,"slotContext");h(this,"rootStyle");h(this,"modelValue");h(this,"providers");h(this,"effectSet",new Set);h(this,"appendAllSlotContent");h(this,"allSlotContent",[]);h(this,"slotContent",{});h(this,"htmlSlotContent",{});h(this,"shadow");h(this,"injects",{});this.shadow=this.attachShadow({mode:e?"closed":"open"})}appendChild(e,s=!0){var o;if(this.isSlotLazyLoading&&s){if(e instanceof HTMLElement){const i=e.slot||"default";this.htmlSlotContent[i]||(this.htmlSlotContent[i]=[]),(o=this.htmlSlotContent[i])==null||o.push(e)}}else return super.appendChild(e)}appendSlotContent(){var e;(e=this.appendAllSlotContent)==null||e.call(this)}inject(e){return p("%cinject%c",e),this.injects[e]||(this.injects[e]=R(null)),this.injects[e]}checkInjects(){Object.entries(this.injects).forEach(([e,s])=>{p("%cinject%c",`%c${e}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(e,{detail:{context:e,callback:o=>b(()=>{s.set(o())},{name:e})},bubbles:!0,composed:!0}))})}setReactiveValue(e){this.modelValue=e}}h(j,"observedAttributes",[]),h(j,"renderTagName",""),h(j,"styles");const jt=n=>"render"in n&&"setReactiveValue"in n,Ot="handleSlotContext",Q="onConnected",Y=n=>typeof n=="string"?n:JSON.stringify(n),Tt=n=>{const t=document.createElement("span");return t.textContent=Y(n),t},K=(n,t)=>(n.appendChild(Tt(t)),n),It=(n,t)=>(n.replaceChildren(),K(n,t)),x=n=>{const t=document.createElement("span");return b(()=>{const e=n();t.textContent=Y(e)}),t};class tt{constructor(t){h(this,"wrapper");h(this,"keyedEffects",new Map);h(this,"append",(...t)=>(t.forEach(e=>{var o;const s=e.hostElement;s&&((o=this.hostElement)==null||o.appendChild(s),Q in s&&setTimeout(()=>{var i;(i=s.onConnected)==null||i.call(s,e,s)}))}),this));h(this,"set",(...t)=>{var s;this.clear();const e=document.createDocumentFragment();return t.forEach(o=>{const i=o.hostElement;i&&e.appendChild(i)}),(s=this.hostElement)==null||s.appendChild(e),this});h(this,"removeChild",(...t)=>(t.forEach(e=>{var s,o;if(Array.from(((s=this.hostElement)==null?void 0:s.childNodes.values())||[]).some(i=>i===e.hostElement)){const i=e.hostElement;i&&((o=this.hostElement)==null||o.removeChild(i))}}),this));h(this,"addHtmlContent",t=>{const e=this.hostElement;return e?(K(e,t),this):this});h(this,"setHtmlContent",t=>{const e=this.hostElement;return e?(It(e,t),this):this});h(this,"setAttribute",(t,e)=>{var i;const s=this.hostElement;if(!s)return this;let o;if(typeof e=="boolean"&&!(s instanceof j))if(e)o="";else{this.removeAttribute(t);const c=t.toLowerCase();return c in s&&(s[c]=null),this}else typeof e!="string"?o=JSON.stringify(e):o=e;if((i=this.hostElement)==null||i.setAttribute(k(t),o),!(s instanceof j)){const c=t.toLowerCase();c in s&&(s[c]=e)}return this});h(this,"setCustomAttribute",(t,e)=>{var o;let s;return typeof e!="string"?s=JSON.stringify(e):s=e,(o=this.hostElement)==null||o.setAttribute(k(t),s),this});h(this,"setReactiveAttribute",(t,e)=>(this.addEffect(s=>{s.setAttribute(t,e())},t),this));h(this,"setReactiveCustomAttribute",(t,e)=>(this.addEffect(s=>{s.setCustomAttribute(t,e())}),this));h(this,"removeAttribute",t=>{var e;return(e=this.hostElement)==null||e.removeAttribute(k(t)),this});h(this,"addStyle",t=>{const e=this.hostElement;return e?(Object.entries(t).forEach(([s,o])=>{const i=s.startsWith("--");typeof o=="function"?this.addEffect(()=>{if(i){const c=String(o()||"");e.style.setProperty(s,c)}else e.style[s]=o()}):typeof o=="string"&&(i?e.style.setProperty(s,o):e.style[s]=o)}),this):this});h(this,"onConnected",t=>this.hostElement?(Reflect.defineProperty(this.hostElement,Q,{get(){return t}}),this):this);h(this,"addClass",(...t)=>(t.forEach(e=>{var s;typeof e=="string"?(s=this.hostElement)==null||s.classList.add(...e.split(" ").flatMap(o=>o.split(`
2
+ `)).map(o=>o.trim()).filter(Boolean)):(()=>{let o=null;this.addEffect(()=>{const i=e();i.length>0&&(o?this.replaceClass(o,i):this.addClass(i),o=i)})})()}),this));h(this,"setClass",(...t)=>{var e,s,o;return(s=this.hostElement)==null||s.classList.remove(...((e=this.hostElement)==null?void 0:e.classList)||[]),(o=this.hostElement)==null||o.classList.add(...t),this});h(this,"addReactiveClass",t=>(Object.keys(t).forEach(e=>{this.addEffect(s=>{t[e]()?s.addClass(e):s.removeClass(e)})}),this));h(this,"removeClass",(...t)=>{var e;return(e=this.hostElement)==null||e.classList.remove(...t),this});h(this,"replaceClass",(t,e)=>{var s;return(s=this.hostElement)==null||s.classList.replace(t,e),this});h(this,"addEffect",(t,e)=>{var i,c;const s=this.hostElement;if(!s)return this;const o=()=>t(this,s);if(e){const l=(i=this.keyedEffects.get(e))==null?void 0:i.deref();l&&F(l)}return(c=s.effectSet)==null||c.add(new WeakRef(o)),o.component=this.wrapper,b(o,{name:(e==null?void 0:e.toString())||s.tagName}),this});h(this,"addReactiveContent",t=>{var e;return(e=this.hostElement)==null||e.appendChild(x(t)),this});h(this,"setReactiveContent",t=>{var e;return this.clear(),(e=this.hostElement)==null||e.appendChild(x(t)),this});h(this,"clear",()=>{var t;return(t=this.hostElement)==null||t.replaceChildren(),this});this.wrapper=t;const e=t.deref();e&&(e.effectSet=new Set)}get hostElement(){return this.wrapper.deref()}addEventlistener(t,e,s=!1){var o;return(o=this.hostElement)==null||o.addEventListener(t,i=>e(i,this,this.hostElement),s),this}}class kt extends tt{constructor(){super(...arguments);h(this,"setReactiveValue",e=>(this.hostElement instanceof j&&this.hostElement.setReactiveValue(e),this));h(this,"setSlotTemplate",e=>{var o;const s=(o=this.hostElement)==null?void 0:o.slotTemplate;return s&&Object.entries(e).forEach(([i,c])=>{s[i]=c}),this})}}const $t=()=>()=>{},et=n=>new kt(new WeakRef(n)),nt=n=>new tt(new WeakRef(n)),st=(n,...t)=>({classList:[...n.map(e=>e.trim()).filter(Boolean),...t]}),Wt=(n,...t)=>st(n,...t),z=(n,t)=>{if(!t||!n.deref())return;const e=Object.keys(t||{}).filter(o=>o.startsWith(".")||o.startsWith("@")||o.startsWith("$"));e.filter(o=>o.startsWith(".")).forEach(o=>{t!=null&&t.attributes||(t.attributes={}),t.attributes[o.slice(1)]=t[o]}),e.filter(o=>o.startsWith("@")).forEach(o=>{t!=null&&t.listeners||(t.listeners={});const i=o.slice(1);t.listeners[i]=t[o]}),e.filter(o=>o.startsWith("$")).forEach(o=>{t!=null&&t.effects||(t.effects=[]),t.effects.push(t[o])});const s=n.deref();if(s)return ct(s,t.classList),lt(s,t.style),dt(s,t.attributes),at(s,t.reactiveClassList),it(s,t.customAttributes),rt(s,t.children),ot(s,t.effects),G(s,t.listeners),G(s,t.customListeners),s},G=(n,t)=>{t&&Object.entries(t).forEach(([e,s])=>{typeof s=="function"&&n.addEventlistener(e,s)})},ot=(n,t)=>t==null?void 0:t.forEach(e=>n.addEffect(e)),rt=(n,t)=>H(new WeakRef(n),...t||[])??n,it=(n,t)=>{const e=t;e&&Object.keys(e).forEach(s=>{w(e[s])?n.setReactiveCustomAttribute(s,e[s]):typeof e[s]=="function"?n.addEffect(()=>{n.setCustomAttribute(s,e[s]())}):n.setCustomAttribute(s,e[s])})},ct=(n,t)=>n.addClass(...t||[]),at=(n,t)=>n.addReactiveClass(t||{}),lt=(n,t)=>n.addStyle(t||{}),dt=(n,t)=>{const e=t,s=(o,i)=>{i&&(w(i)?n.setReactiveAttribute(o,i):typeof i=="function"?n.addEffect(()=>{n.setAttribute(o,i())}):n.setAttribute(o,i))};e&&Object.keys(e).forEach(o=>{s(o,e[o])})},H=(n,...t)=>{const e=n.deref();if(e)return t.forEach(s=>{typeof s=="string"?s.trim().length>0&&e.addHtmlContent(s):w(s)?e.addReactiveContent(s):e.append(s)}),e},T=(n,t)=>{const e=document.createElement(n),s=nt(e);return z(new WeakRef(s),t)??s},J=(n,t)=>{const[e,...s]=n.split(" ").map(i=>i.trim()),o=T(e,t);return s.length>0&&o.addClass(...s),(...i)=>H(new WeakRef(o),...i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!w(c)?L(()=>c(o)):c))??o},L=n=>{const t=`getSignalContent_${Math.random().toString(36).substring(2,15)}`;return T("div").addStyle({display:"contents"}).addEffect(e=>{e.clear(),H(new WeakRef(e),...[n()].flat())},t)},Ht=(n,t,e)=>{const s=T("div").addStyle({display:"contents"}),o=new Map,i=new Map;let c=[];const l=new Set;let u=n.peek();const y=d=>{l.delete(d),o.delete(d),i.delete(d)};return b(()=>{var C;const d=n();c=d.map(t).map(f=>typeof f=="string"?f:f.toString());const m=Array.from(((C=s.hostElement)==null?void 0:C.children)||[]);p("containerChildren",m,c),m.forEach(f=>{const E=f.dataset.key;c.includes(E)||(p("remove element",E,f),f.remove(),y(E))}),c.forEach(f=>{var M,I,O;const E=d[c.indexOf(f)];o.has(f)?JSON.stringify(E)!==JSON.stringify(u[c.indexOf(f)])&&((I=(M=s.hostElement)==null?void 0:M.querySelector(`[data-key="${f}"]`))==null||I.remove(),(O=o.get(f))==null||O.set(Math.random().toString(36).substring(2,15)),i.set(f,()=>e(E,c.indexOf(f),d).setCustomAttribute("data-key",f))):(p("create new element",f,E),o.set(f,R(Math.random().toString(36).substring(2,15))),i.set(f,()=>e(E,c.indexOf(f),d).setCustomAttribute("data-key",f)))}),u=[...d.map(f=>({...f}))];const v=()=>{o.forEach((f,E)=>{p("key from setTimeout foreach currItemSignalMap",E),l.has(E)||(l.add(E),b(()=>{var Ct,Et;f();const M=c.indexOf(E),I=(Ct=i.get(E))==null?void 0:Ct();if(!I)return;p("call effect from setTimeout",E,I.hostElement);const O=s.hostElement,N=I.hostElement;O&&N&&M<=O.children.length-1?O.insertBefore(N,O.children[M]):N&&((Et=s.hostElement)==null||Et.append(N))}))})};Promise.resolve().then(()=>v())}),s},Mt=n=>{let t=[T("div")],e=!1;return b(()=>{var i,c;const s=n();e=Array.isArray(s);const o=[];o.push(...[s].flat()),o.length===0&&o.push(T("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{p("newReactiveComponent.map",o.map(l=>{var u;return p("newReactiveComponent hostElement",l.hostElement),(u=l.hostElement)==null?void 0:u.id})),p("currComponent[0].hostElement?.id",(i=t[0].hostElement)==null?void 0:i.id,t),(c=t[0].hostElement)==null||c.replaceWith(...o.map(l=>l.hostElement).filter(Boolean)),t.slice(1).forEach(l=>{var u;return(u=l.hostElement)==null?void 0:u.remove()}),t=o}catch(l){console.error(l)}}),e?t:t[0]},Pt=n=>Ot in n,_t=n=>{const t=J("div")().addStyle({display:"contents"}),e=s=>{const o=t.hostElement;return o&&(o.innerHTML=s),t};return typeof n=="string"?e(n):t.addEffect(()=>{e(n())}),t},D=(n,t,e)=>n?L(t):e?L(e):J("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),ht=(n,t,e)=>L(()=>D(!!n(),t,e)),Ft=(n,t,e)=>typeof n=="boolean"?D(n,t,e):ht(n,t,e),U=(n,t)=>L(t).addEffect((e,s)=>{if(typeof n=="boolean")s.style.display=n?"block":"none";else{const o=n()?"block":"none";s.style.display=o}}),Bt=(n,t,e)=>{const s=[U(n,t)].flat();return e&&s.push(...[U(()=>typeof n=="boolean"?!n:!n(),e)].flat()),L(()=>s)},ft=(n,t)=>{p("createCustomElement",n);const e=document.createElement(n),s=et(e);return e.init=()=>{z(new WeakRef(s),t)},s},ut=(n,t)=>{const e=n.split(" ").slice(1).map(o=>o.trim()),s=ft(n.split(" ")[0],t);return Array.isArray(e)&&e.length>0&&s.addClass(...e),(...o)=>{const i=o.filter(Boolean).flat().flatMap(l=>typeof l=="function"&&!w(l)?L(()=>l(s)):l),c=s.hostElement;return c&&(c.allSlotContent=i,c.slotContent=i.filter(g).reduce((l,u)=>{var d;const y=((d=u.hostElement)==null?void 0:d.getAttribute("slot"))||"default";return l[y]||(l[y]=[]),l[y].push(u),l},{}),c.appendAllSlotContent=()=>{H(new WeakRef(s),...i)}),s}},mt=(n,t,e)=>ut(`${n.renderTagName}${t&&typeof t=="string"?" "+t:""}`,S(t)?t:t&&typeof t=="string"?e:void 0),Vt=()=>{const n=()=>{};return n.oldValue=null,n},Jt=()=>({}),pt=(n,t,e)=>{const s=t?q(t,e)(n):n;return(o,...i)=>{const c=[...i];return o&&!S(o)&&c.unshift(o),mt(s,S(o)?o:{})(...c)}},Nt=n=>[pt(n),(t,e)=>{q(t,e)(n)}],a={};["div","span","section","input","button","table","tr","td","th","ul","li","ol","form","label","select","option","textarea","img","a","p","h1","h2","h3","h4","h5","h6","br","hr","pre","code","nav","header","footer","main","aside","article","figure","figcaption","blockquote","cite","small","strong","em","b","i","u","s","sub","sup","mark","del","ins","details","summary","progress","meter","audio","video","canvas","slot"].forEach(n=>{a[n]=(t,...e)=>{let s=[...e];return t&&!S(t)&&(s=[t].concat(s)),J(n,S(t)?t:{})(...s)}});const qt=a.div,zt=a.span,Gt=a.section,Dt=a.input,Ut=a.button,Xt=a.table,Zt=a.tr,Qt=a.td,Yt=a.th,Kt=a.ul,xt=a.li,te=a.ol,ee=a.form,ne=a.label,se=a.select,oe=a.option,re=a.textarea,ie=a.img,ce=a.a,ae=a.p,le=a.h1,de=a.h2,he=a.h3,fe=a.h4,ue=a.h5,me=a.h6,pe=a.br,Ce=a.hr,Ee=a.pre,be=a.code,Se=a.nav,ye=a.header,ve=a.footer,we=a.main,Ae=a.aside,Re=a.article,Le=a.figure,ge=a.figcaption,je=a.blockquote,Oe=a.cite,Te=a.small,Ie=a.strong,ke=a.em,$e=a.b,We=a.i,He=a.u,Me=a.s,Pe=a.sub,_e=a.sup,Fe=a.mark,Be=a.del,Ve=a.ins,Je=a.details,Ne=a.summary,qe=a.progress,ze=a.meter,Ge=a.audio,De=a.video,Ue=a.canvas,Xe=a.slot,Ze=n=>t=>n(t).addClass(...t.classList??[]).addReactiveClass(t.reactiveClassList??{});r.BaseElement=j,r.a=ce,r.addAttributeList=dt,r.addClassList=ct,r.addCustomAttributes=it,r.addReactiveClassList=at,r.addStyleList=lt,r.appendContentItem=H,r.article=Re,r.aside=Ae,r.audio=Ge,r.b=$e,r.bindReactiveSignals=wt,r.blockquote=je,r.br=pe,r.button=Ut,r.camelToKebab=k,r.canvas=Ue,r.checkCall=P,r.checkRef=St,r.cite=Oe,r.classList=st,r.cls=Wt,r.code=be,r.colorLog=$,r.combineLatest=Rt,r.component=q,r.configCustomComponent=Nt,r.createComponent=Ze,r.createCustom=mt,r.createCustomEl=ut,r.createCustomElement=ft,r.createEl=J,r.createElement=T,r.createSignal=vt,r.customElementHelpers=et,r.defineSlotTemplate=Jt,r.del=Be,r.details=Je,r.disableLogs=Z,r.div=qt,r.effect=b,r.elementHelpers=nt,r.em=ke,r.enableLogs=bt,r.event=gt,r.eventEmitter=$t,r.figcaption=ge,r.figure=Le,r.footer=ve,r.forkJoin=At,r.form=ee,r.getList=Ht,r.getSignalContent=L,r.h1=le,r.h2=de,r.h3=he,r.h4=fe,r.h5=ue,r.h6=me,r.header=ye,r.hr=Ce,r.i=We,r.img=ie,r.initComponent=z,r.input=Dt,r.ins=Ve,r.isBaseElement=jt,r.isComponentConfig=g,r.isComponentInitConfig=S,r.isReactiveSignal=w,r.isSlotTemplate=Pt,r.kebabToCamel=X,r.label=ne,r.li=xt,r.main=we,r.mark=Fe,r.meter=ze,r.nav=Se,r.newEventEmitter=Vt,r.ol=te,r.option=oe,r.p=ae,r.pre=Ee,r.progress=qe,r.projectLog=p,r.property=Lt,r.removeEffect=F,r.renderIf=D,r.rs=yt,r.rxRenderIf=ht,r.s=Me,r.section=Gt,r.select=se,r.setChildren=rt,r.setEffects=ot,r.setListeners=G,r.show=Bt,r.showIf=U,r.signal=R,r.signalComponent=Mt,r.slot=Xe,r.small=Te,r.span=zt,r.strong=Ie,r.sub=Pe,r.summary=Ne,r.sup=_e,r.table=Xt,r.td=Qt,r.textarea=re,r.th=Yt,r.tr=Zt,r.u=He,r.ul=Kt,r.unsafeHtml=_t,r.useCustomComponent=pt,r.video=De,r.when=Ft,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
@@ -3,17 +3,17 @@ var tt = (e, t, s) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writa
3
3
  var h = (e, t, s) => tt(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  const $ = (e) => e && typeof e == "object" && ("classList" in e || "attributes" in e || "customAttributes" in e || "reactiveClassList" in e || "listeners" in e || "customListeners" in e || "children" in e || "effects" in e || "style" in e || Object.keys(e).some(
5
5
  (t) => t.startsWith(".") || t.startsWith("@") || t.startsWith("$")
6
- )) && !("hostElement" in e), et = (e) => e && typeof e == "object" && "hostElement" in e && "append" in e && "set" in e && "addStyle" in e && "setAttribute" in e && "addClass" in e && "addEffect" in e && "addReactiveContent" in e && "setReactiveContent" in e && "clear" in e, H = (e, t, ...s) => {
6
+ )) && !("hostElement" in e), et = (e) => e && typeof e == "object" && "hostElement" in e && "append" in e && "set" in e && "addStyle" in e && "setAttribute" in e && "addClass" in e && "addEffect" in e && "addReactiveContent" in e && "setReactiveContent" in e && "clear" in e, P = (e, t, ...s) => {
7
7
  t && t.apply(e, s);
8
8
  };
9
- let _ = !0;
9
+ let g = !0;
10
10
  const m = (...e) => {
11
- _ && console.debug(
11
+ g && console.debug(
12
12
  ["[rwc]", ...e].join(" | "),
13
13
  ...Array.from(e.join("").matchAll(/%c/gm)).map((t, s) => s % 2 === 0 ? "color:red" : "color:inherit")
14
14
  );
15
- }, W = (e) => e.replace(/([A-Z])/gm, (t) => `-${t.toLowerCase()}`), st = (e) => e.replace(/-(\w)/gm, (t, s) => s.toUpperCase()), T = (e, ...t) => {
16
- if (!_) return;
15
+ }, k = (e) => e.replace(/([A-Z])/gm, (t) => `-${t.toLowerCase()}`), st = (e) => e.replace(/-(\w)/gm, (t, s) => s.toUpperCase()), W = (e, ...t) => {
16
+ if (!g) return;
17
17
  const s = {
18
18
  r: "color: #ff0000",
19
19
  // red
@@ -41,14 +41,14 @@ const m = (...e) => {
41
41
  r = r.replace(l, "%c$1");
42
42
  }), console.log(r, ...o, ...t);
43
43
  }, Lt = () => {
44
- _ = !0;
44
+ g = !0;
45
45
  }, nt = () => {
46
- _ = !1;
46
+ g = !1;
47
47
  };
48
48
  nt();
49
49
  const Ot = (e, t) => {
50
50
  e.every(Boolean) && t(e);
51
- }, w = [], P = (e) => {
51
+ }, v = [], F = (e) => {
52
52
  var t, s, n, o;
53
53
  (t = e.children) == null || t.forEach((r) => {
54
54
  var c;
@@ -60,7 +60,7 @@ function R(e, t) {
60
60
  const n = /* @__PURE__ */ new Set();
61
61
  function o() {
62
62
  var c;
63
- const r = w[w.length - 1];
63
+ const r = v[v.length - 1];
64
64
  return r && !r.fake && !n.has(r) && r.status === "active" && (n.add(r), (c = r.cleanupSet) == null || c.add(() => n.delete(r))), !(t != null && t.name) && (r != null && r.effectId) && o.setName(r.effectId), e;
65
65
  }
66
66
  return o.signalId = `${(t == null ? void 0 : t.name) || ""}_${Math.random().toString(36).substring(2, 15)}`, o.setName = function(r) {
@@ -75,8 +75,8 @@ function R(e, t) {
75
75
  return Object.freeze(e);
76
76
  }, o.initValue = Object.freeze(e), o.forceSet = function(r) {
77
77
  e = r, n.forEach((c) => {
78
- P(c), Promise.resolve().then(() => {
79
- w.push(c), c(), w.pop();
78
+ F(c), Promise.resolve().then(() => {
79
+ v.push(c), c(), v.pop();
80
80
  });
81
81
  });
82
82
  }, o.set = function(r, c = s) {
@@ -101,11 +101,11 @@ function C(e, t) {
101
101
  m("current effect", `%c${s}%c`);
102
102
  const n = e;
103
103
  n.status = "active", n.children = /* @__PURE__ */ new Set(), n.effectId = s;
104
- const o = w[w.length - 1];
104
+ const o = v[v.length - 1];
105
105
  o && ((r = o.children) == null || r.add(n), n.parent = new WeakRef(o), n.destroy = () => {
106
106
  var c;
107
- P(n), (c = o.children) == null || c.delete(n), n.destroy = void 0, n.status = "inactive";
108
- }), n.cleanupSet = /* @__PURE__ */ new Set(), w.push(n), n(), w.pop();
107
+ F(n), (c = o.children) == null || c.delete(n), n.destroy = void 0, n.status = "inactive";
108
+ }), n.cleanupSet = /* @__PURE__ */ new Set(), v.push(n), n(), v.pop();
109
109
  }
110
110
  const y = (e) => !!e && ["object", "function"].includes(typeof e) && "set" in e && "update" in e && "forceSet" in e && "signalId" in e;
111
111
  function jt(e, ...t) {
@@ -148,21 +148,21 @@ const Tt = (...e) => {
148
148
  return C(() => {
149
149
  t.set(e.map((s) => s()));
150
150
  }), t;
151
- }, k = "eventProps", M = "EVENT_CONFIG", I = "observedAttributes", Wt = () => (e, t) => {
151
+ }, M = "eventProps", _ = "EVENT_CONFIG", I = "observedAttributes", Wt = () => (e, t) => {
152
152
  Reflect.get(e, I) || Reflect.defineProperty(e, I, {
153
153
  value: []
154
154
  }), Reflect.get(e, I).push(
155
- W(t)
155
+ k(t)
156
156
  );
157
157
  }, kt = (e) => (t, s) => {
158
- Reflect.get(t, k) || Reflect.defineProperty(t, k, {
158
+ Reflect.get(t, M) || Reflect.defineProperty(t, M, {
159
159
  value: []
160
- }), Reflect.get(t, M) || Reflect.defineProperty(t, M, {
160
+ }), Reflect.get(t, _) || Reflect.defineProperty(t, _, {
161
161
  value: {}
162
- }), Reflect.get(t, M)[s] = {
162
+ }), Reflect.get(t, _)[s] = {
163
163
  bubbles: (e == null ? void 0 : e.bubbles) ?? !1,
164
164
  composed: (e == null ? void 0 : e.composed) ?? !1
165
- }, Reflect.get(t, k).push(s);
165
+ }, Reflect.get(t, M).push(s);
166
166
  }, G = (e, t = !1) => (s) => {
167
167
  m(
168
168
  e,
@@ -202,7 +202,7 @@ const Tt = (...e) => {
202
202
  const a = this[b];
203
203
  a.setName(c), f === null ? (a.set(a.initValue), this.removeAttribute(c)) : a.set(f);
204
204
  }
205
- H(
205
+ P(
206
206
  this,
207
207
  s.prototype.attributeChangedCallback,
208
208
  c,
@@ -222,19 +222,19 @@ const Tt = (...e) => {
222
222
  ((d = p.detail) == null ? void 0 : d.context) === a && (p.stopPropagation(), p.detail.callback(u));
223
223
  });
224
224
  }
225
- )), this.checkInjects(), (b = s.prototype[k]) == null || b.forEach(
225
+ )), this.checkInjects(), (b = s.prototype[M]) == null || b.forEach(
226
226
  (a) => {
227
227
  this[a] = (u) => {
228
- const S = s.prototype[M][a], { bubbles: p, composed: d } = S;
228
+ const S = s.prototype[_][a], { bubbles: p, composed: d } = S;
229
229
  y(u) ? C(() => {
230
- T("@oemit reactive value", u()), this.dispatchEvent(
230
+ W("@oemit reactive value", u()), this.dispatchEvent(
231
231
  new CustomEvent(a, {
232
232
  detail: u(),
233
233
  bubbles: p,
234
234
  composed: d
235
235
  })
236
236
  );
237
- }) : (T("@oemit value", u), this.dispatchEvent(
237
+ }) : (W("@oemit value", u), this.dispatchEvent(
238
238
  new CustomEvent(a, {
239
239
  detail: u,
240
240
  bubbles: p,
@@ -247,7 +247,7 @@ const Tt = (...e) => {
247
247
  const l = () => {
248
248
  m("rwc: insertRenderTemplate");
249
249
  const u = this.render().hostElement;
250
- u && this.shadow.appendChild(u), H(this, s.prototype.connectedCallback), this.appendSlotContent();
250
+ u && this.shadow.appendChild(u), P(this, s.prototype.connectedCallback), this.appendSlotContent();
251
251
  };
252
252
  if (this.rootStyle && !s.styles) {
253
253
  const a = (p) => p instanceof Promise || Array.isArray(p) && p.every((d) => d instanceof Promise), u = this.rootStyle, S = (p) => {
@@ -269,14 +269,14 @@ const Tt = (...e) => {
269
269
  m(
270
270
  this.slotContext,
271
271
  this.slotContext && this.slotContext[a.name]
272
- ), T(
272
+ ), W(
273
273
  "@bslot element",
274
274
  a,
275
275
  `name:${a.name};`,
276
276
  a.assignedElements()
277
277
  ), a.assignedElements().forEach((u) => {
278
278
  const S = this.slotContext[a.name];
279
- this.slotContext && y(S) && (T(
279
+ this.slotContext && y(S) && (W(
280
280
  "@oslot element",
281
281
  a,
282
282
  `name:${a.name};`,
@@ -297,7 +297,7 @@ const Tt = (...e) => {
297
297
  this.allSlotContent = [], this.slotContent = {}, this.htmlSlotContent = {}, this.effectSet.forEach((c) => {
298
298
  var l, f;
299
299
  return (f = (l = c.deref()) == null ? void 0 : l.destroy) == null ? void 0 : f.call(l);
300
- }), this.effectSet.clear(), this.shadow.replaceChildren(), this.replaceChildren(), H(this, s.prototype.disconnectedCallback);
300
+ }), this.effectSet.clear(), this.shadow.replaceChildren(), this.replaceChildren(), P(this, s.prototype.disconnectedCallback);
301
301
  }
302
302
  }
303
303
  return h(o, "observedAttributes", s.prototype[I] ?? []), h(o, "renderTagName", e), o.toString = () => e, customElements.get(e) ? console.error(
@@ -431,7 +431,7 @@ class Z {
431
431
  return c in n && (n[c] = null), this;
432
432
  }
433
433
  else typeof s != "string" ? o = JSON.stringify(s) : o = s;
434
- if ((r = this.hostElement) == null || r.setAttribute(W(t), o), !(n instanceof O)) {
434
+ if ((r = this.hostElement) == null || r.setAttribute(k(t), o), !(n instanceof O)) {
435
435
  const c = t.toLowerCase();
436
436
  c in n && (n[c] = s);
437
437
  }
@@ -440,7 +440,7 @@ class Z {
440
440
  h(this, "setCustomAttribute", (t, s) => {
441
441
  var o;
442
442
  let n;
443
- return typeof s != "string" ? n = JSON.stringify(s) : n = s, (o = this.hostElement) == null || o.setAttribute(W(t), n), this;
443
+ return typeof s != "string" ? n = JSON.stringify(s) : n = s, (o = this.hostElement) == null || o.setAttribute(k(t), n), this;
444
444
  });
445
445
  h(this, "setReactiveAttribute", (t, s) => (this.addEffect((n) => {
446
446
  n.setAttribute(t, s());
@@ -450,7 +450,7 @@ class Z {
450
450
  }), this));
451
451
  h(this, "removeAttribute", (t) => {
452
452
  var s;
453
- return (s = this.hostElement) == null || s.removeAttribute(W(t)), this;
453
+ return (s = this.hostElement) == null || s.removeAttribute(k(t)), this;
454
454
  });
455
455
  h(this, "addStyle", (t) => {
456
456
  const s = this.hostElement;
@@ -507,7 +507,7 @@ class Z {
507
507
  const o = () => t(this, n);
508
508
  if (s) {
509
509
  const l = (r = this.keyedEffects.get(s)) == null ? void 0 : r.deref();
510
- l && P(l);
510
+ l && F(l);
511
511
  }
512
512
  return (c = n.effectSet) == null || c.add(new WeakRef(o)), o.component = this.wrapper, C(o, { name: (s == null ? void 0 : s.toString()) || n.tagName }), this;
513
513
  });
@@ -572,7 +572,7 @@ const _t = () => () => {
572
572
  t && Object.entries(t).forEach(([s, n]) => {
573
573
  typeof n == "function" && e.addEventlistener(s, n);
574
574
  });
575
- }, dt = (e, t) => t == null ? void 0 : t.forEach((s) => e.addEffect(s)), ft = (e, t) => g(new WeakRef(e), ...t || []) ?? e, ut = (e, t) => {
575
+ }, dt = (e, t) => t == null ? void 0 : t.forEach((s) => e.addEffect(s)), ft = (e, t) => H(new WeakRef(e), ...t || []) ?? e, ut = (e, t) => {
576
576
  const s = t;
577
577
  s && Object.keys(s).forEach((n) => {
578
578
  y(s[n]) ? e.setReactiveCustomAttribute(n, s[n]) : typeof s[n] == "function" ? e.addEffect(() => {
@@ -588,7 +588,7 @@ const _t = () => () => {
588
588
  s && Object.keys(s).forEach((o) => {
589
589
  n(o, s[o]);
590
590
  });
591
- }, g = (e, ...t) => {
591
+ }, H = (e, ...t) => {
592
592
  const s = e.deref();
593
593
  if (s)
594
594
  return t.forEach((n) => {
@@ -597,9 +597,9 @@ const _t = () => () => {
597
597
  }, x = (e, t) => {
598
598
  const s = document.createElement(e), n = at(s);
599
599
  return Q(new WeakRef(n), t) ?? n;
600
- }, F = (e, t) => {
600
+ }, V = (e, t) => {
601
601
  const [s, ...n] = e.split(" ").map((r) => r.trim()), o = x(s, t);
602
- return n.length > 0 && o.addClass(...n), (...r) => g(
602
+ return n.length > 0 && o.addClass(...n), (...r) => H(
603
603
  new WeakRef(o),
604
604
  ...r.filter(Boolean).flat().flatMap(
605
605
  (c) => typeof c == "function" && !y(c) ? A(() => c(o)) : c
@@ -608,7 +608,7 @@ const _t = () => () => {
608
608
  }, A = (e) => {
609
609
  const t = `getSignalContent_${Math.random().toString(36).substring(2, 15)}`;
610
610
  return x("div").addStyle({ display: "contents" }).addEffect((s) => {
611
- s.clear(), g(new WeakRef(s), ...[e()].flat());
611
+ s.clear(), H(new WeakRef(s), ...[e()].flat());
612
612
  }, t);
613
613
  }, Ht = (e, t, s) => {
614
614
  const n = x("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
@@ -622,52 +622,56 @@ const _t = () => () => {
622
622
  var p;
623
623
  const a = e();
624
624
  c = a.map(t).map((d) => typeof d == "string" ? d : d.toString());
625
- const u = Array.from(((p = n.hostElement) == null ? void 0 : p.children) || []);
625
+ const u = Array.from(
626
+ ((p = n.hostElement) == null ? void 0 : p.children) || []
627
+ );
626
628
  m("containerChildren", u, c), u.forEach((d) => {
627
629
  const E = d.dataset.key;
628
630
  c.includes(E) || (m("remove element", E, d), d.remove(), b(E));
629
631
  }), c.forEach((d) => {
630
- var j, L, v;
632
+ var j, L, w;
631
633
  const E = a[c.indexOf(d)];
632
- o.has(d) ? JSON.stringify(E) !== JSON.stringify(f[c.indexOf(d)]) && ((L = (j = n.hostElement) == null ? void 0 : j.querySelector(`[data-key="${d}"]`)) == null || L.remove(), (v = o.get(d)) == null || v.set(Math.random().toString(36).substring(2, 15)), r.set(
634
+ o.has(d) ? JSON.stringify(E) !== JSON.stringify(f[c.indexOf(d)]) && ((L = (j = n.hostElement) == null ? void 0 : j.querySelector(`[data-key="${d}"]`)) == null || L.remove(), (w = o.get(d)) == null || w.set(Math.random().toString(36).substring(2, 15)), r.set(
633
635
  d,
634
- () => s(E, c.indexOf(d), a).setCustomAttribute(
635
- "data-key",
636
- d
637
- )
636
+ () => s(
637
+ E,
638
+ c.indexOf(d),
639
+ a
640
+ ).setCustomAttribute("data-key", d)
638
641
  )) : (m("create new element", d, E), o.set(
639
642
  d,
640
643
  R(Math.random().toString(36).substring(2, 15))
641
644
  ), r.set(
642
645
  d,
643
- () => s(E, c.indexOf(d), a).setCustomAttribute(
644
- "data-key",
645
- d
646
- )
646
+ () => s(
647
+ E,
648
+ c.indexOf(d),
649
+ a
650
+ ).setCustomAttribute("data-key", d)
647
651
  ));
648
652
  }), f = [...a.map((d) => ({ ...d }))];
649
653
  const S = () => {
650
654
  o.forEach((d, E) => {
651
- m("key from setTimeout foreach currItemSignalMap", E), l.has(E) || (l.add(E), C(() => {
652
- var V, B;
655
+ m(
656
+ "key from setTimeout foreach currItemSignalMap",
657
+ E
658
+ ), l.has(E) || (l.add(E), C(() => {
659
+ var B, N;
653
660
  d();
654
- const j = c.indexOf(E), L = (V = r.get(E)) == null ? void 0 : V();
661
+ const j = c.indexOf(E), L = (B = r.get(E)) == null ? void 0 : B();
655
662
  if (!L) return;
656
663
  m(
657
664
  "call effect from setTimeout",
658
665
  E,
659
666
  L.hostElement
660
667
  );
661
- const v = n.hostElement;
662
- if (v && j <= v.children.length - 1)
663
- v.insertBefore(
664
- v,
665
- v.children[j]
666
- );
667
- else {
668
- const N = L.hostElement;
669
- N && ((B = n.hostElement) == null || B.append(N));
670
- }
668
+ const w = n.hostElement, T = L.hostElement;
669
+ w && T && j <= w.children.length - 1 ? w.insertBefore(
670
+ T,
671
+ w.children[j]
672
+ ) : T && ((N = n.hostElement) == null || N.append(
673
+ T
674
+ ));
671
675
  }));
672
676
  });
673
677
  };
@@ -684,10 +688,20 @@ const _t = () => () => {
684
688
  x("div").addStyle({ display: "none" }).setAttribute("id", "empty_template")
685
689
  );
686
690
  try {
687
- m("newReactiveComponent.map", o.map((l) => {
688
- var f;
689
- return m("newReactiveComponent hostElement", l.hostElement), (f = l.hostElement) == null ? void 0 : f.id;
690
- })), m("currComponent[0].hostElement?.id", (r = t[0].hostElement) == null ? void 0 : r.id, t), (c = t[0].hostElement) == null || c.replaceWith(
691
+ m(
692
+ "newReactiveComponent.map",
693
+ o.map((l) => {
694
+ var f;
695
+ return m(
696
+ "newReactiveComponent hostElement",
697
+ l.hostElement
698
+ ), (f = l.hostElement) == null ? void 0 : f.id;
699
+ })
700
+ ), m(
701
+ "currComponent[0].hostElement?.id",
702
+ (r = t[0].hostElement) == null ? void 0 : r.id,
703
+ t
704
+ ), (c = t[0].hostElement) == null || c.replaceWith(
691
705
  ...o.map((l) => l.hostElement).filter(Boolean)
692
706
  ), t.slice(1).forEach((l) => {
693
707
  var f;
@@ -698,14 +712,16 @@ const _t = () => () => {
698
712
  }
699
713
  }), s ? t : t[0];
700
714
  }, Ft = (e) => ot in e, Vt = (e) => {
701
- const t = F("div")().addStyle({ display: "contents" }), s = (n) => {
715
+ const t = V("div")().addStyle({ display: "contents" }), s = (n) => {
702
716
  const o = t.hostElement;
703
717
  return o && (o.innerHTML = n), t;
704
718
  };
705
719
  return typeof e == "string" ? s(e) : t.addEffect(() => {
706
720
  s(e());
707
721
  }), t;
708
- }, Y = (e, t, s) => e ? A(t) : s ? A(s) : F("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), bt = (e, t, s) => A(() => Y(!!e(), t, s)), Bt = (e, t, s) => typeof e == "boolean" ? Y(e, t, s) : bt(e, t, s), D = (e, t) => A(t).addEffect((s, n) => {
722
+ }, Y = (e, t, s) => e ? A(t) : s ? A(s) : V("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), bt = (e, t, s) => A(
723
+ () => Y(!!e(), t, s)
724
+ ), Bt = (e, t, s) => typeof e == "boolean" ? Y(e, t, s) : bt(e, t, s), D = (e, t) => A(t).addEffect((s, n) => {
709
725
  if (typeof e == "boolean")
710
726
  n.style.display = e ? "block" : "none";
711
727
  else {
@@ -713,12 +729,16 @@ const _t = () => () => {
713
729
  n.style.display = o;
714
730
  }
715
731
  }), Nt = (e, t, s) => {
716
- const n = [D(e, t)].flat();
732
+ const n = [
733
+ D(e, t)
734
+ ].flat();
717
735
  return s && n.push(
718
- ...[D(
719
- () => typeof e == "boolean" ? !e : !e(),
720
- s
721
- )].flat()
736
+ ...[
737
+ D(
738
+ () => typeof e == "boolean" ? !e : !e(),
739
+ s
740
+ )
741
+ ].flat()
722
742
  ), A(() => n);
723
743
  }, St = (e, t) => {
724
744
  m("createCustomElement", e);
@@ -740,7 +760,7 @@ const _t = () => () => {
740
760
  },
741
761
  {}
742
762
  ), c.appendAllSlotContent = () => {
743
- g(new WeakRef(n), ...r);
763
+ H(new WeakRef(n), ...r);
744
764
  }), n;
745
765
  };
746
766
  }, vt = (e, t, s) => yt(
@@ -826,7 +846,7 @@ const _t = () => () => {
826
846
  At.forEach((e) => {
827
847
  i[e] = (t, ...s) => {
828
848
  let n = [...s];
829
- return t && !$(t) && (n = [t].concat(n)), F(e, $(t) ? t : {})(...n);
849
+ return t && !$(t) && (n = [t].concat(n)), V(e, $(t) ? t : {})(...n);
830
850
  };
831
851
  });
832
852
  const Dt = i.div, Gt = i.span, Ut = i.section, Xt = i.input, Zt = i.button, Qt = i.table, Yt = i.tr, Kt = i.td, te = i.th, ee = i.ul, se = i.li, ne = i.ol, oe = i.form, re = i.label, ce = i.select, ie = i.option, le = i.textarea, ae = i.img, he = i.a, de = i.p, fe = i.h1, ue = i.h2, pe = i.h3, me = i.h4, Ee = i.h5, Ce = i.h6, be = i.br, Se = i.hr, ye = i.pre, ve = i.code, we = i.nav, Ae = i.header, Re = i.footer, Le = i.main, Oe = i.aside, je = i.article, Ie = i.figure, $e = i.figcaption, xe = i.blockquote, Te = i.cite, We = i.small, ke = i.strong, Me = i.em, _e = i.b, ge = i.i, He = i.u, Pe = i.s, Fe = i.sub, Ve = i.sup, Be = i.mark, Ne = i.del, Je = i.ins, qe = i.details, ze = i.summary, De = i.progress, Ge = i.meter, Ue = i.audio, Xe = i.video, Ze = i.canvas, Qe = i.slot, Ye = (e) => (t) => e(t).addClass(...t.classList ?? []).addReactiveClass(t.reactiveClassList ?? {});
@@ -838,7 +858,7 @@ export {
838
858
  ut as addCustomAttributes,
839
859
  mt as addReactiveClassList,
840
860
  Et as addStyleList,
841
- g as appendContentItem,
861
+ H as appendContentItem,
842
862
  je as article,
843
863
  Oe as aside,
844
864
  Ue as audio,
@@ -847,15 +867,15 @@ export {
847
867
  xe as blockquote,
848
868
  be as br,
849
869
  Zt as button,
850
- W as camelToKebab,
870
+ k as camelToKebab,
851
871
  Ze as canvas,
852
- H as checkCall,
872
+ P as checkCall,
853
873
  Ot as checkRef,
854
874
  Te as cite,
855
875
  ht as classList,
856
876
  gt as cls,
857
877
  ve as code,
858
- T as colorLog,
878
+ W as colorLog,
859
879
  Tt as combineLatest,
860
880
  G as component,
861
881
  zt as configCustomComponent,
@@ -863,7 +883,7 @@ export {
863
883
  vt as createCustom,
864
884
  yt as createCustomEl,
865
885
  St as createCustomElement,
866
- F as createEl,
886
+ V as createEl,
867
887
  x as createElement,
868
888
  It as createSignal,
869
889
  lt as customElementHelpers,
@@ -918,7 +938,7 @@ export {
918
938
  De as progress,
919
939
  m as projectLog,
920
940
  Wt as property,
921
- P as removeEffect,
941
+ F as removeEffect,
922
942
  Y as renderIf,
923
943
  jt as rs,
924
944
  bt as rxRenderIf,
@@ -1,2 +0,0 @@
1
- (function(r,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(r=typeof globalThis<"u"?globalThis:r||self,S(r.ReactiveComponent={}))})(this,function(r){"use strict";var Qe=Object.defineProperty;var Ye=(r,S,j)=>S in r?Qe(r,S,{enumerable:!0,configurable:!0,writable:!0,value:j}):r[S]=j;var h=(r,S,j)=>Ye(r,typeof S!="symbol"?S+"":S,j);const S=n=>n&&typeof n=="object"&&("classList"in n||"attributes"in n||"customAttributes"in n||"reactiveClassList"in n||"listeners"in n||"customListeners"in n||"children"in n||"effects"in n||"style"in n||Object.keys(n).some(t=>t.startsWith(".")||t.startsWith("@")||t.startsWith("$")))&&!("hostElement"in n),j=n=>n&&typeof n=="object"&&"hostElement"in n&&"append"in n&&"set"in n&&"addStyle"in n&&"setAttribute"in n&&"addClass"in n&&"addEffect"in n&&"addReactiveContent"in n&&"setReactiveContent"in n&&"clear"in n,P=(n,t,...e)=>{t&&t.apply(n,e)};let _=!0;const p=(...n)=>{_&&console.debug(["[rwc]",...n].join(" | "),...Array.from(n.join("").matchAll(/%c/gm)).map((t,e)=>e%2===0?"color:red":"color:inherit"))},k=n=>n.replace(/([A-Z])/gm,t=>`-${t.toLowerCase()}`),U=n=>n.replace(/-(\w)/gm,(t,e)=>e.toUpperCase()),$=(n,...t)=>{if(!_)return;const e={r:"color: #ff0000",g:"color: #00ff00",b:"color: #0000ff",y:"color: #ffff00",p:"color: #800080",c:"color: #00ffff",o:"color: #ffa500",w:"color: #808080"},s=n.match(/@[rgbpycow]/g)||[],o=s.map(c=>{const l=c.slice(1);return e[l]||"color: inherit"});let i=n;s.forEach(c=>{const l=new RegExp(`\\${c}([^\\s,]+)`,"g");i=i.replace(l,"%c$1")}),console.log(i,...o,...t)},bt=()=>{_=!0},X=()=>{_=!1};X();const St=(n,t)=>{n.every(Boolean)&&t(n)},A=[],F=n=>{var t,e,s,o;(t=n.children)==null||t.forEach(i=>{var c;return(c=i.destroy)==null?void 0:c.call(i)}),(e=n.children)==null||e.clear(),(s=n.cleanupSet)==null||s.forEach(i=>i()),(o=n.cleanupSet)==null||o.clear()};function R(n,t){let e=(t==null?void 0:t.signalCompareFn)||(()=>!0);const s=new Set;function o(){var c;const i=A[A.length-1];return i&&!i.fake&&!s.has(i)&&i.status==="active"&&(s.add(i),(c=i.cleanupSet)==null||c.add(()=>s.delete(i))),!(t!=null&&t.name)&&(i!=null&&i.effectId)&&o.setName(i.effectId),n}return o.signalId=`${(t==null?void 0:t.name)||""}_${Math.random().toString(36).substring(2,15)}`,o.setName=function(i){return o.signalId=`${i}_${Math.random().toString(36).substring(2,15)}`,o},o.setCompareFn=function(i){return e=i,o},o.clearSubscribers=function(){s.clear()},o.getSubscribers=function(){return s},o.peek=function(){return Object.freeze(n)},o.initValue=Object.freeze(n),o.forceSet=function(i){n=i,s.forEach(c=>{F(c),Promise.resolve().then(()=>{A.push(c),c(),A.pop()})})},o.set=function(i,c=e){n!==i&&c(n,i)&&o.forceSet(i)},o.update=function(i){o.set(i(n))},o.pipe=(i,c)=>{c!=null&&c.name&&o.setName(c.name);const l=R(null);return b(()=>{const u=o();b(()=>{const d=i(u);d instanceof Promise?d.then(v=>l.set(v)):w(d)?b(()=>l.set(d()),{name:"pipe_effect_inner"}):l.set(d)},{name:"pipe_effect"})},{name:(c==null?void 0:c.name)||`pipe_${o.signalId}`}),l},o}function b(n,t){var i;const e=`${(t==null?void 0:t.name)||""}_${Math.random().toString(36).substring(2,15)}`;p("current effect",`%c${e}%c`);const s=n;s.status="active",s.children=new Set,s.effectId=e;const o=A[A.length-1];o&&((i=o.children)==null||i.add(s),s.parent=new WeakRef(o),s.destroy=()=>{var c;F(s),(c=o.children)==null||c.delete(s),s.destroy=void 0,s.status="inactive"}),s.cleanupSet=new Set,A.push(s),s(),A.pop()}const w=n=>!!n&&["object","function"].includes(typeof n)&&"set"in n&&"update"in n&&"forceSet"in n&&"signalId"in n;function yt(n,...t){const e=R("");return b(()=>{const s=t.map(i=>w(i)?String(i()):String(i)),o=[n[0]];s.forEach((i,c)=>{o.push(i,n[c+1])}),e.set(o.join(""))}),e}function vt(n,t){const e=R(t??null),s=o=>e.set(o);return n instanceof Promise?n.then(s):typeof n=="function"&&b(()=>{const o=n();o instanceof Promise?o.then(s):w(o)?b(()=>s(o())):s(o)}),e}function wt(n,t){let e=n(),s=t();b(()=>{const o=n(),i=t();o!==i&&(o!==e?t.set(o):i!==s&&n.set(i)),e=o,s=i})}function At(...n){let t=n.map(s=>s());const e=R(t);return n.forEach((s,o)=>{b(()=>{const i=()=>t.filter(c=>c!==void 0).length;i()===n.length&&(t=Array.from(t).fill(void 0)),t[o]=s(),i()===n.length&&e.set([...t])})}),e}const Rt=(...n)=>{const t=R([]);return b(()=>{t.set(n.map(e=>e()))}),t},B="eventProps",V="EVENT_CONFIG",W="observedAttributes",Lt=()=>(n,t)=>{Reflect.get(n,W)||Reflect.defineProperty(n,W,{value:[]}),Reflect.get(n,W).push(k(t))},gt=n=>(t,e)=>{Reflect.get(t,B)||Reflect.defineProperty(t,B,{value:[]}),Reflect.get(t,V)||Reflect.defineProperty(t,V,{value:{}}),Reflect.get(t,V)[e]={bubbles:(n==null?void 0:n.bubbles)??!1,composed:(n==null?void 0:n.composed)??!1},Reflect.get(t,B).push(e)},N=(n,t=!1)=>e=>{p(n,"start register static attr",e.prototype[W]);const s=[];if(e.styles){const i=e.styles,c=[];Array.isArray(i)?c.push(...i):c.push(i),c.forEach(l=>{const u=new CSSStyleSheet;u.replaceSync(l),s.push(u);const y=new CSSStyleSheet;y.replaceSync(l.slice(l.indexOf("@property"))),document.adoptedStyleSheets.push(y)})}class o extends e{constructor(...c){p("constructor",`%c${n}%c`),super(t,...c),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){return p("rwc: render from new class"),e.prototype.render.call(this)}attributeChangedCallback(c,l,u){p("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${l}, newValue: ${u}`,`%c${n}%c`);try{u=JSON.parse(u)}catch{}const y=U(c);if(y in this&&w(this[y])){const d=this[y];d.setName(c),u===null?(d.set(d.initValue),this.removeAttribute(c)):d.set(u)}P(this,e.prototype.attributeChangedCallback,c,l,u)}connectedCallback(){const c=()=>{var u,y;p("rwc: connectedCallback"),p("connectedCallback",`%c${n}%c`,this),(u=this.init)==null||u.call(this),this.providers&&Object.keys(this.providers).length>0&&(p("WRAPPER for providers",n),Object.entries(this.providers).forEach(([d,m])=>{p("register provider",d,m()),this.addEventListener(d,v=>{var f;p("send provider",d,m());const C=v;((f=C.detail)==null?void 0:f.context)===d&&(C.stopPropagation(),C.detail.callback(m))})})),this.checkInjects(),(y=e.prototype[B])==null||y.forEach(d=>{this[d]=m=>{const v=e.prototype[V][d],{bubbles:C,composed:f}=v;w(m)?b(()=>{$("@oemit reactive value",m()),this.dispatchEvent(new CustomEvent(d,{detail:m(),bubbles:C,composed:f}))}):($("@oemit value",m),this.dispatchEvent(new CustomEvent(d,{detail:m,bubbles:C,composed:f})))}}),p("start render",`%c${n}%c`,n);const l=()=>{p("rwc: insertRenderTemplate");const m=this.render().hostElement;m&&this.shadow.appendChild(m),P(this,e.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!e.styles){const d=C=>C instanceof Promise||Array.isArray(C)&&C.every(f=>f instanceof Promise),m=this.rootStyle,v=C=>{const f=new CSSStyleSheet;f.replaceSync(C),this.shadow.adoptedStyleSheets.push(f);const E=new CSSStyleSheet;E.replaceSync(C.slice(C.indexOf("@property"))),document.adoptedStyleSheets.push(E)};if(d(m)){const C=[];Array.isArray(m)?C.push(...m):C.push(m),Promise.all(C).then(f=>f.forEach(E=>v(E.default))).then(()=>l())}else{const C=[];Array.isArray(m)?C.push(...m):C.push(m),C.forEach(f=>v(f)),l()}}else l();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(d=>{p(this.slotContext,this.slotContext&&this.slotContext[d.name]),$("@bslot element",d,`name:${d.name};`,d.assignedElements()),d.assignedElements().forEach(m=>{const v=this.slotContext[d.name];this.slotContext&&w(v)&&($("@oslot element",d,`name:${d.name};`,d.assignedElements()),b(()=>{m.dispatchEvent(new CustomEvent("handleSlotContext",{detail:v()}))}))})})};c.fake=!0,c.component=new WeakRef(this),this.effectSet.add(new WeakRef(c)),b(c,{name:"FAKE_wrapperEffect"})}disconnectedCallback(){this.allSlotContent=[],this.slotContent={},this.htmlSlotContent={},this.effectSet.forEach(c=>{var l,u;return(u=(l=c.deref())==null?void 0:l.destroy)==null?void 0:u.call(l)}),this.effectSet.clear(),this.shadow.replaceChildren(),this.replaceChildren(),P(this,e.prototype.disconnectedCallback)}}return h(o,"observedAttributes",e.prototype[W]??[]),h(o,"renderTagName",n),o.toString=()=>n,customElements.get(n)?console.error(`название тега ${n} повторяется, компонент ${e.name} не зарегистрирован`):customElements.define(n,o),e.renderTagName=n,e};class O extends HTMLElement{constructor(e=!1){super();h(this,"init");h(this,"isSlotLazyLoading",!1);h(this,"slotTemplate");h(this,"slotContext");h(this,"rootStyle");h(this,"modelValue");h(this,"providers");h(this,"effectSet",new Set);h(this,"appendAllSlotContent");h(this,"allSlotContent",[]);h(this,"slotContent",{});h(this,"htmlSlotContent",{});h(this,"shadow");h(this,"injects",{});this.shadow=this.attachShadow({mode:e?"closed":"open"})}appendChild(e,s=!0){var o;if(this.isSlotLazyLoading&&s){if(e instanceof HTMLElement){const i=e.slot||"default";this.htmlSlotContent[i]||(this.htmlSlotContent[i]=[]),(o=this.htmlSlotContent[i])==null||o.push(e)}}else return super.appendChild(e)}appendSlotContent(){var e;(e=this.appendAllSlotContent)==null||e.call(this)}inject(e){return p("%cinject%c",e),this.injects[e]||(this.injects[e]=R(null)),this.injects[e]}checkInjects(){Object.entries(this.injects).forEach(([e,s])=>{p("%cinject%c",`%c${e}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(e,{detail:{context:e,callback:o=>b(()=>{s.set(o())},{name:e})},bubbles:!0,composed:!0}))})}setReactiveValue(e){this.modelValue=e}}h(O,"observedAttributes",[]),h(O,"renderTagName",""),h(O,"styles");const jt=n=>"render"in n&&"setReactiveValue"in n,Ot="handleSlotContext",Z="onConnected",Q=n=>typeof n=="string"?n:JSON.stringify(n),Tt=n=>{const t=document.createElement("span");return t.textContent=Q(n),t},Y=(n,t)=>(n.appendChild(Tt(t)),n),It=(n,t)=>(n.replaceChildren(),Y(n,t)),K=n=>{const t=document.createElement("span");return b(()=>{const e=n();t.textContent=Q(e)}),t};class x{constructor(t){h(this,"wrapper");h(this,"keyedEffects",new Map);h(this,"append",(...t)=>(t.forEach(e=>{var o;const s=e.hostElement;s&&((o=this.hostElement)==null||o.appendChild(s),Z in s&&setTimeout(()=>{var i;(i=s.onConnected)==null||i.call(s,e,s)}))}),this));h(this,"set",(...t)=>{var s;this.clear();const e=document.createDocumentFragment();return t.forEach(o=>{const i=o.hostElement;i&&e.appendChild(i)}),(s=this.hostElement)==null||s.appendChild(e),this});h(this,"removeChild",(...t)=>(t.forEach(e=>{var s,o;if(Array.from(((s=this.hostElement)==null?void 0:s.childNodes.values())||[]).some(i=>i===e.hostElement)){const i=e.hostElement;i&&((o=this.hostElement)==null||o.removeChild(i))}}),this));h(this,"addHtmlContent",t=>{const e=this.hostElement;return e?(Y(e,t),this):this});h(this,"setHtmlContent",t=>{const e=this.hostElement;return e?(It(e,t),this):this});h(this,"setAttribute",(t,e)=>{var i;const s=this.hostElement;if(!s)return this;let o;if(typeof e=="boolean"&&!(s instanceof O))if(e)o="";else{this.removeAttribute(t);const c=t.toLowerCase();return c in s&&(s[c]=null),this}else typeof e!="string"?o=JSON.stringify(e):o=e;if((i=this.hostElement)==null||i.setAttribute(k(t),o),!(s instanceof O)){const c=t.toLowerCase();c in s&&(s[c]=e)}return this});h(this,"setCustomAttribute",(t,e)=>{var o;let s;return typeof e!="string"?s=JSON.stringify(e):s=e,(o=this.hostElement)==null||o.setAttribute(k(t),s),this});h(this,"setReactiveAttribute",(t,e)=>(this.addEffect(s=>{s.setAttribute(t,e())},t),this));h(this,"setReactiveCustomAttribute",(t,e)=>(this.addEffect(s=>{s.setCustomAttribute(t,e())}),this));h(this,"removeAttribute",t=>{var e;return(e=this.hostElement)==null||e.removeAttribute(k(t)),this});h(this,"addStyle",t=>{const e=this.hostElement;return e?(Object.entries(t).forEach(([s,o])=>{const i=s.startsWith("--");typeof o=="function"?this.addEffect(()=>{if(i){const c=String(o()||"");e.style.setProperty(s,c)}else e.style[s]=o()}):typeof o=="string"&&(i?e.style.setProperty(s,o):e.style[s]=o)}),this):this});h(this,"onConnected",t=>this.hostElement?(Reflect.defineProperty(this.hostElement,Z,{get(){return t}}),this):this);h(this,"addClass",(...t)=>(t.forEach(e=>{var s;typeof e=="string"?(s=this.hostElement)==null||s.classList.add(...e.split(" ").flatMap(o=>o.split(`
2
- `)).map(o=>o.trim()).filter(Boolean)):(()=>{let o=null;this.addEffect(()=>{const i=e();i.length>0&&(o?this.replaceClass(o,i):this.addClass(i),o=i)})})()}),this));h(this,"setClass",(...t)=>{var e,s,o;return(s=this.hostElement)==null||s.classList.remove(...((e=this.hostElement)==null?void 0:e.classList)||[]),(o=this.hostElement)==null||o.classList.add(...t),this});h(this,"addReactiveClass",t=>(Object.keys(t).forEach(e=>{this.addEffect(s=>{t[e]()?s.addClass(e):s.removeClass(e)})}),this));h(this,"removeClass",(...t)=>{var e;return(e=this.hostElement)==null||e.classList.remove(...t),this});h(this,"replaceClass",(t,e)=>{var s;return(s=this.hostElement)==null||s.classList.replace(t,e),this});h(this,"addEffect",(t,e)=>{var i,c;const s=this.hostElement;if(!s)return this;const o=()=>t(this,s);if(e){const l=(i=this.keyedEffects.get(e))==null?void 0:i.deref();l&&F(l)}return(c=s.effectSet)==null||c.add(new WeakRef(o)),o.component=this.wrapper,b(o,{name:(e==null?void 0:e.toString())||s.tagName}),this});h(this,"addReactiveContent",t=>{var e;return(e=this.hostElement)==null||e.appendChild(K(t)),this});h(this,"setReactiveContent",t=>{var e;return this.clear(),(e=this.hostElement)==null||e.appendChild(K(t)),this});h(this,"clear",()=>{var t;return(t=this.hostElement)==null||t.replaceChildren(),this});this.wrapper=t;const e=t.deref();e&&(e.effectSet=new Set)}get hostElement(){return this.wrapper.deref()}addEventlistener(t,e,s=!1){var o;return(o=this.hostElement)==null||o.addEventListener(t,i=>e(i,this,this.hostElement),s),this}}class kt extends x{constructor(){super(...arguments);h(this,"setReactiveValue",e=>(this.hostElement instanceof O&&this.hostElement.setReactiveValue(e),this));h(this,"setSlotTemplate",e=>{var o;const s=(o=this.hostElement)==null?void 0:o.slotTemplate;return s&&Object.entries(e).forEach(([i,c])=>{s[i]=c}),this})}}const $t=()=>()=>{},tt=n=>new kt(new WeakRef(n)),et=n=>new x(new WeakRef(n)),nt=(n,...t)=>({classList:[...n.map(e=>e.trim()).filter(Boolean),...t]}),Wt=(n,...t)=>nt(n,...t),q=(n,t)=>{if(!t||!n.deref())return;const e=Object.keys(t||{}).filter(o=>o.startsWith(".")||o.startsWith("@")||o.startsWith("$"));e.filter(o=>o.startsWith(".")).forEach(o=>{t!=null&&t.attributes||(t.attributes={}),t.attributes[o.slice(1)]=t[o]}),e.filter(o=>o.startsWith("@")).forEach(o=>{t!=null&&t.listeners||(t.listeners={});const i=o.slice(1);t.listeners[i]=t[o]}),e.filter(o=>o.startsWith("$")).forEach(o=>{t!=null&&t.effects||(t.effects=[]),t.effects.push(t[o])});const s=n.deref();if(s)return it(s,t.classList),at(s,t.style),lt(s,t.attributes),ct(s,t.reactiveClassList),rt(s,t.customAttributes),ot(s,t.children),st(s,t.effects),z(s,t.listeners),z(s,t.customListeners),s},z=(n,t)=>{t&&Object.entries(t).forEach(([e,s])=>{typeof s=="function"&&n.addEventlistener(e,s)})},st=(n,t)=>t==null?void 0:t.forEach(e=>n.addEffect(e)),ot=(n,t)=>H(new WeakRef(n),...t||[])??n,rt=(n,t)=>{const e=t;e&&Object.keys(e).forEach(s=>{w(e[s])?n.setReactiveCustomAttribute(s,e[s]):typeof e[s]=="function"?n.addEffect(()=>{n.setCustomAttribute(s,e[s]())}):n.setCustomAttribute(s,e[s])})},it=(n,t)=>n.addClass(...t||[]),ct=(n,t)=>n.addReactiveClass(t||{}),at=(n,t)=>n.addStyle(t||{}),lt=(n,t)=>{const e=t,s=(o,i)=>{i&&(w(i)?n.setReactiveAttribute(o,i):typeof i=="function"?n.addEffect(()=>{n.setAttribute(o,i())}):n.setAttribute(o,i))};e&&Object.keys(e).forEach(o=>{s(o,e[o])})},H=(n,...t)=>{const e=n.deref();if(e)return t.forEach(s=>{typeof s=="string"?s.trim().length>0&&e.addHtmlContent(s):w(s)?e.addReactiveContent(s):e.append(s)}),e},T=(n,t)=>{const e=document.createElement(n),s=et(e);return q(new WeakRef(s),t)??s},J=(n,t)=>{const[e,...s]=n.split(" ").map(i=>i.trim()),o=T(e,t);return s.length>0&&o.addClass(...s),(...i)=>H(new WeakRef(o),...i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!w(c)?L(()=>c(o)):c))??o},L=n=>{const t=`getSignalContent_${Math.random().toString(36).substring(2,15)}`;return T("div").addStyle({display:"contents"}).addEffect(e=>{e.clear(),H(new WeakRef(e),...[n()].flat())},t)},Ht=(n,t,e)=>{const s=T("div").addStyle({display:"contents"}),o=new Map,i=new Map;let c=[];const l=new Set;let u=n.peek();const y=d=>{l.delete(d),o.delete(d),i.delete(d)};return b(()=>{var C;const d=n();c=d.map(t).map(f=>typeof f=="string"?f:f.toString());const m=Array.from(((C=s.hostElement)==null?void 0:C.children)||[]);p("containerChildren",m,c),m.forEach(f=>{const E=f.dataset.key;c.includes(E)||(p("remove element",E,f),f.remove(),y(E))}),c.forEach(f=>{var M,I,g;const E=d[c.indexOf(f)];o.has(f)?JSON.stringify(E)!==JSON.stringify(u[c.indexOf(f)])&&((I=(M=s.hostElement)==null?void 0:M.querySelector(`[data-key="${f}"]`))==null||I.remove(),(g=o.get(f))==null||g.set(Math.random().toString(36).substring(2,15)),i.set(f,()=>e(E,c.indexOf(f),d).setCustomAttribute("data-key",f))):(p("create new element",f,E),o.set(f,R(Math.random().toString(36).substring(2,15))),i.set(f,()=>e(E,c.indexOf(f),d).setCustomAttribute("data-key",f)))}),u=[...d.map(f=>({...f}))];const v=()=>{o.forEach((f,E)=>{p("key from setTimeout foreach currItemSignalMap",E),l.has(E)||(l.add(E),b(()=>{var pt,Ct;f();const M=c.indexOf(E),I=(pt=i.get(E))==null?void 0:pt();if(!I)return;p("call effect from setTimeout",E,I.hostElement);const g=s.hostElement;if(g&&M<=g.children.length-1)g.insertBefore(g,g.children[M]);else{const Et=I.hostElement;Et&&((Ct=s.hostElement)==null||Ct.append(Et))}}))})};Promise.resolve().then(()=>v())}),s},Mt=n=>{let t=[T("div")],e=!1;return b(()=>{var i,c;const s=n();e=Array.isArray(s);const o=[];o.push(...[s].flat()),o.length===0&&o.push(T("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{p("newReactiveComponent.map",o.map(l=>{var u;return p("newReactiveComponent hostElement",l.hostElement),(u=l.hostElement)==null?void 0:u.id})),p("currComponent[0].hostElement?.id",(i=t[0].hostElement)==null?void 0:i.id,t),(c=t[0].hostElement)==null||c.replaceWith(...o.map(l=>l.hostElement).filter(Boolean)),t.slice(1).forEach(l=>{var u;return(u=l.hostElement)==null?void 0:u.remove()}),t=o}catch(l){console.error(l)}}),e?t:t[0]},Pt=n=>Ot in n,_t=n=>{const t=J("div")().addStyle({display:"contents"}),e=s=>{const o=t.hostElement;return o&&(o.innerHTML=s),t};return typeof n=="string"?e(n):t.addEffect(()=>{e(n())}),t},G=(n,t,e)=>n?L(t):e?L(e):J("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),dt=(n,t,e)=>L(()=>G(!!n(),t,e)),Ft=(n,t,e)=>typeof n=="boolean"?G(n,t,e):dt(n,t,e),D=(n,t)=>L(t).addEffect((e,s)=>{if(typeof n=="boolean")s.style.display=n?"block":"none";else{const o=n()?"block":"none";s.style.display=o}}),Bt=(n,t,e)=>{const s=[D(n,t)].flat();return e&&s.push(...[D(()=>typeof n=="boolean"?!n:!n(),e)].flat()),L(()=>s)},ht=(n,t)=>{p("createCustomElement",n);const e=document.createElement(n),s=tt(e);return e.init=()=>{q(new WeakRef(s),t)},s},ft=(n,t)=>{const e=n.split(" ").slice(1).map(o=>o.trim()),s=ht(n.split(" ")[0],t);return Array.isArray(e)&&e.length>0&&s.addClass(...e),(...o)=>{const i=o.filter(Boolean).flat().flatMap(l=>typeof l=="function"&&!w(l)?L(()=>l(s)):l),c=s.hostElement;return c&&(c.allSlotContent=i,c.slotContent=i.filter(j).reduce((l,u)=>{var d;const y=((d=u.hostElement)==null?void 0:d.getAttribute("slot"))||"default";return l[y]||(l[y]=[]),l[y].push(u),l},{}),c.appendAllSlotContent=()=>{H(new WeakRef(s),...i)}),s}},ut=(n,t,e)=>ft(`${n.renderTagName}${t&&typeof t=="string"?" "+t:""}`,S(t)?t:t&&typeof t=="string"?e:void 0),Vt=()=>{const n=()=>{};return n.oldValue=null,n},Jt=()=>({}),mt=(n,t,e)=>{const s=t?N(t,e)(n):n;return(o,...i)=>{const c=[...i];return o&&!S(o)&&c.unshift(o),ut(s,S(o)?o:{})(...c)}},Nt=n=>[mt(n),(t,e)=>{N(t,e)(n)}],a={};["div","span","section","input","button","table","tr","td","th","ul","li","ol","form","label","select","option","textarea","img","a","p","h1","h2","h3","h4","h5","h6","br","hr","pre","code","nav","header","footer","main","aside","article","figure","figcaption","blockquote","cite","small","strong","em","b","i","u","s","sub","sup","mark","del","ins","details","summary","progress","meter","audio","video","canvas","slot"].forEach(n=>{a[n]=(t,...e)=>{let s=[...e];return t&&!S(t)&&(s=[t].concat(s)),J(n,S(t)?t:{})(...s)}});const qt=a.div,zt=a.span,Gt=a.section,Dt=a.input,Ut=a.button,Xt=a.table,Zt=a.tr,Qt=a.td,Yt=a.th,Kt=a.ul,xt=a.li,te=a.ol,ee=a.form,ne=a.label,se=a.select,oe=a.option,re=a.textarea,ie=a.img,ce=a.a,ae=a.p,le=a.h1,de=a.h2,he=a.h3,fe=a.h4,ue=a.h5,me=a.h6,pe=a.br,Ce=a.hr,Ee=a.pre,be=a.code,Se=a.nav,ye=a.header,ve=a.footer,we=a.main,Ae=a.aside,Re=a.article,Le=a.figure,ge=a.figcaption,je=a.blockquote,Oe=a.cite,Te=a.small,Ie=a.strong,ke=a.em,$e=a.b,We=a.i,He=a.u,Me=a.s,Pe=a.sub,_e=a.sup,Fe=a.mark,Be=a.del,Ve=a.ins,Je=a.details,Ne=a.summary,qe=a.progress,ze=a.meter,Ge=a.audio,De=a.video,Ue=a.canvas,Xe=a.slot,Ze=n=>t=>n(t).addClass(...t.classList??[]).addReactiveClass(t.reactiveClassList??{});r.BaseElement=O,r.a=ce,r.addAttributeList=lt,r.addClassList=it,r.addCustomAttributes=rt,r.addReactiveClassList=ct,r.addStyleList=at,r.appendContentItem=H,r.article=Re,r.aside=Ae,r.audio=Ge,r.b=$e,r.bindReactiveSignals=wt,r.blockquote=je,r.br=pe,r.button=Ut,r.camelToKebab=k,r.canvas=Ue,r.checkCall=P,r.checkRef=St,r.cite=Oe,r.classList=nt,r.cls=Wt,r.code=be,r.colorLog=$,r.combineLatest=Rt,r.component=N,r.configCustomComponent=Nt,r.createComponent=Ze,r.createCustom=ut,r.createCustomEl=ft,r.createCustomElement=ht,r.createEl=J,r.createElement=T,r.createSignal=vt,r.customElementHelpers=tt,r.defineSlotTemplate=Jt,r.del=Be,r.details=Je,r.disableLogs=X,r.div=qt,r.effect=b,r.elementHelpers=et,r.em=ke,r.enableLogs=bt,r.event=gt,r.eventEmitter=$t,r.figcaption=ge,r.figure=Le,r.footer=ve,r.forkJoin=At,r.form=ee,r.getList=Ht,r.getSignalContent=L,r.h1=le,r.h2=de,r.h3=he,r.h4=fe,r.h5=ue,r.h6=me,r.header=ye,r.hr=Ce,r.i=We,r.img=ie,r.initComponent=q,r.input=Dt,r.ins=Ve,r.isBaseElement=jt,r.isComponentConfig=j,r.isComponentInitConfig=S,r.isReactiveSignal=w,r.isSlotTemplate=Pt,r.kebabToCamel=U,r.label=ne,r.li=xt,r.main=we,r.mark=Fe,r.meter=ze,r.nav=Se,r.newEventEmitter=Vt,r.ol=te,r.option=oe,r.p=ae,r.pre=Ee,r.progress=qe,r.projectLog=p,r.property=Lt,r.removeEffect=F,r.renderIf=G,r.rs=yt,r.rxRenderIf=dt,r.s=Me,r.section=Gt,r.select=se,r.setChildren=ot,r.setEffects=st,r.setListeners=z,r.show=Bt,r.showIf=D,r.signal=R,r.signalComponent=Mt,r.slot=Xe,r.small=Te,r.span=zt,r.strong=Ie,r.sub=Pe,r.summary=Ne,r.sup=_e,r.table=Xt,r.td=Qt,r.textarea=re,r.th=Yt,r.tr=Zt,r.u=He,r.ul=Kt,r.unsafeHtml=_t,r.useCustomComponent=mt,r.video=De,r.when=Ft,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});