@reactive-web-components/rwc 2.53.3 → 2.54.0
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 +0 -26
- package/package.json +5 -5
- package/reactive-web-component.BDKz51Vi.umd.cjs +2 -0
- package/{reactive-web-component.jn8CKMFG.js → reactive-web-component.T3Qg0HMS.js} +283 -275
- package/shared/utils/signal/signal.d.ts +9 -2
- package/shared/utils/signal/signal.type.d.ts +3 -1
- package/shared/utils/signal/utils.d.ts +1 -0
- package/reactive-web-component.B4djMSlX.umd.cjs +0 -2
package/main.d.ts
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CompFuncContent, ComponentConfig } from './shared/types';
|
|
2
|
-
import { ReactiveSignal } from './shared/utils';
|
|
3
|
-
export declare function newrenderIf<Content extends CompFuncContent, ElseContent extends CompFuncContent>(condition: boolean, content: Content, elseContent: ElseContent): ReturnType<Content> | ReturnType<ElseContent>;
|
|
4
|
-
export declare function newrenderIf<Content extends CompFuncContent>(condition: boolean, content: Content): ReturnType<Content> | ComponentConfig<HTMLDivElement>;
|
|
5
|
-
export declare function newrxRenderIf<Content extends CompFuncContent, ElseContent extends CompFuncContent>(condition: ReactiveSignal<any> | (() => boolean), content: Content, elseContent: ElseContent): ReturnType<Content> | ReturnType<ElseContent>;
|
|
6
|
-
export declare function newrxRenderIf<Content extends CompFuncContent>(condition: ReactiveSignal<any> | (() => boolean), content: Content): ReturnType<Content> | ComponentConfig<HTMLDivElement>;
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
export const renderIf = (
|
|
10
|
-
condition: boolean,
|
|
11
|
-
content: CompFuncContent,
|
|
12
|
-
elseContent?: CompFuncContent,
|
|
13
|
-
) =>
|
|
14
|
-
condition
|
|
15
|
-
? getSignalContent(content)
|
|
16
|
-
: elseContent
|
|
17
|
-
? getSignalContent(elseContent)
|
|
18
|
-
: createEl('div')().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" });
|
|
19
|
-
|
|
20
|
-
export const rxRenderIf = (
|
|
21
|
-
condition: ReactiveSignal<any> | (() => boolean),
|
|
22
|
-
content: CompFuncContent,
|
|
23
|
-
elseContent?: CompFuncContent,
|
|
24
|
-
) =>
|
|
25
|
-
getSignalContent(() => renderIf(Boolean(condition()), content, elseContent));
|
|
26
|
-
*/
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactive-web-components/rwc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.54.0",
|
|
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.
|
|
10
|
-
"require": "./reactive-web-component.
|
|
9
|
+
"import": "./reactive-web-component.T3Qg0HMS.js",
|
|
10
|
+
"require": "./reactive-web-component.BDKz51Vi.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.
|
|
38
|
-
"main": "./reactive-web-component.
|
|
37
|
+
"module": "./reactive-web-component.T3Qg0HMS.js",
|
|
38
|
+
"main": "./reactive-web-component.BDKz51Vi.umd.cjs"
|
|
39
39
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o.ReactiveComponent={}))})(this,function(o){"use strict";var Ne=Object.defineProperty;var Ve=(o,p,L)=>p in o?Ne(o,p,{enumerable:!0,configurable:!0,writable:!0,value:L}):o[p]=L;var E=(o,p,L)=>Ve(o,typeof p!="symbol"?p+"":p,L);const p=t=>t&&typeof t=="object"&&("classList"in t||"attributes"in t||"customAttributes"in t||"reactiveClassList"in t||"listeners"in t||"customListeners"in t||"children"in t||"effects"in t||"style"in t||Object.keys(t).some(e=>e.startsWith(".")||e.startsWith("@")||e.startsWith("$")))&&!("hostElement"in t),L=t=>t&&typeof t=="object"&&"hostElement"in t&&"append"in t&&"set"in t&&"addStyle"in t&&"setAttribute"in t&&"addClass"in t&&"addEffect"in t&&"addReactiveContent"in t&&"setReactiveContent"in t&&"clear"in t,W=(t,e,...n)=>{e&&e.apply(t,n)};let _=!0;const f=(...t)=>{_&&console.debug(["[rwc]",...t].join(" | "),...Array.from(t.join("").matchAll(/%c/gm)).map((e,n)=>n%2===0?"color:red":"color:inherit"))},I=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),Y=t=>t.replace(/-(\w)/gm,(e,n)=>n.toUpperCase()),R=(t,...e)=>{if(!_)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=t.match(/@[rgbpycow]/g)||[],i=s.map(c=>{const d=c.slice(1);return n[d]||"color: inherit"});let l=t;s.forEach(c=>{const d=new RegExp(`\\${c}([^\\s,]+)`,"g");l=l.replace(d,"%c$1")}),console.log(l,...i,...e)},pt=()=>{_=!0},K=()=>{_=!1};K();const G=new Map,O=new WeakMap,B=[],w=[];function A(t,e){const n=new Set;let s=(e==null?void 0:e.signalCompareFn)||(()=>!0);function i(){var c;const l=B[B.length-1];if(l&&!("fake"in l&&l.fake)){const d=O.get(l),a=d==null?void 0:d.parent;if(a){const h=O.get(a);h==null||h.cleanupFns.add(()=>{n.delete(l)})}n.add(l),(c=G.get(l.effectId))==null||c.signals.push(i)}return t}return i.signalId=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`,i.getSubscribers=()=>[...n],i.setCompareFn=function(l){return s=l,i},i.clearSubscribers=function(){n.clear()},i.peek=function(){return Object.freeze(t)},i.initValue=Object.freeze(t),i.oldValue=Object.freeze(t),i.forceSet=function(l){i.oldValue=Object.freeze(t),t=l,n.forEach(c=>Promise.resolve(c).then(d=>{const a=O.get(d);a&&a.cleanupFns.size>0&&(a.cleanupFns.forEach(h=>h()),a.cleanupFns.clear()),w.push(d),d(),w.pop()}))},i.set=function(l,c=s){t!==l&&c(t,l)&&i.forceSet(l)},i.update=function(l){i.set(l(t))},i.pipe=(l,c)=>{const d=A(null);return b(()=>{const a=i();b(()=>{const h=l(a);h instanceof Promise?h.then(m=>d.set(m)):v(h)?b(()=>d.set(h())):d.set(h)},c)}),d},i}function b(t,e){const n=`${(e==null?void 0:e.name)||""}_${Math.random().toString(36).substring(2,15)}`;f("current effect",`%c${n}%c`);const s=t;t=()=>(f("current effect callback",`%c${n}%c`),s()),"fake"in s&&s.fake&&(t.fake=!0),t.effectId=n;const i=w[w.length-1];G.set(n,{signals:[],parent:(i==null?void 0:i.effectId)||null}),O.has(t)||O.set(t,{cleanupFns:new Set});const l=O.get(t);i?l.parent=i:delete l.parent,w.push(t),B.push(t),t(),B.pop(),w.pop()}const v=t=>!!t&&["object","function"].includes(typeof t)&&"set"in t&&"oldValue"in t&&"update"in t&&"forceSet"in t;function Et(t,...e){const n=A("");return b(()=>{const s=e.map(l=>v(l)?String(l()):String(l)),i=[t[0]];s.forEach((l,c)=>{i.push(l,t[c+1])}),n.set(i.join(""))}),n}function yt(t,e){const n=A(e??null),s=i=>n.set(i);return t instanceof Promise?t.then(s):typeof t=="function"&&b(()=>{const i=t();i instanceof Promise?i.then(s):v(i)?b(()=>s(i())):s(i)}),n}function St(t,e){let n=t(),s=e();b(()=>{const i=t(),l=e();i!==l&&(i!==n?e.set(i):l!==s&&t.set(l)),n=i,s=l})}function vt(...t){let e=t.map(s=>s());const n=A(e);return t.forEach((s,i)=>{b(()=>{const l=()=>e.filter(c=>c!==void 0).length;l()===t.length&&(e=Array.from(e).fill(void 0)),e[i]=s(),l()===t.length&&n.set([...e])})}),n}const At=(...t)=>{const e=A([]);return b(()=>{e.set(t.map(n=>n()))}),e};class T extends HTMLElement{constructor(n=!1){super();E(this,"isSlotLazyLoading",!1);E(this,"slotTemplate");E(this,"slotContext");E(this,"rootStyle");E(this,"modelValue");E(this,"providers");E(this,"appendAllSlotContent");E(this,"allSlotContent",[]);E(this,"slotContent",{});E(this,"htmlSlotContent",{});E(this,"shadow");E(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var i;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const l=n.slot||"default";this.htmlSlotContent[l]||(this.htmlSlotContent[l]=[]),(i=this.htmlSlotContent[l])==null||i.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return f("%cinject%c",n),this.injects[n]||(this.injects[n]=A(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{f("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:i=>b(()=>{s.set(i())})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}E(T,"observedAttributes",[]),E(T,"renderTagName",""),E(T,"styles");const gt=t=>"render"in t&&"setReactiveValue"in t,Lt="handleSlotContext",x="onConnected",Rt=()=>()=>{},N=t=>typeof t=="string"?t:JSON.stringify(t),V=t=>{const e=document.createElement("span");return e.textContent=N(t),e},D=(t,e)=>(t.appendChild(V(e)),t),tt=(t,e)=>(t.innerHTML="",D(t,e)),J=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=N(n)}),e},M=t=>({append(...e){return e.forEach(n=>{t.appendChild(n.hostElement),x in n.hostElement&&setTimeout(()=>{var s,i;(i=(s=n.hostElement).onConnected)==null||i.call(s,n,n.hostElement)})}),this},set(...e){this.clear();const n=document.createDocumentFragment();return e.forEach(s=>{n.appendChild(s.hostElement)}),t.appendChild(n),this},removeChild(...e){return e.forEach(n=>{Array.from(t.childNodes.values()).some(s=>s===n.hostElement)&&t.removeChild(n.hostElement)}),this},addHtmlContent(e){return D(t,e),this},setHtmlContent(e){return tt(t,e),this},addEventlistener(e,n,s=!1){return t.addEventListener(e,i=>n(i,this,t),s),this},setAttribute(e,n){let s;if(typeof n=="boolean"&&!(t instanceof T))if(n)s="";else{this.removeAttribute(e);const i=e.toLowerCase();return i in t&&(t[i]=null),this}else typeof n!="string"?s=JSON.stringify(n):s=n;if(t.setAttribute(I(e),s),!(t instanceof T)){const i=e.toLowerCase();i in t&&(t[i]=n)}return this},setCustomAttribute(e,n){let s;return typeof n!="string"?s=JSON.stringify(n):s=n,t.setAttribute(I(e),s),this},setReactiveAttribute(e,n){return b(()=>this.setAttribute(e,n())),this},setReactiveCustomAttribute(e,n){return b(()=>this.setCustomAttribute(e,n())),this},removeAttribute(e){return t.removeAttribute(I(e)),this},addStyle(e){return Object.entries(e).forEach(([n,s])=>{const i=n.startsWith("--");typeof s=="function"?this.addEffect(()=>{if(i){const l=String(s()||"");t.style.setProperty(n,l)}else t.style[n]=s()}):typeof s=="string"&&(i?t.style.setProperty(n,s):t.style[n]=s)}),this},onConnected(e){return Reflect.defineProperty(t,x,{get(){return e}}),this},addClass(...e){return e.forEach(n=>{typeof n=="string"?t.classList.add(...n.split(" ").flatMap(s=>s.split(`
|
|
2
|
+
`)).map(s=>s.trim()).filter(Boolean)):(()=>{let s=null;this.addEffect(()=>{const i=n();i.length>0&&(s?this.replaceClass(s,i):this.addClass(i),s=i)})})()}),this},setClass(...e){return t.classList.remove(...t.classList),t.classList.add(...e),this},addReactiveClass(e){return Object.keys(e).forEach(n=>{b(()=>{e[n]()?this.addClass(n):this.removeClass(n)})}),this},removeClass(...e){return t.classList.remove(...e),this},replaceClass(e,n){return t.classList.replace(e,n),this},addEffect(e){return b(()=>e(this,this.hostElement)),this},addReactiveContent(e){return t.appendChild(J(e)),this},setReactiveContent(e){return this.clear(),t.appendChild(J(e)),this},clear(){return t.innerHTML="",this},hostElement:t}),et=(t,...e)=>({classList:[...t.map(n=>n.trim()).filter(Boolean),...e]}),Tt=(t,...e)=>et(t,...e),U=(t,e)=>{if(!e)return t;const n=Object.keys(e||{}).filter(s=>s.startsWith(".")||s.startsWith("@")||s.startsWith("$"));return n.filter(s=>s.startsWith(".")).forEach(s=>{e!=null&&e.attributes||(e.attributes={}),e.attributes[s.slice(1)]=e[s]}),n.filter(s=>s.startsWith("@")).forEach(s=>{e!=null&&e.listeners||(e.listeners={});const i=s.slice(1);e.listeners[i]=e[s]}),n.filter(s=>s.startsWith("$")).forEach(s=>{e!=null&&e.effects||(e.effects=[]),e.effects.push(e[s])}),it(t,e.classList),ct(t,e.style),rt(t,e.attributes),lt(t,e.reactiveClassList),ot(t,e.customAttributes),st(t,e.children),nt(t,e.effects),X(t,e.listeners),X(t,e.customListeners),t},X=(t,e)=>{e&&Object.entries(e).forEach(([n,s])=>{typeof s=="function"&&t.addEventlistener(n,s)})},nt=(t,e)=>e==null?void 0:e.forEach(n=>t.addEffect(n)),st=(t,e)=>$(t,...e||[]),ot=(t,e)=>{const n=e;n&&Object.keys(n).forEach(s=>{v(n[s])?t.setReactiveCustomAttribute(s,n[s]):typeof n[s]=="function"?t.addEffect(()=>{t.setCustomAttribute(s,n[s]())}):t.setCustomAttribute(s,n[s])})},it=(t,e)=>t.addClass(...e||[]),lt=(t,e)=>t.addReactiveClass(e||{}),ct=(t,e)=>t.addStyle(e||{}),rt=(t,e)=>{const n=e,s=(i,l)=>{l&&(v(l)?t.setReactiveAttribute(i,l):typeof l=="function"?t.addEffect(()=>{t.setAttribute(i,l())}):t.setAttribute(i,l))};n&&Object.keys(n).forEach(i=>{s(i,n[i])})},$=(t,...e)=>(e.forEach(n=>{typeof n=="string"?n.trim().length>0&&t.addHtmlContent(n):v(n)?t.addReactiveContent(n):t.append(n)}),t),k=(t,e)=>{const n=document.createElement(t),s={...M(n)};return U(s,e)},P=(t,e)=>{const[n,...s]=t.split(" ").map(l=>l.trim()),i=k(n,e);return s.length>0&&i.addClass(...s),(...l)=>$(i,...l.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?g(()=>c(i)):c))},g=t=>k("div").addStyle({display:"contents"}).addEffect(e=>{const n=t(),s=[];Array.isArray(n)?s.push(...n):s.push(n),e.clear(),$(e,...s)}),jt=t=>{const e=s=>typeof s=="string"?s.trim().length>0?M(V(s)):P("div")():v(s)?M(J(s)):s;return at(()=>{const s=t();return s instanceof Array&&Array.isArray(s)?s.map(e):e(s)})},Ot=(t,e,n)=>{const s=k("div").addStyle({display:"contents"}),i=new Map,l=new Map;let c=[];const d=new Set;let a=t.peek();const h=m=>{d.delete(m),i.delete(m),l.delete(m)};return b(()=>{const m=t();c=m.map(e).map(u=>typeof u=="string"?u:u.toString());const C=Array.from(s.hostElement.children);f("containerChildren",C,c),C.forEach(u=>{const S=u.dataset.key;c.includes(S)||(f("remove element",S,u),u.remove(),h(S))}),c.forEach(u=>{var H,j;const S=m[c.indexOf(u)];i.has(u)?JSON.stringify(S)!==JSON.stringify(a[c.indexOf(u)])&&((H=s.hostElement.querySelector(`[data-key="${u}"]`))==null||H.remove(),(j=i.get(u))==null||j.set(Math.random().toString(36).substring(2,15)),l.set(u,()=>n(S,c.indexOf(u),m).setCustomAttribute("data-key",u))):(f("create new element",u,S),i.set(u,A(Math.random().toString(36).substring(2,15))),l.set(u,()=>n(S,c.indexOf(u),m).setCustomAttribute("data-key",u)))}),a=m;const y=()=>{i.forEach((u,S)=>{f("key from setTimeout foreach currItemSignalMap",S),d.has(S)||(d.add(S),b(()=>{var bt;u();const H=c.indexOf(S),j=(bt=l.get(S))==null?void 0:bt();j&&(f("call effect from setTimeout",S,j.hostElement),H<=s.hostElement.children.length-1?s.hostElement.insertBefore(j.hostElement,s.hostElement.children[H]):s.hostElement.append(j.hostElement))}))})};Promise.resolve().then(()=>y())}),s},at=t=>{let e=[k("div")],n=!1;return b(()=>{var l,c;const s=t();n=Array.isArray(s);const i=[];i.push(...[s].flat()),i.length===0&&i.push(k("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{f("newReactiveComponent.map",i.map(d=>{var a;return f("newReactiveComponent hostElement",d.hostElement),(a=d.hostElement)==null?void 0:a.id})),f("currComponent[0].hostElement?.id",(l=e[0].hostElement)==null?void 0:l.id,e),(c=e[0].hostElement)==null||c.replaceWith(...i.map(d=>d.hostElement)),e.slice(1).forEach(d=>{var a;return(a=d.hostElement)==null?void 0:a.remove()}),e=i}catch(d){console.error(d)}}),n?e:e[0]},wt=t=>Lt in t,kt=t=>{const e=P("div")().addStyle({display:"contents"}),n=s=>(e.hostElement.innerHTML=s,e);return typeof t=="string"?n(t):e.addEffect(()=>{n(t())}),e},Z=(t,e,n)=>t?g(e):n?g(n):P("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),dt=(t,e,n)=>g(()=>Z(!!t(),e,n)),It=(t,e,n)=>typeof t=="boolean"?Z(t,e,n):dt(t,e,n),Q=(t,e)=>{const n=g(e);return typeof t=="boolean"?[n].flat().forEach(s=>s.hostElement.style.display=t?"block":"none"):b(()=>{const s=t()?"block":"none";[n].flat().forEach(i=>i.hostElement.style.display=s)}),n},Mt=(t,e,n)=>{const s=[Q(t,e)].flat();return n&&s.push(...[Q(()=>typeof t=="boolean"?!t:!t(),n)].flat()),g(()=>s)},ht=(t,e)=>{f("createCustomElement",t);const n=document.createElement(t),s={...M(n),setReactiveValue(i){return n instanceof T&&n.setReactiveValue(i),this},setSlotTemplate(i){const l=n.slotTemplate;return l&&Object.entries(i).forEach(([c,d])=>{l[c]=d}),this}};return U(s,e)},ut=(t,e)=>{const n=t.split(" ").slice(1).map(i=>i.trim()),s=ht(t.split(" ")[0],e);return Array.isArray(n)&&n.length>0&&s.addClass(...n),(...i)=>{R("@rcreateCustomEl content",t,i);const l=i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?g(()=>c(s)):c);return s.hostElement.allSlotContent=l,s.hostElement.slotContent=l.filter(L).reduce((c,d)=>{const a=d.hostElement.getAttribute("slot")||"default";return c[a]||(c[a]=[]),c[a].push(d),c},{}),s.hostElement.appendAllSlotContent=()=>$(s,...l),s}},ft=(t,e,n)=>ut(`${t.renderTagName}${e&&typeof e=="string"?" "+e:""}`,p(e)?e:e&&typeof e=="string"?n:void 0),$t=()=>{const t=()=>{};return t.oldValue=null,t},Pt=()=>({}),Ft=(t,e,n)=>{const s=e?Ct(e,n)(t):t;return(i,...l)=>{const c=[...l];return i&&!p(i)&&c.unshift(i),ft(s,p(i)?i:{})(...c)}},r={};["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(t=>{r[t]=(e,...n)=>{let s=[...n];return e&&!p(e)&&(s=[e].concat(s)),P(t,p(e)?e:{})(...s)}});const mt=r.div,Ht=r.span,Wt=r.section,_t=r.input,Bt=r.button,Jt=r.table,zt=r.tr,qt=r.td,Gt=r.th,Nt=r.ul,Vt=r.li,Dt=r.ol,Ut=r.form,Xt=r.label,Zt=r.select,Qt=r.option,Yt=r.textarea,Kt=r.img,xt=r.a,te=r.p,ee=r.h1,ne=r.h2,se=r.h3,oe=r.h4,ie=r.h5,le=r.h6,ce=r.br,re=r.hr,ae=r.pre,de=r.code,he=r.nav,ue=r.header,fe=r.footer,me=r.main,Ce=r.aside,be=r.article,pe=r.figure,Ee=r.figcaption,ye=r.blockquote,Se=r.cite,ve=r.small,Ae=r.strong,ge=r.em,Le=r.b,Re=r.i,Te=r.u,je=r.s,Oe=r.sub,we=r.sup,ke=r.mark,Ie=r.del,Me=r.ins,$e=r.details,Pe=r.summary,Fe=r.progress,He=r.meter,We=r.audio,_e=r.video,Be=r.canvas,Je=r.slot,ze=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{}),z="eventProps",q="EVENT_CONFIG",F="observedAttributes",qe=()=>(t,e)=>{Reflect.get(t,F)||Reflect.defineProperty(t,F,{value:[]}),Reflect.get(t,F).push(I(e))},Ge=t=>(e,n)=>{Reflect.get(e,z)||Reflect.defineProperty(e,z,{value:[]}),Reflect.get(e,q)||Reflect.defineProperty(e,q,{value:{}}),Reflect.get(e,q)[n]={bubbles:(t==null?void 0:t.bubbles)??!1,composed:(t==null?void 0:t.composed)??!1},Reflect.get(e,z).push(n)},Ct=(t,e=!1)=>n=>{f(t,"start register static attr",n.prototype[F]);const s=[];if(n.styles){const l=n.styles,c=[];Array.isArray(l)?c.push(...l):c.push(l),c.forEach(d=>{const a=new CSSStyleSheet;a.replaceSync(d),s.push(a);const h=new CSSStyleSheet;h.replaceSync(d.slice(d.indexOf("@property"))),document.adoptedStyleSheets.push(h)})}class i extends n{constructor(...c){f("constructor",`%c${t}%c`),super(e,...c),R("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){f("rwc: render from new class");let c=mt();const d=()=>{f("wrapperEffectCallback"),c=n.prototype.render.call(this)};return d.fake=!0,b(d),c}attributeChangedCallback(c,d,a){f("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${d}, newValue: ${a}`,`%c${t}%c`);try{a=JSON.parse(a)}catch{}const h=Y(c);if(h in this&&v(this[h])){const m=this[h];a===null?(m.set(m.initValue),this.removeAttribute(c)):m.set(a)}W(this,n.prototype.attributeChangedCallback,c,d,a)}connectedCallback(){var d;f("rwc: connectedCallback"),f("connectedCallback",`%c${t}%c`,this),this.providers&&Object.keys(this.providers).length>0&&(f("WRAPPER for providers",t),Object.entries(this.providers).forEach(([a,h])=>{f("register provider",a,h()),this.addEventListener(a,m=>{var y;f("send provider",a,h());const C=m;((y=C.detail)==null?void 0:y.context)===a&&(C.stopPropagation(),C.detail.callback(h))})})),this.checkInjects(),(d=n.prototype[z])==null||d.forEach(a=>{this[a]=h=>{const m=n.prototype[q][a],{bubbles:C,composed:y}=m;v(h)?b(()=>{R("@oemit reactive value",h()),this.dispatchEvent(new CustomEvent(a,{detail:h(),bubbles:C,composed:y}))}):(R("@oemit value",h),this.dispatchEvent(new CustomEvent(a,{detail:h,bubbles:C,composed:y})))}}),f("start render",`%c${t}%c`,t);const c=()=>{f("rwc: insertRenderTemplate");const a=this.render();this.shadow.appendChild(a.hostElement),W(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const a=C=>C instanceof Promise||Array.isArray(C)&&C.every(y=>y instanceof Promise),h=this.rootStyle,m=C=>{const y=new CSSStyleSheet;y.replaceSync(C),this.shadow.adoptedStyleSheets.push(y);const u=new CSSStyleSheet;u.replaceSync(C.slice(C.indexOf("@property"))),document.adoptedStyleSheets.push(u)};if(a(h)){const C=[];Array.isArray(h)?C.push(...h):C.push(h),Promise.all(C).then(y=>y.forEach(u=>m(u.default))).then(()=>c())}else{const C=[];Array.isArray(h)?C.push(...h):C.push(h),C.forEach(y=>m(y)),c()}}else c();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(a=>{f(this.slotContext,this.slotContext&&this.slotContext[a.name]),R("@bslot element",a,`name:${a.name};`,a.assignedElements()),a.assignedElements().forEach(h=>{const m=this.slotContext[a.name];this.slotContext&&v(m)&&(R("@oslot element",a,`name:${a.name};`,a.assignedElements()),b(()=>{h.dispatchEvent(new CustomEvent("handleSlotContext",{detail:m()}))}))})})}disconnectedCallback(){this.shadow.replaceChildren(),this.replaceChildren(),W(this,n.prototype.disconnectedCallback)}}return E(i,"observedAttributes",n.prototype[F]??[]),E(i,"renderTagName",t),i.toString=()=>t,customElements.get(t)?console.error(`название тега ${t} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(t,i),n.renderTagName=t,n};o.BaseElement=T,o.a=xt,o.addAttributeList=rt,o.addClassList=it,o.addCustomAttributes=ot,o.addHtmlContent=D,o.addReactiveClassList=lt,o.addStyleList=ct,o.appendContentItem=$,o.article=be,o.aside=Ce,o.audio=We,o.b=Le,o.bindReactiveSignals=St,o.blockquote=ye,o.br=ce,o.button=Bt,o.camelToKebab=I,o.canvas=Be,o.checkCall=W,o.cite=Se,o.classList=et,o.cls=Tt,o.code=de,o.colorLog=R,o.combineLatest=At,o.component=Ct,o.createComponent=ze,o.createCustom=ft,o.createCustomEl=ut,o.createCustomElement=ht,o.createEl=P,o.createElement=k,o.createSignal=yt,o.defineSlotTemplate=Pt,o.del=Ie,o.details=$e,o.disableLogs=K,o.div=mt,o.effect=b,o.effectMap=G,o.elementHelpers=M,o.em=ge,o.enableLogs=pt,o.event=Ge,o.eventEmitter=Rt,o.figcaption=Ee,o.figure=pe,o.footer=fe,o.forkJoin=vt,o.form=Ut,o.getList=Ot,o.getReactiveTemplate=jt,o.getSignalContent=g,o.getTextContent=N,o.h1=ee,o.h2=ne,o.h3=se,o.h4=oe,o.h5=ie,o.h6=le,o.header=ue,o.hr=re,o.htmlEffectWrapper=J,o.i=Re,o.img=Kt,o.initComponent=U,o.input=_t,o.ins=Me,o.isBaseElement=gt,o.isComponentConfig=L,o.isComponentInitConfig=p,o.isReactiveSignal=v,o.isSlotTemplate=wt,o.kebabToCamel=Y,o.label=Xt,o.li=Vt,o.main=me,o.mark=ke,o.meter=He,o.nav=he,o.newEventEmitter=$t,o.ol=Dt,o.option=Qt,o.p=te,o.pre=ae,o.progress=Fe,o.projectLog=f,o.property=qe,o.renderIf=Z,o.rs=Et,o.rxRenderIf=dt,o.s=je,o.section=Wt,o.select=Zt,o.setChildren=st,o.setEffects=nt,o.setHtmlContent=tt,o.setListeners=X,o.show=Mt,o.showIf=Q,o.signal=A,o.signalComponent=at,o.slot=Je,o.small=ve,o.span=Ht,o.strong=Ae,o.sub=Oe,o.summary=Pe,o.sup=we,o.table=Jt,o.td=qt,o.textContentWrapper=V,o.textarea=Yt,o.th=Gt,o.tr=zt,o.u=Te,o.ul=Nt,o.unsafeHtml=kt,o.useCustomComponent=Ft,o.video=_e,o.when=It,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var Q = Object.defineProperty;
|
|
2
2
|
var Y = (t, e, s) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
3
|
var C = (t, e, s) => Y(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
const
|
|
4
|
+
const x = (t) => t && typeof t == "object" && ("classList" in t || "attributes" in t || "customAttributes" in t || "reactiveClassList" in t || "listeners" in t || "customListeners" in t || "children" in t || "effects" in t || "style" in t || Object.keys(t).some(
|
|
5
5
|
(e) => e.startsWith(".") || e.startsWith("@") || e.startsWith("$")
|
|
6
6
|
)) && !("hostElement" in t), K = (t) => t && typeof t == "object" && "hostElement" in t && "append" in t && "set" in t && "addStyle" in t && "setAttribute" in t && "addClass" in t && "addEffect" in t && "addReactiveContent" in t && "setReactiveContent" in t && "clear" in t, _ = (t, e, ...s) => {
|
|
7
7
|
e && e.apply(t, s);
|
|
8
8
|
};
|
|
9
9
|
let F = !0;
|
|
10
|
-
const
|
|
10
|
+
const u = (...t) => {
|
|
11
11
|
F && console.debug(
|
|
12
12
|
["[rwc]", ...t].join(" | "),
|
|
13
13
|
...Array.from(t.join("").matchAll(/%c/gm)).map((e, s) => s % 2 === 0 ? "color:red" : "color:inherit")
|
|
14
14
|
);
|
|
15
|
-
},
|
|
15
|
+
}, $ = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`), tt = (t) => t.replace(/-(\w)/gm, (e, s) => s.toUpperCase()), L = (t, ...e) => {
|
|
16
16
|
if (!F) return;
|
|
17
17
|
const s = {
|
|
18
18
|
r: "color: #ff0000",
|
|
@@ -31,13 +31,13 @@ const f = (...t) => {
|
|
|
31
31
|
// orange
|
|
32
32
|
w: "color: #808080"
|
|
33
33
|
// gray (w for white/gray)
|
|
34
|
-
}, n = t.match(/@[rgbpycow]/g) || [], o = n.map((
|
|
35
|
-
const a =
|
|
34
|
+
}, n = t.match(/@[rgbpycow]/g) || [], o = n.map((i) => {
|
|
35
|
+
const a = i.slice(1);
|
|
36
36
|
return s[a] || "color: inherit";
|
|
37
37
|
});
|
|
38
38
|
let r = t;
|
|
39
|
-
n.forEach((
|
|
40
|
-
const a = new RegExp(`\\${
|
|
39
|
+
n.forEach((i) => {
|
|
40
|
+
const a = new RegExp(`\\${i}([^\\s,]+)`, "g");
|
|
41
41
|
r = r.replace(a, "%c$1");
|
|
42
42
|
}), console.log(r, ...o, ...e);
|
|
43
43
|
}, vt = () => {
|
|
@@ -46,81 +46,81 @@ const f = (...t) => {
|
|
|
46
46
|
F = !1;
|
|
47
47
|
};
|
|
48
48
|
et();
|
|
49
|
-
const V = /* @__PURE__ */ new Map(),
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
function
|
|
54
|
-
var
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
const V = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), I = [], g = [];
|
|
50
|
+
function A(t, e) {
|
|
51
|
+
const s = /* @__PURE__ */ new Set();
|
|
52
|
+
let n = (e == null ? void 0 : e.signalCompareFn) || (() => !0);
|
|
53
|
+
function o() {
|
|
54
|
+
var i;
|
|
55
|
+
const r = I[I.length - 1];
|
|
56
|
+
if (r && !("fake" in r && r.fake)) {
|
|
57
|
+
const a = R.get(r), c = a == null ? void 0 : a.parent;
|
|
58
|
+
if (c) {
|
|
59
|
+
const d = R.get(c);
|
|
60
|
+
d == null || d.cleanupFns.add(() => {
|
|
61
|
+
s.delete(r);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
s.add(r), (i = V.get(r.effectId)) == null || i.signals.push(o);
|
|
65
65
|
}
|
|
66
66
|
return t;
|
|
67
67
|
}
|
|
68
|
-
return
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
},
|
|
68
|
+
return o.signalId = `${(e == null ? void 0 : e.name) || ""}_${Math.random().toString(36).substring(2, 15)}`, o.getSubscribers = () => [...s], o.setCompareFn = function(r) {
|
|
69
|
+
return n = r, o;
|
|
70
|
+
}, o.clearSubscribers = function() {
|
|
71
|
+
s.clear();
|
|
72
|
+
}, o.peek = function() {
|
|
73
73
|
return Object.freeze(t);
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
74
|
+
}, o.initValue = Object.freeze(t), o.oldValue = Object.freeze(t), o.forceSet = function(r) {
|
|
75
|
+
o.oldValue = Object.freeze(t), t = r, s.forEach((i) => Promise.resolve(i).then((a) => {
|
|
76
|
+
const c = R.get(a);
|
|
77
|
+
c && c.cleanupFns.size > 0 && (c.cleanupFns.forEach((d) => d()), c.cleanupFns.clear()), g.push(a), a(), g.pop();
|
|
78
78
|
}));
|
|
79
|
-
},
|
|
80
|
-
t !==
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
const a =
|
|
79
|
+
}, o.set = function(r, i = n) {
|
|
80
|
+
t !== r && i(t, r) && o.forceSet(r);
|
|
81
|
+
}, o.update = function(r) {
|
|
82
|
+
o.set(r(t));
|
|
83
|
+
}, o.pipe = (r, i) => {
|
|
84
|
+
const a = A(null);
|
|
85
85
|
return m(() => {
|
|
86
|
-
const
|
|
86
|
+
const c = o();
|
|
87
87
|
m(() => {
|
|
88
|
-
const d = c
|
|
89
|
-
d instanceof Promise ? d.then((
|
|
90
|
-
});
|
|
88
|
+
const d = r(c);
|
|
89
|
+
d instanceof Promise ? d.then((f) => a.set(f)) : y(d) ? m(() => a.set(d())) : a.set(d);
|
|
90
|
+
}, i);
|
|
91
91
|
}), a;
|
|
92
|
-
},
|
|
92
|
+
}, o;
|
|
93
93
|
}
|
|
94
94
|
function m(t, e) {
|
|
95
|
-
const s = e || Math.random().toString(36).substring(2, 15)
|
|
96
|
-
|
|
95
|
+
const s = `${(e == null ? void 0 : e.name) || ""}_${Math.random().toString(36).substring(2, 15)}`;
|
|
96
|
+
u("current effect", `%c${s}%c`);
|
|
97
97
|
const n = t;
|
|
98
|
-
t = () => (
|
|
98
|
+
t = () => (u("current effect callback", `%c${s}%c`), n()), "fake" in n && n.fake && (t.fake = !0), t.effectId = s;
|
|
99
99
|
const o = g[g.length - 1];
|
|
100
|
-
|
|
101
|
-
const r =
|
|
100
|
+
V.set(s, { signals: [], parent: (o == null ? void 0 : o.effectId) || null }), R.has(t) || R.set(t, { cleanupFns: /* @__PURE__ */ new Set() });
|
|
101
|
+
const r = R.get(t);
|
|
102
102
|
o ? r.parent = o : delete r.parent, g.push(t), I.push(t), t(), I.pop(), g.pop();
|
|
103
103
|
}
|
|
104
104
|
const y = (t) => !!t && ["object", "function"].includes(typeof t) && "set" in t && "oldValue" in t && "update" in t && "forceSet" in t;
|
|
105
105
|
function At(t, ...e) {
|
|
106
|
-
const s =
|
|
106
|
+
const s = A("");
|
|
107
107
|
return m(() => {
|
|
108
108
|
const n = e.map(
|
|
109
109
|
(r) => y(r) ? String(r()) : String(r)
|
|
110
110
|
), o = [t[0]];
|
|
111
|
-
n.forEach((r,
|
|
112
|
-
o.push(r, t[
|
|
111
|
+
n.forEach((r, i) => {
|
|
112
|
+
o.push(r, t[i + 1]);
|
|
113
113
|
}), s.set(o.join(""));
|
|
114
114
|
}), s;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
const s =
|
|
116
|
+
function Lt(t, e) {
|
|
117
|
+
const s = A(e ?? null), n = (o) => s.set(o);
|
|
118
118
|
return t instanceof Promise ? t.then(n) : typeof t == "function" && m(() => {
|
|
119
119
|
const o = t();
|
|
120
120
|
o instanceof Promise ? o.then(n) : y(o) ? m(() => n(o())) : n(o);
|
|
121
121
|
}), s;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function gt(t, e) {
|
|
124
124
|
let s = t(), n = e();
|
|
125
125
|
m(() => {
|
|
126
126
|
const o = t(), r = e();
|
|
@@ -129,15 +129,21 @@ function Lt(t, e) {
|
|
|
129
129
|
}
|
|
130
130
|
function Rt(...t) {
|
|
131
131
|
let e = t.map((n) => n());
|
|
132
|
-
const s =
|
|
132
|
+
const s = A(e);
|
|
133
133
|
return t.forEach((n, o) => {
|
|
134
134
|
m(() => {
|
|
135
|
-
const r = () => e.filter((
|
|
135
|
+
const r = () => e.filter((i) => i !== void 0).length;
|
|
136
136
|
r() === t.length && (e = Array.from(e).fill(void 0)), e[o] = n(), r() === t.length && s.set([...e]);
|
|
137
137
|
});
|
|
138
138
|
}), s;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
const Ot = (...t) => {
|
|
141
|
+
const e = A([]);
|
|
142
|
+
return m(() => {
|
|
143
|
+
e.set(t.map((s) => s()));
|
|
144
|
+
}), e;
|
|
145
|
+
};
|
|
146
|
+
class O extends HTMLElement {
|
|
141
147
|
constructor(s = !1) {
|
|
142
148
|
super();
|
|
143
149
|
C(this, "isSlotLazyLoading", !1);
|
|
@@ -169,11 +175,11 @@ class R extends HTMLElement {
|
|
|
169
175
|
(s = this.appendAllSlotContent) == null || s.call(this);
|
|
170
176
|
}
|
|
171
177
|
inject(s) {
|
|
172
|
-
return
|
|
178
|
+
return u("%cinject%c", s), this.injects[s] || (this.injects[s] = A(null)), this.injects[s];
|
|
173
179
|
}
|
|
174
180
|
checkInjects() {
|
|
175
181
|
Object.entries(this.injects).forEach(([s, n]) => {
|
|
176
|
-
|
|
182
|
+
u(
|
|
177
183
|
"%cinject%c",
|
|
178
184
|
`%c${s}%c`,
|
|
179
185
|
"from BaseElement (dispatch event)"
|
|
@@ -195,8 +201,8 @@ class R extends HTMLElement {
|
|
|
195
201
|
this.modelValue = s;
|
|
196
202
|
}
|
|
197
203
|
}
|
|
198
|
-
C(
|
|
199
|
-
const
|
|
204
|
+
C(O, "observedAttributes", []), C(O, "renderTagName", ""), C(O, "styles");
|
|
205
|
+
const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotContext", J = "onConnected", Tt = () => () => {
|
|
200
206
|
}, D = (t) => typeof t == "string" ? t : JSON.stringify(t), G = (t) => {
|
|
201
207
|
const e = document.createElement("span");
|
|
202
208
|
return e.textContent = D(t), e;
|
|
@@ -244,7 +250,7 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
244
250
|
},
|
|
245
251
|
setAttribute(e, s) {
|
|
246
252
|
let n;
|
|
247
|
-
if (typeof s == "boolean" && !(t instanceof
|
|
253
|
+
if (typeof s == "boolean" && !(t instanceof O))
|
|
248
254
|
if (s)
|
|
249
255
|
n = "";
|
|
250
256
|
else {
|
|
@@ -253,7 +259,7 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
253
259
|
return o in t && (t[o] = null), this;
|
|
254
260
|
}
|
|
255
261
|
else typeof s != "string" ? n = JSON.stringify(s) : n = s;
|
|
256
|
-
if (t.setAttribute(
|
|
262
|
+
if (t.setAttribute($(e), n), !(t instanceof O)) {
|
|
257
263
|
const o = e.toLowerCase();
|
|
258
264
|
o in t && (t[o] = s);
|
|
259
265
|
}
|
|
@@ -261,7 +267,7 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
261
267
|
},
|
|
262
268
|
setCustomAttribute(e, s) {
|
|
263
269
|
let n;
|
|
264
|
-
return typeof s != "string" ? n = JSON.stringify(s) : n = s, t.setAttribute(
|
|
270
|
+
return typeof s != "string" ? n = JSON.stringify(s) : n = s, t.setAttribute($(e), n), this;
|
|
265
271
|
},
|
|
266
272
|
setReactiveAttribute(e, s) {
|
|
267
273
|
return m(() => this.setAttribute(e, s())), this;
|
|
@@ -270,7 +276,7 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
270
276
|
return m(() => this.setCustomAttribute(e, s())), this;
|
|
271
277
|
},
|
|
272
278
|
removeAttribute(e) {
|
|
273
|
-
return t.removeAttribute(
|
|
279
|
+
return t.removeAttribute($(e)), this;
|
|
274
280
|
},
|
|
275
281
|
addStyle(e) {
|
|
276
282
|
return Object.entries(e).forEach(([s, n]) => {
|
|
@@ -336,7 +342,7 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
336
342
|
hostElement: t
|
|
337
343
|
}), ot = (t, ...e) => ({
|
|
338
344
|
classList: [...t.map((s) => s.trim()).filter(Boolean), ...e]
|
|
339
|
-
}),
|
|
345
|
+
}), xt = (t, ...e) => ot(t, ...e), X = (t, e) => {
|
|
340
346
|
if (!e) return t;
|
|
341
347
|
const s = Object.keys(e || {}).filter(
|
|
342
348
|
(n) => n.startsWith(".") || n.startsWith("@") || n.startsWith("$")
|
|
@@ -349,19 +355,19 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
349
355
|
e.listeners[o] = e[n];
|
|
350
356
|
}), s.filter((n) => n.startsWith("$")).forEach((n) => {
|
|
351
357
|
e != null && e.effects || (e.effects = []), e.effects.push(e[n]);
|
|
352
|
-
}),
|
|
358
|
+
}), ct(t, e.classList), dt(t, e.style), ht(t, e.attributes), at(t, e.reactiveClassList), lt(t, e.customAttributes), it(t, e.children), rt(t, e.effects), q(t, e.listeners), q(t, e.customListeners), t;
|
|
353
359
|
}, q = (t, e) => {
|
|
354
360
|
e && Object.entries(e).forEach(([s, n]) => {
|
|
355
361
|
typeof n == "function" && t.addEventlistener(s, n);
|
|
356
362
|
});
|
|
357
|
-
}, rt = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)),
|
|
363
|
+
}, rt = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)), it = (t, e) => W(t, ...e || []), lt = (t, e) => {
|
|
358
364
|
const s = e;
|
|
359
365
|
s && Object.keys(s).forEach((n) => {
|
|
360
366
|
y(s[n]) ? t.setReactiveCustomAttribute(n, s[n]) : typeof s[n] == "function" ? t.addEffect(() => {
|
|
361
367
|
t.setCustomAttribute(n, s[n]());
|
|
362
368
|
}) : t.setCustomAttribute(n, s[n]);
|
|
363
369
|
});
|
|
364
|
-
},
|
|
370
|
+
}, ct = (t, e) => t.addClass(...e || []), at = (t, e) => t.addReactiveClass(e || {}), dt = (t, e) => t.addStyle(e || {}), ht = (t, e) => {
|
|
365
371
|
const s = e, n = (o, r) => {
|
|
366
372
|
r && (y(r) ? t.setReactiveAttribute(o, r) : typeof r == "function" ? t.addEffect(() => {
|
|
367
373
|
t.setAttribute(o, r());
|
|
@@ -372,20 +378,20 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
372
378
|
});
|
|
373
379
|
}, W = (t, ...e) => (e.forEach((s) => {
|
|
374
380
|
typeof s == "string" ? s.trim().length > 0 && t.addHtmlContent(s) : y(s) ? t.addReactiveContent(s) : t.append(s);
|
|
375
|
-
}), t),
|
|
381
|
+
}), t), w = (t, e) => {
|
|
376
382
|
const s = document.createElement(t), n = {
|
|
377
383
|
...P(s)
|
|
378
384
|
};
|
|
379
385
|
return X(n, e);
|
|
380
386
|
}, H = (t, e) => {
|
|
381
|
-
const [s, ...n] = t.split(" ").map((r) => r.trim()), o =
|
|
387
|
+
const [s, ...n] = t.split(" ").map((r) => r.trim()), o = w(s, e);
|
|
382
388
|
return n.length > 0 && o.addClass(...n), (...r) => W(
|
|
383
389
|
o,
|
|
384
390
|
...r.filter(Boolean).flat().flatMap(
|
|
385
|
-
(
|
|
391
|
+
(i) => typeof i == "function" && !y(i) ? v(() => i(o)) : i
|
|
386
392
|
)
|
|
387
393
|
);
|
|
388
|
-
}, v = (t) =>
|
|
394
|
+
}, v = (t) => w("div").addStyle({ display: "contents" }).addEffect((e) => {
|
|
389
395
|
const s = t(), n = [];
|
|
390
396
|
Array.isArray(s) ? n.push(...s) : n.push(s), e.clear(), W(e, ...n);
|
|
391
397
|
}), wt = (t) => {
|
|
@@ -394,48 +400,48 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
394
400
|
const n = t();
|
|
395
401
|
return n instanceof Array && Array.isArray(n) ? n.map(e) : e(n);
|
|
396
402
|
});
|
|
397
|
-
},
|
|
398
|
-
const n =
|
|
399
|
-
let
|
|
403
|
+
}, $t = (t, e, s) => {
|
|
404
|
+
const n = w("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
405
|
+
let i = [];
|
|
400
406
|
const a = /* @__PURE__ */ new Set();
|
|
401
|
-
let
|
|
402
|
-
const d = (
|
|
403
|
-
a.delete(
|
|
407
|
+
let c = t.peek();
|
|
408
|
+
const d = (f) => {
|
|
409
|
+
a.delete(f), o.delete(f), r.delete(f);
|
|
404
410
|
};
|
|
405
411
|
return m(() => {
|
|
406
|
-
const
|
|
407
|
-
|
|
412
|
+
const f = t();
|
|
413
|
+
i = f.map(e).map((h) => typeof h == "string" ? h : h.toString());
|
|
408
414
|
const p = Array.from(n.hostElement.children);
|
|
409
|
-
|
|
410
|
-
const E =
|
|
411
|
-
|
|
412
|
-
}),
|
|
415
|
+
u("containerChildren", p, i), p.forEach((h) => {
|
|
416
|
+
const E = h.dataset.key;
|
|
417
|
+
i.includes(E) || (u("remove element", E, h), h.remove(), d(E));
|
|
418
|
+
}), i.forEach((h) => {
|
|
413
419
|
var j, S;
|
|
414
|
-
const E =
|
|
415
|
-
o.has(
|
|
416
|
-
|
|
417
|
-
() => s(E,
|
|
420
|
+
const E = f[i.indexOf(h)];
|
|
421
|
+
o.has(h) ? JSON.stringify(E) !== JSON.stringify(c[i.indexOf(h)]) && ((j = n.hostElement.querySelector(`[data-key="${h}"]`)) == null || j.remove(), (S = o.get(h)) == null || S.set(Math.random().toString(36).substring(2, 15)), r.set(
|
|
422
|
+
h,
|
|
423
|
+
() => s(E, i.indexOf(h), f).setCustomAttribute(
|
|
418
424
|
"data-key",
|
|
419
|
-
|
|
425
|
+
h
|
|
420
426
|
)
|
|
421
|
-
)) : (
|
|
422
|
-
|
|
423
|
-
|
|
427
|
+
)) : (u("create new element", h, E), o.set(
|
|
428
|
+
h,
|
|
429
|
+
A(Math.random().toString(36).substring(2, 15))
|
|
424
430
|
), r.set(
|
|
425
|
-
|
|
426
|
-
() => s(E,
|
|
431
|
+
h,
|
|
432
|
+
() => s(E, i.indexOf(h), f).setCustomAttribute(
|
|
427
433
|
"data-key",
|
|
428
|
-
|
|
434
|
+
h
|
|
429
435
|
)
|
|
430
436
|
));
|
|
431
|
-
}),
|
|
437
|
+
}), c = f;
|
|
432
438
|
const b = () => {
|
|
433
|
-
o.forEach((
|
|
434
|
-
|
|
439
|
+
o.forEach((h, E) => {
|
|
440
|
+
u("key from setTimeout foreach currItemSignalMap", E), a.has(E) || (a.add(E), m(() => {
|
|
435
441
|
var B;
|
|
436
|
-
|
|
437
|
-
const j =
|
|
438
|
-
S && (
|
|
442
|
+
h();
|
|
443
|
+
const j = i.indexOf(E), S = (B = r.get(E)) == null ? void 0 : B();
|
|
444
|
+
S && (u(
|
|
439
445
|
"call effect from setTimeout",
|
|
440
446
|
E,
|
|
441
447
|
S.hostElement
|
|
@@ -449,24 +455,24 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
449
455
|
Promise.resolve().then(() => b());
|
|
450
456
|
}), n;
|
|
451
457
|
}, ut = (t) => {
|
|
452
|
-
let e = [
|
|
458
|
+
let e = [w("div")], s = !1;
|
|
453
459
|
return m(() => {
|
|
454
|
-
var r,
|
|
460
|
+
var r, i;
|
|
455
461
|
const n = t();
|
|
456
462
|
s = Array.isArray(n);
|
|
457
463
|
const o = [];
|
|
458
464
|
o.push(...[n].flat()), o.length === 0 && o.push(
|
|
459
|
-
|
|
465
|
+
w("div").addStyle({ display: "none" }).setAttribute("id", "empty_template")
|
|
460
466
|
);
|
|
461
467
|
try {
|
|
462
|
-
|
|
463
|
-
var
|
|
464
|
-
return
|
|
465
|
-
})),
|
|
468
|
+
u("newReactiveComponent.map", o.map((a) => {
|
|
469
|
+
var c;
|
|
470
|
+
return u("newReactiveComponent hostElement", a.hostElement), (c = a.hostElement) == null ? void 0 : c.id;
|
|
471
|
+
})), u("currComponent[0].hostElement?.id", (r = e[0].hostElement) == null ? void 0 : r.id, e), (i = e[0].hostElement) == null || i.replaceWith(
|
|
466
472
|
...o.map((a) => a.hostElement)
|
|
467
473
|
), e.slice(1).forEach((a) => {
|
|
468
|
-
var
|
|
469
|
-
return (
|
|
474
|
+
var c;
|
|
475
|
+
return (c = a.hostElement) == null ? void 0 : c.remove();
|
|
470
476
|
}), e = o;
|
|
471
477
|
} catch (a) {
|
|
472
478
|
console.error(a);
|
|
@@ -477,13 +483,13 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
477
483
|
return typeof t == "string" ? s(t) : e.addEffect(() => {
|
|
478
484
|
s(t());
|
|
479
485
|
}), e;
|
|
480
|
-
}, Z = (t, e, s) => t ? v(e) : s ? v(s) : H("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), ft = (t, e, s) => v(() => Z(!!t(), e, s)),
|
|
486
|
+
}, Z = (t, e, s) => t ? v(e) : s ? v(s) : H("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), ft = (t, e, s) => v(() => Z(!!t(), e, s)), It = (t, e, s) => typeof t == "boolean" ? Z(t, e, s) : ft(t, e, s), N = (t, e) => {
|
|
481
487
|
const s = v(e);
|
|
482
488
|
return typeof t == "boolean" ? [s].flat().forEach((n) => n.hostElement.style.display = t ? "block" : "none") : m(() => {
|
|
483
489
|
const n = t() ? "block" : "none";
|
|
484
490
|
[s].flat().forEach((o) => o.hostElement.style.display = n);
|
|
485
491
|
}), s;
|
|
486
|
-
},
|
|
492
|
+
}, Pt = (t, e, s) => {
|
|
487
493
|
const n = [N(t, e)].flat();
|
|
488
494
|
return s && n.push(
|
|
489
495
|
...[N(
|
|
@@ -492,16 +498,16 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
492
498
|
)].flat()
|
|
493
499
|
), v(() => n);
|
|
494
500
|
}, pt = (t, e) => {
|
|
495
|
-
|
|
501
|
+
u("createCustomElement", t);
|
|
496
502
|
const s = document.createElement(t), n = {
|
|
497
503
|
...P(s),
|
|
498
504
|
setReactiveValue(o) {
|
|
499
|
-
return s instanceof
|
|
505
|
+
return s instanceof O && s.setReactiveValue(o), this;
|
|
500
506
|
},
|
|
501
507
|
setSlotTemplate(o) {
|
|
502
508
|
const r = s.slotTemplate;
|
|
503
|
-
return r && Object.entries(o).forEach(([
|
|
504
|
-
r[
|
|
509
|
+
return r && Object.entries(o).forEach(([i, a]) => {
|
|
510
|
+
r[i] = a;
|
|
505
511
|
}), this;
|
|
506
512
|
}
|
|
507
513
|
};
|
|
@@ -509,32 +515,32 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
509
515
|
}, mt = (t, e) => {
|
|
510
516
|
const s = t.split(" ").slice(1).map((o) => o.trim()), n = pt(t.split(" ")[0], e);
|
|
511
517
|
return Array.isArray(s) && s.length > 0 && n.addClass(...s), (...o) => {
|
|
512
|
-
|
|
518
|
+
L("@rcreateCustomEl content", t, o);
|
|
513
519
|
const r = o.filter(Boolean).flat().flatMap(
|
|
514
|
-
(
|
|
520
|
+
(i) => typeof i == "function" && !y(i) ? v(() => i(n)) : i
|
|
515
521
|
);
|
|
516
522
|
return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(K).reduce(
|
|
517
|
-
(
|
|
518
|
-
const
|
|
519
|
-
return c
|
|
523
|
+
(i, a) => {
|
|
524
|
+
const c = a.hostElement.getAttribute("slot") || "default";
|
|
525
|
+
return i[c] || (i[c] = []), i[c].push(a), i;
|
|
520
526
|
},
|
|
521
527
|
{}
|
|
522
528
|
), n.hostElement.appendAllSlotContent = () => W(n, ...r), n;
|
|
523
529
|
};
|
|
524
530
|
}, Ct = (t, e, s) => mt(
|
|
525
531
|
`${t.renderTagName}${e && typeof e == "string" ? " " + e : ""}`,
|
|
526
|
-
|
|
527
|
-
),
|
|
532
|
+
x(e) ? e : e && typeof e == "string" ? s : void 0
|
|
533
|
+
), Ft = () => {
|
|
528
534
|
const t = () => {
|
|
529
535
|
};
|
|
530
536
|
return t.oldValue = null, t;
|
|
531
|
-
},
|
|
537
|
+
}, Wt = () => ({}), Ht = (t, e, s) => {
|
|
532
538
|
const n = e ? yt(e, s)(t) : t;
|
|
533
539
|
return (o, ...r) => {
|
|
534
|
-
const
|
|
535
|
-
return o && !
|
|
540
|
+
const i = [...r];
|
|
541
|
+
return o && !x(o) && i.unshift(o), Ct(n, x(o) ? o : {})(...i);
|
|
536
542
|
};
|
|
537
|
-
},
|
|
543
|
+
}, l = {}, bt = [
|
|
538
544
|
"div",
|
|
539
545
|
"span",
|
|
540
546
|
"section",
|
|
@@ -597,103 +603,103 @@ const Ot = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
597
603
|
"slot"
|
|
598
604
|
];
|
|
599
605
|
bt.forEach((t) => {
|
|
600
|
-
|
|
606
|
+
l[t] = (e, ...s) => {
|
|
601
607
|
let n = [...s];
|
|
602
|
-
return e && !
|
|
608
|
+
return e && !x(e) && (n = [e].concat(n)), H(t, x(e) ? e : {})(...n);
|
|
603
609
|
};
|
|
604
610
|
});
|
|
605
|
-
const Et =
|
|
611
|
+
const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt = l.table, Nt = l.tr, Vt = l.td, Dt = l.th, Gt = l.ul, Ut = l.li, Xt = l.ol, Zt = l.form, Qt = l.label, Yt = l.select, Kt = l.option, te = l.textarea, ee = l.img, se = l.a, ne = l.p, oe = l.h1, re = l.h2, ie = l.h3, le = l.h4, ce = l.h5, ae = l.h6, de = l.br, he = l.hr, ue = l.pre, fe = l.code, pe = l.nav, me = l.header, Ce = l.footer, be = l.main, Ee = l.aside, ye = l.article, Se = l.figure, ve = l.figcaption, Ae = l.blockquote, Le = l.cite, ge = l.small, Re = l.strong, Oe = l.em, je = l.b, Te = l.i, xe = l.u, we = l.s, $e = l.sub, ke = l.sup, Me = l.mark, Ie = l.del, Pe = l.ins, Fe = l.details, We = l.summary, He = l.progress, _e = l.meter, ze = l.audio, Be = l.video, Je = l.canvas, qe = l.slot, Ne = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", M = "EVENT_CONFIG", T = "observedAttributes", Ve = () => (t, e) => {
|
|
606
612
|
Reflect.get(t, T) || Reflect.defineProperty(t, T, {
|
|
607
613
|
value: []
|
|
608
614
|
}), Reflect.get(t, T).push(
|
|
609
|
-
|
|
615
|
+
$(e)
|
|
610
616
|
);
|
|
611
|
-
},
|
|
612
|
-
Reflect.get(e,
|
|
617
|
+
}, De = (t) => (e, s) => {
|
|
618
|
+
Reflect.get(e, k) || Reflect.defineProperty(e, k, {
|
|
613
619
|
value: []
|
|
614
|
-
}), Reflect.get(e,
|
|
620
|
+
}), Reflect.get(e, M) || Reflect.defineProperty(e, M, {
|
|
615
621
|
value: {}
|
|
616
|
-
}), Reflect.get(e,
|
|
622
|
+
}), Reflect.get(e, M)[s] = {
|
|
617
623
|
bubbles: (t == null ? void 0 : t.bubbles) ?? !1,
|
|
618
624
|
composed: (t == null ? void 0 : t.composed) ?? !1
|
|
619
|
-
}, Reflect.get(e,
|
|
625
|
+
}, Reflect.get(e, k).push(s);
|
|
620
626
|
}, yt = (t, e = !1) => (s) => {
|
|
621
|
-
|
|
627
|
+
u(
|
|
622
628
|
t,
|
|
623
629
|
"start register static attr",
|
|
624
630
|
s.prototype[T]
|
|
625
631
|
);
|
|
626
632
|
const n = [];
|
|
627
633
|
if (s.styles) {
|
|
628
|
-
const r = s.styles,
|
|
629
|
-
Array.isArray(r) ?
|
|
630
|
-
const
|
|
631
|
-
|
|
634
|
+
const r = s.styles, i = [];
|
|
635
|
+
Array.isArray(r) ? i.push(...r) : i.push(r), i.forEach((a) => {
|
|
636
|
+
const c = new CSSStyleSheet();
|
|
637
|
+
c.replaceSync(a), n.push(c);
|
|
632
638
|
const d = new CSSStyleSheet();
|
|
633
639
|
d.replaceSync(a.slice(a.indexOf("@property"))), document.adoptedStyleSheets.push(d);
|
|
634
640
|
});
|
|
635
641
|
}
|
|
636
642
|
class o extends s {
|
|
637
|
-
constructor(...
|
|
638
|
-
|
|
643
|
+
constructor(...i) {
|
|
644
|
+
u("constructor", `%c${t}%c`), super(e, ...i), L("@osheet", n), n.length > 0 && this.shadow.adoptedStyleSheets.push(...n);
|
|
639
645
|
}
|
|
640
646
|
render() {
|
|
641
|
-
|
|
642
|
-
let
|
|
647
|
+
u("rwc: render from new class");
|
|
648
|
+
let i = Et();
|
|
643
649
|
const a = () => {
|
|
644
|
-
|
|
650
|
+
u("wrapperEffectCallback"), i = s.prototype.render.call(this);
|
|
645
651
|
};
|
|
646
|
-
return a.fake = !0, m(a),
|
|
652
|
+
return a.fake = !0, m(a), i;
|
|
647
653
|
}
|
|
648
|
-
attributeChangedCallback(
|
|
649
|
-
|
|
654
|
+
attributeChangedCallback(i, a, c) {
|
|
655
|
+
u(
|
|
650
656
|
"%cAttribute has changed.%c",
|
|
651
|
-
`%c${
|
|
652
|
-
`oldValue: ${a}, newValue: ${
|
|
657
|
+
`%c${i}%c`,
|
|
658
|
+
`oldValue: ${a}, newValue: ${c}`,
|
|
653
659
|
`%c${t}%c`
|
|
654
660
|
);
|
|
655
661
|
try {
|
|
656
|
-
|
|
662
|
+
c = JSON.parse(c);
|
|
657
663
|
} catch {
|
|
658
664
|
}
|
|
659
|
-
const d = tt(
|
|
665
|
+
const d = tt(i);
|
|
660
666
|
if (d in this && y(this[d])) {
|
|
661
|
-
const
|
|
662
|
-
|
|
667
|
+
const f = this[d];
|
|
668
|
+
c === null ? (f.set(f.initValue), this.removeAttribute(i)) : f.set(c);
|
|
663
669
|
}
|
|
664
670
|
_(
|
|
665
671
|
this,
|
|
666
672
|
s.prototype.attributeChangedCallback,
|
|
667
|
-
|
|
673
|
+
i,
|
|
668
674
|
a,
|
|
669
|
-
|
|
675
|
+
c
|
|
670
676
|
);
|
|
671
677
|
}
|
|
672
678
|
connectedCallback() {
|
|
673
679
|
var a;
|
|
674
|
-
|
|
675
|
-
([
|
|
676
|
-
|
|
680
|
+
u("rwc: connectedCallback"), u("connectedCallback", `%c${t}%c`, this), this.providers && Object.keys(this.providers).length > 0 && (u("WRAPPER for providers", t), Object.entries(this.providers).forEach(
|
|
681
|
+
([c, d]) => {
|
|
682
|
+
u("register provider", c, d()), this.addEventListener(c, (f) => {
|
|
677
683
|
var b;
|
|
678
|
-
|
|
679
|
-
const p =
|
|
680
|
-
((b = p.detail) == null ? void 0 : b.context) ===
|
|
684
|
+
u("send provider", c, d());
|
|
685
|
+
const p = f;
|
|
686
|
+
((b = p.detail) == null ? void 0 : b.context) === c && (p.stopPropagation(), p.detail.callback(d));
|
|
681
687
|
});
|
|
682
688
|
}
|
|
683
|
-
)), this.checkInjects(), (a = s.prototype[
|
|
684
|
-
(
|
|
685
|
-
this[
|
|
686
|
-
const
|
|
689
|
+
)), this.checkInjects(), (a = s.prototype[k]) == null || a.forEach(
|
|
690
|
+
(c) => {
|
|
691
|
+
this[c] = (d) => {
|
|
692
|
+
const f = s.prototype[M][c], { bubbles: p, composed: b } = f;
|
|
687
693
|
y(d) ? m(() => {
|
|
688
|
-
|
|
689
|
-
new CustomEvent(
|
|
694
|
+
L("@oemit reactive value", d()), this.dispatchEvent(
|
|
695
|
+
new CustomEvent(c, {
|
|
690
696
|
detail: d(),
|
|
691
697
|
bubbles: p,
|
|
692
698
|
composed: b
|
|
693
699
|
})
|
|
694
700
|
);
|
|
695
|
-
}) : (
|
|
696
|
-
new CustomEvent(
|
|
701
|
+
}) : (L("@oemit value", d), this.dispatchEvent(
|
|
702
|
+
new CustomEvent(c, {
|
|
697
703
|
detail: d,
|
|
698
704
|
bubbles: p,
|
|
699
705
|
composed: b
|
|
@@ -701,48 +707,48 @@ const Et = i.div, Ht = i.span, _t = i.section, zt = i.input, Bt = i.button, Jt =
|
|
|
701
707
|
));
|
|
702
708
|
};
|
|
703
709
|
}
|
|
704
|
-
),
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
this.shadow.appendChild(
|
|
710
|
+
), u("start render", `%c${t}%c`, t);
|
|
711
|
+
const i = () => {
|
|
712
|
+
u("rwc: insertRenderTemplate");
|
|
713
|
+
const c = this.render();
|
|
714
|
+
this.shadow.appendChild(c.hostElement), _(this, s.prototype.connectedCallback), this.appendSlotContent();
|
|
709
715
|
};
|
|
710
716
|
if (this.rootStyle && !s.styles) {
|
|
711
|
-
const
|
|
717
|
+
const c = (p) => p instanceof Promise || Array.isArray(p) && p.every((b) => b instanceof Promise), d = this.rootStyle, f = (p) => {
|
|
712
718
|
const b = new CSSStyleSheet();
|
|
713
719
|
b.replaceSync(p), this.shadow.adoptedStyleSheets.push(b);
|
|
714
|
-
const
|
|
715
|
-
|
|
720
|
+
const h = new CSSStyleSheet();
|
|
721
|
+
h.replaceSync(p.slice(p.indexOf("@property"))), document.adoptedStyleSheets.push(h);
|
|
716
722
|
};
|
|
717
|
-
if (
|
|
723
|
+
if (c(d)) {
|
|
718
724
|
const p = [];
|
|
719
|
-
Array.isArray(d) ? p.push(...d) : p.push(d), Promise.all(p).then((b) => b.forEach((
|
|
725
|
+
Array.isArray(d) ? p.push(...d) : p.push(d), Promise.all(p).then((b) => b.forEach((h) => f(h.default))).then(() => i());
|
|
720
726
|
} else {
|
|
721
727
|
const p = [];
|
|
722
|
-
Array.isArray(d) ? p.push(...d) : p.push(d), p.forEach((b) =>
|
|
728
|
+
Array.isArray(d) ? p.push(...d) : p.push(d), p.forEach((b) => f(b)), i();
|
|
723
729
|
}
|
|
724
730
|
} else
|
|
725
|
-
|
|
726
|
-
this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((
|
|
727
|
-
|
|
731
|
+
i();
|
|
732
|
+
this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((c) => {
|
|
733
|
+
u(
|
|
728
734
|
this.slotContext,
|
|
729
|
-
this.slotContext && this.slotContext[
|
|
730
|
-
),
|
|
735
|
+
this.slotContext && this.slotContext[c.name]
|
|
736
|
+
), L(
|
|
731
737
|
"@bslot element",
|
|
732
|
-
|
|
733
|
-
`name:${
|
|
734
|
-
|
|
735
|
-
),
|
|
736
|
-
const
|
|
737
|
-
this.slotContext && y(
|
|
738
|
+
c,
|
|
739
|
+
`name:${c.name};`,
|
|
740
|
+
c.assignedElements()
|
|
741
|
+
), c.assignedElements().forEach((d) => {
|
|
742
|
+
const f = this.slotContext[c.name];
|
|
743
|
+
this.slotContext && y(f) && (L(
|
|
738
744
|
"@oslot element",
|
|
739
|
-
|
|
740
|
-
`name:${
|
|
741
|
-
|
|
745
|
+
c,
|
|
746
|
+
`name:${c.name};`,
|
|
747
|
+
c.assignedElements()
|
|
742
748
|
), m(() => {
|
|
743
749
|
d.dispatchEvent(
|
|
744
750
|
new CustomEvent("handleSlotContext", {
|
|
745
|
-
detail:
|
|
751
|
+
detail: f()
|
|
746
752
|
})
|
|
747
753
|
);
|
|
748
754
|
}));
|
|
@@ -758,124 +764,126 @@ const Et = i.div, Ht = i.span, _t = i.section, zt = i.input, Bt = i.button, Jt =
|
|
|
758
764
|
) : customElements.define(t, o), s.renderTagName = t, s;
|
|
759
765
|
};
|
|
760
766
|
export {
|
|
761
|
-
|
|
762
|
-
|
|
767
|
+
O as BaseElement,
|
|
768
|
+
se as a,
|
|
763
769
|
ht as addAttributeList,
|
|
764
|
-
|
|
765
|
-
|
|
770
|
+
ct as addClassList,
|
|
771
|
+
lt as addCustomAttributes,
|
|
766
772
|
U as addHtmlContent,
|
|
767
773
|
at as addReactiveClassList,
|
|
768
774
|
dt as addStyleList,
|
|
769
775
|
W as appendContentItem,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
776
|
+
ye as article,
|
|
777
|
+
Ee as aside,
|
|
778
|
+
ze as audio,
|
|
779
|
+
je as b,
|
|
780
|
+
gt as bindReactiveSignals,
|
|
781
|
+
Ae as blockquote,
|
|
782
|
+
de as br,
|
|
783
|
+
Jt as button,
|
|
784
|
+
$ as camelToKebab,
|
|
785
|
+
Je as canvas,
|
|
780
786
|
_ as checkCall,
|
|
781
|
-
|
|
787
|
+
Le as cite,
|
|
782
788
|
ot as classList,
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
789
|
+
xt as cls,
|
|
790
|
+
fe as code,
|
|
791
|
+
L as colorLog,
|
|
792
|
+
Ot as combineLatest,
|
|
786
793
|
yt as component,
|
|
787
|
-
|
|
794
|
+
Ne as createComponent,
|
|
788
795
|
Ct as createCustom,
|
|
789
796
|
mt as createCustomEl,
|
|
790
797
|
pt as createCustomElement,
|
|
791
798
|
H as createEl,
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
799
|
+
w as createElement,
|
|
800
|
+
Lt as createSignal,
|
|
801
|
+
Wt as defineSlotTemplate,
|
|
802
|
+
Ie as del,
|
|
803
|
+
Fe as details,
|
|
797
804
|
et as disableLogs,
|
|
798
805
|
Et as div,
|
|
799
806
|
m as effect,
|
|
807
|
+
V as effectMap,
|
|
800
808
|
P as elementHelpers,
|
|
801
|
-
|
|
809
|
+
Oe as em,
|
|
802
810
|
vt as enableLogs,
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
811
|
+
De as event,
|
|
812
|
+
Tt as eventEmitter,
|
|
813
|
+
ve as figcaption,
|
|
814
|
+
Se as figure,
|
|
815
|
+
Ce as footer,
|
|
808
816
|
Rt as forkJoin,
|
|
809
|
-
|
|
810
|
-
|
|
817
|
+
Zt as form,
|
|
818
|
+
$t as getList,
|
|
811
819
|
wt as getReactiveTemplate,
|
|
812
820
|
v as getSignalContent,
|
|
813
821
|
D as getTextContent,
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
+
oe as h1,
|
|
823
|
+
re as h2,
|
|
824
|
+
ie as h3,
|
|
825
|
+
le as h4,
|
|
826
|
+
ce as h5,
|
|
827
|
+
ae as h6,
|
|
828
|
+
me as header,
|
|
829
|
+
he as hr,
|
|
822
830
|
z as htmlEffectWrapper,
|
|
823
|
-
|
|
824
|
-
|
|
831
|
+
Te as i,
|
|
832
|
+
ee as img,
|
|
825
833
|
X as initComponent,
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
834
|
+
Bt as input,
|
|
835
|
+
Pe as ins,
|
|
836
|
+
jt as isBaseElement,
|
|
829
837
|
K as isComponentConfig,
|
|
830
|
-
|
|
838
|
+
x as isComponentInitConfig,
|
|
831
839
|
y as isReactiveSignal,
|
|
832
840
|
kt as isSlotTemplate,
|
|
833
841
|
tt as kebabToCamel,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
842
|
+
Qt as label,
|
|
843
|
+
Ut as li,
|
|
844
|
+
be as main,
|
|
837
845
|
Me as mark,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
846
|
+
_e as meter,
|
|
847
|
+
pe as nav,
|
|
848
|
+
Ft as newEventEmitter,
|
|
849
|
+
Xt as ol,
|
|
850
|
+
Kt as option,
|
|
851
|
+
ne as p,
|
|
852
|
+
ue as pre,
|
|
853
|
+
He as progress,
|
|
854
|
+
u as projectLog,
|
|
855
|
+
Ve as property,
|
|
848
856
|
Z as renderIf,
|
|
849
857
|
At as rs,
|
|
850
858
|
ft as rxRenderIf,
|
|
851
859
|
we as s,
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
860
|
+
zt as section,
|
|
861
|
+
Yt as select,
|
|
862
|
+
it as setChildren,
|
|
855
863
|
rt as setEffects,
|
|
856
864
|
nt as setHtmlContent,
|
|
857
865
|
q as setListeners,
|
|
858
|
-
|
|
866
|
+
Pt as show,
|
|
859
867
|
N as showIf,
|
|
860
|
-
|
|
868
|
+
A as signal,
|
|
861
869
|
ut as signalComponent,
|
|
862
|
-
|
|
870
|
+
qe as slot,
|
|
863
871
|
ge as small,
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
872
|
+
_t as span,
|
|
873
|
+
Re as strong,
|
|
874
|
+
$e as sub,
|
|
875
|
+
We as summary,
|
|
868
876
|
ke as sup,
|
|
869
|
-
|
|
870
|
-
|
|
877
|
+
qt as table,
|
|
878
|
+
Vt as td,
|
|
871
879
|
G as textContentWrapper,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
880
|
+
te as textarea,
|
|
881
|
+
Dt as th,
|
|
882
|
+
Nt as tr,
|
|
883
|
+
xe as u,
|
|
884
|
+
Gt as ul,
|
|
877
885
|
Mt as unsafeHtml,
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
886
|
+
Ht as useCustomComponent,
|
|
887
|
+
Be as video,
|
|
888
|
+
It as when
|
|
881
889
|
};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { IsPromise, IsPromiseFunction, UnwrapPromise } from './helpers.types';
|
|
2
2
|
import { CompareFn, ReactiveSignal, UnwrapSignal } from './signal.type';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const effectMap: Map<string, {
|
|
4
|
+
signals: Array<ReactiveSignal<any>>;
|
|
5
|
+
parent: string | null;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function signal<T = unknown>(initValue: T, config?: {
|
|
8
|
+
signalCompareFn?: CompareFn<T>;
|
|
4
9
|
name?: string;
|
|
5
10
|
}): ReactiveSignal<T>;
|
|
6
|
-
export declare function effect(cb: () => void,
|
|
11
|
+
export declare function effect(cb: () => void, config?: {
|
|
12
|
+
name?: string;
|
|
13
|
+
}): void;
|
|
7
14
|
export declare const isReactiveSignal: <R extends ReactiveSignal<any>>(v: R | any) => v is R;
|
|
8
15
|
/**
|
|
9
16
|
* Reactive String (rs). Создаёт зависимый string сигнал от источника.
|
|
@@ -13,6 +13,8 @@ export interface ReactiveSignal<T> {
|
|
|
13
13
|
update(cb: SignalUpdateFunc<T>): void;
|
|
14
14
|
clearSubscribers(): void;
|
|
15
15
|
peek(): Readonly<T>;
|
|
16
|
-
pipe<R>(fn: (sg: T) => R
|
|
16
|
+
pipe<R>(fn: (sg: T) => R, config?: {
|
|
17
|
+
name?: string;
|
|
18
|
+
}): ReactiveSignal<R extends Promise<any> ? UnwrapPromise<R> : UnwrapSignal<R>>;
|
|
17
19
|
}
|
|
18
20
|
export type UnwrapSignal<T> = T extends ReactiveSignal<infer U> ? U : T;
|
|
@@ -8,3 +8,4 @@ export declare function bindReactiveSignals<T>(signalA: ReactiveSignal<T>, signa
|
|
|
8
8
|
export declare function forkJoin<T extends readonly ReactiveSignal<unknown>[]>(...signals: T): ReactiveSignal<{
|
|
9
9
|
[K in keyof T]: UnwrapSignal<T[K]>;
|
|
10
10
|
}>;
|
|
11
|
+
export declare const combineLatest: <T extends readonly ReactiveSignal<any>[]>(...signals: T) => ReactiveSignal<{ [K in keyof T]: UnwrapSignal<T[K]>; }>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o.ReactiveComponent={}))})(this,function(o){"use strict";var Ge=Object.defineProperty;var Ne=(o,p,A)=>p in o?Ge(o,p,{enumerable:!0,configurable:!0,writable:!0,value:A}):o[p]=A;var E=(o,p,A)=>Ne(o,typeof p!="symbol"?p+"":p,A);const p=t=>t&&typeof t=="object"&&("classList"in t||"attributes"in t||"customAttributes"in t||"reactiveClassList"in t||"listeners"in t||"customListeners"in t||"children"in t||"effects"in t||"style"in t||Object.keys(t).some(e=>e.startsWith(".")||e.startsWith("@")||e.startsWith("$")))&&!("hostElement"in t),A=t=>t&&typeof t=="object"&&"hostElement"in t&&"append"in t&&"set"in t&&"addStyle"in t&&"setAttribute"in t&&"addClass"in t&&"addEffect"in t&&"addReactiveContent"in t&&"setReactiveContent"in t&&"clear"in t,F=(t,e,...n)=>{e&&e.apply(t,n)};let _=!0;const m=(...t)=>{_&&console.debug(["[rwc]",...t].join(" | "),...Array.from(t.join("").matchAll(/%c/gm)).map((e,n)=>n%2===0?"color:red":"color:inherit"))},I=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),Q=t=>t.replace(/-(\w)/gm,(e,n)=>n.toUpperCase()),L=(t,...e)=>{if(!_)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=t.match(/@[rgbpycow]/g)||[],i=s.map(c=>{const d=c.slice(1);return n[d]||"color: inherit"});let l=t;s.forEach(c=>{const d=new RegExp(`\\${c}([^\\s,]+)`,"g");l=l.replace(d,"%c$1")}),console.log(l,...i,...e)},pt=()=>{_=!0},Y=()=>{_=!1};Y();const K=new Map,O=new WeakMap,B=[],w=[];function R(t,e=()=>!0,n){const s=new Set;let i=e;function l(){var d;const c=B[B.length-1];if(c&&!("fake"in c&&c.fake)){const a=O.get(c),h=a==null?void 0:a.parent;if(h){const f=O.get(h);f==null||f.cleanupFns.add(()=>{s.delete(c)})}s.add(c),(d=K.get(c.effectId))==null||d.add(l)}return t}return l.effectId=(n==null?void 0:n.name)||Math.random().toString(36).substring(2,15),l.getSubscribers=()=>[...s],l.setCompareFn=function(c){return i=c,l},l.clearSubscribers=function(){s.clear()},l.peek=function(){return Object.freeze(t)},l.initValue=Object.freeze(t),l.oldValue=Object.freeze(t),l.forceSet=function(c){l.oldValue=Object.freeze(t),t=c,s.forEach(d=>Promise.resolve(d).then(a=>{const h=O.get(a);h&&h.cleanupFns.size>0&&(h.cleanupFns.forEach(f=>f()),h.cleanupFns.clear()),w.push(a),a(),w.pop()}))},l.set=function(c,d=i){t!==c&&d(t,c)&&l.forceSet(c)},l.update=function(c){l.set(c(t))},l.pipe=c=>{const d=R(null);return b(()=>{const a=l();b(()=>{const h=c(a);h instanceof Promise?h.then(f=>d.set(f)):v(h)?b(()=>d.set(h())):d.set(h)})}),d},l}function b(t,e){const n=e||Math.random().toString(36).substring(2,15);m("current effect",`%c${n}%c`);const s=t;t=()=>(m("current effect callback",`%c${n}%c`),s()),"fake"in s&&s.fake&&(t.fake=!0),K.set(n,new WeakSet),t.effectId=n;const i=w[w.length-1];O.has(t)||O.set(t,{cleanupFns:new Set});const l=O.get(t);i?l.parent=i:delete l.parent,w.push(t),B.push(t),t(),B.pop(),w.pop()}const v=t=>!!t&&["object","function"].includes(typeof t)&&"set"in t&&"oldValue"in t&&"update"in t&&"forceSet"in t;function Et(t,...e){const n=R("");return b(()=>{const s=e.map(l=>v(l)?String(l()):String(l)),i=[t[0]];s.forEach((l,c)=>{i.push(l,t[c+1])}),n.set(i.join(""))}),n}function yt(t,e){const n=R(e??null),s=i=>n.set(i);return t instanceof Promise?t.then(s):typeof t=="function"&&b(()=>{const i=t();i instanceof Promise?i.then(s):v(i)?b(()=>s(i())):s(i)}),n}function St(t,e){let n=t(),s=e();b(()=>{const i=t(),l=e();i!==l&&(i!==n?e.set(i):l!==s&&t.set(l)),n=i,s=l})}function vt(...t){let e=t.map(s=>s());const n=R(e);return t.forEach((s,i)=>{b(()=>{const l=()=>e.filter(c=>c!==void 0).length;l()===t.length&&(e=Array.from(e).fill(void 0)),e[i]=s(),l()===t.length&&n.set([...e])})}),n}class T extends HTMLElement{constructor(n=!1){super();E(this,"isSlotLazyLoading",!1);E(this,"slotTemplate");E(this,"slotContext");E(this,"rootStyle");E(this,"modelValue");E(this,"providers");E(this,"appendAllSlotContent");E(this,"allSlotContent",[]);E(this,"slotContent",{});E(this,"htmlSlotContent",{});E(this,"shadow");E(this,"injects",{});this.shadow=this.attachShadow({mode:n?"closed":"open"})}appendChild(n,s=!0){var i;if(this.isSlotLazyLoading&&s){if(n instanceof HTMLElement){const l=n.slot||"default";this.htmlSlotContent[l]||(this.htmlSlotContent[l]=[]),(i=this.htmlSlotContent[l])==null||i.push(n)}}else return super.appendChild(n)}appendSlotContent(){var n;(n=this.appendAllSlotContent)==null||n.call(this)}inject(n){return m("%cinject%c",n),this.injects[n]||(this.injects[n]=R(null)),this.injects[n]}checkInjects(){Object.entries(this.injects).forEach(([n,s])=>{m("%cinject%c",`%c${n}%c`,"from BaseElement (dispatch event)"),this.shadow.dispatchEvent(new CustomEvent(n,{detail:{context:n,callback:i=>b(()=>{s.set(i())})},bubbles:!0,composed:!0}))})}setReactiveValue(n){this.modelValue=n}}E(T,"observedAttributes",[]),E(T,"renderTagName",""),E(T,"styles");const gt=t=>"render"in t&&"setReactiveValue"in t,At="handleSlotContext",x="onConnected",Lt=()=>()=>{},G=t=>typeof t=="string"?t:JSON.stringify(t),N=t=>{const e=document.createElement("span");return e.textContent=G(t),e},V=(t,e)=>(t.appendChild(N(e)),t),tt=(t,e)=>(t.innerHTML="",V(t,e)),J=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=G(n)}),e},M=t=>({append(...e){return e.forEach(n=>{t.appendChild(n.hostElement),x in n.hostElement&&setTimeout(()=>{var s,i;(i=(s=n.hostElement).onConnected)==null||i.call(s,n,n.hostElement)})}),this},set(...e){this.clear();const n=document.createDocumentFragment();return e.forEach(s=>{n.appendChild(s.hostElement)}),t.appendChild(n),this},removeChild(...e){return e.forEach(n=>{Array.from(t.childNodes.values()).some(s=>s===n.hostElement)&&t.removeChild(n.hostElement)}),this},addHtmlContent(e){return V(t,e),this},setHtmlContent(e){return tt(t,e),this},addEventlistener(e,n,s=!1){return t.addEventListener(e,i=>n(i,this,t),s),this},setAttribute(e,n){let s;if(typeof n=="boolean"&&!(t instanceof T))if(n)s="";else{this.removeAttribute(e);const i=e.toLowerCase();return i in t&&(t[i]=null),this}else typeof n!="string"?s=JSON.stringify(n):s=n;if(t.setAttribute(I(e),s),!(t instanceof T)){const i=e.toLowerCase();i in t&&(t[i]=n)}return this},setCustomAttribute(e,n){let s;return typeof n!="string"?s=JSON.stringify(n):s=n,t.setAttribute(I(e),s),this},setReactiveAttribute(e,n){return b(()=>this.setAttribute(e,n())),this},setReactiveCustomAttribute(e,n){return b(()=>this.setCustomAttribute(e,n())),this},removeAttribute(e){return t.removeAttribute(I(e)),this},addStyle(e){return Object.entries(e).forEach(([n,s])=>{const i=n.startsWith("--");typeof s=="function"?this.addEffect(()=>{if(i){const l=String(s()||"");t.style.setProperty(n,l)}else t.style[n]=s()}):typeof s=="string"&&(i?t.style.setProperty(n,s):t.style[n]=s)}),this},onConnected(e){return Reflect.defineProperty(t,x,{get(){return e}}),this},addClass(...e){return e.forEach(n=>{typeof n=="string"?t.classList.add(...n.split(" ").flatMap(s=>s.split(`
|
|
2
|
-
`)).map(s=>s.trim()).filter(Boolean)):(()=>{let s=null;this.addEffect(()=>{const i=n();i.length>0&&(s?this.replaceClass(s,i):this.addClass(i),s=i)})})()}),this},setClass(...e){return t.classList.remove(...t.classList),t.classList.add(...e),this},addReactiveClass(e){return Object.keys(e).forEach(n=>{b(()=>{e[n]()?this.addClass(n):this.removeClass(n)})}),this},removeClass(...e){return t.classList.remove(...e),this},replaceClass(e,n){return t.classList.replace(e,n),this},addEffect(e){return b(()=>e(this,this.hostElement)),this},addReactiveContent(e){return t.appendChild(J(e)),this},setReactiveContent(e){return this.clear(),t.appendChild(J(e)),this},clear(){return t.innerHTML="",this},hostElement:t}),et=(t,...e)=>({classList:[...t.map(n=>n.trim()).filter(Boolean),...e]}),Rt=(t,...e)=>et(t,...e),D=(t,e)=>{if(!e)return t;const n=Object.keys(e||{}).filter(s=>s.startsWith(".")||s.startsWith("@")||s.startsWith("$"));return n.filter(s=>s.startsWith(".")).forEach(s=>{e!=null&&e.attributes||(e.attributes={}),e.attributes[s.slice(1)]=e[s]}),n.filter(s=>s.startsWith("@")).forEach(s=>{e!=null&&e.listeners||(e.listeners={});const i=s.slice(1);e.listeners[i]=e[s]}),n.filter(s=>s.startsWith("$")).forEach(s=>{e!=null&&e.effects||(e.effects=[]),e.effects.push(e[s])}),it(t,e.classList),ct(t,e.style),rt(t,e.attributes),lt(t,e.reactiveClassList),ot(t,e.customAttributes),st(t,e.children),nt(t,e.effects),U(t,e.listeners),U(t,e.customListeners),t},U=(t,e)=>{e&&Object.entries(e).forEach(([n,s])=>{typeof s=="function"&&t.addEventlistener(n,s)})},nt=(t,e)=>e==null?void 0:e.forEach(n=>t.addEffect(n)),st=(t,e)=>$(t,...e||[]),ot=(t,e)=>{const n=e;n&&Object.keys(n).forEach(s=>{v(n[s])?t.setReactiveCustomAttribute(s,n[s]):typeof n[s]=="function"?t.addEffect(()=>{t.setCustomAttribute(s,n[s]())}):t.setCustomAttribute(s,n[s])})},it=(t,e)=>t.addClass(...e||[]),lt=(t,e)=>t.addReactiveClass(e||{}),ct=(t,e)=>t.addStyle(e||{}),rt=(t,e)=>{const n=e,s=(i,l)=>{l&&(v(l)?t.setReactiveAttribute(i,l):typeof l=="function"?t.addEffect(()=>{t.setAttribute(i,l())}):t.setAttribute(i,l))};n&&Object.keys(n).forEach(i=>{s(i,n[i])})},$=(t,...e)=>(e.forEach(n=>{typeof n=="string"?n.trim().length>0&&t.addHtmlContent(n):v(n)?t.addReactiveContent(n):t.append(n)}),t),k=(t,e)=>{const n=document.createElement(t),s={...M(n)};return D(s,e)},P=(t,e)=>{const[n,...s]=t.split(" ").map(l=>l.trim()),i=k(n,e);return s.length>0&&i.addClass(...s),(...l)=>$(i,...l.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?g(()=>c(i)):c))},g=t=>k("div").addStyle({display:"contents"}).addEffect(e=>{const n=t(),s=[];Array.isArray(n)?s.push(...n):s.push(n),e.clear(),$(e,...s)}),Tt=t=>{const e=s=>typeof s=="string"?s.trim().length>0?M(N(s)):P("div")():v(s)?M(J(s)):s;return at(()=>{const s=t();return s instanceof Array&&Array.isArray(s)?s.map(e):e(s)})},jt=(t,e,n)=>{const s=k("div").addStyle({display:"contents"}),i=new Map,l=new Map;let c=[];const d=new Set;let a=t.peek();const h=f=>{d.delete(f),i.delete(f),l.delete(f)};return b(()=>{const f=t();c=f.map(e).map(u=>typeof u=="string"?u:u.toString());const C=Array.from(s.hostElement.children);m("containerChildren",C,c),C.forEach(u=>{const S=u.dataset.key;c.includes(S)||(m("remove element",S,u),u.remove(),h(S))}),c.forEach(u=>{var W,j;const S=f[c.indexOf(u)];i.has(u)?JSON.stringify(S)!==JSON.stringify(a[c.indexOf(u)])&&((W=s.hostElement.querySelector(`[data-key="${u}"]`))==null||W.remove(),(j=i.get(u))==null||j.set(Math.random().toString(36).substring(2,15)),l.set(u,()=>n(S,c.indexOf(u),f).setCustomAttribute("data-key",u))):(m("create new element",u,S),i.set(u,R(Math.random().toString(36).substring(2,15))),l.set(u,()=>n(S,c.indexOf(u),f).setCustomAttribute("data-key",u)))}),a=f;const y=()=>{i.forEach((u,S)=>{m("key from setTimeout foreach currItemSignalMap",S),d.has(S)||(d.add(S),b(()=>{var bt;u();const W=c.indexOf(S),j=(bt=l.get(S))==null?void 0:bt();j&&(m("call effect from setTimeout",S,j.hostElement),W<=s.hostElement.children.length-1?s.hostElement.insertBefore(j.hostElement,s.hostElement.children[W]):s.hostElement.append(j.hostElement))}))})};Promise.resolve().then(()=>y())}),s},at=t=>{let e=[k("div")],n=!1;return b(()=>{var l,c;const s=t();n=Array.isArray(s);const i=[];i.push(...[s].flat()),i.length===0&&i.push(k("div").addStyle({display:"none"}).setAttribute("id","empty_template"));try{m("newReactiveComponent.map",i.map(d=>{var a;return m("newReactiveComponent hostElement",d.hostElement),(a=d.hostElement)==null?void 0:a.id})),m("currComponent[0].hostElement?.id",(l=e[0].hostElement)==null?void 0:l.id,e),(c=e[0].hostElement)==null||c.replaceWith(...i.map(d=>d.hostElement)),e.slice(1).forEach(d=>{var a;return(a=d.hostElement)==null?void 0:a.remove()}),e=i}catch(d){console.error(d)}}),n?e:e[0]},Ot=t=>At in t,wt=t=>{const e=P("div")().addStyle({display:"contents"}),n=s=>(e.hostElement.innerHTML=s,e);return typeof t=="string"?n(t):e.addEffect(()=>{n(t())}),e},X=(t,e,n)=>t?g(e):n?g(n):P("div")().setAttribute("id","empty_div_renderIf").addStyle({display:"none"}),dt=(t,e,n)=>g(()=>X(!!t(),e,n)),kt=(t,e,n)=>typeof t=="boolean"?X(t,e,n):dt(t,e,n),Z=(t,e)=>{const n=g(e);return typeof t=="boolean"?[n].flat().forEach(s=>s.hostElement.style.display=t?"block":"none"):b(()=>{const s=t()?"block":"none";[n].flat().forEach(i=>i.hostElement.style.display=s)}),n},It=(t,e,n)=>{const s=[Z(t,e)].flat();return n&&s.push(...[Z(()=>typeof t=="boolean"?!t:!t(),n)].flat()),g(()=>s)},ht=(t,e)=>{m("createCustomElement",t);const n=document.createElement(t),s={...M(n),setReactiveValue(i){return n instanceof T&&n.setReactiveValue(i),this},setSlotTemplate(i){const l=n.slotTemplate;return l&&Object.entries(i).forEach(([c,d])=>{l[c]=d}),this}};return D(s,e)},ft=(t,e)=>{const n=t.split(" ").slice(1).map(i=>i.trim()),s=ht(t.split(" ")[0],e);return Array.isArray(n)&&n.length>0&&s.addClass(...n),(...i)=>{L("@rcreateCustomEl content",t,i);const l=i.filter(Boolean).flat().flatMap(c=>typeof c=="function"&&!v(c)?g(()=>c(s)):c);return s.hostElement.allSlotContent=l,s.hostElement.slotContent=l.filter(A).reduce((c,d)=>{const a=d.hostElement.getAttribute("slot")||"default";return c[a]||(c[a]=[]),c[a].push(d),c},{}),s.hostElement.appendAllSlotContent=()=>$(s,...l),s}},ut=(t,e,n)=>ft(`${t.renderTagName}${e&&typeof e=="string"?" "+e:""}`,p(e)?e:e&&typeof e=="string"?n:void 0),Mt=()=>{const t=()=>{};return t.oldValue=null,t},$t=()=>({}),Pt=(t,e,n)=>{const s=e?Ct(e,n)(t):t;return(i,...l)=>{const c=[...l];return i&&!p(i)&&c.unshift(i),ut(s,p(i)?i:{})(...c)}},r={};["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(t=>{r[t]=(e,...n)=>{let s=[...n];return e&&!p(e)&&(s=[e].concat(s)),P(t,p(e)?e:{})(...s)}});const mt=r.div,Ht=r.span,Wt=r.section,Ft=r.input,_t=r.button,Bt=r.table,Jt=r.tr,zt=r.td,qt=r.th,Gt=r.ul,Nt=r.li,Vt=r.ol,Dt=r.form,Ut=r.label,Xt=r.select,Zt=r.option,Qt=r.textarea,Yt=r.img,Kt=r.a,xt=r.p,te=r.h1,ee=r.h2,ne=r.h3,se=r.h4,oe=r.h5,ie=r.h6,le=r.br,ce=r.hr,re=r.pre,ae=r.code,de=r.nav,he=r.header,fe=r.footer,ue=r.main,me=r.aside,Ce=r.article,be=r.figure,pe=r.figcaption,Ee=r.blockquote,ye=r.cite,Se=r.small,ve=r.strong,ge=r.em,Ae=r.b,Le=r.i,Re=r.u,Te=r.s,je=r.sub,Oe=r.sup,we=r.mark,ke=r.del,Ie=r.ins,Me=r.details,$e=r.summary,Pe=r.progress,He=r.meter,We=r.audio,Fe=r.video,_e=r.canvas,Be=r.slot,Je=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{}),z="eventProps",q="EVENT_CONFIG",H="observedAttributes",ze=()=>(t,e)=>{Reflect.get(t,H)||Reflect.defineProperty(t,H,{value:[]}),Reflect.get(t,H).push(I(e))},qe=t=>(e,n)=>{Reflect.get(e,z)||Reflect.defineProperty(e,z,{value:[]}),Reflect.get(e,q)||Reflect.defineProperty(e,q,{value:{}}),Reflect.get(e,q)[n]={bubbles:(t==null?void 0:t.bubbles)??!1,composed:(t==null?void 0:t.composed)??!1},Reflect.get(e,z).push(n)},Ct=(t,e=!1)=>n=>{m(t,"start register static attr",n.prototype[H]);const s=[];if(n.styles){const l=n.styles,c=[];Array.isArray(l)?c.push(...l):c.push(l),c.forEach(d=>{const a=new CSSStyleSheet;a.replaceSync(d),s.push(a);const h=new CSSStyleSheet;h.replaceSync(d.slice(d.indexOf("@property"))),document.adoptedStyleSheets.push(h)})}class i extends n{constructor(...c){m("constructor",`%c${t}%c`),super(e,...c),L("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){m("rwc: render from new class");let c=mt();const d=()=>{m("wrapperEffectCallback"),c=n.prototype.render.call(this)};return d.fake=!0,b(d),c}attributeChangedCallback(c,d,a){m("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${d}, newValue: ${a}`,`%c${t}%c`);try{a=JSON.parse(a)}catch{}const h=Q(c);if(h in this&&v(this[h])){const f=this[h];a===null?(f.set(f.initValue),this.removeAttribute(c)):f.set(a)}F(this,n.prototype.attributeChangedCallback,c,d,a)}connectedCallback(){var d;m("rwc: connectedCallback"),m("connectedCallback",`%c${t}%c`,this),this.providers&&Object.keys(this.providers).length>0&&(m("WRAPPER for providers",t),Object.entries(this.providers).forEach(([a,h])=>{m("register provider",a,h()),this.addEventListener(a,f=>{var y;m("send provider",a,h());const C=f;((y=C.detail)==null?void 0:y.context)===a&&(C.stopPropagation(),C.detail.callback(h))})})),this.checkInjects(),(d=n.prototype[z])==null||d.forEach(a=>{this[a]=h=>{const f=n.prototype[q][a],{bubbles:C,composed:y}=f;v(h)?b(()=>{L("@oemit reactive value",h()),this.dispatchEvent(new CustomEvent(a,{detail:h(),bubbles:C,composed:y}))}):(L("@oemit value",h),this.dispatchEvent(new CustomEvent(a,{detail:h,bubbles:C,composed:y})))}}),m("start render",`%c${t}%c`,t);const c=()=>{m("rwc: insertRenderTemplate");const a=this.render();this.shadow.appendChild(a.hostElement),F(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const a=C=>C instanceof Promise||Array.isArray(C)&&C.every(y=>y instanceof Promise),h=this.rootStyle,f=C=>{const y=new CSSStyleSheet;y.replaceSync(C),this.shadow.adoptedStyleSheets.push(y);const u=new CSSStyleSheet;u.replaceSync(C.slice(C.indexOf("@property"))),document.adoptedStyleSheets.push(u)};if(a(h)){const C=[];Array.isArray(h)?C.push(...h):C.push(h),Promise.all(C).then(y=>y.forEach(u=>f(u.default))).then(()=>c())}else{const C=[];Array.isArray(h)?C.push(...h):C.push(h),C.forEach(y=>f(y)),c()}}else c();this.slotContext&&Object.keys(this.slotContext).length>0&&this.shadow.querySelectorAll("slot").forEach(a=>{m(this.slotContext,this.slotContext&&this.slotContext[a.name]),L("@bslot element",a,`name:${a.name};`,a.assignedElements()),a.assignedElements().forEach(h=>{const f=this.slotContext[a.name];this.slotContext&&v(f)&&(L("@oslot element",a,`name:${a.name};`,a.assignedElements()),b(()=>{h.dispatchEvent(new CustomEvent("handleSlotContext",{detail:f()}))}))})})}disconnectedCallback(){this.shadow.replaceChildren(),this.replaceChildren(),F(this,n.prototype.disconnectedCallback)}}return E(i,"observedAttributes",n.prototype[H]??[]),E(i,"renderTagName",t),i.toString=()=>t,customElements.get(t)?console.error(`название тега ${t} повторяется, компонент ${n.name} не зарегистрирован`):customElements.define(t,i),n.renderTagName=t,n};o.BaseElement=T,o.a=Kt,o.addAttributeList=rt,o.addClassList=it,o.addCustomAttributes=ot,o.addHtmlContent=V,o.addReactiveClassList=lt,o.addStyleList=ct,o.appendContentItem=$,o.article=Ce,o.aside=me,o.audio=We,o.b=Ae,o.bindReactiveSignals=St,o.blockquote=Ee,o.br=le,o.button=_t,o.camelToKebab=I,o.canvas=_e,o.checkCall=F,o.cite=ye,o.classList=et,o.cls=Rt,o.code=ae,o.colorLog=L,o.component=Ct,o.createComponent=Je,o.createCustom=ut,o.createCustomEl=ft,o.createCustomElement=ht,o.createEl=P,o.createElement=k,o.createSignal=yt,o.defineSlotTemplate=$t,o.del=ke,o.details=Me,o.disableLogs=Y,o.div=mt,o.effect=b,o.elementHelpers=M,o.em=ge,o.enableLogs=pt,o.event=qe,o.eventEmitter=Lt,o.figcaption=pe,o.figure=be,o.footer=fe,o.forkJoin=vt,o.form=Dt,o.getList=jt,o.getReactiveTemplate=Tt,o.getSignalContent=g,o.getTextContent=G,o.h1=te,o.h2=ee,o.h3=ne,o.h4=se,o.h5=oe,o.h6=ie,o.header=he,o.hr=ce,o.htmlEffectWrapper=J,o.i=Le,o.img=Yt,o.initComponent=D,o.input=Ft,o.ins=Ie,o.isBaseElement=gt,o.isComponentConfig=A,o.isComponentInitConfig=p,o.isReactiveSignal=v,o.isSlotTemplate=Ot,o.kebabToCamel=Q,o.label=Ut,o.li=Nt,o.main=ue,o.mark=we,o.meter=He,o.nav=de,o.newEventEmitter=Mt,o.ol=Vt,o.option=Zt,o.p=xt,o.pre=re,o.progress=Pe,o.projectLog=m,o.property=ze,o.renderIf=X,o.rs=Et,o.rxRenderIf=dt,o.s=Te,o.section=Wt,o.select=Xt,o.setChildren=st,o.setEffects=nt,o.setHtmlContent=tt,o.setListeners=U,o.show=It,o.showIf=Z,o.signal=R,o.signalComponent=at,o.slot=Be,o.small=Se,o.span=Ht,o.strong=ve,o.sub=je,o.summary=$e,o.sup=Oe,o.table=Bt,o.td=zt,o.textContentWrapper=N,o.textarea=Qt,o.th=qt,o.tr=Jt,o.u=Re,o.ul=Gt,o.unsafeHtml=wt,o.useCustomComponent=Pt,o.video=Fe,o.when=kt,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|