cradova 3.5.4 → 3.5.6
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/dist/index.js +1 -1
- package/dist/primitives/classes.d.ts +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class U{static compId=0;afterMount=[];beforeMountActive=[];afterDeactivate=[];dispatchEvent(H){let L=this[H];if(H.includes("Active")){for(let T=0;T<L.length;T++)L[T]();return}while(L.length!==0)L.shift()()}}var J=new U;class G{id=0;component;effects=[];effectuate=null;rendered=!1;published=!1;preRendered=null;reference=null;subData=null;_state=[];_state_index=0;constructor(H){this.component=H.bind(this)}preRender(){this.preRendered=this.render()}render(){if(U.compId+=1,this.id=U.compId,this.effects=[],this.rendered=!1,!this.preRendered){this._state_index=0,this._state=[];let H=this.component();if(H instanceof HTMLElement)this.reference=H,this.effector.apply(this),this.rendered=!0,this.published=!0;else console.error(" ✘ Cradova err : Invalid html content, got - "+H);return H}else return this.preRendered}_effect(H){if(!this.rendered)this.effects.push(H.bind(this))}async effector(){for(let H=0;H<this.effects.length;H++){let L=await this.effects[H].apply(this);if(typeof L==="function")J.afterDeactivate.push(L)}if(this.effects=[],this.effectuate)this.effectuate(),this.effectuate=null}recall(){if(!this.rendered)this.effectuate=()=>{if(this.published)this.activate()};else if(this.published)setTimeout(()=>{this.activate()})}async activate(){if(this.published=!1,!this.rendered)return;this._state_index=0;let H=this.reference;if(document.contains(H)){let L=this.component();if(L instanceof HTMLElement)H.insertAdjacentElement("beforebegin",L),H.remove(),this.published=!0,this.reference=L,J.dispatchEvent("afterMount");else console.error(" ✘ Cradova err : Invalid html, got - "+L)}else this.reference=null,this.rendered=!1}}class Z{pn;subs;pipe;constructor(H,L){if(this.pipe=H,this.subs={},L&&L.persistName){this.pn=L.persistName;let T=localStorage.getItem(L.persistName);if(T&&T!=="undefined")this.pipe=JSON.parse(T);if(typeof H==="object"){for(let M in H)if(!Object.prototype.hasOwnProperty.call(this.pipe,M))this.pipe[M]=H[M]}}}publish(H,L){this.pipe[H]=L;let T=this.subs[H]||[];for(let M=0;M<T.length;M++){let E=T[M];E.subData=L,E.recall()}if(this.pn)localStorage.setItem(this.pn,JSON.stringify(this.pipe))}subscribe(H,L){if(L instanceof G){if(this.subs[H]?.find((T)=>T.id===L.id))return;if(!this.subs[H])this.subs[H]=[L];else this.subs[H].push(L);if(this.pipe[H])L.subData=this.pipe[H]}}clearPersist(){if(this.pn)localStorage.removeItem(this.pn)}}class q{_name;_html;_template=document.createElement("div");_dropped=!1;_snapshot;_snapshot_html;_deCB;constructor(H){let{template:L,name:T}=H;this._html=L,this._name=T||document.title,this._template.setAttribute("id","page"),this._snapshot=H.snapshotIsolation||!1}async _takeSnapShot(){if(A.doc.dataset.snapshot==="true")return;try{let H=await fetch(location.href);if(!H.ok)throw new Error("Failed to fetch the page");let L=await H.text(),M=new DOMParser().parseFromString(L,"text/html");M.title=this._name;let E=M.querySelector('[data-wrapper="app"]');if(E)E.setAttribute("data-snapshot","true"),E.innerHTML=this._snapshot_html;else{console.error("Wrapper or template is not found");return}let I=M.documentElement.outerHTML;await fetch(`${location.origin}`,{body:I,method:"POST",headers:{"Content-Type":"text/html","cradova-snapshot":location.href.slice(location.origin.length)}})}catch(H){console.error("Snapshot error:",H)}this._snapshot_html=void 0}set onDeactivate(H){this._deCB=H}drop(H){if(typeof H==="boolean"){this._dropped=H;return}else return this._dropped}async _activate(){if(this._dropped){history.go(-1);return}let H=this._html.apply(this);if(H instanceof HTMLElement)this._template.innerHTML="",this._template.appendChild(H);else throw new Error(` ✘ Cradova err: template function for the page returned ${H} instead of html`);if(document.title=this._name,A.doc.innerHTML="",J.dispatchEvent("beforeMountActive"),this._snapshot)this._snapshot_html=this._template.outerHTML;if(A.doc.appendChild(this._template),J.dispatchEvent("afterMount"),window.scrollTo({top:0,left:0,behavior:"instant"}),J.dispatchEvent("afterDeactivate"),this._snapshot)this._takeSnapShot()}}class Q{doc=null;lastNavigatedRouteController;nextRouteController;lastNavigatedRoute;pageShow=null;pageHide=null;errorHandler;loadingPage=null;pageData={params:{}};routes={};paused=!1;route(H,L){if(!L)console.error(" ✘ Cradova err: not a valid page ",L);return this.routes[H]=L}async router(H,L){let T=window.location.href,M,E;if(this.paused){window.location.hash="paused";return}if(this.nextRouteController)M=this.nextRouteController,this.nextRouteController=void 0;else[M,E]=this.checker(T);if(typeof M!=="undefined")try{if(typeof M==="function"){if(this.loadingPage instanceof q)await this.loadingPage._activate();if(M=await M(),M?.default)M=M.default;if(!M){if(this.lastNavigatedRoute)history.pushState({},T,this.lastNavigatedRoute);return}}if(E)this.pageData.params=E;await M._activate(),this.lastNavigatedRouteController&&this.lastNavigatedRouteController._deCB?.(),this.lastNavigatedRoute=T,this.lastNavigatedRouteController=M}catch(I){if(typeof this.errorHandler==="function")this.errorHandler(I,T);else console.error(I)}else if(this.routes["*"])await this.routes["*"]._activate()}checker(H){if(H[0]!=="/")H=H.slice(H.indexOf("/",8));if(this.routes[H])return[this.routes[H],{path:H}];if(H.includes("?")){let L,T={};if([H,L]=H.split("?"),new URLSearchParams(L).forEach((M,E)=>{T[E]=M}),this.routes[H])return[this.routes[H],T]}for(let L in this.routes){if(L.includes(":")){let T=H.split("/"),M=L.split("/");if(H.endsWith("/"))T.pop();let E=0,I=0;if(M.length===T.length){for(let D=0;D<M.length;D++){if(M[D].includes(":")){I++;continue}if(T[D]===M[D])E++}if(E+I===M.length){let D={};for(let O=0;O<M.length;O++)if(M[O].includes(":"))D[M[O].split(":")[1]]=T[O];return[this.routes[L],D]}}}if(L.includes("*")){let T=L.slice(0,-1);if(H.startsWith(T))return[this.routes[L],{extraPath:H.slice(T.length)}]}}return[]}}var A=new Q;class Y{static BrowserRoutes(H){for(let L in H){let T=H[L];if(typeof T==="object"&&typeof T.then==="function"||typeof T==="function")A.routes[L]=async()=>{let M=typeof T==="function"?await T():await T;return A.route(L,M)};else A.route(L,T)}Y._mount()}static pauseNavigation(){A.paused=!0,window.location.hash="paused"}static resumeNavigation(){A.paused=!1,window.location.replace(window.location.pathname+window.location.search),history.go(-1)}static navigate(H,L){if(typeof H!=="string")console.error(" ✘ Cradova err: href must be a defined path but got "+H+" instead");let T=null,M;if(H.includes("."))window.location.href=H;else{if([T,M]=A.checker(H),T)A.nextRouteController=T,window.history.pushState({},"",H);A.pageData.params=M,A.pageData.data=L,A.router(null)}}static setLoadingPage(H){if(H instanceof q)A.loadingPage=H;else throw new Error(" ✘ Cradova err: Loading Page should be a cradova page class")}static get PageData(){return A.pageData}static addErrorHandler(H){if(typeof H==="function")A.errorHandler=H;else throw new Error(" ✘ Cradova err: callback for error event is not a function")}static _mount(){let H=document.querySelector("[data-wrapper=app]");if(H)A.doc=H;else throw new Error(`✘ Cradova err: please add '<div data-wrapper="app"></div>' to the body of your index.html file `);window.addEventListener("pageshow",()=>A.router()),window.addEventListener("popstate",(L)=>{L.preventDefault(),A.router()})}}class z{tree={};bindAs(H){return[this,H]}elem(H){let L=this.tree[H];if(document.contains(L))return L;this.tree[H]=void 0}swap(H,L){[this.tree[H],this.tree[L]]=[this.tree[L],this.tree[H]]}_append(H,L){this.tree[H]=L}}var K=(H,L)=>{let T={},M=void 0;if(L.length!==0)for(let E=0;E<L.length;E++){let I=L[E];if(typeof I==="function")I=I();if(I instanceof G)I=I.render();if(I instanceof HTMLElement||I instanceof DocumentFragment){H.appendChild(I);continue}if(Array.isArray(I)){H.appendChild(S(I));continue}if(typeof I==="string"){M=I;continue}if(typeof I==="object"){Object.assign(T,I);continue}}else return H;if(typeof T==="object"&&H)for(let[E,I]of Object.entries(T)){if(E==="style"&&typeof I==="object"){Object.assign(H.style,I);continue}if(E==="href"){let D=I||"";if(!D.includes("://"))H.addEventListener("click",(O)=>{if(O.preventDefault(),Y.navigate(H.href),D.includes("#")){let W=D.split("#").at(-1);document.getElementById("#"+W)?.scrollIntoView()}});H.setAttribute(E,I);continue}if(E==="onmount"){J.afterMount.push(()=>{typeof T.onmount==="function"&&T.onmount.apply(H)});continue}if(E.includes("data-")||E.includes("aria-")){H.setAttribute(E,I);continue}if(Array.isArray(I)){if(E=="ref"&&I[0]instanceof z){I[0]._append(I[1],H);continue}}H[E]=I}if(M!==void 0)H.appendChild(document.createTextNode(M));return H},V=(H)=>{return(...L)=>K(document.createElement(H),L)};function S(H){let L=new DocumentFragment;for(let T of H)if(Array.isArray(T))L.appendChild(S(T));else{if(T instanceof G)T=T.render();if(typeof T==="function"){if(T=T(),typeof T==="function")T=T()}if(T instanceof HTMLElement||T instanceof DocumentFragment){L.appendChild(T);continue}if(typeof T==="string")L.appendChild(document.createTextNode(T))}return L}function x(H,...L){if(H)return L}function j(H,L,T){if(H)return L;return T}function y(H,...L){return(T)=>{if(T===H)return L;return}}function g(H,...L){let T;if(L.length){for(let M=0;M<L.length;M++)if(T=L[M](H),T)break}return T}function b(H,L){return Array.isArray(H)?H.map(L):void 0}var F=function(H){let L=document.createDocumentFragment();for(let T=0;T<H.length;T++){let M=H[T];if(typeof M==="function")M=M();if(M instanceof HTMLElement||M instanceof DocumentFragment){L.appendChild(M);continue}if(M instanceof String){L.appendChild(document.createTextNode(M));continue}console.error(" ✘ Cradova err: wrong element type"+M)}return L};function w(H,L){L._state_index+=1;let T=L._state_index;if(T>=L._state.length)L._state[T]=H;function M(E){if(typeof E==="function")E=E(L._state[T]);L._state[T]=E,L.recall()}return[L._state[T],M]}function _(H,L){L._effect(H)}function P(){return new z}var N=V("a"),B=V("audio"),c=V("button"),f=V("canvas"),R=V("div"),s=V("footer"),C=V("form"),o=V("h1"),v=V("h2"),d=V("h3"),i=V("h4"),h=V("h5"),p=V("h6"),u=V("header"),m=V("i"),t=V("iframe"),l=V("img"),r=V("input"),a=V("label"),e=V("li"),HH=V("main"),LH=V("nav"),TH=V("ol"),MH=V("optgroup"),EH=V("option"),IH=V("p"),VH=V("section"),AH=V("select"),DH=V("source"),OH=V("span"),JH=V("textarea"),GH=V("ul"),UH=V("video"),YH=(H,L)=>{let T=document.createElement("span");return T.innerHTML=H,K(T,L||[])},qH=(H)=>{let L=document.createElement("div");if(Array.isArray(H))L.innerHTML=H[0];else if(typeof H==="string")L.innerHTML=H;let T=new DocumentFragment;return T.append(...Array.from(L.children)),T};export{UH as video,w as useState,P as useRef,_ as useEffect,GH as ul,JH as textarea,YH as svg,OH as span,DH as source,AH as select,VH as section,qH as raw,IH as p,EH as option,MH as optgroup,TH as ol,LH as nav,K as makeElement,HH as main,b as loop,e as li,a as label,r as input,l as img,t as iframe,m as i,u as header,p as h6,h as h5,i as h4,d as h3,v as h2,o as h1,F as frag,C as form,s as footer,R as div,V as cra,f as canvas,c as button,B as audio,N as a,Z as Signal,Y as Router,S as Rhoda,q as Page,J as CradovaEvent,G as Comp,g as $switch,j as $ifelse,x as $if,y as $case};
|
|
1
|
+
class U{static compId=0;afterMount=[];beforeMountActive=[];afterDeactivate=[];dispatchEvent(H){let L=this[H];if(H.includes("Active")){for(let T=0;T<L.length;T++)L[T]();return}while(L.length!==0)L.shift()()}}var J=new U;class G{id=0;component;effects=[];effectuate=null;rendered=!1;published=!1;preRendered=null;reference=null;subData=null;_state=[];_state_index=0;constructor(H){this.component=H.bind(this)}preRender(H){this.preRendered=this.render(H)}render(H){if(U.compId+=1,this.id=U.compId,this.effects=[],this.rendered=!1,!this.preRendered){this._state_index=0,this._state=[];let L=this.component(H);if(L instanceof HTMLElement)this.reference=L,this.effector.apply(this),this.rendered=!0,this.published=!0;else console.error(" ✘ Cradova err : Invalid html content, got - "+L);return L}else return this.preRendered}_effect(H){if(!this.rendered)this.effects.push(H.bind(this))}async effector(){for(let H=0;H<this.effects.length;H++){let L=await this.effects[H].apply(this);if(typeof L==="function")J.afterDeactivate.push(L)}if(this.effects=[],this.effectuate)this.effectuate(),this.effectuate=null}recall(H){if(!this.rendered)this.effectuate=()=>{if(this.published)this.activate(H)};else if(this.published)setTimeout(()=>{this.activate(H)})}async activate(H){if(this.published=!1,!this.rendered)return;this._state_index=0;let L=this.reference;if(document.contains(L)){let T=this.component(H);if(T instanceof HTMLElement)L.insertAdjacentElement("beforebegin",T),L.remove(),this.published=!0,this.reference=T,J.dispatchEvent("afterMount");else console.error(" ✘ Cradova err : Invalid html, got - "+T)}else this.reference=null,this.rendered=!1}}class Z{pn;subs;pipe;constructor(H,L){if(this.pipe=H,this.subs={},L&&L.persistName){this.pn=L.persistName;let T=localStorage.getItem(L.persistName);if(T&&T!=="undefined")this.pipe=JSON.parse(T);if(typeof H==="object"){for(let M in H)if(!Object.prototype.hasOwnProperty.call(this.pipe,M))this.pipe[M]=H[M]}}}publish(H,L){this.pipe[H]=L;let T=this.subs[H]||[];for(let M=0;M<T.length;M++){let E=T[M];E.subData=L,E.recall()}if(this.pn)localStorage.setItem(this.pn,JSON.stringify(this.pipe))}subscribe(H,L){if(L instanceof G){if(this.subs[H]?.find((T)=>T.id===L.id))return;if(!this.subs[H])this.subs[H]=[L];else this.subs[H].push(L);if(this.pipe[H])L.subData=this.pipe[H]}}clearPersist(){if(this.pn)localStorage.removeItem(this.pn)}}class q{_name;_html;_template=document.createElement("div");_dropped=!1;_snapshot;_snapshot_html;_deCB;constructor(H){let{template:L,name:T}=H;this._html=L,this._name=T||document.title,this._template.setAttribute("id","page"),this._snapshot=H.snapshotIsolation||!1}async _takeSnapShot(){if(A.doc.dataset.snapshot==="true")return;try{let H=await fetch(location.href);if(!H.ok)throw new Error("Failed to fetch the page");let L=await H.text(),M=new DOMParser().parseFromString(L,"text/html");M.title=this._name;let E=M.querySelector('[data-wrapper="app"]');if(E)E.setAttribute("data-snapshot","true"),E.innerHTML=this._snapshot_html;else{console.error("Wrapper or template is not found");return}let I=M.documentElement.outerHTML;await fetch(`${location.origin}`,{body:I,method:"POST",headers:{"Content-Type":"text/html","cradova-snapshot":location.href.slice(location.origin.length)}})}catch(H){console.error("Snapshot error:",H)}this._snapshot_html=void 0}set onDeactivate(H){this._deCB=H}drop(H){if(typeof H==="boolean"){this._dropped=H;return}else return this._dropped}async _activate(){if(this._dropped){history.go(-1);return}let H=this._html.apply(this);if(H instanceof HTMLElement)this._template.innerHTML="",this._template.appendChild(H);else throw new Error(` ✘ Cradova err: template function for the page returned ${H} instead of html`);if(document.title=this._name,A.doc.innerHTML="",J.dispatchEvent("beforeMountActive"),this._snapshot)this._snapshot_html=this._template.outerHTML;if(A.doc.appendChild(this._template),J.dispatchEvent("afterMount"),window.scrollTo({top:0,left:0,behavior:"instant"}),J.dispatchEvent("afterDeactivate"),this._snapshot)this._takeSnapShot()}}class Q{doc=null;lastNavigatedRouteController;nextRouteController;lastNavigatedRoute;pageShow=null;pageHide=null;errorHandler;loadingPage=null;pageData={params:{}};routes={};paused=!1;route(H,L){if(!L)console.error(" ✘ Cradova err: not a valid page ",L);return this.routes[H]=L}async router(H,L){let T=window.location.href,M,E;if(this.paused){window.location.hash="paused";return}if(this.nextRouteController)M=this.nextRouteController,this.nextRouteController=void 0;else[M,E]=this.checker(T);if(typeof M!=="undefined")try{if(typeof M==="function"){if(this.loadingPage instanceof q)await this.loadingPage._activate();if(M=await M(),M?.default)M=M.default;if(!M){if(this.lastNavigatedRoute)history.pushState({},T,this.lastNavigatedRoute);return}}if(E)this.pageData.params=E;await M._activate(),this.lastNavigatedRouteController&&this.lastNavigatedRouteController._deCB?.(),this.lastNavigatedRoute=T,this.lastNavigatedRouteController=M}catch(I){if(typeof this.errorHandler==="function")this.errorHandler(I,T);else console.error(I)}else if(this.routes["*"])await this.routes["*"]._activate()}checker(H){if(H[0]!=="/")H=H.slice(H.indexOf("/",8));if(this.routes[H])return[this.routes[H],{path:H}];if(H.includes("?")){let L,T={};if([H,L]=H.split("?"),new URLSearchParams(L).forEach((M,E)=>{T[E]=M}),this.routes[H])return[this.routes[H],T]}for(let L in this.routes){if(L.includes(":")){let T=H.split("/"),M=L.split("/");if(H.endsWith("/"))T.pop();let E=0,I=0;if(M.length===T.length){for(let D=0;D<M.length;D++){if(M[D].includes(":")){I++;continue}if(T[D]===M[D])E++}if(E+I===M.length){let D={};for(let O=0;O<M.length;O++)if(M[O].includes(":"))D[M[O].split(":")[1]]=T[O];return[this.routes[L],D]}}}if(L.includes("*")){let T=L.slice(0,-1);if(H.startsWith(T))return[this.routes[L],{extraPath:H.slice(T.length)}]}}return[]}}var A=new Q;class Y{static BrowserRoutes(H){for(let L in H){let T=H[L];if(typeof T==="object"&&typeof T.then==="function"||typeof T==="function")A.routes[L]=async()=>{let M=typeof T==="function"?await T():await T;return A.route(L,M)};else A.route(L,T)}Y._mount()}static pauseNavigation(){A.paused=!0,window.location.hash="paused"}static resumeNavigation(){A.paused=!1,window.location.replace(window.location.pathname+window.location.search),history.go(-1)}static navigate(H,L){if(typeof H!=="string")console.error(" ✘ Cradova err: href must be a defined path but got "+H+" instead");let T=null,M;if(H.includes("."))window.location.href=H;else{if([T,M]=A.checker(H),T)A.nextRouteController=T,window.history.pushState({},"",H);A.pageData.params=M,A.pageData.data=L,A.router(null)}}static setLoadingPage(H){if(H instanceof q)A.loadingPage=H;else throw new Error(" ✘ Cradova err: Loading Page should be a cradova page class")}static get PageData(){return A.pageData}static addErrorHandler(H){if(typeof H==="function")A.errorHandler=H;else throw new Error(" ✘ Cradova err: callback for error event is not a function")}static _mount(){let H=document.querySelector("[data-wrapper=app]");if(H)A.doc=H;else throw new Error(`✘ Cradova err: please add '<div data-wrapper="app"></div>' to the body of your index.html file `);window.addEventListener("pageshow",()=>A.router()),window.addEventListener("popstate",(L)=>{L.preventDefault(),A.router()})}}class z{tree={};bindAs(H){return[this,H]}elem(H){let L=this.tree[H];if(document.contains(L))return L;this.tree[H]=void 0}swap(H,L){[this.tree[H],this.tree[L]]=[this.tree[L],this.tree[H]]}_append(H,L){this.tree[H]=L}}var K=(H,L)=>{let T={},M=void 0;if(L.length!==0)for(let E=0;E<L.length;E++){let I=L[E];if(typeof I==="function")I=I();if(I instanceof G)I=I.render();if(I instanceof HTMLElement||I instanceof DocumentFragment){H.appendChild(I);continue}if(Array.isArray(I)){H.appendChild(S(I));continue}if(typeof I==="string"){M=I;continue}if(typeof I==="object"){Object.assign(T,I);continue}}else return H;if(typeof T==="object"&&H)for(let[E,I]of Object.entries(T)){if(E==="style"&&typeof I==="object"){Object.assign(H.style,I);continue}if(E==="href"){let D=I||"";if(!D.includes("://"))H.addEventListener("click",(O)=>{if(O.preventDefault(),Y.navigate(H.href),D.includes("#")){let W=D.split("#").at(-1);document.getElementById("#"+W)?.scrollIntoView()}});H.setAttribute(E,I);continue}if(E==="onmount"){J.afterMount.push(()=>{typeof T.onmount==="function"&&T.onmount.apply(H)});continue}if(E.includes("data-")||E.includes("aria-")){H.setAttribute(E,I);continue}if(Array.isArray(I)){if(E=="ref"&&I[0]instanceof z){I[0]._append(I[1],H);continue}}H[E]=I}if(M!==void 0)H.appendChild(document.createTextNode(M));return H},V=(H)=>{return(...L)=>K(document.createElement(H),L)};function S(H){let L=new DocumentFragment;for(let T of H)if(Array.isArray(T))L.appendChild(S(T));else{if(T instanceof G)T=T.render();if(typeof T==="function"){if(T=T(),typeof T==="function")T=T()}if(T instanceof HTMLElement||T instanceof DocumentFragment){L.appendChild(T);continue}if(typeof T==="string")L.appendChild(document.createTextNode(T))}return L}function x(H,...L){if(H)return L}function j(H,L,T){if(H)return L;return T}function y(H,...L){return(T)=>{if(T===H)return L;return}}function g(H,...L){let T;if(L.length){for(let M=0;M<L.length;M++)if(T=L[M](H),T)break}return T}function b(H,L){return Array.isArray(H)?H.map(L):void 0}var F=function(H){let L=document.createDocumentFragment();for(let T=0;T<H.length;T++){let M=H[T];if(typeof M==="function")M=M();if(M instanceof HTMLElement||M instanceof DocumentFragment){L.appendChild(M);continue}if(M instanceof String){L.appendChild(document.createTextNode(M));continue}console.error(" ✘ Cradova err: wrong element type"+M)}return L};function w(H,L){L._state_index+=1;let T=L._state_index;if(T>=L._state.length)L._state[T]=H;function M(E){if(typeof E==="function")E=E(L._state[T]);L._state[T]=E,L.recall()}return[L._state[T],M]}function _(H,L){L._effect(H)}function P(){return new z}var N=V("a"),B=V("audio"),c=V("button"),f=V("canvas"),R=V("div"),C=V("footer"),s=V("form"),v=V("h1"),d=V("h2"),i=V("h3"),o=V("h4"),h=V("h5"),u=V("h6"),m=V("header"),t=V("i"),p=V("iframe"),l=V("img"),r=V("input"),a=V("label"),e=V("li"),HH=V("main"),LH=V("nav"),TH=V("ol"),MH=V("optgroup"),EH=V("option"),IH=V("p"),VH=V("section"),AH=V("select"),DH=V("source"),OH=V("span"),JH=V("textarea"),GH=V("ul"),UH=V("video"),YH=(H,L)=>{let T=document.createElement("span");return T.innerHTML=H,K(T,L||[])},qH=(H)=>{let L=document.createElement("div");if(Array.isArray(H))L.innerHTML=H[0];else if(typeof H==="string")L.innerHTML=H;let T=new DocumentFragment;return T.append(...Array.from(L.children)),T};export{UH as video,w as useState,P as useRef,_ as useEffect,GH as ul,JH as textarea,YH as svg,OH as span,DH as source,AH as select,VH as section,qH as raw,IH as p,EH as option,MH as optgroup,TH as ol,LH as nav,K as makeElement,HH as main,b as loop,e as li,a as label,r as input,l as img,p as iframe,t as i,m as header,u as h6,h as h5,o as h4,i as h3,d as h2,v as h1,F as frag,s as form,C as footer,R as div,V as cra,f as canvas,c as button,B as audio,N as a,Z as Signal,Y as Router,S as Rhoda,q as Page,J as CradovaEvent,G as Comp,g as $switch,j as $ifelse,x as $if,y as $case};
|
|
@@ -34,7 +34,7 @@ export declare const CradovaEvent: cradovaEvent;
|
|
|
34
34
|
* -------
|
|
35
35
|
* create dynamic components
|
|
36
36
|
*/
|
|
37
|
-
export declare class Comp<
|
|
37
|
+
export declare class Comp<Props extends Record<string, any> = any> {
|
|
38
38
|
id: number;
|
|
39
39
|
private component;
|
|
40
40
|
private effects;
|
|
@@ -43,11 +43,11 @@ export declare class Comp<Prop extends Record<string, any> = any> {
|
|
|
43
43
|
private published;
|
|
44
44
|
private preRendered;
|
|
45
45
|
private reference;
|
|
46
|
-
subData:
|
|
47
|
-
_state:
|
|
46
|
+
subData: Props | null;
|
|
47
|
+
_state: Props[];
|
|
48
48
|
_state_index: number;
|
|
49
|
-
constructor(component: (this: Comp<
|
|
50
|
-
preRender(): void;
|
|
49
|
+
constructor(component: (this: Comp<Props>) => HTMLElement);
|
|
50
|
+
preRender(props: Props): void;
|
|
51
51
|
/**
|
|
52
52
|
* Cradova Comp
|
|
53
53
|
* ---
|
|
@@ -55,7 +55,7 @@ export declare class Comp<Prop extends Record<string, any> = any> {
|
|
|
55
55
|
* @param data
|
|
56
56
|
* @returns () => HTMLElement
|
|
57
57
|
*/
|
|
58
|
-
render(): HTMLElement;
|
|
58
|
+
render(props?: Props): HTMLElement;
|
|
59
59
|
_effect(fn: () => Promise<void> | void): void;
|
|
60
60
|
private effector;
|
|
61
61
|
/**
|
|
@@ -65,7 +65,7 @@ export declare class Comp<Prop extends Record<string, any> = any> {
|
|
|
65
65
|
* @param data
|
|
66
66
|
* @returns
|
|
67
67
|
*/
|
|
68
|
-
recall(): void;
|
|
68
|
+
recall(props?: Props): void;
|
|
69
69
|
private activate;
|
|
70
70
|
}
|
|
71
71
|
/**
|