@stacksjs/stx 0.2.336 → 0.2.338
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/app-shell.js +9 -8
- package/dist/{chunk-9v0fsdsf.js → chunk-066yt1hy.js} +1 -1
- package/dist/{chunk-eth22r93.js → chunk-0xgc5t3y.js} +1 -1
- package/dist/{chunk-vd5xvsnv.js → chunk-18018jkn.js} +1 -1
- package/dist/{chunk-5tefa8qb.js → chunk-1vb2rj09.js} +2 -2
- package/dist/chunk-1wsewc5h.js +2 -0
- package/dist/{chunk-p1hy2bwn.js → chunk-1yj4xd6n.js} +3 -3
- package/dist/{chunk-fqq5k9ve.js → chunk-1z1efvtw.js} +1 -1
- package/dist/{chunk-cdqx2c2h.js → chunk-22hch2me.js} +1 -1
- package/dist/{chunk-kpeqn5tx.js → chunk-2gc4cevb.js} +1 -1
- package/dist/{chunk-mgmn1vxy.js → chunk-39xtzfzf.js} +1 -1
- package/dist/{chunk-zsnrcbw1.js → chunk-3cjvqa0s.js} +2 -2
- package/dist/chunk-3sgdth20.js +2 -0
- package/dist/chunk-41dfsdy9.js +2 -0
- package/dist/{chunk-ymrxpwr8.js → chunk-46tmg3k4.js} +2 -2
- package/dist/{chunk-e1sxe3q4.js → chunk-4904n5v0.js} +2 -2
- package/dist/chunk-4cw0s9f4.js +4 -0
- package/dist/chunk-4jj4kk18.js +2 -0
- package/dist/chunk-4np12rj1.js +2 -0
- package/dist/chunk-4pcjt99d.js +2 -0
- package/dist/{chunk-dvvx1wny.js → chunk-57atgbyq.js} +1 -1
- package/dist/chunk-58j32d7n.js +2 -0
- package/dist/{chunk-hyfjnn7g.js → chunk-5g6rprcy.js} +1 -1
- package/dist/{chunk-mm59b0gg.js → chunk-5qsg9q46.js} +1 -1
- package/dist/{chunk-m8kezfrt.js → chunk-5r7gfwpj.js} +5 -5
- package/dist/chunk-799s9mwc.js +47 -0
- package/dist/{chunk-yxppshfd.js → chunk-7a21q2q4.js} +1 -1
- package/dist/chunk-7d74am4w.js +2 -0
- package/dist/chunk-7ngnyy5k.js +2 -0
- package/dist/{chunk-r8rbf28v.js → chunk-7r79j1hs.js} +1 -1
- package/dist/{chunk-cr8v8k53.js → chunk-7r9vgzg4.js} +1 -1
- package/dist/{chunk-xwxdwqn9.js → chunk-7we3xfde.js} +1 -1
- package/dist/{chunk-fr66xp8q.js → chunk-823h67tv.js} +1 -1
- package/dist/{chunk-42en0cxm.js → chunk-86v2rps7.js} +1 -1
- package/dist/{chunk-xz3evxqp.js → chunk-8bxtvsgm.js} +1 -1
- package/dist/{chunk-09jdvqhg.js → chunk-8cg15rr7.js} +2 -2
- package/dist/chunk-95t7pked.js +2 -0
- package/dist/{chunk-xdmb578h.js → chunk-97ej3abh.js} +1 -1
- package/dist/{chunk-kw98dfza.js → chunk-9btdax2s.js} +1 -1
- package/dist/{chunk-pbexz0d4.js → chunk-9bvgzqw1.js} +2 -2
- package/dist/{chunk-te6qym2g.js → chunk-9jc2z17q.js} +2 -2
- package/dist/chunk-9m5sxaen.js +2 -0
- package/dist/{chunk-tjag2cmm.js → chunk-a26hcag1.js} +1 -1
- package/dist/chunk-a3m7mgjc.js +2 -0
- package/dist/{chunk-9368t9jm.js → chunk-a959m68j.js} +1 -1
- package/dist/{chunk-fkdnfjc2.js → chunk-aftqqqcg.js} +2 -2
- package/dist/chunk-aved735s.js +64 -0
- package/dist/{chunk-q0g5c39d.js → chunk-ay336sqb.js} +1 -1
- package/dist/{chunk-cvphepjb.js → chunk-b3pn6dh5.js} +1 -1
- package/dist/{chunk-5swem3qy.js → chunk-b4cabzk9.js} +1 -1
- package/dist/{chunk-ej8mv2k6.js → chunk-bgrkxzr7.js} +1 -1
- package/dist/{chunk-2cm03y4y.js → chunk-d3kjaae0.js} +1 -1
- package/dist/chunk-d7zxg9bp.js +16 -0
- package/dist/{chunk-1ebyt1ba.js → chunk-dekxwgc2.js} +1 -1
- package/dist/chunk-dvafkj8w.js +2 -0
- package/dist/chunk-e3rgky2r.js +3747 -0
- package/dist/{chunk-t41aaehf.js → chunk-e4g8wz6t.js} +1 -1
- package/dist/chunk-e9y48d60.js +2 -0
- package/dist/{chunk-pbzdjhp8.js → chunk-eq2j7w8p.js} +1 -1
- package/dist/chunk-f08ttkqr.js +2 -0
- package/dist/{chunk-4jdj52c5.js → chunk-f6sejeg3.js} +1 -1
- package/dist/chunk-fha0nyet.js +2 -0
- package/dist/{chunk-6k8h1fj1.js → chunk-fjrkyhm7.js} +1 -1
- package/dist/chunk-fw56y3cb.js +30 -0
- package/dist/chunk-fx5m9d3t.js +2 -0
- package/dist/{chunk-mwh3ymwc.js → chunk-g6czgcg4.js} +1 -1
- package/dist/chunk-gtfcw1gc.js +12 -0
- package/dist/chunk-gz539gk6.js +2 -0
- package/dist/chunk-h0y4mb2m.js +2 -0
- package/dist/chunk-hfzv07az.js +3 -0
- package/dist/{chunk-nat3actx.js → chunk-hrdd26r4.js} +1 -1
- package/dist/{chunk-cdsbxghb.js → chunk-jkyvk4x6.js} +1 -1
- package/dist/{chunk-4ty8j3xn.js → chunk-jx03a693.js} +1 -1
- package/dist/{chunk-vvd659y4.js → chunk-k3dtvay1.js} +1 -1
- package/dist/chunk-kawdj1j7.js +2 -0
- package/dist/{chunk-d4etph79.js → chunk-kdhrk7x5.js} +1 -1
- package/dist/chunk-kdwerx8e.js +2 -0
- package/dist/{chunk-n66k2v2q.js → chunk-kermxyfe.js} +2 -2
- package/dist/{chunk-x7yc7e9v.js → chunk-m11pb9cx.js} +1 -1
- package/dist/{chunk-k6ky5et7.js → chunk-m1p2n3nf.js} +1 -1
- package/dist/chunk-m46edxtt.js +3 -0
- package/dist/chunk-meqz313r.js +2 -0
- package/dist/{chunk-q05eh1n4.js → chunk-mnyehz4t.js} +2 -2
- package/dist/{chunk-0vv5s039.js → chunk-mys0rat0.js} +1 -1
- package/dist/chunk-n0a55zv2.js +2 -0
- package/dist/{chunk-7kw3grq5.js → chunk-nf7k53ap.js} +1 -1
- package/dist/{chunk-kffndzch.js → chunk-nhbc464j.js} +3 -3
- package/dist/{chunk-1hzgxk2m.js → chunk-nvp546bb.js} +1 -1
- package/dist/chunk-p1cddybx.js +2 -0
- package/dist/chunk-q0srntf6.js +2 -0
- package/dist/chunk-q3g4yf5r.js +2 -0
- package/dist/{chunk-c2ta859c.js → chunk-q9ckfwhh.js} +1 -1
- package/dist/chunk-qhdp0ycf.js +2 -0
- package/dist/{chunk-y4nzmkea.js → chunk-qsbjtp60.js} +1 -1
- package/dist/{chunk-1tva0f8f.js → chunk-qtc28zy1.js} +1 -1
- package/dist/{chunk-2vgkc0kg.js → chunk-r10fypcd.js} +1 -1
- package/dist/chunk-rkykwy3z.js +2 -0
- package/dist/{chunk-64djh88a.js → chunk-sqvqwd0p.js} +1 -1
- package/dist/{chunk-67bh5vrj.js → chunk-stbns4bg.js} +1 -1
- package/dist/chunk-szfk6pw6.js +2 -0
- package/dist/{chunk-amxtypkp.js → chunk-t00ga194.js} +1 -1
- package/dist/chunk-temapbqe.js +2 -0
- package/dist/{chunk-9kxfz708.js → chunk-tr1174hz.js} +1 -1
- package/dist/{chunk-q85qp5we.js → chunk-tr41gn5j.js} +1 -1
- package/dist/{chunk-crj19mqr.js → chunk-tr9ynxdw.js} +1 -1
- package/dist/{chunk-71y3bhcw.js → chunk-tsmdmf5h.js} +123 -37
- package/dist/{chunk-gptwwv3c.js → chunk-vaggjvsm.js} +1 -1
- package/dist/{chunk-ya5m5vbn.js → chunk-vgfd9582.js} +1 -1
- package/dist/chunk-vgfnre7b.js +2 -0
- package/dist/{chunk-n9c975db.js → chunk-vhzc08aa.js} +1 -1
- package/dist/{chunk-08w4gtyf.js → chunk-vm5jbgb1.js} +3 -3
- package/dist/{chunk-drqdc0mh.js → chunk-vxt5c5aq.js} +1 -1
- package/dist/{chunk-hzfd8cz0.js → chunk-w0hzaka3.js} +78 -67
- package/dist/{chunk-yk6446kr.js → chunk-w72v0ab1.js} +2 -2
- package/dist/{chunk-c65yrgck.js → chunk-wakb8z5q.js} +10 -10
- package/dist/{chunk-q569zmrr.js → chunk-wb90259a.js} +1 -1
- package/dist/chunk-x01sw9wy.js +2 -0
- package/dist/{chunk-dfejgnny.js → chunk-x48crnwa.js} +1 -1
- package/dist/{chunk-24b4711v.js → chunk-x4vhn880.js} +1 -1
- package/dist/{chunk-j2dj21ay.js → chunk-xe6zmdfq.js} +1 -1
- package/dist/chunk-y8vj3rtt.js +2 -0
- package/dist/chunk-yj1dxdfr.js +2 -0
- package/dist/{chunk-wx5zf66r.js → chunk-yne23w3c.js} +1 -1
- package/dist/{chunk-zz8qgqa1.js → chunk-ypzm47q3.js} +2 -2
- package/dist/chunk-z07knk3p.js +2 -0
- package/dist/{chunk-27xfkzks.js → chunk-zj039s33.js} +1 -1
- package/dist/{chunk-c79nfdyj.js → chunk-zk6ghjnj.js} +1 -1
- package/dist/chunk-zt4pf776.js +2 -0
- package/dist/{chunk-4k0ce745.js → chunk-zye9r15n.js} +2 -2
- package/dist/chunk-zzfpwxpp.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/component-contract-checks.d.ts +18 -15
- package/dist/component-contract.d.ts +6 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +45 -0
- package/dist/expressions.js +60 -11
- package/dist/includes.js +4 -0
- package/dist/loops.js +10 -0
- package/dist/pwa.js +2 -2
- package/dist/server-components.js +2 -1
- package/dist/signals.js +121 -35
- package/dist/slots.js +86 -12
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +205 -95
- package/dist/template-syntax-escape.d.ts +36 -0
- package/dist/template-syntax-escape.js +8 -0
- package/dist/utils.js +9 -2
- package/dist/variable-extractor.d.ts +1 -0
- package/dist/variable-extractor.js +8 -0
- package/dist/visual-testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-046dp691.js +0 -2
- package/dist/chunk-1brnvyhv.js +0 -2
- package/dist/chunk-3ntf8f5e.js +0 -2
- package/dist/chunk-4tnxnzja.js +0 -2
- package/dist/chunk-63yfp05p.js +0 -2
- package/dist/chunk-7y4eqkv4.js +0 -2
- package/dist/chunk-7ywnkv1f.js +0 -2
- package/dist/chunk-80zj5516.js +0 -2
- package/dist/chunk-8730k51r.js +0 -2
- package/dist/chunk-907qxn09.js +0 -2
- package/dist/chunk-9fcq5x2r.js +0 -2
- package/dist/chunk-a97tp43x.js +0 -2
- package/dist/chunk-atw841yx.js +0 -2
- package/dist/chunk-c1m1gng4.js +0 -2
- package/dist/chunk-caaenc3w.js +0 -60
- package/dist/chunk-dbfq77qe.js +0 -4
- package/dist/chunk-dnesmvvb.js +0 -2
- package/dist/chunk-eg8ksaft.js +0 -2
- package/dist/chunk-ewsx2qxm.js +0 -2
- package/dist/chunk-farwrdr2.js +0 -3
- package/dist/chunk-fcenm8n1.js +0 -2
- package/dist/chunk-gbz6pfs8.js +0 -2
- package/dist/chunk-gdbkqatx.js +0 -43
- package/dist/chunk-jnahcd4d.js +0 -2
- package/dist/chunk-ke88kpva.js +0 -30
- package/dist/chunk-krpkfndf.js +0 -3
- package/dist/chunk-kxtqbrfr.js +0 -3759
- package/dist/chunk-m1yrakpk.js +0 -2
- package/dist/chunk-q2hvne0v.js +0 -2
- package/dist/chunk-qpbk50xd.js +0 -2
- package/dist/chunk-rxdd3k6n.js +0 -2
- package/dist/chunk-ssd10kje.js +0 -2
- package/dist/chunk-szx6pxh3.js +0 -2
- package/dist/chunk-tpmgq2dx.js +0 -12
- package/dist/chunk-tte4m2s9.js +0 -2
- package/dist/chunk-v7gjsb3f.js +0 -2
- package/dist/chunk-vv289x82.js +0 -2
- package/dist/chunk-vx6mxybh.js +0 -2
- package/dist/chunk-x510wr8z.js +0 -2
- package/dist/chunk-x95sxapm.js +0 -2
- package/dist/chunk-xjrhzkx2.js +0 -2
- package/dist/chunk-y1x2ebhv.js +0 -2
- package/dist/chunk-yvec3f1c.js +0 -2
- package/dist/chunk-yzxm75jp.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`),
|
|
4
|
-
`))}var
|
|
2
|
+
import{rw as v$,sw as G}from"./chunk-5g6rprcy.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
|
|
3
|
+
`),L=E.join(U,"route-types.d.ts");try{if(W.existsSync(L)&&W.readFileSync(L,"utf8")===B)return;W.mkdirSync(U,{recursive:!0}),W.writeFileSync(L,B)}catch{}}function q($,U,O){let I=process.cwd(),B=E.relative(I,O),L=$.filter((V)=>!A(V.pattern)),K=["// Auto-generated by stx \u2014 do not edit",`// Source: ${B||"pages"}/`,"","export const routes = ["];for(let V of L){let J=E.relative(I,V.filePath).replace(/\\/g,"/"),X=JSON.stringify(V.params),Y=V.layout?`, layout: '${E.relative(I,V.layout).replace(/\\/g,"/")}'`:"";K.push(` { pattern: '${V.pattern}', filePath: '${J}', isDynamic: ${V.isDynamic}, params: ${X}${Y} },`)}K.push("] as const",""),K.push("export type RouteName = typeof routes[number]['pattern']",""),W.mkdirSync(U,{recursive:!0}),W.writeFileSync(E.join(U,"routes.ts"),K.join(`
|
|
4
|
+
`))}var f=G(()=>{C()});import i from"path";function N($,U){let I=i.relative(U,$).replace(/\.(stx|md)$/,"");if(I=I.split(i.sep).join("/"),I==="index")return"/";if(I.endsWith("/index"))I=I.slice(0,-6);return I=I.replace(/\[\[([^\]]+)\]\]/g,":$1?"),I=I.replace(/\[([^\]]+)\]/g,":$1"),I=I.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${I}`}function j($){let U=[],O="",I=0;while(I<$.length){let B=$.slice(I),L=/^\/:([^/?*]+)\?/.exec(B);if(L){U.push(L[1]),O+="(?:/([^/]+))?",I+=L[0].length;continue}let K=/^:([^/?*]+)\*/.exec(B);if(K){U.push(K[1]),O+="(.+)",I+=K[0].length;continue}let V=/^:([^/?*]+)/.exec(B);if(V){U.push(V[1]),O+="([^/]+)",I+=V[0].length;continue}O+=$[I].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),I+=1}return{regex:new RegExp(`^${O}$`),params:U}}function o($,U){let O=$===""?"/":$;for(let I of U){let B=O.match(I.regex);if(B){let L={};return I.params.forEach((K,V)=>{L[K]=B[V+1]}),{route:I,params:L}}}return null}function r($){let U=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return j(U)}var g=()=>{};import b$ from"fs";import d from"path";function R($,U){let O=[],I=d.dirname($);while(I.startsWith(U)||I===U){let B=d.join(I,"_layout.stx");if(b$.existsSync(B))O.unshift(B);if(I===U)break;I=d.dirname(I)}return O}var m=()=>{};import S from"fs";import Q from"path";function t($,U){let O=[];if(!S.existsSync($))return O;let I=S.readdirSync($,{withFileTypes:!0});for(let B of I){let L=Q.join($,B.name);if(B.isDirectory()){if(B.name.startsWith("."))continue;if(F.includes(B.name))continue;O.push(...t(L,U))}else if(B.isFile()){let K=Q.extname(B.name);if(U.includes(K)){if(B.name.startsWith("_")&&B.name!=="_layout.stx")continue;if(B.name==="_layout.stx")continue;O.push(L)}}}return O}class b{routes;pagesDir;pagesDirs;config;constructor($,U={}){this.config=U;let O=U.pagesDirs&&U.pagesDirs.length>0?U.pagesDirs:[U.pagesDir||"pages"];this.pagesDirs=O.map((J)=>Q.resolve($,J)),this.pagesDir=this.pagesDirs[0];let I=U.extensions||[".stx"],B=(J)=>{let X=Q.resolve($,J);try{return S.realpathSync(X)}catch{return X}},L=(U.exclude??[]).filter((J)=>typeof J==="string"&&J.trim()!=="").map(B),K=(J)=>{if(L.length===0)return!1;let X=B(J);return L.some((Y)=>X===Y||X.startsWith(`${Y}${Q.sep}`))},V=new Set;this.routes=[];for(let J of this.pagesDirs){let X=t(J,I).filter((Z)=>!K(Z)),Y=new Map;for(let Z of X){let _=N(Z,J),z=U.pagesDirs?_.replace(/:[\w]+/g,":param"):_;if(U.pagesDirs&&Y.has(z))throw Error(`Conflicting layer pages for ${_}: ${Y.get(z)} and ${Z}`);if(Y.set(z,Z),V.has(z))continue;V.add(z);let{regex:S$,params:s}=j(_),D=U.layouts!==!1?R(Z,J):[];this.routes.push({pattern:_,regex:S$,params:s,filePath:Z,isDynamic:s.length>0,layout:D.length>0?D[D.length-1]:void 0})}}if(this.routes.sort((J,X)=>{if(!J.isDynamic&&X.isDynamic)return-1;if(J.isDynamic&&!X.isDynamic)return 1;let Y=J.pattern.split("/").length,Z=X.pattern.split("/").length;if(Y!==Z)return Z-Y;return J.pattern.localeCompare(X.pattern)}),U.emit!==!1){let J=Q.resolve($,U.stateDir||process.env.STX_DIR?.trim()||".stx");H(this.routes,J),q(this.routes,J,this.pagesDir)}}match($){let U=$===""?"/":$;for(let O of this.routes){let I=U.match(O.regex);if(I){let B={};return O.params.forEach((L,K)=>{B[L]=I[K+1]}),{route:O,params:B}}}return null}resolve($,U){let O=this.routes.find((B)=>B.pattern===$||B.filePath.includes($));if(!O)return"#not-found";let I=O.pattern;if(U)for(let[B,L]of Object.entries(U))I=I.replace(`:${B}`,encodeURIComponent(L));return I}addRoute($){this.routes.push($),this.routes.sort((U,O)=>{if(!U.isDynamic&&O.isDynamic)return-1;if(U.isDynamic&&!O.isDynamic)return 1;return U.pattern.localeCompare(O.pattern)})}getLayout($){return $.layout??null}}function a($,U){return new b($,U)}function e($,U){let O=[`${U}.stx`,"error.stx"];for(let I of O){let B=Q.join($,I);if(S.existsSync(B))return B}return null}function $$($,U){return $.map((O)=>{let I=Q.relative(U,O.filePath),B=O.isDynamic?" (dynamic)":"";return`${O.pattern} \u2192 ${I}${B}`})}var U$=G(()=>{f();g();m();C()});function I$($){x=$.replace(/\/$/,"")}function O$($,U,O={}){M[$]={path:U,name:$,params:O}}function B$($){for(let[U,O]of Object.entries($))if(typeof O==="string")M[U]={path:O,name:U};else M[U]={...O,name:U}}function J$($,U={},O=!1){let I=M[$];if(!I)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let B={...I.params,...U},L=I.path;L=L.replace(/:(\w+)/g,(V,J)=>{let X=B[J];if(X===void 0)return console.warn(`Missing parameter [${J}] for route [${$}].`),`:${J}`;return delete B[J],encodeURIComponent(String(X))});let K=Object.entries(B);if(K.length>0){let V=K.map(([J,X])=>`${encodeURIComponent(J)}=${encodeURIComponent(String(X))}`).join("&");L+=(L.includes("?")?"&":"?")+V}return O&&x?`${x}${L}`:L}function K$(){for(let $ of Object.keys(M))delete M[$];x=""}var M,x="";var L$=G(()=>{M={}});import V$ from"fs";import X$ from"path";function Y$($,U={}){return{type:"redirect",path:$,options:{replace:U.replace??!1,external:U.external??!1,redirectCode:U.redirectCode??302}}}function Z$($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function G$($,U={}){return{handler:$,mode:U.mode??"universal"}}function h($){let U={};if(!$)return U;let O=$.split(";");for(let I of O){let[B,...L]=I.split("=");if(B){let K=B.trim(),V=L.join("=").trim();if(K)U[K]=decodeURIComponent(V)}}return U}function k($,U,O={}){let I=`${encodeURIComponent($)}=${encodeURIComponent(U)}`;if(O.expires){let B=typeof O.expires==="number"?new Date(Date.now()+O.expires*1000):O.expires;I+=`; Expires=${B.toUTCString()}`}if(O.path)I+=`; Path=${O.path}`;if(O.domain)I+=`; Domain=${O.domain}`;if(O.secure)I+="; Secure";if(O.httpOnly)I+="; HttpOnly";if(O.sameSite)I+=`; SameSite=${O.sameSite}`;return I}function c($,U){let O=$.headers.get("cookie")||"",I=h(O);return{get(B){return I[B]},set(B,L,K={}){I[B]=L,U.append("Set-Cookie",k(B,L,K))},delete(B){delete I[B],U.append("Set-Cookie",k(B,"",{expires:new Date(0),path:"/"}))},getAll(){return{...I}}}}function l(){return{get($){if(typeof document>"u")return;return h(document.cookie)[$]},set($,U,O={}){if(typeof document>"u")return;document.cookie=k($,U,O)},delete($){if(typeof document>"u")return;document.cookie=k($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return h(document.cookie)}}}function u(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(U){if(!$)return null;try{return window.localStorage.getItem(U)}catch{return null}},set(U,O){if(!$)return;try{window.localStorage.setItem(U,O)}catch{}},remove(U){if(!$)return;try{window.localStorage.removeItem(U)}catch{}},isAvailable(){return $}}}function v($,U){T.set($,U)}function p($){return T.get($)}function Q$($){return T.has($)}function W$(){T.clear()}function M$(){return Array.from(T.keys())}async function _$($,U="middleware"){let O=X$.resolve($,U);if(!V$.existsSync(O))return;let I=V$.readdirSync(O);for(let B of I){if(!B.endsWith(".ts")&&!B.endsWith(".js"))continue;if(B.includes(".test.")||B.includes(".spec."))continue;let L=B.replace(/\.(ts|js)$/,""),K=X$.join(O,B);try{let J=(await import(K)).default;if(J&&typeof J.handler==="function")v(L,J);else if(typeof J==="function")v(L,{handler:J,mode:"universal"})}catch(V){console.warn(`Failed to load middleware '${L}' from ${K}:`,V)}}}function x$($){let U={};if(!$)return U;let O=new URLSearchParams($);for(let[I,B]of O)U[I]=B;return U}function z$($,U,O,I=""){return{path:$,params:U,query:x$(I),fullPath:I?`${$}?${I}`:$,meta:O}}function F$($,U,O,I){let B=I?.isServer??typeof window>"u",L=!B,K=new Headers;return{to:$,from:U,isClient:L,isServer:B,cookies:B&&O?c(O,K):l(),storage:u(),state:{},request:O,responseHeaders:K}}async function A$($,U){let O=Array.isArray($)?$:[$],I=U.isServer;for(let B of O){let L=p(B);if(!L)return console.error(`Route middleware '${B}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${B}' is not registered`}},state:U.state,responseHeaders:U.responseHeaders};if(L.mode==="server"&&!I)continue;try{let K=await L.handler(U);if(K){if(K.type==="redirect")return{passed:!1,redirect:K,state:U.state,responseHeaders:U.responseHeaders};if(K.type==="abort")return{passed:!1,abort:K,state:U.state,responseHeaders:U.responseHeaders}}}catch(K){return console.error(`Error in middleware '${B}':`,K),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:K instanceof Error?K.message:"Middleware error"}},state:U.state,responseHeaders:U.responseHeaders}}}return{passed:!0,state:U.state,responseHeaders:U.responseHeaders}}var T;var E$=G(()=>{T=new Map});function n($){let O=$.replace(/\\/g,"/").split("/").filter(Boolean),I=O.lastIndexOf("layouts"),B=I>=0?O[I+1]:O.at(-1);if(!B)return"app";return B.replace(/\.stx$/i,"")||"app"}function j$($){let U=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),O=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),I=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),B=U?.[1]||I?.[1]||"";return{layout:B,group:O?.[1]||n(B)}}var T$=()=>{};function k$($){let U=[],O="log(",I=0;while(I<$.length){let B=$.indexOf("log(",I);if(B===-1){U.push($.slice(I));break}let L=B>0?$[B-1]:" ",K=/\bfunction\s+$/.test($.slice(Math.max(0,B-16),B));if(/[\w$.]/.test(L)||K){U.push($.slice(I,B+4)),I=B+4;continue}U.push($.slice(I,B));let V=1,J=B+4;while(J<$.length&&V>0){let X=$[J];if(X==='"'||X==="'"||X==="`"){let Y=X;J++;while(J<$.length&&$[J]!==Y){if($[J]==="\\")J++;J++}J++;continue}if(X==="(")V++;else if(X===")")V--;J++}U.push("0"),I=J}return U.join("")}function C$($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function H$(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
@@ -14,6 +14,17 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
14
14
|
var debug=!!o.debug;
|
|
15
15
|
function log(){if(debug&&typeof console!=='undefined'&&console.log)console.log.apply(console,arguments)}
|
|
16
16
|
|
|
17
|
+
// Shorthands for the document-rooted queries this script makes ~33 times.
|
|
18
|
+
// Every page carries these bytes, and the budget in
|
|
19
|
+
// scripts/performance-budgets.ts is what noticed.
|
|
20
|
+
var LAYOUT_META='meta[name="stx-layout"]';
|
|
21
|
+
var LAYOUT_GROUP_META='meta[name="stx-layout-group"]';
|
|
22
|
+
var BUILD_META='meta[name="stx-build"]';
|
|
23
|
+
function qs(sel){return document.querySelector(sel)}
|
|
24
|
+
function qsa(sel){return document.querySelectorAll(sel)}
|
|
25
|
+
function ce(tag){return document.createElement(tag)}
|
|
26
|
+
function dhead(){return document.head}
|
|
27
|
+
|
|
17
28
|
// Replace, never merge: absent payloads must forget the outgoing page's data.
|
|
18
29
|
// Run at the committed swap, not during prefetch or a superseded navigation.
|
|
19
30
|
function hydrateServerData(html){
|
|
@@ -36,7 +47,7 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
36
47
|
// Conservative on purpose: act only when BOTH ids are known. A missing id is
|
|
37
48
|
// "no information", never "mismatch", so statically hosted output (no headers)
|
|
38
49
|
// and older servers behave exactly as before.
|
|
39
|
-
var buildMeta=
|
|
50
|
+
var buildMeta=qs(BUILD_META);
|
|
40
51
|
var loadedBuild=buildMeta?(buildMeta.getAttribute('content')||''):'';
|
|
41
52
|
window.__stxBuild=loadedBuild;
|
|
42
53
|
function isBuildSkew(incoming){
|
|
@@ -184,7 +195,7 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
184
195
|
function parseContainerAttrs(attrStr){
|
|
185
196
|
var map={};
|
|
186
197
|
if(!attrStr)return map;
|
|
187
|
-
var probe=
|
|
198
|
+
var probe=ce('div');
|
|
188
199
|
probe.innerHTML='<i '+attrStr+'></i>';
|
|
189
200
|
var src=probe.firstChild;
|
|
190
201
|
// getAttributeNames first: it is the same standard DOM answer and it is
|
|
@@ -273,7 +284,7 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
273
284
|
}
|
|
274
285
|
|
|
275
286
|
function getContainer(){
|
|
276
|
-
return
|
|
287
|
+
return qs(containerSel)||qs('[data-stx-content]')||qs('main');
|
|
277
288
|
}
|
|
278
289
|
|
|
279
290
|
// \u2500\u2500 Navigation \u2500\u2500
|
|
@@ -357,7 +368,7 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
357
368
|
// navigation. Scripts without an owner are unaffected.
|
|
358
369
|
function ownerStays(owner){
|
|
359
370
|
if(!owner)return false;
|
|
360
|
-
var root=
|
|
371
|
+
var root=qs('[data-stx-scope="'+owner+'"]');
|
|
361
372
|
return !root||typeof root.__stx_disposers==='function';
|
|
362
373
|
}
|
|
363
374
|
function hashScript(code){
|
|
@@ -524,7 +535,7 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
524
535
|
if(!key||loadedExternalScripts[key])return null;
|
|
525
536
|
loadedExternalScripts[key]=1;
|
|
526
537
|
return new Promise(function(resolve){
|
|
527
|
-
var el=
|
|
538
|
+
var el=ce('script');
|
|
528
539
|
el.src=key;
|
|
529
540
|
// Deliberately NOT data-stx-page: both swap paths clear those on every
|
|
530
541
|
// navigation, which would sweep this away and \u2014 since it is never loaded
|
|
@@ -533,12 +544,12 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
533
544
|
el.setAttribute('data-stx-external','');
|
|
534
545
|
el.onload=function(){resolve()};
|
|
535
546
|
el.onerror=function(){log('[router] container script failed:',key);resolve()};
|
|
536
|
-
|
|
547
|
+
dhead().appendChild(el);
|
|
537
548
|
});
|
|
538
549
|
}
|
|
539
550
|
|
|
540
551
|
// Record scripts from the initial page load
|
|
541
|
-
|
|
552
|
+
qsa('script').forEach(function(s){
|
|
542
553
|
var text=s.textContent||'';
|
|
543
554
|
if(s.hasAttribute('src'))rememberExternalScript(s.getAttribute('src'));
|
|
544
555
|
else if(text.trim())executedScriptHashes[hashScript(text)]=1;
|
|
@@ -565,17 +576,17 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
565
576
|
return part?part.replace(/\\.stx$/i,''):'app';
|
|
566
577
|
}
|
|
567
578
|
function getCurrentLayoutGroup(){
|
|
568
|
-
var meta=
|
|
579
|
+
var meta=qs(LAYOUT_GROUP_META);
|
|
569
580
|
if(meta&&meta.getAttribute('content'))return meta.getAttribute('content');
|
|
570
|
-
var layout=
|
|
581
|
+
var layout=qs(LAYOUT_META);
|
|
571
582
|
return defaultLayoutGroup(layout?layout.getAttribute('content'):'');
|
|
572
583
|
}
|
|
573
584
|
function getDocLayoutGroup(doc,layout){
|
|
574
|
-
var meta=doc&&doc.querySelector?doc.querySelector(
|
|
585
|
+
var meta=doc&&doc.querySelector?doc.querySelector(LAYOUT_GROUP_META):null;
|
|
575
586
|
return meta&&meta.getAttribute('content')?meta.getAttribute('content'):defaultLayoutGroup(layout||'');
|
|
576
587
|
}
|
|
577
588
|
function checkLayoutChange(newLayout,targetUrl,newGroup){
|
|
578
|
-
var currentLayout=
|
|
589
|
+
var currentLayout=qs(LAYOUT_META);
|
|
579
590
|
var curLayoutName=currentLayout?currentLayout.getAttribute('content'):'';
|
|
580
591
|
var curGroup=getCurrentLayoutGroup();
|
|
581
592
|
var nextGroup=newGroup||defaultLayoutGroup(newLayout);
|
|
@@ -628,7 +639,7 @@ import{qw as Re,rw as d}from"./chunk-hyfjnn7g.js";function N(t){return t.split(/
|
|
|
628
639
|
|
|
629
640
|
if(t.pathname===location.pathname&&t.hash){
|
|
630
641
|
if(pushState!==false)writeHistory(pushState,t.href);
|
|
631
|
-
var el=
|
|
642
|
+
var el=qs(t.hash);
|
|
632
643
|
if(el)el.scrollIntoView({behavior:'smooth'});
|
|
633
644
|
return Promise.resolve(true);
|
|
634
645
|
}
|
|
@@ -773,7 +784,7 @@ else {
|
|
|
773
784
|
function routeAnnouncer(){
|
|
774
785
|
var el=document.getElementById('stx-route-announcer');
|
|
775
786
|
if(el)return el;
|
|
776
|
-
el=
|
|
787
|
+
el=ce('div');
|
|
777
788
|
el.id='stx-route-announcer';
|
|
778
789
|
el.setAttribute('aria-live','polite');
|
|
779
790
|
el.setAttribute('role','status');
|
|
@@ -806,7 +817,7 @@ else {
|
|
|
806
817
|
function focusAfterNavigation(hash){
|
|
807
818
|
if(o.routeFocus===false)return;
|
|
808
819
|
var target=null;
|
|
809
|
-
if(hash){try{target=
|
|
820
|
+
if(hash){try{target=qs(hash)}catch(e){target=null}}
|
|
810
821
|
if(!target)target=getContainer();
|
|
811
822
|
if(!target||!target.focus)return;
|
|
812
823
|
// The container is not naturally focusable. tabindex="-1" makes it
|
|
@@ -829,7 +840,7 @@ else {
|
|
|
829
840
|
// be the last one, every navigation, not just the first time it is seen.
|
|
830
841
|
function findGeneratedCss(abs){
|
|
831
842
|
var found=null;
|
|
832
|
-
|
|
843
|
+
qsa('head link[data-css][href]').forEach(function(link){
|
|
833
844
|
if(new URL(link.getAttribute('href'),location.href).href!==abs)return;
|
|
834
845
|
// Collapse duplicates, so moving one copy to the end can never leave an
|
|
835
846
|
// older copy of the same sheet behind to fight it.
|
|
@@ -858,7 +869,7 @@ else {
|
|
|
858
869
|
if(link.__stxCssReady)pending.push(link.__stxCssReady);
|
|
859
870
|
return;
|
|
860
871
|
}
|
|
861
|
-
link=
|
|
872
|
+
link=ce('link');
|
|
862
873
|
link.setAttribute('data-css','generated');
|
|
863
874
|
link.setAttribute('rel','stylesheet');
|
|
864
875
|
link.setAttribute('href',new URL(href,location.href).href===abs?href:abs);
|
|
@@ -879,7 +890,7 @@ else {
|
|
|
879
890
|
link.onerror=function(){finish(true)};
|
|
880
891
|
});
|
|
881
892
|
pending.push(link.__stxCssReady);
|
|
882
|
-
|
|
893
|
+
dhead().appendChild(link);
|
|
883
894
|
});
|
|
884
895
|
return pending.length?Promise.all(pending).then(function(results){return results.every(function(ok){return ok!==false})}):null;
|
|
885
896
|
}
|
|
@@ -915,7 +926,7 @@ else {
|
|
|
915
926
|
link.removeAttribute('data-stx-css-pending');
|
|
916
927
|
link.removeAttribute('media');
|
|
917
928
|
}
|
|
918
|
-
|
|
929
|
+
dhead().appendChild(link);
|
|
919
930
|
});
|
|
920
931
|
}
|
|
921
932
|
|
|
@@ -1028,18 +1039,18 @@ else {
|
|
|
1028
1039
|
});
|
|
1029
1040
|
cleanFrag=cleanFrag.replace(new RegExp('<!--stx-held-script-(\\\\d+)-->','g'),function(m,i){return heldScripts[Number(i)]});
|
|
1030
1041
|
// Remove old page styles (not css \u2014 that gets merged)
|
|
1031
|
-
|
|
1042
|
+
qsa('style[data-stx-page]').forEach(function(s){s.remove()});
|
|
1032
1043
|
// Merge css CSS from fragment into existing css style
|
|
1033
1044
|
if(fragCss){
|
|
1034
|
-
var curCss=
|
|
1045
|
+
var curCss=qs('head style[data-css]');
|
|
1035
1046
|
if(curCss){
|
|
1036
1047
|
var merged=mergeCss(curCss.textContent||'',fragCss);
|
|
1037
1048
|
if(merged)curCss.textContent=merged;
|
|
1038
1049
|
}else{
|
|
1039
|
-
var cw=
|
|
1050
|
+
var cw=ce('style');
|
|
1040
1051
|
cw.setAttribute('data-css','generated');
|
|
1041
1052
|
cw.textContent=fragCss;
|
|
1042
|
-
|
|
1053
|
+
dhead().appendChild(cw);
|
|
1043
1054
|
}
|
|
1044
1055
|
}
|
|
1045
1056
|
// Already present ones are MOVED last, not skipped \u2014 see
|
|
@@ -1047,10 +1058,10 @@ else {
|
|
|
1047
1058
|
promoteGeneratedCss(fragCssHrefs,location.href);
|
|
1048
1059
|
// Add new page styles
|
|
1049
1060
|
fragStyles.forEach(function(s){
|
|
1050
|
-
var el=
|
|
1061
|
+
var el=ce('style');
|
|
1051
1062
|
el.textContent=s.css;
|
|
1052
1063
|
el.setAttribute('data-stx-page','');
|
|
1053
|
-
|
|
1064
|
+
dhead().appendChild(el);
|
|
1054
1065
|
});
|
|
1055
1066
|
// Swap content \u2014 apply the destination container's own attributes first
|
|
1056
1067
|
// so the incoming markup lands in a correctly-laid-out container instead
|
|
@@ -1058,11 +1069,11 @@ else {
|
|
|
1058
1069
|
applyContainerAttrs(currentContent,pendingContainerAttrs);
|
|
1059
1070
|
currentContent.innerHTML=cleanFrag;
|
|
1060
1071
|
// Remove old page scripts
|
|
1061
|
-
|
|
1072
|
+
qsa('script[data-stx-page]').forEach(function(s){s.remove()});
|
|
1062
1073
|
if(pushState!==false)writeHistory(pushState,url+(hash||''));
|
|
1063
1074
|
refreshCurrentLinks();
|
|
1064
1075
|
if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:'instant'});
|
|
1065
|
-
else if(hash){var el=
|
|
1076
|
+
else if(hash){var el=qs(hash);if(el)el.scrollIntoView({behavior:'smooth'})}
|
|
1066
1077
|
window.dispatchEvent(new CustomEvent('stx:navigate',{detail:{url:url}}));
|
|
1067
1078
|
// Before page scripts run, so a page that focuses its own control on
|
|
1068
1079
|
// mount still wins \u2014 its script executes after this.
|
|
@@ -1072,7 +1083,7 @@ else {
|
|
|
1072
1083
|
setTimeout(announceRoute,0);
|
|
1073
1084
|
// Execute page scripts FIRST \u2014 they define setup functions and set _latestSetup
|
|
1074
1085
|
log('[router] frag scripts:', fragScripts.length);
|
|
1075
|
-
|
|
1086
|
+
qsa('script[data-stx-page]').forEach(function(s){s.remove()});
|
|
1076
1087
|
// The page's module registry first (#1957), setups last. A fragment
|
|
1077
1088
|
// lists its scripts in document order, and the registry is emitted
|
|
1078
1089
|
// after the content it serves: a component that imports a package ran
|
|
@@ -1084,11 +1095,11 @@ else {
|
|
|
1084
1095
|
fragScripts.forEach(function(entry){
|
|
1085
1096
|
var code=entry.text;
|
|
1086
1097
|
log('[router] exec script len:', code.length, 'has __stx_setup:', code.indexOf('__stx_setup')>-1);
|
|
1087
|
-
var placeholder=
|
|
1098
|
+
var placeholder=qs('script[data-stx-route-script="'+entry.slot+'"]');
|
|
1088
1099
|
var nestedScopedTemplate=false;
|
|
1089
1100
|
var scopedLoopSetup=false;
|
|
1090
1101
|
if(entry.scoped&&placeholder){
|
|
1091
|
-
|
|
1102
|
+
qsa('template').forEach(function(template){
|
|
1092
1103
|
if(template.contains(placeholder)||(template.content&&template.content.contains(placeholder)))
|
|
1093
1104
|
nestedScopedTemplate=true;
|
|
1094
1105
|
});
|
|
@@ -1131,7 +1142,7 @@ else {
|
|
|
1131
1142
|
return;
|
|
1132
1143
|
}
|
|
1133
1144
|
executedScriptHashes[h]=1;
|
|
1134
|
-
var ns=
|
|
1145
|
+
var ns=ce('script');
|
|
1135
1146
|
var hasImport=hasStaticImport(code);
|
|
1136
1147
|
if(hasImport){
|
|
1137
1148
|
ns.type='module';
|
|
@@ -1194,7 +1205,7 @@ else {
|
|
|
1194
1205
|
var doc=parser.parseFromString(html,'text/html');
|
|
1195
1206
|
// Full documents carry the build id as a meta rather than a header, and
|
|
1196
1207
|
// this path also serves cached HTML, so check here too (#1772).
|
|
1197
|
-
var docBuildMeta=doc.querySelector(
|
|
1208
|
+
var docBuildMeta=doc.querySelector(BUILD_META);
|
|
1198
1209
|
var docBuild=docBuildMeta?(docBuildMeta.getAttribute('content')||''):'';
|
|
1199
1210
|
if(isBuildSkew(docBuild)){reloadForSkew(url,docBuild);return Promise.resolve(false)}
|
|
1200
1211
|
// Same hand-off as the fragment path, for the same reason (#1809, #1839).
|
|
@@ -1228,12 +1239,12 @@ else {
|
|
|
1228
1239
|
// \u2500\u2500 Swap <head> styles \u2500\u2500
|
|
1229
1240
|
// Inject new styles FIRST, then remove old to prevent unstyled flash
|
|
1230
1241
|
var keepIds={'stx-view-transitions':1,'stx-r-css':1};
|
|
1231
|
-
var curStyles=
|
|
1242
|
+
var curStyles=qsa('head style');
|
|
1232
1243
|
var newStyles=doc.querySelectorAll('head style');
|
|
1233
1244
|
|
|
1234
1245
|
// Merge css styles instead of replacing \u2014 persistent elements
|
|
1235
1246
|
// (nav, footer) outside <main> still need their utility classes
|
|
1236
|
-
var curCss=
|
|
1247
|
+
var curCss=qs('head style[data-css]');
|
|
1237
1248
|
var newCss=null;
|
|
1238
1249
|
newStyles.forEach(function(s){if(s.getAttribute('data-css'))newCss=s});
|
|
1239
1250
|
|
|
@@ -1245,20 +1256,20 @@ else {
|
|
|
1245
1256
|
var incoming=[];
|
|
1246
1257
|
newStyles.forEach(function(s){
|
|
1247
1258
|
if(!keepIds[s.id]&&!s.getAttribute('data-css')){
|
|
1248
|
-
var ns=
|
|
1259
|
+
var ns=ce('style');
|
|
1249
1260
|
ns.textContent=s.textContent;
|
|
1250
1261
|
ns.setAttribute('data-stx-incoming','');
|
|
1251
|
-
|
|
1262
|
+
dhead().appendChild(ns);
|
|
1252
1263
|
incoming.push(ns);
|
|
1253
1264
|
}
|
|
1254
1265
|
});
|
|
1255
1266
|
|
|
1256
1267
|
// If no existing css but new page has one, add it
|
|
1257
1268
|
if(!curCss&&newCss){
|
|
1258
|
-
var ns=
|
|
1269
|
+
var ns=ce('style');
|
|
1259
1270
|
ns.textContent=newCss.textContent;
|
|
1260
1271
|
ns.setAttribute('data-css',newCss.getAttribute('data-css'));
|
|
1261
|
-
|
|
1272
|
+
dhead().appendChild(ns);
|
|
1262
1273
|
}
|
|
1263
1274
|
|
|
1264
1275
|
// Remove old styles (except persistent ones, css, and incoming)
|
|
@@ -1285,7 +1296,7 @@ else {
|
|
|
1285
1296
|
try{docBase=new URL(url,location.href).href}catch(e){docBase=location.href}
|
|
1286
1297
|
var linkSel='link[rel="stylesheet"],link[rel="preconnect"]';
|
|
1287
1298
|
var curLinks={};
|
|
1288
|
-
|
|
1299
|
+
qsa('head '+linkSel).forEach(function(l){var h=l.getAttribute('href');if(h)curLinks[new URL(h,location.href).href]=1});
|
|
1289
1300
|
doc.querySelectorAll('head '+linkSel).forEach(function(l){
|
|
1290
1301
|
var href=l.getAttribute('href');
|
|
1291
1302
|
if(!href)return;
|
|
@@ -1295,9 +1306,9 @@ else {
|
|
|
1295
1306
|
var abs=new URL(href,docBase).href;
|
|
1296
1307
|
if(curLinks[abs])return;
|
|
1297
1308
|
curLinks[abs]=1;
|
|
1298
|
-
var nl=
|
|
1309
|
+
var nl=ce('link');
|
|
1299
1310
|
Array.from(l.attributes).forEach(function(a){nl.setAttribute(a.name,a.value)});
|
|
1300
|
-
|
|
1311
|
+
dhead().appendChild(nl);
|
|
1301
1312
|
});
|
|
1302
1313
|
// After every other stylesheet link, so the destination's complete
|
|
1303
1314
|
// utility sheet is last in the cascade.
|
|
@@ -1311,8 +1322,8 @@ else {
|
|
|
1311
1322
|
var declaredLayout=pendingLayoutDecl;
|
|
1312
1323
|
pendingLayoutDecl=null;
|
|
1313
1324
|
if(newBody){
|
|
1314
|
-
var newMeta=doc.querySelector(
|
|
1315
|
-
var curMeta=
|
|
1325
|
+
var newMeta=doc.querySelector(LAYOUT_META);
|
|
1326
|
+
var curMeta=qs(LAYOUT_META);
|
|
1316
1327
|
var curLayout=curMeta?curMeta.getAttribute('content'):'';
|
|
1317
1328
|
// The server's answer wins over the document's metas. We are only here
|
|
1318
1329
|
// because checkLayoutChange already said the group changed, based on
|
|
@@ -1380,16 +1391,16 @@ else {
|
|
|
1380
1391
|
// Copy body attributes (class, data-stx, etc.)
|
|
1381
1392
|
Array.from(newBody.attributes).forEach(function(attr){document.body.setAttribute(attr.name,attr.value)});
|
|
1382
1393
|
// Update layout meta tag
|
|
1383
|
-
var oldMeta=
|
|
1384
|
-
var freshMeta=doc.querySelector(
|
|
1394
|
+
var oldMeta=qs(LAYOUT_META);
|
|
1395
|
+
var freshMeta=doc.querySelector(LAYOUT_META);
|
|
1385
1396
|
if(oldMeta&&freshMeta)oldMeta.setAttribute('content',freshMeta.getAttribute('content')||'');
|
|
1386
|
-
else if(freshMeta){var m=
|
|
1387
|
-
var oldGroupMeta=
|
|
1388
|
-
var freshGroupMeta=doc.querySelector(
|
|
1397
|
+
else if(freshMeta){var m=ce('meta');m.name='stx-layout';m.content=freshMeta.getAttribute('content')||'';dhead().appendChild(m)}
|
|
1398
|
+
var oldGroupMeta=qs(LAYOUT_GROUP_META);
|
|
1399
|
+
var freshGroupMeta=doc.querySelector(LAYOUT_GROUP_META);
|
|
1389
1400
|
if(oldGroupMeta&&freshGroupMeta)oldGroupMeta.setAttribute('content',freshGroupMeta.getAttribute('content')||'');
|
|
1390
|
-
else if(freshGroupMeta){var gm=
|
|
1401
|
+
else if(freshGroupMeta){var gm=ce('meta');gm.name='stx-layout-group';gm.content=freshGroupMeta.getAttribute('content')||'';dhead().appendChild(gm)}
|
|
1391
1402
|
// Update container reference for script execution below
|
|
1392
|
-
currentContent=
|
|
1403
|
+
currentContent=qs(containerSel)||qs('main')||document.body;
|
|
1393
1404
|
} else {
|
|
1394
1405
|
// Same layout \u2014 swap only container content. Carry the destination
|
|
1395
1406
|
// container's attributes across too (same reason as the fragment path:
|
|
@@ -1408,7 +1419,7 @@ else {
|
|
|
1408
1419
|
|
|
1409
1420
|
// \u2500\u2500 Load new external <head> scripts \u2500\u2500
|
|
1410
1421
|
var loadedSrcs={};
|
|
1411
|
-
|
|
1422
|
+
qsa('head script[src]').forEach(function(s){loadedSrcs[s.src]=1});
|
|
1412
1423
|
var extPromises=[];
|
|
1413
1424
|
doc.querySelectorAll('head script[src]').forEach(function(s){
|
|
1414
1425
|
if(isSharedClientScript(s))return;
|
|
@@ -1418,11 +1429,11 @@ else {
|
|
|
1418
1429
|
if(loadedSrcs[src])return;
|
|
1419
1430
|
loadedSrcs[src]=1;
|
|
1420
1431
|
extPromises.push(new Promise(function(resolve,reject){
|
|
1421
|
-
var ns=
|
|
1432
|
+
var ns=ce('script');
|
|
1422
1433
|
ns.src=src;
|
|
1423
1434
|
ns.onload=resolve;
|
|
1424
1435
|
ns.onerror=reject;
|
|
1425
|
-
|
|
1436
|
+
dhead().appendChild(ns);
|
|
1426
1437
|
}));
|
|
1427
1438
|
});
|
|
1428
1439
|
|
|
@@ -1436,7 +1447,7 @@ else {
|
|
|
1436
1447
|
|
|
1437
1448
|
// \u2500\u2500 Script re-execution \u2500\u2500
|
|
1438
1449
|
// Remove previously injected page scripts
|
|
1439
|
-
|
|
1450
|
+
qsa('script[data-stx-page]').forEach(function(s){s.remove()});
|
|
1440
1451
|
|
|
1441
1452
|
var scripts=routedBodyScripts.slice();
|
|
1442
1453
|
function addScript(text, runAlways, slot, owner){
|
|
@@ -1521,7 +1532,7 @@ else {
|
|
|
1521
1532
|
|
|
1522
1533
|
// Scroll
|
|
1523
1534
|
if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:'instant'});
|
|
1524
|
-
else if(hash){var el=
|
|
1535
|
+
else if(hash){var el=qs(hash);if(el)el.scrollIntoView({behavior:'smooth'})}
|
|
1525
1536
|
|
|
1526
1537
|
// Update title
|
|
1527
1538
|
var newTitle=doc.querySelector('title');
|
|
@@ -1582,7 +1593,7 @@ else {
|
|
|
1582
1593
|
if(!runAlways&&!isSetup&&executedScriptHashes[h])return;
|
|
1583
1594
|
executedScriptHashes[h]=1;
|
|
1584
1595
|
// Wrap scripts with import statements as modules (Bug 3 fix)
|
|
1585
|
-
var ns=
|
|
1596
|
+
var ns=ce('script');
|
|
1586
1597
|
if(hasImport){
|
|
1587
1598
|
ns.type='module';
|
|
1588
1599
|
}
|
|
@@ -1595,7 +1606,7 @@ else {
|
|
|
1595
1606
|
var alreadyScoped=runsAlways(typeof entry==='string'?'':entry.run,text);
|
|
1596
1607
|
ns.textContent=(hasImport||alreadyScoped)?text:'{'+text+'}';
|
|
1597
1608
|
ns.setAttribute('data-stx-page','');
|
|
1598
|
-
var placeholder=entry.slot?
|
|
1609
|
+
var placeholder=entry.slot?qs('script[data-stx-route-script="'+entry.slot+'"]'):null;
|
|
1599
1610
|
if(placeholder&&placeholder.parentNode){
|
|
1600
1611
|
ns.setAttribute('data-stx-positioned','');
|
|
1601
1612
|
placeholder.parentNode.replaceChild(ns,placeholder);
|
|
@@ -1953,7 +1964,7 @@ else {
|
|
|
1953
1964
|
}
|
|
1954
1965
|
|
|
1955
1966
|
function updateNav(){
|
|
1956
|
-
|
|
1967
|
+
qsa('nav a[href], #mobileNav a[href], [data-stx-nav] a[href]').forEach(function(a){
|
|
1957
1968
|
if(!a.hasAttribute('data-stx-link'))return;
|
|
1958
1969
|
var st=linkState(a.getAttribute('href'),a.getAttribute('data-stx-active-match'));
|
|
1959
1970
|
if(!st)return;
|
|
@@ -1974,7 +1985,7 @@ else {
|
|
|
1974
1985
|
|
|
1975
1986
|
function updateActiveLinks(){
|
|
1976
1987
|
// Update active classes on <stx-link> elements (and legacy data-stx-link)
|
|
1977
|
-
var links=
|
|
1988
|
+
var links=qsa('[data-stx-link]');
|
|
1978
1989
|
links.forEach(function(link){
|
|
1979
1990
|
var st=linkState(link.getAttribute('to')||link.getAttribute('href')||'',link.getAttribute('data-stx-active-match'));
|
|
1980
1991
|
if(!st)return;
|
|
@@ -2016,7 +2027,7 @@ else {
|
|
|
2016
2027
|
// the cascade, or opt out entirely with viewTransitions:false.
|
|
2017
2028
|
function injectStyles(){
|
|
2018
2029
|
if(!document.getElementById('stx-r-css')){
|
|
2019
|
-
var s=
|
|
2030
|
+
var s=ce('style');s.id='stx-r-css';
|
|
2020
2031
|
// Strip characters that could escape our CSS block and inject new
|
|
2021
2032
|
// declarations: ; { } ( ) " ' \\ < > plus whitespace control chars.
|
|
2022
2033
|
// This keeps the value safe to concat into a stylesheet even if a
|
|
@@ -2038,10 +2049,10 @@ else {
|
|
|
2038
2049
|
css+='@media (prefers-reduced-motion: reduce){::view-transition-old(root),::view-transition-new(root){animation-duration:0s;animation-name:none}}';
|
|
2039
2050
|
}
|
|
2040
2051
|
s.textContent=css;
|
|
2041
|
-
|
|
2052
|
+
dhead().appendChild(s);
|
|
2042
2053
|
}
|
|
2043
2054
|
if(o.progress&&!document.getElementById('stx-router-progress')){
|
|
2044
|
-
var el=
|
|
2055
|
+
var el=ce('div');
|
|
2045
2056
|
el.id='stx-router-progress';
|
|
2046
2057
|
el.setAttribute('role','progressbar');
|
|
2047
2058
|
el.setAttribute('aria-hidden','true');
|
|
@@ -2058,7 +2069,7 @@ else {
|
|
|
2058
2069
|
|
|
2059
2070
|
function injectViewTransitionCSS(){
|
|
2060
2071
|
if(document.getElementById('stx-view-transitions'))return;
|
|
2061
|
-
var s=
|
|
2072
|
+
var s=ce('style');s.id='stx-view-transitions';
|
|
2062
2073
|
s.textContent='::view-transition-group(root){animation:none}::view-transition-old(root){animation:none}::view-transition-new(root){animation:none}main,#app-content,[data-stx-content]{view-transition-name:stx-content}::view-transition-old(stx-content){animation:stx-fade-out .15s ease-out both}::view-transition-new(stx-content){animation:stx-fade-in .15s ease-in .1s both}@keyframes stx-fade-out{from{opacity:1}to{opacity:0}}@keyframes stx-fade-in{from{opacity:0}to{opacity:1}}::view-transition{background:transparent}::view-transition-group(stx-content){background:inherit;overflow:hidden}';
|
|
2063
2074
|
(document.head||document.documentElement).appendChild(s);
|
|
2064
2075
|
}
|
|
@@ -2115,5 +2126,5 @@ else {
|
|
|
2115
2126
|
|
|
2116
2127
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
2117
2128
|
})();
|
|
2118
|
-
`),
|
|
2119
|
-
export{
|
|
2129
|
+
`}function q$(){if(w)return w;return w=C$(k$(H$())),w}function N$(){if(P)return P;return P=C$(H$()),P}var w,P;var R$=()=>{};var w$={};v$(w$,{setAppUrl:()=>I$,runMiddleware:()=>A$,route:()=>J$,resolveLayoutChain:()=>R,resetRoutes:()=>K$,registerMiddleware:()=>v,patternToRegex:()=>j,navigateTo:()=>Y$,matchRoute:()=>o,loadMiddlewareFromDirectory:()=>_$,isNonPageRoutePattern:()=>A,isNonPageRoutePath:()=>y,hasMiddleware:()=>Q$,getRouterScriptDev:()=>N$,getRouterScript:()=>q$,getMiddlewareNames:()=>M$,getMiddleware:()=>p,generateRouteTypes:()=>H,generateRouteManifest:()=>q,formatRoutes:()=>$$,findErrorPage:()=>e,filePathToPattern:()=>N,extractLayoutMetadata:()=>j$,deriveLayoutGroup:()=>n,defineRoutes:()=>B$,defineRoute:()=>O$,defineMiddleware:()=>G$,createStorageManager:()=>u,createServerCookieManager:()=>c,createRouter:()=>a,createRouteLocation:()=>z$,createMiddlewareContext:()=>F$,createClientCookieManager:()=>l,clearMiddleware:()=>W$,bracketPathToRegex:()=>r,abortNavigation:()=>Z$,Router:()=>b,NON_PAGE_DIRS:()=>F});var P$=G(()=>{U$();g();L$();E$();m();T$();f();C();R$()});
|
|
2130
|
+
export{F as xv,y as yv,A as zv,H as Av,q as Bv,N as Cv,j as Dv,o as Ev,r as Fv,R as Gv,b as Hv,a as Iv,e as Jv,$$ as Kv,I$ as Lv,O$ as Mv,B$ as Nv,J$ as Ov,K$ as Pv,Y$ as Qv,Z$ as Rv,G$ as Sv,c as Tv,l as Uv,u as Vv,v as Wv,p as Xv,Q$ as Yv,W$ as Zv,M$ as _v,_$ as $v,z$ as aw,F$ as bw,A$ as cw,n as dw,j$ as ew,T$ as fw,q$ as gw,N$ as hw,w$ as iw,P$ as jw};
|