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