@reactive-web-components/rwc 2.52.1 → 2.53.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactive-web-components/rwc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.53.2",
|
|
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.DynDjiJs.js",
|
|
10
|
+
"require": "./reactive-web-component.CuYL3_1d.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.DynDjiJs.js",
|
|
38
|
+
"main": "./reactive-web-component.CuYL3_1d.umd.cjs"
|
|
39
39
|
}
|
|
@@ -1,2 +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 qe=Object.defineProperty;var Ge=(o,p,A)=>p in o?qe(o,p,{enumerable:!0,configurable:!0,writable:!0,value:A}):o[p]=A;var E=(o,p,A)=>Ge(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,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()}`),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)},bt=()=>{_=!0},Y=()=>{_=!1};Y();const O=new WeakMap,B=[],w=[];function R(t,e=()=>!0){const n=new Set;let s=e;function i(){const l=B[B.length-1];if(l&&!("fake"in l&&l.fake)){const c=O.get(l),d=c==null?void 0:c.parent;if(d){const a=O.get(d);a==null||a.cleanupFns.add(()=>{n.delete(l)})}n.add(l)}return t}return 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=>{const c=R(null);return b(()=>{const d=
|
|
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 qe=Object.defineProperty;var Ge=(o,p,A)=>p in o?qe(o,p,{enumerable:!0,configurable:!0,writable:!0,value:A}):o[p]=A;var E=(o,p,A)=>Ge(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,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()}`),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)},bt=()=>{_=!0},Y=()=>{_=!1};Y();const O=new WeakMap,B=[],w=[];function R(t,e=()=>!0){const n=new Set;let s=e;function i(){const l=B[B.length-1];if(l&&!("fake"in l&&l.fake)){const c=O.get(l),d=c==null?void 0:c.parent;if(d){const a=O.get(d);a==null||a.cleanupFns.add(()=>{n.delete(l)})}n.add(l)}return t}return 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=>{const c=R(null);return b(()=>{const d=i();b(()=>{const a=l(d);a instanceof Promise?a.then(h=>c.set(h)):v(a)?b(()=>c.set(a())):c.set(a)})}),c},i}function b(t){const e=Math.random().toString(36).substring(2,15);f("current effect",`%c${e}%c`);const n=t;t=()=>(f("current effect callback",`%c${e}%c`),n());const s=w[w.length-1];O.has(t)||O.set(t,{cleanupFns:new Set});const i=O.get(t);s?i.parent=s:delete i.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 pt(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 Et(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 yt(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 St(...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 f("%cinject%c",n),this.injects[n]||(this.injects[n]=R(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 vt=t=>"render"in t&&"setReactiveValue"in t,gt="handleSlotContext",K="onConnected",At=()=>()=>{},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),x=(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),K 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 x(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,K,{get(){return e}}),this},addClass(...e){return e.forEach(n=>{typeof n=="string"?t.classList.add(...n.split(" ").flatMap(s=>s.split(`
|
|
2
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}),tt=(t,...e)=>({classList:[...t.map(n=>n.trim()).filter(Boolean),...e]}),Lt=(t,...e)=>tt(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])}),ot(t,e.classList),lt(t,e.style),ct(t,e.attributes),it(t,e.reactiveClassList),st(t,e.customAttributes),nt(t,e.children),et(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)})},et=(t,e)=>e==null?void 0:e.forEach(n=>t.addEffect(n)),nt=(t,e)=>$(t,...e||[]),st=(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])})},ot=(t,e)=>t.addClass(...e||[]),it=(t,e)=>t.addReactiveClass(e||{}),lt=(t,e)=>t.addStyle(e||{}),ct=(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)}),Rt=t=>{const e=s=>typeof s=="string"?s.trim().length>0?M(N(s)):P("div")():v(s)?M(J(s)):s;return rt(()=>{const s=t();return s instanceof Array&&Array.isArray(s)?s.map(e):e(s)})},Tt=(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=C=>{d.delete(C),i.delete(C),l.delete(C)};return b(()=>{const C=t();c=C.map(e).map(u=>typeof u=="string"?u:u.toString());const m=Array.from(s.hostElement.children);f("containerChildren",m,c),m.forEach(u=>{const S=u.dataset.key;c.includes(S)||(f("remove element",S,u),u.remove(),h(S))}),c.forEach(u=>{var F,j;const S=C[c.indexOf(u)];i.has(u)?JSON.stringify(S)!==JSON.stringify(a[c.indexOf(u)])&&((F=s.hostElement.querySelector(`[data-key="${u}"]`))==null||F.remove(),(j=i.get(u))==null||j.set(Math.random().toString(36).substring(2,15)),l.set(u,()=>n(S,c.indexOf(u),C).setCustomAttribute("data-key",u))):(f("create new element",u,S),i.set(u,R(Math.random().toString(36).substring(2,15))),l.set(u,()=>n(S,c.indexOf(u),C).setCustomAttribute("data-key",u)))}),a=C;const y=()=>{i.forEach((u,S)=>{f("key from setTimeout foreach currItemSignalMap",S),d.has(S)||(d.add(S),b(()=>{var Ct;u();const F=c.indexOf(S),j=(Ct=l.get(S))==null?void 0:Ct();j&&(f("call effect from setTimeout",S,j.hostElement),F<=s.hostElement.children.length-1?s.hostElement.insertBefore(j.hostElement,s.hostElement.children[F]):s.hostElement.append(j.hostElement))}))})};Promise.resolve().then(()=>y())}),s},rt=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]},jt=t=>gt in t,Ot=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"}),at=(t,e,n)=>g(()=>X(!!t(),e,n)),wt=(t,e,n)=>typeof t=="boolean"?X(t,e,n):at(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},kt=(t,e,n)=>{const s=[Z(t,e)].flat();return n&&s.push(...[Z(()=>typeof t=="boolean"?!t:!t(),n)].flat()),g(()=>s)},dt=(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 D(s,e)},ht=(t,e)=>{const n=t.split(" ").slice(1).map(i=>i.trim()),s=dt(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)=>ht(`${t.renderTagName}${e&&typeof e=="string"?" "+e:""}`,p(e)?e:e&&typeof e=="string"?n:void 0),It=()=>{const t=()=>{};return t.oldValue=null,t},Mt=()=>({}),$t=(t,e,n)=>{const s=e?mt(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 ft=r.div,Pt=r.span,Ht=r.section,Ft=r.input,Wt=r.button,_t=r.table,Bt=r.tr,Jt=r.td,zt=r.th,qt=r.ul,Gt=r.li,Nt=r.ol,Vt=r.form,Dt=r.label,Ut=r.select,Xt=r.option,Zt=r.textarea,Qt=r.img,Yt=r.a,Kt=r.p,xt=r.h1,te=r.h2,ee=r.h3,ne=r.h4,se=r.h5,oe=r.h6,ie=r.br,le=r.hr,ce=r.pre,re=r.code,ae=r.nav,de=r.header,he=r.footer,ue=r.main,fe=r.aside,me=r.article,Ce=r.figure,be=r.figcaption,pe=r.blockquote,Ee=r.cite,ye=r.small,Se=r.strong,ve=r.em,ge=r.b,Ae=r.i,Le=r.u,Re=r.s,Te=r.sub,je=r.sup,Oe=r.mark,we=r.del,ke=r.ins,Ie=r.details,Me=r.summary,$e=r.progress,Pe=r.meter,He=r.audio,Fe=r.video,We=r.canvas,_e=r.slot,Be=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{}),z="eventProps",q="EVENT_CONFIG",H="observedAttributes",Je=()=>(t,e)=>{Reflect.get(t,H)||Reflect.defineProperty(t,H,{value:[]}),Reflect.get(t,H).push(I(e))},ze=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)},mt=(t,e=!1)=>n=>{f(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){f("constructor",`%c${t}%c`),super(e,...c),L("@osheet",s),s.length>0&&this.shadow.adoptedStyleSheets.push(...s)}render(){f("rwc: render from new class");let c=ft();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=Q(c);if(h in this&&v(this[h])){const C=this[h];a===null?(C.set(C.initValue),this.removeAttribute(c)):C.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,C=>{var y;f("send provider",a,h());const m=C;((y=m.detail)==null?void 0:y.context)===a&&(m.stopPropagation(),m.detail.callback(h))})})),this.checkInjects(),(d=n.prototype[z])==null||d.forEach(a=>{this[a]=h=>{const C=n.prototype[q][a],{bubbles:m,composed:y}=C;v(h)?b(()=>{L("@oemit reactive value",h()),this.dispatchEvent(new CustomEvent(a,{detail:h(),bubbles:m,composed:y}))}):(L("@oemit value",h),this.dispatchEvent(new CustomEvent(a,{detail:h,bubbles:m,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=m=>m instanceof Promise||Array.isArray(m)&&m.every(y=>y instanceof Promise),h=this.rootStyle,C=m=>{const y=new CSSStyleSheet;y.replaceSync(m),this.shadow.adoptedStyleSheets.push(y);const u=new CSSStyleSheet;u.replaceSync(m.slice(m.indexOf("@property"))),document.adoptedStyleSheets.push(u)};if(a(h)){const m=[];Array.isArray(h)?m.push(...h):m.push(h),Promise.all(m).then(y=>y.forEach(u=>C(u.default))).then(()=>c())}else{const m=[];Array.isArray(h)?m.push(...h):m.push(h),m.forEach(y=>C(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]),L("@bslot element",a,`name:${a.name};`,a.assignedElements()),a.assignedElements().forEach(h=>{const C=this.slotContext[a.name];this.slotContext&&v(C)&&(L("@oslot element",a,`name:${a.name};`,a.assignedElements()),b(()=>{h.dispatchEvent(new CustomEvent("handleSlotContext",{detail:C()}))}))})})}disconnectedCallback(){this.shadow.replaceChildren(),this.replaceChildren(),W(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=Yt,o.addAttributeList=ct,o.addClassList=ot,o.addCustomAttributes=st,o.addHtmlContent=V,o.addReactiveClassList=it,o.addStyleList=lt,o.appendContentItem=$,o.article=me,o.aside=fe,o.audio=He,o.b=ge,o.bindReactiveSignals=yt,o.blockquote=pe,o.br=ie,o.button=Wt,o.camelToKebab=I,o.canvas=We,o.checkCall=W,o.cite=Ee,o.classList=tt,o.cls=Lt,o.code=re,o.colorLog=L,o.component=mt,o.createComponent=Be,o.createCustom=ut,o.createCustomEl=ht,o.createCustomElement=dt,o.createEl=P,o.createElement=k,o.createSignal=Et,o.defineSlotTemplate=Mt,o.del=we,o.details=Ie,o.disableLogs=Y,o.div=ft,o.effect=b,o.elementHelpers=M,o.em=ve,o.enableLogs=bt,o.event=ze,o.eventEmitter=At,o.figcaption=be,o.figure=Ce,o.footer=he,o.forkJoin=St,o.form=Vt,o.getList=Tt,o.getReactiveTemplate=Rt,o.getSignalContent=g,o.getTextContent=G,o.h1=xt,o.h2=te,o.h3=ee,o.h4=ne,o.h5=se,o.h6=oe,o.header=de,o.hr=le,o.htmlEffectWrapper=J,o.i=Ae,o.img=Qt,o.initComponent=D,o.input=Ft,o.ins=ke,o.isBaseElement=vt,o.isComponentConfig=A,o.isComponentInitConfig=p,o.isReactiveSignal=v,o.isSlotTemplate=jt,o.kebabToCamel=Q,o.label=Dt,o.li=Gt,o.main=ue,o.mark=Oe,o.meter=Pe,o.nav=ae,o.newEventEmitter=It,o.ol=Nt,o.option=Xt,o.p=Kt,o.pre=ce,o.progress=$e,o.projectLog=f,o.property=Je,o.renderIf=X,o.rs=pt,o.rxRenderIf=at,o.s=Re,o.section=Ht,o.select=Ut,o.setChildren=nt,o.setEffects=et,o.setHtmlContent=x,o.setListeners=U,o.show=kt,o.showIf=Z,o.signal=R,o.signalComponent=rt,o.slot=_e,o.small=ye,o.span=Pt,o.strong=Se,o.sub=Te,o.summary=Me,o.sup=je,o.table=_t,o.td=Jt,o.textContentWrapper=N,o.textarea=Zt,o.th=zt,o.tr=Bt,o.u=Le,o.ul=qt,o.unsafeHtml=Ot,o.useCustomComponent=$t,o.video=Fe,o.when=wt,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -55,8 +55,8 @@ function O(t, e = () => !0) {
|
|
|
55
55
|
if (r && !("fake" in r && r.fake)) {
|
|
56
56
|
const c = L.get(r), a = c == null ? void 0 : c.parent;
|
|
57
57
|
if (a) {
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const i = L.get(a);
|
|
59
|
+
i == null || i.cleanupFns.add(() => {
|
|
60
60
|
s.delete(r);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -72,8 +72,8 @@ function O(t, e = () => !0) {
|
|
|
72
72
|
return Object.freeze(t);
|
|
73
73
|
}, o.initValue = Object.freeze(t), o.oldValue = Object.freeze(t), o.forceSet = function(r) {
|
|
74
74
|
o.oldValue = Object.freeze(t), t = r, s.forEach((c) => Promise.resolve(c).then((a) => {
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const i = L.get(a);
|
|
76
|
+
i && i.cleanupFns.size > 0 && (i.cleanupFns.forEach((d) => d()), i.cleanupFns.clear()), g.push(a), a(), g.pop();
|
|
77
77
|
}));
|
|
78
78
|
}, o.set = function(r, c = n) {
|
|
79
79
|
t !== r && c(t, r) && o.forceSet(r);
|
|
@@ -82,8 +82,11 @@ function O(t, e = () => !0) {
|
|
|
82
82
|
}, o.pipe = (r) => {
|
|
83
83
|
const c = O(null);
|
|
84
84
|
return m(() => {
|
|
85
|
-
const a =
|
|
86
|
-
|
|
85
|
+
const a = o();
|
|
86
|
+
m(() => {
|
|
87
|
+
const i = r(a);
|
|
88
|
+
i instanceof Promise ? i.then((d) => c.set(d)) : y(i) ? m(() => c.set(i())) : c.set(i);
|
|
89
|
+
});
|
|
87
90
|
}), c;
|
|
88
91
|
}, o;
|
|
89
92
|
}
|
|
@@ -394,7 +397,7 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
394
397
|
const n = w("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
395
398
|
let c = [];
|
|
396
399
|
const a = /* @__PURE__ */ new Set();
|
|
397
|
-
let
|
|
400
|
+
let i = t.peek();
|
|
398
401
|
const d = (p) => {
|
|
399
402
|
a.delete(p), o.delete(p), r.delete(p);
|
|
400
403
|
};
|
|
@@ -408,7 +411,7 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
408
411
|
}), c.forEach((h) => {
|
|
409
412
|
var j, S;
|
|
410
413
|
const E = p[c.indexOf(h)];
|
|
411
|
-
o.has(h) ? JSON.stringify(E) !== JSON.stringify(
|
|
414
|
+
o.has(h) ? JSON.stringify(E) !== JSON.stringify(i[c.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(
|
|
412
415
|
h,
|
|
413
416
|
() => s(E, c.indexOf(h), p).setCustomAttribute(
|
|
414
417
|
"data-key",
|
|
@@ -424,7 +427,7 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
424
427
|
h
|
|
425
428
|
)
|
|
426
429
|
));
|
|
427
|
-
}),
|
|
430
|
+
}), i = p;
|
|
428
431
|
const b = () => {
|
|
429
432
|
o.forEach((h, E) => {
|
|
430
433
|
u("key from setTimeout foreach currItemSignalMap", E), a.has(E) || (a.add(E), m(() => {
|
|
@@ -456,13 +459,13 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
456
459
|
);
|
|
457
460
|
try {
|
|
458
461
|
u("newReactiveComponent.map", o.map((a) => {
|
|
459
|
-
var
|
|
460
|
-
return u("newReactiveComponent hostElement", a.hostElement), (
|
|
462
|
+
var i;
|
|
463
|
+
return u("newReactiveComponent hostElement", a.hostElement), (i = a.hostElement) == null ? void 0 : i.id;
|
|
461
464
|
})), u("currComponent[0].hostElement?.id", (r = e[0].hostElement) == null ? void 0 : r.id, e), (c = e[0].hostElement) == null || c.replaceWith(
|
|
462
465
|
...o.map((a) => a.hostElement)
|
|
463
466
|
), e.slice(1).forEach((a) => {
|
|
464
|
-
var
|
|
465
|
-
return (
|
|
467
|
+
var i;
|
|
468
|
+
return (i = a.hostElement) == null ? void 0 : i.remove();
|
|
466
469
|
}), e = o;
|
|
467
470
|
} catch (a) {
|
|
468
471
|
console.error(a);
|
|
@@ -511,8 +514,8 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
511
514
|
);
|
|
512
515
|
return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(Y).reduce(
|
|
513
516
|
(c, a) => {
|
|
514
|
-
const
|
|
515
|
-
return c[
|
|
517
|
+
const i = a.hostElement.getAttribute("slot") || "default";
|
|
518
|
+
return c[i] || (c[i] = []), c[i].push(a), c;
|
|
516
519
|
},
|
|
517
520
|
{}
|
|
518
521
|
), n.hostElement.appendAllSlotContent = () => W(n, ...r), n;
|
|
@@ -530,7 +533,7 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
530
533
|
const c = [...r];
|
|
531
534
|
return o && !x(o) && c.unshift(o), mt(n, x(o) ? o : {})(...c);
|
|
532
535
|
};
|
|
533
|
-
},
|
|
536
|
+
}, l = {}, Ct = [
|
|
534
537
|
"div",
|
|
535
538
|
"span",
|
|
536
539
|
"section",
|
|
@@ -593,12 +596,12 @@ const Rt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotCont
|
|
|
593
596
|
"slot"
|
|
594
597
|
];
|
|
595
598
|
Ct.forEach((t) => {
|
|
596
|
-
|
|
599
|
+
l[t] = (e, ...s) => {
|
|
597
600
|
let n = [...s];
|
|
598
601
|
return e && !x(e) && (n = [e].concat(n)), H(t, x(e) ? e : {})(...n);
|
|
599
602
|
};
|
|
600
603
|
});
|
|
601
|
-
const bt =
|
|
604
|
+
const bt = l.div, Wt = l.span, Ht = l.section, _t = l.input, zt = l.button, Bt = l.table, Jt = l.tr, qt = l.td, Nt = l.th, Vt = l.ul, Dt = l.li, Gt = l.ol, Ut = l.form, Xt = l.label, Zt = l.select, Qt = l.option, Yt = l.textarea, Kt = l.img, te = l.a, ee = l.p, se = l.h1, ne = l.h2, oe = l.h3, re = l.h4, ce = l.h5, ie = l.h6, le = l.br, ae = l.hr, de = l.pre, he = l.code, ue = l.nav, fe = l.header, pe = l.footer, me = l.main, Ce = l.aside, be = l.article, Ee = l.figure, ye = l.figcaption, Se = l.blockquote, ve = l.cite, Ae = l.small, ge = l.strong, Le = l.em, Re = l.b, Oe = l.i, je = l.u, Te = l.s, xe = l.sub, we = l.sup, $e = l.mark, ke = l.del, Me = l.ins, Pe = l.details, Ie = l.summary, Fe = l.progress, We = l.meter, He = l.audio, _e = l.video, ze = l.canvas, Be = l.slot, Je = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", M = "EVENT_CONFIG", T = "observedAttributes", qe = () => (t, e) => {
|
|
602
605
|
Reflect.get(t, T) || Reflect.defineProperty(t, T, {
|
|
603
606
|
value: []
|
|
604
607
|
}), Reflect.get(t, T).push(
|
|
@@ -623,8 +626,8 @@ const bt = i.div, Wt = i.span, Ht = i.section, _t = i.input, zt = i.button, Bt =
|
|
|
623
626
|
if (s.styles) {
|
|
624
627
|
const r = s.styles, c = [];
|
|
625
628
|
Array.isArray(r) ? c.push(...r) : c.push(r), c.forEach((a) => {
|
|
626
|
-
const
|
|
627
|
-
|
|
629
|
+
const i = new CSSStyleSheet();
|
|
630
|
+
i.replaceSync(a), n.push(i);
|
|
628
631
|
const d = new CSSStyleSheet();
|
|
629
632
|
d.replaceSync(a.slice(a.indexOf("@property"))), document.adoptedStyleSheets.push(d);
|
|
630
633
|
});
|
|
@@ -641,55 +644,55 @@ const bt = i.div, Wt = i.span, Ht = i.section, _t = i.input, zt = i.button, Bt =
|
|
|
641
644
|
};
|
|
642
645
|
return a.fake = !0, m(a), c;
|
|
643
646
|
}
|
|
644
|
-
attributeChangedCallback(c, a,
|
|
647
|
+
attributeChangedCallback(c, a, i) {
|
|
645
648
|
u(
|
|
646
649
|
"%cAttribute has changed.%c",
|
|
647
650
|
`%c${c}%c`,
|
|
648
|
-
`oldValue: ${a}, newValue: ${
|
|
651
|
+
`oldValue: ${a}, newValue: ${i}`,
|
|
649
652
|
`%c${t}%c`
|
|
650
653
|
);
|
|
651
654
|
try {
|
|
652
|
-
|
|
655
|
+
i = JSON.parse(i);
|
|
653
656
|
} catch {
|
|
654
657
|
}
|
|
655
658
|
const d = K(c);
|
|
656
659
|
if (d in this && y(this[d])) {
|
|
657
660
|
const p = this[d];
|
|
658
|
-
|
|
661
|
+
i === null ? (p.set(p.initValue), this.removeAttribute(c)) : p.set(i);
|
|
659
662
|
}
|
|
660
663
|
_(
|
|
661
664
|
this,
|
|
662
665
|
s.prototype.attributeChangedCallback,
|
|
663
666
|
c,
|
|
664
667
|
a,
|
|
665
|
-
|
|
668
|
+
i
|
|
666
669
|
);
|
|
667
670
|
}
|
|
668
671
|
connectedCallback() {
|
|
669
672
|
var a;
|
|
670
673
|
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(
|
|
671
|
-
([
|
|
672
|
-
u("register provider",
|
|
674
|
+
([i, d]) => {
|
|
675
|
+
u("register provider", i, d()), this.addEventListener(i, (p) => {
|
|
673
676
|
var b;
|
|
674
|
-
u("send provider",
|
|
677
|
+
u("send provider", i, d());
|
|
675
678
|
const f = p;
|
|
676
|
-
((b = f.detail) == null ? void 0 : b.context) ===
|
|
679
|
+
((b = f.detail) == null ? void 0 : b.context) === i && (f.stopPropagation(), f.detail.callback(d));
|
|
677
680
|
});
|
|
678
681
|
}
|
|
679
682
|
)), this.checkInjects(), (a = s.prototype[k]) == null || a.forEach(
|
|
680
|
-
(
|
|
681
|
-
this[
|
|
682
|
-
const p = s.prototype[M][
|
|
683
|
+
(i) => {
|
|
684
|
+
this[i] = (d) => {
|
|
685
|
+
const p = s.prototype[M][i], { bubbles: f, composed: b } = p;
|
|
683
686
|
y(d) ? m(() => {
|
|
684
687
|
A("@oemit reactive value", d()), this.dispatchEvent(
|
|
685
|
-
new CustomEvent(
|
|
688
|
+
new CustomEvent(i, {
|
|
686
689
|
detail: d(),
|
|
687
690
|
bubbles: f,
|
|
688
691
|
composed: b
|
|
689
692
|
})
|
|
690
693
|
);
|
|
691
694
|
}) : (A("@oemit value", d), this.dispatchEvent(
|
|
692
|
-
new CustomEvent(
|
|
695
|
+
new CustomEvent(i, {
|
|
693
696
|
detail: d,
|
|
694
697
|
bubbles: f,
|
|
695
698
|
composed: b
|
|
@@ -700,17 +703,17 @@ const bt = i.div, Wt = i.span, Ht = i.section, _t = i.input, zt = i.button, Bt =
|
|
|
700
703
|
), u("start render", `%c${t}%c`, t);
|
|
701
704
|
const c = () => {
|
|
702
705
|
u("rwc: insertRenderTemplate");
|
|
703
|
-
const
|
|
704
|
-
this.shadow.appendChild(
|
|
706
|
+
const i = this.render();
|
|
707
|
+
this.shadow.appendChild(i.hostElement), _(this, s.prototype.connectedCallback), this.appendSlotContent();
|
|
705
708
|
};
|
|
706
709
|
if (this.rootStyle && !s.styles) {
|
|
707
|
-
const
|
|
710
|
+
const i = (f) => f instanceof Promise || Array.isArray(f) && f.every((b) => b instanceof Promise), d = this.rootStyle, p = (f) => {
|
|
708
711
|
const b = new CSSStyleSheet();
|
|
709
712
|
b.replaceSync(f), this.shadow.adoptedStyleSheets.push(b);
|
|
710
713
|
const h = new CSSStyleSheet();
|
|
711
714
|
h.replaceSync(f.slice(f.indexOf("@property"))), document.adoptedStyleSheets.push(h);
|
|
712
715
|
};
|
|
713
|
-
if (
|
|
716
|
+
if (i(d)) {
|
|
714
717
|
const f = [];
|
|
715
718
|
Array.isArray(d) ? f.push(...d) : f.push(d), Promise.all(f).then((b) => b.forEach((h) => p(h.default))).then(() => c());
|
|
716
719
|
} else {
|
|
@@ -719,22 +722,22 @@ const bt = i.div, Wt = i.span, Ht = i.section, _t = i.input, zt = i.button, Bt =
|
|
|
719
722
|
}
|
|
720
723
|
} else
|
|
721
724
|
c();
|
|
722
|
-
this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((
|
|
725
|
+
this.slotContext && Object.keys(this.slotContext).length > 0 && this.shadow.querySelectorAll("slot").forEach((i) => {
|
|
723
726
|
u(
|
|
724
727
|
this.slotContext,
|
|
725
|
-
this.slotContext && this.slotContext[
|
|
728
|
+
this.slotContext && this.slotContext[i.name]
|
|
726
729
|
), A(
|
|
727
730
|
"@bslot element",
|
|
728
|
-
|
|
729
|
-
`name:${
|
|
730
|
-
|
|
731
|
-
),
|
|
732
|
-
const p = this.slotContext[
|
|
731
|
+
i,
|
|
732
|
+
`name:${i.name};`,
|
|
733
|
+
i.assignedElements()
|
|
734
|
+
), i.assignedElements().forEach((d) => {
|
|
735
|
+
const p = this.slotContext[i.name];
|
|
733
736
|
this.slotContext && y(p) && (A(
|
|
734
737
|
"@oslot element",
|
|
735
|
-
|
|
736
|
-
`name:${
|
|
737
|
-
|
|
738
|
+
i,
|
|
739
|
+
`name:${i.name};`,
|
|
740
|
+
i.assignedElements()
|
|
738
741
|
), m(() => {
|
|
739
742
|
d.dispatchEvent(
|
|
740
743
|
new CustomEvent("handleSlotContext", {
|