@reactive-web-components/rwc 2.61.4 → 2.61.7

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/main.d.ts CHANGED
@@ -1,14 +1,8 @@
1
1
  import { ComponentConfig } from './shared/types';
2
- import { BaseElement, ReactiveSignal } from './shared/utils';
2
+ import { BaseElement } from './shared/utils';
3
3
  export declare class TestComponent extends BaseElement {
4
- test: ReactiveSignal<number>;
4
+ test: import('./shared/utils').ReactiveSignal<number>;
5
5
  test1: void;
6
6
  connectedCallback(): void;
7
7
  render(): ComponentConfig<HTMLDivElement>;
8
8
  }
9
- export declare const debounce: <T>(fn: (...args: T[]) => void, delay: number) => {
10
- (...args: T[]): void;
11
- cancel(): void;
12
- };
13
- export declare function throttle<T extends unknown[]>(func: (...args: T) => void, delay: number): (...args: T) => void;
14
- export declare const ddList: <Item extends Record<string, any>>(items: ReactiveSignal<Item[]>, template: (item: Item, index: number, items: Item[]) => ComponentConfig<HTMLElement>) => ComponentConfig<HTMLDivElement>;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reactive-web-components/rwc",
3
- "version": "2.61.4",
3
+ "version": "2.61.7",
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.ClOi0z2y.js",
10
- "require": "./reactive-web-component.CDG_MV1y.umd.cjs"
9
+ "import": "./reactive-web-component.BOufSDNu.js",
10
+ "require": "./reactive-web-component.B1k6LJYO.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.ClOi0z2y.js",
38
- "main": "./reactive-web-component.CDG_MV1y.umd.cjs"
37
+ "module": "./reactive-web-component.BOufSDNu.js",
38
+ "main": "./reactive-web-component.B1k6LJYO.umd.cjs"
39
39
  }
