@aglyn/tenant-runtime 1.0.0-beta.143
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 +201 -0
- package/README.md +26 -0
- package/package.json +39 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/apply-publish-schedule.d.ts +34 -0
- package/src/lib/apply-publish-schedule.js +285 -0
- package/src/lib/apply-publish-schedule.js.map +1 -0
- package/src/lib/assign-contact-owner.d.ts +162 -0
- package/src/lib/assign-contact-owner.js +322 -0
- package/src/lib/assign-contact-owner.js.map +1 -0
- package/src/lib/associate-company-by-domain.d.ts +70 -0
- package/src/lib/associate-company-by-domain.js +150 -0
- package/src/lib/associate-company-by-domain.js.map +1 -0
- package/src/lib/author-page-nodes.d.ts +36 -0
- package/src/lib/author-page-nodes.js +296 -0
- package/src/lib/author-page-nodes.js.map +1 -0
- package/src/lib/built-in-page-layout.d.ts +48 -0
- package/src/lib/built-in-page-layout.js +107 -0
- package/src/lib/built-in-page-layout.js.map +1 -0
- package/src/lib/capture-host-contact.d.ts +95 -0
- package/src/lib/capture-host-contact.js +137 -0
- package/src/lib/capture-host-contact.js.map +1 -0
- package/src/lib/collection-fallback-nodes.d.ts +90 -0
- package/src/lib/collection-fallback-nodes.js +602 -0
- package/src/lib/collection-fallback-nodes.js.map +1 -0
- package/src/lib/compose-author-page.d.ts +109 -0
- package/src/lib/compose-author-page.js +225 -0
- package/src/lib/compose-author-page.js.map +1 -0
- package/src/lib/compose-collection-page.d.ts +94 -0
- package/src/lib/compose-collection-page.js +256 -0
- package/src/lib/compose-collection-page.js.map +1 -0
- package/src/lib/compose-screen-nodes.d.ts +156 -0
- package/src/lib/compose-screen-nodes.js +547 -0
- package/src/lib/compose-screen-nodes.js.map +1 -0
- package/src/lib/compose-search-page.d.ts +39 -0
- package/src/lib/compose-search-page.js +57 -0
- package/src/lib/compose-search-page.js.map +1 -0
- package/src/lib/convert-host-lead.d.ts +189 -0
- package/src/lib/convert-host-lead.js +443 -0
- package/src/lib/convert-host-lead.js.map +1 -0
- package/src/lib/defer-lazy-panels.d.ts +58 -0
- package/src/lib/defer-lazy-panels.js +171 -0
- package/src/lib/defer-lazy-panels.js.map +1 -0
- package/src/lib/element-animation-assets.d.ts +62 -0
- package/src/lib/element-animation-assets.js +290 -0
- package/src/lib/element-animation-assets.js.map +1 -0
- package/src/lib/emit-host-event.d.ts +29 -0
- package/src/lib/emit-host-event.js +30 -0
- package/src/lib/emit-host-event.js.map +1 -0
- package/src/lib/enrich-gated-page.d.ts +67 -0
- package/src/lib/enrich-gated-page.js +134 -0
- package/src/lib/enrich-gated-page.js.map +1 -0
- package/src/lib/entry-link-routes.d.ts +61 -0
- package/src/lib/entry-link-routes.js +169 -0
- package/src/lib/entry-link-routes.js.map +1 -0
- package/src/lib/get-author-content.d.ts +119 -0
- package/src/lib/get-author-content.js +288 -0
- package/src/lib/get-author-content.js.map +1 -0
- package/src/lib/get-collection-content.d.ts +290 -0
- package/src/lib/get-collection-content.js +565 -0
- package/src/lib/get-collection-content.js.map +1 -0
- package/src/lib/get-components.d.ts +24 -0
- package/src/lib/get-components.js +102 -0
- package/src/lib/get-components.js.map +1 -0
- package/src/lib/get-datasets.d.ts +45 -0
- package/src/lib/get-datasets.js +169 -0
- package/src/lib/get-datasets.js.map +1 -0
- package/src/lib/get-forms.d.ts +24 -0
- package/src/lib/get-forms.js +116 -0
- package/src/lib/get-forms.js.map +1 -0
- package/src/lib/get-layout-version.d.ts +26 -0
- package/src/lib/get-layout-version.js +99 -0
- package/src/lib/get-layout-version.js.map +1 -0
- package/src/lib/get-media-asset-facts.d.ts +74 -0
- package/src/lib/get-media-asset-facts.js +116 -0
- package/src/lib/get-media-asset-facts.js.map +1 -0
- package/src/lib/get-plugin-installs.d.ts +29 -0
- package/src/lib/get-plugin-installs.js +94 -0
- package/src/lib/get-plugin-installs.js.map +1 -0
- package/src/lib/get-screen-version.d.ts +27 -0
- package/src/lib/get-screen-version.js +66 -0
- package/src/lib/get-screen-version.js.map +1 -0
- package/src/lib/get-screen.d.ts +39 -0
- package/src/lib/get-screen.js +126 -0
- package/src/lib/get-screen.js.map +1 -0
- package/src/lib/get-variables.d.ts +41 -0
- package/src/lib/get-variables.js +128 -0
- package/src/lib/get-variables.js.map +1 -0
- package/src/lib/get-video-asset-facts.d.ts +22 -0
- package/src/lib/get-video-asset-facts.js +22 -0
- package/src/lib/get-video-asset-facts.js.map +1 -0
- package/src/lib/host-event-listeners.d.ts +83 -0
- package/src/lib/host-event-listeners.js +91 -0
- package/src/lib/host-event-listeners.js.map +1 -0
- package/src/lib/org-permissions.d.ts +63 -0
- package/src/lib/org-permissions.js +187 -0
- package/src/lib/org-permissions.js.map +1 -0
- package/src/lib/repeat-record-pages.d.ts +48 -0
- package/src/lib/repeat-record-pages.js +64 -0
- package/src/lib/repeat-record-pages.js.map +1 -0
- package/src/lib/required-site-plugins.d.ts +114 -0
- package/src/lib/required-site-plugins.js +121 -0
- package/src/lib/required-site-plugins.js.map +1 -0
- package/src/lib/resolve-dataset.d.ts +40 -0
- package/src/lib/resolve-dataset.js +64 -0
- package/src/lib/resolve-dataset.js.map +1 -0
- package/src/lib/search-results-nodes.d.ts +48 -0
- package/src/lib/search-results-nodes.js +302 -0
- package/src/lib/search-results-nodes.js.map +1 -0
- package/src/lib/social-image-facts.d.ts +107 -0
- package/src/lib/social-image-facts.js +133 -0
- package/src/lib/social-image-facts.js.map +1 -0
- package/src/lib/stamp-form-dataset-bindings.d.ts +32 -0
- package/src/lib/stamp-form-dataset-bindings.js +59 -0
- package/src/lib/stamp-form-dataset-bindings.js.map +1 -0
- package/src/lib/template-screens.d.ts +227 -0
- package/src/lib/template-screens.js +364 -0
- package/src/lib/template-screens.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/tenant/runtime/src/lib/collection-fallback-nodes.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { wistiaMediaId } from '@aglyn/aglyn/app-utils/wistia-embed'\nimport * as Aglyn from '@aglyn/aglyn/server'\n\n/** Namespaces the synthetic fallback node ids (never persisted). */\nconst FALLBACK_ID_PREFIX = 'cfb__'\n\nconst id = (suffix: string) => `${FALLBACK_ID_PREFIX}${suffix}`\n\ntype NodesMap = Record<string, Aglyn.AglynNodeSchema>\n\ninterface FallbackCollection {\n slug: string\n displayName: string\n /** Category taxonomy (AGL-582) for `categoryId` → name resolution. */\n categories?: Aglyn.CollectionCategory[]\n}\n\ninterface FallbackEntry {\n title?: string\n slug?: string\n excerpt?: string\n /** Per-entry byline (AGL-686); falls back to the site as author. */\n authorName?: string\n body?: string\n coverImage?: string\n /** The featured video (AGL-2956); plays in the cover's place. */\n coverVideo?: string\n /** Meta description override (AGL-582); falls back to `excerpt`. */\n seoDescription?: string\n /** Stable taxonomy reference (AGL-582); wins over `category`. */\n categoryId?: string\n /** Legacy free-typed category (AGL-582); read-only fallback. */\n category?: string\n tags?: string[]\n publishedAt?: { seconds: number } | null\n}\n\n// The one shared formatter (AGL-1926). This composes server-side, so the\n// inline `toLocaleDateString()` it replaces was not itself a hydration\n// mismatch — but it was a THIRD spelling of \"the entry's published date\",\n// free to drift from the byline and the related-post card that quote the\n// same instant. Pinned locale and zone, so all three agree by construction.\nconst formatDate = (value?: { seconds: number } | null) =>\n Aglyn.formatCollectionEntryDate(value)\n\n/**\n * What may be interpolated into the cover block's CSS `url(\"…\")` (AGL-1407).\n *\n * The gate this replaces was `/^https?:\\/\\//i`, which answered the safety\n * question correctly and the coverage question wrongly: it admitted only the\n * OLDEST of the stored generations. A `media:` reference failed it and the\n * cover block was never emitted — a SILENT drop, no error, no placeholder,\n * just a page missing its picture — and so did the AGL-175 relative CDN path\n * that the first pass at media references wrote. Resolving before testing is\n * what closes that, and the test then has to accept a site-relative path,\n * which is what {@link Aglyn.resolveMediaSrc} returns for a reference.\n *\n * Still a scheme allowlist rather than \"anything non-empty\": this value lands\n * inside a stylesheet rather than in an `<img src>`, so `data:` and friends\n * have no business here even though {@link cssUrlValue} already makes\n * quote-breaking impossible. A bare relative `cover.png` stays rejected\n * exactly as before — there is no page for it to resolve against at compose\n * time.\n *\n * `http:` was dropped for AGL-1725. AGL-1701 found two paths accepting it;\n * markdown-lite is AGL-1713 and this was the second, separate one. It is the\n * only scheme change here, and it is not a host restriction: an author\n * hotlinking their own https cover keeps working, because on a published\n * site the author IS the site owner and the audience is their own visitors.\n * `http:` alone has no defensible use — the request is mixed passive content\n * that current browsers already block or auto-upgrade, so the author gains\n * nothing from it, while the plaintext fetch discloses which article a\n * visitor is reading to every observer on the network path.\n *\n * The consequence of the drop is the SILENT DROP this whole comment is about,\n * for `http:` covers only: no cover node is emitted. That is the correct\n * trade here and the browser was very likely refusing the image anyway, but\n * it is the reason the change is one scheme and not a host list.\n */\nconst RENDERABLE_COVER_URL = /^(?:https:\\/\\/|\\/)/i\n\n/**\n * A URL made safe to sit inside `url(\"…\")`, WITHOUT re-encoding it.\n *\n * This replaces `encodeURI`, which was the wrong tool and quietly broke the\n * commonest stored form: `encodeURI` escapes `%`, so every raw firebasestorage\n * download URL — whose object path is `orgs%2F…%2Fmedia%2F…` — came out\n * double-encoded as `%252F` and 404'd. The block rendered, the image did not,\n * which is why it survived: the page looks composed and the picture is just\n * missing.\n *\n * Only the characters that could END the CSS string are escaped, and they are\n * escaped percent-wise rather than with a backslash so the result is still a\n * valid URL if anything downstream reads it as one. `encodeURI` was never\n * needed for anything else here — a stored URL is already URL-encoded.\n */\nconst cssUrlValue = (url: string) =>\n url.replace(/[\"\\\\\\n\\r]/g, (char) => encodeURIComponent(char))\n\n/**\n * Container width for the built-in entry article: the PROSE case of the\n * Container standard (AGL-1298), not an arbitrary narrow default. A\n * collection entry is an article body, and `xl` — the section default — runs\n * a paragraph past 180 characters a line. Stock breakpoint, no bespoke\n * number.\n */\nconst ENTRY_MAX_WIDTH = 'md'\n\n/**\n * Container width for the built-in listing: the section default. A listing is\n * a card grid rather than a reading column, so the entry's prose width is the\n * wrong measure for it, and the authored list screens render at this same\n * `xl` (AGL-2567). Still a stock breakpoint, so the AGL-1298 rule holds.\n */\nconst LIST_MAX_WIDTH = 'xl'\n\n/**\n * Vertical rhythm between the built-in listing's sections, in MUI theme\n * spacing units: `theme.spacing(6)` resolves to 48px, the same rhythm the\n * authored list screens carry, so a generated listing and an authored one\n * read as one product (AGL-2567).\n *\n * A theme token rather than a pixel string: a hand-written length here\n * answers to no theme, and a length missing its unit is a valid-looking\n * value the browser drops.\n *\n * @see https://mui.com/material-ui/customization/spacing/\n */\nconst LIST_SECTION_GAP = 6\n\n/** The page shell's width and the rhythm of the stack that holds sections. */\ninterface ShellLayout {\n /** Stock Container breakpoint (AGL-1298); never a bespoke pixel cap. */\n maxWidth: typeof ENTRY_MAX_WIDTH | typeof LIST_MAX_WIDTH\n /** Props for the content stack the page's sections slot into. */\n stackProps: Record<string, unknown>\n}\n\n/** The entry article's shell: reading column, sections close together. */\nconst entryShell = (): ShellLayout => ({\n maxWidth: ENTRY_MAX_WIDTH,\n stackProps: { spacing: 2 },\n})\n\n/**\n * The listing's shell: full section width, sections on the 48px rhythm.\n *\n * The gap is declared on the stack's `sx` rather than left to the Stack's own\n * `spacing`, which is the shape the authored list screens carry: one\n * `row-gap` on the flex container, so every section is spaced by the same\n * declaration instead of by margins that a section's own styling can collapse\n * or override.\n */\nconst listShell = (): ShellLayout => ({\n maxWidth: LIST_MAX_WIDTH,\n stackProps: {\n sx: {\n display: 'flex',\n flexDirection: 'column',\n gap: LIST_SECTION_GAP,\n },\n },\n})\n\n/** Root → centered container → content stack; children slot underneath. */\nfunction shell(childIds: string[], layout: ShellLayout): NodesMap {\n return {\n [Aglyn.NODE_ROOT_ID]: {\n $id: Aglyn.NODE_ROOT_ID,\n componentId: 'div',\n nodes: [id('container')],\n },\n [id('container')]: {\n $id: id('container'),\n componentId: 'muiContainer',\n pluginId: 'mui',\n parentId: Aglyn.NODE_ROOT_ID,\n props: {\n maxWidth: layout.maxWidth,\n sx: { paddingTop: 6, paddingBottom: 6 },\n },\n nodes: [id('stack')],\n },\n [id('stack')]: {\n $id: id('stack'),\n componentId: 'muiStack',\n pluginId: 'mui',\n parentId: id('container'),\n props: layout.stackProps,\n nodes: childIds,\n },\n }\n}\n\nconst typography = (\n suffix: string,\n props: Record<string, unknown>,\n): AglynNodeEntry => [\n id(suffix),\n {\n $id: id(suffix),\n componentId: 'muiTypography',\n pluginId: 'mui',\n parentId: id('stack'),\n props,\n },\n]\n\ntype AglynNodeEntry = [string, Aglyn.AglynNodeSchema]\n\n/**\n * The Video node's props for an entry's featured video, or `undefined` when\n * the entry has none this page can play (AGL-2956).\n *\n * An entry of a video collection is an article whose film sits where a post's\n * cover would, and on the built-in page nobody is there to bind one. So the\n * props carry what a designer would bind by hand: the source, the cover as\n * the poster, and the three facts the page's `VideoObject` is built from —\n * the title, the SEO description falling back to the excerpt as\n * `{{entry.seoDescription}}` does, and the ISO publish instant\n * `{{entry.publishedAt}}` resolves to. An instant rather than a calendar day:\n * the builder publishes `uploadDate` as a date-time with a zone, and it keeps\n * an instant as given where it would publish a bare day at noon UTC.\n *\n * `undefined` rather than a Video node in two cases, because the element's\n * answer to each is a labeled placeholder, which a published article must\n * never show:\n *\n * - a source nothing resolves, such as an empty field or a malformed `media:`\n * reference;\n * - a Wistia link with no poster. Its player loads only when a visitor\n * presses the poster, so without one there is nothing to press.\n *\n * The page then renders as a cover article, exactly as it does for an entry\n * with no video.\n *\n * The poster is the stored reference, not a resolved URL, so the element and\n * the structured data each resolve it against the site rendering the page. It\n * is passed only when the cover's own scheme rule would render it, so this\n * page never shows a still as a poster that it refuses as a cover.\n *\n * The film takes the cover's whole slot in the reading column, whose stock\n * `md` container bounds it; the column is the width limit rather than a pixel\n * cap (AGL-1298).\n */\nfunction featuredVideoProps(\n entry: FallbackEntry,\n options: { hostId?: string; posterRenders: boolean },\n): Record<string, unknown> | undefined {\n const src = (entry.coverVideo ?? '').trim()\n if (!src || !Aglyn.resolveMediaSrc(src, { hostId: options.hostId })) {\n return undefined\n }\n const poster = options.posterRenders ? entry.coverImage : undefined\n if (wistiaMediaId(src) && !poster) return undefined\n const description = entry.seoDescription || entry.excerpt || ''\n const uploadDate = Aglyn.collectionEntryPublishedAtIso(entry.publishedAt)\n return {\n src,\n ...(poster ? { poster } : {}),\n title: entry.title ?? '',\n ...(description ? { description } : {}),\n ...(uploadDate ? { uploadDate } : {}),\n width: '100%',\n }\n}\n\n/**\n * Built-in entry article as canvas nodes (AGL-551): when a collection has\n * no entry-template screen, `/{collection}/{entry}` renders these through\n * the normal compose pipeline — site theme, shared layout chrome, and the\n * markdown-rendering Entry body block — instead of the old unthemed HTML.\n */\nexport function buildCollectionEntryFallbackNodes(\n collection: FallbackCollection,\n entry: FallbackEntry,\n /**\n * The site being composed, so an org-scoped reference is host-qualified the\n * way every other render surface qualifies one (AGL-1043/AGL-1407). Optional\n * because a bare org reference still resolves without it; passing it is what\n * lets an asset restricted to this site resolve at all.\n */\n hostId?: string,\n): NodesMap {\n const entries: AglynNodeEntry[] = [\n typography('title', {\n variant: 'h3',\n component: 'h1',\n children: entry.title ?? '',\n }),\n ]\n const date = formatDate(entry.publishedAt)\n const tags = (entry.tags ?? []).filter(Boolean)\n // Category name resolves against the collection's taxonomy (AGL-582):\n // `categoryId` lookup first, legacy free-typed string fallback.\n const categoryName =\n Aglyn.resolveEntryCategoryName(entry, collection.categories) ?? ''\n if (date || categoryName || tags.length) {\n // Entry meta block (AGL-582): \"date · category\" line + tag chips.\n entries.push([\n id('meta'),\n {\n $id: id('meta'),\n componentId: Aglyn.COLLECTION_ENTRY_META_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: {\n date,\n category: categoryName,\n tags: tags.join(', '),\n },\n },\n ])\n }\n // The cover, through the ONE shared resolver (AGL-1407). A `media:`\n // reference becomes the site-relative CDN path; a raw storage URL, an\n // AGL-175 CDN path and an author's own hotlinked URL all pass through\n // untouched, which is the documented precedence in `media-ref.ts`.\n const coverImage = Aglyn.resolveMediaSrc(entry.coverImage, { hostId })\n const coverRenders = Boolean(\n coverImage && RENDERABLE_COVER_URL.test(coverImage),\n )\n // A featured video takes the cover's slot, with the cover as its poster\n // (AGL-2956); see `featuredVideoProps` for when an entry has one to play.\n const video = featuredVideoProps(entry, {\n hostId,\n posterRenders: coverRenders,\n })\n if (video) {\n entries.push([\n id('video'),\n {\n $id: id('video'),\n componentId: Aglyn.VIDEO_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: video,\n },\n ])\n } else if (coverRenders) {\n // Rendered as a background image on a plain stack, NOT through the\n // first-party `image` component — that component crashes tenant SSR\n // (AGL-579); the background-image approach is proven safe.\n entries.push([\n id('cover'),\n {\n $id: id('cover'),\n componentId: 'muiStack',\n pluginId: 'mui',\n parentId: id('stack'),\n props: {\n role: 'img',\n 'aria-label': entry.title ?? '',\n sx: {\n backgroundImage: `url(\"${cssUrlValue(coverImage)}\")`,\n backgroundSize: 'cover',\n backgroundPosition: 'center',\n borderRadius: 1,\n minHeight: 320,\n },\n },\n },\n ])\n }\n entries.push([\n id('body'),\n {\n $id: id('body'),\n componentId: Aglyn.COLLECTION_ENTRY_BODY_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: { markdown: entry.body ?? '' },\n },\n ])\n // Related posts after the body, share bar at the end (AGL-582); the\n // compose pipeline stamps the related entries server-side.\n entries.push([\n id('related'),\n {\n $id: id('related'),\n componentId: Aglyn.COLLECTION_RELATED_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: { heading: 'Related articles', limit: 3, sx: { paddingTop: 2 } },\n },\n ])\n entries.push([\n id('share'),\n {\n $id: id('share'),\n componentId: Aglyn.COLLECTION_SHARE_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: {},\n },\n ])\n entries.push([\n id('back'),\n {\n $id: id('back'),\n componentId: 'muiScreenLink',\n pluginId: 'mui',\n parentId: id('stack'),\n props: {\n href: `/${collection.slug}`,\n children: `← ${collection.displayName}`,\n sx: { alignSelf: 'flex-start' },\n },\n },\n ])\n return {\n ...shell(\n entries.map(([entryId]) => entryId),\n entryShell(),\n ),\n ...Object.fromEntries(entries),\n }\n}\n\n/** Pagination state for the built-in list (AGL-620). */\nexport interface FallbackListPagination {\n page: number\n perPage: number\n totalPages: number\n}\n\n/** The routed category for a filtered listing (AGL-1321). */\nexport interface FallbackListCategory {\n slug: string\n name: string\n}\n\n/** Prev/next + \"Page X of Y\" nav linking to /{slug}/page/{n} (AGL-620). */\nfunction paginationNodes(\n collection: FallbackCollection,\n pagination: FallbackListPagination,\n category?: FallbackListCategory,\n): { childId: string; nodes: NodesMap } {\n // Page 1 lives at the bare listing; deeper pages at .../page/{n}. Built\n // through the shared pager computation so this fallback and the\n // `{{pagination.*}}` tokens an authored template binds (AGL-1386) can never\n // disagree — and so the pager stays inside the category it is paging\n // (AGL-1321): a \"next\" that dropped the filter would silently return the\n // reader to the unfiltered list. An edge is the empty string, which is\n // exactly the \"no link here\" this fallback already meant.\n const { page, totalPages, prevUrl, nextUrl } = Aglyn.collectionPaginationLinks(\n {\n collectionSlug: collection.slug,\n ...(category ? { categorySlug: category.slug } : {}),\n page: pagination.page,\n totalPages: pagination.totalPages,\n },\n )\n const children: string[] = []\n const nodes: NodesMap = {}\n if (prevUrl) {\n nodes[id('prev')] = {\n $id: id('prev'),\n componentId: 'muiScreenLink',\n pluginId: 'mui',\n parentId: id('pager'),\n props: { href: prevUrl, children: '← Newer' },\n }\n children.push(id('prev'))\n }\n nodes[id('pageinfo')] = {\n $id: id('pageinfo'),\n componentId: 'muiTypography',\n pluginId: 'mui',\n parentId: id('pager'),\n props: {\n variant: 'body2',\n children: `Page ${page} of ${totalPages}`,\n sx: { color: 'text.secondary' },\n },\n }\n children.push(id('pageinfo'))\n if (nextUrl) {\n nodes[id('next')] = {\n $id: id('next'),\n componentId: 'muiScreenLink',\n pluginId: 'mui',\n parentId: id('pager'),\n props: { href: nextUrl, children: 'Older →' },\n }\n children.push(id('next'))\n }\n nodes[id('pager')] = {\n $id: id('pager'),\n componentId: 'muiStack',\n pluginId: 'mui',\n parentId: id('stack'),\n props: {\n direction: 'row',\n spacing: 3,\n sx: { alignItems: 'center', justifyContent: 'center' },\n },\n nodes: children,\n }\n return { childId: id('pager'), nodes }\n}\n\n/**\n * Built-in entry list as canvas nodes (AGL-551): a heading plus a\n * Collection entries block whose template (title, date, excerpt, Read\n * more) the compose pipeline expands over the published entries — the same\n * block designers drop onto their own list-template screens. With\n * `pagination` (AGL-620) the block renders one page and prev/next nav links\n * to `/{slug}/page/{n}`.\n */\nexport function buildCollectionListFallbackNodes(\n collection: FallbackCollection,\n hasEntries: boolean,\n pagination?: FallbackListPagination,\n category?: FallbackListCategory,\n): NodesMap {\n const [titleId, title] = typography('title', {\n variant: 'h3',\n component: 'h1',\n // A filtered listing says which slice it is (AGL-1321) — a page of\n // Guides whose only heading reads \"Blog\" tells the reader nothing about\n // why the other posts vanished.\n children: category\n ? `${collection.displayName} · ${category.name}`\n : collection.displayName,\n })\n // Category pills (AGL-1321): stamped by `expandCollectionCategories` during\n // compose, from the same taxonomy this node's collection carries. Present\n // in the EMPTY case too — a filtered listing with no entries whose pills\n // vanished would be a dead end with no way back to \"All\".\n const pills = collection.categories?.length\n ? {\n $id: id('pills'),\n componentId: Aglyn.COLLECTION_CATEGORIES_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: { allLabel: 'All' },\n }\n : null\n const lead = pills ? [titleId, id('pills')] : [titleId]\n if (!hasEntries) {\n const [emptyId, empty] = typography('empty', {\n variant: 'body1',\n children: category\n ? `Nothing published in ${category.name} yet.`\n : 'Nothing published yet.',\n sx: { color: 'text.secondary' },\n })\n return {\n ...shell([...lead, emptyId], listShell()),\n [titleId]: title,\n ...(pills ? { [id('pills')]: pills } : {}),\n [emptyId]: empty,\n }\n }\n const item = (suffix: string, props: Record<string, unknown>) => ({\n $id: id(suffix),\n componentId: 'muiTypography' as const,\n pluginId: 'mui',\n parentId: id('item'),\n props,\n })\n const pager =\n pagination && pagination.totalPages > 1\n ? paginationNodes(collection, pagination, category)\n : null\n return {\n ...shell(\n pager\n ? [...lead, id('entries'), pager.childId]\n : [...lead, id('entries')],\n listShell(),\n ),\n [titleId]: title,\n ...(pills ? { [id('pills')]: pills } : {}),\n [id('entries')]: {\n $id: id('entries'),\n componentId: Aglyn.COLLECTION_ENTRIES_COMPONENT_ID,\n pluginId: 'mui',\n parentId: id('stack'),\n props: {\n spacing: 4,\n ...(pagination\n ? { perPage: pagination.perPage, page: pagination.page }\n : {}),\n },\n nodes: [id('item')],\n },\n ...(pager ? pager.nodes : {}),\n [id('item')]: {\n $id: id('item'),\n componentId: 'muiStack',\n pluginId: 'mui',\n parentId: id('entries'),\n props: { spacing: 0.5 },\n nodes: [\n id('item-title'),\n id('item-date'),\n id('item-excerpt'),\n id('item-link'),\n ],\n },\n [id('item-title')]: item('item-title', {\n variant: 'h5',\n component: 'h2',\n children: '{{entry.title}}',\n }),\n [id('item-date')]: item('item-date', {\n variant: 'caption',\n children: '{{entry.date}}',\n sx: { color: 'text.secondary' },\n }),\n [id('item-excerpt')]: item('item-excerpt', {\n variant: 'body1',\n children: '{{entry.excerpt}}',\n }),\n [id('item-link')]: {\n $id: id('item-link'),\n componentId: 'muiScreenLink',\n pluginId: 'mui',\n parentId: id('item'),\n props: {\n href: '{{entry.url}}',\n children: 'Read more',\n size: 'small',\n sx: { alignSelf: 'flex-start' },\n },\n },\n }\n}\n\n/** Entry vs list fallback selection for the routed content (AGL-551). */\nexport function buildCollectionFallbackNodes(content: {\n collection: FallbackCollection\n entries: FallbackEntry[]\n entry: FallbackEntry | null\n pagination?: FallbackListPagination | null\n category?: FallbackListCategory | null\n /** The composing site, for host-qualifying a media reference (AGL-1407). */\n hostId?: string\n}): NodesMap {\n return content.entry\n ? buildCollectionEntryFallbackNodes(\n content.collection,\n content.entry,\n content.hostId,\n )\n : buildCollectionListFallbackNodes(\n content.collection,\n content.entries.length > 0,\n content.pagination ?? undefined,\n content.category ?? undefined,\n )\n}\n\nexport default buildCollectionFallbackNodes\n"],"names":["wistiaMediaId","Aglyn","FALLBACK_ID_PREFIX","id","suffix","formatDate","value","formatCollectionEntryDate","RENDERABLE_COVER_URL","cssUrlValue","url","replace","char","encodeURIComponent","ENTRY_MAX_WIDTH","LIST_MAX_WIDTH","LIST_SECTION_GAP","entryShell","maxWidth","stackProps","spacing","listShell","sx","display","flexDirection","gap","shell","childIds","layout","NODE_ROOT_ID","$id","componentId","nodes","pluginId","parentId","props","paddingTop","paddingBottom","typography","featuredVideoProps","entry","options","src","coverVideo","trim","resolveMediaSrc","hostId","undefined","poster","posterRenders","coverImage","description","seoDescription","excerpt","uploadDate","collectionEntryPublishedAtIso","publishedAt","title","width","buildCollectionEntryFallbackNodes","collection","entries","variant","component","children","date","tags","filter","Boolean","categoryName","resolveEntryCategoryName","categories","length","push","COLLECTION_ENTRY_META_COMPONENT_ID","category","join","coverRenders","test","video","VIDEO_COMPONENT_ID","role","backgroundImage","backgroundSize","backgroundPosition","borderRadius","minHeight","COLLECTION_ENTRY_BODY_COMPONENT_ID","markdown","body","COLLECTION_RELATED_COMPONENT_ID","heading","limit","COLLECTION_SHARE_COMPONENT_ID","href","slug","displayName","alignSelf","map","entryId","Object","fromEntries","paginationNodes","pagination","page","totalPages","prevUrl","nextUrl","collectionPaginationLinks","collectionSlug","categorySlug","color","direction","alignItems","justifyContent","childId","buildCollectionListFallbackNodes","hasEntries","titleId","name","pills","COLLECTION_CATEGORIES_COMPONENT_ID","allLabel","lead","emptyId","empty","item","pager","COLLECTION_ENTRIES_COMPONENT_ID","perPage","size","buildCollectionFallbackNodes","content"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAQ,sCAAqC;AACnE,YAAYC,WAAW,sBAAqB;AAE5C,kEAAkE,GAClE,MAAMC,qBAAqB;AAE3B,MAAMC,KAAK,CAACC,SAAmB,GAAGF,qBAAqBE,QAAQ;AA+B/D,yEAAyE;AACzE,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,MAAMC,aAAa,CAACC,QAClBL,MAAMM,yBAAyB,CAACD;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GACD,MAAME,uBAAuB;AAE7B;;;;;;;;;;;;;;CAcC,GACD,MAAMC,cAAc,CAACC,MACnBA,IAAIC,OAAO,CAAC,cAAc,CAACC,OAASC,mBAAmBD;AAEzD;;;;;;CAMC,GACD,MAAME,kBAAkB;AAExB;;;;;CAKC,GACD,MAAMC,iBAAiB;AAEvB;;;;;;;;;;;CAWC,GACD,MAAMC,mBAAmB;AAUzB,wEAAwE,GACxE,MAAMC,aAAa,IAAoB,CAAA;QACrCC,UAAUJ;QACVK,YAAY;YAAEC,SAAS;QAAE;IAC3B,CAAA;AAEA;;;;;;;;CAQC,GACD,MAAMC,YAAY,IAAoB,CAAA;QACpCH,UAAUH;QACVI,YAAY;YACVG,IAAI;gBACFC,SAAS;gBACTC,eAAe;gBACfC,KAAKT;YACP;QACF;IACF,CAAA;AAEA,yEAAyE,GACzE,SAASU,MAAMC,QAAkB,EAAEC,MAAmB;IACpD,OAAO;QACL,CAAC3B,MAAM4B,YAAY,CAAC,EAAE;YACpBC,KAAK7B,MAAM4B,YAAY;YACvBE,aAAa;YACbC,OAAO;gBAAC7B,GAAG;aAAa;QAC1B;QACA,CAACA,GAAG,aAAa,EAAE;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|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn/server';
|
|
18
|
+
import type { AuthorContent } from './get-author-content';
|
|
19
|
+
/**
|
|
20
|
+
* The host field naming the screen every author page renders through
|
|
21
|
+
* (AGL-2518).
|
|
22
|
+
*
|
|
23
|
+
* ## Why the HOST and not the author
|
|
24
|
+
*
|
|
25
|
+
* A collection names its own list and entry templates because a site
|
|
26
|
+
* legitimately designs its changelog differently from its blog. Author pages
|
|
27
|
+
* are not like that: they are one page shape repeated per person, and letting
|
|
28
|
+
* each author record name its own template would mean a masthead where the
|
|
29
|
+
* design changes as the reader clicks between colleagues — plus a template
|
|
30
|
+
* picker on a form whose whole subject is a byline.
|
|
31
|
+
*
|
|
32
|
+
* ## Why a SCREEN and not a layout
|
|
33
|
+
*
|
|
34
|
+
* The opposite call from `builtInPageLayoutId` (AGL-2513), and for the reason
|
|
35
|
+
* that comment gives in reverse. Search results have no design worth
|
|
36
|
+
* authoring — the platform composes the body and the site only chooses the
|
|
37
|
+
* chrome around it. An author page has: a portrait, a bio, a role, links, and
|
|
38
|
+
* a listing whose cards a designer wants to match the blog's. That is a page,
|
|
39
|
+
* so the author designs it as one, with `{{author.*}}` tokens and the same
|
|
40
|
+
* Collection entries block every list template uses.
|
|
41
|
+
*
|
|
42
|
+
* Unset is the ordinary case rather than a misconfiguration, and it renders
|
|
43
|
+
* the built-in body — bylines link to this address, so it must always answer.
|
|
44
|
+
*/
|
|
45
|
+
export declare const AUTHOR_PAGE_SCREEN_FIELD: "authorScreenId";
|
|
46
|
+
/**
|
|
47
|
+
* The pseudo-collection an author page's entries block resolves against.
|
|
48
|
+
*
|
|
49
|
+
* The compose pipeline keys entry sources by collection slug, and this page
|
|
50
|
+
* has no single collection — it mixes them. Its entries are handed over
|
|
51
|
+
* already in hand (`ComposeCollectionContext.entries`), which is a path that
|
|
52
|
+
* never touches Firestore, so the key only has to be a name that no real
|
|
53
|
+
* collection can take: a collection slug is a URL segment, and this is not a
|
|
54
|
+
* legal one.
|
|
55
|
+
*
|
|
56
|
+
* It never reaches a URL. Every entry on this page carries its OWN
|
|
57
|
+
* `collectionSlug` out of the read that found it, and `collectionEntryTokens`
|
|
58
|
+
* prefers that — which is the whole reason a cross-collection listing can
|
|
59
|
+
* build correct `entry.url`s at all.
|
|
60
|
+
*/
|
|
61
|
+
export declare const AUTHOR_ENTRIES_SOURCE_SLUG = "__author__";
|
|
62
|
+
/** What the author route renders. */
|
|
63
|
+
export interface ComposedAuthorPage {
|
|
64
|
+
/** The template screen doc, when one is designated; null for the built-in. */
|
|
65
|
+
screen: Record<string, any> | null;
|
|
66
|
+
nodes: Record<string, any>;
|
|
67
|
+
/**
|
|
68
|
+
* The current pair of each picture the head's card may name (AGL-2850): the
|
|
69
|
+
* author's share card, then their portrait. Read in the composition's
|
|
70
|
+
* batch, and absent when it answered for neither.
|
|
71
|
+
*/
|
|
72
|
+
socialImageFacts?: Aglyn.SocialImageAssetFacts;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* An author page composed through the screen the host designated (AGL-2518).
|
|
76
|
+
*
|
|
77
|
+
* The `composeCollectionTemplatePage` shape: the screen goes through the
|
|
78
|
+
* NORMAL published pipeline — theme, shared layout, reusable components,
|
|
79
|
+
* Collection entries blocks — with `{{author.*}}` and `{{pagination.*}}`
|
|
80
|
+
* substituted and Author Profile blocks filled from the record.
|
|
81
|
+
*
|
|
82
|
+
* Returns null when no screen is designated, or when the designated one has
|
|
83
|
+
* been deleted, so the caller falls through to the built-in body rather than
|
|
84
|
+
* serving a 404 for a page a byline links to.
|
|
85
|
+
*/
|
|
86
|
+
export declare function composeAuthorTemplatePage(options: {
|
|
87
|
+
hostId: string;
|
|
88
|
+
host: any;
|
|
89
|
+
content: AuthorContent;
|
|
90
|
+
}): Promise<ComposedAuthorPage | null>;
|
|
91
|
+
/**
|
|
92
|
+
* The built-in author page (AGL-2518) — the body this file's own nodes build,
|
|
93
|
+
* grafted into the site's shared layout so it carries the same header, nav and
|
|
94
|
+
* footer as the posts it links to.
|
|
95
|
+
*
|
|
96
|
+
* Which layout is the host's to choose (`resolveBuiltInPageLayoutId`), shared
|
|
97
|
+
* with site search so the two platform-built pages of a site cannot end up in
|
|
98
|
+
* different chrome.
|
|
99
|
+
*
|
|
100
|
+
* Fail-open to `null`, and the route then renders the body with no chrome at
|
|
101
|
+
* all. A person's page must not be the page that 500s because a layout was
|
|
102
|
+
* deleted.
|
|
103
|
+
*/
|
|
104
|
+
export declare function composeAuthorFallbackPage(options: {
|
|
105
|
+
hostId: string;
|
|
106
|
+
host: any;
|
|
107
|
+
content: AuthorContent;
|
|
108
|
+
}): Promise<ComposedAuthorPage | null>;
|
|
109
|
+
export default composeAuthorTemplatePage;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import * as Aglyn from "@aglyn/aglyn/server";
|
|
18
|
+
import buildAuthorPageNodes from "./author-page-nodes.js";
|
|
19
|
+
import { resolveBuiltInPageLayoutId } from "./built-in-page-layout.js";
|
|
20
|
+
import composeScreenNodes, { composeNodesWithChrome } from "./compose-screen-nodes.js";
|
|
21
|
+
import getScreen from "./get-screen.js";
|
|
22
|
+
import { collectSocialImageFacts } from "./social-image-facts.js";
|
|
23
|
+
/**
|
|
24
|
+
* The host field naming the screen every author page renders through
|
|
25
|
+
* (AGL-2518).
|
|
26
|
+
*
|
|
27
|
+
* ## Why the HOST and not the author
|
|
28
|
+
*
|
|
29
|
+
* A collection names its own list and entry templates because a site
|
|
30
|
+
* legitimately designs its changelog differently from its blog. Author pages
|
|
31
|
+
* are not like that: they are one page shape repeated per person, and letting
|
|
32
|
+
* each author record name its own template would mean a masthead where the
|
|
33
|
+
* design changes as the reader clicks between colleagues — plus a template
|
|
34
|
+
* picker on a form whose whole subject is a byline.
|
|
35
|
+
*
|
|
36
|
+
* ## Why a SCREEN and not a layout
|
|
37
|
+
*
|
|
38
|
+
* The opposite call from `builtInPageLayoutId` (AGL-2513), and for the reason
|
|
39
|
+
* that comment gives in reverse. Search results have no design worth
|
|
40
|
+
* authoring — the platform composes the body and the site only chooses the
|
|
41
|
+
* chrome around it. An author page has: a portrait, a bio, a role, links, and
|
|
42
|
+
* a listing whose cards a designer wants to match the blog's. That is a page,
|
|
43
|
+
* so the author designs it as one, with `{{author.*}}` tokens and the same
|
|
44
|
+
* Collection entries block every list template uses.
|
|
45
|
+
*
|
|
46
|
+
* Unset is the ordinary case rather than a misconfiguration, and it renders
|
|
47
|
+
* the built-in body — bylines link to this address, so it must always answer.
|
|
48
|
+
*/ export const AUTHOR_PAGE_SCREEN_FIELD = 'authorScreenId';
|
|
49
|
+
/**
|
|
50
|
+
* The pseudo-collection an author page's entries block resolves against.
|
|
51
|
+
*
|
|
52
|
+
* The compose pipeline keys entry sources by collection slug, and this page
|
|
53
|
+
* has no single collection — it mixes them. Its entries are handed over
|
|
54
|
+
* already in hand (`ComposeCollectionContext.entries`), which is a path that
|
|
55
|
+
* never touches Firestore, so the key only has to be a name that no real
|
|
56
|
+
* collection can take: a collection slug is a URL segment, and this is not a
|
|
57
|
+
* legal one.
|
|
58
|
+
*
|
|
59
|
+
* It never reaches a URL. Every entry on this page carries its OWN
|
|
60
|
+
* `collectionSlug` out of the read that found it, and `collectionEntryTokens`
|
|
61
|
+
* prefers that — which is the whole reason a cross-collection listing can
|
|
62
|
+
* build correct `entry.url`s at all.
|
|
63
|
+
*/ export const AUTHOR_ENTRIES_SOURCE_SLUG = '__author__';
|
|
64
|
+
/** The tokens and entry context both compose paths share. */ function authorComposeContext(content) {
|
|
65
|
+
var _content_author, _content_author1;
|
|
66
|
+
const address = content.author ? {
|
|
67
|
+
author: content.author
|
|
68
|
+
} : {
|
|
69
|
+
authorName: content.slug
|
|
70
|
+
};
|
|
71
|
+
const pager = Aglyn.contentAuthorPaginationLinks(_extends({}, address, {
|
|
72
|
+
page: content.page,
|
|
73
|
+
totalPages: content.totalPages
|
|
74
|
+
}));
|
|
75
|
+
return {
|
|
76
|
+
/**
|
|
77
|
+
* The pictures the head builds the card from, in its order: the share
|
|
78
|
+
* card, then the portrait (AGL-2850). The author head reads the record
|
|
79
|
+
* alone and never the site default, so the host's image is not one.
|
|
80
|
+
*/ cardImages: [
|
|
81
|
+
(_content_author = content.author) == null ? void 0 : _content_author.seoImage,
|
|
82
|
+
(_content_author1 = content.author) == null ? void 0 : _content_author1.image
|
|
83
|
+
],
|
|
84
|
+
tokens: _extends({}, Aglyn.contentAuthorTokens(content.author, {
|
|
85
|
+
entryCount: content.totalEntries
|
|
86
|
+
}), {
|
|
87
|
+
// The byline falls back to the raw segment for an unknown author, so a
|
|
88
|
+
// heading bound to `{{author.name}}` prints something either way.
|
|
89
|
+
'author.name': content.name,
|
|
90
|
+
// Named `pagination.*` rather than `author.page*`, so a designer who has
|
|
91
|
+
// already built a pager on a collection list template rebuilds nothing
|
|
92
|
+
// here — and so the two pagers cannot drift into two spellings of the
|
|
93
|
+
// same four values. The edges are the empty string, which is what makes
|
|
94
|
+
// an unconditional binding correct on page 1 of 1.
|
|
95
|
+
'pagination.page': String(pager.page),
|
|
96
|
+
'pagination.totalPages': String(pager.totalPages),
|
|
97
|
+
'pagination.prevUrl': pager.prevUrl,
|
|
98
|
+
'pagination.nextUrl': pager.nextUrl
|
|
99
|
+
}),
|
|
100
|
+
collection: {
|
|
101
|
+
slug: AUTHOR_ENTRIES_SOURCE_SLUG,
|
|
102
|
+
// The slug above is a key, not an address (AGL-2524) — so a block that
|
|
103
|
+
// would build a URL out of it resolves nothing instead.
|
|
104
|
+
routeless: true,
|
|
105
|
+
// Already narrowed to this author AND to this page's window by the
|
|
106
|
+
// loader, for the reason the category route states: a page count
|
|
107
|
+
// computed over the whole set advertises pages that render empty.
|
|
108
|
+
entries: content.entries,
|
|
109
|
+
categories: content.categories,
|
|
110
|
+
page: content.page
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* An author page composed through the screen the host designated (AGL-2518).
|
|
116
|
+
*
|
|
117
|
+
* The `composeCollectionTemplatePage` shape: the screen goes through the
|
|
118
|
+
* NORMAL published pipeline — theme, shared layout, reusable components,
|
|
119
|
+
* Collection entries blocks — with `{{author.*}}` and `{{pagination.*}}`
|
|
120
|
+
* substituted and Author Profile blocks filled from the record.
|
|
121
|
+
*
|
|
122
|
+
* Returns null when no screen is designated, or when the designated one has
|
|
123
|
+
* been deleted, so the caller falls through to the built-in body rather than
|
|
124
|
+
* serving a 404 for a page a byline links to.
|
|
125
|
+
*/ export async function composeAuthorTemplatePage(options) {
|
|
126
|
+
var _ref;
|
|
127
|
+
const { hostId, host, content } = options;
|
|
128
|
+
const screenId = String((_ref = host == null ? void 0 : host[AUTHOR_PAGE_SCREEN_FIELD]) != null ? _ref : '').trim();
|
|
129
|
+
if (!screenId) return null;
|
|
130
|
+
try {
|
|
131
|
+
// `allowTemplate`, exactly as a collection template is read: the screen is
|
|
132
|
+
// deliberately not servable at an address of its own, and this is the
|
|
133
|
+
// composition it exists for.
|
|
134
|
+
const templateRes = await getScreen({
|
|
135
|
+
hostId,
|
|
136
|
+
screenId,
|
|
137
|
+
allowTemplate: true
|
|
138
|
+
});
|
|
139
|
+
if (!templateRes.screen) return null;
|
|
140
|
+
const { cardImages, tokens, collection } = authorComposeContext(content);
|
|
141
|
+
const card = collectSocialImageFacts(cardImages);
|
|
142
|
+
const nodes = await composeScreenNodes({
|
|
143
|
+
hostId,
|
|
144
|
+
screenId,
|
|
145
|
+
screen: templateRes.screen,
|
|
146
|
+
tokens,
|
|
147
|
+
collection,
|
|
148
|
+
socialImages: card.socialImages,
|
|
149
|
+
// The designated screen's host variables, and its layout's, fill in
|
|
150
|
+
// from this site, as the built-in author page's already do (AGL-2883).
|
|
151
|
+
host: host
|
|
152
|
+
});
|
|
153
|
+
if (!nodes) return null;
|
|
154
|
+
/*
|
|
155
|
+
The screen document travels UNCHANGED, and deliberately carries no
|
|
156
|
+
composed SEO.
|
|
157
|
+
|
|
158
|
+
A collection template composes the entry's title and cover into
|
|
159
|
+
`screen.seo` because `page.tsx` reads that on its way to the head. An
|
|
160
|
+
author page does not take that path: its head branch has the author
|
|
161
|
+
RECORD in hand and builds the title, description and portrait from it
|
|
162
|
+
directly, before the screen branch is ever reached. Writing a second,
|
|
163
|
+
unread copy here would be a value that looks authoritative, is dead, and
|
|
164
|
+
goes stale the first time the head's rule changes — which is how a
|
|
165
|
+
template's stored title came to name every post in a collection
|
|
166
|
+
(AGL-1345).
|
|
167
|
+
*/ return _extends({
|
|
168
|
+
screen: templateRes.screen,
|
|
169
|
+
nodes: Aglyn.expandContentAuthorProfile(nodes, content.author)
|
|
170
|
+
}, card.collected());
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error('author template composition failed', error);
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The built-in author page (AGL-2518) — the body this file's own nodes build,
|
|
178
|
+
* grafted into the site's shared layout so it carries the same header, nav and
|
|
179
|
+
* footer as the posts it links to.
|
|
180
|
+
*
|
|
181
|
+
* Which layout is the host's to choose (`resolveBuiltInPageLayoutId`), shared
|
|
182
|
+
* with site search so the two platform-built pages of a site cannot end up in
|
|
183
|
+
* different chrome.
|
|
184
|
+
*
|
|
185
|
+
* Fail-open to `null`, and the route then renders the body with no chrome at
|
|
186
|
+
* all. A person's page must not be the page that 500s because a layout was
|
|
187
|
+
* deleted.
|
|
188
|
+
*/ export async function composeAuthorFallbackPage(options) {
|
|
189
|
+
const { hostId, host, content } = options;
|
|
190
|
+
try {
|
|
191
|
+
const layoutId = await resolveBuiltInPageLayoutId({
|
|
192
|
+
hostId,
|
|
193
|
+
host
|
|
194
|
+
});
|
|
195
|
+
const { cardImages, tokens, collection } = authorComposeContext(content);
|
|
196
|
+
const card = collectSocialImageFacts(cardImages);
|
|
197
|
+
const nodes = await composeNodesWithChrome({
|
|
198
|
+
hostId,
|
|
199
|
+
layoutId,
|
|
200
|
+
socialImages: card.socialImages,
|
|
201
|
+
screenNodes: buildAuthorPageNodes({
|
|
202
|
+
slug: content.slug,
|
|
203
|
+
name: content.name,
|
|
204
|
+
author: content.author,
|
|
205
|
+
hasEntries: content.entries.length > 0,
|
|
206
|
+
page: content.page,
|
|
207
|
+
perPage: content.perPage,
|
|
208
|
+
totalPages: content.totalPages
|
|
209
|
+
}),
|
|
210
|
+
tokens,
|
|
211
|
+
collection,
|
|
212
|
+
host: host
|
|
213
|
+
});
|
|
214
|
+
return nodes ? _extends({
|
|
215
|
+
screen: null,
|
|
216
|
+
nodes
|
|
217
|
+
}, card.collected()) : null;
|
|
218
|
+
} catch (error) {
|
|
219
|
+
console.error('author page composition failed', error);
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export default composeAuthorTemplatePage;
|
|
224
|
+
|
|
225
|
+
//# sourceMappingURL=compose-author-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/tenant/runtime/src/lib/compose-author-page.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn/server'\nimport buildAuthorPageNodes from './author-page-nodes'\nimport { resolveBuiltInPageLayoutId } from './built-in-page-layout'\nimport composeScreenNodes, {\n composeNodesWithChrome,\n} from './compose-screen-nodes'\nimport type { AuthorContent } from './get-author-content'\nimport getScreen from './get-screen'\nimport { collectSocialImageFacts } from './social-image-facts'\n\n/**\n * The host field naming the screen every author page renders through\n * (AGL-2518).\n *\n * ## Why the HOST and not the author\n *\n * A collection names its own list and entry templates because a site\n * legitimately designs its changelog differently from its blog. Author pages\n * are not like that: they are one page shape repeated per person, and letting\n * each author record name its own template would mean a masthead where the\n * design changes as the reader clicks between colleagues — plus a template\n * picker on a form whose whole subject is a byline.\n *\n * ## Why a SCREEN and not a layout\n *\n * The opposite call from `builtInPageLayoutId` (AGL-2513), and for the reason\n * that comment gives in reverse. Search results have no design worth\n * authoring — the platform composes the body and the site only chooses the\n * chrome around it. An author page has: a portrait, a bio, a role, links, and\n * a listing whose cards a designer wants to match the blog's. That is a page,\n * so the author designs it as one, with `{{author.*}}` tokens and the same\n * Collection entries block every list template uses.\n *\n * Unset is the ordinary case rather than a misconfiguration, and it renders\n * the built-in body — bylines link to this address, so it must always answer.\n */\nexport const AUTHOR_PAGE_SCREEN_FIELD = 'authorScreenId' as const\n\n/**\n * The pseudo-collection an author page's entries block resolves against.\n *\n * The compose pipeline keys entry sources by collection slug, and this page\n * has no single collection — it mixes them. Its entries are handed over\n * already in hand (`ComposeCollectionContext.entries`), which is a path that\n * never touches Firestore, so the key only has to be a name that no real\n * collection can take: a collection slug is a URL segment, and this is not a\n * legal one.\n *\n * It never reaches a URL. Every entry on this page carries its OWN\n * `collectionSlug` out of the read that found it, and `collectionEntryTokens`\n * prefers that — which is the whole reason a cross-collection listing can\n * build correct `entry.url`s at all.\n */\nexport const AUTHOR_ENTRIES_SOURCE_SLUG = '__author__'\n\n/** What the author route renders. */\nexport interface ComposedAuthorPage {\n /** The template screen doc, when one is designated; null for the built-in. */\n screen: Record<string, any> | null\n nodes: Record<string, any>\n /**\n * The current pair of each picture the head's card may name (AGL-2850): the\n * author's share card, then their portrait. Read in the composition's\n * batch, and absent when it answered for neither.\n */\n socialImageFacts?: Aglyn.SocialImageAssetFacts\n}\n\n/** The tokens and entry context both compose paths share. */\nfunction authorComposeContext(content: AuthorContent) {\n const address = content.author\n ? { author: content.author }\n : { authorName: content.slug }\n const pager = Aglyn.contentAuthorPaginationLinks({\n ...address,\n page: content.page,\n totalPages: content.totalPages,\n })\n return {\n /**\n * The pictures the head builds the card from, in its order: the share\n * card, then the portrait (AGL-2850). The author head reads the record\n * alone and never the site default, so the host's image is not one.\n */\n cardImages: [content.author?.seoImage, content.author?.image],\n tokens: {\n ...Aglyn.contentAuthorTokens(content.author, {\n entryCount: content.totalEntries,\n }),\n // The byline falls back to the raw segment for an unknown author, so a\n // heading bound to `{{author.name}}` prints something either way.\n 'author.name': content.name,\n // Named `pagination.*` rather than `author.page*`, so a designer who has\n // already built a pager on a collection list template rebuilds nothing\n // here — and so the two pagers cannot drift into two spellings of the\n // same four values. The edges are the empty string, which is what makes\n // an unconditional binding correct on page 1 of 1.\n 'pagination.page': String(pager.page),\n 'pagination.totalPages': String(pager.totalPages),\n 'pagination.prevUrl': pager.prevUrl,\n 'pagination.nextUrl': pager.nextUrl,\n } as Record<string, string>,\n collection: {\n slug: AUTHOR_ENTRIES_SOURCE_SLUG,\n // The slug above is a key, not an address (AGL-2524) — so a block that\n // would build a URL out of it resolves nothing instead.\n routeless: true,\n // Already narrowed to this author AND to this page's window by the\n // loader, for the reason the category route states: a page count\n // computed over the whole set advertises pages that render empty.\n entries: content.entries,\n categories: content.categories,\n page: content.page,\n },\n }\n}\n\n/**\n * An author page composed through the screen the host designated (AGL-2518).\n *\n * The `composeCollectionTemplatePage` shape: the screen goes through the\n * NORMAL published pipeline — theme, shared layout, reusable components,\n * Collection entries blocks — with `{{author.*}}` and `{{pagination.*}}`\n * substituted and Author Profile blocks filled from the record.\n *\n * Returns null when no screen is designated, or when the designated one has\n * been deleted, so the caller falls through to the built-in body rather than\n * serving a 404 for a page a byline links to.\n */\nexport async function composeAuthorTemplatePage(options: {\n hostId: string\n host: any\n content: AuthorContent\n}): Promise<ComposedAuthorPage | null> {\n const { hostId, host, content } = options\n const screenId = String(host?.[AUTHOR_PAGE_SCREEN_FIELD] ?? '').trim()\n if (!screenId) return null\n try {\n // `allowTemplate`, exactly as a collection template is read: the screen is\n // deliberately not servable at an address of its own, and this is the\n // composition it exists for.\n const templateRes = await getScreen({\n hostId,\n screenId,\n allowTemplate: true,\n })\n if (!templateRes.screen) return null\n const { cardImages, tokens, collection } = authorComposeContext(content)\n const card = collectSocialImageFacts(cardImages)\n const nodes = await composeScreenNodes({\n hostId,\n screenId,\n screen: templateRes.screen,\n tokens,\n collection,\n socialImages: card.socialImages,\n // The designated screen's host variables, and its layout's, fill in\n // from this site, as the built-in author page's already do (AGL-2883).\n host: host as Aglyn.HostTokenSource,\n })\n if (!nodes) return null\n /*\n The screen document travels UNCHANGED, and deliberately carries no\n composed SEO.\n\n A collection template composes the entry's title and cover into\n `screen.seo` because `page.tsx` reads that on its way to the head. An\n author page does not take that path: its head branch has the author\n RECORD in hand and builds the title, description and portrait from it\n directly, before the screen branch is ever reached. Writing a second,\n unread copy here would be a value that looks authoritative, is dead, and\n goes stale the first time the head's rule changes — which is how a\n template's stored title came to name every post in a collection\n (AGL-1345).\n */\n return {\n screen: templateRes.screen as Record<string, any>,\n nodes: Aglyn.expandContentAuthorProfile(nodes, content.author),\n ...card.collected(),\n }\n } catch (error) {\n console.error('author template composition failed', error)\n return null\n }\n}\n\n/**\n * The built-in author page (AGL-2518) — the body this file's own nodes build,\n * grafted into the site's shared layout so it carries the same header, nav and\n * footer as the posts it links to.\n *\n * Which layout is the host's to choose (`resolveBuiltInPageLayoutId`), shared\n * with site search so the two platform-built pages of a site cannot end up in\n * different chrome.\n *\n * Fail-open to `null`, and the route then renders the body with no chrome at\n * all. A person's page must not be the page that 500s because a layout was\n * deleted.\n */\nexport async function composeAuthorFallbackPage(options: {\n hostId: string\n host: any\n content: AuthorContent\n}): Promise<ComposedAuthorPage | null> {\n const { hostId, host, content } = options\n try {\n const layoutId = await resolveBuiltInPageLayoutId({ hostId, host })\n const { cardImages, tokens, collection } = authorComposeContext(content)\n const card = collectSocialImageFacts(cardImages)\n const nodes = await composeNodesWithChrome({\n hostId,\n layoutId,\n socialImages: card.socialImages,\n screenNodes: buildAuthorPageNodes({\n slug: content.slug,\n name: content.name,\n author: content.author,\n hasEntries: content.entries.length > 0,\n page: content.page,\n perPage: content.perPage,\n totalPages: content.totalPages,\n }),\n tokens,\n collection,\n host: host as Aglyn.HostTokenSource,\n })\n return nodes ? { screen: null, nodes, ...card.collected() } : null\n } catch (error) {\n console.error('author page composition failed', error)\n return null\n }\n}\n\nexport default composeAuthorTemplatePage\n"],"names":["Aglyn","buildAuthorPageNodes","resolveBuiltInPageLayoutId","composeScreenNodes","composeNodesWithChrome","getScreen","collectSocialImageFacts","AUTHOR_PAGE_SCREEN_FIELD","AUTHOR_ENTRIES_SOURCE_SLUG","authorComposeContext","content","address","author","authorName","slug","pager","contentAuthorPaginationLinks","page","totalPages","cardImages","seoImage","image","tokens","contentAuthorTokens","entryCount","totalEntries","name","String","prevUrl","nextUrl","collection","routeless","entries","categories","composeAuthorTemplatePage","options","hostId","host","screenId","trim","templateRes","allowTemplate","screen","card","nodes","socialImages","expandContentAuthorProfile","collected","error","console","composeAuthorFallbackPage","layoutId","screenNodes","hasEntries","length","perPage"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,sBAAqB;AAC5C,OAAOC,0BAA0B,yBAAqB;AACtD,SAASC,0BAA0B,QAAQ,4BAAwB;AACnE,OAAOC,sBACLC,sBAAsB,QACjB,4BAAwB;AAE/B,OAAOC,eAAe,kBAAc;AACpC,SAASC,uBAAuB,QAAQ,0BAAsB;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,MAAMC,2BAA2B,iBAAyB;AAEjE;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,6BAA6B,aAAY;AAetD,2DAA2D,GAC3D,SAASC,qBAAqBC,OAAsB;QAenCA,iBAA0BA;IAdzC,MAAMC,UAAUD,QAAQE,MAAM,GAC1B;QAAEA,QAAQF,QAAQE,MAAM;IAAC,IACzB;QAAEC,YAAYH,QAAQI,IAAI;IAAC;IAC/B,MAAMC,QAAQf,MAAMgB,4BAA4B,CAAC,aAC5CL;QACHM,MAAMP,QAAQO,IAAI;QAClBC,YAAYR,QAAQQ,UAAU;;IAEhC,OAAO;QACL;;;;KAIC,GACDC,YAAY;aAACT,kBAAAA,QAAQE,MAAM,qBAAdF,gBAAgBU,QAAQ;aAAEV,mBAAAA,QAAQE,MAAM,qBAAdF,iBAAgBW,KAAK;SAAC;QAC7DC,QAAQ,aACHtB,MAAMuB,mBAAmB,CAACb,QAAQE,MAAM,EAAE;YAC3CY,YAAYd,QAAQe,YAAY;QAClC;YACA,uEAAuE;YACvE,kEAAkE;YAClE,eAAef,QA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8C,0BAA0B,CAACF,OAAOlC,QAAQE,MAAM;WAC1D+B,KAAKI,SAAS;IAErB,EAAE,OAAOC,OAAO;QACdC,QAAQD,KAAK,CAAC,sCAAsCA;QACpD,OAAO;IACT;AACF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,eAAeE,0BAA0Bf,OAI/C;IACC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE3B,OAAO,EAAE,GAAGyB;IAClC,IAAI;QACF,MAAMgB,WAAW,MAAMjD,2BAA2B;YAAEkC;YAAQC;QAAK;QACjE,MAAM,EAAElB,UAAU,EAAEG,MAAM,EAAEQ,UAAU,EAAE,GAAGrB,qBAAqBC;QAChE,MAAMiC,OAAOrC,wBAAwBa;QACrC,MAAMyB,QAAQ,MAAMxC,uBAAuB;YACzCgC;YACAe;YACAN,cAAcF,KAAKE,YAAY;YAC/BO,aAAanD,qBAAqB;gBAChCa,MAAMJ,QAAQI,IAAI;gBAClBY,MAAMhB,QAAQgB,IAAI;gBAClBd,QAAQF,QAAQE,MAAM;gBACtByC,YAAY3C,QAAQsB,OAAO,CAACsB,MAAM,GAAG;gBACrCrC,MAAMP,QAAQO,IAAI;gBAClBsC,SAAS7C,QAAQ6C,OAAO;gBACxBrC,YAAYR,QAAQQ,UAAU;YAChC;YACAI;YACAQ;YACAO,MAAMA;QACR;QACA,OAAOO,QAAQ;YAAEF,QAAQ;YAAME;WAAUD,KAAKI,SAAS,MAAO;IAChE,EAAE,OAAOC,OAAO;QACdC,QAAQD,KAAK,CAAC,kCAAkCA;QAChD,OAAO;IACT;AACF;AAEA,eAAed,0BAAyB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn/server';
|
|
18
|
+
import type { CollectionContent } from './get-collection-content';
|
|
19
|
+
type CollectionDoc = NonNullable<CollectionContent['collection']>;
|
|
20
|
+
/**
|
|
21
|
+
* Which template screen a collection route renders through (AGL-551):
|
|
22
|
+
* `/{collection}` uses `listScreenId`, `/{collection}/{entry}` uses
|
|
23
|
+
* `entryScreenId` — falling back to the legacy AGL-105 `templateScreenId`
|
|
24
|
+
* so existing blogs keep rendering. `undefined` means no template is set
|
|
25
|
+
* and the designed built-in fallback applies.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveCollectionTemplateScreenId(collection: Pick<CollectionDoc, 'listScreenId' | 'entryScreenId' | 'templateScreenId'>, kind: 'list' | 'entry'): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Page-level `{{collection.*}}` tokens for template screens (AGL-551), plus
|
|
30
|
+
* the routed category (AGL-1321) so a list template can name what it is
|
|
31
|
+
* showing — "Guides" rather than a heading that says "Blog" on every filtered
|
|
32
|
+
* URL. Both category tokens resolve to the empty string on the unfiltered
|
|
33
|
+
* listing, which is what makes them safe to bind unconditionally.
|
|
34
|
+
*
|
|
35
|
+
* `{{pagination.*}}` follows the same design (AGL-1386). One static list
|
|
36
|
+
* screen serves the bare listing, every `/page/{n}` and every
|
|
37
|
+
* `/category/{slug}`, so a hand-built pager on it renders identically on all
|
|
38
|
+
* of them: "Older →" on a category that has one page, pointing at a URL that
|
|
39
|
+
* dropped the filter. The URLs come from `collectionPaginationLinks`, which
|
|
40
|
+
* builds them through the shared listing-URL builder (so they carry the
|
|
41
|
+
* category) and resolves the EDGES TO THE EMPTY STRING — no previous page,
|
|
42
|
+
* no `prevUrl`. There is no runtime conditional to hide a link with (the
|
|
43
|
+
* `condition` field on nodes is editor-side field visibility, not a render
|
|
44
|
+
* gate), so the empty string is what makes an unconditional binding correct
|
|
45
|
+
* on every route: a link whose href does not resolve renders as an inert
|
|
46
|
+
* placeholder of the same element (AGL-1268/1357).
|
|
47
|
+
*
|
|
48
|
+
* This SURFACES what the platform already computes — the built-in fallback
|
|
49
|
+
* pager reads the same function, so the two cannot drift.
|
|
50
|
+
*/
|
|
51
|
+
export declare function collectionTokens(collection: Pick<CollectionDoc, 'displayName' | 'slug'>, category?: CollectionContent['category'], pagination?: CollectionContent['pagination']): Record<string, string>;
|
|
52
|
+
export interface ComposedCollectionPage {
|
|
53
|
+
/** Template screen doc with the entry/collection SEO merged in. */
|
|
54
|
+
screen: Record<string, any>;
|
|
55
|
+
nodes: Record<string, any>;
|
|
56
|
+
/**
|
|
57
|
+
* The current pair of each asset the head's card may name (AGL-2850): the
|
|
58
|
+
* entry's cover, the template's image, the site default. Read in the
|
|
59
|
+
* composition's batch, and absent when it answered for none of them.
|
|
60
|
+
*/
|
|
61
|
+
socialImageFacts?: Aglyn.SocialImageAssetFacts;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Renders a collection route through its designated template screen
|
|
65
|
+
* (AGL-551), the same mechanism as commerce PDP/collection templates: the
|
|
66
|
+
* screen composes through the NORMAL published pipeline — theme, shared
|
|
67
|
+
* layout, reusable components — with `{{entry.*}}`/`{{collection.*}}`
|
|
68
|
+
* tokens substituted and Collection entries blocks expanded. Returns null
|
|
69
|
+
* when no template is designated (or it fails to compose) so the caller
|
|
70
|
+
* falls through to the designed built-in fallback.
|
|
71
|
+
*/
|
|
72
|
+
export declare function composeCollectionTemplatePage(options: {
|
|
73
|
+
hostId: string;
|
|
74
|
+
content: CollectionContent;
|
|
75
|
+
/**
|
|
76
|
+
* The site, whose default card the head falls back to after the entry's
|
|
77
|
+
* cover and the template's image (AGL-2850). Its document is read in this
|
|
78
|
+
* page's batch with theirs.
|
|
79
|
+
*/
|
|
80
|
+
host?: Aglyn.AglynHost | null;
|
|
81
|
+
}): Promise<ComposedCollectionPage | null>;
|
|
82
|
+
/**
|
|
83
|
+
* The designed built-in rendering (AGL-551): when a collection has no
|
|
84
|
+
* template screen, its routes still compose through the site's theme and
|
|
85
|
+
* the host's default shared layout (the home screen's layout) instead of
|
|
86
|
+
* the old unthemed article. Fail-open — any error returns null and the
|
|
87
|
+
* caller keeps the legacy plain rendering.
|
|
88
|
+
*/
|
|
89
|
+
export declare function composeCollectionFallbackPage(options: {
|
|
90
|
+
hostId: string;
|
|
91
|
+
host: Aglyn.AglynHost;
|
|
92
|
+
content: CollectionContent;
|
|
93
|
+
}): Promise<Omit<ComposedCollectionPage, 'screen'> | null>;
|
|
94
|
+
export default composeCollectionTemplatePage;
|