@voltro/web 0.52.0 → 0.54.0

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/index.js CHANGED
@@ -2,29 +2,29 @@ import { t as e } from "./globalContext-AuflFFmy.js";
2
2
  import { AppClientsContext as t, useAppClient as n } from "./hooks.js";
3
3
  import { a as r, c as i, i as a, l as o, o as s, r as c, s as l, u } from "./frameworkBoot-CnE9vzLQ.js";
4
4
  import { a as d, c as f, i as p, l as m, o as h, u as g } from "./defaultFallbacks-SQ45vAhz.js";
5
- import { getIslandComponent as _, hydrateIslandsOnPage as ee, island as te } from "./islands.js";
6
- import { c as ne, d as re, h as ie, l as ae, p as oe, u as se } from "./routerState-DAT472IC.js";
7
- import { mount as ce, noticeIslandsShipTheFullBundle as le } from "./mount.js";
8
- import { A as ue, B as de, C as fe, D as pe, E as me, F as he, G as ge, H as _e, I as v, K as y, L as b, M as x, N as S, O as C, P as w, R as T, S as E, T as D, U as O, V as k, W as A, _ as j, a as M, b as N, c as P, d as F, f as I, g as ve, h as ye, i as be, j as xe, k as Se, l as Ce, m as we, n as Te, o as Ee, p as De, q as Oe, r as ke, s as Ae, t as je, u as Me, v as Ne, w as Pe, x as Fe, y as Ie, z as Le } from "./serverContext-CzmZZwuQ.js";
9
- import { Component as Re, Suspense as ze, createElement as L, use as Be, useCallback as Ve, useContext as He, useSyncExternalStore as Ue } from "react";
10
- import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
5
+ import { getIslandComponent as _, hydrateIslandsOnPage as v, island as y } from "./islands.js";
6
+ import { c as b, d as x, f as S, g as C, l as w, m as T } from "./routerState-Cr6fTbka.js";
7
+ import { mount as E, noticeIslandsShipTheFullBundle as ee } from "./mount.js";
8
+ import { A as te, B as ne, C as re, D as ie, E as ae, F as oe, G as se, H as ce, I as le, K as ue, L as de, M as fe, N as pe, O as me, P as he, R as ge, S as _e, T as ve, U as ye, V as be, W as D, _ as O, a as k, b as A, c as j, d as M, f as N, g as xe, h as Se, i as Ce, j as we, k as Te, l as Ee, m as De, n as Oe, o as ke, p as Ae, q as je, r as Me, s as Ne, t as Pe, u as Fe, v as Ie, w as Le, x as Re, y as ze, z as Be } from "./serverContext-BwzZ6Q7d.js";
9
+ import { Component as Ve, Suspense as He, createElement as P, use as Ue, useCallback as We, useContext as Ge, useEffect as Ke, useSyncExternalStore as qe } from "react";
10
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
11
11
  export * from "@voltro/client";
12
12
  export * from "@voltro/ui";
13
13
  //#region src/await.tsx