@@ -0,0 +1,2 @@
1
+ (function(r,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(r=typeof globalThis<"u"?globalThis:r||self,A(r.ReactiveComponent={}))})(this,function(r){"use strict";var fn=Object.defineProperty;var hn=(r,A,_)=>A in r?fn(r,A,{enumerable:!0,configurable:!0,writable:!0,value:_}):r[A]=_;var u=(r,A,_)=>hn(r,typeof A!="symbol"?A+"":A,_);const A=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(t=>t.startsWith(".")||t.startsWith("@")||t.startsWith("$")))&&!("hostElement"in e),_=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,D=(e,t,...n)=>{t&&t.apply(e,n)};let G=!0;const S=(...e)=>{G&&console.debug(["[rwc]",...e].join(" | "),...Array.from(e.join("").matchAll(/%c/gm)).map((t,n)=>n%2===0?"color:red":"color:inherit"))},B=e=>e.replace(/([A-Z])/gm,t=>`-${t.toLowerCase()}`),ot=e=>e.replace(/-(\w)/gm,(t,n)=>n.toUpperCase()),F=(e,...t)=>{if(!G)return;const n={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=e.match(/@[rgbpycow]/g)||[],o=s.map(c=>{const a=c.slice(1);return n[a]||"color: inherit"});let i=e;s.forEach(c=>{const a=new RegExp(`\\${c}([^\\s,]+)`,"g");i=i.replace(a,"%c$1")}),console.log(i,...o,...t)},jt=()=>{G=!0},rt=()=>{G=!1};rt();const Ot=(e,t)=>{e.every(Boolean)&&t(e)},N=new Set;let K=!1;const it=()=>{if(K=!1,N.size===0)return;const e=Array.from(N);N.clear(),e.forEach(t=>{t.status==="active"&&(Y(t),O.push(t),t(),O.pop())}),N.size>0&&(K=!0,Promise.resolve().then(it))},Mt=e=>{N.add(e),K||(K=!0,Promise.resolve().then(it))},O=[],Y=e=>{var t,n,s,o;(t=e.children)==null||t.forEach(i=>{var c;return(c=i.destroy)==null?void 0:c.call(i)}),(n=e.children)==null||n.clear(),(s=e.cleanupSet)==null||s.forEach(i=>i()),(o=e.cleanupSet)==null||o.clear()};function T(e,t){let n=(t==null?void 0:t.signalCompareFn)||(()=>!0);const s=new Set;function o(){var c;const i=O[O.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),e}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 n=i,o},o.clearSubscribers=function(){s.clear()},o.getSubscribers=function(){return s},o.peek=function(){return Object.freeze(e)},o.initValue=Object.freeze(e),o.forceSet=function(i){e=i,s.forEach(c=>{Mt(c)})},o.set=function(i,c=n){e!==i&&c(e,i)&&o.forceSet(i)},o.update=function(i){o.set(i(e))},o.pipe=(i,c)=>{c!=null&&c.name&&o.setName(c.name);const a=T(null);return v(()=>{const d=o();v(()=>{const h=i(d);h instanceof Promise?h.then(E=>a.set(E)):R(h)?v(()=>a.set(h()),{name:"pipe_effect_inner"}):a.set(h)},{name:"pipe_effect"})},{name:(c==null?void 0:c.name)||`pipe_${o.signalId}`}),a},o}function v(e,t){var i;const n=`${(t==null?void 0:t.name)||""}_${Math.random().toString(36).substring(2,15)}`;S("current effect",`%c${n}%c`);const s=e;s.status="active",s.children=new Set,s.effectId=n;const o=O[O.length-1];o&&((i=o.children)==null||i.add(s),s.parent=new WeakRef(o),s.destroy=()=>{var c;Y(s),(c=o.children)==null||c.delete(s),s.destroy=void 0,s.status="inactive"}),s.cleanupSet=new Set,O.push(s),s(),O.pop()}const R=e=>!!e&&["object","function"].includes(typeof e)&&"set"in e&&"update"in e&&"forceSet"in e&&"signalId"in e;function $t(e,...t){const n=T("");return v(()=>{const s=t.map(i=>R(i)?String(i()):String(i)),o=[e[0]];s.forEach((i,c)=>{o.push(i,e[c+1])}),n.set(o.join(""))}),n}function _t(e,t){const n=T(t??null),s=o=>n.set(o);return e instanceof Promise?e.then(s):typeof e=="function"&&v(()=>{const o=e();o instanceof Promise?o.then(s):R(o)?v(()=>s(o())):s(o)}),n}function Ht(e,t){let n=e(),s=t();v(()=>{const o=e(),i=t();o!==i&&(o!==n?t.set(o):i!==s&&e.set(i)),n=o,s=i})}function Wt(...e){let t=e.map(s=>s());const n=T(t);return e.forEach((s,o)=>{v(()=>{const i=()=>t.filter(c=>c!==void 0).length;i()===e.length&&(t=Array.from(t).fill(void 0)),t[o]=s(),i()===e.length&&n.set([...t])})}),n}const kt=(...e)=>{const t=T([]);return v(()=>{t.set(e.map(n=>n()))}),t},Z="eventProps",U="EVENT_CONFIG",V="observedAttributes",Pt=()=>(e,t)=>{Reflect.get(e,V)||Reflect.defineProperty(e,V,{value:[]}),Reflect.get(e,V).push(B(t))},Bt=e=>(t,n)=>{Reflect.get(t,Z)||Reflect.defineProperty(t,Z,{value:[]}),Reflect.get(t,U)||Reflect.defineProperty(t,U,{value:{}}),Reflect.get(t,U)[n]={bubbles:(e==null?void 0:e.bubbles)??!1,composed:(e==null?void 0:e.composed)??!1},Reflect.get(t,Z).push(n)},x=(e,t=!1)=>n=>{S(e,"start register static attr",n.prototype[V]);const s=[];if(n.styles){const i=n.styles,c=[];Array.isArray(i)?c.push(...i):c.push(i),c.forEach(a=>{const d=new CSSStyleSheet;d.replaceSync(a),s.push(d);const b=new CSSStyleSheet;b.replaceSync(a.slice(a.indexOf("@property"))),document.adoptedStyleSheets.push(b)})}class o extends n{constructor(...c){S("constructor",`%c${e}%c`),super(t,...c),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){return S("rwc: render from new class"),n.prototype.render.call(this)}attributeChangedCallback(c,a,d){S("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${a}, newValue: ${d}`,`%c${e}%c`);try{d=JSON.parse(d)}catch{}const b=ot(c);if(b in this&&R(this[b])){const h=this[b];h.setName(c),d===null?(h.set(h.initValue),this.removeAttribute(c)):h.set(d)}D(this,n.prototype.attributeChangedCallback,c,a,d)}connectedCallback(){const c=()=>{var d,b;S("rwc: connectedCallback"),S("connectedCallback",`%c${e}%c`,this),(d=this.init)==null||d.call(this),this.providers&&Object.keys(this.providers).length>0&&(S("WRAPPER for providers",e),Object.entries(this.providers).forEach(([h,f])=>{S("register provider",h,f()),this.addEventListener(h,E=>{var m;S("send provider",h,f());const p=E;((m=p.detail)==null?void 0:m.context)===h&&(p.stopPropagation(),p.detail.callback(f))})})),this.checkInjects(),(b=n.prototype[Z])==null||b.forEach(h=>{this[h]=f=>{const E=n.prototype[U][h],{bubbles:p,composed:m}=E;R(f)?v(()=>{F("@oemit reactive value",f()),this.dispatchEvent(new CustomEvent(h,{detail:f(),bubbles:p,composed:m}))}):(F("@oemit value",f),this.dispatchEvent(new CustomEvent(h,{detail:f,bubbles:p,composed:m})))}}),S("start render",`%c${e}%c`,e);const a=()=>{S("rwc: insertRenderTemplate");const f=this.render().hostElement;f&&this.shadow.appendChild(f),D(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const h=p=>p instanceof Promise||Array.isArray(p)&&p.every(m=>m instanceof Promise),f=this.rootStyle,E=p=>{const m=new CSSStyleSheet;m.replaceSync(p),this.shadow.adoptedStyleSheets.push(m);const w=new CSSStyleSheet;w.replaceSync(p.slice(p.indexOf("@property"))),document.adoptedStyleSheets.push(w)};if(h(f)){const p=[];Array.isArray(f)?p.push(...f):p.push(f),Promise.all(p).then(m=>m.forEach(w=>E(w.default))).then(()=>a())}else{const p=[];Array.isArray(f)?p.push(...f):p.push(f),p.forEach(m=>E(m)),a()}}else a();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(h=>{S(this.slotContext,this.slotContext&&this.slotContext[h.name]),F("@bslot element",h,`name:${h.name};`,h.assignedElements()),h.assignedElements().forEach(f=>{const E=this.slotContext[h.name];this.slotContext&&R(E)&&(F("@oslot element",h,`name:${h.name};`,h.assignedElements()),v(()=>{f.dispatchEvent(new CustomEvent("handleSlotContext",{detail:E()}))}))})})};c.fake=!0,c.component=new WeakRef(this),this.effectSet.add(new WeakRef(c)),v(c,{name:"FAKE_wrapperEffect"})}disconnectedCallback(){this.allSlotContent=[],this.slotContent={},this.htmlSlotContent={},this.effectSet.forEach(c=>{var a,d;return(d=(a=c.deref())==null?void 0:a.destroy)==null?void 0:d.call(a)}),this.effectSet.clear(),this.shadow.replaceChildren(),this.replaceChildren(),D(this,n.prototype.disconnectedCallback)}}return u(o,"observedAttributes",n.prototype[V]??[]),u(o,"renderTagName",e),o.toString=()=>e,customElements.get(e)?console.error(`название тега ${e} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(e,o),n.renderTagName=e,n};class H extends HTMLElement{constructor(n=!1){super();u(this,"init");u(this,"isSlotLazyLoading",!1);u(this,"slotTemplate");u(this,"slotContext");u(this,"rootStyle");u(this,"modelValue");u(this,"providers");u(this,"effectSet",new Set);u(this,"appendAllSlotContent");u(this,"allSlotContent",[]);u(this,"slotContent",{});u(this,"htmlSlotContent",{});u(this,"shadow");u(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var o;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const i=n.slot||"default";this.htmlSlotContent[i]||(this.htmlSlotContent[i]=[]),(o=this.htmlSlotContent[i])==null||o.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return S("%cinject%c",n),this.injects[n]||(this.injects[n]=T(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{S("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:o=>v(()=>{s.set(o())},{name:n})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}u(H,"observedAttributes",[]),u(H,"renderTagName",""),u(H,"styles");const Ft=e=>"render"in e&&"setReactiveValue"in e,Nt="handleSlotContext",ct="onConnected",lt=e=>typeof e=="string"?e:JSON.stringify(e),Vt=e=>{const t=document.createElement("span");return t.textContent=lt(e),t},at=(e,t)=>(e.appendChild(Vt(t)),e),Jt=(e,t)=>(e.replaceChildren(),at(e,t)),dt=e=>{const t=document.createElement("span");return v(()=>{const n=e();t.textContent=lt(n)}),t};class ft{constructor(t){u(this,"wrapper");u(this,"keyedEffects",new Map);u(this,"append",(...t)=>(t.forEach(n=>{var o;const s=n.hostElement;s&&((o=this.hostElement)==null||o.appendChild(s),ct in s&&setTimeout(()=>{var i;(i=s.onConnected)==null||i.call(s,n,s)}))}),this));u(this,"set",(...t)=>{var s;this.clear();const n=document.createDocumentFragment();return t.forEach(o=>{const i=o.hostElement;i&&n.appendChild(i)}),(s=this.hostElement)==null||s.appendChild(n),this});u(this,"removeChild",(...t)=>(t.forEach(n=>{var s,o;if(Array.from(((s=this.hostElement)==null?void 0:s.childNodes.values())||[]).some(i=>i===n.hostElement)){const i=n.hostElement;i&&((o=this.hostElement)==null||o.removeChild(i))}}),this));u(this,"addHtmlContent",t=>{const n=this.hostElement;return n?(at(n,t),this):this});u(this,"setHtmlContent",t=>{const n=this.hostElement;return n?(Jt(n,t),this):this});u(this,"setAttribute",(t,n)=>{var i;const s=this.hostElement;if(!s)return this;let o;if(typeof n=="boolean"&&!(s instanceof H))if(n)o="";else{this.removeAttribute(t);const c=t.toLowerCase();return c in s&&(s[c]=null),this}else typeof n!="string"?o=JSON.stringify(n):o=n;if((i=this.hostElement)==null||i.setAttribute(B(t),o),!(s instanceof H)){const c=t.toLowerCase();c in s&&(s[c]=n)}return this});u(this,"setCustomAttribute",(t,n)=>{var o;let s;return typeof n!="string"?s=JSON.stringify(n):s=n,(o=this.hostElement)==null||o.setAttribute(B(t),s),this});u(this,"setReactiveAttribute",(t,n)=>(this.addEffect(s=>{s.setAttribute(t,n())},t),this));u(this,"setReactiveCustomAttribute",(t,n)=>(this.addEffect(s=>{s.setCustomAttribute(t,n())}),this));u(this,"removeAttribute",t=>{var n;return(n=this.hostElement)==null||n.removeAttribute(B(t)),this});u(this,"addStyle",t=>{const n=this.hostElement;return n?(Object.entries(t).forEach(([s,o])=>{const i=s.startsWith("--");typeof o=="function"?this.addEffect(()=>{if(i){const c=String(o()||"");n.style.setProperty(s,c)}else n.style[s]=o()}):typeof o=="string"&&(i?n.style.setProperty(s,o):n.style[s]=o)}),this):this});u(this,"onConnected",t=>this.hostElement?(Reflect.defineProperty(this.hostElement,ct,{get(){return t}}),this):this);u(this,"addClass",(...t)=>(t.forEach(n=>{var s;typeof n=="string"?(s=this.hostElement)==null||s.classList.add(...n.split(" ").flatMap(o=>o.split(`
2
+ `)).map(o=>o.trim()).filter(Boolean)):(()=>{let o=null;this.addEffect(()=>{const i=n();i.length>0&&(o?this.replaceClass(o,i):this.addClass(i),o=i)})})()}),this));u(this,"setClass",(...t)=>{var n,s,o;return(s=this.hostElement)==null||s.classList.remove(...((n=this.hostElement)==null?void 0:n.classList)||[]),(o=this.hostElement)==null||o.classList.add(...t),this});u(this,"addReactiveClass",t=>(Object.keys(t).forEach(n=>{this.addEffect(s=>{t[n]()?s.addClass(n):s.removeClass(n)})}),this));u(this,"removeClass",(...t)=>{var n;return(n=this.hostElement)==null||n.classList.remove(...t),this});u(this,"replaceClass",(t,n)=>{var s;return(s=this.hostElement)==null||s.classList.replace(t,n),this});u(this,"addEffect",(t,n)=>{var i,c;const s=this.hostElement;if(!s)return this;const o=()=>t(this,s);if(n){const a=(i=this.keyedEffects.get(n))==null?void 0:i.deref();a&&Y(a)}return(c=s.effectSet)==null||c.add(new WeakRef(o)),o.component=this.wrapper,v(o,{name:(n==null?void 0:n.toString())||s.tagName}),this});u(this,"addReactiveContent",t=>{var n;return(n=this.hostElement)==null||n.appendChild(dt(t)),this});u(this,"setReactiveContent",t=>{var n;return this.clear(),(n=this.hostElement)==null||n.appendChild(dt(t)),this});u(this,"clear",()=>{var t;return(t=this.hostElement)==null||t.replaceChildren(),this});this.wrapper=t;const n=t.deref();n&&(n.effectSet=new Set)}get hostElement(){return this.wrapper.deref()}addEventlistener(t,n,s=!1){var o;return(o=this.hostElement)==null||o.addEventListener(t,i=>n(i,this,this.hostElement),s),this}}class qt extends ft{constructor(){super(...arguments);u(this,"setReactiveValue",n=>(this.hostElement instanceof H&&this.hostElement.setReactiveValue(n),this));u(this,"setSlotTemplate",n=>{var o;const s=(o=this.hostElement)==null?void 0:o.slotTemplate;return s&&Object.entries(n).forEach(([i,c])=>{s[i]=c}),this})}}const zt=()=>()=>{},ht=e=>new qt(new WeakRef(e)),ut=e=>new ft(new WeakRef(e)),mt=(e,...t)=>({classList:[...e.map(n=>n.trim()).filter(Boolean),...t]}),Dt=(e,...t)=>mt(e,...t),tt=(e,t)=>{if(!t||!e.deref())return;const n=Object.keys(t||{}).filter(o=>o.startsWith(".")||o.startsWith("@")||o.startsWith("$"));n.filter(o=>o.startsWith(".")).forEach(o=>{t!=null&&t.attributes||(t.attributes={}),t.attributes[o.slice(1)]=t[o]}),n.filter(o=>o.startsWith("@")).forEach(o=>{t!=null&&t.listeners||(t.listeners={});const i=o.slice(1);t.listeners[i]=t[o]}),n.filter(o=>o.startsWith("$")).forEach(o=>{t!=null&&t.effects||(t.effects=[]),t.effects.push(t[o])});const s=e.deref();if(s)return bt(s,t.classList),yt(s,t.style),vt(s,t.attributes),St(s,t.reactiveClassList),Ct(s,t.customAttributes),Et(s,t.children),pt(s,t.effects),et(s,t.listeners),et(s,t.customListeners),s},et=(e,t)=>{t&&Object.entries(t).forEach(([n,s])=>{typeof s=="function"&&e.addEventlistener(n,s)})},pt=(e,t)=>t==null?void 0:t.forEach(n=>e.addEffect(n)),Et=(e,t)=>J(new WeakRef(e),...t||[])??e,Ct=(e,t)=>{const n=t;n&&Object.keys(n).forEach(s=>{R(n[s])?e.setReactiveCustomAttribute(s,n[s]):typeof n[s]=="function"?e.addEffect(()=>{e.setCustomAttribute(s,n[s]())}):e.setCustomAttribute(s,n[s])})},bt=(e,t)=>e.addClass(...t||[]),St=(e,t)=>e.addReactiveClass(t||{}),yt=(e,t)=>e.addStyle(t||{}),vt=(e,t)=>{const n=t,s=(o,i)=>{i&&(R(i)?e.setReactiveAttribute(o,i):typeof i=="function"?e.addEffect(()=>{e.setAttribute(o,i())}):e.setAttribute(o,i))};n&&Object.keys(n).forEach(o=>{s(o,n[o])})},J=(e,...t)=>{const n=e.deref();if(n)return t.forEach(s=>{typeof s=="string"?s.trim().length>0&&n.addHtmlContent(s):R(s)?n.addReactiveContent(s):n.append(s)}),n},W=(e,t)=>{const n=document.createElement(e),s=ut(n);return tt(new WeakRef(s),t)??s},X=(e,t)=>{const[n,...s]=e.split(" ").map(i=>i.trim()),o=W(n,t);return s.length>0&&o.addClass(...s),(...i)=>J(new WeakRef(o),...i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!R(c)?j(()=>c(o)):c))??o},j=e=>{const t=`getSignalContent_${Math.random().toString(36).substring(2,15)}`;return W("div").addStyle({display:"contents"}).addEffect(n=>{n.clear(),J(new WeakRef(n),...[e()].flat())},t)},Gt=(e,t,n)=>{const s=W("div").addStyle({display:"contents"}),o=new Map,i=new Map,c=new Map,a=new Map;let d=[];const b=new Set;let h=e.peek();const f=m=>{b.delete(m),o.delete(m),i.delete(m),c.delete(m),a.delete(m)},E=m=>{if(!a.has(m)){const w=d.indexOf(m);return a.set(m,w),w}return a.get(m)},p=(m,w,q)=>Array.from(q.children).indexOf(m)!==w;return v(()=>{const m=e(),w=m.map(t).map(C=>typeof C=="string"?C:C.toString()),q=new Set(w);a.clear(),w.forEach((C,y)=>{a.set(C,y)}),d=w;const M=s.hostElement;if(!M)return;S("containerChildren",Array.from(M.children),d);const z=[];Array.from(M.children).forEach(C=>{const y=C.dataset.key;y&&!q.has(y)&&z.push(C)}),z.forEach(C=>{const y=C.dataset.key;S("remove element",y,C),C.remove(),f(y)}),w.forEach((C,y)=>{var g;const L=m[y],P=h[y];if(!o.has(C))S("create new element",C,L),o.set(C,T(Math.random().toString(36).substring(2,15))),i.set(C,()=>n(L,y,m).setCustomAttribute("data-key",C));else if(P&&JSON.stringify(L)!==JSON.stringify(P)){const I=c.get(C);(g=o.get(C))==null||g.set(Math.random().toString(36).substring(2,15)),i.set(C,()=>n(L,y,m).setCustomAttribute("data-key",C)),I&&I.parentNode&&S("mark element for update",C)}}),h=[...m.map(C=>({...C}))];const Q=()=>{o.forEach((C,y)=>{S("key from setTimeout foreach currItemSignalMap",y),b.has(y)||(b.add(y),v(()=>{var Tt;C();const L=E(y),P=(Tt=i.get(y))==null?void 0:Tt();if(!P||!P.hostElement)return;const g=s.hostElement,I=P.hostElement;if(!g)return;S("call effect from setTimeout",y,I);const $=c.get(y);if($&&$.parentNode===g){if(p($,L,g)){const k=g.children[L];k&&k!==$?g.insertBefore($,k):k||g.appendChild($)}I!==$&&($.replaceWith(I),c.set(y,I))}else if(c.set(y,I),L<g.children.length){const k=g.children[L];k?g.insertBefore(I,k):g.appendChild(I)}else g.appendChild(I)}))})};Promise.resolve().then(()=>Q())}),s},Kt=e=>{let t=[W("div")],n=!1;return v(()=>{var i,c;const s=e();n=Array.isArray(s);const o=[];o.push(...[s].flat()),o.length===0&&o.push(W("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{S("newReactiveComponent.map",o.map(a=>{var d;return S("newReactiveComponent hostElement",a.hostElement),(d=a.hostElement)==null?void 0:d.id})),S("currComponent[0].hostElement?.id",(i=t[0].hostElement)==null?void 0:i.id,t),(c=t[0].hostElement)==null||c.replaceWith(...o.map(a=>a.hostElement).filter(Boolean)),t.slice(1).forEach(a=>{var d;return(d=a.hostElement)==null?void 0:d.remove()}),t=o}catch(a){console.error(a)}}),n?t:t[0]},Yt=e=>Nt in e,Zt=e=>{const t=X("div")().addStyle({display:"contents"}),n=s=>{const o=t.hostElement;return o&&(o.innerHTML=s),t};return typeof e=="string"?n(e):t.addEffect(()=>{n(e())}),t},nt=(e,t,n)=>e?j(t):n?j(n):X("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),wt=(e,t,n)=>j(()=>nt(!!e(),t,n)),Ut=(e,t,n)=>typeof e=="boolean"?nt(e,t,n):wt(e,t,n),st=(e,t)=>j(t).addEffect((n,s)=>{if(typeof e=="boolean")s.style.display=e?"block":"none";else{const o=e()?"block":"none";s.style.display=o}}),Xt=(e,t,n)=>{const s=[st(e,t)].flat();return n&&s.push(...[st(()=>typeof e=="boolean"?!e:!e(),n)].flat()),j(()=>s)},At=(e,t)=>{S("createCustomElement",e);const n=document.createElement(e),s=ht(n);return n.init=()=>{tt(new WeakRef(s),t)},s},gt=(e,t)=>{const n=e.split(" ").slice(1).map(o=>o.trim()),s=At(e.split(" ")[0],t);return Array.isArray(n)&&n.length>0&&s.addClass(...n),(...o)=>{const i=o.filter(Boolean).flat().flatMap(a=>typeof a=="function"&&!R(a)?j(()=>a(s)):a),c=s.hostElement;return c&&(c.allSlotContent=i,c.slotContent=i.filter(_).reduce((a,d)=>{var h;const b=((h=d.hostElement)==null?void 0:h.getAttribute("slot"))||"default";return a[b]||(a[b]=[]),a[b].push(d),a},{}),c.appendAllSlotContent=()=>{J(new WeakRef(s),...i)}),s}},Rt=(e,t,n)=>gt(`${e.renderTagName}${t&&typeof t=="string"?" "+t:""}`,A(t)?t:t&&typeof t=="string"?n:void 0),Qt=()=>{const e=()=>{};return e.oldValue=null,e},xt=()=>({}),Lt=(e,t,n)=>{const s=t?x(t,n)(e):e;return(o,...i)=>{const c=[...i];return o&&!A(o)&&c.unshift(o),Rt(s,A(o)?o:{})(...c)}},te=e=>[Lt(e),(t,n)=>{x(t,n)(e)}],l={};["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(e=>{l[e]=(t,...n)=>{let s=[...n];return t&&!A(t)&&(s=[t].concat(s)),X(e,A(t)?t:{})(...s)}});const It=l.div,ee=l.span,ne=l.section,se=l.input,oe=l.button,re=l.table,ie=l.tr,ce=l.td,le=l.th,ae=l.ul,de=l.li,fe=l.ol,he=l.form,ue=l.label,me=l.select,pe=l.option,Ee=l.textarea,Ce=l.img,be=l.a,Se=l.p,ye=l.h1,ve=l.h2,we=l.h3,Ae=l.h4,ge=l.h5,Re=l.h6,Le=l.br,Ie=l.hr,Te=l.pre,je=l.code,Oe=l.nav,Me=l.header,$e=l.footer,_e=l.main,He=l.aside,We=l.article,ke=l.figure,Pe=l.figcaption,Be=l.blockquote,Fe=l.cite,Ne=l.small,Ve=l.strong,Je=l.em,qe=l.b,ze=l.i,De=l.u,Ge=l.s,Ke=l.sub,Ye=l.sup,Ze=l.mark,Ue=l.del,Xe=l.ins,Qe=l.details,xe=l.summary,tn=l.progress,en=l.meter,nn=l.audio,sn=l.video,on=l.canvas,rn=l.slot,cn=e=>t=>e(t).addClass(...t.classList??[]).addReactiveClass(t.reactiveClassList??{});function ln(e,t){let n=0;return(...s)=>{const o=Date.now();o-n>=t&&(e(...s),n=o)}}const an=(e,t)=>j(()=>{const n=e();let s=null;return n.map((o,i)=>It({"@dragstart":(c,a,d)=>{s=d},"@dragend":(c,a,d)=>{d.style.transform="",d.removeAttribute("draggable")},"@mousedown":(c,a,d)=>{d.style.transform="translateZ(0)",d.setAttribute("draggable","true")},"@dragover":c=>{c.preventDefault()},"@dragenter":ln((c,a,d)=>{var b,h,f;if(c.preventDefault(),s){let E=s,p=d;const m=((b=s.getClientRects().item(0))==null?void 0:b.y)??0,w=((h=d.getClientRects().item(0))==null?void 0:h.y)??0;m<w&&([E,p]=[d,s]),(f=d.parentElement)==null||f.insertBefore(E,p)}},200)},t(o,i,[...e.peek()])))}),dn=(e,t,n)=>{let s=[],o=[];const i=W("div").addStyle({display:"contents"}),c=new Map,a=new Map;return v(()=>{const d=e(),b=d.map(t);o.filter(f=>!b.includes(f)).forEach(f=>{var E,p;c.delete(f),(p=(E=i.hostElement)==null?void 0:E.querySelector(`[data-key="${f}"]`))==null||p.remove()}),b.forEach((f,E)=>{o.includes(f)||c.set(f,()=>n(d[E],E,d).setCustomAttribute("data-key",f))}),b.forEach((f,E)=>{var p;if(o.includes(f)){JSON.stringify(s[o.indexOf(f)])!==JSON.stringify(d[E])&&((p=a.get(f))==null||p.set({templateFunc:()=>n(d[E],E,d),items:d,itemsKey:b,index:E}));return}a.set(f,T({templateFunc:()=>n(d[E],E,d),items:d,itemsKey:b,index:E})),queueMicrotask(()=>{v(()=>{var z,Q,C;const{templateFunc:m,index:w}=((z=a.get(f))==null?void 0:z())??{},q=(Q=i.hostElement)==null?void 0:Q.querySelector(`[data-key="${f}"]`),M=(m==null?void 0:m().setCustomAttribute("data-key",f).hostElement)??document.createElement("div");q?(C=i.hostElement)==null||C.childNodes.forEach((y,L)=>{y instanceof HTMLElement&&y.getAttribute("data-key")===f&&(w===L?(h(w??0,i.hostElement,M),y.remove()):h(w??0,i.hostElement,M))}):h(w??0,i.hostElement,M)})})});const h=(f,E,p)=>{p&&E&&(f<E.children.length?E.insertBefore(p,E.children[f]):E.appendChild(p))};o=b,s=[...d]}),i};r.BaseElement=H,r.a=be,r.addAttributeList=vt,r.addClassList=bt,r.addCustomAttributes=Ct,r.addReactiveClassList=St,r.addStyleList=yt,r.appendContentItem=J,r.article=We,r.aside=He,r.audio=nn,r.b=qe,r.bindReactiveSignals=Ht,r.blockquote=Be,r.br=Le,r.button=oe,r.camelToKebab=B,r.canvas=on,r.checkCall=D,r.checkRef=Ot,r.cite=Fe,r.classList=mt,r.cls=Dt,r.code=je,r.colorLog=F,r.combineLatest=kt,r.component=x,r.configCustomComponent=te,r.createComponent=cn,r.createCustom=Rt,r.createCustomEl=gt,r.createCustomElement=At,r.createEl=X,r.createElement=W,r.createSignal=_t,r.customElementHelpers=ht,r.ddList=an,r.defineSlotTemplate=xt,r.del=Ue,r.details=Qe,r.disableLogs=rt,r.div=It,r.effect=v,r.elementHelpers=ut,r.em=Je,r.enableLogs=jt,r.event=Bt,r.eventEmitter=zt,r.figcaption=Pe,r.figure=ke,r.footer=$e,r.forkJoin=Wt,r.form=he,r.getList=dn,r.getSignalContent=j,r.h1=ye,r.h2=ve,r.h3=we,r.h4=Ae,r.h5=ge,r.h6=Re,r.header=Me,r.hr=Ie,r.i=ze,r.img=Ce,r.initComponent=tt,r.input=se,r.ins=Xe,r.isBaseElement=Ft,r.isComponentConfig=_,r.isComponentInitConfig=A,r.isReactiveSignal=R,r.isSlotTemplate=Yt,r.kebabToCamel=ot,r.label=ue,r.li=de,r.main=_e,r.mark=Ze,r.meter=en,r.nav=Oe,r.newEventEmitter=Qt,r.ol=fe,r.oldGetList=Gt,r.option=pe,r.p=Se,r.pre=Te,r.progress=tn,r.projectLog=S,r.property=Pt,r.removeEffect=Y,r.renderIf=nt,r.rs=$t,r.rxRenderIf=wt,r.s=Ge,r.section=ne,r.select=me,r.setChildren=Et,r.setEffects=pt,r.setListeners=et,r.show=Xt,r.showIf=st,r.signal=T,r.signalComponent=Kt,r.slot=rn,r.small=Ne,r.span=ee,r.strong=Ve,r.sub=Ke,r.summary=xe,r.sup=Ye,r.table=re,r.td=ce,r.textarea=Ee,r.th=le,r.tr=ie,r.u=De,r.ul=ae,r.unsafeHtml=Zt,r.useCustomComponent=Lt,r.video=sn,r.when=Ut,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});