@reactive-web-components/rwc 2.54.0 → 2.54.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/README.md
CHANGED
|
@@ -215,6 +215,34 @@ city.set('SPB'); // userData updates to ['Jane', 30, 'SPB']
|
|
|
215
215
|
- Creating composite objects from multiple sources
|
|
216
216
|
- Waiting for all dependencies to update before executing actions
|
|
217
217
|
|
|
218
|
+
#### combineLatest
|
|
219
|
+
|
|
220
|
+
Combines multiple signals into one that updates whenever any of the source signals receives a new value. Unlike `forkJoin`, which waits for all signals to update, `combineLatest` immediately updates when any signal changes.
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { combineLatest, signal } from '@shared/utils';
|
|
224
|
+
|
|
225
|
+
const name = signal('John');
|
|
226
|
+
const age = signal(25);
|
|
227
|
+
const city = signal('Moscow');
|
|
228
|
+
|
|
229
|
+
const userData = combineLatest(name, age, city);
|
|
230
|
+
// userData() returns ['John', 25, 'Moscow']
|
|
231
|
+
|
|
232
|
+
name.set('Jane'); // userData immediately updates to ['Jane', 25, 'Moscow']
|
|
233
|
+
age.set(30); // userData immediately updates to ['Jane', 30, 'Moscow']
|
|
234
|
+
city.set('SPB'); // userData immediately updates to ['Jane', 30, 'SPB']
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Application:**
|
|
238
|
+
- Real-time synchronization of multiple data sources
|
|
239
|
+
- Creating reactive computed values from multiple signals
|
|
240
|
+
- Updating UI immediately when any dependency changes
|
|
241
|
+
|
|
242
|
+
**Differences between `forkJoin` and `combineLatest`:**
|
|
243
|
+
- **`forkJoin`** — waits for all signals to update before emitting a new value. Useful when you need all values to be updated together.
|
|
244
|
+
- **`combineLatest`** — emits a new value immediately when any signal changes. Useful for real-time updates and reactive computations.
|
|
245
|
+
|
|
218
246
|
### Function as Child Content (recommended style for dynamic lists and conditional render)
|
|
219
247
|
|
|
220
248
|
Functions passed as child content to `el` or `customEl` are automatically converted to reactive content. This allows convenient creation of dynamic content that will update when dependent signals change. The content function receives context (a reference to its component) as the first argument.
|
|
@@ -1227,18 +1255,25 @@ const MyCounter = Counter({
|
|
|
1227
1255
|
|
|
1228
1256
|
#### Example: Working with Signal Utilities
|
|
1229
1257
|
```typescript
|
|
1230
|
-
import { bindReactiveSignals, forkJoin, signal } from '@shared/utils';
|
|
1258
|
+
import { bindReactiveSignals, forkJoin, combineLatest, signal } from '@shared/utils';
|
|
1231
1259
|
|
|
1232
1260
|
// Two-way binding
|
|
1233
1261
|
const inputValue = signal('');
|
|
1234
1262
|
const displayValue = signal('');
|
|
1235
1263
|
bindReactiveSignals(inputValue, displayValue);
|
|
1236
1264
|
|
|
1237
|
-
// Combining signals
|
|
1265
|
+
// Combining signals with forkJoin (waits for all to update)
|
|
1238
1266
|
const name = signal('John');
|
|
1239
1267
|
const age = signal(25);
|
|
1240
1268
|
const userInfo = forkJoin(name, age);
|
|
1241
1269
|
// userInfo() returns ['John', 25] only when both signals update
|
|
1270
|
+
|
|
1271
|
+
// Combining signals with combineLatest (updates on any change)
|
|
1272
|
+
const firstName = signal('John');
|
|
1273
|
+
const lastName = signal('Doe');
|
|
1274
|
+
const fullName = combineLatest(firstName, lastName);
|
|
1275
|
+
// fullName() returns ['John', 'Doe'] and updates immediately when either signal changes
|
|
1276
|
+
firstName.set('Jane'); // fullName() immediately becomes ['Jane', 'Doe']
|
|
1242
1277
|
```
|
|
1243
1278
|
|
|
1244
1279
|
#### Example: Event Handling
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactive-web-components/rwc",
|
|
3
|
-
"version": "2.54.
|
|
3
|
+
"version": "2.54.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.o8AlN8rR.js",
|
|
10
|
+
"require": "./reactive-web-component.FnhsCVIl.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.o8AlN8rR.js",
|
|
38
|
+
"main": "./reactive-web-component.FnhsCVIl.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"))},M=t=>t.replace(/([A-Z])/gm,e=>`-${e.toLowerCase()}`),Q=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)},bt=()=>{_=!0},Y=()=>{_=!1};Y();let pt=!1;const Et=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(){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 r=O.get(d);r==null||r.cleanupFns.add(()=>{n.delete(l)})}n.add(l)}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 r=O.get(d);r&&r.cleanupFns.size>0&&(r.cleanupFns.forEach(h=>h()),r.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 r=i();b(()=>{const h=l(r);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];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 yt(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 St(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 vt(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 At(...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 gt=(...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 Lt=t=>"render"in t&&"setReactiveValue"in t,Rt="handleSlotContext",K="onConnected",Tt=()=>()=>{},D=t=>typeof t=="string"?t:JSON.stringify(t),G=t=>{const e=document.createElement("span");return e.textContent=D(t),e},N=(t,e)=>(t.appendChild(G(e)),t),x=(t,e)=>(t.innerHTML="",N(t,e)),J=t=>{const e=document.createElement("span");return b(()=>{const n=t();e.textContent=D(n)}),e},$=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 N(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(M(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(M(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(M(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
|
+
`)).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]}),jt=(t,...e)=>tt(t,...e),V=(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)=>I(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])})},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={...$(n)};return V(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(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(),I(e,...s)}),Ot=t=>{const e=s=>typeof s=="string"?s.trim().length>0?$(G(s)):P("div")():v(s)?$(J(s)):s;return at(()=>{const s=t();return s instanceof Array&&Array.isArray(s)?s.map(e):e(s)})},wt=(t,e,n)=>{const s=k("div").addStyle({display:"contents"}),i=new Map,l=new Map;let c=[];const d=new Set;let r=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(r[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)))}),r=[...m.map(u=>({...u}))];const y=()=>{i.forEach((u,S)=>{f("key from setTimeout foreach currItemSignalMap",S),d.has(S)||(d.add(S),b(()=>{var Ct;u();const H=c.indexOf(S),j=(Ct=l.get(S))==null?void 0:Ct();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 r;return f("newReactiveComponent hostElement",d.hostElement),(r=d.hostElement)==null?void 0:r.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 r;return(r=d.hostElement)==null?void 0:r.remove()}),e=i}catch(d){console.error(d)}}),n?e:e[0]},kt=t=>Rt in t,Mt=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"}),rt=(t,e,n)=>g(()=>X(!!t(),e,n)),$t=(t,e,n)=>typeof t=="boolean"?X(t,e,n):rt(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)},dt=(t,e)=>{f("createCustomElement",t);const n=document.createElement(t),s={...$(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 V(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)=>{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 r=d.hostElement.getAttribute("slot")||"default";return c[r]||(c[r]=[]),c[r].push(d),c},{}),s.hostElement.appendAllSlotContent=()=>I(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),Pt=()=>{const t=()=>{};return t.oldValue=null,t},Ft=()=>({}),Ht=(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)}},a={};["div","span","section","input","button","table","tr","td","th","ul","li","ol","form","label","select","option","textarea","img","a","p","h1","h2","h3","h4","h5","h6","br","hr","pre","code","nav","header","footer","main","aside","article","figure","figcaption","blockquote","cite","small","strong","em","b","i","u","s","sub","sup","mark","del","ins","details","summary","progress","meter","audio","video","canvas","slot"].forEach(t=>{a[t]=(e,...n)=>{let s=[...n];return e&&!p(e)&&(s=[e].concat(s)),P(t,p(e)?e:{})(...s)}});const ft=a.div,Wt=a.span,_t=a.section,Bt=a.input,Jt=a.button,zt=a.table,qt=a.tr,Dt=a.td,Gt=a.th,Nt=a.ul,Vt=a.li,Ut=a.ol,Xt=a.form,Zt=a.label,Qt=a.select,Yt=a.option,Kt=a.textarea,xt=a.img,te=a.a,ee=a.p,ne=a.h1,se=a.h2,oe=a.h3,ie=a.h4,le=a.h5,ce=a.h6,ae=a.br,re=a.hr,de=a.pre,he=a.code,ue=a.nav,fe=a.header,me=a.footer,Ce=a.main,be=a.aside,pe=a.article,Ee=a.figure,ye=a.figcaption,Se=a.blockquote,ve=a.cite,Ae=a.small,ge=a.strong,Le=a.em,Re=a.b,Te=a.i,je=a.u,Oe=a.s,we=a.sub,ke=a.sup,Me=a.mark,$e=a.del,Ie=a.ins,Pe=a.details,Fe=a.summary,He=a.progress,We=a.meter,_e=a.audio,Be=a.video,Je=a.canvas,ze=a.slot,qe=t=>e=>t(e).addClass(...e.classList??[]).addReactiveClass(e.reactiveClassList??{}),z="eventProps",q="EVENT_CONFIG",F="observedAttributes",De=()=>(t,e)=>{Reflect.get(t,F)||Reflect.defineProperty(t,F,{value:[]}),Reflect.get(t,F).push(M(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)},mt=(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 r=new CSSStyleSheet;r.replaceSync(d),s.push(r);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=ft();const d=()=>{f("wrapperEffectCallback"),c=n.prototype.render.call(this)};return d.fake=!0,b(d),c}attributeChangedCallback(c,d,r){f("%cAttribute has changed.%c",`%c${c}%c`,`oldValue: ${d}, newValue: ${r}`,`%c${t}%c`);try{r=JSON.parse(r)}catch{}const h=Q(c);if(h in this&&v(this[h])){const m=this[h];r===null?(m.set(m.initValue),this.removeAttribute(c)):m.set(r)}W(this,n.prototype.attributeChangedCallback,c,d,r)}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(([r,h])=>{f("register provider",r,h()),this.addEventListener(r,m=>{var y;f("send provider",r,h());const C=m;((y=C.detail)==null?void 0:y.context)===r&&(C.stopPropagation(),C.detail.callback(h))})})),this.checkInjects(),(d=n.prototype[z])==null||d.forEach(r=>{this[r]=h=>{const m=n.prototype[q][r],{bubbles:C,composed:y}=m;v(h)?b(()=>{R("@oemit reactive value",h()),this.dispatchEvent(new CustomEvent(r,{detail:h(),bubbles:C,composed:y}))}):(R("@oemit value",h),this.dispatchEvent(new CustomEvent(r,{detail:h,bubbles:C,composed:y})))}}),f("start render",`%c${t}%c`,t);const c=()=>{f("rwc: insertRenderTemplate");const r=this.render();this.shadow.appendChild(r.hostElement),W(this,n.prototype.connectedCallback),this.appendSlotContent()};if(this.rootStyle&&!n.styles){const r=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(r(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(r=>{f(this.slotContext,this.slotContext&&this.slotContext[r.name]),R("@bslot element",r,`name:${r.name};`,r.assignedElements()),r.assignedElements().forEach(h=>{const m=this.slotContext[r.name];this.slotContext&&v(m)&&(R("@oslot element",r,`name:${r.name};`,r.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=te,o.addAttributeList=ct,o.addClassList=ot,o.addCustomAttributes=st,o.addHtmlContent=N,o.addReactiveClassList=it,o.addStyleList=lt,o.appendContentItem=I,o.article=pe,o.aside=be,o.audio=_e,o.b=Re,o.bindReactiveSignals=vt,o.blockquote=Se,o.br=ae,o.button=Jt,o.camelToKebab=M,o.canvas=Je,o.checkCall=W,o.cite=ve,o.classList=tt,o.cls=jt,o.code=he,o.colorLog=R,o.combineLatest=gt,o.component=mt,o.createComponent=qe,o.createCustom=ut,o.createCustomEl=ht,o.createCustomElement=dt,o.createEl=P,o.createElement=k,o.createSignal=St,o.defineSlotTemplate=Ft,o.del=$e,o.details=Pe,o.disableLogs=Y,o.div=ft,o.effect=b,o.effectMap=Et,o.elementHelpers=$,o.em=Le,o.enableLogs=bt,o.event=Ge,o.eventEmitter=Tt,o.figcaption=ye,o.figure=Ee,o.footer=me,o.forkJoin=At,o.form=Xt,o.getList=wt,o.getReactiveTemplate=Ot,o.getSignalContent=g,o.getTextContent=D,o.h1=ne,o.h2=se,o.h3=oe,o.h4=ie,o.h5=le,o.h6=ce,o.header=fe,o.hr=re,o.htmlEffectWrapper=J,o.i=Te,o.img=xt,o.initComponent=V,o.input=Bt,o.ins=Ie,o.isBaseElement=Lt,o.isComponentConfig=L,o.isComponentInitConfig=p,o.isEffectDebugEnabled=pt,o.isReactiveSignal=v,o.isSlotTemplate=kt,o.kebabToCamel=Q,o.label=Zt,o.li=Vt,o.main=Ce,o.mark=Me,o.meter=We,o.nav=ue,o.newEventEmitter=Pt,o.ol=Ut,o.option=Yt,o.p=ee,o.pre=de,o.progress=He,o.projectLog=f,o.property=De,o.renderIf=X,o.rs=yt,o.rxRenderIf=rt,o.s=Oe,o.section=_t,o.select=Qt,o.setChildren=nt,o.setEffects=et,o.setHtmlContent=x,o.setListeners=U,o.show=It,o.showIf=Z,o.signal=A,o.signalComponent=at,o.slot=ze,o.small=Ae,o.span=Wt,o.strong=ge,o.sub=we,o.summary=Fe,o.sup=ke,o.table=zt,o.td=Dt,o.textContentWrapper=G,o.textarea=Kt,o.th=Gt,o.tr=qt,o.u=je,o.ul=Nt,o.unsafeHtml=Mt,o.useCustomComponent=Ht,o.video=Be,o.when=$t,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var C = (t, e, s) =>
|
|
1
|
+
var Z = Object.defineProperty;
|
|
2
|
+
var Q = (t, e, s) => e in t ? Z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var C = (t, e, s) => Q(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
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
|
-
)) && !("hostElement" in t),
|
|
6
|
+
)) && !("hostElement" in t), Y = (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;
|
|
@@ -12,7 +12,7 @@ const u = (...t) => {
|
|
|
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
|
-
}, $ = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`),
|
|
15
|
+
}, $ = (t) => t.replace(/([A-Z])/gm, (e) => `-${e.toLowerCase()}`), K = (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",
|
|
@@ -40,28 +40,28 @@ const u = (...t) => {
|
|
|
40
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
|
+
}, St = () => {
|
|
44
44
|
F = !0;
|
|
45
|
-
},
|
|
45
|
+
}, tt = () => {
|
|
46
46
|
F = !1;
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
tt();
|
|
49
|
+
let vt = !1;
|
|
50
|
+
const At = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new WeakMap(), I = [], R = [];
|
|
50
51
|
function A(t, e) {
|
|
51
52
|
const s = /* @__PURE__ */ new Set();
|
|
52
53
|
let n = (e == null ? void 0 : e.signalCompareFn) || (() => !0);
|
|
53
54
|
function o() {
|
|
54
|
-
var i;
|
|
55
55
|
const r = I[I.length - 1];
|
|
56
56
|
if (r && !("fake" in r && r.fake)) {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
57
|
+
const i = g.get(r), a = i == null ? void 0 : i.parent;
|
|
58
|
+
if (a) {
|
|
59
|
+
const c = g.get(a);
|
|
60
|
+
c == null || c.cleanupFns.add(() => {
|
|
61
61
|
s.delete(r);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
s.add(r)
|
|
64
|
+
s.add(r);
|
|
65
65
|
}
|
|
66
66
|
return t;
|
|
67
67
|
}
|
|
@@ -72,10 +72,12 @@ function A(t, e) {
|
|
|
72
72
|
}, o.peek = function() {
|
|
73
73
|
return Object.freeze(t);
|
|
74
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(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
o.oldValue = Object.freeze(t), t = r, s.forEach(
|
|
76
|
+
(i) => Promise.resolve(i).then((a) => {
|
|
77
|
+
const c = g.get(a);
|
|
78
|
+
c && c.cleanupFns.size > 0 && (c.cleanupFns.forEach((d) => d()), c.cleanupFns.clear()), R.push(a), a(), R.pop();
|
|
79
|
+
})
|
|
80
|
+
);
|
|
79
81
|
}, o.set = function(r, i = n) {
|
|
80
82
|
t !== r && i(t, r) && o.forceSet(r);
|
|
81
83
|
}, o.update = function(r) {
|
|
@@ -96,13 +98,13 @@ function m(t, e) {
|
|
|
96
98
|
u("current effect", `%c${s}%c`);
|
|
97
99
|
const n = t;
|
|
98
100
|
t = () => (u("current effect callback", `%c${s}%c`), n()), "fake" in n && n.fake && (t.fake = !0), t.effectId = s;
|
|
99
|
-
const o =
|
|
100
|
-
|
|
101
|
-
const r =
|
|
102
|
-
o ? r.parent = o : delete r.parent,
|
|
101
|
+
const o = R[R.length - 1];
|
|
102
|
+
g.has(t) || g.set(t, { cleanupFns: /* @__PURE__ */ new Set() });
|
|
103
|
+
const r = g.get(t);
|
|
104
|
+
o ? r.parent = o : delete r.parent, R.push(t), I.push(t), t(), I.pop(), R.pop();
|
|
103
105
|
}
|
|
104
106
|
const y = (t) => !!t && ["object", "function"].includes(typeof t) && "set" in t && "oldValue" in t && "update" in t && "forceSet" in t;
|
|
105
|
-
function
|
|
107
|
+
function Lt(t, ...e) {
|
|
106
108
|
const s = A("");
|
|
107
109
|
return m(() => {
|
|
108
110
|
const n = e.map(
|
|
@@ -113,7 +115,7 @@ function At(t, ...e) {
|
|
|
113
115
|
}), s.set(o.join(""));
|
|
114
116
|
}), s;
|
|
115
117
|
}
|
|
116
|
-
function
|
|
118
|
+
function Rt(t, e) {
|
|
117
119
|
const s = A(e ?? null), n = (o) => s.set(o);
|
|
118
120
|
return t instanceof Promise ? t.then(n) : typeof t == "function" && m(() => {
|
|
119
121
|
const o = t();
|
|
@@ -127,7 +129,7 @@ function gt(t, e) {
|
|
|
127
129
|
o !== r && (o !== s ? e.set(o) : r !== n && t.set(r)), s = o, n = r;
|
|
128
130
|
});
|
|
129
131
|
}
|
|
130
|
-
function
|
|
132
|
+
function Ot(...t) {
|
|
131
133
|
let e = t.map((n) => n());
|
|
132
134
|
const s = A(e);
|
|
133
135
|
return t.forEach((n, o) => {
|
|
@@ -137,7 +139,7 @@ function Rt(...t) {
|
|
|
137
139
|
});
|
|
138
140
|
}), s;
|
|
139
141
|
}
|
|
140
|
-
const
|
|
142
|
+
const jt = (...t) => {
|
|
141
143
|
const e = A([]);
|
|
142
144
|
return m(() => {
|
|
143
145
|
e.set(t.map((s) => s()));
|
|
@@ -202,15 +204,15 @@ class O extends HTMLElement {
|
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
C(O, "observedAttributes", []), C(O, "renderTagName", ""), C(O, "styles");
|
|
205
|
-
const
|
|
206
|
-
},
|
|
207
|
+
const Tt = (t) => "render" in t && "setReactiveValue" in t, et = "handleSlotContext", J = "onConnected", xt = () => () => {
|
|
208
|
+
}, N = (t) => typeof t == "string" ? t : JSON.stringify(t), V = (t) => {
|
|
207
209
|
const e = document.createElement("span");
|
|
208
|
-
return e.textContent =
|
|
209
|
-
},
|
|
210
|
+
return e.textContent = N(t), e;
|
|
211
|
+
}, G = (t, e) => (t.appendChild(V(e)), t), st = (t, e) => (t.innerHTML = "", G(t, e)), z = (t) => {
|
|
210
212
|
const e = document.createElement("span");
|
|
211
213
|
return m(() => {
|
|
212
214
|
const s = t();
|
|
213
|
-
e.textContent =
|
|
215
|
+
e.textContent = N(s);
|
|
214
216
|
}), e;
|
|
215
217
|
}, P = (t) => ({
|
|
216
218
|
append(...e) {
|
|
@@ -240,10 +242,10 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
240
242
|
}), this;
|
|
241
243
|
},
|
|
242
244
|
addHtmlContent(e) {
|
|
243
|
-
return
|
|
245
|
+
return G(t, e), this;
|
|
244
246
|
},
|
|
245
247
|
setHtmlContent(e) {
|
|
246
|
-
return
|
|
248
|
+
return st(t, e), this;
|
|
247
249
|
},
|
|
248
250
|
addEventlistener(e, s, n = !1) {
|
|
249
251
|
return t.addEventListener(e, (o) => s(o, this, t), n), this;
|
|
@@ -340,9 +342,9 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
340
342
|
return t.innerHTML = "", this;
|
|
341
343
|
},
|
|
342
344
|
hostElement: t
|
|
343
|
-
}),
|
|
345
|
+
}), nt = (t, ...e) => ({
|
|
344
346
|
classList: [...t.map((s) => s.trim()).filter(Boolean), ...e]
|
|
345
|
-
}),
|
|
347
|
+
}), wt = (t, ...e) => nt(t, ...e), U = (t, e) => {
|
|
346
348
|
if (!e) return t;
|
|
347
349
|
const s = Object.keys(e || {}).filter(
|
|
348
350
|
(n) => n.startsWith(".") || n.startsWith("@") || n.startsWith("$")
|
|
@@ -355,19 +357,19 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
355
357
|
e.listeners[o] = e[n];
|
|
356
358
|
}), s.filter((n) => n.startsWith("$")).forEach((n) => {
|
|
357
359
|
e != null && e.effects || (e.effects = []), e.effects.push(e[n]);
|
|
358
|
-
}),
|
|
360
|
+
}), lt(t, e.classList), at(t, e.style), dt(t, e.attributes), ct(t, e.reactiveClassList), it(t, e.customAttributes), rt(t, e.children), ot(t, e.effects), q(t, e.listeners), q(t, e.customListeners), t;
|
|
359
361
|
}, q = (t, e) => {
|
|
360
362
|
e && Object.entries(e).forEach(([s, n]) => {
|
|
361
363
|
typeof n == "function" && t.addEventlistener(s, n);
|
|
362
364
|
});
|
|
363
|
-
},
|
|
365
|
+
}, ot = (t, e) => e == null ? void 0 : e.forEach((s) => t.addEffect(s)), rt = (t, e) => W(t, ...e || []), it = (t, e) => {
|
|
364
366
|
const s = e;
|
|
365
367
|
s && Object.keys(s).forEach((n) => {
|
|
366
368
|
y(s[n]) ? t.setReactiveCustomAttribute(n, s[n]) : typeof s[n] == "function" ? t.addEffect(() => {
|
|
367
369
|
t.setCustomAttribute(n, s[n]());
|
|
368
370
|
}) : t.setCustomAttribute(n, s[n]);
|
|
369
371
|
});
|
|
370
|
-
},
|
|
372
|
+
}, lt = (t, e) => t.addClass(...e || []), ct = (t, e) => t.addReactiveClass(e || {}), at = (t, e) => t.addStyle(e || {}), dt = (t, e) => {
|
|
371
373
|
const s = e, n = (o, r) => {
|
|
372
374
|
r && (y(r) ? t.setReactiveAttribute(o, r) : typeof r == "function" ? t.addEffect(() => {
|
|
373
375
|
t.setAttribute(o, r());
|
|
@@ -382,7 +384,7 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
382
384
|
const s = document.createElement(t), n = {
|
|
383
385
|
...P(s)
|
|
384
386
|
};
|
|
385
|
-
return
|
|
387
|
+
return U(n, e);
|
|
386
388
|
}, H = (t, e) => {
|
|
387
389
|
const [s, ...n] = t.split(" ").map((r) => r.trim()), o = w(s, e);
|
|
388
390
|
return n.length > 0 && o.addClass(...n), (...r) => W(
|
|
@@ -394,13 +396,13 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
394
396
|
}, v = (t) => w("div").addStyle({ display: "contents" }).addEffect((e) => {
|
|
395
397
|
const s = t(), n = [];
|
|
396
398
|
Array.isArray(s) ? n.push(...s) : n.push(s), e.clear(), W(e, ...n);
|
|
397
|
-
}),
|
|
398
|
-
const e = (n) => typeof n == "string" ? n.trim().length > 0 ? P(
|
|
399
|
-
return
|
|
399
|
+
}), $t = (t) => {
|
|
400
|
+
const e = (n) => typeof n == "string" ? n.trim().length > 0 ? P(V(n)) : H("div")() : y(n) ? P(z(n)) : n;
|
|
401
|
+
return ht(() => {
|
|
400
402
|
const n = t();
|
|
401
403
|
return n instanceof Array && Array.isArray(n) ? n.map(e) : e(n);
|
|
402
404
|
});
|
|
403
|
-
},
|
|
405
|
+
}, kt = (t, e, s) => {
|
|
404
406
|
const n = w("div").addStyle({ display: "contents" }), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
405
407
|
let i = [];
|
|
406
408
|
const a = /* @__PURE__ */ new Set();
|
|
@@ -434,7 +436,7 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
434
436
|
h
|
|
435
437
|
)
|
|
436
438
|
));
|
|
437
|
-
}), c = f;
|
|
439
|
+
}), c = [...f.map((h) => ({ ...h }))];
|
|
438
440
|
const b = () => {
|
|
439
441
|
o.forEach((h, E) => {
|
|
440
442
|
u("key from setTimeout foreach currItemSignalMap", E), a.has(E) || (a.add(E), m(() => {
|
|
@@ -454,7 +456,7 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
454
456
|
};
|
|
455
457
|
Promise.resolve().then(() => b());
|
|
456
458
|
}), n;
|
|
457
|
-
},
|
|
459
|
+
}, ht = (t) => {
|
|
458
460
|
let e = [w("div")], s = !1;
|
|
459
461
|
return m(() => {
|
|
460
462
|
var r, i;
|
|
@@ -478,26 +480,26 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
478
480
|
console.error(a);
|
|
479
481
|
}
|
|
480
482
|
}), s ? e : e[0];
|
|
481
|
-
},
|
|
483
|
+
}, Mt = (t) => et in t, It = (t) => {
|
|
482
484
|
const e = H("div")().addStyle({ display: "contents" }), s = (n) => (e.hostElement.innerHTML = n, e);
|
|
483
485
|
return typeof t == "string" ? s(t) : e.addEffect(() => {
|
|
484
486
|
s(t());
|
|
485
487
|
}), e;
|
|
486
|
-
},
|
|
488
|
+
}, X = (t, e, s) => t ? v(e) : s ? v(s) : H("div")().setAttribute("id", "empty_div_renderIf").addStyle({ display: "none" }), ut = (t, e, s) => v(() => X(!!t(), e, s)), Pt = (t, e, s) => typeof t == "boolean" ? X(t, e, s) : ut(t, e, s), D = (t, e) => {
|
|
487
489
|
const s = v(e);
|
|
488
490
|
return typeof t == "boolean" ? [s].flat().forEach((n) => n.hostElement.style.display = t ? "block" : "none") : m(() => {
|
|
489
491
|
const n = t() ? "block" : "none";
|
|
490
492
|
[s].flat().forEach((o) => o.hostElement.style.display = n);
|
|
491
493
|
}), s;
|
|
492
|
-
},
|
|
493
|
-
const n = [
|
|
494
|
+
}, Ft = (t, e, s) => {
|
|
495
|
+
const n = [D(t, e)].flat();
|
|
494
496
|
return s && n.push(
|
|
495
|
-
...[
|
|
497
|
+
...[D(
|
|
496
498
|
() => typeof t == "boolean" ? !t : !t(),
|
|
497
499
|
s
|
|
498
500
|
)].flat()
|
|
499
501
|
), v(() => n);
|
|
500
|
-
},
|
|
502
|
+
}, ft = (t, e) => {
|
|
501
503
|
u("createCustomElement", t);
|
|
502
504
|
const s = document.createElement(t), n = {
|
|
503
505
|
...P(s),
|
|
@@ -511,15 +513,15 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
511
513
|
}), this;
|
|
512
514
|
}
|
|
513
515
|
};
|
|
514
|
-
return
|
|
515
|
-
},
|
|
516
|
-
const s = t.split(" ").slice(1).map((o) => o.trim()), n =
|
|
516
|
+
return U(n, e);
|
|
517
|
+
}, pt = (t, e) => {
|
|
518
|
+
const s = t.split(" ").slice(1).map((o) => o.trim()), n = ft(t.split(" ")[0], e);
|
|
517
519
|
return Array.isArray(s) && s.length > 0 && n.addClass(...s), (...o) => {
|
|
518
520
|
L("@rcreateCustomEl content", t, o);
|
|
519
521
|
const r = o.filter(Boolean).flat().flatMap(
|
|
520
522
|
(i) => typeof i == "function" && !y(i) ? v(() => i(n)) : i
|
|
521
523
|
);
|
|
522
|
-
return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(
|
|
524
|
+
return n.hostElement.allSlotContent = r, n.hostElement.slotContent = r.filter(Y).reduce(
|
|
523
525
|
(i, a) => {
|
|
524
526
|
const c = a.hostElement.getAttribute("slot") || "default";
|
|
525
527
|
return i[c] || (i[c] = []), i[c].push(a), i;
|
|
@@ -527,20 +529,20 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
527
529
|
{}
|
|
528
530
|
), n.hostElement.appendAllSlotContent = () => W(n, ...r), n;
|
|
529
531
|
};
|
|
530
|
-
},
|
|
532
|
+
}, mt = (t, e, s) => pt(
|
|
531
533
|
`${t.renderTagName}${e && typeof e == "string" ? " " + e : ""}`,
|
|
532
534
|
x(e) ? e : e && typeof e == "string" ? s : void 0
|
|
533
|
-
),
|
|
535
|
+
), Wt = () => {
|
|
534
536
|
const t = () => {
|
|
535
537
|
};
|
|
536
538
|
return t.oldValue = null, t;
|
|
537
|
-
},
|
|
538
|
-
const n = e ?
|
|
539
|
+
}, Ht = () => ({}), _t = (t, e, s) => {
|
|
540
|
+
const n = e ? Et(e, s)(t) : t;
|
|
539
541
|
return (o, ...r) => {
|
|
540
542
|
const i = [...r];
|
|
541
|
-
return o && !x(o) && i.unshift(o),
|
|
543
|
+
return o && !x(o) && i.unshift(o), mt(n, x(o) ? o : {})(...i);
|
|
542
544
|
};
|
|
543
|
-
}, l = {},
|
|
545
|
+
}, l = {}, Ct = [
|
|
544
546
|
"div",
|
|
545
547
|
"span",
|
|
546
548
|
"section",
|
|
@@ -602,19 +604,19 @@ const jt = (t) => "render" in t && "setReactiveValue" in t, st = "handleSlotCont
|
|
|
602
604
|
"canvas",
|
|
603
605
|
"slot"
|
|
604
606
|
];
|
|
605
|
-
|
|
607
|
+
Ct.forEach((t) => {
|
|
606
608
|
l[t] = (e, ...s) => {
|
|
607
609
|
let n = [...s];
|
|
608
610
|
return e && !x(e) && (n = [e].concat(n)), H(t, x(e) ? e : {})(...n);
|
|
609
611
|
};
|
|
610
612
|
});
|
|
611
|
-
const
|
|
613
|
+
const bt = l.div, zt = l.span, Bt = l.section, Jt = l.input, qt = l.button, Dt = l.table, Nt = l.tr, Vt = l.td, Gt = l.th, Ut = l.ul, Xt = l.li, Zt = l.ol, Qt = l.form, Yt = l.label, Kt = l.select, te = l.option, ee = l.textarea, se = l.img, ne = l.a, oe = l.p, re = l.h1, ie = l.h2, le = l.h3, ce = l.h4, ae = l.h5, de = l.h6, he = l.br, ue = l.hr, fe = l.pre, pe = l.code, me = l.nav, Ce = l.header, be = l.footer, Ee = l.main, ye = l.aside, Se = l.article, ve = l.figure, Ae = l.figcaption, Le = l.blockquote, Re = l.cite, ge = l.small, Oe = l.strong, je = l.em, Te = l.b, xe = l.i, we = l.u, $e = l.s, ke = l.sub, Me = l.sup, Ie = l.mark, Pe = l.del, Fe = l.ins, We = l.details, He = l.summary, _e = l.progress, ze = l.meter, Be = l.audio, Je = l.video, qe = l.canvas, De = l.slot, Ne = (t) => (e) => t(e).addClass(...e.classList ?? []).addReactiveClass(e.reactiveClassList ?? {}), k = "eventProps", M = "EVENT_CONFIG", T = "observedAttributes", Ve = () => (t, e) => {
|
|
612
614
|
Reflect.get(t, T) || Reflect.defineProperty(t, T, {
|
|
613
615
|
value: []
|
|
614
616
|
}), Reflect.get(t, T).push(
|
|
615
617
|
$(e)
|
|
616
618
|
);
|
|
617
|
-
},
|
|
619
|
+
}, Ge = (t) => (e, s) => {
|
|
618
620
|
Reflect.get(e, k) || Reflect.defineProperty(e, k, {
|
|
619
621
|
value: []
|
|
620
622
|
}), Reflect.get(e, M) || Reflect.defineProperty(e, M, {
|
|
@@ -623,7 +625,7 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
|
|
|
623
625
|
bubbles: (t == null ? void 0 : t.bubbles) ?? !1,
|
|
624
626
|
composed: (t == null ? void 0 : t.composed) ?? !1
|
|
625
627
|
}, Reflect.get(e, k).push(s);
|
|
626
|
-
},
|
|
628
|
+
}, Et = (t, e = !1) => (s) => {
|
|
627
629
|
u(
|
|
628
630
|
t,
|
|
629
631
|
"start register static attr",
|
|
@@ -645,7 +647,7 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
|
|
|
645
647
|
}
|
|
646
648
|
render() {
|
|
647
649
|
u("rwc: render from new class");
|
|
648
|
-
let i =
|
|
650
|
+
let i = bt();
|
|
649
651
|
const a = () => {
|
|
650
652
|
u("wrapperEffectCallback"), i = s.prototype.render.call(this);
|
|
651
653
|
};
|
|
@@ -662,7 +664,7 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
|
|
|
662
664
|
c = JSON.parse(c);
|
|
663
665
|
} catch {
|
|
664
666
|
}
|
|
665
|
-
const d =
|
|
667
|
+
const d = K(i);
|
|
666
668
|
if (d in this && y(this[d])) {
|
|
667
669
|
const f = this[d];
|
|
668
670
|
c === null ? (f.set(f.initValue), this.removeAttribute(i)) : f.set(c);
|
|
@@ -765,125 +767,126 @@ const Et = l.div, _t = l.span, zt = l.section, Bt = l.input, Jt = l.button, qt =
|
|
|
765
767
|
};
|
|
766
768
|
export {
|
|
767
769
|
O as BaseElement,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
770
|
+
ne as a,
|
|
771
|
+
dt as addAttributeList,
|
|
772
|
+
lt as addClassList,
|
|
773
|
+
it as addCustomAttributes,
|
|
774
|
+
G as addHtmlContent,
|
|
775
|
+
ct as addReactiveClassList,
|
|
776
|
+
at as addStyleList,
|
|
775
777
|
W as appendContentItem,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
778
|
+
Se as article,
|
|
779
|
+
ye as aside,
|
|
780
|
+
Be as audio,
|
|
781
|
+
Te as b,
|
|
780
782
|
gt as bindReactiveSignals,
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
783
|
+
Le as blockquote,
|
|
784
|
+
he as br,
|
|
785
|
+
qt as button,
|
|
784
786
|
$ as camelToKebab,
|
|
785
|
-
|
|
787
|
+
qe as canvas,
|
|
786
788
|
_ as checkCall,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
789
|
+
Re as cite,
|
|
790
|
+
nt as classList,
|
|
791
|
+
wt as cls,
|
|
792
|
+
pe as code,
|
|
791
793
|
L as colorLog,
|
|
792
|
-
|
|
793
|
-
|
|
794
|
+
jt as combineLatest,
|
|
795
|
+
Et as component,
|
|
794
796
|
Ne as createComponent,
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
797
|
+
mt as createCustom,
|
|
798
|
+
pt as createCustomEl,
|
|
799
|
+
ft as createCustomElement,
|
|
798
800
|
H as createEl,
|
|
799
801
|
w as createElement,
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
802
|
+
Rt as createSignal,
|
|
803
|
+
Ht as defineSlotTemplate,
|
|
804
|
+
Pe as del,
|
|
805
|
+
We as details,
|
|
806
|
+
tt as disableLogs,
|
|
807
|
+
bt as div,
|
|
806
808
|
m as effect,
|
|
807
|
-
|
|
809
|
+
At as effectMap,
|
|
808
810
|
P as elementHelpers,
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
811
|
+
je as em,
|
|
812
|
+
St as enableLogs,
|
|
813
|
+
Ge as event,
|
|
814
|
+
xt as eventEmitter,
|
|
815
|
+
Ae as figcaption,
|
|
816
|
+
ve as figure,
|
|
817
|
+
be as footer,
|
|
818
|
+
Ot as forkJoin,
|
|
819
|
+
Qt as form,
|
|
820
|
+
kt as getList,
|
|
821
|
+
$t as getReactiveTemplate,
|
|
820
822
|
v as getSignalContent,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
823
|
+
N as getTextContent,
|
|
824
|
+
re as h1,
|
|
825
|
+
ie as h2,
|
|
826
|
+
le as h3,
|
|
827
|
+
ce as h4,
|
|
828
|
+
ae as h5,
|
|
829
|
+
de as h6,
|
|
830
|
+
Ce as header,
|
|
831
|
+
ue as hr,
|
|
830
832
|
z as htmlEffectWrapper,
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
833
|
+
xe as i,
|
|
834
|
+
se as img,
|
|
835
|
+
U as initComponent,
|
|
836
|
+
Jt as input,
|
|
837
|
+
Fe as ins,
|
|
838
|
+
Tt as isBaseElement,
|
|
839
|
+
Y as isComponentConfig,
|
|
838
840
|
x as isComponentInitConfig,
|
|
841
|
+
vt as isEffectDebugEnabled,
|
|
839
842
|
y as isReactiveSignal,
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
843
|
+
Mt as isSlotTemplate,
|
|
844
|
+
K as kebabToCamel,
|
|
845
|
+
Yt as label,
|
|
846
|
+
Xt as li,
|
|
847
|
+
Ee as main,
|
|
848
|
+
Ie as mark,
|
|
849
|
+
ze as meter,
|
|
850
|
+
me as nav,
|
|
851
|
+
Wt as newEventEmitter,
|
|
852
|
+
Zt as ol,
|
|
853
|
+
te as option,
|
|
854
|
+
oe as p,
|
|
855
|
+
fe as pre,
|
|
856
|
+
_e as progress,
|
|
854
857
|
u as projectLog,
|
|
855
858
|
Ve as property,
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
859
|
+
X as renderIf,
|
|
860
|
+
Lt as rs,
|
|
861
|
+
ut as rxRenderIf,
|
|
862
|
+
$e as s,
|
|
863
|
+
Bt as section,
|
|
864
|
+
Kt as select,
|
|
865
|
+
rt as setChildren,
|
|
866
|
+
ot as setEffects,
|
|
867
|
+
st as setHtmlContent,
|
|
865
868
|
q as setListeners,
|
|
866
|
-
|
|
867
|
-
|
|
869
|
+
Ft as show,
|
|
870
|
+
D as showIf,
|
|
868
871
|
A as signal,
|
|
869
|
-
|
|
870
|
-
|
|
872
|
+
ht as signalComponent,
|
|
873
|
+
De as slot,
|
|
871
874
|
ge as small,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
875
|
+
zt as span,
|
|
876
|
+
Oe as strong,
|
|
877
|
+
ke as sub,
|
|
878
|
+
He as summary,
|
|
879
|
+
Me as sup,
|
|
880
|
+
Dt as table,
|
|
878
881
|
Vt as td,
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
+
V as textContentWrapper,
|
|
883
|
+
ee as textarea,
|
|
884
|
+
Gt as th,
|
|
882
885
|
Nt as tr,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
886
|
+
we as u,
|
|
887
|
+
Ut as ul,
|
|
888
|
+
It as unsafeHtml,
|
|
889
|
+
_t as useCustomComponent,
|
|
890
|
+
Je as video,
|
|
891
|
+
Pt as when
|
|
889
892
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IsPromise, IsPromiseFunction, UnwrapPromise } from './helpers.types';
|
|
2
2
|
import { CompareFn, ReactiveSignal, UnwrapSignal } from './signal.type';
|
|
3
|
+
export declare let isEffectDebugEnabled: boolean;
|
|
3
4
|
export declare const effectMap: Map<string, {
|
|
4
5
|
signals: Array<ReactiveSignal<any>>;
|
|
5
6
|
parent: string | null;
|
|
@@ -24,4 +25,4 @@ export declare const isReactiveSignal: <R extends ReactiveSignal<any>>(v: R | an
|
|
|
24
25
|
* // log: "abc-test"
|
|
25
26
|
*/
|
|
26
27
|
export declare function rs<T extends ReactiveSignal<any> | any>(strings: TemplateStringsArray, ...values: T[]): ReactiveSignal<string>;
|
|
27
|
-
export declare function createSignal<T extends Promise<any> | (() => any), I extends UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T> | undefined>(cb: T, initializeValue?: I): I extends undefined ?
|
|
28
|
+
export declare function createSignal<T extends Promise<any> | (() => any), I extends UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T> | undefined>(cb: T, initializeValue?: I): I extends undefined ? IsPromise<T> extends true ? ReactiveSignal<UnwrapPromise<T> | null> : IsPromiseFunction<T> extends true ? ReactiveSignal<UnwrapPromise<T extends () => infer R ? R : never> | null> : ReactiveSignal<UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : never>> : ReactiveSignal<UnwrapPromise<T extends () => infer R ? UnwrapSignal<R> : T>>;
|
|
@@ -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 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"})});
|