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