@cloudhal/astro-renderer 0.0.0-stage → 0.1.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.
Files changed (164) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +36 -2
  3. package/dist/src/ambient-client.d.ts +17 -0
  4. package/dist/src/ambient-client.js +55 -0
  5. package/dist/src/analytics-client.d.ts +17 -0
  6. package/dist/src/analytics-client.js +96 -0
  7. package/dist/src/analytics-middleware.d.ts +6 -0
  8. package/dist/src/analytics-middleware.js +43 -0
  9. package/dist/src/analytics-node.d.ts +46 -0
  10. package/dist/src/analytics-node.js +134 -0
  11. package/dist/src/analytics.d.ts +117 -0
  12. package/dist/src/analytics.js +372 -0
  13. package/dist/src/archive.d.ts +106 -0
  14. package/dist/src/archive.js +207 -0
  15. package/dist/src/astro-env.d.ts +21 -0
  16. package/dist/src/block-html.d.ts +14 -0
  17. package/dist/src/block-html.js +103 -0
  18. package/dist/src/blocks.d.ts +24 -0
  19. package/dist/src/blocks.js +66 -0
  20. package/dist/src/cache-tags.d.ts +25 -0
  21. package/dist/src/cache-tags.js +59 -0
  22. package/dist/src/carousel-client.d.ts +28 -0
  23. package/dist/src/carousel-client.js +67 -0
  24. package/dist/src/chart.d.ts +34 -0
  25. package/dist/src/chart.js +182 -0
  26. package/dist/src/chrome-client.d.ts +27 -0
  27. package/dist/src/chrome-client.js +64 -0
  28. package/dist/src/cloudflare-entry.d.ts +87 -0
  29. package/dist/src/cloudflare-entry.js +548 -0
  30. package/dist/src/comments-client.d.ts +11 -0
  31. package/dist/src/comments-client.js +58 -0
  32. package/dist/src/comments-html.d.ts +42 -0
  33. package/dist/src/comments-html.js +303 -0
  34. package/dist/src/comments-middleware.d.ts +6 -0
  35. package/dist/src/comments-middleware.js +38 -0
  36. package/dist/src/comments-node.d.ts +42 -0
  37. package/dist/src/comments-node.js +112 -0
  38. package/dist/src/comments-view.d.ts +68 -0
  39. package/dist/src/comments-view.js +174 -0
  40. package/dist/src/comments.d.ts +66 -0
  41. package/dist/src/comments.js +258 -0
  42. package/dist/src/components/Block.astro +39 -0
  43. package/dist/src/components/Body.astro +43 -0
  44. package/dist/src/components/Comments.astro +19 -0
  45. package/dist/src/components/ContentList.astro +31 -0
  46. package/dist/src/components/EntryArticle.astro +31 -0
  47. package/dist/src/components/Hero.astro +36 -0
  48. package/dist/src/components/Image.astro +36 -0
  49. package/dist/src/components/RichText.astro +19 -0
  50. package/dist/src/components/Sections.astro +66 -0
  51. package/dist/src/components/SeoHead.astro +22 -0
  52. package/dist/src/components/Surface.astro +36 -0
  53. package/dist/src/components/SurfaceNode.astro +82 -0
  54. package/dist/src/components/index.d.ts +12 -0
  55. package/dist/src/components/index.js +12 -0
  56. package/dist/src/csp.d.ts +20 -0
  57. package/dist/src/csp.js +28 -0
  58. package/dist/src/embed-client.d.ts +38 -0
  59. package/dist/src/embed-client.js +98 -0
  60. package/dist/src/embed-middleware.d.ts +9 -0
  61. package/dist/src/embed-middleware.js +49 -0
  62. package/dist/src/feeds.d.ts +72 -0
  63. package/dist/src/feeds.js +246 -0
  64. package/dist/src/gates.d.ts +25 -0
  65. package/dist/src/gates.js +63 -0
  66. package/dist/src/index.d.ts +17 -0
  67. package/dist/src/index.js +17 -0
  68. package/dist/src/integration.d.ts +55 -0
  69. package/dist/src/integration.js +244 -0
  70. package/dist/src/kit.d.ts +48 -0
  71. package/dist/src/kit.js +83 -0
  72. package/dist/src/locale-feeds.d.ts +29 -0
  73. package/dist/src/locale-feeds.js +152 -0
  74. package/dist/src/locale-middleware.d.ts +5 -0
  75. package/dist/src/locale-middleware.js +26 -0
  76. package/dist/src/locales.d.ts +87 -0
  77. package/dist/src/locales.js +336 -0
  78. package/dist/src/markdown.d.ts +83 -0
  79. package/dist/src/markdown.js +533 -0
  80. package/dist/src/media-middleware.d.ts +5 -0
  81. package/dist/src/media-middleware.js +18 -0
  82. package/dist/src/media-route.d.ts +47 -0
  83. package/dist/src/media-route.js +238 -0
  84. package/dist/src/media.d.ts +109 -0
  85. package/dist/src/media.js +298 -0
  86. package/dist/src/motion-client.d.ts +39 -0
  87. package/dist/src/motion-client.js +115 -0
  88. package/dist/src/navigation.d.ts +127 -0
  89. package/dist/src/navigation.js +382 -0
  90. package/dist/src/not-found.d.ts +16 -0
  91. package/dist/src/not-found.js +41 -0
  92. package/dist/src/overlay-client.d.ts +20 -0
  93. package/dist/src/overlay-client.js +49 -0
  94. package/dist/src/prefs-client.d.ts +14 -0
  95. package/dist/src/prefs-client.js +18 -0
  96. package/dist/src/preview.d.ts +70 -0
  97. package/dist/src/preview.js +551 -0
  98. package/dist/src/resolver.d.ts +71 -0
  99. package/dist/src/resolver.js +206 -0
  100. package/dist/src/routing.d.ts +108 -0
  101. package/dist/src/routing.js +285 -0
  102. package/dist/src/runtime-workerd.d.ts +87 -0
  103. package/dist/src/runtime-workerd.js +275 -0
  104. package/dist/src/runtime.d.ts +59 -0
  105. package/dist/src/runtime.js +153 -0
  106. package/dist/src/safe-urls.d.ts +13 -0
  107. package/dist/src/safe-urls.js +35 -0
  108. package/dist/src/sanitize.d.ts +7 -0
  109. package/dist/src/sanitize.js +217 -0
  110. package/dist/src/search-client.d.ts +29 -0
  111. package/dist/src/search-client.js +92 -0
  112. package/dist/src/search-limit.d.ts +36 -0
  113. package/dist/src/search-limit.js +66 -0
  114. package/dist/src/search.d.ts +64 -0
  115. package/dist/src/search.js +155 -0
  116. package/dist/src/seo.d.ts +85 -0
  117. package/dist/src/seo.js +468 -0
  118. package/dist/src/site-dispatch.d.ts +37 -0
  119. package/dist/src/site-dispatch.js +86 -0
  120. package/dist/src/site-hosts.d.ts +35 -0
  121. package/dist/src/site-hosts.js +110 -0
  122. package/dist/src/source.d.ts +227 -0
  123. package/dist/src/source.js +794 -0
  124. package/dist/src/static-gates.d.ts +3 -0
  125. package/dist/src/static-gates.js +28 -0
  126. package/dist/src/static-headers.d.ts +30 -0
  127. package/dist/src/static-headers.js +140 -0
  128. package/dist/src/static-media.d.ts +4 -0
  129. package/dist/src/static-media.js +65 -0
  130. package/dist/src/static-redirects.d.ts +4 -0
  131. package/dist/src/static-redirects.js +40 -0
  132. package/dist/src/surface-client.d.ts +34 -0
  133. package/dist/src/surface-client.js +146 -0
  134. package/dist/src/surfaces/html.d.ts +35 -0
  135. package/dist/src/surfaces/html.js +184 -0
  136. package/dist/src/surfaces/markup.d.ts +57 -0
  137. package/dist/src/surfaces/markup.js +135 -0
  138. package/dist/src/surfaces/motion.d.ts +33 -0
  139. package/dist/src/surfaces/motion.js +132 -0
  140. package/dist/src/surfaces/primitives/carousel.d.ts +2 -0
  141. package/dist/src/surfaces/primitives/carousel.js +95 -0
  142. package/dist/src/surfaces/primitives/content.d.ts +13 -0
  143. package/dist/src/surfaces/primitives/content.js +159 -0
  144. package/dist/src/surfaces/primitives/data.d.ts +5 -0
  145. package/dist/src/surfaces/primitives/data.js +80 -0
  146. package/dist/src/surfaces/primitives/index.d.ts +54 -0
  147. package/dist/src/surfaces/primitives/index.js +106 -0
  148. package/dist/src/surfaces/primitives/inputs.d.ts +8 -0
  149. package/dist/src/surfaces/primitives/inputs.js +68 -0
  150. package/dist/src/surfaces/primitives/layout.d.ts +14 -0
  151. package/dist/src/surfaces/primitives/layout.js +61 -0
  152. package/dist/src/surfaces/primitives/motion.d.ts +9 -0
  153. package/dist/src/surfaces/primitives/motion.js +45 -0
  154. package/dist/src/surfaces/primitives/overlays.d.ts +6 -0
  155. package/dist/src/surfaces/primitives/overlays.js +79 -0
  156. package/dist/src/surfaces/tree.d.ts +107 -0
  157. package/dist/src/surfaces/tree.js +321 -0
  158. package/dist/src/surfaces.d.ts +14 -0
  159. package/dist/src/surfaces.js +33 -0
  160. package/dist/src/taxonomy.d.ts +86 -0
  161. package/dist/src/taxonomy.js +268 -0
  162. package/dist/src/theme-settings.d.ts +24 -0
  163. package/dist/src/theme-settings.js +111 -0
  164. package/package.json +219 -3
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The site's own "not found" page (RFC-0033 §4): a site may author a page at `/404`; its
3
+ * translations (the page's translation group, at any path) are the not-found page of their
4
+ * locales. A route answers a miss with the version in the request's locale, else (with
5
+ * `localization.fallback: "default-with-notice"`) the default locale's, else nothing — the theme
6
+ * then draws its built-in one in the request's locale. The page itself also answers `404` and stays
7
+ * out of sitemaps and `llms.txt`. No contract change: `/404` is an ordinary page path. Worker-safe.
8
+ */
9
+ import type { Page, Site } from "@cloudhal/core-contracts";
10
+ import type { GraphSource } from "./source.js";
11
+ /** Where a site authors its not-found page. */
12
+ export declare const NOT_FOUND_PATH = "/404";
13
+ /** Ids of the pages that are a not-found page: those at `/404` and their translation groups. */
14
+ export declare function notFoundPageIds(pages: readonly Page[]): Set<string>;
15
+ /** The authored not-found page to show for a miss in `locale`, if the site has one. */
16
+ export declare function notFoundPage(source: GraphSource, site: Site, locale: string): Promise<Page | undefined>;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The site's own "not found" page (RFC-0033 §4): a site may author a page at `/404`; its
3
+ * translations (the page's translation group, at any path) are the not-found page of their
4
+ * locales. A route answers a miss with the version in the request's locale, else (with
5
+ * `localization.fallback: "default-with-notice"`) the default locale's, else nothing — the theme
6
+ * then draws its built-in one in the request's locale. The page itself also answers `404` and stays
7
+ * out of sitemaps and `llms.txt`. No contract change: `/404` is an ordinary page path. Worker-safe.
8
+ */
9
+
10
+
11
+
12
+ /** Where a site authors its not-found page. */
13
+ export const NOT_FOUND_PATH = "/404";
14
+
15
+ /** Ids of the pages that are a not-found page: those at `/404` and their translation groups. */
16
+ export function notFoundPageIds(pages ) {
17
+ const groups = new Set(
18
+ pages.filter((p) => p.path === NOT_FOUND_PATH).map((p) => p.translation?.group ?? p.id),
19
+ );
20
+ return new Set(
21
+ pages
22
+ .filter((p) => groups.has(p.id) || (p.translation && groups.has(p.translation.group)))
23
+ .map((p) => p.id),
24
+ );
25
+ }
26
+
27
+ /** The authored not-found page to show for a miss in `locale`, if the site has one. */
28
+ export async function notFoundPage(
29
+ source ,
30
+ site ,
31
+ locale ,
32
+ ) {
33
+ const pages = await source.pages();
34
+ const ids = notFoundPageIds(pages);
35
+ const versions = pages.filter((p) => ids.has(p.id));
36
+ const own = versions.find((p) => p.locale === locale);
37
+ if (own) return own;
38
+ return site.localization?.fallback === "default-with-notice"
39
+ ? versions.find((p) => p.locale === site.defaultLocale)
40
+ : undefined;
41
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Cloudhal's overlay module (RFC-0025 §3): what overlays need beyond the platform. A self-contained,
3
+ * versioned file under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by surfaces with an
4
+ * overlay. The overlays themselves are native: `<dialog>` opened by Invoker Commands
5
+ * (`command="show-modal"`), popovers by `popovertarget`, tooltips by `interestfor`; this module
6
+ * fills the gaps of older browsers and adds what the platform does not do.
7
+ *
8
+ * - Invoker Commands for browsers before December 2025 (`show-modal`, `close`, `--next`/`--prev`).
9
+ * - A dialog's fallback link (`a[data-ch-open]`) opens the dialog instead of its page.
10
+ * - `closedby` where it is missing (Safari): a click on the backdrop closes `any` dialogs, and
11
+ * Escape never closes an `explicit` one (`closedby="none"`).
12
+ * - `aria-expanded` on every trigger, kept in step with its overlay.
13
+ * - Lightboxes: a thumbnail opens its image; previous, next and the arrow keys move through them.
14
+ * - Tooltips on focus and hover where `interestfor` is missing; Escape hides them.
15
+ * - Popovers and tooltips placed next to their trigger where CSS anchor positioning is missing.
16
+ */
17
+ export declare const OVERLAY_SCRIPT: {
18
+ readonly path: "/_cloudhal/overlay.1.js";
19
+ readonly code: string;
20
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Cloudhal's overlay module (RFC-0025 §3): what overlays need beyond the platform. A self-contained,
3
+ * versioned file under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by surfaces with an
4
+ * overlay. The overlays themselves are native: `<dialog>` opened by Invoker Commands
5
+ * (`command="show-modal"`), popovers by `popovertarget`, tooltips by `interestfor`; this module
6
+ * fills the gaps of older browsers and adds what the platform does not do.
7
+ *
8
+ * - Invoker Commands for browsers before December 2025 (`show-modal`, `close`, `--next`/`--prev`).
9
+ * - A dialog's fallback link (`a[data-ch-open]`) opens the dialog instead of its page.
10
+ * - `closedby` where it is missing (Safari): a click on the backdrop closes `any` dialogs, and
11
+ * Escape never closes an `explicit` one (`closedby="none"`).
12
+ * - `aria-expanded` on every trigger, kept in step with its overlay.
13
+ * - Lightboxes: a thumbnail opens its image; previous, next and the arrow keys move through them.
14
+ * - Tooltips on focus and hover where `interestfor` is missing; Escape hides them.
15
+ * - Popovers and tooltips placed next to their trigger where CSS anchor positioning is missing.
16
+ */
17
+
18
+ const code = String.raw`const d=document,B=HTMLButtonElement.prototype,D=window.HTMLDialogElement&&HTMLDialogElement.prototype;
19
+ const anchored=!!(window.CSS&&CSS.supports("position-area","bottom"));
20
+ const byId=(id)=>id?d.getElementById(id):null;
21
+ const place=(p,el,above)=>{if(anchored||!el)return;const r=el.getBoundingClientRect();p.style.position="fixed";p.style.margin="0";p.style.inset="auto";
22
+ const top=above?r.top-p.offsetHeight-8:r.bottom+8;p.style.top=Math.round(Math.max(8,Math.min(top,innerHeight-p.offsetHeight-8)))+"px";
23
+ p.style.left=Math.round(Math.max(8,Math.min(r.left,innerWidth-p.offsetWidth-8)))+"px";};
24
+ const isOpen=(t)=>!!t.open||(t.matches&&t.matches(":popover-open"));
25
+ const triggers=(t)=>d.querySelectorAll('[commandfor="'+t.id+'"]:not([command="close"]),[popovertarget="'+t.id+'"]:not([popovertargetaction="hide"]),[data-ch-open="'+t.id+'"],[data-ch-lightbox="'+t.id+'"]');
26
+ const sync=(t)=>{for(const b of triggers(t))b.setAttribute("aria-expanded",String(isOpen(t)));};
27
+ if(D&&!("commandForElement"in B))d.addEventListener("click",(e)=>{const b=e.target instanceof Element&&e.target.closest("button[commandfor]");if(!b||b.disabled)return;
28
+ const t=byId(b.getAttribute("commandfor")),c=b.getAttribute("command")||"";if(!t)return;
29
+ if(c==="show-modal"&&t.showModal&&!t.open)t.showModal();else if(c==="close"&&t.close)t.close();
30
+ else if(c.startsWith("--")){const ev=new Event("command");ev.command=c;ev.source=b;t.dispatchEvent(ev);}});
31
+ for(const a of d.querySelectorAll("a[data-ch-open]"))a.addEventListener("click",(e)=>{const t=byId(a.getAttribute("data-ch-open"));if(t&&t.showModal){e.preventDefault();t.showModal();}});
32
+ for(const t of d.querySelectorAll("dialog.ch-dialog")){sync(t);new MutationObserver(()=>sync(t)).observe(t,{attributes:true,attributeFilter:["open"]});
33
+ if(D&&!("closedBy"in D)){if(t.getAttribute("closedby")==="none")t.addEventListener("cancel",(e)=>e.preventDefault());
34
+ if(t.getAttribute("closedby")==="any")t.addEventListener("click",(e)=>{if(e.target!==t)return;const r=t.getBoundingClientRect();
35
+ if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)t.close();});}}
36
+ for(const p of d.querySelectorAll("[popover].ch-popover")){sync(p);p.addEventListener("toggle",(e)=>{sync(p);if(e.newState==="open")place(p,d.querySelector('[popovertarget="'+p.id+'"]'),p.getAttribute("data-placement")==="top");});}
37
+ for(const box of d.querySelectorAll("dialog.ch-lightbox__dialog")){const items=[...box.querySelectorAll(".ch-lightbox__item")],count=box.querySelector(".ch-lightbox__count");let at=0;
38
+ const show=(i)=>{if(!items.length)return;at=(i+items.length)%items.length;items.forEach((f,k)=>{f.hidden=k!==at;});if(count)count.textContent=(at+1)+" / "+items.length;};
39
+ box.addEventListener("command",(e)=>{if(e.command==="--next")show(at+1);else if(e.command==="--prev")show(at-1);});
40
+ box.addEventListener("keydown",(e)=>{if(e.key==="ArrowRight")show(at+1);else if(e.key==="ArrowLeft")show(at-1);});
41
+ for(const a of d.querySelectorAll('a[data-ch-lightbox="'+box.id+'"]'))a.addEventListener("click",(e)=>{if(!box.showModal)return;e.preventDefault();show(Number(a.getAttribute("data-index"))||0);box.showModal();});}
42
+ if(!("interestForElement"in B))for(const el of d.querySelectorAll("[interestfor]")){const tip=byId(el.getAttribute("interestfor"));if(!tip||!tip.showPopover)continue;let timer=0;
43
+ const on=()=>{clearTimeout(timer);if(isOpen(tip))return;try{tip.showPopover({source:el});}catch{try{tip.showPopover();}catch{}}place(tip,el,true);};
44
+ const off=()=>{clearTimeout(timer);timer=setTimeout(()=>{try{tip.hidePopover();}catch{}},120);};
45
+ el.addEventListener("mouseenter",on);el.addEventListener("focus",on);el.addEventListener("mouseleave",off);el.addEventListener("blur",off);
46
+ el.addEventListener("keydown",(e)=>{if(e.key==="Escape")off();});}
47
+ `;
48
+
49
+ export const OVERLAY_SCRIPT = { path: "/_cloudhal/overlay.1.js", code } ;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Cloudhal's preferences script (RFC-0025 25d): the reader's choices about the site's bars, read
3
+ * before the page paints. A tiny classic script in `<head>` (not a module: it must run before the
4
+ * body draws), first-party under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by pages
5
+ * with a dismissible announcement or a consent bar.
6
+ *
7
+ * The edge cache does not vary on cookies, so the server cannot leave a closed bar out; instead this
8
+ * marks the root (`data-ch-announcement-dismissed`, `data-ch-consent`) and the theme's CSS hides
9
+ * the bar before it is drawn: nothing shifts. It reads cookies only and writes nothing.
10
+ */
11
+ export declare const PREFS_SCRIPT: {
12
+ readonly path: "/_cloudhal/prefs.1.js";
13
+ readonly code: string;
14
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Cloudhal's preferences script (RFC-0025 25d): the reader's choices about the site's bars, read
3
+ * before the page paints. A tiny classic script in `<head>` (not a module: it must run before the
4
+ * body draws), first-party under `/_cloudhal/` (CSP `script-src 'self'`), loaded only by pages
5
+ * with a dismissible announcement or a consent bar.
6
+ *
7
+ * The edge cache does not vary on cookies, so the server cannot leave a closed bar out; instead this
8
+ * marks the root (`data-ch-announcement-dismissed`, `data-ch-consent`) and the theme's CSS hides
9
+ * the bar before it is drawn: nothing shifts. It reads cookies only and writes nothing.
10
+ */
11
+
12
+ const code = String.raw`(function(){try{var h=document.documentElement,c=document.cookie||"";
13
+ var m=/(?:^|;\s*)ch_consent=([a-z]{1,16})/.exec(c);if(m)h.setAttribute("data-ch-consent",m[1]);
14
+ var a=h.getAttribute("data-ch-announcement");if(a){var d=/(?:^|;\s*)ch_dismiss=([^;]*)/.exec(c);
15
+ if(d&&decodeURIComponent(d[1]).split(",").indexOf(a)>=0)h.setAttribute("data-ch-announcement-dismissed","");}}catch(e){}})();
16
+ `;
17
+
18
+ export const PREFS_SCRIPT = { path: "/_cloudhal/prefs.1.js", code } ;
@@ -0,0 +1,70 @@
1
+ import type { ContentEntry, Page, Section, Site, Taxonomy, Term } from "@cloudhal/core-contracts";
2
+ import { type ArchiveState } from "./archive.js";
3
+ import { type MediaContext } from "./media.js";
4
+ /** The collections a page's sections list: content lists and surfaces' entry sources. */
5
+ export declare function previewCollections(sections: readonly Section[]): string[];
6
+ /**
7
+ * Framework-free HTML for a page's sections — the same structure the Astro components emit
8
+ * (`.ch-*` classes, `data-section-id`), so agents can preview a change without a build and the
9
+ * markup matches what the site will render.
10
+ */
11
+ export declare function renderSectionHtml(section: Section, entries?: Record<string, ContentEntry[]>, media?: MediaContext): string;
12
+ export interface PreviewDocument {
13
+ html: string;
14
+ title: string;
15
+ path: string;
16
+ }
17
+ /**
18
+ * The notice a preview shows above a page or entry the public cannot see at `now` (embargoed or
19
+ * expired, RFC-0008 §7.3); empty when its gates are open.
20
+ */
21
+ export declare function gateNoticeHtml(site: Site, node: Pick<Page, "availability">, now: number, locale?: string): string;
22
+ /**
23
+ * Full HTML document for a page preview. `now` (default: the caller's clock) decides whether the
24
+ * page's gates are closed, which adds a notice.
25
+ */
26
+ export declare function renderPagePreview(site: Site, page: Page, entries?: Record<string, ContentEntry[]>, media?: MediaContext, now?: number): PreviewDocument;
27
+ /**
28
+ * Full HTML document for an article preview (`media.assets`: the assets it refers to), with the
29
+ * gate notice when the entry is embargoed or expired at `now`.
30
+ */
31
+ export declare function renderEntryPreview(site: Site, entry: ContentEntry, media?: MediaContext, now?: number): PreviewDocument;
32
+ /**
33
+ * One piece of a body (a ```surface, a block) as a document of its own, for the body editor's
34
+ * inline preview: the preview's policy and styles, no site header or footer, nothing else.
35
+ */
36
+ export declare function renderFragmentPreview(site: Site, markdown: string, media?: MediaContext): {
37
+ html: string;
38
+ };
39
+ export interface ArchivePreviewInput {
40
+ readonly taxonomies: readonly Taxonomy[];
41
+ /** The site's terms (any status), with the previewed one as it is being edited. */
42
+ readonly terms: readonly Term[];
43
+ readonly termId: string;
44
+ /** The site's entries (any status): the archive lists the published ones in the default locale. */
45
+ readonly entries: readonly ContentEntry[];
46
+ /** Entries per page (the blog starter's `ARCHIVE_PAGE_SIZE`). */
47
+ readonly perPage?: number;
48
+ }
49
+ /**
50
+ * Why an archive answers the way it does (RFC-0002 §7, `archiveState`): `indexed`; `thin` (fewer
51
+ * published entries than `minEntriesToIndex`) and `noindex` (the term's SEO asks for it) are a 200
52
+ * with `noindex,follow`; `empty`, `proposed`, `internal` and `archiveOff` are a 404; `retired` a 410.
53
+ */
54
+ export type ArchivePreviewReason = "indexed" | "thin" | "noindex" | "empty" | "proposed" | "internal" | "retired" | "archiveOff";
55
+ export interface ArchivePreviewDocument extends PreviewDocument {
56
+ /** What the public route answers for this term right now (with this draft). */
57
+ readonly state: ArchiveState;
58
+ readonly reason: ArchivePreviewReason;
59
+ /** Published entries the archive lists (sub-categories included in hierarchical taxonomies). */
60
+ readonly total: number;
61
+ readonly minEntriesToIndex: number;
62
+ }
63
+ /**
64
+ * A term's archive page (`<basePath>/<slug>`, page 1) as the blog starter renders it — breadcrumb,
65
+ * the taxonomy's name, the term's name, post count and feed link, image and markdown intro, the
66
+ * newest entries and pagination — with the `<head>` title and description of `archiveHead`. It
67
+ * renders whatever the archive's state, so a person sees a proposed or empty term's page before it
68
+ * goes public; `state` and `reason` say what the public route answers today (`archiveState`).
69
+ */
70
+ export declare function renderArchivePreview(site: Site, input: ArchivePreviewInput): ArchivePreviewDocument;