@noego/forge 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +263 -223
- package/dist/client.mjs.map +1 -1
- package/dist/plugins-cjs/routing/html_render/html_render.js +90 -2
- package/dist/plugins-cjs/routing/html_render/html_render.js.map +1 -1
- package/dist/plugins-es/routing/html_render/html_render.js +90 -2
- package/dist/plugins-es/routing/html_render/html_render.js.map +1 -1
- package/dist/routing/html_render/html_render.js +90 -2
- package/dist/routing/html_render/html_render.js.map +1 -1
- package/dist-ssr/server.cjs +105 -3
- package/dist-ssr/server.cjs.map +1 -1
- package/dist-ssr/server.js +105 -3
- package/dist-ssr/server.js.map +1 -1
- package/package.json +1 -1
package/dist/client.mjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { s as
|
|
3
|
-
import * as
|
|
4
|
-
import { hydrate as
|
|
5
|
-
import
|
|
1
|
+
import { p as B, a as E } from "./page.svelte-Bq1Q01H0.js";
|
|
2
|
+
import { s as yt } from "./page.svelte-Bq1Q01H0.js";
|
|
3
|
+
import * as W from "svelte/internal/client";
|
|
4
|
+
import { hydrate as J } from "svelte";
|
|
5
|
+
import Y from "../src/components/RecursiveRender.svelte";
|
|
6
6
|
function K(t) {
|
|
7
|
-
const i = new
|
|
7
|
+
const i = new B(t);
|
|
8
8
|
return (n) => i.match(n) || null;
|
|
9
9
|
}
|
|
10
10
|
function Q(t) {
|
|
11
11
|
return t.map((i) => {
|
|
12
|
-
const n = i.path,
|
|
13
|
-
return { pattern: n, parser:
|
|
12
|
+
const n = i.path, r = K(n);
|
|
13
|
+
return { pattern: n, parser: r };
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
16
|
+
function U() {
|
|
17
|
+
return U = Object.assign ? Object.assign.bind() : function(t) {
|
|
18
18
|
for (var i = 1; i < arguments.length; i++) {
|
|
19
19
|
var n = arguments[i];
|
|
20
|
-
for (var
|
|
20
|
+
for (var r in n) ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
|
-
},
|
|
23
|
+
}, U.apply(null, arguments);
|
|
24
24
|
}
|
|
25
|
-
var
|
|
25
|
+
var S;
|
|
26
26
|
(function(t) {
|
|
27
27
|
t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
|
|
28
|
-
})(
|
|
29
|
-
var
|
|
28
|
+
})(S || (S = {}));
|
|
29
|
+
var V = process.env.NODE_ENV !== "production" ? function(t) {
|
|
30
30
|
return Object.freeze(t);
|
|
31
31
|
} : function(t) {
|
|
32
32
|
return t;
|
|
@@ -40,36 +40,36 @@ function X(t, i) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var F = "beforeunload", Z = "popstate";
|
|
44
44
|
function tt(t) {
|
|
45
45
|
t === void 0 && (t = {});
|
|
46
|
-
var i = t, n = i.window,
|
|
47
|
-
function
|
|
48
|
-
var d =
|
|
49
|
-
return [
|
|
46
|
+
var i = t, n = i.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
47
|
+
function a() {
|
|
48
|
+
var d = r.location, m = d.pathname, P = d.search, b = d.hash, O = o.state || {};
|
|
49
|
+
return [O.idx, V({
|
|
50
50
|
pathname: m,
|
|
51
|
-
search:
|
|
51
|
+
search: P,
|
|
52
52
|
hash: b,
|
|
53
|
-
state:
|
|
54
|
-
key:
|
|
53
|
+
state: O.usr || null,
|
|
54
|
+
key: O.key || "default"
|
|
55
55
|
})];
|
|
56
56
|
}
|
|
57
|
-
var
|
|
57
|
+
var s = null;
|
|
58
58
|
function l() {
|
|
59
|
-
if (
|
|
60
|
-
|
|
59
|
+
if (s)
|
|
60
|
+
h.call(s), s = null;
|
|
61
61
|
else {
|
|
62
|
-
var d =
|
|
63
|
-
if (
|
|
64
|
-
if (
|
|
65
|
-
var
|
|
66
|
-
|
|
62
|
+
var d = S.Pop, m = a(), P = m[0], b = m[1];
|
|
63
|
+
if (h.length)
|
|
64
|
+
if (P != null) {
|
|
65
|
+
var O = f - P;
|
|
66
|
+
O && (s = {
|
|
67
67
|
action: d,
|
|
68
68
|
location: b,
|
|
69
69
|
retry: function() {
|
|
70
|
-
|
|
70
|
+
j(O * -1);
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, j(O));
|
|
73
73
|
} else
|
|
74
74
|
process.env.NODE_ENV !== "production" && X(
|
|
75
75
|
!1,
|
|
@@ -79,110 +79,110 @@ function tt(t) {
|
|
|
79
79
|
"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."
|
|
80
80
|
);
|
|
81
81
|
else
|
|
82
|
-
|
|
82
|
+
R(d);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
var e =
|
|
87
|
-
|
|
88
|
-
idx:
|
|
85
|
+
r.addEventListener(Z, l);
|
|
86
|
+
var e = S.Pop, u = a(), f = u[0], p = u[1], c = M(), h = M();
|
|
87
|
+
f == null && (f = 0, o.replaceState(U({}, o.state, {
|
|
88
|
+
idx: f
|
|
89
89
|
}), ""));
|
|
90
|
-
function
|
|
90
|
+
function y(d) {
|
|
91
91
|
return typeof d == "string" ? d : nt(d);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return m === void 0 && (m = null),
|
|
93
|
+
function v(d, m) {
|
|
94
|
+
return m === void 0 && (m = null), V(U({
|
|
95
95
|
pathname: p.pathname,
|
|
96
96
|
hash: "",
|
|
97
97
|
search: ""
|
|
98
|
-
}, typeof d == "string" ?
|
|
98
|
+
}, typeof d == "string" ? rt(d) : d, {
|
|
99
99
|
state: m,
|
|
100
100
|
key: et()
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function w(d, m) {
|
|
104
104
|
return [{
|
|
105
105
|
usr: d.state,
|
|
106
106
|
key: d.key,
|
|
107
107
|
idx: m
|
|
108
|
-
},
|
|
108
|
+
}, y(d)];
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
return !
|
|
110
|
+
function L(d, m, P) {
|
|
111
|
+
return !h.length || (h.call({
|
|
112
112
|
action: d,
|
|
113
113
|
location: m,
|
|
114
|
-
retry:
|
|
114
|
+
retry: P
|
|
115
115
|
}), !1);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function R(d) {
|
|
118
118
|
e = d;
|
|
119
|
-
var m =
|
|
120
|
-
|
|
119
|
+
var m = a();
|
|
120
|
+
f = m[0], p = m[1], c.call({
|
|
121
121
|
action: e,
|
|
122
122
|
location: p
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
var
|
|
127
|
-
function
|
|
128
|
-
|
|
125
|
+
function x(d, m) {
|
|
126
|
+
var P = S.Push, b = v(d, m);
|
|
127
|
+
function O() {
|
|
128
|
+
x(d, m);
|
|
129
129
|
}
|
|
130
|
-
if (
|
|
131
|
-
var _ =
|
|
130
|
+
if (L(P, b, O)) {
|
|
131
|
+
var _ = w(b, f + 1), I = _[0], A = _[1];
|
|
132
132
|
try {
|
|
133
|
-
|
|
133
|
+
o.pushState(I, "", A);
|
|
134
134
|
} catch {
|
|
135
|
-
|
|
135
|
+
r.location.assign(A);
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
R(P);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
var
|
|
142
|
-
function
|
|
143
|
-
|
|
140
|
+
function D(d, m) {
|
|
141
|
+
var P = S.Replace, b = v(d, m);
|
|
142
|
+
function O() {
|
|
143
|
+
D(d, m);
|
|
144
144
|
}
|
|
145
|
-
if (
|
|
146
|
-
var _ =
|
|
147
|
-
|
|
145
|
+
if (L(P, b, O)) {
|
|
146
|
+
var _ = w(b, f), I = _[0], A = _[1];
|
|
147
|
+
o.replaceState(I, "", A), R(P);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
150
|
+
function j(d) {
|
|
151
|
+
o.go(d);
|
|
152
152
|
}
|
|
153
|
-
var
|
|
153
|
+
var z = {
|
|
154
154
|
get action() {
|
|
155
155
|
return e;
|
|
156
156
|
},
|
|
157
157
|
get location() {
|
|
158
158
|
return p;
|
|
159
159
|
},
|
|
160
|
-
createHref:
|
|
161
|
-
push:
|
|
162
|
-
replace:
|
|
163
|
-
go:
|
|
160
|
+
createHref: y,
|
|
161
|
+
push: x,
|
|
162
|
+
replace: D,
|
|
163
|
+
go: j,
|
|
164
164
|
back: function() {
|
|
165
|
-
|
|
165
|
+
j(-1);
|
|
166
166
|
},
|
|
167
167
|
forward: function() {
|
|
168
|
-
|
|
168
|
+
j(1);
|
|
169
169
|
},
|
|
170
170
|
listen: function(m) {
|
|
171
|
-
return
|
|
171
|
+
return c.push(m);
|
|
172
172
|
},
|
|
173
173
|
block: function(m) {
|
|
174
|
-
var
|
|
175
|
-
return
|
|
176
|
-
|
|
174
|
+
var P = h.push(m);
|
|
175
|
+
return h.length === 1 && r.addEventListener(F, G), function() {
|
|
176
|
+
P(), h.length || r.removeEventListener(F, G);
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
|
-
return
|
|
180
|
+
return z;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function G(t) {
|
|
183
183
|
t.preventDefault(), t.returnValue = "";
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function M() {
|
|
186
186
|
var t = [];
|
|
187
187
|
return {
|
|
188
188
|
get length() {
|
|
@@ -190,14 +190,14 @@ function F() {
|
|
|
190
190
|
},
|
|
191
191
|
push: function(n) {
|
|
192
192
|
return t.push(n), function() {
|
|
193
|
-
t = t.filter(function(
|
|
194
|
-
return
|
|
193
|
+
t = t.filter(function(r) {
|
|
194
|
+
return r !== n;
|
|
195
195
|
});
|
|
196
196
|
};
|
|
197
197
|
},
|
|
198
198
|
call: function(n) {
|
|
199
|
-
t.forEach(function(
|
|
200
|
-
return
|
|
199
|
+
t.forEach(function(r) {
|
|
200
|
+
return r && r(n);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
};
|
|
@@ -206,165 +206,189 @@ function et() {
|
|
|
206
206
|
return Math.random().toString(36).substr(2, 8);
|
|
207
207
|
}
|
|
208
208
|
function nt(t) {
|
|
209
|
-
var i = t.pathname, n = i === void 0 ? "/" : i,
|
|
210
|
-
return
|
|
209
|
+
var i = t.pathname, n = i === void 0 ? "/" : i, r = t.search, o = r === void 0 ? "" : r, a = t.hash, s = a === void 0 ? "" : a;
|
|
210
|
+
return o && o !== "?" && (n += o.charAt(0) === "?" ? o : "?" + o), s && s !== "#" && (n += s.charAt(0) === "#" ? s : "#" + s), n;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function rt(t) {
|
|
213
213
|
var i = {};
|
|
214
214
|
if (t) {
|
|
215
215
|
var n = t.indexOf("#");
|
|
216
216
|
n >= 0 && (i.hash = t.substr(n), t = t.substr(0, n));
|
|
217
|
-
var
|
|
218
|
-
|
|
217
|
+
var r = t.indexOf("?");
|
|
218
|
+
r >= 0 && (i.search = t.substr(r), t = t.substr(0, r)), t && (i.pathname = t);
|
|
219
219
|
}
|
|
220
220
|
return i;
|
|
221
221
|
}
|
|
222
|
-
const
|
|
222
|
+
const ot = tt(), g = W.proxy({
|
|
223
223
|
layouts: [],
|
|
224
224
|
view: null,
|
|
225
225
|
data: null,
|
|
226
226
|
params: null,
|
|
227
227
|
urlParams: null,
|
|
228
228
|
query: null,
|
|
229
|
-
page:
|
|
229
|
+
page: E
|
|
230
230
|
});
|
|
231
|
-
function
|
|
232
|
-
let i = t.map((n,
|
|
231
|
+
function C(...t) {
|
|
232
|
+
let i = t.map((n, r) => r === 0 ? n.replace(/\/+$/, "") : n.replace(/^\/+|\/+$/g, "")).join("/");
|
|
233
233
|
return i.startsWith("/") || (i = "/" + i), i.split("?")[0];
|
|
234
234
|
}
|
|
235
|
-
async function at(t, i, n, o, a
|
|
235
|
+
async function at(t, i, n, r, o, a) {
|
|
236
236
|
try {
|
|
237
|
-
const
|
|
238
|
-
let
|
|
239
|
-
return
|
|
237
|
+
const s = typeof i == "string" && i.indexOf("assets") !== -1, l = (n.layout || []).map((p) => {
|
|
238
|
+
let c = C(i, p).toString();
|
|
239
|
+
return s && (c = c.endsWith(".svelte") ? c.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(c) ? c : c + ".js"), c;
|
|
240
240
|
});
|
|
241
|
-
let e =
|
|
242
|
-
|
|
243
|
-
const
|
|
241
|
+
let e = C(i, n.view).toString();
|
|
242
|
+
s && (e = e.endsWith(".svelte") ? e.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(e) ? e : e + ".js");
|
|
243
|
+
const u = await Promise.all(l.map((p) => import(
|
|
244
244
|
/* @vite-ignore */
|
|
245
245
|
p
|
|
246
|
-
).then((
|
|
246
|
+
).then((c) => c.default)));
|
|
247
247
|
e.startsWith("/") || (e = "/" + e);
|
|
248
|
-
const
|
|
248
|
+
const f = await import(
|
|
249
249
|
/* @vite-ignore */
|
|
250
250
|
e
|
|
251
251
|
).then((p) => p.default);
|
|
252
|
-
g.layouts =
|
|
253
|
-
} catch (
|
|
254
|
-
console.error("Client-side route loading failed:",
|
|
252
|
+
g.layouts = u, g.view = f, g.params = r, g.data = window.__INITIAL_DATA__, g.urlParams = o, g.query = a, J(Y, { target: t, props: g });
|
|
253
|
+
} catch (s) {
|
|
254
|
+
console.error("Client-side route loading failed:", s);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
async function
|
|
257
|
+
async function T(t, i, n, r, o, a, s = !1, l = !0) {
|
|
258
|
+
console.log("[NAVIGATION] updateRoute called", {
|
|
259
|
+
url: t,
|
|
260
|
+
server_loading: s,
|
|
261
|
+
route_path: n.path,
|
|
262
|
+
route_middleware: n.middleware
|
|
263
|
+
});
|
|
258
264
|
try {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
let u = A(i, n.view).toString();
|
|
264
|
-
e && (u = u.endsWith(".svelte") ? u.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(u) ? u : u + ".js");
|
|
265
|
-
const p = await Promise.all(s.map((w) => import(
|
|
266
|
-
/* @vite-ignore */
|
|
267
|
-
w
|
|
268
|
-
).then((h) => h.default))), f = await import(
|
|
269
|
-
/* @vite-ignore */
|
|
270
|
-
u
|
|
271
|
-
).then((w) => w.default);
|
|
272
|
-
if (c) {
|
|
273
|
-
const w = {
|
|
265
|
+
let e = null, u = !1;
|
|
266
|
+
if (s) {
|
|
267
|
+
console.log("[NAVIGATION] Making server fetch FIRST for", t);
|
|
268
|
+
const v = {
|
|
274
269
|
method: n.method,
|
|
275
270
|
headers: {
|
|
276
271
|
"Content-Type": "application/json",
|
|
277
272
|
Accept: "application/json"
|
|
278
273
|
}
|
|
279
274
|
};
|
|
280
|
-
|
|
281
|
-
if (
|
|
282
|
-
|
|
275
|
+
if (v[H] = !0, await fetch(t, v).then((w) => {
|
|
276
|
+
if (console.log("[NAVIGATION] Fetch response", {
|
|
277
|
+
url: t,
|
|
278
|
+
ok: w.ok,
|
|
279
|
+
status: w.status,
|
|
280
|
+
type: w.type,
|
|
281
|
+
redirected: w.redirected,
|
|
282
|
+
finalUrl: w.url
|
|
283
|
+
}), w.redirected)
|
|
284
|
+
return console.log("[NAVIGATION] Redirect detected, not loading components"), u = !0, null;
|
|
285
|
+
if (w.ok)
|
|
286
|
+
return w.json();
|
|
283
287
|
throw new Error("Network response was not ok");
|
|
284
|
-
}).then((
|
|
285
|
-
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
}).then((w) => {
|
|
289
|
+
e = w;
|
|
290
|
+
}), u) {
|
|
291
|
+
console.log("[NAVIGATION] Exiting early due to redirect");
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const f = typeof i == "string" && i.indexOf("assets") !== -1, p = (n.layout || []).map((v) => {
|
|
296
|
+
let w = C(i, v).toString();
|
|
297
|
+
return f && (w = w.endsWith(".svelte") ? w.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(w) ? w : w + ".js"), w;
|
|
298
|
+
});
|
|
299
|
+
let c = C(i, n.view).toString();
|
|
300
|
+
f && (c = c.endsWith(".svelte") ? c.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(c) ? c : c + ".js");
|
|
301
|
+
const h = await Promise.all(p.map((v) => import(
|
|
302
|
+
/* @vite-ignore */
|
|
303
|
+
v
|
|
304
|
+
).then((w) => w.default))), y = await import(
|
|
305
|
+
/* @vite-ignore */
|
|
306
|
+
c
|
|
307
|
+
).then((v) => v.default);
|
|
308
|
+
s ? (g.data = e, g.params = r, g.layouts = h, g.view = y, g.urlParams = o, g.query = a) : (console.log("[NAVIGATION] No server loading needed for", t), g.data = { layout: [], view: {} }, g.params = r, g.layouts = h, g.view = y, g.urlParams = o, g.query = a), window && window.scroll(0, 0), l && ot.push(t);
|
|
290
309
|
} catch (e) {
|
|
291
310
|
console.error("Client-side navigation failed for URL:", t, e);
|
|
292
311
|
}
|
|
293
312
|
}
|
|
294
|
-
const
|
|
313
|
+
const N = W.proxy({});
|
|
295
314
|
async function it() {
|
|
296
|
-
Object.assign(
|
|
315
|
+
Object.assign(N, window.__MANIFEST__);
|
|
297
316
|
}
|
|
298
317
|
function st(t, i, n) {
|
|
299
318
|
if (!document) {
|
|
300
319
|
console.error("Document not found");
|
|
301
320
|
return;
|
|
302
321
|
}
|
|
303
|
-
document.addEventListener("click", (
|
|
304
|
-
var
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
let e =
|
|
308
|
-
if (
|
|
309
|
-
|
|
322
|
+
document.addEventListener("click", (r) => {
|
|
323
|
+
var s, l;
|
|
324
|
+
const o = window.location.pathname, a = ((s = r.target) == null ? void 0 : s.tagName) === "A" ? r.target : (l = r.target) == null ? void 0 : l.closest("A");
|
|
325
|
+
if (a) {
|
|
326
|
+
let e = a.getAttribute("href");
|
|
327
|
+
if (o === e) {
|
|
328
|
+
r.preventDefault();
|
|
310
329
|
return;
|
|
311
330
|
}
|
|
312
331
|
if (e && e.startsWith("/") || e.startsWith(".")) {
|
|
313
|
-
const
|
|
332
|
+
const u = e.split("?")[0], f = a.getAttribute("method") || "get", p = i.find((c) => c.method.toLowerCase() === f && n.find((h) => h.parser(u) && h.pattern === c.path));
|
|
314
333
|
if (p) {
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
|
|
334
|
+
r.preventDefault();
|
|
335
|
+
const c = n.find((R) => R.parser(u) && R.pattern === p.path), h = (c == null ? void 0 : c.parser(u)) || {}, y = new URLSearchParams(e.split("?")[1] || ""), v = Object.fromEntries(y.entries()) || {}, w = { ...h, ...v }, L = N[c == null ? void 0 : c.pattern];
|
|
336
|
+
console.log("[EVENTS] Navigation to", e, {
|
|
337
|
+
pattern: c == null ? void 0 : c.pattern,
|
|
338
|
+
requires_server_data: L,
|
|
339
|
+
manifest_store: N,
|
|
340
|
+
middleware: p.middleware
|
|
341
|
+
}), T(e, t, p, w, h, v, L);
|
|
318
342
|
} else
|
|
319
343
|
console.log("No matching route found for URL:", e, "- using fallback navigation");
|
|
320
344
|
}
|
|
321
345
|
}
|
|
322
|
-
}), window.addEventListener("popstate", (
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
const
|
|
346
|
+
}), window.addEventListener("popstate", (r) => {
|
|
347
|
+
const o = window.location.pathname, a = window.location.pathname + window.location.search;
|
|
348
|
+
E.url = a, E.pathname = window.location.pathname;
|
|
349
|
+
const s = "get", l = i.find((e) => e.method.toLowerCase() === s && n.find((u) => u.parser(o) && u.pattern === e.path));
|
|
326
350
|
if (l) {
|
|
327
|
-
const e = n.find((
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
|
|
351
|
+
const e = n.find((y) => y.parser(o) && y.pattern === l.path), u = (e == null ? void 0 : e.parser(o)) || {}, f = new URLSearchParams(window.location.search), p = Object.fromEntries(f.entries()) || {};
|
|
352
|
+
E.params = u, E.query = p;
|
|
353
|
+
const c = { ...u, ...p }, h = N[e == null ? void 0 : e.pattern];
|
|
354
|
+
T(a, t, l, c, u, p, h, !1);
|
|
331
355
|
} else
|
|
332
|
-
console.log("No matching route found for popstate navigation to:",
|
|
356
|
+
console.log("No matching route found for popstate navigation to:", o, "- using fallback navigation"), window.location.href = o;
|
|
333
357
|
}), function() {
|
|
334
|
-
const
|
|
335
|
-
history.pushState = function(...
|
|
336
|
-
const
|
|
337
|
-
return l.state =
|
|
338
|
-
}, history.replaceState = function(...
|
|
339
|
-
const
|
|
358
|
+
const r = history.pushState, o = history.replaceState;
|
|
359
|
+
history.pushState = function(...a) {
|
|
360
|
+
const s = r.apply(this, a), l = new Event("pushstate");
|
|
361
|
+
return l.state = a[0], l.url = a[2], window.dispatchEvent(l), s;
|
|
362
|
+
}, history.replaceState = function(...a) {
|
|
363
|
+
const s = o.apply(this, a), l = a[2], e = window.location.pathname;
|
|
340
364
|
if ((l ? new URL(l, window.location.origin).pathname : e) !== e) {
|
|
341
|
-
const
|
|
342
|
-
|
|
365
|
+
const f = new Event("replacestate");
|
|
366
|
+
f.state = a[0], f.url = a[2], window.dispatchEvent(f);
|
|
343
367
|
}
|
|
344
|
-
return
|
|
368
|
+
return s;
|
|
345
369
|
};
|
|
346
|
-
}(), window.addEventListener("pushstate", (
|
|
347
|
-
const
|
|
370
|
+
}(), window.addEventListener("pushstate", (r) => {
|
|
371
|
+
const o = r.url || window.location.pathname + window.location.search, a = o.split("?")[0], s = "get", l = i.find((e) => e.method.toLowerCase() === s && n.find((u) => u.parser(a) && u.pattern === e.path));
|
|
348
372
|
if (l) {
|
|
349
|
-
const e = n.find((
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
|
|
373
|
+
const e = n.find((y) => y.parser(a) && y.pattern === l.path), u = e == null ? void 0 : e.parser(a), f = new URLSearchParams(o.split("?")[1] || ""), p = Object.fromEntries(f.entries());
|
|
374
|
+
E.url = o, E.pathname = window.location.pathname, Object.assign(E.params, u), Object.assign(E.query, p);
|
|
375
|
+
const c = { ...u, ...p }, h = N[e == null ? void 0 : e.pattern];
|
|
376
|
+
T(o, t, l, c, u, p, h, !1);
|
|
353
377
|
} else
|
|
354
|
-
console.log("No matching route found for pushstate to:",
|
|
355
|
-
}), window.addEventListener("replacestate", (
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
const
|
|
378
|
+
console.log("No matching route found for pushstate to:", a, "- using fallback navigation"), window.location.href = a;
|
|
379
|
+
}), window.addEventListener("replacestate", (r) => {
|
|
380
|
+
const o = r.url || window.location.pathname + window.location.search, a = o.split("?")[0];
|
|
381
|
+
E.url = o, E.pathname = window.location.pathname, E.query = Object.fromEntries(new URLSearchParams(o.split("?")[1] || ""));
|
|
382
|
+
const s = "get", l = i.find((e) => e.method.toLowerCase() === s && n.find((u) => u.parser(a) && u.pattern === e.path));
|
|
359
383
|
if (l) {
|
|
360
|
-
const e = n.find((
|
|
361
|
-
|
|
384
|
+
const e = n.find((y) => y.parser(a) && y.pattern === l.path), u = (e == null ? void 0 : e.parser(a)) || {}, f = new URLSearchParams(o.split("?")[1] || ""), p = Object.fromEntries(f.entries()) || {}, c = { ...u, ...p }, h = N[e == null ? void 0 : e.pattern];
|
|
385
|
+
T(o, t, l, c, u, p, h, !1);
|
|
362
386
|
} else
|
|
363
|
-
console.log("No matching route found for replacestate to:",
|
|
387
|
+
console.log("No matching route found for replacestate to:", a, "- using fallback navigation"), window.location.href = a;
|
|
364
388
|
});
|
|
365
389
|
}
|
|
366
|
-
const
|
|
367
|
-
let
|
|
390
|
+
const H = Symbol("forge-load-function");
|
|
391
|
+
let k = [], q = null;
|
|
368
392
|
function ct(t) {
|
|
369
393
|
try {
|
|
370
394
|
const i = new URL(t, window.location.origin);
|
|
@@ -374,43 +398,62 @@ function ct(t) {
|
|
|
374
398
|
}
|
|
375
399
|
}
|
|
376
400
|
function lt() {
|
|
377
|
-
typeof window < "u" && !
|
|
378
|
-
console.log("🔵 Enhanced fetch called for:", t), console.log("🔵 Initial init:", i);
|
|
401
|
+
typeof window < "u" && !q && (q = window.fetch, window.fetch = async function(t, i = {}) {
|
|
379
402
|
let n = { ...i };
|
|
380
|
-
for (const a of
|
|
403
|
+
for (const a of k)
|
|
381
404
|
try {
|
|
382
405
|
if (a.length === 2) {
|
|
383
|
-
const
|
|
384
|
-
|
|
406
|
+
const s = new Headers(n.headers), l = Object.fromEntries(s.entries());
|
|
407
|
+
await new Promise((e, u) => {
|
|
385
408
|
try {
|
|
386
|
-
a(
|
|
387
|
-
if (
|
|
388
|
-
|
|
409
|
+
a(l, (f) => {
|
|
410
|
+
if (f)
|
|
411
|
+
u(f);
|
|
389
412
|
else {
|
|
390
|
-
const
|
|
391
|
-
Object.entries(
|
|
392
|
-
|
|
393
|
-
}), n.headers =
|
|
413
|
+
const p = new Headers();
|
|
414
|
+
Object.entries(l).forEach(([c, h]) => {
|
|
415
|
+
h !== void 0 && p.set(c, h);
|
|
416
|
+
}), n.headers = p, e();
|
|
394
417
|
}
|
|
395
418
|
});
|
|
396
|
-
} catch (
|
|
397
|
-
|
|
419
|
+
} catch (f) {
|
|
420
|
+
u(f);
|
|
398
421
|
}
|
|
399
422
|
});
|
|
400
423
|
} else {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
r && typeof r == "object" ? (console.log("🟢 Middleware returned RequestInit:", r), n = r) : console.log("🟢 Middleware returned:", r);
|
|
424
|
+
const s = await a(n, t);
|
|
425
|
+
s && typeof s == "object" && (n = s);
|
|
404
426
|
}
|
|
405
|
-
} catch (
|
|
406
|
-
throw console.error("🔴 Middleware error:",
|
|
427
|
+
} catch (s) {
|
|
428
|
+
throw console.error("🔴 Middleware error:", s), s;
|
|
429
|
+
}
|
|
430
|
+
const r = n == null ? void 0 : n[H];
|
|
431
|
+
console.log("[FETCH OVERRIDE] Request", {
|
|
432
|
+
url: t,
|
|
433
|
+
hasForgeSymbol: r,
|
|
434
|
+
headers: n == null ? void 0 : n.headers
|
|
435
|
+
});
|
|
436
|
+
const o = await q(t, n);
|
|
437
|
+
if (console.log("[FETCH OVERRIDE] Response", {
|
|
438
|
+
url: t,
|
|
439
|
+
responseUrl: o.url,
|
|
440
|
+
redirected: o.redirected,
|
|
441
|
+
status: o.status,
|
|
442
|
+
type: o.type,
|
|
443
|
+
hasForgeSymbol: r
|
|
444
|
+
}), r && o.redirected) {
|
|
445
|
+
const a = typeof t == "string" ? t : t.url, s = o.url;
|
|
446
|
+
if (console.log("[FORGE REDIRECT] Detected redirect", {
|
|
447
|
+
requested: a,
|
|
448
|
+
final: s,
|
|
449
|
+
redirected: o.redirected
|
|
450
|
+
}), ct(s)) {
|
|
451
|
+
const l = new URL(s), e = l.pathname + l.search;
|
|
452
|
+
return console.log("[FORGE REDIRECT] Using pushState for SPA navigation to:", e, "from:", s), history.pushState(null, "", e), new Response(JSON.stringify({ layout: [], view: {} }), {
|
|
453
|
+
status: 200,
|
|
454
|
+
headers: { "Content-Type": "application/json" }
|
|
455
|
+
});
|
|
407
456
|
}
|
|
408
|
-
console.log("🟢 Final init after middleware:", n);
|
|
409
|
-
const o = await C(t, n);
|
|
410
|
-
if (o.status >= 300 && o.status < 400 && i[B]) {
|
|
411
|
-
const a = o.headers.get("location");
|
|
412
|
-
if (a && ct(a))
|
|
413
|
-
return window.location.href = a, o;
|
|
414
457
|
}
|
|
415
458
|
return o;
|
|
416
459
|
});
|
|
@@ -423,49 +466,46 @@ const ht = {
|
|
|
423
466
|
configUpdate(t) {
|
|
424
467
|
if (typeof t != "function")
|
|
425
468
|
throw new Error("Middleware must be a function");
|
|
426
|
-
|
|
469
|
+
k.push(t);
|
|
427
470
|
},
|
|
428
471
|
/**
|
|
429
472
|
* Reset all middleware
|
|
430
473
|
*/
|
|
431
474
|
reset() {
|
|
432
|
-
|
|
475
|
+
k.length = 0;
|
|
433
476
|
},
|
|
434
477
|
/**
|
|
435
478
|
* Get current middleware count (for debugging)
|
|
436
479
|
*/
|
|
437
480
|
getMiddlewareCount() {
|
|
438
|
-
return
|
|
481
|
+
return k.length;
|
|
439
482
|
}
|
|
440
483
|
};
|
|
441
|
-
let
|
|
484
|
+
let $;
|
|
442
485
|
async function wt(t, i) {
|
|
443
486
|
let n = window.__COMPONENT_DIR__ || i.component_dir;
|
|
444
487
|
if (!n && typeof n != "string")
|
|
445
488
|
throw new Error("No component directory provided");
|
|
446
|
-
let
|
|
447
|
-
if (
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
console.log("Found route:", c);
|
|
454
|
-
const l = r.parser(a) || {}, e = new URLSearchParams(window.location.search), s = Object.fromEntries(e.entries()) || {}, u = { ...l, ...s };
|
|
455
|
-
it(), at(t, n, c, u, l, s), st(n, o, T);
|
|
489
|
+
let r = window.__ROUTING__;
|
|
490
|
+
if ($ = Q(r), window && window.location) {
|
|
491
|
+
const o = (window.location.pathname || "/").split("?")[0], a = $.find((l) => l.parser(o));
|
|
492
|
+
let s = a ? r.find((l) => l.path === a.pattern) : null;
|
|
493
|
+
if (a && s) {
|
|
494
|
+
const l = a.parser(o) || {}, e = new URLSearchParams(window.location.search), u = Object.fromEntries(e.entries()) || {}, f = { ...l, ...u };
|
|
495
|
+
it(), at(t, n, s, f, l, u), st(n, r, $);
|
|
456
496
|
} else
|
|
457
|
-
console.warn("No matching route found for:",
|
|
497
|
+
console.warn("No matching route found for:", o);
|
|
458
498
|
}
|
|
459
499
|
}
|
|
460
500
|
export {
|
|
461
|
-
|
|
501
|
+
N as MANIFEST_STORE,
|
|
462
502
|
st as bootstrap_events,
|
|
463
503
|
wt as createApp,
|
|
464
504
|
ht as fetch,
|
|
465
505
|
at as loadRoute,
|
|
466
|
-
|
|
467
|
-
|
|
506
|
+
E as page,
|
|
507
|
+
yt as shadowUrl,
|
|
468
508
|
it as updateManifestStore,
|
|
469
|
-
|
|
509
|
+
T as updateRoute
|
|
470
510
|
};
|
|
471
511
|
//# sourceMappingURL=client.mjs.map
|