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