@stacksjs/stx 0.2.338 → 0.2.340
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/builtins/stx-image.js +3 -2
- package/dist/builtins/stx-link.js +2 -1
- package/dist/caching.d.ts +1 -18
- package/dist/caching.js +2 -21
- package/dist/chunk-0pje0pjq.js +2 -0
- package/dist/{chunk-95t7pked.js → chunk-1w8bpytb.js} +1 -1
- package/dist/{chunk-wakb8z5q.js → chunk-284ag6fs.js} +9 -9
- package/dist/{chunk-9btdax2s.js → chunk-28q3vycz.js} +1 -1
- package/dist/{chunk-nhbc464j.js → chunk-3agx4hyd.js} +1 -1
- package/dist/{chunk-fjrkyhm7.js → chunk-3b9sxnty.js} +1 -1
- package/dist/{chunk-8cg15rr7.js → chunk-5ggt2ryn.js} +1 -1
- package/dist/{chunk-46tmg3k4.js → chunk-5t8ersrw.js} +1 -1
- package/dist/{chunk-x01sw9wy.js → chunk-605955nh.js} +1 -1
- package/dist/{chunk-3cjvqa0s.js → chunk-64qg8jes.js} +1 -1
- package/dist/{chunk-gz539gk6.js → chunk-6av24ywm.js} +1 -1
- package/dist/chunk-6es5r4az.js +3 -0
- package/dist/chunk-6j6ek3j1.js +2 -0
- package/dist/{chunk-zye9r15n.js → chunk-6nde3nmc.js} +1 -1
- package/dist/{chunk-vm5jbgb1.js → chunk-6zsc0z5a.js} +3 -3
- package/dist/{chunk-5r7gfwpj.js → chunk-756dqqn1.js} +1 -1
- package/dist/{chunk-m1p2n3nf.js → chunk-7xjm1zqa.js} +1 -1
- package/dist/{chunk-9m5sxaen.js → chunk-82h5rp34.js} +1 -1
- package/dist/{chunk-mnyehz4t.js → chunk-8de19dmw.js} +1 -1
- package/dist/{chunk-hfzv07az.js → chunk-95e1m9p8.js} +1 -1
- package/dist/{chunk-qhdp0ycf.js → chunk-9pv7gcey.js} +1 -1
- package/dist/{chunk-kawdj1j7.js → chunk-a2mj88c6.js} +1 -1
- package/dist/{chunk-39xtzfzf.js → chunk-apa2v787.js} +1 -1
- package/dist/{chunk-f6sejeg3.js → chunk-axqfm9b4.js} +1 -1
- package/dist/{chunk-4pcjt99d.js → chunk-cjcj2gsq.js} +1 -1
- package/dist/{chunk-w0hzaka3.js → chunk-d6yyzpsv.js} +98 -7
- package/dist/{chunk-e3rgky2r.js → chunk-d964bsxm.js} +283 -283
- package/dist/chunk-dy9xs2q0.js +2 -0
- package/dist/chunk-eb1v7f55.js +2 -0
- package/dist/{chunk-1yj4xd6n.js → chunk-f476c9fb.js} +3 -3
- package/dist/{chunk-4904n5v0.js → chunk-fa2mg49t.js} +2 -2
- package/dist/{chunk-4cw0s9f4.js → chunk-fx07kyz7.js} +1 -1
- package/dist/chunk-g0059g3p.js +2 -0
- package/dist/{chunk-meqz313r.js → chunk-gf6t4419.js} +1 -1
- package/dist/{chunk-yj1dxdfr.js → chunk-h7hnzwd0.js} +1 -1
- package/dist/chunk-hkgnpf6v.js +2 -0
- package/dist/{chunk-9jc2z17q.js → chunk-hq9fa4pe.js} +2 -2
- package/dist/chunk-hvw4mwee.js +2 -0
- package/dist/chunk-jwa2jhd8.js +2 -0
- package/dist/{chunk-kdwerx8e.js → chunk-kwxcertb.js} +1 -1
- package/dist/{chunk-gtfcw1gc.js → chunk-mb7rn0bf.js} +1 -1
- package/dist/chunk-mjf3xmxn.js +3 -0
- package/dist/{chunk-vgfnre7b.js → chunk-nwz43t6d.js} +1 -1
- package/dist/{chunk-823h67tv.js → chunk-p7ntrtaj.js} +1 -1
- package/dist/{chunk-fw56y3cb.js → chunk-ppp84wry.js} +2 -2
- package/dist/{chunk-qtc28zy1.js → chunk-pxw0cpxe.js} +1 -1
- package/dist/chunk-r5kr6jk4.js +17 -0
- package/dist/chunk-rceawm7w.js +2 -0
- package/dist/{chunk-kermxyfe.js → chunk-shtg7kah.js} +1 -1
- package/dist/{chunk-dvafkj8w.js → chunk-t3mh10z3.js} +1 -1
- package/dist/chunk-vz0ebk4j.js +2 -0
- package/dist/{chunk-fha0nyet.js → chunk-wjcrcbd1.js} +1 -1
- package/dist/{chunk-3sgdth20.js → chunk-x80ahcnw.js} +1 -1
- package/dist/{chunk-41dfsdy9.js → chunk-x81z8m6a.js} +1 -1
- package/dist/{chunk-jkyvk4x6.js → chunk-xy4jt4ek.js} +1 -1
- package/dist/{chunk-4np12rj1.js → chunk-y07fna67.js} +1 -1
- package/dist/{chunk-9bvgzqw1.js → chunk-yxpr7h26.js} +2 -2
- package/dist/{chunk-7d74am4w.js → chunk-yz0d60px.js} +1 -1
- package/dist/{chunk-7ngnyy5k.js → chunk-z19pk2pn.js} +1 -1
- package/dist/{chunk-4jj4kk18.js → chunk-z7vb3mgn.js} +1 -1
- package/dist/{chunk-tsmdmf5h.js → chunk-zg2hvb1j.js} +28 -1
- package/dist/cli.js +8 -8
- package/dist/client-script-bundler.js +10 -8
- package/dist/config.js +1 -0
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/engine-fingerprint.d.ts +17 -0
- package/dist/engine-fingerprint.js +23 -0
- package/dist/expressions.js +9 -4
- package/dist/pwa.js +2 -2
- package/dist/runtime-injection.js +2 -0
- package/dist/signals.js +28 -1
- package/dist/ssg.js +2 -2
- package/dist/types/config-types.d.ts +8 -0
- package/dist/url-safety.d.ts +67 -0
- package/dist/url-safety.js +40 -0
- package/package.json +5 -5
- package/dist/chunk-1wsewc5h.js +0 -2
- package/dist/chunk-a3m7mgjc.js +0 -2
- package/dist/chunk-aftqqqcg.js +0 -3
- package/dist/chunk-e9y48d60.js +0 -2
- package/dist/chunk-f08ttkqr.js +0 -2
- package/dist/chunk-n0a55zv2.js +0 -2
- package/dist/chunk-q3g4yf5r.js +0 -2
- package/dist/chunk-szfk6pw6.js +0 -2
- package/dist/chunk-temapbqe.js +0 -2
- package/dist/chunk-ypzm47q3.js +0 -17
- package/dist/chunk-z07knk3p.js +0 -2
- package/dist/chunk-zt4pf776.js +0 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{rl as K}from"./chunk-mjf3xmxn.js";import{hq as M,lq as y}from"./chunk-d964bsxm.js";import{Fs as G}from"./chunk-3agx4hyd.js";import{tw as T}from"./chunk-5g6rprcy.js";import V from"fs";import Z from"path";var w=new Map,W=new Map;async function _(j){let z;for(let J=0;J<3;J++)try{let X=(await V.promises.stat(j)).mtime.getTime(),Q=W.get(j);if(Q&&Q.mtime===X)return Q.content;let Y=await Bun.file(j).text(),L=(await V.promises.stat(j)).mtime.getTime();if(L!==X)continue;return W.set(j,{content:Y,mtime:L}),Y}catch(I){z=I;break}throw W.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function C(j){W.delete(j)}function g(j){for(let B of W.keys())if(B.startsWith(j))W.delete(B)}var q=null,b=null,O=null;function u(j){O=j}async function A(j=!1){let B=O??await import("./chunk-pxw0cpxe.js");if(j)return B.generateSignalsRuntimeDev();if(q===null)q=B.generateSignalsRuntime();return q}var D=null;async function v(){if(D===null){let{getRouterScript:j}=await import("./chunk-6av24ywm.js");D=j()}return D}var N={};async function P(j,B=!1){let z=j==="runtime"?await A(B):await v(),J=j==="runtime"&&B?"runtime-debug":j,I=N[J];if(!I||I.content!==z)I={content:z,hash:Bun.hash(z).toString(16).padStart(16,"0").slice(0,16)},N[J]=I;return{content:z,hash:I.hash,url:`/_stx/${j}.${I.hash}.js`}}function m(){W.clear(),y(),G(),q=null,b=null,D=null}function x(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function p(j,B){try{if(!B.cachePath)return null;let z=Z.resolve(B.cachePath),J=Z.join(z,`${U(j)}.html`),I=Z.join(z,`${U(j)}.meta.json`);if(!await M(J)||!await M(I))return null;let X=await Bun.file(I).text(),Q=JSON.parse(X);if(Q.cacheVersion!==B.cacheVersion)return null;if(Q.engine!==K())return null;if(Q.optionsSignature!==x(B))return null;if((await V.promises.stat(j)).mtime.getTime()>Q.mtime)return null;for(let $ of Q.dependencies)if(await M($)){if((await V.promises.stat($)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function d(j,B,z,J){try{if(!J.cachePath)return;let I=Z.resolve(J.cachePath);await V.promises.mkdir(I,{recursive:!0});let X=Z.join(I,`${U(j)}.html`),Q=Z.join(I,`${U(j)}.meta.json`),Y=await V.promises.stat(j);await Bun.write(X,B);let $={sourcePath:j,mtime:Y.mtime.getTime(),dependencies:Array.from(z),cacheVersion:J.cacheVersion,engine:K(),optionsSignature:x(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify($,null,2)),w.set(j,{output:B,mtime:Y.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var k=16;function U(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,k)}
|
|
3
|
+
export{w as Jj,_ as Kj,C as Lj,g as Mj,u as Nj,A as Oj,v as Pj,P as Qj,m as Rj,p as Sj,d as Tj,U as Uj};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ue as a}from"./chunk-apa2v787.js";import"./chunk-57atgbyq.js";import"./chunk-d964bsxm.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-3agx4hyd.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-shtg7kah.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-d6yyzpsv.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{a as buildApp};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ji as D,Ki as S,Li as R}from"./chunk-7we3xfde.js";import{Yl as I,aq as K,rr as k}from"./chunk-
|
|
2
|
+
import{Ji as D,Ki as S,Li as R}from"./chunk-7we3xfde.js";import{Yl as I,aq as K,rr as k}from"./chunk-d964bsxm.js";import{bv as x,cv as F}from"./chunk-2tjk867y.js";import{gv as y}from"./chunk-deqnt1w5.js";import P from"path";var U=new Map,T=new Map,u=["composables","functions"];function b(q){let z=P.basename(q,".ts");return z==="index"||z==="types"||q.endsWith(".d.ts")}async function p(q){if(q)return P.resolve(q);let z=`<default>:${process.cwd()}`,W=T.get(z);if(W!==void 0)return W;let H=await m();if(H!==null)T.set(z,H);return H}async function m(){let q=await k(),z=q.root||process.cwd(),W=q.composablesDir;if(W)return P.resolve(z,W);for(let H of u){let Q=P.resolve(z,H);try{let V=new Bun.Glob("**/*.ts");for await(let Z of V.scan({cwd:Q,absolute:!0}))if(!b(Z))return Q}catch{}}return null}async function g(q){let z=Array.isArray(q)?q:q?[P.resolve(q)]:(await k())._layerComposableDirs??[await p()].filter((H)=>!!H),W=new Map;for(let H of z){let Q=new Bun.Glob("**/*.ts");try{for await(let V of Q.scan({cwd:H,absolute:!0})){let Z=P.relative(H,V);if(!b(V)&&!W.has(Z))W.set(Z,V)}}catch{}}return{key:z.join("\x00"),files:[...W.values()].sort()}}async function e(q){let{files:z}=await g(q),W=K({loader:"ts",target:"browser",define:I()}),H=[];for(let Q of z)try{let V=await Bun.file(Q).text(),Z=W.scan(V).exports.filter(($)=>$!=="default");if(Z.length>0)H.push({file:Q,names:Z})}catch{}return H}function t(q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(q)}function n(q,z,W){let H=new Map;for(let{file:$,names:G}of q)for(let O of G)if(!H.has(O))H.set(O,$);let Q=($)=>{let G=[];for(let[O,j]of H)if(t($,O))G.push(j);return G},V=new Set,Z=W.flatMap(Q);while(Z.length>0){let $=[];for(let G of Z){if(V.has(G))continue;V.add(G);for(let O of Q(z.get(G)??""))if(!V.has(O))$.push(O)}Z=$}return V}async function qq(q,z,W){let{key:H,files:Q}=await g(q);if(!H)return null;let V=D(Q);if(Q.length===0)return R(U,H,V,""),null;Q.sort();let Z=K({loader:"ts",target:"browser",define:I()}),$=new Map,G=[];for(let J of Q)try{let Y=await Bun.file(J).text();$.set(J,Y);let L=Z.scan(Y).exports.filter((X)=>X!=="default");if(L.length>0)G.push({file:J,names:L})}catch{$.set(J,"")}let O=z===void 0?new Set(Q):n(G,$,W?[z,...W]:[z]);if(O.size===0)return null;let j=Q.filter((J)=>O.has(J)),A=`${H}\x00${j.join("\x00")}`,B=S(U,A,V);if(B!==void 0)return B||null;let M=[],w=new Set,_=new Set;for(let J of j)try{let Y=$.get(J)??await Bun.file(J).text(),L=P.basename(J,".ts");for(let X of Y.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])_.add(X[1]);try{for(let X of Z.scan(Y).exports)if(X!=="default")w.add(X)}catch{}Y=x(Y),Y=F(Y),Y=Y.replace(/^export\s+(default\s+)?/gm,""),Y=Z.transformSync(Y),M.push(`// Composable: ${L}
|
|
3
3
|
${Y.trim()}`)}catch(Y){console.warn(`[stx] Failed to load composable ${J}:`,Y)}if(M.length===0||w.size===0)return R(U,A,V,""),null;let h=[...w].map((J)=>` try { if (!(${JSON.stringify(J)} in __c)) __c[${JSON.stringify(J)}] = ${J}; } catch (e) {}`).join(`
|
|
4
4
|
`),v=JSON.stringify([...w]),E=M.join(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ho as k,Jp as w,Ql as A,Rl as b,Xm as T,Ym as y,Zn as M,gm as B,im as F,lo as R,pr as P,zo as x}from"./chunk-
|
|
2
|
+
import{Ho as k,Jp as w,Ql as A,Rl as b,Xm as T,Ym as y,Zn as M,gm as B,im as F,lo as R,pr as P,zo as x}from"./chunk-d964bsxm.js";import{tw as v}from"./chunk-5g6rprcy.js";function j(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,Y){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(Y?.some((X)=>q>=X.start&&N<=X.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,Y)=>J.start-Y.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function D(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>b(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as f,resolve as H}from"path";function S(K){let z=K,G=M(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],Y=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],X=$[2],E=$[0],Z=N.includes("server");if(Y(X))J.push(E);else if(Z)Q.push(X);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,X,E=[];while((X=N.exec(q))!==null){let Z=X.index+X[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:X.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=Y.__stx_event_bindings||[],X=B(Y),Z=(await Promise.all(Q.map(async(I)=>{let W=I.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return I;return await F(W[1],{eventBindings:N,templateContent:q,serverData:X,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-
|
|
18
|
-
export{j as
|
|
17
|
+
${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-7xjm1zqa.js");q=await N(q)}catch{}return q}
|
|
18
|
+
export{j as mk,C as nk,D as ok,o as pk,r as qk,V as rk};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ei as s}from"./chunk-
|
|
2
|
+
import{ei as s}from"./chunk-6nde3nmc.js";import{Kp as v,Lp as i,Mp as t,Pp as e,Qp as HH,Rp as KH,Sp as QH,Tp as YH,Up as ZH,Xl as a,rr as $H}from"./chunk-d964bsxm.js";import{mt as h}from"./chunk-vaggjvsm.js";import{gv as f}from"./chunk-deqnt1w5.js";import{existsSync as jH,readFileSync as WH}from"fs";import z from"path";function AH(Q,K="",V=""){let L=Q.startLine>1?`
|
|
3
3
|
`.repeat(Q.startLine-1):"",U=t(i(Q.code)),X=Q.kind==="client"||Q.kind==="plain"?HH(K,Q.code):"";return QH(`${L+U}
|
|
4
4
|
${X}
|
|
5
5
|
export {}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$s as d,Ys as a,Zs as b,_s as c,at as e,bt as f,ct as g,dt as h,et as i,ft as j,gt as k,ht as l}from"./chunk-
|
|
2
|
+
import{$s as d,Ys as a,Zs as b,_s as c,at as e,bt as f,ct as g,dt as h,et as i,ft as j,gt as k,ht as l}from"./chunk-3agx4hyd.js";import"./chunk-vaggjvsm.js";import"./chunk-5g6rprcy.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{At as a,Bt as b}from"./chunk-
|
|
2
|
+
import{At as a,Bt as b}from"./chunk-shtg7kah.js";import"./chunk-k3dtvay1.js";import"./chunk-5g6rprcy.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ji as O,Ki as w,Li as Z}from"./chunk-7we3xfde.js";import{
|
|
2
|
+
import{Ji as O,Ki as w,Li as Z}from"./chunk-7we3xfde.js";import{Xk as R,cl as U,il as T}from"./chunk-r5kr6jk4.js";import{Yl as M,aq as k,rr as C,yo as W}from"./chunk-d964bsxm.js";import{bv as E,cv as L}from"./chunk-2tjk867y.js";import{gv as B}from"./chunk-deqnt1w5.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
|
|
3
3
|
${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(G.length===0)return Z(Y,z,K,""),null;let j=G.join(`
|
|
4
4
|
|
|
5
5
|
`),x=`;(function(){
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wm as b}from"./chunk-
|
|
2
|
+
import{wm as b}from"./chunk-d964bsxm.js";import{Hu as L,Lu as R}from"./chunk-799s9mwc.js";function P(j,U){let Q=1,J=U,B="<template",z="</template";while(J<j.length&&Q>0){let G=j.indexOf("<",J);if(G===-1)break;if(J=G,j.startsWith(B,J)&&(J+B.length>=j.length||/[\s>\/]/.test(j[J+B.length]))){Q++,J+=B.length;continue}if(j.startsWith(z,J)){let W=j.indexOf(">",J+z.length);if(W!==-1){if(Q--,Q===0)return W+1;J=W+1;continue}}J++}return Q===0?J:-1}var F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function O(j,U){let Q=null;for(let J=U;J<j.length;J++){let B=j[J];if(Q){if(B==="\\"){J++;continue}if(B===Q)Q=null;continue}if(B==='"'||B==="'"){Q=B;continue}if(B===">")return J+1}return-1}function I(j,U,Q){let J=U.toLowerCase(),B=1,z=Q;while(z<j.length){let G=j.indexOf("<",z);if(G===-1)return-1;if(j.startsWith("<!--",G)){let $=j.indexOf("-->",G+4);z=$===-1?j.length:$+3;continue}let W=O(j,G+1);if(W===-1)return-1;let Z=j.slice(G,W),Y=Z.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(Y&&Y[2].toLowerCase()===J){if(Y[1]==="/"){if(B--,B===0)return W}else if(!/\/\s*>$/.test(Z))B++}z=W}return-1}function w(j){let U=[],Q=[],J=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[2].toLowerCase();if(Z[1]==="/"){let X=Q.lastIndexOf(Y);if(X!==-1)Q.splice(X);B=G;continue}let $=/\/\s*>$/.test(W),K=Q.length===0?W.match(J):null;if(K){let X=K[1]||K[2],H=W.replace(J,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),_=$||F.has(Y)?-1:I(j,Y,G);if(_===-1)U.push({start:z,end:G,slotName:X,element:H}),B=G;else U.push({start:z,end:_,slotName:X,element:H+j.slice(G,_)}),B=_;continue}if(!$&&!F.has(Y)){if(Q.push(Y),Y==="script"||Y==="style"){let X=j.toLowerCase().indexOf(`</${Y}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function D(j){let U=[],Q=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[1]==="/",$=Z[2].toLowerCase();if(Y){let X=Q.lastIndexOf($);if(X!==-1)Q.splice(X);B=G;continue}if($==="template"&&Q.length===0){let X=W.match(J);if(X){let H=P(j,G);if(H!==-1){let _=X[1]||X[2]||X[3];U.push({start:z,end:H,slotName:_,content:j.slice(G,H-11).trim(),propsBinding:X[4]||void 0}),B=H;continue}}}if(!/\/\s*>$/.test(W)&&!F.has($)){if(Q.push($),$==="script"||$==="style"){let X=j.toLowerCase().indexOf(`</${$}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function v(j){let U={default:"",named:new Map},Q=j,J=D(j);for(let z of J)U.named.set(z.slotName,{name:z.slotName,content:z.content,propsBinding:z.propsBinding});J.sort((z,G)=>G.start-z.start);for(let z of J)Q=Q.slice(0,z.start)+Q.slice(z.end);let B=w(Q);for(let z of B){let G=U.named.get(z.slotName);if(G)G.content+=z.element;else U.named.set(z.slotName,{name:z.slotName,content:z.element})}for(let z=B.length-1;z>=0;z--){let G=B[z];Q=Q.slice(0,G.start)+Q.slice(G.end)}return U.default=Q.trim(),U}function S(j){let U=j.match(/name\s*=\s*["']([^"']+)["']/),Q=U?U[1]:"",J={},B=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,z;while((z=B.exec(j))!==null)J[z[1]]=z[2];let G=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),W=G?G[1].trim():"";return{name:Q,props:J,defaultContent:W}}async function k(j,U,Q,J){if(!j)return Q;let B=j.content;if(j.propsBinding&&Object.keys(U).length>0){let z=j.propsBinding.trim(),G={...J};if(z.startsWith("{")&&z.endsWith("}")){let W=z.slice(1,-1).split(",").map((Z)=>Z.trim()).filter(Boolean);for(let Z of W){let[Y,$]=Z.split(":").map((X)=>X.trim()),K=$||Y;if(U[Y]!==void 0)G[K]=U[Y]}}else G[z]=U;B=N(B,G)}return B}function N(j,U){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Q,J)=>{try{let B=J.trim(),z=y(B,U);return b(String(z??""))}catch{return`{{ ${J} }}`}})}function y(j,U){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let J=j.split("."),B=U;for(let z of J)if(B&&typeof B==="object"&&z in B)B=B[z];else return;return B}let Q=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Q){let[,J,B,z]=Q,G=U[J],W=parseInt(z,10);if(typeof G==="number")switch(B){case"+":return G+W;case"-":return G-W;case"*":return G*W;case"/":return G/W}}try{if(!L(j))return;return R(j,Object.keys(U))(...Object.values(U))}catch{return}}async function T(j,U,Q){let J=j;J=await C(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,W,Z,Y)=>{let $=U.named.get(W),K=Y?.trim()||"",X=Z||"",H={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,q;while((q=_.exec(X))!==null){let A=q[1],V=q[2];H[A]=y(V,Q)}return await k($,H,K,Q)});let z=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(z,(G,W)=>{if(G.includes("name="))return G;let Z=W?.trim()||"";return U.default||Z}),J}async function C(j,U,Q){let J=[],B=[];j.replace(U,(W,...Z)=>{let Y=Z[Z.length-2];return B.push({match:W,index:Y}),J.push(Q(W,...Z.slice(0,-2))),W});let z=await Promise.all(J),G=j;for(let W=B.length-1;W>=0;W--){let{match:Z,index:Y}=B[W];G=G.slice(0,Y)+z[W]+G.slice(Y+Z.length)}return G}function E(j){let U=v(j);return{defaultSlot:U.default,namedSlots:U.named}}async function x(j,U,Q,J){return await T(j,{default:U,named:Q},J)}
|
|
3
3
|
export{v as Kg,S as Lg,k as Mg,T as Ng,E as Og,x as Pg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Kg as a,Lg as b,Mg as c,Ng as d,Og as e,Pg as f}from"./chunk-
|
|
2
|
+
import{Kg as a,Lg as b,Mg as c,Ng as d,Og as e,Pg as f}from"./chunk-95e1m9p8.js";import"./chunk-d964bsxm.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-3agx4hyd.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-shtg7kah.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-d6yyzpsv.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ei as a,fi as b,gi as c}from"./chunk-
|
|
2
|
+
import{ei as a,fi as b,gi as c}from"./chunk-6nde3nmc.js";import"./chunk-7we3xfde.js";import"./chunk-d964bsxm.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-3agx4hyd.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-shtg7kah.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-d6yyzpsv.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wg as I}from"./chunk-57atgbyq.js";import{rr as H}from"./chunk-
|
|
2
|
+
import{wg as I}from"./chunk-57atgbyq.js";import{rr as H}from"./chunk-d964bsxm.js";import{tw as G}from"./chunk-5g6rprcy.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-rceawm7w.js");E=await z({root:A,outputDir:".output",debug:k.debug,...k.ssr})}let K=Math.round(performance.now()-J);return{mode:q,ssg:D,ssr:E,duration:K}}
|
|
3
3
|
export{Q as Ue};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Co as a,Do as b,Eo as c,Fo as d,Go as e,Ho as f,Io as g,Jo as h,Ko as i,Lo as j,Mo as k}from"./chunk-
|
|
2
|
+
import{Co as a,Do as b,Eo as c,Fo as d,Go as e,Ho as f,Io as g,Jo as h,Ko as i,Lo as j,Mo as k}from"./chunk-d964bsxm.js";import"./chunk-d7zxg9bp.js";import"./chunk-t00ga194.js";import"./chunk-hrdd26r4.js";import"./chunk-7r79j1hs.js";import"./chunk-ay336sqb.js";import"./chunk-3agx4hyd.js";import"./chunk-vaggjvsm.js";import"./chunk-q9ckfwhh.js";import"./chunk-shtg7kah.js";import"./chunk-k3dtvay1.js";import"./chunk-aved735s.js";import"./chunk-799s9mwc.js";import"./chunk-7r80apc5.js";import"./chunk-2tjk867y.js";import"./chunk-t8ctvjqe.js";import"./chunk-deqnt1w5.js";import"./chunk-d6yyzpsv.js";import"./chunk-wb90259a.js";import"./chunk-5g6rprcy.js";export{b as stripTypeScript,i as splitDeclaration,d as isSyntaxFailure,c as isModuleResolutionFailure,e as isMissingBindingFailure,g as isCompleteImport,k as hasVariables,f as extractVariables,j as extractScriptFromTemplate,h as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|
|
@@ -8,7 +8,7 @@ import{rw as v$,sw as G}from"./chunk-5g6rprcy.js";function y($){return $.split(/
|
|
|
8
8
|
if(window.__stxRouter&&window.__stxRouter.__rev===ROUTER_REV)return;
|
|
9
9
|
|
|
10
10
|
// \u2500\u2500 Configuration \u2500\u2500
|
|
11
|
-
var defaults={container:'main',loadingClass:'stx-navigating',viewTransitions:true,cache:true,scrollToTop:true,prefetch:true,progress:true,progressColor:'#78dce8',progressHeight:'2px',interceptAllLinks:false,prefetchCacheMax:50,routeFocus:true,announceRoute:true,interceptForms:false,cssLoadTimeout:1500};
|
|
11
|
+
var defaults={container:'main',loadingClass:'stx-navigating',viewTransitions:true,cache:true,scrollToTop:true,prefetch:true,progress:true,progressColor:'#78dce8',progressHeight:'2px',interceptAllLinks:false,prefetchCacheMax:50,routeFocus:true,announceRoute:true,interceptForms:false,cssLoadTimeout:1500,scrollRestoration:true};
|
|
12
12
|
var o=Object.assign({},defaults,window.__stxRouterConfig||{},window.STX_ROUTER_OPTIONS||{});
|
|
13
13
|
var containerSel=o.container;
|
|
14
14
|
var debug=!!o.debug;
|
|
@@ -25,6 +25,84 @@ import{rw as v$,sw as G}from"./chunk-5g6rprcy.js";function y($){return $.split(/
|
|
|
25
25
|
function ce(tag){return document.createElement(tag)}
|
|
26
26
|
function dhead(){return document.head}
|
|
27
27
|
|
|
28
|
+
// \u2500\u2500 Scroll position \u2500\u2500
|
|
29
|
+
// Forward navigation goes to the top, or to the hash. Back and forward return
|
|
30
|
+
// to where the entry was left -- the browser cannot do that for us, because
|
|
31
|
+
// by the time it would restore, the content of the entry has not been fetched
|
|
32
|
+
// yet, so it clamps to whatever height the outgoing page happened to have.
|
|
33
|
+
// history.scrollRestoration therefore goes to manual and the positions are
|
|
34
|
+
// kept here, keyed by a token written into each history entry (two entries
|
|
35
|
+
// for the same URL keep their own positions, which is the point).
|
|
36
|
+
//
|
|
37
|
+
// Manual restoration also takes the browser's reload behaviour away, so the
|
|
38
|
+
// positions are mirrored into sessionStorage: a reload, or a return to the
|
|
39
|
+
// tab, finds the entry's token already in history.state and restores from
|
|
40
|
+
// there. sessionStorage is per tab and dies with it, same as the history.
|
|
41
|
+
var SCROLL_TOKEN='__stxScroll';
|
|
42
|
+
var SCROLL_STORE='stx:scroll:';
|
|
43
|
+
var scrollSeq=0;
|
|
44
|
+
var pendingScroll=null;
|
|
45
|
+
var restoreScroll=!!o.scrollRestoration;
|
|
46
|
+
function newScrollToken(){return 's'+(++scrollSeq)+'-'+Date.now()}
|
|
47
|
+
var scrollToken=(history.state&&history.state[SCROLL_TOKEN])||newScrollToken();
|
|
48
|
+
// sessionStorage is the only store: it is synchronous, it is per tab, it dies
|
|
49
|
+
// with the tab exactly as the history does, and it is the one that survives a
|
|
50
|
+
// reload. A private window that refuses it degrades to scrolling to the top.
|
|
51
|
+
function readScroll(token){
|
|
52
|
+
try{
|
|
53
|
+
var parts=(window.sessionStorage.getItem(SCROLL_STORE+token)||'').split(',');
|
|
54
|
+
return parts.length===2?[parseFloat(parts[0])||0,parseFloat(parts[1])||0]:null;
|
|
55
|
+
}catch(e){return null}
|
|
56
|
+
}
|
|
57
|
+
// Called while the outgoing entry is still the current one, so the position
|
|
58
|
+
// read here belongs to the token being written.
|
|
59
|
+
function rememberScroll(){
|
|
60
|
+
if(!restoreScroll)return;
|
|
61
|
+
try{window.sessionStorage.setItem(SCROLL_STORE+scrollToken,(window.pageXOffset||window.scrollX||0)+','+(window.pageYOffset||window.scrollY||0))}catch(e){}
|
|
62
|
+
}
|
|
63
|
+
// One place decides where a swap leaves the viewport, so the fragment path
|
|
64
|
+
// and the whole-document path cannot drift apart.
|
|
65
|
+
function applyScroll(hash){
|
|
66
|
+
if(pendingScroll){
|
|
67
|
+
var at=pendingScroll;
|
|
68
|
+
pendingScroll=null;
|
|
69
|
+
window.scrollTo({left:at[0],top:at[1],behavior:'instant'});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if(o.scrollToTop&&!hash){window.scrollTo({top:0,behavior:'instant'});return}
|
|
73
|
+
if(hash){var el=qs(hash);if(el)el.scrollIntoView({behavior:'smooth'})}
|
|
74
|
+
}
|
|
75
|
+
// Keeps whatever another script put in the entry; only adds the token.
|
|
76
|
+
function stampScrollToken(){
|
|
77
|
+
var state={};
|
|
78
|
+
var current=history.state;
|
|
79
|
+
if(current&&typeof current==='object')for(var key in current)state[key]=current[key];
|
|
80
|
+
state[SCROLL_TOKEN]=scrollToken;
|
|
81
|
+
try{history.replaceState(state,'',location.href)}catch(e){}
|
|
82
|
+
}
|
|
83
|
+
if(restoreScroll){
|
|
84
|
+
try{history.scrollRestoration='manual'}catch(e){}
|
|
85
|
+
// A token already in the entry means this document is a reload or a
|
|
86
|
+
// restore of an entry visited before, so its position is worth asking for.
|
|
87
|
+
var known=history.state&&history.state[SCROLL_TOKEN];
|
|
88
|
+
if(known){
|
|
89
|
+
var saved=readScroll(scrollToken);
|
|
90
|
+
if(saved&&(saved[0]||saved[1])){
|
|
91
|
+
var restoreAt=function(){window.scrollTo({left:saved[0],top:saved[1],behavior:'instant'})};
|
|
92
|
+
if(document.readyState==='complete')restoreAt();
|
|
93
|
+
else window.addEventListener('load',restoreAt,{once:true});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else{
|
|
97
|
+
stampScrollToken();
|
|
98
|
+
}
|
|
99
|
+
// A reload or a link out of the app never calls writeHistory, so this is
|
|
100
|
+
// the only chance to record where the page was left. pagehide fires for
|
|
101
|
+
// both, and unlike beforeunload it does not keep the page out of the
|
|
102
|
+
// back/forward cache.
|
|
103
|
+
window.addEventListener('pagehide',rememberScroll);
|
|
104
|
+
}
|
|
105
|
+
|
|
28
106
|
// Replace, never merge: absent payloads must forget the outgoing page's data.
|
|
29
107
|
// Run at the committed swap, not during prefetch or a superseded navigation.
|
|
30
108
|
function hydrateServerData(html){
|
|
@@ -615,9 +693,14 @@ import{rw as v$,sw as G}from"./chunk-5g6rprcy.js";function y($){return $.split(/
|
|
|
615
693
|
// through swap() to each of the three history sites would have been the
|
|
616
694
|
// alternative (#1807).
|
|
617
695
|
function writeHistory(mode,href){
|
|
618
|
-
|
|
619
|
-
|
|
696
|
+
// The position belongs to the entry being left, and scrollToken still
|
|
697
|
+
// names it here.
|
|
698
|
+
rememberScroll();
|
|
699
|
+
if(mode==='replace'){history.replaceState(tokenState(),'',href);return}
|
|
700
|
+
scrollToken=newScrollToken();
|
|
701
|
+
history.pushState(tokenState(),'',href);
|
|
620
702
|
}
|
|
703
|
+
function tokenState(){var state={};state[SCROLL_TOKEN]=scrollToken;return state}
|
|
621
704
|
|
|
622
705
|
// Second arg accepts the legacy pushState boolean OR an options object
|
|
623
706
|
// { replace }. Callers inside this file still pass the boolean.
|
|
@@ -1072,8 +1155,7 @@ else {
|
|
|
1072
1155
|
qsa('script[data-stx-page]').forEach(function(s){s.remove()});
|
|
1073
1156
|
if(pushState!==false)writeHistory(pushState,url+(hash||''));
|
|
1074
1157
|
refreshCurrentLinks();
|
|
1075
|
-
|
|
1076
|
-
else if(hash){var el=qs(hash);if(el)el.scrollIntoView({behavior:'smooth'})}
|
|
1158
|
+
applyScroll(hash);
|
|
1077
1159
|
window.dispatchEvent(new CustomEvent('stx:navigate',{detail:{url:url}}));
|
|
1078
1160
|
// Before page scripts run, so a page that focuses its own control on
|
|
1079
1161
|
// mount still wins \u2014 its script executes after this.
|
|
@@ -1531,8 +1613,7 @@ else {
|
|
|
1531
1613
|
refreshCurrentLinks();
|
|
1532
1614
|
|
|
1533
1615
|
// Scroll
|
|
1534
|
-
|
|
1535
|
-
else if(hash){var el=qs(hash);if(el)el.scrollIntoView({behavior:'smooth'})}
|
|
1616
|
+
applyScroll(hash);
|
|
1536
1617
|
|
|
1537
1618
|
// Update title
|
|
1538
1619
|
var newTitle=doc.querySelector('title');
|
|
@@ -1898,6 +1979,16 @@ else {
|
|
|
1898
1979
|
|
|
1899
1980
|
// \u2500\u2500 Back/forward \u2500\u2500
|
|
1900
1981
|
window.addEventListener('popstate',function(){
|
|
1982
|
+
// Nothing has scrolled yet (restoration is manual), so the viewport still
|
|
1983
|
+
// shows the entry being left: save it under its own token before adopting
|
|
1984
|
+
// the popped entry's, and hand the swap the position to land on.
|
|
1985
|
+
rememberScroll();
|
|
1986
|
+
if(restoreScroll){
|
|
1987
|
+
var popped=history.state&&history.state[SCROLL_TOKEN];
|
|
1988
|
+
scrollToken=popped||newScrollToken();
|
|
1989
|
+
if(!popped)stampScrollToken();
|
|
1990
|
+
pendingScroll=readScroll(scrollToken);
|
|
1991
|
+
}
|
|
1901
1992
|
navigate(location.pathname+location.search+location.hash,false);
|
|
1902
1993
|
});
|
|
1903
1994
|
|