@noego/forge 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +441 -383
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +16 -2
- package/dist/client.mjs +261 -244
- package/dist/client.mjs.map +1 -1
- package/dist/page.svelte-Bq1Q01H0.js.map +1 -1
- package/dist/page.svelte-Dvj7306U.cjs.map +1 -1
- package/dist-ssr/{path-9twSsimy.js → path-BqcF5dbs.js} +3 -2
- package/dist-ssr/{path-9twSsimy.js.map → path-BqcF5dbs.js.map} +1 -1
- package/dist-ssr/{path-Dm_4PXDW.cjs → path-sxXxpB6R.cjs} +3 -2
- package/dist-ssr/{path-Dm_4PXDW.cjs.map → path-sxXxpB6R.cjs.map} +1 -1
- package/dist-ssr/server.cjs +24 -7
- package/dist-ssr/server.cjs.map +1 -1
- package/dist-ssr/server.js +24 -7
- package/dist-ssr/server.js.map +1 -1
- package/dist-ssr/shared.cjs +1 -1
- package/dist-ssr/shared.js +1 -1
- package/package.json +1 -1
- package/schema.json +16 -6
- package/src/components/RecursiveRender.svelte +55 -14
package/dist/client.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./page.svelte-Dvj7306U.cjs"),K=require("svelte/internal/client"),Q=require("svelte"),X=require("../src/components/RecursiveRender.svelte");function Z(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const e=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(a,o,e.get?e:{enumerable:!0,get:()=>t[o]})}}return a.default=t,Object.freeze(a)}const z=Z(K);function tt(t){const a=new m.path_to_regex(t);return o=>a.match(o)||null}function et(t){return t.map(a=>{const o=a.path,e=tt(o);return{pattern:o,parser:e}})}function A(){return A=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var e in o)({}).hasOwnProperty.call(o,e)&&(t[e]=o[e])}return t},A.apply(null,arguments)}var S;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(S||(S={}));var H=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function nt(t,a){{typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}var F="beforeunload",ot="popstate";function at(t){t===void 0&&(t={});var a=t,o=a.window,e=o===void 0?document.defaultView:o,i=e.history;function s(){var f=e.location,h=f.pathname,v=f.search,P=f.hash,b=i.state||{};return[b.idx,H({pathname:h,search:v,hash:P,state:b.usr||null,key:b.key||"default"})]}var c=null;function r(){if(c)d.call(c),c=null;else{var f=S.Pop,h=s(),v=h[0],P=h[1];if(d.length)if(v!=null){var b=u-v;b&&(c={action:f,location:P,retry:function(){R(b*-1)}},R(b))}else process.env.NODE_ENV!=="production"&&nt(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else _(f)}}e.addEventListener(ot,r);var n=S.Pop,l=s(),u=l[0],w=l[1],p=W(),d=W();u==null&&(u=0,i.replaceState(A({},i.state,{idx:u}),""));function y(f){return typeof f=="string"?f:it(f)}function L(f,h){return h===void 0&&(h=null),H(A({pathname:w.pathname,hash:"",search:""},typeof f=="string"?st(f):f,{state:h,key:rt()}))}function j(f,h){return[{usr:f.state,key:f.key,idx:h},y(f)]}function q(f,h,v){return!d.length||(d.call({action:f,location:h,retry:v}),!1)}function _(f){n=f;var h=s();u=h[0],w=h[1],p.call({action:n,location:w})}function C(f,h){var v=S.Push,P=L(f,h);function b(){C(f,h)}if(q(v,P,b)){var E=j(P,u+1),$=E[0],U=E[1];try{i.pushState($,"",U)}catch{e.location.assign(U)}_(v)}}function D(f,h){var v=S.Replace,P=L(f,h);function b(){D(f,h)}if(q(v,P,b)){var E=j(P,u),$=E[0],U=E[1];i.replaceState($,"",U),_(v)}}function R(f){i.go(f)}var J={get action(){return n},get location(){return w},createHref:y,push:C,replace:D,go:R,back:function(){R(-1)},forward:function(){R(1)},listen:function(h){return p.push(h)},block:function(h){var v=d.push(h);return d.length===1&&e.addEventListener(F,I),function(){v(),d.length||e.removeEventListener(F,I)}}};return J}function I(t){t.preventDefault(),t.returnValue=""}function W(){var t=[];return{get length(){return t.length},push:function(o){return t.push(o),function(){t=t.filter(function(e){return e!==o})}},call:function(o){t.forEach(function(e){return e&&e(o)})}}}function rt(){return Math.random().toString(36).substr(2,8)}function it(t){var a=t.pathname,o=a===void 0?"/":a,e=t.search,i=e===void 0?"":e,s=t.hash,c=s===void 0?"":s;return i&&i!=="?"&&(o+=i.charAt(0)==="?"?i:"?"+i),c&&c!=="#"&&(o+=c.charAt(0)==="#"?c:"#"+c),o}function st(t){var a={};if(t){var o=t.indexOf("#");o>=0&&(a.hash=t.substr(o),t=t.substr(0,o));var e=t.indexOf("?");e>=0&&(a.search=t.substr(e),t=t.substr(0,e)),t&&(a.pathname=t)}return a}const ct=at(),g=z.proxy({layouts:[],view:null,data:null,params:null,urlParams:null,query:null,page:m.page});function T(...t){let a=t.map((o,e)=>e===0?o.replace(/\/+$/,""):o.replace(/^\/+|\/+$/g,"")).join("/");return a.startsWith("/")||(a="/"+a),a.split("?")[0]}async function B(t,a,o,e,i,s){try{const c=(o.layout||[]).map(u=>T(a,u).toString());let r=T(a,o.view).toString();console.log({layouts_paths:c,view_path:r});const n=await Promise.all(c.map(u=>import(u).then(w=>w.default)));r.startsWith("/")||(r="/"+r);const l=await import(r).then(u=>u.default);g.layouts=n,g.view=l,g.params=e,g.data=window.__INITIAL_DATA__,g.urlParams=i,g.query=s,Q.hydrate(X,{target:t,props:g})}catch(c){console.log("Client-side route loading failed - falling back to SSR navigation"),console.error("Route loading error:",c);const r=window.location.pathname||"/";window.location.href=r}}async function k(t,a,o,e,i,s,c=!1,r=!0){try{const n=(o.layout||[]).map(p=>T(a,p).toString()),l=T(a,o.view).toString(),u=await Promise.all(n.map(p=>import(p).then(d=>d.default))),w=await import(l).then(p=>p.default);if(c){const p={method:o.method,headers:{"Content-Type":"application/json",Accept:"application/json"}};p[Y]=!0,await fetch(t,p).then(d=>{if(d.ok)return d.json();throw new Error("Network response was not ok")}).then(d=>{console.log("Server data",d),g.data=d,g.params=e,g.layouts=u,g.view=w,g.urlParams=i,g.query=s})}else g.data={layout:[],view:{}},g.params=e,g.layouts=u,g.view=w,g.urlParams=i,g.query=s;window&&window.scroll(0,0),r&&ct.push(t)}catch(n){console.log("Client-side navigation failed for URL:",t,"- falling back to SSR navigation"),console.error("Navigation error:",n),window.location.href=t}}const O=z.proxy({});async function V(){Object.assign(O,window.__MANIFEST__)}function G(t,a,o){if(!document){console.error("Document not found");return}document.addEventListener("click",e=>{var c,r;const i=window.location.pathname,s=((c=e.target)==null?void 0:c.tagName)==="A"?e.target:(r=e.target)==null?void 0:r.closest("A");if(s){let n=s.getAttribute("href");if(i===n){e.preventDefault();return}if(n&&n.startsWith("/")||n.startsWith(".")){const l=n.split("?")[0],u=s.getAttribute("method")||"get",w=a.find(p=>p.method.toLowerCase()===u&&o.find(d=>d.parser(l)&&d.pattern===p.path));if(w){e.preventDefault();const p=o.find(_=>_.parser(l)&&_.pattern===w.path),d=(p==null?void 0:p.parser(l))||{},y=new URLSearchParams(n.split("?")[1]||""),L=Object.fromEntries(y.entries())||{},j={...d,...L},q=O[p==null?void 0:p.pattern];k(n,t,w,j,d,L,q)}else console.log("No matching route found for URL:",n,"- using fallback navigation")}}}),window.addEventListener("popstate",e=>{const i=window.location.pathname,s=window.location.pathname+window.location.search;m.page.url=s,m.page.pathname=window.location.pathname;const c="get",r=a.find(n=>n.method.toLowerCase()===c&&o.find(l=>l.parser(i)&&l.pattern===n.path));if(r){const n=o.find(y=>y.parser(i)&&y.pattern===r.path),l=(n==null?void 0:n.parser(i))||{},u=new URLSearchParams(window.location.search),w=Object.fromEntries(u.entries())||{};m.page.params=l,m.page.query=w;const p={...l,...w},d=O[n==null?void 0:n.pattern];k(s,t,r,p,l,w,d,!1)}else console.log("No matching route found for popstate navigation to:",i,"- using fallback navigation"),window.location.href=i}),function(){const e=history.pushState,i=history.replaceState;history.pushState=function(...s){const c=e.apply(this,s),r=new Event("pushstate");return r.state=s[0],r.url=s[2],window.dispatchEvent(r),c},history.replaceState=function(...s){const c=i.apply(this,s),r=s[2],n=window.location.pathname;if((r?new URL(r,window.location.origin).pathname:n)!==n){const u=new Event("replacestate");u.state=s[0],u.url=s[2],window.dispatchEvent(u)}return c}}(),window.addEventListener("pushstate",e=>{const i=e.url||window.location.pathname+window.location.search,s=i.split("?")[0],c="get",r=a.find(n=>n.method.toLowerCase()===c&&o.find(l=>l.parser(s)&&l.pattern===n.path));if(r){const n=o.find(y=>y.parser(s)&&y.pattern===r.path),l=n==null?void 0:n.parser(s),u=new URLSearchParams(i.split("?")[1]||""),w=Object.fromEntries(u.entries());m.page.url=i,m.page.pathname=window.location.pathname,Object.assign(m.page.params,l),Object.assign(m.page.query,w);const p={...l,...w},d=O[n==null?void 0:n.pattern];k(i,t,r,p,l,w,d,!1)}else console.log("No matching route found for pushstate to:",s,"- using fallback navigation"),window.location.href=s}),window.addEventListener("replacestate",e=>{const i=e.url||window.location.pathname+window.location.search,s=i.split("?")[0];m.page.url=i,m.page.pathname=window.location.pathname,m.page.query=Object.fromEntries(new URLSearchParams(i.split("?")[1]||""));const c="get",r=a.find(n=>n.method.toLowerCase()===c&&o.find(l=>l.parser(s)&&l.pattern===n.path));if(r){const n=o.find(y=>y.parser(s)&&y.pattern===r.path),l=(n==null?void 0:n.parser(s))||{},u=new URLSearchParams(i.split("?")[1]||""),w=Object.fromEntries(u.entries())||{},p={...l,...w},d=O[n==null?void 0:n.pattern];k(i,t,r,p,l,w,d,!1)}else console.log("No matching route found for replacestate to:",s,"- using fallback navigation"),window.location.href=s})}const Y=Symbol("forge-load-function");let N=[],x=null;function lt(t){try{const a=new URL(t,window.location.origin);return a.origin===window.location.origin&&!a.pathname.startsWith("/api/")}catch{return!t.startsWith("/api/")}}function ut(){typeof window<"u"&&!x&&(x=window.fetch,window.fetch=async function(t,a={}){console.log("🔵 Enhanced fetch called for:",t),console.log("🔵 Initial headers:",a.headers);const o=new Headers(a.headers),e=Object.fromEntries(o.entries());console.log("🟡 Headers before middleware:",e);for(const r of N)r.length===2?await new Promise((n,l)=>{try{r(e,u=>{u?l(u):n()})}catch(u){l(u)}}):await r(e);console.log("🟢 Headers after middleware:",e);const i=new Headers;Object.entries(e).forEach(([r,n])=>{n!==void 0&&i.set(r,n)});const s={...a,headers:i};console.log("🔴 Final requestInit:",s),console.log("🔴 Headers entries:",Array.from(i.entries()));const c=await x(t,s);if(c.status>=300&&c.status<400&&a[Y]){const r=c.headers.get("location");if(r&<(r))return window.location.href=r,c}return c})}ut();const ft={configUpdate(t){if(typeof t!="function")throw new Error("Middleware must be a function");N.push(t)},reset(){N.length=0},getMiddlewareCount(){return N.length}};let M;async function pt(t,a){let o=a.component_dir;if(!o&&typeof o!="string")throw new Error("No component directory provided");let e=window.__ROUTING__;if(M=et(e),window&&window.location){const i=(window.location.pathname||"/").split("?")[0];console.log(`Current pathname: ${i}`);const s=M.find(r=>r.parser(i));let c=s?e.find(r=>r.path===s.pattern):null;if(s&&c){console.log("Found route:",c);const r=s.parser(i)||{},n=new URLSearchParams(window.location.search),l=Object.fromEntries(n.entries())||{},u={...r,...l};V(),B(t,o,c,u,r,l),G(o,e,M)}else{console.log("No matching route found, using fallback navigation"),window.location.href=i;return}}}exports.page=m.page;exports.shadowUrl=m.shadowUrl;exports.MANIFEST_STORE=O;exports.bootstrap_events=G;exports.createApp=pt;exports.fetch=ft;exports.loadRoute=B;exports.updateManifestStore=V;exports.updateRoute=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./page.svelte-Dvj7306U.cjs"),K=require("svelte/internal/client"),Q=require("svelte"),X=require("../src/components/RecursiveRender.svelte");function Z(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const H=Z(K);function tt(t){const r=new v.path_to_regex(t);return n=>r.match(n)||null}function et(t){return t.map(r=>{const n=r.path,o=tt(n);return{pattern:n,parser:o}})}function $(){return $=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},$.apply(null,arguments)}var S;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(S||(S={}));var W=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function nt(t,r){{typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}var I="beforeunload",ot="popstate";function rt(t){t===void 0&&(t={});var r=t,n=r.window,o=n===void 0?document.defaultView:n,i=o.history;function a(){var d=o.location,g=d.pathname,y=d.search,P=d.hash,b=i.state||{};return[b.idx,W({pathname:g,search:y,hash:P,state:b.usr||null,key:b.key||"default"})]}var l=null;function s(){if(l)w.call(l),l=null;else{var d=S.Pop,g=a(),y=g[0],P=g[1];if(w.length)if(y!=null){var b=u-y;b&&(l={action:d,location:P,retry:function(){R(b*-1)}},R(b))}else process.env.NODE_ENV!=="production"&&nt(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else O(d)}}o.addEventListener(ot,s);var e=S.Pop,c=a(),u=c[0],p=c[1],f=F(),w=F();u==null&&(u=0,i.replaceState($({},i.state,{idx:u}),""));function h(d){return typeof d=="string"?d:it(d)}function j(d,g){return g===void 0&&(g=null),W($({pathname:p.pathname,hash:"",search:""},typeof d=="string"?st(d):d,{state:g,key:at()}))}function k(d,g){return[{usr:d.state,key:d.key,idx:g},h(d)]}function q(d,g,y){return!w.length||(w.call({action:d,location:g,retry:y}),!1)}function O(d){e=d;var g=a();u=g[0],p=g[1],f.call({action:e,location:p})}function x(d,g){var y=S.Push,P=j(d,g);function b(){x(d,g)}if(q(y,P,b)){var E=k(P,u+1),T=E[0],U=E[1];try{i.pushState(T,"",U)}catch{o.location.assign(U)}O(y)}}function D(d,g){var y=S.Replace,P=j(d,g);function b(){D(d,g)}if(q(y,P,b)){var E=k(P,u),T=E[0],U=E[1];i.replaceState(T,"",U),O(y)}}function R(d){i.go(d)}var J={get action(){return e},get location(){return p},createHref:h,push:x,replace:D,go:R,back:function(){R(-1)},forward:function(){R(1)},listen:function(g){return f.push(g)},block:function(g){var y=w.push(g);return w.length===1&&o.addEventListener(I,z),function(){y(),w.length||o.removeEventListener(I,z)}}};return J}function z(t){t.preventDefault(),t.returnValue=""}function F(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(o){return o!==n})}},call:function(n){t.forEach(function(o){return o&&o(n)})}}}function at(){return Math.random().toString(36).substr(2,8)}function it(t){var r=t.pathname,n=r===void 0?"/":r,o=t.search,i=o===void 0?"":o,a=t.hash,l=a===void 0?"":a;return i&&i!=="?"&&(n+=i.charAt(0)==="?"?i:"?"+i),l&&l!=="#"&&(n+=l.charAt(0)==="#"?l:"#"+l),n}function st(t){var r={};if(t){var n=t.indexOf("#");n>=0&&(r.hash=t.substr(n),t=t.substr(0,n));var o=t.indexOf("?");o>=0&&(r.search=t.substr(o),t=t.substr(0,o)),t&&(r.pathname=t)}return r}const ct=rt(),m=H.proxy({layouts:[],view:null,data:null,params:null,urlParams:null,query:null,page:v.page});function A(...t){let r=t.map((n,o)=>o===0?n.replace(/\/+$/,""):n.replace(/^\/+|\/+$/g,"")).join("/");return r.startsWith("/")||(r="/"+r),r.split("?")[0]}async function B(t,r,n,o,i,a){try{const l=typeof r=="string"&&r.indexOf("dist/client")!==-1,s=(n.layout||[]).map(p=>{let f=A(r,p).toString();return l&&(f=f.endsWith(".svelte")?f.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(f)?f:f+".js"),f});let e=A(r,n.view).toString();l&&(e=e.endsWith(".svelte")?e.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(e)?e:e+".js"),console.log({layouts_paths:s,view_path:e});const c=await Promise.all(s.map(p=>import(p).then(f=>f.default)));e.startsWith("/")||(e="/"+e);const u=await import(e).then(p=>p.default);m.layouts=c,m.view=u,m.params=o,m.data=window.__INITIAL_DATA__,m.urlParams=i,m.query=a,Q.hydrate(X,{target:t,props:m})}catch(l){console.log("Client-side route loading failed - falling back to SSR navigation"),console.error("Route loading error:",l);const s=window.location.pathname||"/";window.location.href=s}}async function L(t,r,n,o,i,a,l=!1,s=!0){try{const e=typeof r=="string"&&r.indexOf("dist/client")!==-1,c=(n.layout||[]).map(w=>{let h=A(r,w).toString();return e&&(h=h.endsWith(".svelte")?h.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(h)?h:h+".js"),h});let u=A(r,n.view).toString();e&&(u=u.endsWith(".svelte")?u.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(u)?u:u+".js");const p=await Promise.all(c.map(w=>import(w).then(h=>h.default))),f=await import(u).then(w=>w.default);if(l){const w={method:n.method,headers:{"Content-Type":"application/json",Accept:"application/json"}};w[Y]=!0,await fetch(t,w).then(h=>{if(h.ok)return h.json();throw new Error("Network response was not ok")}).then(h=>{console.log("Server data",h),m.data=h,m.params=o,m.layouts=p,m.view=f,m.urlParams=i,m.query=a})}else m.data={layout:[],view:{}},m.params=o,m.layouts=p,m.view=f,m.urlParams=i,m.query=a;window&&window.scroll(0,0),s&&ct.push(t)}catch(e){console.log("Client-side navigation failed for URL:",t,"- falling back to SSR navigation"),console.error("Navigation error:",e)}}const _=H.proxy({});async function V(){Object.assign(_,window.__MANIFEST__)}function G(t,r,n){if(!document){console.error("Document not found");return}document.addEventListener("click",o=>{var l,s;const i=window.location.pathname,a=((l=o.target)==null?void 0:l.tagName)==="A"?o.target:(s=o.target)==null?void 0:s.closest("A");if(a){let e=a.getAttribute("href");if(i===e){o.preventDefault();return}if(e&&e.startsWith("/")||e.startsWith(".")){const c=e.split("?")[0],u=a.getAttribute("method")||"get",p=r.find(f=>f.method.toLowerCase()===u&&n.find(w=>w.parser(c)&&w.pattern===f.path));if(p){o.preventDefault();const f=n.find(O=>O.parser(c)&&O.pattern===p.path),w=(f==null?void 0:f.parser(c))||{},h=new URLSearchParams(e.split("?")[1]||""),j=Object.fromEntries(h.entries())||{},k={...w,...j},q=_[f==null?void 0:f.pattern];L(e,t,p,k,w,j,q)}else console.log("No matching route found for URL:",e,"- using fallback navigation")}}}),window.addEventListener("popstate",o=>{const i=window.location.pathname,a=window.location.pathname+window.location.search;v.page.url=a,v.page.pathname=window.location.pathname;const l="get",s=r.find(e=>e.method.toLowerCase()===l&&n.find(c=>c.parser(i)&&c.pattern===e.path));if(s){const e=n.find(h=>h.parser(i)&&h.pattern===s.path),c=(e==null?void 0:e.parser(i))||{},u=new URLSearchParams(window.location.search),p=Object.fromEntries(u.entries())||{};v.page.params=c,v.page.query=p;const f={...c,...p},w=_[e==null?void 0:e.pattern];L(a,t,s,f,c,p,w,!1)}else console.log("No matching route found for popstate navigation to:",i,"- using fallback navigation"),window.location.href=i}),function(){const o=history.pushState,i=history.replaceState;history.pushState=function(...a){const l=o.apply(this,a),s=new Event("pushstate");return s.state=a[0],s.url=a[2],window.dispatchEvent(s),l},history.replaceState=function(...a){const l=i.apply(this,a),s=a[2],e=window.location.pathname;if((s?new URL(s,window.location.origin).pathname:e)!==e){const u=new Event("replacestate");u.state=a[0],u.url=a[2],window.dispatchEvent(u)}return l}}(),window.addEventListener("pushstate",o=>{const i=o.url||window.location.pathname+window.location.search,a=i.split("?")[0],l="get",s=r.find(e=>e.method.toLowerCase()===l&&n.find(c=>c.parser(a)&&c.pattern===e.path));if(s){const e=n.find(h=>h.parser(a)&&h.pattern===s.path),c=e==null?void 0:e.parser(a),u=new URLSearchParams(i.split("?")[1]||""),p=Object.fromEntries(u.entries());v.page.url=i,v.page.pathname=window.location.pathname,Object.assign(v.page.params,c),Object.assign(v.page.query,p);const f={...c,...p},w=_[e==null?void 0:e.pattern];L(i,t,s,f,c,p,w,!1)}else console.log("No matching route found for pushstate to:",a,"- using fallback navigation"),window.location.href=a}),window.addEventListener("replacestate",o=>{const i=o.url||window.location.pathname+window.location.search,a=i.split("?")[0];v.page.url=i,v.page.pathname=window.location.pathname,v.page.query=Object.fromEntries(new URLSearchParams(i.split("?")[1]||""));const l="get",s=r.find(e=>e.method.toLowerCase()===l&&n.find(c=>c.parser(a)&&c.pattern===e.path));if(s){const e=n.find(h=>h.parser(a)&&h.pattern===s.path),c=(e==null?void 0:e.parser(a))||{},u=new URLSearchParams(i.split("?")[1]||""),p=Object.fromEntries(u.entries())||{},f={...c,...p},w=_[e==null?void 0:e.pattern];L(i,t,s,f,c,p,w,!1)}else console.log("No matching route found for replacestate to:",a,"- using fallback navigation"),window.location.href=a})}const Y=Symbol("forge-load-function");let N=[],C=null;function lt(t){try{const r=new URL(t,window.location.origin);return r.origin===window.location.origin&&!r.pathname.startsWith("/api/")}catch{return!t.startsWith("/api/")}}function ut(){typeof window<"u"&&!C&&(C=window.fetch,window.fetch=async function(t,r={}){console.log("🔵 Enhanced fetch called for:",t),console.log("🔵 Initial init:",r);let n={...r};for(const i of N)try{if(i.length===2){const a=new Headers(n.headers),l=Object.fromEntries(a.entries());console.log("🟡 Running callback-style middleware (length=2)"),await new Promise((s,e)=>{try{i(l,c=>{if(c)e(c);else{const u=new Headers;Object.entries(l).forEach(([p,f])=>{f!==void 0&&u.set(p,f)}),n.headers=u,s()}})}catch(c){e(c)}})}else{console.log("🟡 Running new-style RequestInit middleware (length="+i.length+")");const a=await i(n,t);a&&typeof a=="object"?(console.log("🟢 Middleware returned RequestInit:",a),n=a):console.log("🟢 Middleware returned:",a)}}catch(a){throw console.error("🔴 Middleware error:",a),a}console.log("🟢 Final init after middleware:",n);const o=await C(t,n);if(o.status>=300&&o.status<400&&r[Y]){const i=o.headers.get("location");if(i&<(i))return window.location.href=i,o}return o})}ut();const ft={configUpdate(t){if(typeof t!="function")throw new Error("Middleware must be a function");N.push(t)},reset(){N.length=0},getMiddlewareCount(){return N.length}};let M;async function dt(t,r){let n=r.component_dir;if(!n&&typeof n!="string")throw new Error("No component directory provided");let o=window.__ROUTING__;if(M=et(o),window&&window.location){const i=(window.location.pathname||"/").split("?")[0];console.log(`Current pathname: ${i}`);const a=M.find(s=>s.parser(i));let l=a?o.find(s=>s.path===a.pattern):null;if(a&&l){console.log("Found route:",l);const s=a.parser(i)||{},e=new URLSearchParams(window.location.search),c=Object.fromEntries(e.entries())||{},u={...s,...c};V(),B(t,n,l,u,s,c),G(n,o,M)}else{console.log("No matching route found, using fallback navigation"),window.location.href=i;return}}}exports.page=v.page;exports.shadowUrl=v.shadowUrl;exports.MANIFEST_STORE=_;exports.bootstrap_events=G;exports.createApp=dt;exports.fetch=ft;exports.loadRoute=B;exports.updateManifestStore=V;exports.updateRoute=L;
|
|
2
2
|
//# sourceMappingURL=client.cjs.map
|
package/dist/client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.cjs","sources":["../src/routing/url_parser.ts","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/history/index.js","../src/client/navigation.svelte.ts","../src/routing/manifest/store.svelte.ts","../src/client/events.ts","../src/client/client.ts"],"sourcesContent":["import pathToRegex from 'path-to-regex';\nimport type { IRoute } from '../parser/IRoute';\n\n\n\nexport function makeUrlParser(pattern: string) {\n const parser = new pathToRegex(pattern);\n return (pathname: string) => {\n const result = parser.match(pathname);\n return result || null;\n };\n}\n\n\nexport type UrlMatcher = {\n pattern: string,\n parser: ReturnType<typeof makeUrlParser>\n}\n\nexport function findRoute(pathname:string, routes: UrlMatcher[]) {\n for (const { pattern, parser } of routes) {\n const params = parser(pathname);\n if (params) {\n return { pattern, params };\n }\n }\n return null;\n}\n\n\n\n\n\nexport function initialize_route_matchers(routes: IRoute[]): UrlMatcher[] {\n return routes.map((route: IRoute) => {\n const pattern = route.path;\n const parser = makeUrlParser(pattern);\n return { pattern, parser };\n })\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","\nimport type { IRoute } from '../parser/IRoute'\nimport { hydrate } from 'svelte'\nimport RecursiveLoader from '../components/RecursiveRender.svelte'\nimport { createBrowserHistory } from 'history';\nimport { FORGE_LOAD_SYMBOL } from './client';\nimport {page} from \"./page.svelte\";\n\nconst history = createBrowserHistory()\n\nconst ROOT = $state({\n layouts: [] as any[],\n view: null,\n data: null as any,\n params: null,\n urlParams: null as any,\n query: null as any,\n page\n})\n\nfunction urlJoin(...parts) {\n let url = parts\n .map((part, i) => {\n if (i === 0) return part.replace(/\\/+$/, ''); // trim trailing slash\n return part.replace(/^\\/+|\\/+$/g, ''); // trim both for middle parts\n })\n .join('/');\n\n if (!url.startsWith('/')) {\n url = '/' + url; // add leading slash if not present\n }\n return url.split('?')[0]; // remove query string\n}\n\nexport async function loadRoute(node:any,base_path:string, route: IRoute, combinedParams: any, urlParams:any, query:any) {\n try {\n const layouts_paths = (route.layout || []).map(layout => {\n return urlJoin(base_path,layout).toString()\n })\n let view_path = urlJoin(base_path,route.view).toString()\n\n console.log({layouts_paths,view_path})\n\n const layouts = await Promise.all(layouts_paths.map((layout) => {\n return import(/* @vite-ignore */ layout).then(layout => {\n return layout.default\n })\n }))\n\n if (!view_path.startsWith('/')){\n view_path = '/'+view_path\n }\n const view = await import(/* @vite-ignore */ view_path).then(view => {\n return view.default\n })\n\n ROOT.layouts = layouts\n ROOT.view = view\n ROOT.params = combinedParams\n ROOT.data = (window as any).__INITIAL_DATA__\n ROOT.urlParams = urlParams\n ROOT.query = query\n\n hydrate(RecursiveLoader, {\n target: node,\n props: ROOT,\n })\n } catch (error) {\n console.log('Client-side route loading failed - falling back to SSR navigation');\n console.error('Route loading error:', error);\n // Fallback: Use SSR rendering by triggering a full page load\n const currentUrl = window.location.pathname || '/';\n window.location.href = currentUrl;\n }\n}\n\n\n\nexport async function updateRoute(url:string,base_path:string, route: IRoute, params: any,urlParams:any,query:any,server_loading:boolean = false,update = true) {\n try {\n const layouts_paths = (route.layout || []).map(layout => {\n return urlJoin(base_path,layout).toString()\n })\n const view_path = urlJoin(base_path,route.view).toString()\n const layouts = await Promise.all(layouts_paths.map((layout) => {\n return import(/* @vite-ignore */ layout).then(layout => {\n return layout.default\n })\n }))\n const view = await import(/* @vite-ignore */ view_path).then(view => {\n return view.default\n })\n\n if (server_loading) {\n const fetchOptions: any = {\n method: route.method,\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n }\n };\n fetchOptions[FORGE_LOAD_SYMBOL] = true;\n \n await fetch(url, fetchOptions).then((response) => {\n if (response.ok) {\n return response.json()\n } else {\n throw new Error('Network response was not ok')\n }\n }).then((data)=>{\n \n console.log('Server data',data)\n // The server returns structured data: { layout: [...], view: {...} }\n // We need to pass this structure to RecursiveRender correctly\n ROOT.data = data\n ROOT.params = params\n ROOT.layouts = layouts\n ROOT.view = view\n ROOT.urlParams = urlParams\n ROOT.query = query\n })\n }else{\n ROOT.data = {layout:[],view:{}}\n ROOT.params = params\n ROOT.layouts = layouts\n ROOT.view = view\n ROOT.urlParams = urlParams\n ROOT.query = query\n }\n if(window){\n window.scroll(0,0)\n }\n\n if(update){\n history.push(url)\n }\n } catch (error) {\n console.log('Client-side navigation failed for URL:', url, '- falling back to SSR navigation');\n console.error('Navigation error:', error);\n // Fallback: Use SSR rendering by triggering a full page load\n window.location.href = url;\n }\n}\n","\n\n\nexport const MANIFEST_STORE = $state({})\n\n\n\nexport async function updateManifestStore() {\n Object.assign(MANIFEST_STORE, window['__MANIFEST__'])\n // await fetch('/manifest.json')\n // .then(async (response) => {\n // if (response.ok) {\n // const manifest = await response.json();\n // console.log(manifest)\n // Object.assign(MANIFEST_STORE, manifest);\n // }\n // })\n}","\n\nimport type {IRoute} from \"../parser/IRoute\";\nimport type { UrlMatcher } from \"../routing/url_parser\";\nimport { updateRoute } from \"./navigation.svelte\";\nimport { MANIFEST_STORE } from \"../routing/manifest/store.svelte\";\nimport {page} from './page.svelte'\n\n\n\n\nexport function bootstrap_events(base_path:string,routes:IRoute[], matchers: UrlMatcher[]) {\n if(!document){\n console.error('Document not found')\n return\n }\n\n document.addEventListener('click', (event:any) => {\n const currentUrl = window.location.pathname;\n const a = event.target?.tagName === 'A' ? event.target : event.target?.closest('A');\n \n if (a) {\n let url = a.getAttribute('href');\n if (currentUrl === url) {\n event.preventDefault();\n return;\n }\n if (url && url.startsWith('/') || url.startsWith('.')) {\n const pathname = url.split('?')[0];\n const method = a.getAttribute('method') || 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(pathname) && m.pattern === r.path));\n if (route) {\n event.preventDefault();\n const m = matchers.find(m => m.parser(pathname) && m.pattern === route.path);\n const params = m?.parser(pathname) || {};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(url.split('?')[1] || '');\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(url,base_path, route, combinedParams,params,queryParams,requires_server_data);\n } else {\n console.log('No matching route found for URL:', url, '- using fallback navigation');\n // Fallback: Don't prevent default, let browser handle the navigation\n // This will trigger a full page load that the server can handle\n }\n }\n }\n });\n\n\n window.addEventListener('popstate', (_) => {\n const path = window.location.pathname;\n const fullUrl = window.location.pathname + window.location.search;\n // update page data\n page.url = fullUrl\n page.pathname = window.location.pathname\n const method = 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(path) && m.pattern === r.path));\n if (route) {\n const m = matchers.find(m => m.parser(path) && m.pattern === route.path);\n const params = m?.parser(path) || {};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(window.location.search);\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n\n // Object.assign(page.params,params)\n page.params = params\n page.query = queryParams\n\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(fullUrl,base_path, route, combinedParams,params,queryParams,requires_server_data,false);\n } else {\n console.log('No matching route found for popstate navigation to:', path, '- using fallback navigation');\n // Fallback: Trigger full page reload for unknown routes\n window.location.href = path;\n }\n });\n\n\n // Run this once in your bootstrap code\n (function () {\n const originalPushState = history.pushState;\n const originalReplaceState = history.replaceState;\n\n history.pushState = function (...args) {\n const result = originalPushState.apply(this, args);\n const evt= new Event('pushstate')\n evt['state'] = args[0]\n evt['url'] = args[2]\n window.dispatchEvent(evt);\n return result;\n };\n\n\n history.replaceState = function (...args) {\n const result = originalReplaceState.apply(this, args);\n \n // Only trigger navigation if pathname actually changes\n const newUrl = args[2];\n const currentPathname = window.location.pathname;\n const newPathname = newUrl ? new URL(newUrl, window.location.origin).pathname : currentPathname;\n \n if (newPathname !== currentPathname) {\n const evt= new Event('replacestate')\n evt['state'] = args[0]\n evt['url'] = args[2]\n window.dispatchEvent(evt);\n }\n \n return result;\n }\n // Add a listener to the popstate event\n })();\n\n window.addEventListener('pushstate', (event) => {\n const fullPath = event['url'] || window.location.pathname + window.location.search;\n const path = fullPath.split('?')[0];\n const method = 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(path) && m.pattern === r.path));\n if (route) {\n const m = matchers.find(m => m.parser(path) && m.pattern === route.path);\n const params = m?.parser(path);\n\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(fullPath.split('?')[1] || '');\n const queryParams = Object.fromEntries(urlParams.entries());\n \n page.url = fullPath\n page.pathname = window.location.pathname\n Object.assign(page.params,params)\n Object.assign(page.query,queryParams)\n\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(fullPath,base_path, route, combinedParams,params,queryParams,requires_server_data,false);\n } else {\n console.log('No matching route found for pushstate to:', path, '- using fallback navigation');\n // Fallback: Use full page navigation for unknown routes\n window.location.href = path;\n }\n });\n\n window.addEventListener('replacestate', (event) => {\n const fullPath = event['url'] || window.location.pathname + window.location.search;\n const path = fullPath.split('?')[0];\n\n // update page data\n page.url = fullPath\n page.pathname = window.location.pathname\n page.query = Object.fromEntries(new URLSearchParams(fullPath.split('?')[1] || ''))\n\n const method = 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(path) && m.pattern === r.path));\n if (route) {\n const m = matchers.find(m => m.parser(path) && m.pattern === route.path);\n const params = m?.parser(path) || {};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(fullPath.split('?')[1] || '');\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(fullPath,base_path, route, combinedParams,params,queryParams,requires_server_data,false);\n } else {\n console.log('No matching route found for replacestate to:', path, '- using fallback navigation');\n // Fallback: Use full page navigation for unknown routes\n window.location.href = path;\n }\n });\n \n}\n","import { initialize_route_matchers } from '../routing/url_parser';\nimport { loadRoute } from './navigation.svelte';\nimport { bootstrap_events } from './events';\nimport { updateManifestStore } from '../routing/manifest/store.svelte';\nimport type { ServerOptions } from '../options/ServerOptions';\nimport type { FetchMiddleware, FetchMiddlewareAPI, HeadersObject, AsyncMiddleware, CallbackMiddleware } from '../types/FetchMiddleware';\n\n// Symbol for marking load function fetches\nexport const FORGE_LOAD_SYMBOL = Symbol('forge-load-function');\n\n// Middleware storage\nlet middlewares: Array<FetchMiddleware> = [];\nlet originalFetch: typeof window.fetch | null = null;\n\n// Helper to determine if a URL is an internal route\nfunction isInternalRoute(url: string): boolean {\n try {\n const urlObj = new URL(url, window.location.origin);\n return urlObj.origin === window.location.origin && !urlObj.pathname.startsWith('/api/');\n } catch {\n // Relative URL, assume internal\n return !url.startsWith('/api/');\n }\n}\n\n// Initialize fetch override immediately when module is imported\nfunction initializeFetch(): void {\n if (typeof window !== 'undefined' && !originalFetch) {\n originalFetch = window.fetch;\n \n window.fetch = async function(input: RequestInfo | URL, init: RequestInit = {}): Promise<Response> {\n console.log('🔵 Enhanced fetch called for:', input);\n console.log('🔵 Initial headers:', init.headers);\n \n // Convert headers to plain object for middleware\n const headers = new Headers(init.headers);\n const headersObject: HeadersObject = Object.fromEntries(headers.entries());\n \n console.log('🟡 Headers before middleware:', headersObject);\n \n // Run all configured middleware\n for (const middleware of middlewares) {\n if (middleware.length === 2) {\n // Callback style: (headers, next) => {}\n await new Promise<void>((resolve, reject) => {\n try {\n (middleware as CallbackMiddleware)(headersObject, (error) => {\n if (error) reject(error);\n else resolve();\n });\n } catch (error) {\n reject(error);\n }\n });\n } else {\n // Async style: async (headers) => {}\n await (middleware as AsyncMiddleware)(headersObject);\n }\n }\n \n console.log('🟢 Headers after middleware:', headersObject);\n \n // Convert plain object back to Headers for proper fetch API compatibility\n const finalHeaders = new Headers();\n Object.entries(headersObject).forEach(([key, value]) => {\n if (value !== undefined) {\n finalHeaders.set(key, value);\n }\n });\n \n const requestInit: RequestInit = {\n ...init,\n headers: finalHeaders\n };\n \n console.log('🔴 Final requestInit:', requestInit);\n console.log('🔴 Headers entries:', Array.from(finalHeaders.entries()));\n \n // Make the actual request\n const response = await originalFetch!(input, requestInit);\n \n // Handle frontend route redirects\n if (response.status >= 300 && response.status < 400 && (init as any)[FORGE_LOAD_SYMBOL]) {\n const location = response.headers.get('location');\n if (location && isInternalRoute(location)) {\n // For internal routes, let the browser handle the redirect\n window.location.href = location;\n return response;\n }\n }\n \n return response;\n };\n }\n}\n\n// Initialize fetch override immediately\ninitializeFetch();\n\n// Export fetch API with middleware configuration\nexport const fetch: FetchMiddlewareAPI & { getMiddlewareCount(): number } = {\n /**\n * Add middleware to the fetch pipeline\n */\n configUpdate(middleware: FetchMiddleware): void {\n if (typeof middleware !== 'function') {\n throw new Error('Middleware must be a function');\n }\n middlewares.push(middleware);\n },\n \n /**\n * Reset all middleware\n */\n reset(): void {\n middlewares.length = 0;\n },\n \n /**\n * Get current middleware count (for debugging)\n */\n getMiddlewareCount(): number {\n return middlewares.length;\n }\n};\n\nlet routing;\n\nexport async function createApp<T extends HTMLElement = HTMLElement>(\n node: T,\n options: ServerOptions\n): Promise<void> {\n\n let base_path = options.component_dir\n\n if(!base_path && typeof base_path !== 'string') {\n throw new Error('No component directory provided');\n }\n let routes = window['__ROUTING__']\n routing = initialize_route_matchers(routes)\n\n if (window && window.location) {\n const application_url = (window.location.pathname || '/').split('?')[0];\n console.log(`Current pathname: ${application_url}`);\n const needle = routing.find(r => r.parser(application_url));\n let route = needle ? routes.find(r => r.path === needle.pattern) : null;\n if (needle && route) {\n console.log(`Found route:`, route);\n const params = needle.parser(application_url) ||{};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(window.location.search);\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n const combinedParams = { ...params, ...queryParams };\n updateManifestStore()\n loadRoute(node, base_path, route, combinedParams,params, queryParams);\n bootstrap_events(base_path, routes, routing);\n } else {\n console.log('No matching route found, using fallback navigation');\n // Fallback: Use window.location.href to navigate to the current URL\n // This will trigger a full page load, allowing the server to handle the route\n window.location.href = application_url;\n return; // Exit early since we're doing a full page navigation\n }\n\n }\n}\n\n\n"],"names":["makeUrlParser","pattern","parser","pathToRegex","pathname","initialize_route_matchers","routes","route","_extends","n","e","t","r","Action","readOnly","obj","warning","cond","message","BeforeUnloadEventType","PopStateEventType","createBrowserHistory","options","_options","_options$window","window","globalHistory","getIndexAndLocation","_window$location","search","hash","state","blockedPopTx","handlePop","blockers","nextAction","_getIndexAndLocation","nextIndex","nextLocation","delta","index","go","applyTx","action","_getIndexAndLocation2","location","listeners","createEvents","createHref","to","createPath","getNextLocation","parsePath","createKey","getHistoryStateAndUrl","allowTx","retry","_getIndexAndLocation3","push","_getHistoryStateAndUr","historyState","url","replace","_getHistoryStateAndUr2","history","listener","blocker","unblock","promptBeforeUnload","event","handlers","fn","handler","arg","_ref","_ref$pathname","_ref$search","_ref$hash","path","parsedPath","hashIndex","searchIndex","ROOT","page","urlJoin","parts","part","i","loadRoute","node","base_path","combinedParams","urlParams","query","layouts_paths","layout","view_path","layouts","view","hydrate","RecursiveLoader","error","currentUrl","updateRoute","params","server_loading","update","fetchOptions","FORGE_LOAD_SYMBOL","response","data","MANIFEST_STORE","$","updateManifestStore","bootstrap_events","matchers","a","_a","_b","method","m","queryParams","requires_server_data","_","fullUrl","originalPushState","originalReplaceState","args","result","evt","newUrl","currentPathname","fullPath","middlewares","originalFetch","isInternalRoute","urlObj","initializeFetch","input","init","headers","headersObject","middleware","resolve","reject","finalHeaders","key","value","requestInit","fetch","routing","createApp","application_url","needle"],"mappings":"sgBAKO,SAASA,GAAcC,EAAiB,CACvC,MAAAC,EAAS,IAAIC,EAAA,cAAYF,CAAO,EACtC,OAAQG,GACSF,EAAO,MAAME,CAAQ,GACnB,IAErB,CAsBO,SAASC,GAA0BC,EAAgC,CACjE,OAAAA,EAAO,IAAKC,GAAkB,CACnC,MAAMN,EAAUM,EAAM,KAChBL,EAASF,GAAcC,CAAO,EAC7B,MAAA,CAAE,QAAAA,EAAS,OAAAC,CAAO,CAAA,CAC1B,CACH,CCvCA,SAASM,GAAW,CAClB,OAAOA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAI,EAAK,SAAUC,EAAG,CACpE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAI,UAAUD,CAAC,EACnB,QAASE,KAAKD,GAAI,CAAE,GAAE,eAAe,KAAKA,EAAGC,CAAC,IAAMH,EAAEG,CAAC,EAAID,EAAEC,CAAC,EACpE,CACI,OAAOH,CACR,EAAED,EAAS,MAAM,KAAM,SAAS,CACnC,CCDA,IAAIK,GAEH,SAAUA,EAAQ,CAQjBA,EAAO,IAAS,MAOhBA,EAAO,KAAU,OAMjBA,EAAO,QAAa,SACtB,GAAGA,IAAWA,EAAS,CAAA,EAAG,EAE1B,IAAIC,EAAW,QAAQ,IAAI,WAAa,aAAe,SAAUC,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AI,KACnE,GAAIA,GAAUlJ,EAAO,CACT,QAAA,IAAI,eAAgBA,CAAK,EACjC,MAAMiG,EAASiD,EAAO,OAAOD,CAAe,GAAI,CAAC,EAE3C5D,EAAY,IAAI,gBAAgB,OAAO,SAAS,MAAM,EACtD6B,EAAc,OAAO,YAAY7B,EAAU,QAAS,CAAA,GAAK,CAAC,EAC1DD,EAAiB,CAAE,GAAGa,EAAQ,GAAGiB,CAAY,EAC/BR,EAAA,EACpBzB,EAAUC,EAAMC,EAAWnF,EAAOoF,EAAea,EAAQiB,CAAW,EACnDP,EAAAxB,EAAWpF,EAAQgJ,CAAO,CAAA,KACxC,CACH,QAAQ,IAAI,oDAAoD,EAGhE,OAAO,SAAS,KAAOE,EACvB,MAAA,CACJ,CAGR","x_google_ignoreList":[1,2]}
|
|
1
|
+
{"version":3,"file":"client.cjs","sources":["../src/routing/url_parser.ts","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/history/index.js","../src/client/navigation.svelte.ts","../src/routing/manifest/store.svelte.ts","../src/client/events.ts","../src/client/client.ts"],"sourcesContent":["import pathToRegex from 'path-to-regex';\nimport type { IRoute } from '../parser/IRoute';\n\n\n\nexport function makeUrlParser(pattern: string) {\n const parser = new pathToRegex(pattern);\n return (pathname: string) => {\n const result = parser.match(pathname);\n return result || null;\n };\n}\n\n\nexport type UrlMatcher = {\n pattern: string,\n parser: ReturnType<typeof makeUrlParser>\n}\n\nexport function findRoute(pathname:string, routes: UrlMatcher[]) {\n for (const { pattern, parser } of routes) {\n const params = parser(pathname);\n if (params) {\n return { pattern, params };\n }\n }\n return null;\n}\n\n\n\n\n\nexport function initialize_route_matchers(routes: IRoute[]): UrlMatcher[] {\n return routes.map((route: IRoute) => {\n const pattern = route.path;\n const parser = makeUrlParser(pattern);\n return { pattern, parser };\n })\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","\nimport type { IRoute } from '../parser/IRoute'\nimport { hydrate } from 'svelte'\nimport RecursiveLoader from '../components/RecursiveRender.svelte'\nimport { createBrowserHistory } from 'history';\nimport { FORGE_LOAD_SYMBOL } from './client';\nimport {page} from \"./page.svelte\";\n\nconst history = createBrowserHistory()\n\nconst ROOT = $state({\n layouts: [] as any[],\n view: null,\n data: null as any,\n params: null,\n urlParams: null as any,\n query: null as any,\n page\n})\n\nfunction urlJoin(...parts) {\n let url = parts\n .map((part, i) => {\n if (i === 0) return part.replace(/\\/+$/, ''); // trim trailing slash\n return part.replace(/^\\/+|\\/+$/g, ''); // trim both for middle parts\n })\n .join('/');\n\n if (!url.startsWith('/')) {\n url = '/' + url; // add leading slash if not present\n }\n return url.split('?')[0]; // remove query string\n}\n\nexport async function loadRoute(node:any,base_path:string, route: IRoute, combinedParams: any, urlParams:any, query:any) {\n try {\n // When serving precompiled client bundles (dist/client), resolve to .js files\n const useCompiledClient = typeof base_path === 'string' && base_path.indexOf('dist/client') !== -1;\n\n const layouts_paths = (route.layout || []).map(layout => {\n let p = urlJoin(base_path,layout).toString();\n if (useCompiledClient) {\n p = p.endsWith('.svelte') ? p.replace(/\\.svelte$/, '.js') : (/[.][a-z]+$/.test(p) ? p : p + '.js');\n }\n return p;\n })\n let view_path = urlJoin(base_path,route.view).toString()\n if (useCompiledClient) {\n view_path = view_path.endsWith('.svelte') ? view_path.replace(/\\.svelte$/, '.js') : (/[.][a-z]+$/.test(view_path) ? view_path : view_path + '.js');\n }\n\n console.log({layouts_paths,view_path})\n\n const layouts = await Promise.all(layouts_paths.map((layout) => {\n return import(/* @vite-ignore */ layout).then(layout => {\n return layout.default\n })\n }))\n\n if (!view_path.startsWith('/')){\n view_path = '/'+view_path\n }\n const view = await import(/* @vite-ignore */ view_path).then(view => {\n return view.default\n })\n\n ROOT.layouts = layouts\n ROOT.view = view\n ROOT.params = combinedParams\n ROOT.data = (window as any).__INITIAL_DATA__\n ROOT.urlParams = urlParams\n ROOT.query = query\n\n hydrate(RecursiveLoader, {\n target: node,\n props: ROOT,\n })\n } catch (error) {\n console.log('Client-side route loading failed - falling back to SSR navigation');\n console.error('Route loading error:', error);\n // Fallback: Use SSR rendering by triggering a full page load\n const currentUrl = window.location.pathname || '/';\n window.location.href = currentUrl;\n }\n}\n\n\n\nexport async function updateRoute(url:string,base_path:string, route: IRoute, params: any,urlParams:any,query:any,server_loading:boolean = false,update = true) {\n try {\n const useCompiledClient = typeof base_path === 'string' && base_path.indexOf('dist/client') !== -1;\n const layouts_paths = (route.layout || []).map(layout => {\n let p = urlJoin(base_path,layout).toString();\n if (useCompiledClient) {\n p = p.endsWith('.svelte') ? p.replace(/\\.svelte$/, '.js') : (/[.][a-z]+$/.test(p) ? p : p + '.js');\n }\n return p;\n })\n let view_path = urlJoin(base_path,route.view).toString()\n if (useCompiledClient) {\n view_path = view_path.endsWith('.svelte') ? view_path.replace(/\\.svelte$/, '.js') : (/[.][a-z]+$/.test(view_path) ? view_path : view_path + '.js');\n }\n const layouts = await Promise.all(layouts_paths.map((layout) => {\n return import(/* @vite-ignore */ layout).then(layout => {\n return layout.default\n })\n }))\n const view = await import(/* @vite-ignore */ view_path).then(view => {\n return view.default\n })\n\n if (server_loading) {\n const fetchOptions: any = {\n method: route.method,\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n }\n };\n fetchOptions[FORGE_LOAD_SYMBOL] = true;\n \n await fetch(url, fetchOptions).then((response) => {\n if (response.ok) {\n return response.json()\n } else {\n throw new Error('Network response was not ok')\n }\n }).then((data)=>{\n \n console.log('Server data',data)\n // The server returns structured data: { layout: [...], view: {...} }\n // We need to pass this structure to RecursiveRender correctly\n ROOT.data = data\n ROOT.params = params\n ROOT.layouts = layouts\n ROOT.view = view\n ROOT.urlParams = urlParams\n ROOT.query = query\n })\n }else{\n ROOT.data = {layout:[],view:{}}\n ROOT.params = params\n ROOT.layouts = layouts\n ROOT.view = view\n ROOT.urlParams = urlParams\n ROOT.query = query\n }\n if(window){\n window.scroll(0,0)\n }\n\n if(update){\n history.push(url)\n }\n } catch (error) {\n console.log('Client-side navigation failed for URL:', url, '- falling back to SSR navigation');\n console.error('Navigation error:', error);\n // Fallback: Use SSR rendering by triggering a full page load\n // window.location.href = url;\n }\n}\n","\n\n\nexport const MANIFEST_STORE = $state({})\n\n\n\nexport async function updateManifestStore() {\n Object.assign(MANIFEST_STORE, window['__MANIFEST__'])\n // await fetch('/manifest.json')\n // .then(async (response) => {\n // if (response.ok) {\n // const manifest = await response.json();\n // console.log(manifest)\n // Object.assign(MANIFEST_STORE, manifest);\n // }\n // })\n}","\n\nimport type {IRoute} from \"../parser/IRoute\";\nimport type { UrlMatcher } from \"../routing/url_parser\";\nimport { updateRoute } from \"./navigation.svelte\";\nimport { MANIFEST_STORE } from \"../routing/manifest/store.svelte\";\nimport {page} from './page.svelte'\n\n\n\n\nexport function bootstrap_events(base_path:string,routes:IRoute[], matchers: UrlMatcher[]) {\n if(!document){\n console.error('Document not found')\n return\n }\n\n document.addEventListener('click', (event:any) => {\n const currentUrl = window.location.pathname;\n const a = event.target?.tagName === 'A' ? event.target : event.target?.closest('A');\n \n if (a) {\n let url = a.getAttribute('href');\n if (currentUrl === url) {\n event.preventDefault();\n return;\n }\n if (url && url.startsWith('/') || url.startsWith('.')) {\n const pathname = url.split('?')[0];\n const method = a.getAttribute('method') || 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(pathname) && m.pattern === r.path));\n if (route) {\n event.preventDefault();\n const m = matchers.find(m => m.parser(pathname) && m.pattern === route.path);\n const params = m?.parser(pathname) || {};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(url.split('?')[1] || '');\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(url,base_path, route, combinedParams,params,queryParams,requires_server_data);\n } else {\n console.log('No matching route found for URL:', url, '- using fallback navigation');\n // Fallback: Don't prevent default, let browser handle the navigation\n // This will trigger a full page load that the server can handle\n }\n }\n }\n });\n\n\n window.addEventListener('popstate', (_) => {\n const path = window.location.pathname;\n const fullUrl = window.location.pathname + window.location.search;\n // update page data\n page.url = fullUrl\n page.pathname = window.location.pathname\n const method = 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(path) && m.pattern === r.path));\n if (route) {\n const m = matchers.find(m => m.parser(path) && m.pattern === route.path);\n const params = m?.parser(path) || {};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(window.location.search);\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n\n // Object.assign(page.params,params)\n page.params = params\n page.query = queryParams\n\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(fullUrl,base_path, route, combinedParams,params,queryParams,requires_server_data,false);\n } else {\n console.log('No matching route found for popstate navigation to:', path, '- using fallback navigation');\n // Fallback: Trigger full page reload for unknown routes\n window.location.href = path;\n }\n });\n\n\n // Run this once in your bootstrap code\n (function () {\n const originalPushState = history.pushState;\n const originalReplaceState = history.replaceState;\n\n history.pushState = function (...args) {\n const result = originalPushState.apply(this, args);\n const evt= new Event('pushstate')\n evt['state'] = args[0]\n evt['url'] = args[2]\n window.dispatchEvent(evt);\n return result;\n };\n\n\n history.replaceState = function (...args) {\n const result = originalReplaceState.apply(this, args);\n \n // Only trigger navigation if pathname actually changes\n const newUrl = args[2];\n const currentPathname = window.location.pathname;\n const newPathname = newUrl ? new URL(newUrl, window.location.origin).pathname : currentPathname;\n \n if (newPathname !== currentPathname) {\n const evt= new Event('replacestate')\n evt['state'] = args[0]\n evt['url'] = args[2]\n window.dispatchEvent(evt);\n }\n \n return result;\n }\n // Add a listener to the popstate event\n })();\n\n window.addEventListener('pushstate', (event) => {\n const fullPath = event['url'] || window.location.pathname + window.location.search;\n const path = fullPath.split('?')[0];\n const method = 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(path) && m.pattern === r.path));\n if (route) {\n const m = matchers.find(m => m.parser(path) && m.pattern === route.path);\n const params = m?.parser(path);\n\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(fullPath.split('?')[1] || '');\n const queryParams = Object.fromEntries(urlParams.entries());\n \n page.url = fullPath\n page.pathname = window.location.pathname\n Object.assign(page.params,params)\n Object.assign(page.query,queryParams)\n\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(fullPath,base_path, route, combinedParams,params,queryParams,requires_server_data,false);\n } else {\n console.log('No matching route found for pushstate to:', path, '- using fallback navigation');\n // Fallback: Use full page navigation for unknown routes\n window.location.href = path;\n }\n });\n\n window.addEventListener('replacestate', (event) => {\n const fullPath = event['url'] || window.location.pathname + window.location.search;\n const path = fullPath.split('?')[0];\n\n // update page data\n page.url = fullPath\n page.pathname = window.location.pathname\n page.query = Object.fromEntries(new URLSearchParams(fullPath.split('?')[1] || ''))\n\n const method = 'get';\n const route = routes.find(r => r.method.toLowerCase() === method && matchers.find(m => m.parser(path) && m.pattern === r.path));\n if (route) {\n const m = matchers.find(m => m.parser(path) && m.pattern === route.path);\n const params = m?.parser(path) || {};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(fullPath.split('?')[1] || '');\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n const combinedParams = { ...params, ...queryParams };\n const requires_server_data = MANIFEST_STORE[m?.pattern as string]\n updateRoute(fullPath,base_path, route, combinedParams,params,queryParams,requires_server_data,false);\n } else {\n console.log('No matching route found for replacestate to:', path, '- using fallback navigation');\n // Fallback: Use full page navigation for unknown routes\n window.location.href = path;\n }\n });\n \n}\n","import { initialize_route_matchers } from '../routing/url_parser';\nimport { loadRoute } from './navigation.svelte';\nimport { bootstrap_events } from './events';\nimport { updateManifestStore } from '../routing/manifest/store.svelte';\nimport type { ServerOptions } from '../options/ServerOptions';\nimport type { FetchMiddleware, FetchMiddlewareAPI, HeadersObject, AsyncMiddleware, CallbackMiddleware } from '../types/FetchMiddleware';\n\n// Symbol for marking load function fetches\nexport const FORGE_LOAD_SYMBOL = Symbol('forge-load-function');\n\n// Middleware storage\nlet middlewares: Array<FetchMiddleware> = [];\nlet originalFetch: typeof window.fetch | null = null;\n\n// Helper to determine if a URL is an internal route\nfunction isInternalRoute(url: string): boolean {\n try {\n const urlObj = new URL(url, window.location.origin);\n return urlObj.origin === window.location.origin && !urlObj.pathname.startsWith('/api/');\n } catch {\n // Relative URL, assume internal\n return !url.startsWith('/api/');\n }\n}\n\n// Initialize fetch override immediately when module is imported\nfunction initializeFetch(): void {\n if (typeof window !== 'undefined' && !originalFetch) {\n originalFetch = window.fetch;\n\n window.fetch = async function(input: RequestInfo | URL, init: RequestInit = {}): Promise<Response> {\n console.log('🔵 Enhanced fetch called for:', input);\n console.log('🔵 Initial init:', init);\n\n // Start with the original init\n let currentInit: RequestInit = { ...init };\n\n // Run all configured middleware\n for (const middleware of middlewares) {\n try {\n if (middleware.length === 2) {\n // Callback style (legacy): (headers, next) => {}\n // Convert headers for middleware\n const headers = new Headers(currentInit.headers);\n const headersObject: HeadersObject = Object.fromEntries(headers.entries());\n\n console.log('🟡 Running callback-style middleware (length=2)');\n await new Promise<void>((resolve, reject) => {\n try {\n (middleware as any)(headersObject, (error?: any) => {\n if (error) {\n reject(error);\n } else {\n // Convert headers back\n const finalHeaders = new Headers();\n Object.entries(headersObject).forEach(([key, value]) => {\n if (value !== undefined) {\n finalHeaders.set(key, value);\n }\n });\n currentInit.headers = finalHeaders;\n resolve();\n }\n });\n } catch (error) {\n reject(error);\n }\n });\n } else {\n // New style middleware (returns RequestInit)\n console.log('🟡 Running new-style RequestInit middleware (length=' + middleware.length + ')');\n const result = await (middleware as any)(currentInit, input);\n\n if (result && typeof result === 'object') {\n // Middleware returned a value - use it as new RequestInit\n console.log('🟢 Middleware returned RequestInit:', result);\n currentInit = result;\n } else {\n console.log('🟢 Middleware returned:', result);\n }\n }\n } catch (error) {\n console.error('🔴 Middleware error:', error);\n throw error;\n }\n }\n\n console.log('🟢 Final init after middleware:', currentInit);\n\n // Make the actual request\n const response = await originalFetch!(input, currentInit);\n\n // Handle frontend route redirects\n if (response.status >= 300 && response.status < 400 && (init as any)[FORGE_LOAD_SYMBOL]) {\n const location = response.headers.get('location');\n if (location && isInternalRoute(location)) {\n // For internal routes, let the browser handle the redirect\n window.location.href = location;\n return response;\n }\n }\n\n return response;\n };\n }\n}\n\n// Initialize fetch override immediately\ninitializeFetch();\n\n// Export fetch API with middleware configuration\nexport const fetch: FetchMiddlewareAPI & { getMiddlewareCount(): number } = {\n /**\n * Add middleware to the fetch pipeline\n */\n configUpdate(middleware: FetchMiddleware): void {\n if (typeof middleware !== 'function') {\n throw new Error('Middleware must be a function');\n }\n middlewares.push(middleware);\n },\n \n /**\n * Reset all middleware\n */\n reset(): void {\n middlewares.length = 0;\n },\n \n /**\n * Get current middleware count (for debugging)\n */\n getMiddlewareCount(): number {\n return middlewares.length;\n }\n};\n\nlet routing;\n\nexport async function createApp<T extends HTMLElement = HTMLElement>(\n node: T,\n options: ServerOptions\n): Promise<void> {\n\n let base_path = options.component_dir\n\n if(!base_path && typeof base_path !== 'string') {\n throw new Error('No component directory provided');\n }\n let routes = window['__ROUTING__']\n routing = initialize_route_matchers(routes)\n\n if (window && window.location) {\n const application_url = (window.location.pathname || '/').split('?')[0];\n console.log(`Current pathname: ${application_url}`);\n const needle = routing.find(r => r.parser(application_url));\n let route = needle ? routes.find(r => r.path === needle.pattern) : null;\n if (needle && route) {\n console.log(`Found route:`, route);\n const params = needle.parser(application_url) ||{};\n // Parse query parameters and combine with path parameters\n const urlParams = new URLSearchParams(window.location.search);\n const queryParams = Object.fromEntries(urlParams.entries()) || {};\n const combinedParams = { ...params, ...queryParams };\n updateManifestStore()\n loadRoute(node, base_path, route, combinedParams,params, queryParams);\n bootstrap_events(base_path, routes, routing);\n } else {\n console.log('No matching route found, using fallback navigation');\n // Fallback: Use window.location.href to navigate to the current URL\n // This will trigger a full page load, allowing the server to handle the route\n window.location.href = application_url;\n return; // Exit early since we're doing a full page navigation\n }\n\n }\n}\n\n\n"],"names":["makeUrlParser","pattern","parser","pathToRegex","pathname","initialize_route_matchers","routes","route","_extends","n","e","t","r","Action","readOnly","obj","warning","cond","message","BeforeUnloadEventType","PopStateEventType","createBrowserHistory","options","_options","_options$window","window","globalHistory","getIndexAndLocation","_window$location","search","hash","state","blockedPopTx","handlePop","blockers","nextAction","_getIndexAndLocation","nextIndex","nextLocation","delta","index","go","applyTx","action","_getIndexAndLocation2","location","listeners","createEvents","createHref","to","createPath","getNextLocation","parsePath","createKey","getHistoryStateAndUrl","allowTx","retry","_getIndexAndLocation3","push","_getHistoryStateAndUr","historyState","url","replace","_getHistoryStateAndUr2","history","listener","blocker","unblock","promptBeforeUnload","event","handlers","fn","handler","arg","_ref","_ref$pathname","_ref$search","_ref$hash","path","parsedPath","hashIndex","searchIndex","ROOT","page","urlJoin","parts","part","i","loadRoute","node","base_path","combinedParams","urlParams","query","useCompiledClient","layouts_paths","layout","p","view_path","layouts","view","hydrate","RecursiveLoader","error","currentUrl","updateRoute","params","server_loading","update","fetchOptions","FORGE_LOAD_SYMBOL","response","data","MANIFEST_STORE","$","updateManifestStore","bootstrap_events","matchers","_a","_b","method","m","queryParams","requires_server_data","_","fullUrl","originalPushState","originalReplaceState","args","result","evt","newUrl","currentPathname","fullPath","middlewares","originalFetch","isInternalRoute","urlObj","initializeFetch","input","init","currentInit","middleware","headers","headersObject","resolve","reject","finalHeaders","key","value","fetch","routing","createApp","application_url","needle"],"mappings":"sgBAKO,SAASA,GAAcC,EAAiB,CACvC,MAAAC,EAAS,IAAIC,EAAA,cAAYF,CAAO,EACtC,OAAQG,GACSF,EAAO,MAAME,CAAQ,GACnB,IAErB,CAsBO,SAASC,GAA0BC,EAAgC,CACjE,OAAAA,EAAO,IAAKC,GAAkB,CACnC,MAAMN,EAAUM,EAAM,KAChBL,EAASF,GAAcC,CAAO,EAC7B,MAAA,CAAE,QAAAA,EAAS,OAAAC,CAAO,CAAA,CAC1B,CACH,CCvCA,SAASM,GAAW,CAClB,OAAOA,EAAW,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Ae,CAAC,EACtD,IAAAlJ,EAAQmJ,EAASpJ,EAAO,QAAUM,EAAE,OAAS8I,EAAO,OAAO,EAAI,KACnE,GAAIA,GAAUnJ,EAAO,CACT,QAAA,IAAI,eAAgBA,CAAK,EACjC,MAAMmG,EAASgD,EAAO,OAAOD,CAAe,GAAI,CAAC,EAE3C7D,EAAY,IAAI,gBAAgB,OAAO,SAAS,MAAM,EACtD8B,EAAc,OAAO,YAAY9B,EAAU,QAAS,CAAA,GAAK,CAAC,EAC1DD,EAAiB,CAAE,GAAGe,EAAQ,GAAGgB,CAAY,EAC/BP,EAAA,EACpB3B,EAAUC,EAAMC,EAAWnF,EAAOoF,EAAee,EAAQgB,CAAW,EACnDN,EAAA1B,EAAWpF,EAAQiJ,CAAO,CAAA,KACxC,CACH,QAAQ,IAAI,oDAAoD,EAGhE,OAAO,SAAS,KAAOE,EACvB,MAAA,CACJ,CAGR","x_google_ignoreList":[1,2]}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
declare type AsyncHeadersMiddleware = (headers: HeadersObject) => Promise<void> | void;
|
|
2
|
+
|
|
1
3
|
declare interface Body_2 {
|
|
2
4
|
description: string;
|
|
3
5
|
required?: boolean;
|
|
@@ -6,6 +8,8 @@ declare interface Body_2 {
|
|
|
6
8
|
|
|
7
9
|
export declare function bootstrap_events(base_path: string, routes: IRoute[], matchers: UrlMatcher[]): void;
|
|
8
10
|
|
|
11
|
+
declare type CallbackHeadersMiddleware = (headers: HeadersObject, next: NextFunction) => void;
|
|
12
|
+
|
|
9
13
|
declare type ContextBuilder = (req: any, res: any) => Record<string, any>;
|
|
10
14
|
|
|
11
15
|
export declare function createApp<T extends HTMLElement = HTMLElement>(node: T, options: ServerOptions): Promise<void>;
|
|
@@ -15,12 +19,20 @@ declare const fetch_2: FetchMiddlewareAPI & {
|
|
|
15
19
|
};
|
|
16
20
|
export { fetch_2 as fetch }
|
|
17
21
|
|
|
18
|
-
declare type FetchMiddleware =
|
|
22
|
+
declare type FetchMiddleware = AsyncHeadersMiddleware | CallbackHeadersMiddleware | RequestInitMiddleware;
|
|
19
23
|
|
|
20
24
|
declare interface FetchMiddlewareAPI {
|
|
21
25
|
/**
|
|
22
26
|
* Add a new middleware to the fetch chain
|
|
23
|
-
*
|
|
27
|
+
* Middleware can either modify headers only (legacy) or the full RequestInit (new)
|
|
28
|
+
*
|
|
29
|
+
* Legacy: `(headers: HeadersObject) => void | Promise<void>`
|
|
30
|
+
* Legacy: `(headers: HeadersObject, next: () => void) => void`
|
|
31
|
+
*
|
|
32
|
+
* New: `(init: RequestInit) => RequestInit | Promise<RequestInit>`
|
|
33
|
+
* New: `(init: RequestInit, input: RequestInfo | URL) => RequestInit | Promise<RequestInit>`
|
|
34
|
+
*
|
|
35
|
+
* @param middleware - Function to modify request before fetch
|
|
24
36
|
*/
|
|
25
37
|
configUpdate(middleware: FetchMiddleware): void;
|
|
26
38
|
/**
|
|
@@ -75,6 +87,8 @@ export declare let page: IPage;
|
|
|
75
87
|
|
|
76
88
|
declare type Parameter = any;
|
|
77
89
|
|
|
90
|
+
declare type RequestInitMiddleware = ((init: RequestInit, input: RequestInfo | URL) => Promise<RequestInit> | RequestInit) | ((init: RequestInit) => Promise<RequestInit> | RequestInit);
|
|
91
|
+
|
|
78
92
|
declare type Response_2 = Record<number, ResponseData>;
|
|
79
93
|
|
|
80
94
|
declare type ResponseData = {
|