14
- var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PURE__ */ z(ze, {
14
+ var R = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PURE__ */ I(He, {
15
15
  fallback: t,
16
- children: /* @__PURE__ */ z(Ke, {
16
+ children: /* @__PURE__ */ I(Ye, {
17
17
  errorFallback: r,
18
- children: /* @__PURE__ */ z(Ge, {
18
+ children: /* @__PURE__ */ I(Je, {
19
19
  value: e,
20
20
  errorFallback: r ?? null,
21
21
  children: n
22
22
  })
23
23
  })
24
- }), V = ({ body: e }) => /* @__PURE__ */ z("script", { dangerouslySetInnerHTML: { __html: e } }), Ge = ({ value: e, errorFallback: t, children: n }) => {
25
- let r = Be(e), i = se(e), a = ie(r);
26
- return a === void 0 ? /* @__PURE__ */ B(R, { children: [i === void 0 ? null : /* @__PURE__ */ z(V, { body: re(i, r) }), n(r)] }) : /* @__PURE__ */ B(R, { children: [i === void 0 ? null : /* @__PURE__ */ z(V, { body: ae(i, a) }), t] });
27
- }, Ke = class extends Re {
24
+ }), z = ({ body: e }) => /* @__PURE__ */ I("script", { dangerouslySetInnerHTML: { __html: e } }), Je = ({ value: e, errorFallback: t, children: n }) => {
25
+ let r = Ue(e), i = x(e), a = C(r);
26
+ return a === void 0 ? /* @__PURE__ */ L(F, { children: [i === void 0 ? null : /* @__PURE__ */ I(z, { body: S(i, r) }), n(r)] }) : /* @__PURE__ */ L(F, { children: [i === void 0 ? null : /* @__PURE__ */ I(z, { body: w(i, a) }), t] });
27
+ }, Ye = class extends Ve {
28
28
  state = { error: void 0 };
29
29
  static getDerivedStateFromError(e) {
30
30
  return { error: e };
@@ -32,7 +32,7 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
32
32
  render() {
33
33
  return this.state.error === void 0 ? this.props.children : this.props.errorFallback ?? null;
34
34
  }
35
- }, H = ({ src: e }) => e, U = e("imageConfig", { loader: H }), qe = ({ loader: e, children: t }) => L(U.Provider, { value: { loader: e } }, t), W = [
35
+ }, Xe = (e) => typeof e == "object" && !!e && typeof e.src == "string", B = ({ src: e }) => e, V = e("imageConfig", { loader: B }), Ze = ({ loader: e, children: t }) => P(V.Provider, { value: { loader: e } }, t), H = [
36
36
  640,
37
37
  750,
38
38
  828,
@@ -41,8 +41,8 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
41
41
  1920,
42
42
  2048,
43
43
  3840
44
- ], Je = (e, t, n, r) => {
45
- let i = n !== void 0 && !r ? Array.from(new Set(W.filter((e) => e <= n * 2).concat(n))).sort((e, t) => e - t) : [...W];
44
+ ], Qe = (e, t, n, r) => {
45
+ let i = n !== void 0 && !r ? Array.from(new Set(H.filter((e) => e <= n * 2).concat(n))).sort((e, t) => e - t) : [...H];
46
46
  return {
47
47
  srcSet: i.map((n) => `${e({
48
48
  src: t,
@@ -53,43 +53,153 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
53
53
  width: i[i.length - 1]
54
54
  })
55
55
  };
56
- }, Ye = ({ src: e, alt: t, width: n, height: r, fill: i = !1, sizes: a, priority: o = !1, loader: s, placeholder: c = "empty", blurDataURL: l, style: u, ...d }) => {
57
- let f = He(U).loader, p = s ?? f;
58
- !i && (n === void 0 || r === void 0) && typeof console < "u" && console.warn(`<Image src="${e}"> needs both width and height (or fill) to reserve layout space and avoid CLS.`);
59
- let { srcSet: m, fallback: h } = Je(p, e, n, i), g = c === "blur" && l ? {
60
- backgroundImage: `url(${l})`,
56
+ }, $e = ({ src: e, alt: t, width: n, height: r, fill: i = !1, sizes: a, priority: o = !1, loader: s, quality: c, placeholder: l, blurDataURL: u, style: d, ...f }) => {
57
+ let p = Ge(V).loader, m = s ?? p, h = c === void 0 ? m : (e) => m({
58
+ ...e,
59
+ quality: c
60
+ }), g = Xe(e) ? e : void 0, _ = g === void 0 ? e : g.src, v = n ?? (g !== void 0 && g.width > 0 ? g.width : void 0), y = r ?? (g !== void 0 && g.height > 0 ? g.height : void 0), b = u ?? (g !== void 0 && g.blurDataURL !== "" ? g.blurDataURL : void 0), x = l ?? (b !== void 0 && g !== void 0 ? "blur" : "empty");
61
+ !i && (v === void 0 || y === void 0) && typeof console < "u" && console.warn(`<Image src="${_}"> needs both width and height (or fill) to reserve layout space and avoid CLS.`);
62
+ let { srcSet: S, fallback: C } = g !== void 0 && g.srcSet !== "" ? {
63
+ srcSet: g.srcSet,
64
+ fallback: g.src
65
+ } : Qe(h, _, v, i), w = x === "blur" && b ? {
66
+ backgroundImage: `url(${b})`,
61
67
  backgroundSize: "cover",
62
68
  backgroundPosition: "center"
63
- } : {}, _ = i ? {
69
+ } : {}, T = i ? {
64
70
  position: "absolute",
65
71
  inset: 0,
66
72
  height: "100%",
67
73
  width: "100%",
68
74
  objectFit: "cover"
69
- } : {};
70
- return L("img", {
71
- src: h,
72
- srcSet: m,
75
+ } : {}, E = P("img", {
76
+ src: C,
77
+ srcSet: S === "" ? void 0 : S,
73
78
  sizes: a ?? (i ? "100vw" : void 0),
74
79
  alt: t,
75
80
  ...i ? {} : {
76
- width: n,
77
- height: r
81
+ width: v,
82
+ height: y
78
83
  },
79
84
  loading: o ? "eager" : "lazy",
80
85
  decoding: "async",
81
86
  ...o ? { fetchPriority: "high" } : {},
82
87
  style: {
83
- ...g,
84
- ..._,
85
- ...u
88
+ ...w,
89
+ ...T,
90
+ ...d
86
91
  },
87
- ...d
92
+ ...f
88
93
  });
89
- }, Xe = ({ to: e, children: t, className: n }) => L("a", {
94
+ return g !== void 0 && g.sources.length > 0 ? P("picture", null, ...g.sources.map((e) => P("source", {
95
+ key: e.type,
96
+ type: e.type,
97
+ srcSet: e.srcSet,
98
+ sizes: a ?? (i ? "100vw" : void 0)
99
+ })), E) : E;
100
+ }, et = Symbol.for("@voltro/web/script:registry"), U = () => {
101
+ let e = globalThis;
102
+ return e[et] ??= /* @__PURE__ */ new Map();
103
+ }, tt = () => {
104
+ U().clear();
105
+ }, W = (e, t, n) => {
106
+ e.status = t, e.error = n;
107
+ let r = e.listeners.splice(0);
108
+ for (let e of r) t === "loaded" ? e.onLoad?.() : e.onError?.(n);
109
+ }, G = (e, t) => {
110
+ let n = U(), r = n.get(t);
111
+ if (r !== void 0) {
112
+ if (r.status === "loaded" || r.status === "error") {
113
+ let t = !1;
114
+ return queueMicrotask(() => {
115
+ t || (r.status === "loaded" ? e.onLoad?.() : e.onError?.(r.error));
116
+ }), () => {
117
+ t = !0;
118
+ };
119
+ }
120
+ let t = {
121
+ onLoad: e.onLoad,
122
+ onError: e.onError
123
+ };
124
+ return r.listeners.push(t), () => {
125
+ let e = r.listeners.indexOf(t);
126
+ e !== -1 && r.listeners.splice(e, 1);
127
+ };
128
+ }
129
+ let i = {
130
+ status: "loading",
131
+ listeners: []
132
+ };
133
+ n.set(t, i);
134
+ let a = document.createElement("script"), o = e.nonce ?? document.querySelector("script[nonce]")?.nonce;
135
+ o !== void 0 && o !== "" && (a.nonce = o), e.id !== void 0 && (a.id = e.id);
136
+ for (let [t, n] of Object.entries(e.attributes ?? {})) a.setAttribute(t, n);
137
+ if (e.src !== void 0) {
138
+ a.addEventListener("load", () => {
139
+ W(i, "loaded");
140
+ }), a.addEventListener("error", (e) => {
141
+ W(i, "error", e);
142
+ });
143
+ let t = {
144
+ onLoad: e.onLoad,
145
+ onError: e.onError
146
+ };
147
+ return i.listeners.push(t), a.src = e.src, document.body.appendChild(a), () => {
148
+ let e = i.listeners.indexOf(t);
149
+ e !== -1 && i.listeners.splice(e, 1);
150
+ };
151
+ }
152
+ a.textContent = e.children ?? "";
153
+ try {
154
+ document.body.appendChild(a), W(i, "loaded"), e.onLoad?.();
155
+ } catch (t) {
156
+ W(i, "error", t), e.onError?.(t);
157
+ }
158
+ }, nt = (e) => {
159
+ let t = globalThis;
160
+ if (typeof t.requestIdleCallback == "function") {
161
+ let n = t.requestIdleCallback(e);
162
+ return () => t.cancelIdleCallback?.(n);
163
+ }
164
+ let n = setTimeout(e, 0);
165
+ return () => clearTimeout(n);
166
+ }, rt = ({ src: e, children: t, id: n, strategy: r = "afterInteractive", onLoad: i, onError: a, nonce: o, attributes: s }) => (Ke(() => {
167
+ if (e === void 0 && (t === void 0 || t === "")) {
168
+ console.warn("<Script> needs either src or inline children — rendered nothing.");
169
+ return;
170
+ }
171
+ if (e === void 0 && n === void 0) {
172
+ console.error("<Script> with inline children requires an `id` (the dedupe key). Script not injected.");
173
+ return;
174
+ }
175
+ let c = e ?? `inline:${n}`, l = {
176
+ ...e === void 0 ? {} : { src: e },
177
+ ...t === void 0 ? {} : { children: t },
178
+ ...n === void 0 ? {} : { id: n },
179
+ ...i ? { onLoad: i } : {},
180
+ ...a ? { onError: a } : {},
181
+ ...o === void 0 ? {} : { nonce: o },
182
+ ...s === void 0 ? {} : { attributes: s }
183
+ };
184
+ if (r === "lazyOnload") {
185
+ let e, t = nt(() => {
186
+ e = G(l, c);
187
+ });
188
+ return () => {
189
+ t(), e?.();
190
+ };
191
+ }
192
+ return G(l, c);
193
+ }, []), null), it = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""), at = (e) => {
194
+ let t = `--font-${it(e)}`;
195
+ return {
196
+ variable: t,
197
+ fontFamily: `var(${t})`
198
+ };
199
+ }, ot = ({ to: e, children: t, className: n }) => P("a", {
90
200
  href: e,
91
201
  className: n
92
- }, t), Ze = {
202
+ }, t), st = {
93
203
  position: "sticky",
94
204
  top: 0,
95
205
  zIndex: 10,
@@ -100,13 +210,13 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
100
210
  padding: "1rem 1.5rem",
101
211
  borderBottom: "1px solid var(--voltro-blog-border, rgba(127,127,127,0.2))",
102
212
  backdropFilter: "blur(8px)"
103
- }, Qe = {
213
+ }, ct = {
104
214
  maxWidth: "48rem",
105
215
  margin: "0 auto",
106
216
  padding: "2rem 1.5rem",
107
217
  width: "100%"
108
- }, $e = (e) => {
109
- let { brand: t, topNav: n, children: r, pathname: i, footer: a, breadcrumbs: o, headerRight: s } = e, c = e.Link ?? Xe, l = L("nav", {
218
+ }, lt = (e) => {
219
+ let { brand: t, topNav: n, children: r, pathname: i, footer: a, breadcrumbs: o, headerRight: s } = e, c = e.Link ?? ot, l = P("nav", {
110
220
  className: "voltro-blog-nav",
111
221
  style: {
112
222
  display: "flex",
@@ -115,20 +225,20 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
115
225
  }
116
226
  }, ...n.map((e) => {
117
227
  let t = i === e.href;
118
- return L(c, {
228
+ return P(c, {
119
229
  key: e.href,
120
230
  to: e.href,
121
231
  className: t ? "voltro-blog-nav-link is-active" : "voltro-blog-nav-link",
122
232
  children: e.label
123
233
  });
124
- })), u = L("header", {
234
+ })), u = P("header", {
125
235
  className: "voltro-blog-header",
126
- style: Ze
127
- }, L("div", { className: "voltro-blog-brand" }, t), s ? L("div", { style: {
236
+ style: st
237
+ }, P("div", { className: "voltro-blog-brand" }, t), s ? P("div", { style: {
128
238
  display: "flex",
129
239
  gap: "1rem",
130
240
  alignItems: "center"
131
- } }, l, s) : l), d = o && o.length > 0 ? L("nav", {
241
+ } }, l, s) : l), d = o && o.length > 0 ? P("nav", {
132
242
  className: "voltro-blog-breadcrumbs",
133
243
  "aria-label": "Breadcrumb",
134
244
  style: {
@@ -139,19 +249,19 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
139
249
  gap: "0.5rem"
140
250
  }
141
251
  }, ...o.flatMap((e, t) => {
142
- let n = t === o.length - 1, r = e.href && !n ? L(c, {
252
+ let n = t === o.length - 1, r = e.href && !n ? P(c, {
143
253
  key: `c${t}`,
144
254
  to: e.href,
145
255
  children: e.label
146
- }) : L("span", {
256
+ }) : P("span", {
147
257
  key: `c${t}`,
148
258
  "aria-current": n ? "page" : void 0
149
259
  }, e.label);
150
- return n ? [r] : [r, L("span", { key: `s${t}` }, "/")];
151
- })) : null, f = L("main", {
260
+ return n ? [r] : [r, P("span", { key: `s${t}` }, "/")];
261
+ })) : null, f = P("main", {
152
262
  className: "voltro-blog-main",
153
- style: Qe
154
- }, d, r), p = a ? L("footer", {
263
+ style: ct
264
+ }, d, r), p = a ? P("footer", {
155
265
  className: "voltro-blog-footer",
156
266
  style: {
157
267
  maxWidth: "48rem",
@@ -160,32 +270,32 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
160
270
  borderTop: "1px solid var(--voltro-blog-border, rgba(127,127,127,0.2))"
161
271
  }
162
272
  }, a) : null;
163
- return L("div", { className: "voltro-blog-layout" }, u, f, p);
164
- }, G = (e) => {
273
+ return P("div", { className: "voltro-blog-layout" }, u, f, p);
274
+ }, K = (e) => {
165
275
  if (e === "" || e === "/") return "/";
166
276
  let t = e.startsWith("/") ? e : `/${e}`;
167
277
  return t.endsWith("/") ? t.slice(0, -1) : t;
168
- }, K = (e, t) => {
169
- let n = e.endsWith("/") ? e.slice(0, -1) : e, r = G(t);
278
+ }, q = (e, t) => {
279
+ let n = e.endsWith("/") ? e.slice(0, -1) : e, r = K(t);
170
280
  return r === "/" ? `${n}/` : `${n}${r}`;
171
- }, q = (e, t, n) => {
172
- let r = G(e);
281
+ }, J = (e, t, n) => {
282
+ let r = K(e);
173
283
  return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
174
- }, J = (e, t) => K(e, t), et = (e) => {
175
- let { siteUrl: t, path: n, locale: r, locales: i, defaultLocale: a, xDefault: o = !0 } = e, s = K(t, q(n, r, a)), c = i.map((e) => ({
284
+ }, ut = (e, t) => q(e, t), dt = (e) => {
285
+ let { siteUrl: t, path: n, locale: r, locales: i, defaultLocale: a, xDefault: o = !0 } = e, s = q(t, J(n, r, a)), c = i.map((e) => ({
176
286
  rel: "alternate",
177
287
  hreflang: e,
178
- href: K(t, q(n, e, a))
288
+ href: q(t, J(n, e, a))
179
289
  }));
180
290
  return o && c.push({
181
291
  rel: "alternate",
182
292
  hreflang: "x-default",
183
- href: K(t, q(n, a, a))
293
+ href: q(t, J(n, a, a))
184
294
  }), {
185
295
  canonical: s,
186
296
  links: c
187
297
  };
188
- }, Y = "voltro:theme", tt = 31536e3, nt = () => {
298
+ }, Y = "voltro:theme", ft = 31536e3, pt = () => {
189
299
  if (typeof document > "u") return "system";
190
300
  try {
191
301
  let e = document.cookie.match(/(?:^|;\s*)voltro:theme=([^;]*)/), t = e?.[1] === void 0 ? "" : decodeURIComponent(e[1]);
@@ -193,17 +303,17 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
193
303
  } catch {
194
304
  return "system";
195
305
  }
196
- }, rt = () => {
306
+ }, mt = () => {
197
307
  if (typeof window > "u" || !window.matchMedia) return !1;
198
308
  try {
199
309
  return window.matchMedia("(prefers-color-scheme: dark)").matches;
200
310
  } catch {
201
311
  return !1;
202
312
  }
203
- }, X = (e) => e === "system" ? rt() ? "dark" : "light" : e, Z = 0, Q = /* @__PURE__ */ new Set(), $ = () => {
313
+ }, X = (e) => e === "system" ? mt() ? "dark" : "light" : e, Z = 0, Q = /* @__PURE__ */ new Set(), $ = () => {
204
314
  Z++;
205
315
  for (let e of Q) e();
206
- }, it = (e) => {
316
+ }, ht = (e) => {
207
317
  Q.add(e);
208
318
  let t, n = () => $();
209
319
  if (typeof window < "u" && window.matchMedia) try {
@@ -215,21 +325,21 @@ var We = ({ value: e, fallback: t, children: n, errorFallback: r }) => /* @__PUR
215
325
  t?.removeEventListener("change", n);
216
326
  } catch {}
217
327
  };
218
- }, at = () => {
219
- let e = nt();
328
+ }, gt = () => {
329
+ let e = pt();
220
330
  return `${Z}:${e}:${X(e)}`;
221
- }, ot = () => "0:system:light", st = () => {
222
- let [, e, t] = Ue(it, at, ot).split(":");
331
+ }, _t = () => "0:system:light", vt = () => {
332
+ let [, e, t] = qe(ht, gt, _t).split(":");
223
333
  return {
224
334
  theme: e,
225
335
  resolvedTheme: t,
226
- setTheme: Ve((e) => {
336
+ setTheme: We((e) => {
227
337
  if (typeof document < "u") try {
228
- document.cookie = e === "system" ? `${Y}=; path=/; max-age=0; SameSite=Lax` : `${Y}=${e}; path=/; max-age=${tt}; SameSite=Lax`, document.documentElement.classList.toggle("dark", X(e) === "dark");
338
+ document.cookie = e === "system" ? `${Y}=; path=/; max-age=0; SameSite=Lax` : `${Y}=${e}; path=/; max-age=${ft}; SameSite=Lax`, document.documentElement.classList.toggle("dark", X(e) === "dark");
229
339
  } catch {}
230
340
  $();
231
341
  }, [])
232
342
  };
233
- }, ct = "framework-web";
343
+ }, yt = "framework-web";
234
344
  //#endregion
235
- export { t as AppClientsContext, We as Await, $e as BlogLayout, p as FallbackStringsProvider, Ye as Image, qe as ImageConfigProvider, ke as Link, be as LoaderCache, M as LoaderDataContext, Ee as NO_LOADER_DATA, i as NavigationIndicator, Le as NotFoundError, Ae as PAGE_SLOT_ATTR, P as PageSlot, Ce as PlainLink, Me as RENDER_MODES, o as ReconnectContext, de as RedirectError, F as Router, I as RouterContext, Y as THEME_COOKIE, ct as WEB_NAME, J as canonicalUrl, De as compileRoute, v as decodeSearchParams, d as defaultFallbackStrings, ne as defer, b as encodeSearchParams, we as externalUrl, ye as findNotFound, c as formatPrintf, _ as getIslandComponent, ge as getRouteSnapshot, f as getStatuses, ee as hydrateIslandsOnPage, a as installBrowserConsoleBridge, r as installServerLogRelay, oe as isDeferredLoaderResult, k as isNotFound, _e as isRedirect, te as island, K as joinUrl, ve as lazyPageRoute, j as loaderCacheKey, q as localizedPath, Ne as matchRoute, ce as mount, G as normalizePath, O as notFound, le as noticeIslandsShipTheFullBundle, Ie as pageRoute, je as parseCookieHeader, H as passthroughImageLoader, N as preloadRouteModule, m as pushStatus, A as redirect, s as registerClientTrace, Fe as renderRouterProviderTree, E as resolveAnchorNavigation, fe as resolveMeta, T as searchParamsToObject, Pe as segmentLoaderKey, et as seoAlternates, y as setRouteSnapshot, D as sortRoutesByPriority, Oe as subscribeRouteSnapshot, g as subscribeStatuses, l as subscribeTraceErrors, n as useAppClient, me as useBlocker, h as useFallbackStrings, pe as useLoaderData, C as useLocation, Se as useNavigate, ue as useOptionalLoaderData, xe as useParams, x as usePrefetch, u as useReconnect, Te as useSearchParams, S as useSetSearchParams, st as useTheme, w as withHash, he as withQuery };
345
+ export { t as AppClientsContext, R as Await, lt as BlogLayout, p as FallbackStringsProvider, $e as Image, Ze as ImageConfigProvider, Me as Link, Ce as LoaderCache, k as LoaderDataContext, ke as NO_LOADER_DATA, i as NavigationIndicator, Be as NotFoundError, Ne as PAGE_SLOT_ATTR, j as PageSlot, Ee as PlainLink, Fe as RENDER_MODES, o as ReconnectContext, ne as RedirectError, M as Router, N as RouterContext, rt as Script, Y as THEME_COOKIE, yt as WEB_NAME, ut as canonicalUrl, Ae as compileRoute, le as decodeSearchParams, d as defaultFallbackStrings, b as defer, de as encodeSearchParams, De as externalUrl, Se as findNotFound, c as formatPrintf, _ as getIslandComponent, se as getRouteSnapshot, f as getStatuses, v as hydrateIslandsOnPage, a as installBrowserConsoleBridge, r as installServerLogRelay, T as isDeferredLoaderResult, be as isNotFound, ce as isRedirect, y as island, q as joinUrl, xe as lazyPageRoute, O as loaderCacheKey, at as localFont, J as localizedPath, Ie as matchRoute, E as mount, K as normalizePath, ye as notFound, ee as noticeIslandsShipTheFullBundle, ze as pageRoute, Pe as parseCookieHeader, B as passthroughImageLoader, A as preloadRouteModule, m as pushStatus, D as redirect, s as registerClientTrace, Re as renderRouterProviderTree, tt as resetScriptRegistryForTest, _e as resolveAnchorNavigation, re as resolveMeta, ge as searchParamsToObject, Le as segmentLoaderKey, dt as seoAlternates, ue as setRouteSnapshot, ve as sortRoutesByPriority, je as subscribeRouteSnapshot, g as subscribeStatuses, l as subscribeTraceErrors, n as useAppClient, ae as useBlocker, h as useFallbackStrings, ie as useLoaderData, me as useLocation, Te as useNavigate, te as useOptionalLoaderData, we as useParams, fe as usePrefetch, u as useReconnect, Oe as useSearchParams, pe as useSetSearchParams, vt as useTheme, he as withHash, oe as withQuery };
@@ -122,6 +122,25 @@ export declare interface MiddlewareResult {
122
122
  /** Cookies to write on the response. Applied to THIS render's cookie jar too
123
123
  * — see `MiddlewareCookie`. */
124
124
  readonly setCookies?: ReadonlyArray<MiddlewareCookie>;
125
+ /**
126
+ * Headers to set on the RESPONSE — a security-header set, a
127
+ * `Content-Security-Policy`, an `X-Robots-Tag`. Applied to every response
128
+ * shape a RENDER produces (ssr, isr — cached WITH the entry so a HIT carries
129
+ * them —, the spa layout shell, loader redirects/404s). Documented limit: a
130
+ * prerendered `static` file is served without a render, so no middleware
131
+ * runs — set static-file headers at the proxy.
132
+ */
133
+ readonly responseHeaders?: Readonly<Record<string, string>>;
134
+ /**
135
+ * A per-request CSP nonce. When set, the framework stamps `nonce="…"` onto
136
+ * every script tag of THIS render — the state script, the deferred registry,
137
+ * the bootstrap modules of a streamed ssr response, and the built bundle tags
138
+ * of the shell. The POLICY header stays yours: put the same nonce into
139
+ * `responseHeaders['content-security-policy']`. `ssr` only — an isr render is
140
+ * cached and served to later requests, and a cached nonce is a lie the
141
+ * browser enforces; the render REFUSES rather than caching it silently.
142
+ */
143
+ readonly cspNonce?: string;
125
144
  }
126
145
 
127
146
  export { }
package/dist/mount.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./frameworkBoot-CnE9vzLQ.js";
2
2
  import { hydrateIslandsOnPage as t } from "./islands.js";
3
- import { o as n, r, t as i } from "./routerState-DAT472IC.js";
3
+ import { o as n, r, t as i } from "./routerState-Cr6fTbka.js";
4
4
  import { StrictMode as a } from "react";
5
5
  import { createRoot as o, hydrateRoot as s } from "react-dom/client";
6
6
  import { applyPreloadSeeds as c, applyStoreSeeds as l } from "@voltro/client";
@@ -55,7 +55,9 @@ var e = /* @__PURE__ */ RegExp("\\u2028", "g"), t = /* @__PURE__ */ RegExp("\\u2
55
55
  }, x = (e) => {
56
56
  let { page: t, renderMode: n, interactive: r, layoutShell: i } = e;
57
57
  if (i === "artefact") throw Error(`[voltro] a layout in "${t}"'s chain uses defer() in its loader, but this page's SSR layout shell is PRERENDERED at build time into a static HTML file. defer() streams values in AFTER the shell, and a file has no "after" — the <Await> fallback would be frozen into the artefact forever. Drop defer() from the layout loader and return the values directly (the shell then prerenders as before), or give the layout per-request data so the page is served on demand.`);
58
- if (!(n === "ssr" || n === "spa" && i === "stream")) throw Error(`[voltro] "${t}" uses defer() in its loader but has renderMode: '${n}'. defer() streams values in AFTER the shell, which only a per-request response can do — '${n}' produces a stored HTML artefact with no "after". Set \`export const renderMode = 'ssr'\` on this page, or drop defer() and return the values directly.`);
58
+ let a = e.ppr === !0 && n === "isr";
59
+ if (e.ppr === !0 && n !== "isr") throw Error(`[voltro] "${t}" exports ppr = true with renderMode: '${n}'. Partial prerendering caches a SHELL and appends per-request holes, which needs the isr serve path — a '${n}' ${n === "static" ? "file is served by any static host with no way to append holes" : "page already streams per request, ppr adds nothing"}. ` + (n === "static" ? "Set `export const renderMode = 'isr'` (a long revalidate gives the same cache behaviour)." : "Drop the ppr export."));
60
+ if (!(n === "ssr" || n === "spa" && i === "stream") && !a) throw Error(`[voltro] "${t}" uses defer() in its loader but has renderMode: '${n}'. defer() streams values in AFTER the shell, which only a per-request response can do — '${n}' produces a stored HTML artefact with no "after". Set \`export const renderMode = 'ssr'\` on this page, add \`export const ppr = true\` to an isr page (partial prerendering: cached shell + per-request holes), or drop defer() and return the values directly.`);
59
61
  if (r !== "full") throw Error(`[voltro] "${t}" uses defer() in its loader but has interactive: '${r}'. ` + (r === "none" ? "Revealing a streamed <Suspense> boundary requires React's inline reveal scripts, and interactive: 'none' ships no JS at all — the <Await> fallback would be permanent. " : "interactive: 'islands' never hydrates the page's React root, so nothing consumes the streamed values and the <Await> fallback would be permanent. ") + "Remove the `interactive` export (defaults to 'full'), or drop defer() and return the values directly.");
60
62
  }, S = "__voltro_state__", C = (e) => {
61
63
  let t = Object.keys(e.segmentLoaderData ?? {}).map((e) => Number(e)).filter((e) => Number.isInteger(e)).sort((e, t) => e - t), n = e.deferredPageIds !== void 0, r = e.deferredSegmentIds !== void 0 && Object.keys(e.deferredSegmentIds).length > 0;
@@ -112,4 +114,4 @@ var e = /* @__PURE__ */ RegExp("\\u2028", "g"), t = /* @__PURE__ */ RegExp("\\u2
112
114
  k = e;
113
115
  }, j = () => k;
114
116
  //#endregion
115
- export { n as _, w as a, i as c, m as d, o as f, p as g, y as h, j as i, h as l, b as m, C as n, A as o, a as p, D as r, x as s, S as t, l as u };
117
+ export { p as _, w as a, i as c, l as d, m as f, y as g, b as h, j as i, h as l, a as m, C as n, A as o, o as p, D as r, x as s, S as t, u, n as v };