@cloudhal/astro-renderer 0.0.0-stage → 0.1.1
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/LICENSE +202 -0
- package/README.md +36 -2
- package/dist/src/ambient-client.d.ts +17 -0
- package/dist/src/ambient-client.js +55 -0
- package/dist/src/analytics-client.d.ts +17 -0
- package/dist/src/analytics-client.js +96 -0
- package/dist/src/analytics-middleware.d.ts +6 -0
- package/dist/src/analytics-middleware.js +43 -0
- package/dist/src/analytics-node.d.ts +46 -0
- package/dist/src/analytics-node.js +134 -0
- package/dist/src/analytics.d.ts +117 -0
- package/dist/src/analytics.js +372 -0
- package/dist/src/archive.d.ts +106 -0
- package/dist/src/archive.js +207 -0
- package/dist/src/astro-env.d.ts +21 -0
- package/dist/src/block-html.d.ts +14 -0
- package/dist/src/block-html.js +103 -0
- package/dist/src/blocks.d.ts +24 -0
- package/dist/src/blocks.js +66 -0
- package/dist/src/cache-tags.d.ts +25 -0
- package/dist/src/cache-tags.js +59 -0
- package/dist/src/carousel-client.d.ts +28 -0
- package/dist/src/carousel-client.js +67 -0
- package/dist/src/chart.d.ts +34 -0
- package/dist/src/chart.js +182 -0
- package/dist/src/chrome-client.d.ts +27 -0
- package/dist/src/chrome-client.js +64 -0
- package/dist/src/cloudflare-entry.d.ts +87 -0
- package/dist/src/cloudflare-entry.js +548 -0
- package/dist/src/comments-client.d.ts +11 -0
- package/dist/src/comments-client.js +58 -0
- package/dist/src/comments-html.d.ts +42 -0
- package/dist/src/comments-html.js +303 -0
- package/dist/src/comments-middleware.d.ts +6 -0
- package/dist/src/comments-middleware.js +38 -0
- package/dist/src/comments-node.d.ts +42 -0
- package/dist/src/comments-node.js +112 -0
- package/dist/src/comments-view.d.ts +68 -0
- package/dist/src/comments-view.js +174 -0
- package/dist/src/comments.d.ts +66 -0
- package/dist/src/comments.js +258 -0
- package/dist/src/components/Block.astro +39 -0
- package/dist/src/components/Body.astro +43 -0
- package/dist/src/components/Comments.astro +19 -0
- package/dist/src/components/ContentList.astro +31 -0
- package/dist/src/components/EntryArticle.astro +31 -0
- package/dist/src/components/Hero.astro +36 -0
- package/dist/src/components/Image.astro +36 -0
- package/dist/src/components/RichText.astro +19 -0
- package/dist/src/components/Sections.astro +66 -0
- package/dist/src/components/SeoHead.astro +22 -0
- package/dist/src/components/Surface.astro +36 -0
- package/dist/src/components/SurfaceNode.astro +82 -0
- package/dist/src/components/index.d.ts +12 -0
- package/dist/src/components/index.js +12 -0
- package/dist/src/csp.d.ts +20 -0
- package/dist/src/csp.js +28 -0
- package/dist/src/embed-client.d.ts +38 -0
- package/dist/src/embed-client.js +98 -0
- package/dist/src/embed-middleware.d.ts +9 -0
- package/dist/src/embed-middleware.js +49 -0
- package/dist/src/feeds.d.ts +72 -0
- package/dist/src/feeds.js +246 -0
- package/dist/src/gates.d.ts +25 -0
- package/dist/src/gates.js +63 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.js +17 -0
- package/dist/src/integration.d.ts +55 -0
- package/dist/src/integration.js +244 -0
- package/dist/src/kit.d.ts +48 -0
- package/dist/src/kit.js +83 -0
- package/dist/src/locale-feeds.d.ts +29 -0
- package/dist/src/locale-feeds.js +152 -0
- package/dist/src/locale-middleware.d.ts +5 -0
- package/dist/src/locale-middleware.js +26 -0
- package/dist/src/locales.d.ts +87 -0
- package/dist/src/locales.js +336 -0
- package/dist/src/markdown.d.ts +83 -0
- package/dist/src/markdown.js +533 -0
- package/dist/src/media-middleware.d.ts +5 -0
- package/dist/src/media-middleware.js +18 -0
- package/dist/src/media-route.d.ts +47 -0
- package/dist/src/media-route.js +238 -0
- package/dist/src/media.d.ts +109 -0
- package/dist/src/media.js +298 -0
- package/dist/src/motion-client.d.ts +39 -0
- package/dist/src/motion-client.js +115 -0
- package/dist/src/navigation.d.ts +127 -0
- package/dist/src/navigation.js +382 -0
- package/dist/src/not-found.d.ts +16 -0
- package/dist/src/not-found.js +41 -0
- package/dist/src/overlay-client.d.ts +20 -0
- package/dist/src/overlay-client.js +49 -0
- package/dist/src/prefs-client.d.ts +14 -0
- package/dist/src/prefs-client.js +18 -0
- package/dist/src/preview.d.ts +70 -0
- package/dist/src/preview.js +551 -0
- package/dist/src/resolver.d.ts +71 -0
- package/dist/src/resolver.js +206 -0
- package/dist/src/routing.d.ts +108 -0
- package/dist/src/routing.js +285 -0
- package/dist/src/runtime-workerd.d.ts +87 -0
- package/dist/src/runtime-workerd.js +275 -0
- package/dist/src/runtime.d.ts +59 -0
- package/dist/src/runtime.js +153 -0
- package/dist/src/safe-urls.d.ts +13 -0
- package/dist/src/safe-urls.js +35 -0
- package/dist/src/sanitize.d.ts +7 -0
- package/dist/src/sanitize.js +217 -0
- package/dist/src/search-client.d.ts +29 -0
- package/dist/src/search-client.js +92 -0
- package/dist/src/search-limit.d.ts +36 -0
- package/dist/src/search-limit.js +66 -0
- package/dist/src/search.d.ts +64 -0
- package/dist/src/search.js +155 -0
- package/dist/src/seo.d.ts +85 -0
- package/dist/src/seo.js +468 -0
- package/dist/src/site-dispatch.d.ts +37 -0
- package/dist/src/site-dispatch.js +86 -0
- package/dist/src/site-hosts.d.ts +35 -0
- package/dist/src/site-hosts.js +110 -0
- package/dist/src/source.d.ts +227 -0
- package/dist/src/source.js +794 -0
- package/dist/src/static-gates.d.ts +3 -0
- package/dist/src/static-gates.js +28 -0
- package/dist/src/static-headers.d.ts +30 -0
- package/dist/src/static-headers.js +140 -0
- package/dist/src/static-media.d.ts +4 -0
- package/dist/src/static-media.js +65 -0
- package/dist/src/static-redirects.d.ts +4 -0
- package/dist/src/static-redirects.js +40 -0
- package/dist/src/surface-client.d.ts +34 -0
- package/dist/src/surface-client.js +146 -0
- package/dist/src/surfaces/html.d.ts +35 -0
- package/dist/src/surfaces/html.js +184 -0
- package/dist/src/surfaces/markup.d.ts +57 -0
- package/dist/src/surfaces/markup.js +135 -0
- package/dist/src/surfaces/motion.d.ts +33 -0
- package/dist/src/surfaces/motion.js +132 -0
- package/dist/src/surfaces/primitives/carousel.d.ts +2 -0
- package/dist/src/surfaces/primitives/carousel.js +95 -0
- package/dist/src/surfaces/primitives/content.d.ts +13 -0
- package/dist/src/surfaces/primitives/content.js +159 -0
- package/dist/src/surfaces/primitives/data.d.ts +5 -0
- package/dist/src/surfaces/primitives/data.js +80 -0
- package/dist/src/surfaces/primitives/index.d.ts +54 -0
- package/dist/src/surfaces/primitives/index.js +106 -0
- package/dist/src/surfaces/primitives/inputs.d.ts +8 -0
- package/dist/src/surfaces/primitives/inputs.js +68 -0
- package/dist/src/surfaces/primitives/layout.d.ts +14 -0
- package/dist/src/surfaces/primitives/layout.js +61 -0
- package/dist/src/surfaces/primitives/motion.d.ts +9 -0
- package/dist/src/surfaces/primitives/motion.js +45 -0
- package/dist/src/surfaces/primitives/overlays.d.ts +6 -0
- package/dist/src/surfaces/primitives/overlays.js +79 -0
- package/dist/src/surfaces/tree.d.ts +107 -0
- package/dist/src/surfaces/tree.js +321 -0
- package/dist/src/surfaces.d.ts +14 -0
- package/dist/src/surfaces.js +33 -0
- package/dist/src/taxonomy.d.ts +86 -0
- package/dist/src/taxonomy.js +268 -0
- package/dist/src/theme-settings.d.ts +24 -0
- package/dist/src/theme-settings.js +111 -0
- package/package.json +219 -3
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudhal's carousel module (RFC-0027 27b): what a carousel needs beyond scroll snap. A
|
|
3
|
+
* self-contained, versioned file under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by
|
|
4
|
+
* surfaces with a `Carousel`. Without it every slide is still reachable by scrolling and by the
|
|
5
|
+
* marker links; with it:
|
|
6
|
+
*
|
|
7
|
+
* - The arrows appear (`data-ch-pending` goes) and move by a slide (hero) or by what is in view
|
|
8
|
+
* (rail), through `scrollIntoView` (the browser handles right-to-left and the site's
|
|
9
|
+
* `scroll-behavior`); at the ends they say so (`aria-disabled`).
|
|
10
|
+
* - The current slide is tracked (from the slides' boxes on `scroll` and `scrollend`) and shown on its marker
|
|
11
|
+
* (`aria-current`); a marker click scrolls the track instead of jumping the page or the hash.
|
|
12
|
+
* - After the reader moves, a polite live region names the slide ("2 of 5").
|
|
13
|
+
* - A hero's or gallery's slides out of view are `inert` (one slide in view: Tab never lands on
|
|
14
|
+
* what cannot be seen).
|
|
15
|
+
* - 27d: a hero with `data-loop` wraps at its ends. A hero with `data-autoplay` (slow 8 s, normal 6 s)
|
|
16
|
+
* moves on its own only while the site's motion is standard or expressive, the reader has not
|
|
17
|
+
* asked for reduced motion or paused motion, the tab is visible and the carousel is in view; it
|
|
18
|
+
* pauses on hover and stops for good on focus inside, a pointer press or a swipe; its rotation
|
|
19
|
+
* control (first in Tab order, shown only where motion may play) stops and restarts it; the
|
|
20
|
+
* live region is silent while it plays.
|
|
21
|
+
* No scroll hijacking: swipe and wheel stay native.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const code = String.raw`const d=document;
|
|
25
|
+
for(const box of d.querySelectorAll(".ch-carousel")){const track=box.querySelector(".ch-carousel__track");if(!track)continue;
|
|
26
|
+
const slides=[...track.children].filter((e)=>e.classList.contains("ch-carousel__slide"));if(!slides.length)continue;
|
|
27
|
+
const v=box.getAttribute("data-variant"),hero=v==="hero",single=hero||v==="gallery",loop=hero&&box.hasAttribute("data-loop");const prev=box.querySelector('[data-ch-carousel="prev"]'),next=box.querySelector('[data-ch-carousel="next"]');
|
|
28
|
+
const marks=[...box.querySelectorAll(".ch-carousel__markers a")];let seen=new Set(),current=0,said=false,timer=0,auto=false,stop=()=>{};
|
|
29
|
+
const live=d.createElement("p");live.className="sr-only";live.setAttribute("aria-live","polite");box.append(live);
|
|
30
|
+
const measure=()=>{const r=track.getBoundingClientRect();seen=new Set(slides.filter((s)=>{const b=s.getBoundingClientRect();const w=Math.min(b.right,r.right)-Math.max(b.left,r.left);return b.width>0&&w/b.width>=0.6;}));};
|
|
31
|
+
const sync=()=>{measure();const shown=slides.map((s,i)=>seen.has(s)?i:-1).filter((i)=>i>=0);if(shown.length)current=shown[0];
|
|
32
|
+
const last=shown.length?shown[shown.length-1]:current;
|
|
33
|
+
marks.forEach((m,i)=>{if(i===current)m.setAttribute("aria-current","true");else m.removeAttribute("aria-current");});
|
|
34
|
+
if(prev)prev.setAttribute("aria-disabled",String(!loop&¤t<=0));if(next)next.setAttribute("aria-disabled",String(!loop&&last>=slides.length-1));
|
|
35
|
+
if(single)slides.forEach((s,i)=>{s.inert=i!==current;});
|
|
36
|
+
if(said){said=false;live.textContent=slides[current].getAttribute("aria-label")||"";}auto=false;};
|
|
37
|
+
track.addEventListener("scroll",()=>{if(!auto&&!said)stop();clearTimeout(timer);timer=setTimeout(sync,90);},{passive:true});
|
|
38
|
+
track.addEventListener("scrollend",()=>{clearTimeout(timer);sync();});
|
|
39
|
+
addEventListener("resize",()=>{clearTimeout(timer);timer=setTimeout(sync,90);},{passive:true});
|
|
40
|
+
const go=(i)=>{if(loop)i=(i+slides.length)%slides.length;const to=slides[Math.max(0,Math.min(slides.length-1,i))];said=true;to.scrollIntoView({block:"nearest",inline:"start"});clearTimeout(timer);timer=setTimeout(sync,400);};
|
|
41
|
+
const page=()=>{measure();return Math.max(1,slides.filter((s)=>seen.has(s)).length);};
|
|
42
|
+
for(const [b,dir] of [[prev,-1],[next,1]]){if(!b)continue;b.removeAttribute("data-ch-pending");
|
|
43
|
+
b.addEventListener("click",()=>{if(b.getAttribute("aria-disabled")==="true")return;go(current+dir*(single?1:page()));});}
|
|
44
|
+
marks.forEach((m,i)=>m.addEventListener("click",(e)=>{e.preventDefault();go(i);}));
|
|
45
|
+
const ms={slow:8000,normal:6000}[box.getAttribute("data-autoplay")||""],rot=box.querySelector('[data-ch-carousel="rotate"]');
|
|
46
|
+
if(hero&&ms&&rot){const h=d.documentElement;
|
|
47
|
+
const allowed=()=>["standard","expressive"].includes(h.getAttribute("data-ch-motion")||"")&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&!h.hasAttribute("data-ch-motion-paused");
|
|
48
|
+
let on=true,hover=false,t=0;
|
|
49
|
+
const show=()=>{rot.setAttribute("data-state",on?"playing":"stopped");rot.setAttribute("aria-label",rot.getAttribute(on?"data-stop":"data-start")||"");live.setAttribute("aria-live",on?"off":"polite");};
|
|
50
|
+
const tick=()=>{t=setTimeout(tick,ms);if(!on||hover||d.hidden||!allowed())return;const r=box.getBoundingClientRect();if(r.bottom<0||r.top>innerHeight)return;
|
|
51
|
+
auto=true;slides[(current+1)%slides.length].scrollIntoView({block:"nearest",inline:"start"});clearTimeout(timer);timer=setTimeout(sync,400);};
|
|
52
|
+
stop=()=>{if(!on)return;on=false;clearTimeout(t);show();};
|
|
53
|
+
if(allowed())rot.removeAttribute("data-ch-pending");
|
|
54
|
+
rot.addEventListener("click",()=>{if(on)stop();else{on=true;show();clearTimeout(t);t=setTimeout(tick,ms);}});
|
|
55
|
+
box.addEventListener("focusin",(e)=>{if(e.target!==rot)stop();});
|
|
56
|
+
box.addEventListener("pointerdown",(e)=>{if(!(e.target instanceof Node&&rot.contains(e.target)))stop();});
|
|
57
|
+
box.addEventListener("mouseenter",()=>{hover=true;});box.addEventListener("mouseleave",()=>{hover=false;});
|
|
58
|
+
show();t=setTimeout(tick,ms);}
|
|
59
|
+
sync();}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const CAROUSEL_SCRIPT = { path: "/_cloudhal/carousel.3.js", code } ;
|
|
63
|
+
/** Earlier names, still asked for by cached pages: they get the current code. */
|
|
64
|
+
export const CAROUSEL_SCRIPT_ALIASES = [
|
|
65
|
+
"/_cloudhal/carousel.1.js",
|
|
66
|
+
"/_cloudhal/carousel.2.js",
|
|
67
|
+
] ;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Chart` (RFC-0022 §3): bar, line, area and donut charts drawn as SVG from a surface's data, with
|
|
3
|
+
* a legend and the same numbers as a table (screen readers and feed readers that drop SVG still
|
|
4
|
+
* get them). No chart library and no JavaScript needed: the server draws it.
|
|
5
|
+
*
|
|
6
|
+
* `chartInner` is self-contained on purpose (no imports, no outer names): the browser runtime gets
|
|
7
|
+
* the same function as `/_cloudhal/chart.1.js` (`CHART_SCRIPT`) to redraw a chart whose data a
|
|
8
|
+
* reader changes. Colors are theme tokens (`--ch-chart-1` … `--ch-chart-6`).
|
|
9
|
+
*/
|
|
10
|
+
export interface ChartSpec {
|
|
11
|
+
kind?: unknown;
|
|
12
|
+
title?: unknown;
|
|
13
|
+
/** The rows (resolved from the surface's data). */
|
|
14
|
+
data?: unknown;
|
|
15
|
+
/** The field holding each row's category or date. */
|
|
16
|
+
x?: unknown;
|
|
17
|
+
series?: unknown;
|
|
18
|
+
unit?: unknown;
|
|
19
|
+
stacked?: unknown;
|
|
20
|
+
height?: unknown;
|
|
21
|
+
}
|
|
22
|
+
/** The figure's inside: legend, SVG and data table. Every text is escaped; numbers only in SVG. */
|
|
23
|
+
export declare function chartInner(spec: ChartSpec, locale: string, labels: {
|
|
24
|
+
data: string;
|
|
25
|
+
}): string;
|
|
26
|
+
/**
|
|
27
|
+
* The browser's copy of `chartInner` (RFC-0022 §3), loaded only for live charts. Versioned like the
|
|
28
|
+
* interaction runtime: bump the name with any change (a test pins the hash).
|
|
29
|
+
*/
|
|
30
|
+
export declare const CHART_SCRIPT: {
|
|
31
|
+
readonly path: "/_cloudhal/chart.1.js";
|
|
32
|
+
readonly code: `export const chartInner = ${string};
|
|
33
|
+
`;
|
|
34
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Chart` (RFC-0022 §3): bar, line, area and donut charts drawn as SVG from a surface's data, with
|
|
3
|
+
* a legend and the same numbers as a table (screen readers and feed readers that drop SVG still
|
|
4
|
+
* get them). No chart library and no JavaScript needed: the server draws it.
|
|
5
|
+
*
|
|
6
|
+
* `chartInner` is self-contained on purpose (no imports, no outer names): the browser runtime gets
|
|
7
|
+
* the same function as `/_cloudhal/chart.1.js` (`CHART_SCRIPT`) to redraw a chart whose data a
|
|
8
|
+
* reader changes. Colors are theme tokens (`--ch-chart-1` … `--ch-chart-6`).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/** The figure's inside: legend, SVG and data table. Every text is escaped; numbers only in SVG. */
|
|
25
|
+
export function chartInner(spec , locale , labels ) {
|
|
26
|
+
const esc = (v ) =>
|
|
27
|
+
String(v ?? "").replace(
|
|
28
|
+
/[&<>"']/g,
|
|
29
|
+
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] ?? c,
|
|
30
|
+
);
|
|
31
|
+
const isObj = (v ) =>
|
|
32
|
+
typeof v === "object" && v !== null && !Array.isArray(v);
|
|
33
|
+
const toNum = (v ) =>
|
|
34
|
+
typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : Number.NaN;
|
|
35
|
+
const kind = ["bar", "line", "area", "donut"].includes(String(spec.kind))
|
|
36
|
+
? String(spec.kind)
|
|
37
|
+
: "bar";
|
|
38
|
+
const xField = typeof spec.x === "string" ? spec.x : "";
|
|
39
|
+
const rows = (Array.isArray(spec.data) ? spec.data : []).filter(isObj).slice(0, 500);
|
|
40
|
+
const series = (Array.isArray(spec.series) ? spec.series : [])
|
|
41
|
+
.filter((s) => isObj(s) && typeof s.field === "string")
|
|
42
|
+
.slice(0, kind === "donut" ? 1 : 6)
|
|
43
|
+
.map((s) => ({ field: String(s.field), label: String(s.label ?? s.field) }));
|
|
44
|
+
const unit = typeof spec.unit === "string" ? spec.unit : "";
|
|
45
|
+
const fmt = new Intl.NumberFormat(locale, { maximumFractionDigits: 2 });
|
|
46
|
+
const num = (n ) => `${fmt.format(n)}${unit ? ` ${unit}` : ""}`;
|
|
47
|
+
const value = (r , f ) => {
|
|
48
|
+
const n = toNum(r[f]);
|
|
49
|
+
return Number.isFinite(n) ? n : 0;
|
|
50
|
+
};
|
|
51
|
+
const cats = rows.map((r) => String(r[xField] ?? ""));
|
|
52
|
+
const color = (i ) => `var(--ch-chart-${(i % 6) + 1})`;
|
|
53
|
+
const empty = rows.length === 0 || series.length === 0;
|
|
54
|
+
|
|
55
|
+
const table = `<details class="ch-chart__data"><summary>${esc(labels.data)}</summary><table><thead><tr><th scope="col">${esc(xField)}</th>${series
|
|
56
|
+
.map((s) => `<th scope="col">${esc(s.label)}</th>`)
|
|
57
|
+
.join("")}</tr></thead><tbody>${rows
|
|
58
|
+
.map(
|
|
59
|
+
(r, i) =>
|
|
60
|
+
`<tr><th scope="row">${esc(cats[i])}</th>${series.map((s) => `<td>${esc(num(value(r, s.field)))}</td>`).join("")}</tr>`,
|
|
61
|
+
)
|
|
62
|
+
.join("")}</tbody></table></details>`;
|
|
63
|
+
const legend =
|
|
64
|
+
series.length > 1 || kind === "donut"
|
|
65
|
+
? `<ul class="ch-chart__legend">${(kind === "donut"
|
|
66
|
+
? cats.map((c, i) => ({ label: c, i }))
|
|
67
|
+
: series.map((s, i) => ({ label: s.label, i }))
|
|
68
|
+
)
|
|
69
|
+
.map(
|
|
70
|
+
(l) =>
|
|
71
|
+
`<li><span class="ch-chart__swatch" style="background:${color(l.i)}"></span>${esc(l.label)}</li>`,
|
|
72
|
+
)
|
|
73
|
+
.join("")}</ul>`
|
|
74
|
+
: "";
|
|
75
|
+
if (empty) return `<p class="ch-chart__empty">–</p>${table}`;
|
|
76
|
+
|
|
77
|
+
const W = 640;
|
|
78
|
+
const H = spec.height === "s" ? 200 : spec.height === "l" ? 400 : 300;
|
|
79
|
+
const label = esc(spec.title);
|
|
80
|
+
let body = "";
|
|
81
|
+
if (kind === "donut") {
|
|
82
|
+
const s = series[0] ;
|
|
83
|
+
const vals = rows.map((r) => Math.max(0, value(r, s.field)));
|
|
84
|
+
const total = vals.reduce((a, b) => a + b, 0) || 1;
|
|
85
|
+
const cx = W / 2;
|
|
86
|
+
const cy = H / 2;
|
|
87
|
+
const R = H / 2 - 8;
|
|
88
|
+
const r0 = R * 0.6;
|
|
89
|
+
let a = -Math.PI / 2;
|
|
90
|
+
const pt = (rad , ang ) =>
|
|
91
|
+
`${(cx + rad * Math.cos(ang)).toFixed(2)} ${(cy + rad * Math.sin(ang)).toFixed(2)}`;
|
|
92
|
+
vals.forEach((v, i) => {
|
|
93
|
+
if (v <= 0) return;
|
|
94
|
+
const sweep = Math.min((v / total) * Math.PI * 2, Math.PI * 2 - 1e-4);
|
|
95
|
+
const b = a + sweep;
|
|
96
|
+
const large = sweep > Math.PI ? 1 : 0;
|
|
97
|
+
body += `<path fill="${color(i)}" d="M ${pt(R, a)} A ${R} ${R} 0 ${large} 1 ${pt(R, b)} L ${pt(r0, b)} A ${r0} ${r0} 0 ${large} 0 ${pt(r0, a)} Z"><title>${esc(cats[i])}: ${esc(num(v))}</title></path>`;
|
|
98
|
+
a = b;
|
|
99
|
+
});
|
|
100
|
+
body += `<text x="${cx}" y="${cy}" text-anchor="middle" dominant-baseline="middle" class="ch-chart__total">${esc(num(vals.reduce((x, y) => x + y, 0)))}</text>`;
|
|
101
|
+
} else {
|
|
102
|
+
const stacked = spec.stacked === true && kind !== "line";
|
|
103
|
+
const sums = rows.map((r) => series.reduce((t, s) => t + value(r, s.field), 0));
|
|
104
|
+
const all = stacked ? sums : rows.flatMap((r) => series.map((s) => value(r, s.field)));
|
|
105
|
+
const lo = Math.min(0, ...all);
|
|
106
|
+
const hi = Math.max(0, ...all);
|
|
107
|
+
const span = hi - lo || 1;
|
|
108
|
+
const rough = span / 4;
|
|
109
|
+
const mag = 10 ** Math.floor(Math.log10(rough));
|
|
110
|
+
const step = ([1, 2, 2.5, 5, 10].find((m) => m * mag >= rough) ?? 10) * mag;
|
|
111
|
+
const top = Math.ceil(hi / step) * step || step;
|
|
112
|
+
const bottom = Math.floor(lo / step) * step;
|
|
113
|
+
const L = 56;
|
|
114
|
+
const T = 12;
|
|
115
|
+
const B = 28;
|
|
116
|
+
const plotW = W - L - 8;
|
|
117
|
+
const plotH = H - T - B;
|
|
118
|
+
const y = (v ) => T + plotH - ((v - bottom) / (top - bottom || 1)) * plotH;
|
|
119
|
+
for (let t = bottom; t <= top + step / 2; t += step) {
|
|
120
|
+
body += `<line class="ch-chart__grid" x1="${L}" x2="${W - 8}" y1="${y(t).toFixed(1)}" y2="${y(t).toFixed(1)}"/><text class="ch-chart__tick" x="${L - 6}" y="${y(t).toFixed(1)}" text-anchor="end" dominant-baseline="middle">${esc(fmt.format(t))}</text>`;
|
|
121
|
+
}
|
|
122
|
+
const n = rows.length;
|
|
123
|
+
const band = plotW / n;
|
|
124
|
+
const every = Math.max(1, Math.ceil(n / 12));
|
|
125
|
+
cats.forEach((c, i) => {
|
|
126
|
+
if (i % every) return;
|
|
127
|
+
const short = c.length > 12 ? `${c.slice(0, 11)}…` : c;
|
|
128
|
+
body += `<text class="ch-chart__tick" x="${(L + band * (i + 0.5)).toFixed(1)}" y="${H - 8}" text-anchor="middle">${esc(short)}</text>`;
|
|
129
|
+
});
|
|
130
|
+
if (kind === "bar") {
|
|
131
|
+
const inner = band * 0.72;
|
|
132
|
+
rows.forEach((r, i) => {
|
|
133
|
+
let base = 0;
|
|
134
|
+
series.forEach((s, j) => {
|
|
135
|
+
const v = value(r, s.field);
|
|
136
|
+
const w = stacked ? inner : inner / series.length;
|
|
137
|
+
const x = L + band * i + (band - inner) / 2 + (stacked ? 0 : w * j);
|
|
138
|
+
const from = stacked ? base : 0;
|
|
139
|
+
const to = from + v;
|
|
140
|
+
if (stacked) base = to;
|
|
141
|
+
const y1 = y(Math.max(from, to));
|
|
142
|
+
const h = Math.abs(y(from) - y(to));
|
|
143
|
+
body += `<rect fill="${color(j)}" x="${x.toFixed(1)}" y="${y1.toFixed(1)}" width="${Math.max(1, w - 2).toFixed(1)}" height="${h.toFixed(1)}" rx="2"><title>${esc(cats[i])}, ${esc(s.label)}: ${esc(num(v))}</title></rect>`;
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
const base = rows.map(() => 0);
|
|
148
|
+
series.forEach((s, j) => {
|
|
149
|
+
const pts = rows.map((r, i) => {
|
|
150
|
+
const v = value(r, s.field) + (stacked ? (base[i] ) : 0);
|
|
151
|
+
return [L + band * (i + 0.5), y(v), v] ;
|
|
152
|
+
});
|
|
153
|
+
const line = pts.map((p) => `${p[0].toFixed(1)},${p[1].toFixed(1)}`).join(" ");
|
|
154
|
+
if (kind === "area") {
|
|
155
|
+
const floor = rows.map((_, i) => {
|
|
156
|
+
const v = stacked ? (base[i] ) : 0;
|
|
157
|
+
return `${(L + band * (i + 0.5)).toFixed(1)},${y(Math.max(v, bottom)).toFixed(1)}`;
|
|
158
|
+
});
|
|
159
|
+
body += `<polygon fill="${color(j)}" fill-opacity="0.25" points="${line} ${floor.reverse().join(" ")}"/>`;
|
|
160
|
+
}
|
|
161
|
+
body += `<polyline fill="none" stroke="${color(j)}" stroke-width="2.5" stroke-linejoin="round" points="${line}"/>`;
|
|
162
|
+
pts.forEach((p, i) => {
|
|
163
|
+
body += `<circle fill="${color(j)}" cx="${p[0].toFixed(1)}" cy="${p[1].toFixed(1)}" r="3.5"><title>${esc(cats[i])}, ${esc(s.label)}: ${esc(num(value(rows[i] , s.field)))}</title></circle>`;
|
|
164
|
+
});
|
|
165
|
+
if (stacked)
|
|
166
|
+
rows.forEach((r, i) => {
|
|
167
|
+
base[i] = (base[i] ) + value(r, s.field);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return `${legend}<svg class="ch-chart__svg" viewBox="0 0 ${W} ${H}" role="img" aria-label="${label}" preserveAspectRatio="xMidYMid meet">${body}</svg>${table}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The browser's copy of `chartInner` (RFC-0022 §3), loaded only for live charts. Versioned like the
|
|
177
|
+
* interaction runtime: bump the name with any change (a test pins the hash).
|
|
178
|
+
*/
|
|
179
|
+
export const CHART_SCRIPT = {
|
|
180
|
+
path: "/_cloudhal/chart.1.js",
|
|
181
|
+
code: `export const chartInner = ${chartInner.toString()};\n`,
|
|
182
|
+
} ;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudhal's chrome module (RFC-0025 §2): what the header needs beyond CSS. A self-contained,
|
|
3
|
+
* versioned file under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by pages whose header
|
|
4
|
+
* asks for it (a sticky, hiding, shrinking or transparent header, a drawer or full-screen menu,
|
|
5
|
+
* submenus). Without it every page still works: the menu link opens `/menu`, submenus are
|
|
6
|
+
* popovers the browser opens itself, and the header stays where CSS puts it.
|
|
7
|
+
*
|
|
8
|
+
* - `--ch-header-h` on the root follows the header's height (scroll padding, transparent heroes).
|
|
9
|
+
* - `data-ch-scrolled` on the header once the page has scrolled (fill, shrink, stuck style).
|
|
10
|
+
* - `hide-on-scroll` hides the header while the reader scrolls down and shows it on the way up,
|
|
11
|
+
* when keyboard focus is in it, and near the top; never at motion `none` or under reduced motion.
|
|
12
|
+
* - The menu link (`[data-ch-dialog]`) opens its modal dialog instead of `/menu`; a click on the
|
|
13
|
+
* backdrop or on a link inside closes it, and the browser returns focus to the link.
|
|
14
|
+
* - An open disclosure menu closes on Escape or a click elsewhere.
|
|
15
|
+
* - Submenu popovers sit under their button where CSS anchor positioning is missing (a mega panel
|
|
16
|
+
* spans the page under the header instead).
|
|
17
|
+
* - RFC-0025 25d: the announcement's close button and the consent bar's buttons, hidden without
|
|
18
|
+
* JavaScript, write the reader's choice to a first-party cookie (a year, `SameSite=Lax`) and
|
|
19
|
+
* mark the root as `prefs.1.js` does on the next page, so the bar goes at once and stays gone;
|
|
20
|
+
* `--ch-consent-h` keeps focused content clear of the consent bar.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CHROME_SCRIPT: {
|
|
23
|
+
readonly path: "/_cloudhal/chrome.2.js";
|
|
24
|
+
readonly code: string;
|
|
25
|
+
};
|
|
26
|
+
/** Earlier names, still asked for by cached pages: they get the current code. */
|
|
27
|
+
export declare const CHROME_SCRIPT_ALIASES: readonly ["/_cloudhal/chrome.1.js"];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudhal's chrome module (RFC-0025 §2): what the header needs beyond CSS. A self-contained,
|
|
3
|
+
* versioned file under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by pages whose header
|
|
4
|
+
* asks for it (a sticky, hiding, shrinking or transparent header, a drawer or full-screen menu,
|
|
5
|
+
* submenus). Without it every page still works: the menu link opens `/menu`, submenus are
|
|
6
|
+
* popovers the browser opens itself, and the header stays where CSS puts it.
|
|
7
|
+
*
|
|
8
|
+
* - `--ch-header-h` on the root follows the header's height (scroll padding, transparent heroes).
|
|
9
|
+
* - `data-ch-scrolled` on the header once the page has scrolled (fill, shrink, stuck style).
|
|
10
|
+
* - `hide-on-scroll` hides the header while the reader scrolls down and shows it on the way up,
|
|
11
|
+
* when keyboard focus is in it, and near the top; never at motion `none` or under reduced motion.
|
|
12
|
+
* - The menu link (`[data-ch-dialog]`) opens its modal dialog instead of `/menu`; a click on the
|
|
13
|
+
* backdrop or on a link inside closes it, and the browser returns focus to the link.
|
|
14
|
+
* - An open disclosure menu closes on Escape or a click elsewhere.
|
|
15
|
+
* - Submenu popovers sit under their button where CSS anchor positioning is missing (a mega panel
|
|
16
|
+
* spans the page under the header instead).
|
|
17
|
+
* - RFC-0025 25d: the announcement's close button and the consent bar's buttons, hidden without
|
|
18
|
+
* JavaScript, write the reader's choice to a first-party cookie (a year, `SameSite=Lax`) and
|
|
19
|
+
* mark the root as `prefs.1.js` does on the next page, so the bar goes at once and stays gone;
|
|
20
|
+
* `--ch-consent-h` keeps focused content clear of the consent bar.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const code = String.raw`const d=document,h=d.documentElement,hd=d.querySelector(".ch-header");
|
|
24
|
+
const keep=(k,v)=>{d.cookie=k+"="+encodeURIComponent(v)+"; Max-Age=31536000; Path=/; SameSite=Lax"+(location.protocol==="https:"?"; Secure":"");};
|
|
25
|
+
for(const b of d.querySelectorAll("[data-ch-dismiss]")){b.hidden=false;b.addEventListener("click",()=>{const id=b.getAttribute("data-ch-dismiss")||"";
|
|
26
|
+
const m=/(?:^|;\s*)ch_dismiss=([^;]*)/.exec(d.cookie),old=m?decodeURIComponent(m[1]).split(",").filter(Boolean):[];
|
|
27
|
+
keep("ch_dismiss",[...old.filter((x)=>x!==id),id].slice(-5).join(","));h.setAttribute("data-ch-announcement-dismissed","");const main=d.getElementById("main");if(main)main.focus({preventScroll:true});});}
|
|
28
|
+
const bar=d.querySelector("[data-ch-consent-bar]");
|
|
29
|
+
if(bar){const setC=()=>h.style.setProperty("--ch-consent-h",(h.hasAttribute("data-ch-consent")?0:bar.offsetHeight)+"px");setC();
|
|
30
|
+
if("ResizeObserver"in window)new ResizeObserver(setC).observe(bar);
|
|
31
|
+
for(const b of bar.querySelectorAll("[data-ch-consent-choice]")){b.hidden=false;b.addEventListener("click",()=>{const v=b.getAttribute("data-ch-consent-choice")||"ok";keep("ch_consent",v);h.setAttribute("data-ch-consent",v);setC();});}}
|
|
32
|
+
if(hd){
|
|
33
|
+
const setH=()=>h.style.setProperty("--ch-header-h",hd.offsetHeight+"px");
|
|
34
|
+
setH();if("ResizeObserver"in window)new ResizeObserver(setH).observe(hd);
|
|
35
|
+
const quiet=()=>h.getAttribute("data-ch-motion")==="none"||matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
36
|
+
const hides=hd.getAttribute("data-behavior")==="hide-on-scroll";
|
|
37
|
+
let last=scrollY,ticking=false;
|
|
38
|
+
const sync=()=>{ticking=false;const y=Math.max(0,scrollY);
|
|
39
|
+
hd.toggleAttribute("data-ch-scrolled",y>4);
|
|
40
|
+
if(hides){const near=y<hd.offsetHeight*2,down=y>last+6,up=y<last-6;
|
|
41
|
+
if(quiet()||near||up||hd.querySelector(":focus-visible"))hd.removeAttribute("data-ch-hidden");else if(down)hd.setAttribute("data-ch-hidden","");}
|
|
42
|
+
last=y;};
|
|
43
|
+
addEventListener("scroll",()=>{if(!ticking){ticking=true;requestAnimationFrame(sync);}},{passive:true});
|
|
44
|
+
hd.addEventListener("focusin",()=>hd.removeAttribute("data-ch-hidden"));
|
|
45
|
+
sync();}
|
|
46
|
+
for(const a of d.querySelectorAll("a[data-ch-dialog]")){const dlg=d.getElementById(a.getAttribute("data-ch-dialog"));
|
|
47
|
+
if(!dlg||typeof dlg.showModal!=="function")continue;
|
|
48
|
+
a.setAttribute("role","button");a.setAttribute("aria-haspopup","dialog");a.setAttribute("aria-controls",dlg.id);
|
|
49
|
+
const open=(e)=>{e.preventDefault();dlg.showModal();a.setAttribute("aria-expanded","true");};
|
|
50
|
+
a.addEventListener("click",open);a.addEventListener("keydown",(e)=>{if(e.key===" ")open(e);});
|
|
51
|
+
dlg.addEventListener("close",()=>a.setAttribute("aria-expanded","false"));
|
|
52
|
+
dlg.addEventListener("click",(e)=>{if(e.target===dlg||(e.target instanceof Element&&e.target.closest("a[href]")))dlg.close();});}
|
|
53
|
+
const menus=[...d.querySelectorAll("details.ch-menu")];
|
|
54
|
+
if(menus.length){d.addEventListener("keydown",(e)=>{if(e.key!=="Escape")return;for(const m of menus)if(m.open){m.open=false;m.querySelector("summary")?.focus();}});
|
|
55
|
+
d.addEventListener("click",(e)=>{for(const m of menus)if(m.open&&!(e.target instanceof Node&&m.contains(e.target)))m.open=false;});}
|
|
56
|
+
if(!(window.CSS&&CSS.supports("anchor-name","--a"))){for(const p of d.querySelectorAll("[popover].ch-nav-menu__pop:not(.ch-nav-menu__pop--mega)")){
|
|
57
|
+
p.addEventListener("toggle",(e)=>{if(e.newState!=="open")return;const b=d.querySelector('[popovertarget="'+p.id+'"]');if(!b)return;
|
|
58
|
+
const r=b.getBoundingClientRect();p.style.position="fixed";p.style.margin="0";p.style.top=Math.round(r.bottom+6)+"px";
|
|
59
|
+
p.style.left=Math.round(Math.max(8,Math.min(r.left,innerWidth-p.offsetWidth-8)))+"px";});}}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const CHROME_SCRIPT = { path: "/_cloudhal/chrome.2.js", code } ;
|
|
63
|
+
/** Earlier names, still asked for by cached pages: they get the current code. */
|
|
64
|
+
export const CHROME_SCRIPT_ALIASES = ["/_cloudhal/chrome.1.js"] ;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker entry for a Cloudhal site on Cloudflare (`"main"` in the site's wrangler config).
|
|
3
|
+
* Wraps the Astro handler with what a deployed Cloudhal site needs on top:
|
|
4
|
+
*
|
|
5
|
+
* - `POST /__cloudhal/purge` (Bearer `CLOUDHAL_PURGE_TOKEN`) purges this site's edge cache. The
|
|
6
|
+
* admin Worker calls it after publish/rollback. Purges are scoped to the Worker that cached the
|
|
7
|
+
* responses, which is why this lives here and not in the admin Worker (ADR-0012). A JSON body
|
|
8
|
+
* `{ "tags": [...] }` (at most 100, Cloudflare's limit per purge request) purges only those tags
|
|
9
|
+
* (`cloudhal-site-`, `-node-`, `-term-`, `-list-`, see `cache-tags.ts`) — what the admin Worker
|
|
10
|
+
* sends after working out what a publish changed; without one, everything is purged.
|
|
11
|
+
* - `GET /__cloudhal/features` (Bearer `CLOUDHAL_PURGE_TOKEN`) says what this Worker enforces, so
|
|
12
|
+
* the admin Worker never writes data an older site Worker would mishandle (RFC-0008 §7.7):
|
|
13
|
+
* `{ "gates": 1 }` — every public path checks pages' and entries' time gates per request and
|
|
14
|
+
* caps the edge cache at the next one. Until it answers so, writers refuse `availability`.
|
|
15
|
+
* - Redirects (RFC-0002) are answered by the routes themselves (real 301s, `no-store` here like
|
|
16
|
+
* every non-200), so a publish that adds or removes one needs no purge of its own.
|
|
17
|
+
* - Preview responses get every internal link rewritten to keep the signed token, so navigation
|
|
18
|
+
* stays in preview without a cookie (the edge cache does not vary on cookies). Media URLs in
|
|
19
|
+
* images, sources, video and audio keep it too, so draft media show (RFC-0004 §7.3).
|
|
20
|
+
* - `/media/<sha16>/<slug>.<ext>` (RFC-0004 §7.1) is answered here, before Astro: published media
|
|
21
|
+
* are immutable and tagged `cloudhal-media-<siteId>` / `cloudhal-asset-<id>` (not the site tag),
|
|
22
|
+
* so purging pages after a publish leaves them cached.
|
|
23
|
+
* - Site analytics (RFC-0006 §5): `POST /__cloudhal/e` takes page-view and vitals beacons (always
|
|
24
|
+
* `204`, never cached) and writes them to Workers Analytics Engine (`ANALYTICS`); published HTML
|
|
25
|
+
* pages get the `/_cloudhal/p.<hash>.js` tag while the site's setting is on (it sits in the cached
|
|
26
|
+
* HTML, so a settings change purges); responses the Worker renders become `render` events. All of
|
|
27
|
+
* it is off without `CLOUDHAL_ANALYTICS=on` and the binding (`analytics.ts`).
|
|
28
|
+
* - Reader comments (RFC-0007 §6, §15.2): `GET /__cloudhal/comments/challenge`,
|
|
29
|
+
* `POST /__cloudhal/comments` and `POST /__cloudhal/comments/report` are answered here, before
|
|
30
|
+
* Astro and never cached (`comments.ts`), with `CF-Connecting-IP` as the client address. Pages
|
|
31
|
+
* render the section themselves (`loadComments`, `<Comments />`) and set their own CSP when an
|
|
32
|
+
* open form uses Turnstile; `withSecurityHeaders` keeps it. All of it is off without a usable
|
|
33
|
+
* `CLOUDHAL_COMMENTS_KEY` (or when the build has no comments module).
|
|
34
|
+
*/
|
|
35
|
+
import { type CommentsRateLimit } from "./comments.js";
|
|
36
|
+
interface Env {
|
|
37
|
+
CLOUDHAL_SITE_ID?: string;
|
|
38
|
+
/**
|
|
39
|
+
* RFC-0034 §4: the sites a multi-site Worker serves (comma-separated); the hostname picks one
|
|
40
|
+
* through `site_hosts`. Ignored when `CLOUDHAL_SITE_ID` is set.
|
|
41
|
+
*/
|
|
42
|
+
CLOUDHAL_SITE_IDS?: string;
|
|
43
|
+
DB?: D1Database;
|
|
44
|
+
CLOUDHAL_PURGE_TOKEN?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Site analytics (RFC-0006 §11): the Workers Analytics Engine dataset (`<deployment>_events`).
|
|
47
|
+
* Without it nothing is collected and no script tag is injected.
|
|
48
|
+
*/
|
|
49
|
+
ANALYTICS?: AnalyticsEngineDataset;
|
|
50
|
+
/**
|
|
51
|
+
* Optional Workers Rate Limiting binding (`analytics.rateLimit` in cloudhal.json, RFC-0006 §5.5):
|
|
52
|
+
* a cross-isolate beacon limit on top of the per-isolate one, keyed by an HMAC derived from
|
|
53
|
+
* `CLOUDHAL_PURGE_TOKEN` (never the IP). Without it, or without the token, only the per-isolate
|
|
54
|
+
* limits apply.
|
|
55
|
+
*/
|
|
56
|
+
ANALYTICS_RL?: RateLimit;
|
|
57
|
+
/** `"on"` turns analytics on for the deployment; anything else (or absent) is off. */
|
|
58
|
+
CLOUDHAL_ANALYTICS?: string;
|
|
59
|
+
/** `cloudhal.json`'s `analytics` block as compact JSON: defaults for sites without a settings row. */
|
|
60
|
+
CLOUDHAL_ANALYTICS_DEFAULTS?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Hostnames the site answers on besides `Site.domains` (comma-separated), e.g. its workers.dev
|
|
63
|
+
* host. Requests that arrive on a `*.workers.dev` host are always accepted as the site's own.
|
|
64
|
+
*/
|
|
65
|
+
CLOUDHAL_SITE_HOSTS?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Reader comments (RFC-0007 §15.4): the deployment secret the comment keys are derived from
|
|
68
|
+
* (proof-of-work MACs, email encryption and hashes, stored owner secrets). Without it — or with
|
|
69
|
+
* fewer than 32 characters — comments are off: the endpoints answer `404`, pages show none.
|
|
70
|
+
*/
|
|
71
|
+
CLOUDHAL_COMMENTS_KEY?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Optional Workers Rate Limiting binding (`comments.rateLimit` in cloudhal.json, RFC-0007 §6.5):
|
|
74
|
+
* submissions per client across isolates, keyed by an HMAC under `CLOUDHAL_COMMENTS_KEY`.
|
|
75
|
+
*/
|
|
76
|
+
COMMENTS_RL?: CommentsRateLimit;
|
|
77
|
+
[binding: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
export declare function createSiteWorker(options?: {
|
|
80
|
+
siteId?: string;
|
|
81
|
+
}): {
|
|
82
|
+
fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
83
|
+
};
|
|
84
|
+
declare const _default: {
|
|
85
|
+
fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
86
|
+
};
|
|
87
|
+
export default _default;
|