@dlightjs/components
Advanced tools
Comparing version 1.0.0-next.0 to 1.0.0-next.1
@@ -1,2 +0,2 @@ | ||
function m(){return location.hash.slice(2)}function f(){return location.pathname.slice(1)}function P(r,t){let e;if(r[0]==="/")e=r;else{r[0]!=="."&&(r="./"+r);let s=t==="history"?window.location.pathname:window.location.hash.replace(/^#/,""),o=r.split("/"),i=s.split("/").filter(a=>a),n=0;for(let a of o){if(![".",".."].includes(a))break;a===".."&&(i.length===0&&console.warn(`no ../ in ${r}`),i.pop()),n++}e="/"+[...i,...o.slice(n)].join("/")}return e}function y(r){return r.replace(/(^\/+)|(\/+$)/g,"")}function I(r,t){return!r&&!t?!0:!r||!t||Object.keys(r).length!==Object.keys(t).length?!1:Object.keys(r).every(e=>t[e]===r[e])}function U(r){return!!r.prototype?.View}var l=class{mode;constructor(t="history"){this.mode=t}hashTo(t){window.location.href="#"+P(t,this.mode)}historyTo(t){window.history.pushState({},"",P(t,this.mode))}to(t){if(this.mode==="hash"){this.hashTo(t);return}this.historyTo(t)}};import{CondNode as K,ExpNode as N,EnvNode as J,PropView as Q}from"@dlightjs/dlight";import{View as X}from"@dlightjs/dlight";var T=history.pushState,p=[],_=class extends X{constructor(){super(),this.updatePath=this.updatePath.bind(this),this.homeUrl=this.homeUrl.bind(this),this.collectRoutes=this.collectRoutes.bind(this),this.updateRoute=this.updateRoute.bind(this),this.historyChangeListen=this.historyChangeListen.bind(this),this.hashChangeListen=this.hashChangeListen.bind(this),this.willMount=this.willMount.bind(this),this.didMount=this.didMount.bind(this),this.willUnmount=this.willUnmount.bind(this)}$e$_dl_router_baseUrl;_dl_router_baseUrl="/";$$_dl_router_baseUrl=1;$p$mode;mode="history";$p$loading;loading;$p$guard;guard;$p$onPathUpdate;onPathUpdate;$$onPathUpdate=16;$s$onPathUpdate=["updatePath"];$p$afterEnter;afterEnter;$p$beforeLeave;beforeLeave;get routes(){return this._$children}$w$updatePath;updatePath(){this._$cache("updatePath",[this.onPathUpdate])||this.onPathUpdate&&this.onPathUpdate(this.prevInfo.path)}routeMap={};hitPath="";$$hitPath=256;prevInfo={path:"/"};$$prevInfo=512;viewHolder={propView:!0};$$viewHolder=1024;homeUrl(t){return t.replace(/^~/,this._dl_router_baseUrl)}loaded=!1;collectRoutes(t,e){this._$ud(this.routeMap[t]=e,"routeMap"),this.loaded&&this.updateRoute(this.prevInfo.path)}async updateRoute(t){this.loaded||this._$ud(this.loaded=!0,"loaded");let e="/"+t;t=y(e.replace(new RegExp(`^${this._dl_router_baseUrl}`),""));for(let[s,{comp:o,children:i,loading:n,redirect:a,info:d}]of Object.entries(this.routeMap)){let h=this.homeUrl(s.replace(/^(\.\/)+/,"")),q=h==="."&&t==="",b=t.startsWith(h+"/"),g=null,c;if(b||(g=t.match(new RegExp(`^${h}$`)),g&&(c=g.groups)),!(q||b||!!g))continue;let W=i??o;if(s===this.hitPath&&W===this.viewHolder.view&&I(c,this.viewHolder.params))return;let v={...d,path:e};if(this.guard){let $=await this.guard(v,this.prevInfo,this._dl_router_baseUrl);if($===!1){this.navigator.to(this.prevInfo.path);return}if(typeof $=="string"){this.navigator.to(this.homeUrl($));return}}if(a){this.navigator.to(this.homeUrl(a));return}this.beforeLeave&&await this.beforeLeave(v,this.prevInfo,this._dl_router_baseUrl);let w=async()=>{this.afterEnter&&await this.afterEnter(v,this.prevInfo,this._dl_router_baseUrl)};if(i)this._$ud(this.viewHolder={view:i,propView:!0},"viewHolder"),w();else if(o)if(U(o))this._$ud(this.viewHolder={view:o,propView:!1,params:c},"viewHolder"),w();else{let $=n??this.loading;$&&this._$ud(this.viewHolder={view:$,propView:!!$.propViewFunc},"viewHolder"),o().then(z=>{this._$ud(this.viewHolder={view:z.default,propView:!1,params:c},"viewHolder"),w()})}this._$ud(this.hitPath=s,"hitPath"),this._$ud(this.prevInfo={path:e,...c},"prevInfo");return}}navigator=new l;$$navigator=4096;historyChangeListen(){let t=f();t!==this.prevInfo.path&&this.updateRoute(t)}hashChangeListen(){let t=m();t!==this.prevInfo.path&&this.updateRoute(t)}willMount(){this._$ud(this.navigator.mode=this.mode,"navigator"),Promise.resolve().then(()=>{this.mode==="hash"?this.hashChangeListen():this.historyChangeListen()})}didMount(){if(this.mode==="hash"){addEventListener("load",this.hashChangeListen),addEventListener("hashchange",this.hashChangeListen);return}addEventListener("load",this.historyChangeListen),addEventListener("popstate",this.historyChangeListen),p.push(this.historyChangeListen),history.pushState=new Proxy(T,{apply(t,e,s){let o=t.apply(e,s);return p.forEach(i=>i()),o}})}willUnmount(){if(this.mode==="hash"){removeEventListener("load",this.hashChangeListen),removeEventListener("hashchange",this.hashChangeListen);return}removeEventListener("load",this.historyChangeListen),removeEventListener("popstate",this.historyChangeListen),p=p.filter(t=>t!==this.historyChangeListen),p.length>0?history.pushState=new Proxy(T,{apply(t,e,s){let o=t.apply(e,s);return p.forEach(i=>i()),o}}):history.pushState=T}Body(){let t,e,s;return this._$update=o=>{o&257&&t&&t.updateEnv("_dl_router_baseUrl",()=>"/"+y(`${this._dl_router_baseUrl}/${this.hitPath}`),[this._dl_router_baseUrl,this.hitPath]),o&512&&t&&t.updateEnv("path",()=>this.prevInfo.path,[this.prevInfo.path]),o&1024&&s&&s.updateCond(),o&4096&&t&&t.updateEnv("navigator",()=>this.navigator,[this.navigator]),s&&s.update(o)},t=new J({_dl_router_routesCollect:this.collectRoutes,_dl_router_baseUrl:"/"+y(`${this._dl_router_baseUrl}/${this.hitPath}`),path:this.prevInfo.path,navigator:this.navigator},{_dl_router_routesCollect:[],_dl_router_baseUrl:[this._dl_router_baseUrl,this.hitPath],path:[this.prevInfo.path],navigator:[this.navigator]}),e=new N(this.routes,[]),s=new K(1024,o=>{if(this.viewHolder.propView){if(o.cond===0)return o.didntChange=!0,[];o.cond=0;let i;return o.updateFunc=n=>{n&1024&&i&&i.update(()=>this.viewHolder.view,[this.viewHolder.view])},i=new N(this.viewHolder.view,[this.viewHolder.view]),o.cond===0?[i]:o.updateCond()}else{if(o.cond===1)return o.didntChange=!0,[];o.cond=1;let i,n;return o.updateFunc=a=>{a&1024&&n&&n.update(()=>i,[this.viewHolder.view]),i&&i.update(a)},i=new Q(a=>{let d;return a(h=>{h&1024&&d&&d._$setProps(()=>this.viewHolder.params,[this.viewHolder.params])}),d=new this.viewHolder.view,d._$init(null,null,null,null),[d]}),n=new N(i,[this.viewHolder.view]),o.cond===1?[n]:o.updateCond()}}),t.initNodes([e,s]),[t]}},Y=_;import{View as tt,required as et}from"@dlightjs/dlight";var L=class extends tt{constructor(){super(),this.collectRoutes=this.collectRoutes.bind(this)}$e$_dl_router_routesCollect;_dl_router_routesCollect=et;$$_dl_router_routesCollect=1;$s$_dl_router_routesCollect=["collectRoutes"];$p$path;_$contentKey="path";path=".*";$$path=2;$s$path=["collectRoutes"];$p$comp;comp;$$comp=4;$s$comp=["collectRoutes"];get children(){return this._$children}$p$loading;loading;$$loading=8;$s$loading=["collectRoutes"];$p$redirect;redirect;$$redirect=16;$s$redirect=["collectRoutes"];$p$info;info;$$info=32;$s$info=["collectRoutes"];$w$collectRoutes;collectRoutes(){this._$cache("collectRoutes",[this._dl_router_routesCollect,this.path,this.comp,this.loading,this.redirect,this.info])||this._dl_router_routesCollect(this.path,{comp:this.comp,children:this.children,loading:this.loading,redirect:this.redirect,info:this.info})}},st=L;import{createElement as it,setStyle as k,delegateEvent as ot,setHTMLProp as D,insertNode as rt,ExpNode as nt}from"@dlightjs/dlight";import{View as at,required as E}from"@dlightjs/dlight";var x=class extends at{constructor(){super(),this.handleClick=this.handleClick.bind(this)}$p$content;_$contentKey="content";content=E;$$content=1;$p$to;to=E;$p$mode;mode="history";$$mode=4;$s$mode=["nav"];$p$style;style={};$$style=8;$p$class;class="";$$class=16;get children(){return this._$children}$e$navigator;navigator=E;$$navigator=32;$s$navigator=["nav"];nav;get $f$nav(){return this._$cache("nav",[this.navigator,this.mode])?this.nav:this.navigator??new l(this.mode)}handleClick(t){if(t.preventDefault(),this.to.startsWith("http"))return window.open(this.to,"_blank");if(this.to.startsWith("?")){let e=this.nav.mode==="history"?f():m();return this.nav.to(e+this.to)}this.nav.to(this.to)}Body(){let t,e;return this._$update=s=>{s&1&&e&&e.update(()=>this.children??this.content,[this.content]),s&8&&t&&k(t,this.style),s&16&&t&&D(t,"className",()=>this.class,[this.class])},t=it("a"),k(t,this.style),D(t,"className",()=>this.class,[this.class]),ot(t,"click",this.handleClick),e=new nt(this.children??this.content,[this.content]),rt(t,e,0),t._$nodes=[e],[t]}},dt=x;import{CondNode as ht,ExpNode as $t,PropView as lt}from"@dlightjs/dlight";import{View as pt}from"@dlightjs/dlight";function ts(r,t){class e extends pt{constructor(){super(),this.willMount=this.willMount.bind(this)}_$forwardProps;_$forwardPropsSet=new Set;_$forwardPropsId=[];ViewCls;$$ViewCls=8;willMount(){r().then(o=>{this._$ud(this.ViewCls=o.default,"ViewCls")})}Body(){let o;return this._$update=i=>{i&8&&o&&o.updateCond(),o&&o.update(i)},o=new ht(8,i=>{if(this.ViewCls){if(i.cond===0)return i.didntChange=!0,[];i.cond=0;let n,a;return i.updateFunc=d=>{d&8&&a&&a.update(()=>n,[this.ViewCls]),n&&n.update(d)},n=new lt(d=>{let h;return h=new this.ViewCls,h._$init(null,null,null,this),[h]}),a=new $t(n,[this.ViewCls]),i.cond===0?[a]:i.updateCond()}else if(t){if(i.cond===1)return i.didntChange=!0,[];i.cond=1;let n;return i.updateFunc=a=>{},n=new t,n._$init(null,null,null,null),i.cond===1?[n]:i.updateCond()}else return i.cond===2?(i.didntChange=!0,[]):(i.cond=2,i.updateFunc=n=>{},i.cond===2?[]:i.updateCond())}),[o]}}return e}import{createElement as ct,setStyle as F,setHTMLProp as G,insertNode as gt,ExpNode as mt}from"@dlightjs/dlight";import{View as H}from"@dlightjs/dlight";function ut(r,t){let e=[...r].reverse();for(;e.length>0;){let s=e.pop();t(s),"_$dlNodeType"in s?s._$nodes&&e.push(...[...s._$nodes].reverse()):s._$nodes?e.push(...[...s._$nodes].reverse()):e.push(...[...s.childNodes].reverse())}}function u(r,t){let e=s=>{ut(s,o=>{if(o.initNewNodes){let i=o.initNewNodes;o.initNewNodes=function(n){i.call(this,n),t(n),e(n)}}})};e(r)}var M=class extends H{constructor(){super(),this.setStyles=this.setStyles.bind(this),this.didMount=this.didMount.bind(this)}$p$spacing;spacing=0;$$spacing=1;$p$alignment;alignment="top";$$alignment=2;$s$alignment=["margin"];$p$width;width="100%";$$width=4;$p$height;height="max-content";$$height=8;$p$style;style={};$$style=16;$p$class;class;$$class=32;get children(){return this._$children}margin;get $f$margin(){return this._$cache("margin",[this.alignment])?this.margin:{top:"0 0 auto 0",bottom:"auto 0 0 0",center:"auto 0"}[this.alignment]??"0 0 auto 0"}nodes=[];setStyles(t){H.loopShallowEls(t,e=>{e.style.flexShrink="0",e.style.margin=this.margin})}didMount(){this.setStyles(this.nodes),u(this.nodes,this.setStyles)}Body(){let t,e;return this._$update=s=>{s&29&&t&&F(t,{...this.style,height:this.height,width:this.width,columnGap:`${this.spacing}px`,display:"flex",flexDirection:"row"}),s&32&&t&&G(t,"className",()=>this.class,[this.class])},t=ct("div"),G(t,"className",()=>this.class,[this.class]),F(t,{...this.style,height:this.height,width:this.width,columnGap:`${this.spacing}px`,display:"flex",flexDirection:"row"}),e=new mt(this.children,[]),H.addDidMount(e,s=>{this._$ud(this.nodes=s._$nodes,"nodes")}),gt(t,e,0),t._$nodes=[e],[t]}},ft=M;import{createElement as yt,setStyle as j,setHTMLProp as O,insertNode as vt,ExpNode as wt}from"@dlightjs/dlight";import{View as S}from"@dlightjs/dlight";var R=class extends S{constructor(){super(),this.setStyles=this.setStyles.bind(this),this.didMount=this.didMount.bind(this)}$p$spacing;spacing=0;$$spacing=1;$p$alignment;alignment="leading";$$alignment=2;$s$alignment=["margin"];$p$width;width="max-content";$$width=4;$p$height;height="100%";$$height=8;$p$style;style={};$$style=16;$p$class;class;$$class=32;get children(){return this._$children}margin;get $f$margin(){return this._$cache("margin",[this.alignment])?this.margin:{leading:"0 auto 0 0",tailing:"0 0 0 auto",center:"0 auto"}[this.alignment]??"0 auto 0 0"}nodes=[];setStyles(t){S.loopShallowEls(t,e=>{e.style.flexShrink="0",e.style.margin=this.margin})}didMount(){this.setStyles(this.nodes),u(this.nodes,this.setStyles)}Body(){let t,e;return this._$update=s=>{s&29&&t&&j(t,{...this.style,height:this.height,width:this.width,rowGap:`${this.spacing}px`,display:"flex",flexDirection:"column"}),s&32&&t&&O(t,"className",()=>this.class,[this.class])},t=yt("div"),O(t,"className",()=>this.class,[this.class]),j(t,{...this.style,height:this.height,width:this.width,rowGap:`${this.spacing}px`,display:"flex",flexDirection:"column"}),e=new wt(this.children,[]),S.addDidMount(e,s=>{this._$ud(this.nodes=s._$nodes,"nodes")}),vt(t,e,0),t._$nodes=[e],[t]}},Pt=R;import{createElement as Nt,setStyle as B,setHTMLProp as Z,insertNode as Tt,ExpNode as _t}from"@dlightjs/dlight";import{View as V}from"@dlightjs/dlight";var C=class extends V{constructor(){super(),this.setStyles=this.setStyles.bind(this),this.didMount=this.didMount.bind(this)}$p$hAlignment;hAlignment="center";$$hAlignment=1;$s$hAlignment=["justifyItems"];$p$vAlignment;vAlignment="center";$$vAlignment=2;$s$vAlignment=["alignItems"];$p$width;width="max-content";$$width=4;$p$height;height="max-content";$$height=8;$p$style;style={};$$style=16;$p$class;class;$$class=32;get children(){return this._$children}justifyItems;$$justifyItems=64;get $f$justifyItems(){return this._$cache("justifyItems",[this.hAlignment])?this.justifyItems:{leading:"flex-start",center:"center",tailing:"flex-end"}[this.hAlignment]??"center"}alignItems;$$alignItems=128;get $f$alignItems(){return this._$cache("alignItems",[this.vAlignment])?this.alignItems:{top:"flex-start",center:"center",bottom:"flex-end"}[this.vAlignment]??"center"}nodes=[];setStyles(t){V.loopShallowEls(t,e=>{e.style.position="absolute",e.style.gridArea="1 / 1/ 1 / 1"})}didMount(){this.setStyles(this.nodes),u(this.nodes,this.setStyles)}Body(){let t,e;return this._$update=s=>{s&32&&t&&Z(t,"className",()=>this.class,[this.class]),s&223&&t&&B(t,{...this.style,height:this.height,width:this.width,display:"grid",alignItems:this.alignItems,justifyItems:this.justifyItems})},t=Nt("div"),Z(t,"className",()=>this.class,[this.class]),B(t,{...this.style,height:this.height,width:this.width,display:"grid",alignItems:this.alignItems,justifyItems:this.justifyItems}),e=new _t(this.children,[]),V.addDidMount(e,s=>{this._$ud(this.nodes=s._$nodes,"nodes")}),Tt(t,e,0),t._$nodes=[e],[t]}},Lt=C;import{createElement as Et,setStyle as xt}from"@dlightjs/dlight";import{View as Ht}from"@dlightjs/dlight";var A=class extends Ht{isSpacer=!0;Body(){let t;return t=Et("div"),xt(t,{flexGrow:1}),[t]}},Mt=A;export{ft as HStack,dt as Link,l as Navigator,st as Route,Y as RouteGroup,Mt as Spacer,Pt as VStack,Lt as ZStack,ts as lazy}; | ||
function m(){return location.hash.slice(2)}function f(){return location.pathname.slice(1)}function P(r,t){let e;if(r[0]==="/")e=r;else{r[0]!=="."&&(r="./"+r);let s=t==="history"?window.location.pathname:window.location.hash.replace(/^#/,""),o=r.split("/"),i=s.split("/").filter(a=>a),n=0;for(let a of o){if(![".",".."].includes(a))break;a===".."&&(i.length===0&&console.warn(`no ../ in ${r}`),i.pop()),n++}e="/"+[...i,...o.slice(n)].join("/")}return e}function y(r){return r.replace(/(^\/+)|(\/+$)/g,"")}function I(r,t){return!r&&!t?!0:!r||!t||Object.keys(r).length!==Object.keys(t).length?!1:Object.keys(r).every(e=>t[e]===r[e])}function U(r){return!!r.prototype?.Body}var l=class{mode;constructor(t="history"){this.mode=t}hashTo(t){window.location.href="#"+P(t,this.mode)}historyTo(t){window.history.pushState({},"",P(t,this.mode))}to(t){if(this.mode==="hash"){this.hashTo(t);return}this.historyTo(t)}};import{CondNode as K,ExpNode as N,EnvNode as J,PropView as Q}from"@dlightjs/dlight";import{View as X}from"@dlightjs/dlight";var T=history.pushState,p=[],L=class extends X{constructor(){super(),this.updatePath=this.updatePath.bind(this),this.homeUrl=this.homeUrl.bind(this),this.collectRoutes=this.collectRoutes.bind(this),this.updateRoute=this.updateRoute.bind(this),this.historyChangeListen=this.historyChangeListen.bind(this),this.hashChangeListen=this.hashChangeListen.bind(this),this.willMount=this.willMount.bind(this),this.didMount=this.didMount.bind(this),this.willUnmount=this.willUnmount.bind(this)}$e$_dl_router_baseUrl;_dl_router_baseUrl="/";$$_dl_router_baseUrl=1;$p$mode;mode="history";$p$loading;loading;$p$guard;guard;$p$onPathUpdate;onPathUpdate;$$onPathUpdate=16;$s$onPathUpdate=["updatePath"];$p$afterEnter;afterEnter;$p$beforeLeave;beforeLeave;get routes(){return this._$children}$w$updatePath;updatePath(){this._$cache("updatePath",[this.onPathUpdate])||this.onPathUpdate&&this.onPathUpdate(this.prevInfo.path)}routeMap={};hitPath="";$$hitPath=256;prevInfo={path:"/"};$$prevInfo=512;viewHolder={propView:!0};$$viewHolder=1024;homeUrl(t){return t.replace(/^~/,this._dl_router_baseUrl)}loaded=!1;collectRoutes(t,e){this.routeMap[t]=e,this.loaded&&this.updateRoute(this.prevInfo.path)}async updateRoute(t){this.loaded||(this.loaded=!0);let e="/"+t;t=y(e.replace(new RegExp(`^${this._dl_router_baseUrl}`),""));for(let[s,{comp:o,children:i,loading:n,redirect:a,info:d}]of Object.entries(this.routeMap)){let h=this.homeUrl(s.replace(/^(\.\/)+/,"")),q=h==="."&&t==="",b=t.startsWith(h+"/"),g=null,c;if(b||(g=t.match(new RegExp(`^${h}$`)),g&&(c=g.groups)),!(q||b||!!g))continue;let W=i??o;if(s===this.hitPath&&W===this.viewHolder.view&&I(c,this.viewHolder.params))return;let v={...d,path:e};if(this.guard){let $=await this.guard(v,this.prevInfo,this._dl_router_baseUrl);if($===!1){this.navigator.to(this.prevInfo.path);return}if(typeof $=="string"){this.navigator.to(this.homeUrl($));return}}if(a){this.navigator.to(this.homeUrl(a));return}this.beforeLeave&&await this.beforeLeave(v,this.prevInfo,this._dl_router_baseUrl);let w=async()=>{this.afterEnter&&await this.afterEnter(v,this.prevInfo,this._dl_router_baseUrl)};if(i)this._$ud(this.viewHolder={view:i,propView:!0},"viewHolder"),w();else if(o)if(U(o))this._$ud(this.viewHolder={view:o,propView:!1,params:c},"viewHolder"),w();else{let $=n??this.loading;$&&this._$ud(this.viewHolder={view:$,propView:!!$.propViewFunc},"viewHolder"),o().then(z=>{this._$ud(this.viewHolder={view:z.default,propView:!1,params:c},"viewHolder"),w()})}this._$ud(this.hitPath=s,"hitPath"),this._$ud(this.prevInfo={path:e,...c},"prevInfo");return}}navigator=new l;$$navigator=4096;historyChangeListen(){let t=f();t!==this.prevInfo.path&&this.updateRoute(t)}hashChangeListen(){let t=m();t!==this.prevInfo.path&&this.updateRoute(t)}willMount(){this._$ud(this.navigator.mode=this.mode,"navigator"),Promise.resolve().then(()=>{this.mode==="hash"?this.hashChangeListen():this.historyChangeListen()})}didMount(){if(this.mode==="hash"){addEventListener("load",this.hashChangeListen),addEventListener("hashchange",this.hashChangeListen);return}addEventListener("load",this.historyChangeListen),addEventListener("popstate",this.historyChangeListen),p.push(this.historyChangeListen),history.pushState=new Proxy(T,{apply(t,e,s){let o=t.apply(e,s);return p.forEach(i=>i()),o}})}willUnmount(){if(this.mode==="hash"){removeEventListener("load",this.hashChangeListen),removeEventListener("hashchange",this.hashChangeListen);return}removeEventListener("load",this.historyChangeListen),removeEventListener("popstate",this.historyChangeListen),p=p.filter(t=>t!==this.historyChangeListen),p.length>0?history.pushState=new Proxy(T,{apply(t,e,s){let o=t.apply(e,s);return p.forEach(i=>i()),o}}):history.pushState=T}Body(){let t,e,s;return this._$update=o=>{o&257&&t&&t.updateEnv("_dl_router_baseUrl",()=>"/"+y(`${this._dl_router_baseUrl}/${this.hitPath}`),[this._dl_router_baseUrl,this.hitPath]),o&512&&t&&t.updateEnv("path",()=>this.prevInfo.path,[this.prevInfo.path]),o&1024&&s&&s.updateCond(),o&4096&&t&&t.updateEnv("navigator",()=>this.navigator,[this.navigator]),s&&s.update(o)},t=new J({_dl_router_routesCollect:this.collectRoutes,_dl_router_baseUrl:"/"+y(`${this._dl_router_baseUrl}/${this.hitPath}`),path:this.prevInfo.path,navigator:this.navigator},{_dl_router_routesCollect:[],_dl_router_baseUrl:[this._dl_router_baseUrl,this.hitPath],path:[this.prevInfo.path],navigator:[this.navigator]}),e=new N(this.routes,[]),s=new K(1024,o=>{if(this.viewHolder.propView){if(o.cond===0)return o.didntChange=!0,[];o.cond=0;let i;return o.updateFunc=n=>{n&1024&&i&&i.update(()=>this.viewHolder.view,[this.viewHolder.view])},i=new N(this.viewHolder.view,[this.viewHolder.view]),o.cond===0?[i]:o.updateCond()}else{if(o.cond===1)return o.didntChange=!0,[];o.cond=1;let i,n;return o.updateFunc=a=>{a&1024&&n&&n.update(()=>i,[this.viewHolder.view]),i&&i.update(a)},i=new Q(a=>{let d;return a(h=>{h&1024&&d&&d._$setProps(()=>this.viewHolder.params,[this.viewHolder.params])}),d=new this.viewHolder.view,d._$init(null,null,null,null),[d]}),n=new N(i,[this.viewHolder.view]),o.cond===1?[n]:o.updateCond()}}),t.initNodes([e,s]),[t]}},Y=L;import{View as tt,required as et}from"@dlightjs/dlight";var _=class extends tt{constructor(){super(),this.collectRoutes=this.collectRoutes.bind(this)}$e$_dl_router_routesCollect;_dl_router_routesCollect=et;$$_dl_router_routesCollect=1;$s$_dl_router_routesCollect=["collectRoutes"];$p$path;_$contentKey="path";path=".*";$$path=2;$s$path=["collectRoutes"];$p$comp;comp;$$comp=4;$s$comp=["collectRoutes"];get children(){return this._$children}$p$loading;loading;$$loading=8;$s$loading=["collectRoutes"];$p$redirect;redirect;$$redirect=16;$s$redirect=["collectRoutes"];$p$info;info;$$info=32;$s$info=["collectRoutes"];$w$collectRoutes;collectRoutes(){this._$cache("collectRoutes",[this._dl_router_routesCollect,this.path,this.comp,this.loading,this.redirect,this.info])||this._dl_router_routesCollect(this.path,{comp:this.comp,children:this.children,loading:this.loading,redirect:this.redirect,info:this.info})}},st=_;import{createElement as it,setStyle as k,delegateEvent as ot,setHTMLProp as D,insertNode as rt,ExpNode as nt}from"@dlightjs/dlight";import{View as at,required as E}from"@dlightjs/dlight";var x=class extends at{constructor(){super(),this.handleClick=this.handleClick.bind(this)}$p$content;_$contentKey="content";content=E;$$content=1;$p$to;to=E;$p$mode;mode="history";$$mode=4;$s$mode=["nav"];$p$style;style={};$$style=8;$p$class;class="";$$class=16;get children(){return this._$children}$e$navigator;navigator=E;$$navigator=32;$s$navigator=["nav"];nav;get $f$nav(){return this._$cache("nav",[this.navigator,this.mode])?this.nav:this.navigator??new l(this.mode)}handleClick(t){if(t.preventDefault(),this.to.startsWith("http"))return window.open(this.to,"_blank");if(this.to.startsWith("?")){let e=this.nav.mode==="history"?f():m();return this.nav.to(e+this.to)}this.nav.to(this.to)}Body(){let t,e;return this._$update=s=>{s&1&&e&&e.update(()=>this.children??this.content,[this.content]),s&8&&t&&k(t,this.style),s&16&&t&&D(t,"className",()=>this.class,[this.class])},t=it("a"),k(t,this.style),D(t,"className",()=>this.class,[this.class]),ot(t,"click",this.handleClick),e=new nt(this.children??this.content,[this.content]),rt(t,e,0),t._$nodes=[e],[t]}},dt=x;import{CondNode as ht,ExpNode as $t,PropView as lt}from"@dlightjs/dlight";import{View as pt}from"@dlightjs/dlight";function ts(r,t){class e extends pt{constructor(){super(),this.willMount=this.willMount.bind(this)}_$forwardProps;_$forwardPropsSet=new Set;_$forwardPropsId=[];ViewCls;$$ViewCls=8;willMount(){r().then(o=>{this._$ud(this.ViewCls=o.default,"ViewCls")})}Body(){let o;return this._$update=i=>{i&8&&o&&o.updateCond(),o&&o.update(i)},o=new ht(8,i=>{if(this.ViewCls){if(i.cond===0)return i.didntChange=!0,[];i.cond=0;let n,a;return i.updateFunc=d=>{d&8&&a&&a.update(()=>n,[this.ViewCls]),n&&n.update(d)},n=new lt(d=>{let h;return h=new this.ViewCls,h._$init(null,null,null,this),[h]}),a=new $t(n,[this.ViewCls]),i.cond===0?[a]:i.updateCond()}else if(t){if(i.cond===1)return i.didntChange=!0,[];i.cond=1;let n;return i.updateFunc=a=>{},n=new t,n._$init(null,null,null,null),i.cond===1?[n]:i.updateCond()}else return i.cond===2?(i.didntChange=!0,[]):(i.cond=2,i.updateFunc=n=>{},i.cond===2?[]:i.updateCond())}),[o]}}return e}import{createElement as ct,setStyle as F,setHTMLProp as G,insertNode as gt,ExpNode as mt}from"@dlightjs/dlight";import{View as H}from"@dlightjs/dlight";function ut(r,t){let e=[...r].reverse();for(;e.length>0;){let s=e.pop();t(s),"_$dlNodeType"in s?s._$nodes&&e.push(...[...s._$nodes].reverse()):s._$nodes?e.push(...[...s._$nodes].reverse()):e.push(...[...s.childNodes].reverse())}}function u(r,t){let e=s=>{ut(s,o=>{if(o.initNewNodes){let i=o.initNewNodes;o.initNewNodes=function(n){i.call(this,n),t(n),e(n)}}})};e(r)}var M=class extends H{constructor(){super(),this.setStyles=this.setStyles.bind(this),this.didMount=this.didMount.bind(this)}$p$spacing;spacing=0;$$spacing=1;$p$alignment;alignment="top";$$alignment=2;$s$alignment=["margin"];$p$width;width="100%";$$width=4;$p$height;height="max-content";$$height=8;$p$style;style={};$$style=16;$p$class;class;$$class=32;get children(){return this._$children}margin;get $f$margin(){return this._$cache("margin",[this.alignment])?this.margin:{top:"0 0 auto 0",bottom:"auto 0 0 0",center:"auto 0"}[this.alignment]??"0 0 auto 0"}nodes=[];setStyles(t){H.loopShallowEls(t,e=>{e.style.flexShrink="0",e.style.margin=this.margin})}didMount(){this.setStyles(this.nodes),u(this.nodes,this.setStyles)}Body(){let t,e;return this._$update=s=>{s&29&&t&&F(t,{...this.style,height:this.height,width:this.width,columnGap:`${this.spacing}px`,display:"flex",flexDirection:"row"}),s&32&&t&&G(t,"className",()=>this.class,[this.class])},t=ct("div"),G(t,"className",()=>this.class,[this.class]),F(t,{...this.style,height:this.height,width:this.width,columnGap:`${this.spacing}px`,display:"flex",flexDirection:"row"}),e=new mt(this.children,[]),H.addDidMount(e,s=>{this.nodes=s._$nodes}),gt(t,e,0),t._$nodes=[e],[t]}},ft=M;import{createElement as yt,setStyle as j,setHTMLProp as O,insertNode as vt,ExpNode as wt}from"@dlightjs/dlight";import{View as S}from"@dlightjs/dlight";var R=class extends S{constructor(){super(),this.setStyles=this.setStyles.bind(this),this.didMount=this.didMount.bind(this)}$p$spacing;spacing=0;$$spacing=1;$p$alignment;alignment="leading";$$alignment=2;$s$alignment=["margin"];$p$width;width="max-content";$$width=4;$p$height;height="100%";$$height=8;$p$style;style={};$$style=16;$p$class;class;$$class=32;get children(){return this._$children}margin;get $f$margin(){return this._$cache("margin",[this.alignment])?this.margin:{leading:"0 auto 0 0",tailing:"0 0 0 auto",center:"0 auto"}[this.alignment]??"0 auto 0 0"}nodes=[];setStyles(t){S.loopShallowEls(t,e=>{e.style.flexShrink="0",e.style.margin=this.margin})}didMount(){this.setStyles(this.nodes),u(this.nodes,this.setStyles)}Body(){let t,e;return this._$update=s=>{s&29&&t&&j(t,{...this.style,height:this.height,width:this.width,rowGap:`${this.spacing}px`,display:"flex",flexDirection:"column"}),s&32&&t&&O(t,"className",()=>this.class,[this.class])},t=yt("div"),O(t,"className",()=>this.class,[this.class]),j(t,{...this.style,height:this.height,width:this.width,rowGap:`${this.spacing}px`,display:"flex",flexDirection:"column"}),e=new wt(this.children,[]),S.addDidMount(e,s=>{this.nodes=s._$nodes}),vt(t,e,0),t._$nodes=[e],[t]}},Pt=R;import{createElement as Nt,setStyle as B,setHTMLProp as Z,insertNode as Tt,ExpNode as Lt}from"@dlightjs/dlight";import{View as V}from"@dlightjs/dlight";var C=class extends V{constructor(){super(),this.setStyles=this.setStyles.bind(this),this.didMount=this.didMount.bind(this)}$p$hAlignment;hAlignment="center";$$hAlignment=1;$s$hAlignment=["justifyItems"];$p$vAlignment;vAlignment="center";$$vAlignment=2;$s$vAlignment=["alignItems"];$p$width;width="max-content";$$width=4;$p$height;height="max-content";$$height=8;$p$style;style={};$$style=16;$p$class;class;$$class=32;get children(){return this._$children}justifyItems;$$justifyItems=64;get $f$justifyItems(){return this._$cache("justifyItems",[this.hAlignment])?this.justifyItems:{leading:"flex-start",center:"center",tailing:"flex-end"}[this.hAlignment]??"center"}alignItems;$$alignItems=128;get $f$alignItems(){return this._$cache("alignItems",[this.vAlignment])?this.alignItems:{top:"flex-start",center:"center",bottom:"flex-end"}[this.vAlignment]??"center"}nodes=[];setStyles(t){V.loopShallowEls(t,e=>{e.style.position="absolute",e.style.gridArea="1 / 1/ 1 / 1"})}didMount(){this.setStyles(this.nodes),u(this.nodes,this.setStyles)}Body(){let t,e;return this._$update=s=>{s&32&&t&&Z(t,"className",()=>this.class,[this.class]),s&223&&t&&B(t,{...this.style,height:this.height,width:this.width,display:"grid",alignItems:this.alignItems,justifyItems:this.justifyItems})},t=Nt("div"),Z(t,"className",()=>this.class,[this.class]),B(t,{...this.style,height:this.height,width:this.width,display:"grid",alignItems:this.alignItems,justifyItems:this.justifyItems}),e=new Lt(this.children,[]),V.addDidMount(e,s=>{this.nodes=s._$nodes}),Tt(t,e,0),t._$nodes=[e],[t]}},_t=C;import{createElement as Et,setStyle as xt}from"@dlightjs/dlight";import{View as Ht}from"@dlightjs/dlight";var A=class extends Ht{isSpacer=!0;Body(){let t;return t=Et("div"),xt(t,{flexGrow:1}),[t]}},Mt=A;export{ft as HStack,dt as Link,l as Navigator,st as Route,Y as RouteGroup,Mt as Spacer,Pt as VStack,_t as ZStack,ts as lazy}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@dlightjs/components", | ||
"version": "1.0.0-next.0", | ||
"version": "1.0.0-next.1", | ||
"description": "DLight components library", | ||
@@ -25,3 +25,3 @@ "author": { | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"babel-preset-dlight": "1.0.0-next.0", | ||
"babel-preset-dlight": "1.0.0-next.2", | ||
"cross-env": "^7.0.3", | ||
@@ -33,6 +33,6 @@ "eslint": "^8.57.0", | ||
"vite": "^4.5.2", | ||
"vite-plugin-dlight": "1.0.0-next.0" | ||
"vite-plugin-dlight": "1.0.0-next.2" | ||
}, | ||
"dependencies": { | ||
"@dlightjs/dlight": "1.0.0-next.1" | ||
"@dlightjs/dlight": "1.0.0-next.2" | ||
}, | ||
@@ -39,0 +39,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
142376
269
+ Added@dlightjs/dlight@1.0.0-next.2(transitive)
- Removed@dlightjs/dlight@1.0.0-next.1(transitive)