bearminion 1.20.0 → 1.22.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 (47) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +3 -3
  3. package/dist/astro.d.ts +16 -7
  4. package/dist/astro.js +212 -93
  5. package/dist/cli.js +903 -4
  6. package/dist/content-types-46XqPaW4.js +505 -0
  7. package/dist/content.d.ts +24 -3
  8. package/dist/content.js +83 -6
  9. package/dist/{editor-context-DzRwKENi.d.ts → editor-context-D1yfPp21.d.ts} +95 -8
  10. package/dist/{github-store-Dt_YuOPD.js → github-store-B2folBeq.js} +551 -206
  11. package/dist/{github-store-DsLCe5MR.d.ts → github-store-CuhvbFCh.d.ts} +1 -1
  12. package/dist/hosted-astro.js +1 -1
  13. package/dist/{hosted-middleware-CsROahka.js → hosted-middleware-DHLIedeV.js} +1 -1
  14. package/dist/hosted-overlay.js +1 -1
  15. package/dist/hosted.d.ts +10 -4
  16. package/dist/hosted.js +68 -9
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.js +11 -6
  19. package/dist/{migrate-b408EaLp.js → migrate-Cm30puW8.js} +2 -2
  20. package/dist/{page-wlcQJAA-.js → page-C7zE_HD1.js} +5 -1
  21. package/dist/{page-BGSTL63-.d.ts → page-CpVElMPH.d.ts} +193 -37
  22. package/dist/{request-guards-BcSUj8Gc.js → request-guards-DtNVdqQ7.js} +1 -1
  23. package/dist/{collections-Bm3RWg2K.js → routing-jKeq4LwO.js} +213 -57
  24. package/dist/routing-yPy8hEfZ.d.ts +137 -0
  25. package/dist/{theme-BvqJ8UnS.js → theme-DTVVNMlr.js} +1 -1
  26. package/dist/ui/mount.js +3294 -1259
  27. package/package.json +2 -2
  28. package/registry/default/files/src/components/organisms/EntryList.astro +83 -0
  29. package/registry/default/files/src/components/organisms/Pagination.astro +56 -0
  30. package/registry/default/files/src/components/sections/contact/definition.ts +6 -2
  31. package/registry/default/files/src/components/sections/faq/definition.ts +2 -2
  32. package/registry/default/files/src/components/sections/media/Media.astro +2 -2
  33. package/registry/default/files/src/components/sections/media/MediaPlayer.astro +2 -2
  34. package/registry/default/files/src/components/sections/pricing/definition.ts +16 -1
  35. package/registry/default/files/src/components/sections/shared.ts +3 -0
  36. package/registry/default/files/src/components/sections/stats/definition.ts +6 -1
  37. package/registry/default/files/src/components/sections/testimonials/definition.ts +13 -1
  38. package/registry/default/files/src/components/sections/text-image/definition.ts +1 -1
  39. package/registry/default/files/src/components/seo/Seo.astro +3 -1
  40. package/registry/default/files/src/content.config.ts +21 -0
  41. package/registry/default/files/src/env.d.ts +2 -0
  42. package/registry/default/files/src/lib/content.ts +81 -0
  43. package/registry/default/files/src/lib/editing.ts +6 -0
  44. package/registry/default/files/src/lib/sitemap.ts +48 -0
  45. package/registry/default/files/src/pages/[...slug].astro +30 -16
  46. package/registry/default/registry.json +77 -21
  47. package/dist/preview-DFLna-Be.d.ts +0 -42
package/dist/hosted.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as CollectionOptions, n as ImageConvertOptions, t as EditorContext, v as collection, y as ContentStore } from "./editor-context-DzRwKENi.js";
2
- import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-DsLCe5MR.js";
3
- import { g as ContentModel, n as PageRules, t as Page } from "./page-BGSTL63-.js";
4
- import { r as ThemePreviewSource } from "./preview-DFLna-Be.js";
1
+ import { C as collection, S as CollectionOptions, n as ImageConvertOptions, t as EditorContext, w as ContentStore } from "./editor-context-D1yfPp21.js";
2
+ import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-CuhvbFCh.js";
3
+ import { f as ContentModel, n as PageRules, t as Page } from "./page-CpVElMPH.js";
4
+ import { h as ThemePreviewSource, o as Route } from "./routing-yPy8hEfZ.js";
5
5
  //#region src/api.d.ts
6
6
  interface HandleMeta {
7
7
  /**
@@ -112,6 +112,12 @@ interface StoreContent {
112
112
  getSite(): Promise<unknown>;
113
113
  /** One page by slug (the home page is `index`), or `undefined` when there is none or the slug is not a slug. */
114
114
  getPage(slug: string): Promise<Page | undefined>;
115
+ /**
116
+ * What the address `pathname` shows: a page, an entry of a declared type, a single, or one page of a listing. The
117
+ * same answer the static build gives for that address, drafts included, since this is what an editor is looking at.
118
+ * Undefined when nothing lives there.
119
+ */
120
+ getRoute(pathname: string): Promise<Route | undefined>;
115
121
  }
116
122
  interface StoreContentOptions {
117
123
  /**
package/dist/hosted.js CHANGED
@@ -1,17 +1,19 @@
1
- import { C as previewRenderers, O as ContentReadError, c as resolveCollections, g as pageKey, h as SITE_KEY, k as ContentValidationError, t as collection, v as StoreError, y as StoreKeyError } from "./collections-Bm3RWg2K.js";
2
- import { t as defaultTheme } from "./theme-BvqJ8UnS.js";
3
- import { a as resolvePageRules, c as withoutOrphanSections, n as createPageSchema, r as createTolerantPageSchema, s as slugSchema } from "./page-wlcQJAA-.js";
4
- import { n as createMigrator } from "./migrate-b408EaLp.js";
1
+ import { A as ContentValidationError, a as listingRoute, g as resolveCollections, i as listedEntries, k as ContentReadError, l as collection, o as matchPath, s as normalizePath, t as emptySingle, w as previewRenderers } from "./routing-jKeq4LwO.js";
2
+ import { t as defaultTheme } from "./theme-DTVVNMlr.js";
3
+ import { i as createTolerantPageSchema, l as slugSchema, r as createPageSchema, s as resolvePageRules, u as withoutOrphanSections } from "./page-C7zE_HD1.js";
4
+ import { C as pageKey, D as StoreKeyError, E as StoreError, S as SITE_KEY, f as entryKey, i as LISTING_MIGRATION_TYPE, l as createEntrySchema, m as listingKey, u as createListingSchema, y as resolveTypes } from "./content-types-46XqPaW4.js";
5
+ import { n as createMigrator } from "./migrate-Cm30puW8.js";
5
6
  import { i as resolveMaxImageBytes, r as resolveConvert } from "./upload-rules-Cao9uY5K.js";
6
- import { f as DEFAULT_VIDEO_BYTE_LIMIT, n as missingImageSvg, r as handleEditorRequest, t as githubStore } from "./github-store-Dt_YuOPD.js";
7
+ import { f as DEFAULT_VIDEO_BYTE_LIMIT, n as missingImageSvg, r as handleEditorRequest, t as githubStore } from "./github-store-B2folBeq.js";
7
8
  import { S as isAssetPath } from "./draft-store-DBEfw_Gq.js";
8
- import { n as AUTH_PREFIX, r as createHostedAuth, t as createHostedMiddleware } from "./hosted-middleware-CsROahka.js";
9
+ import { n as AUTH_PREFIX, r as createHostedAuth, t as createHostedMiddleware } from "./hosted-middleware-DHLIedeV.js";
9
10
  //#region src/hosted-context.ts
10
11
  /** The context for `handleEditorRequest`. */
11
12
  function createHostedContext(options) {
12
13
  if (!options.sections) throw new Error("createHostedContext() needs the `sections` option: the site's section definitions.");
13
14
  if (!options.site) throw new Error("createHostedContext() needs the `site` option: the site definition from defineSite().");
14
15
  if (!options.store) throw new Error("createHostedContext() needs the `store` option, such as githubStore({ ... }).");
16
+ const pageRules = resolvePageRules(options.pages);
15
17
  return {
16
18
  root: "",
17
19
  contentDir: "",
@@ -19,9 +21,10 @@ function createHostedContext(options) {
19
21
  videosDir: "",
20
22
  maxVideoBytes: DEFAULT_VIDEO_BYTE_LIMIT,
21
23
  maxImageBytes: resolveMaxImageBytes(options.maxImageBytes),
22
- pageRules: resolvePageRules(options.pages),
24
+ pageRules,
23
25
  imageConvert: resolveConvert(options.imageConvert),
24
26
  sections: options.sections,
27
+ types: resolveTypes(options, pageRules),
25
28
  site: options.site,
26
29
  theme: options.theme ?? defaultTheme,
27
30
  store: options.store,
@@ -109,7 +112,28 @@ async function serveStoreAsset(request, store) {
109
112
  function createStoreContent(model, store, options = {}) {
110
113
  const migrator = createMigrator(model);
111
114
  const tolerant = options.tolerateOrphans !== false;
112
- async function read(key, kind) {
115
+ const types = resolveTypes(model);
116
+ const orphans = { tolerateOrphans: tolerant };
117
+ /** One stored page-like document, checked like the build checks it, or undefined when there is no such file. */
118
+ async function document(key, schema, type) {
119
+ const raw = await read(key, "page", type);
120
+ if (raw === void 0) return void 0;
121
+ const parsed = schema.safeParse(raw);
122
+ if (!parsed.success) throw new ContentValidationError(key, parsed.error.issues);
123
+ return withoutOrphanSections(parsed.data, model.sections);
124
+ }
125
+ const entryOf = (type, key) => document(key, createEntrySchema(model.sections, type, orphans), type.id);
126
+ /** Every entry of a type. A listing needs each entry's title and sort field, so it reads them all. */
127
+ async function entriesOf(type) {
128
+ const names = (await store.list(type.dir) ?? []).filter((name) => name.endsWith(".json") && !name.startsWith(".") && !name.startsWith("_"));
129
+ return (await Promise.all(names.map((name) => entryOf(type, `${type.dir}/${name}`)))).filter((entry) => entry !== void 0);
130
+ }
131
+ async function siteLang() {
132
+ const raw = await read(SITE_KEY, "site");
133
+ const lang = typeof raw === "object" && raw !== null && "lang" in raw ? raw.lang : void 0;
134
+ return typeof lang === "string" && lang !== "" ? lang : "en";
135
+ }
136
+ async function read(key, kind, type) {
113
137
  const text = await store.read(key);
114
138
  if (text === void 0) return void 0;
115
139
  let raw;
@@ -118,7 +142,7 @@ function createStoreContent(model, store, options = {}) {
118
142
  } catch (error) {
119
143
  throw new ContentReadError(key, `Invalid JSON in ${key}: ${error instanceof Error ? error.message : String(error)}`);
120
144
  }
121
- const upgraded = migrator.upgrade(raw, kind);
145
+ const upgraded = migrator.upgrade(raw, kind, type);
122
146
  if (!upgraded.ok) throw new ContentValidationError(key, [{
123
147
  path: [],
124
148
  message: upgraded.message
@@ -141,6 +165,41 @@ function createStoreContent(model, store, options = {}) {
141
165
  const parsed = (tolerant ? createTolerantPageSchema(model.sections) : createPageSchema(model.sections)).safeParse(raw);
142
166
  if (!parsed.success) throw new ContentValidationError(key, parsed.error.issues);
143
167
  return withoutOrphanSections(parsed.data, model.sections);
168
+ },
169
+ async getRoute(pathname) {
170
+ const match = matchPath(types, pathname);
171
+ if (match === null) return void 0;
172
+ if (match.kind === "single") {
173
+ const { type } = match;
174
+ const page = await entryOf(type, type.key) ?? (type.builtIn ? void 0 : emptySingle(type));
175
+ return page && {
176
+ kind: "page",
177
+ type: type.id,
178
+ path: type.path,
179
+ page
180
+ };
181
+ }
182
+ if (match.kind === "entry") {
183
+ const { type, slug } = match;
184
+ if (type === types.pages && slug === types.home.slug) return void 0;
185
+ const page = await entryOf(type, entryKey(type, slug));
186
+ return page && page.slug === slug ? {
187
+ kind: "page",
188
+ type: type.id,
189
+ path: normalizePath(pathname),
190
+ page
191
+ } : void 0;
192
+ }
193
+ const { type, page } = match;
194
+ const [entries, listing, locale] = await Promise.all([
195
+ entriesOf(type),
196
+ document(listingKey(type), createListingSchema(model.sections, orphans), LISTING_MIGRATION_TYPE),
197
+ siteLang()
198
+ ]);
199
+ return listingRoute(type, listing, listedEntries(type, entries, {
200
+ locale,
201
+ drafts: true
202
+ }), page);
144
203
  }
145
204
  };
146
205
  }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as CollectionOptions, a as CommitRequest, c as HistoryEntry, d as SaveResponse, f as SitePreview, g as GitInfo, h as ChangedFile, i as ApiProblem, l as PageListItem, m as UploadedVideo, o as CommitResult, p as UploadedImage, r as ApiIssue, s as CreatePageRequest, u as SaveRequest, v as collection } from "./editor-context-DzRwKENi.js";
1
+ import { C as collection, S as CollectionOptions, _ as SitePreview, a as CommitRequest, b as ChangedFile, c as CreateEntryRequest, d as EntryListItem, f as HistoryEntry, g as SaveResponse, h as SaveRequest, i as ApiProblem, l as CreatePageRequest, m as PageListItem, o as CommitResult, p as ListMeta, r as ApiIssue, s as ContentTypeInfo, u as DocumentAt, v as UploadedImage, x as GitInfo, y as UploadedVideo } from "./editor-context-D1yfPp21.js";
2
2
  import { _ as renderMarkedHtml, a as WeightMark, f as markClass, g as reconcileMarks, i as TextRun, l as fontMarks, m as marksFromEmphasis, o as applyTextMark, r as TextMark, t as FontMark, v as splitMarkedText, y as weightMarks } from "./marks-BzLa48Y9.js";
3
- import { $ as mergeJsonLd, $t as tones, A as SectionDefinition, At as MAX_NAV_DEPTH, B as FieldIcons, Bt as toneSchema, C as ContentMigration, Ct as siteConsentSchema, D as SCHEMA_VERSION_KEY, Dt as ButtonStyle, E as DocumentKind, Et as themeSchema, F as defineWireframe, Ft as imageSchema, G as SiteJsonLdIds, Gt as EnumOption, H as ShowWhen, Ht as withEmphasis, I as wireKinds, It as linkSchema, J as generateSiteJsonLd, Jt as StringOption, K as SiteJsonLdSource, Kt as NumberOption, L as wireframeIssues, Lt as richTextSchema, M as WireKind, Mt as Text, N as WireRect, Nt as Tone, O as createMigrator, Ot as Image, P as Wireframe, Pt as htmlIdSchema, Q as jsonLdWarnings, Qt as toneOption, R as OptionalContent, Rt as textMarkSchema, S as defineTheme, St as siteAnalyticsSchema, T as ContentVersioning, Tt as themeColorsSchema, U as JsonLdBlock, Ut as BooleanOption, V as ShowCondition, Vt as trackingIdSchema, W as JsonLdResult, Wt as CountRule, X as isPlaceholderSiteUrl, Xt as motionOption, Y as hasJsonLdId, Yt as buttonStyles, Z as jsonLdSchema, Zt as themeModes, _ as SectionRegistry, _t as SiteSeo, a as createPageSchema, at as DEFAULT_MAX_HEADER_ACTIONS, b as ThemeFont, bt as brandLogoSchema, c as withoutOrphanSections, ct as FooterConfig, d as SectionOf, dt as Site, en as variantOption, et as parseJsonLdInput, f as anchorSchema, ft as SiteAnalytics, g as ContentModel, gt as SiteOf, h as API_PREFIX, ht as SiteDefinition, i as Seo, it as DEFAULT_MAX_FOOTER_COLUMNS, j as defineSection, jt as RichText, k as SectionConfig, kt as Link, l as BaseSection, lt as Header, m as sectionIdSchema, mt as SiteConsent, nt as upsertJsonLd, o as isSystemPage, ot as Footer, p as createSectionSchema, pt as SiteConfig, q as formatJsonLd, qt as Option, r as SYSTEM_PAGES, rt as BRAND_LOGO_HEIGHT, s as seoSchema, st as FooterColumn, t as Page, tt as siteJsonLdIds, u as PropsOf, ut as HeaderConfig, v as ThemeConfig, vt as SiteWith, w as ContentMigrator, wt as siteSeoSchema, x as defaultTheme, xt as defineSite, y as ThemeDefinition, yt as Theme, z as FieldChoices, zt as textSchema } from "./page-BGSTL63-.js";
3
+ import { $ as WireRect, $t as Tone, A as ListingOptions, At as HeaderConfig, B as multi, Bt as brandLogoSchema, C as SCHEMA_VERSION_KEY, Ct as BRAND_LOGO_HEIGHT, D as Entry, Dt as FooterColumn, E as ContentTypes, Et as Footer, F as SingleType, Ft as SiteDefinition, G as SectionOf, Gt as themeColorsSchema, H as single, Ht as siteAnalyticsSchema, I as SortRule, It as SiteOf, J as sectionIdSchema, Jt as Image, K as anchorSchema, Kt as themeSchema, L as TypeOptions, Lt as SiteSeo, M as ResolvedTypes, Mt as SiteAnalytics, N as SINGLES_COLLECTION, Nt as SiteConfig, O as LISTINGS_COLLECTION, Ot as FooterConfig, P as SingleOptions, Pt as SiteConsent, Q as WireKind, Qt as Text, Rt as SiteWith, S as DocumentKind, St as upsertJsonLd, T as ContentType, Tt as DEFAULT_MAX_HEADER_ACTIONS, U as BaseSection, Ut as siteConsentSchema, V as resolveTypes, Vt as defineSite, W as PropsOf, Wt as siteSeoSchema, X as SectionDefinition, Xt as MAX_NAV_DEPTH, Y as SectionConfig, Yt as Link, Z as defineSection, Zt as RichText, _ as defaultTheme, _n as themeModes, _t as jsonLdSchema, a as Seo, an as textSchema, at as FieldChoices, b as ContentMigrator, bn as variantOption, bt as parseJsonLdInput, c as pageStatusSchema, cn as withEmphasis, ct as ShowWhen, d as API_PREFIX, dn as EnumOption, dt as SiteJsonLdIds, en as htmlIdSchema, et as Wireframe, f as ContentModel, fn as NumberOption, ft as SiteJsonLdSource, g as ThemeFont, gn as motionOption, gt as isPlaceholderSiteUrl, h as ThemeDefinition, hn as buttonStyles, ht as hasJsonLdId, i as SYSTEM_PAGES, in as textMarkSchema, it as OptionalContent, j as MultiType, jt as Site, k as ListingDocument, kt as Header, l as seoSchema, ln as BooleanOption, lt as JsonLdBlock, m as ThemeConfig, mn as StringOption, mt as generateSiteJsonLd, nn as linkSchema, nt as wireKinds, o as createPageSchema, on as toneSchema, ot as FieldIcons, p as SectionRegistry, pn as Option, pt as formatJsonLd, q as createSectionSchema, qt as ButtonStyle, r as PageStatus, rn as richTextSchema, rt as wireframeIssues, s as isSystemPage, sn as trackingIdSchema, st as ShowCondition, t as Page, tn as imageSchema, tt as defineWireframe, u as withoutOrphanSections, un as CountRule, ut as JsonLdResult, v as defineTheme, vn as toneOption, vt as jsonLdWarnings, w as createMigrator, wt as DEFAULT_MAX_FOOTER_COLUMNS, x as ContentVersioning, xt as siteJsonLdIds, y as ContentMigration, yn as tones, yt as mergeJsonLd, z as defineTypes, zt as Theme } from "./page-CpVElMPH.js";
4
4
  import { a as TURNSTILE_FIELD, i as HONEYPOT_FIELD, n as FormResult, r as FormSubmission, t as FormFieldErrors } from "./form-contract-BURSJP3Y.js";
5
- import { i as defineThemePreview, n as ThemePreview, t as SitePreviewHtml } from "./preview-DFLna-Be.js";
5
+ import { a as PathMatch, c as SiteContent, d as matchPath, f as siteRoutes, g as defineThemePreview, i as Pagination, l as findRoute, m as ThemePreview, n as ListingRoute, o as Route, p as SitePreviewHtml, r as PageRoute, s as RouteOptions, t as ListedEntry, u as isDraft } from "./routing-yPy8hEfZ.js";
6
6
  //#region src/errors.d.ts
7
7
  /** One schema problem, addressed by a dot path such as `sections.0.props.heading`. */
8
8
  interface ContentIssue {
@@ -167,4 +167,4 @@ interface ContrastCheck {
167
167
  /** Text pairs a visitor reads: text on its background, label on the accent fill, link on its background. */
168
168
  export declare function contrastChecks(colors: ThemeColors | undefined): ContrastCheck[];
169
169
  //#endregion
170
- export { API_PREFIX, type ApiIssue, type ApiProblem, BRAND_LOGO_HEIGHT, type BaseSection, type BooleanOption, type ButtonStyle, type ChangedFile, type CollectionOptions, type CommitRequest, type CommitResult, type ConsentCopy, type ConsentReopen, type ConsentText, type ConsentTextKey, type ContentIssue, type ContentMigration, type ContentMigrator, type ContentModel, type ContentVersioning, type ContrastCheck, type CountRule, type CreatePageRequest, DEFAULT_MAX_FOOTER_COLUMNS, DEFAULT_MAX_HEADER_ACTIONS, type DocumentKind, type EnumOption, type FieldChoices, type FieldIcons, type FontMark, type Footer, type FooterColumn, type FooterConfig, type FormFieldErrors, type FormResult, type FormSubmission, type GitInfo, HONEYPOT_FIELD, type Header, type HeaderConfig, type HistoryEntry, type Image, type ImageFit, type ImagePosition, type JsonLdBlock, type JsonLdResult, type Link, MAX_NAV_DEPTH, type MediaSource, type NumberOption, type Option, type OptionalContent, type Page, type PageListItem, type PropsOf, type RichText, SCHEMA_VERSION_KEY, SYSTEM_PAGES, type SaveRequest, type SaveResponse, type SectionConfig, type SectionDefinition, type SectionOf, type SectionRegistry, type Seo, type ShowCondition, type ShowWhen, type Site, type SiteAnalytics, type SiteConfig, type SiteConsent, type SiteDefinition, type SiteJsonLdIds, type SiteJsonLdSource, type SiteOf, type SitePreview, type SitePreviewHtml, type SiteSeo, type SiteWith, type StringOption, TURNSTILE_FIELD, type Text, type TextMark, type TextRun, type Theme, type ThemeColors, type ThemeConfig, type ThemeDefinition, type ThemeFont, type ThemePreview, type Tone, type UploadedImage, type UploadedVideo, type WeightMark, type WireKind, type WireRect, type Wireframe, anchorSchema, applyTextMark, brandLogoSchema, buttonStyles, collection, createMigrator, createPageSchema, createSectionSchema, defaultTheme, defineSection, defineSite, defineTheme, defineThemePreview, defineWireframe, fontMarks, formatJsonLd, generateSiteJsonLd, hasJsonLdId, htmlIdSchema, imageSchema, isPlaceholderSiteUrl, isSystemPage, jsonLdSchema, jsonLdWarnings, linkSchema, markClass, marksFromEmphasis, mergeJsonLd, motionOption, parseJsonLdInput, reconcileMarks, renderMarkedHtml, richTextSchema, sectionIdSchema, seoSchema, siteAnalyticsSchema, siteConsentSchema, siteJsonLdIds, siteSeoSchema, splitMarkedText, textMarkSchema, textSchema, themeColorsSchema, themeModes, themeSchema, toneOption, toneSchema, tones, trackingIdSchema, upsertJsonLd, variantOption, weightMarks, wireKinds, wireframeIssues, withEmphasis, withoutOrphanSections };
170
+ export { API_PREFIX, type ApiIssue, type ApiProblem, BRAND_LOGO_HEIGHT, type BaseSection, type BooleanOption, type ButtonStyle, type ChangedFile, type CollectionOptions, type CommitRequest, type CommitResult, type ConsentCopy, type ConsentReopen, type ConsentText, type ConsentTextKey, type ContentIssue, type ContentMigration, type ContentMigrator, type ContentModel, type ContentType, type ContentTypeInfo, type ContentTypes, type ContentVersioning, type ContrastCheck, type CountRule, type CreateEntryRequest, type CreatePageRequest, DEFAULT_MAX_FOOTER_COLUMNS, DEFAULT_MAX_HEADER_ACTIONS, type DocumentAt, type DocumentKind, type Entry, type EntryListItem, type EnumOption, type FieldChoices, type FieldIcons, type FontMark, type Footer, type FooterColumn, type FooterConfig, type FormFieldErrors, type FormResult, type FormSubmission, type GitInfo, HONEYPOT_FIELD, type Header, type HeaderConfig, type HistoryEntry, type Image, type ImageFit, type ImagePosition, type JsonLdBlock, type JsonLdResult, LISTINGS_COLLECTION, type Link, type ListMeta, type ListedEntry, type ListingDocument, type ListingOptions, type ListingRoute, MAX_NAV_DEPTH, type MediaSource, type MultiType, type NumberOption, type Option, type OptionalContent, type Page, type PageListItem, type PageRoute, type PageStatus, type Pagination, type PathMatch, type PropsOf, type ResolvedTypes, type RichText, type Route, type RouteOptions, SCHEMA_VERSION_KEY, SINGLES_COLLECTION, SYSTEM_PAGES, type SaveRequest, type SaveResponse, type SectionConfig, type SectionDefinition, type SectionOf, type SectionRegistry, type Seo, type ShowCondition, type ShowWhen, type SingleOptions, type SingleType, type Site, type SiteAnalytics, type SiteConfig, type SiteConsent, type SiteContent, type SiteDefinition, type SiteJsonLdIds, type SiteJsonLdSource, type SiteOf, type SitePreview, type SitePreviewHtml, type SiteSeo, type SiteWith, type SortRule, type StringOption, TURNSTILE_FIELD, type Text, type TextMark, type TextRun, type Theme, type ThemeColors, type ThemeConfig, type ThemeDefinition, type ThemeFont, type ThemePreview, type Tone, type TypeOptions, type UploadedImage, type UploadedVideo, type WeightMark, type WireKind, type WireRect, type Wireframe, anchorSchema, applyTextMark, brandLogoSchema, buttonStyles, collection, createMigrator, createPageSchema, createSectionSchema, defaultTheme, defineSection, defineSite, defineTheme, defineThemePreview, defineTypes, defineWireframe, findRoute, fontMarks, formatJsonLd, generateSiteJsonLd, hasJsonLdId, htmlIdSchema, imageSchema, isDraft, isPlaceholderSiteUrl, isSystemPage, jsonLdSchema, jsonLdWarnings, linkSchema, markClass, marksFromEmphasis, matchPath, mergeJsonLd, motionOption, multi, pageStatusSchema, parseJsonLdInput, reconcileMarks, renderMarkedHtml, resolveTypes, richTextSchema, sectionIdSchema, seoSchema, single, siteAnalyticsSchema, siteConsentSchema, siteJsonLdIds, siteRoutes, siteSeoSchema, splitMarkedText, textMarkSchema, textSchema, themeColorsSchema, themeModes, themeSchema, toneOption, toneSchema, tones, trackingIdSchema, upsertJsonLd, variantOption, weightMarks, wireKinds, wireframeIssues, withEmphasis, withoutOrphanSections };
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { A as formatContentIssues, D as ContentError, E as schemaProps, O as ContentReadError, k as ContentValidationError, t as collection, w as enumFields, x as defineThemePreview } from "./collections-Bm3RWg2K.js";
2
- import { n as defineTheme, t as defaultTheme } from "./theme-BvqJ8UnS.js";
3
- import { A as textMarkSchema, B as isImagePosition, C as upsertJsonLd, D as imageSchema, E as htmlIdSchema, F as DEFAULT_IMAGE_FIT, G as toneOption, H as buttonStyles, I as DEFAULT_IMAGE_POSITION, K as tones, L as IMAGE_FITS, M as toneSchema, N as trackingIdSchema, O as linkSchema, P as withEmphasis, R as IMAGE_POSITIONS, S as siteJsonLdIds, T as addMarkIssues, U as motionOption, W as themeModes, _ as isPlaceholderSiteUrl, b as mergeJsonLd, c as withoutOrphanSections, f as sectionIdSchema, g as hasJsonLdId, h as generateSiteJsonLd, i as isSystemPage, j as textSchema, k as richTextSchema, l as anchorSchema, m as formatJsonLd, n as createPageSchema, o as seoSchema, p as walkLinkIds, q as variantOption, t as SYSTEM_PAGES, u as createSectionSchema, v as jsonLdSchema, w as MAX_NAV_DEPTH, x as parseJsonLdInput, y as jsonLdWarnings, z as isImageFit } from "./page-wlcQJAA-.js";
1
+ import { A as ContentValidationError, D as schemaProps, O as ContentError, S as defineThemePreview, T as enumFields, c as siteRoutes, j as formatContentIssues, k as ContentReadError, l as collection, n as findRoute, o as matchPath, r as isDraft } from "./routing-jKeq4LwO.js";
2
+ import { n as defineTheme, t as defaultTheme } from "./theme-DTVVNMlr.js";
3
+ import { A as imageSchema, B as IMAGE_FITS, C as mergeJsonLd, D as MAX_NAV_DEPTH, E as upsertJsonLd, F as toneSchema, G as buttonStyles, H as isImageFit, I as trackingIdSchema, J as toneOption, K as motionOption, L as withEmphasis, M as richTextSchema, N as textMarkSchema, O as addMarkIssues, P as textSchema, R as DEFAULT_IMAGE_FIT, S as jsonLdWarnings, T as siteJsonLdIds, U as isImagePosition, V as IMAGE_POSITIONS, X as variantOption, Y as tones, _ as formatJsonLd, a as isSystemPage, b as isPlaceholderSiteUrl, c as seoSchema, d as anchorSchema, f as createSectionSchema, g as walkLinkIds, h as sectionIdSchema, j as linkSchema, k as htmlIdSchema, o as pageStatusSchema, q as themeModes, r as createPageSchema, t as SYSTEM_PAGES, u as withoutOrphanSections, v as generateSiteJsonLd, w as parseJsonLdInput, x as jsonLdSchema, y as hasJsonLdId, z as DEFAULT_IMAGE_POSITION } from "./page-C7zE_HD1.js";
4
4
  import { d as reconcileMarks, f as renderMarkedHtml, i as fontMarks, l as marksFromEmphasis, m as weightMarks, p as splitMarkedText, s as markClass, t as applyTextMark } from "./marks-DPBilumg.js";
5
- import { n as createMigrator, r as API_PREFIX, t as SCHEMA_VERSION_KEY } from "./migrate-b408EaLp.js";
5
+ import { _ as multi, b as single, d as defineTypes, n as LISTINGS_COLLECTION, s as SINGLES_COLLECTION, y as resolveTypes } from "./content-types-46XqPaW4.js";
6
+ import { n as createMigrator, r as API_PREFIX, t as SCHEMA_VERSION_KEY } from "./migrate-Cm30puW8.js";
6
7
  import { n as TURNSTILE_FIELD, t as HONEYPOT_FIELD } from "./form-contract-CIDTNab-.js";
7
8
  import { _ as consentCopy, a as contrastRatio, b as parseMediaSource, c as hasThemeColors, d as tokenToHex, f as CONSENT_COPY, g as CONSENT_REOPEN, h as CONSENT_LIMITS, i as contrastChecks, l as hexToToken, m as CONSENT_HREF_MESSAGE, n as HEX_COLOR, o as derivePalette, p as CONSENT_HREF, s as hasOverrides, u as themeCss, v as consentTextIssues, y as VIDEO_FILE } from "./theme-colors-CHROGZkI.js";
8
9
  import { z } from "zod";
@@ -250,7 +251,11 @@ const siteSeoSchema = z.object({
250
251
  description: z.string().optional(),
251
252
  ogImage: z.string().min(1).optional(),
252
253
  /** Structured data emitted on every page, such as `Organization` and `WebSite`. A page's own blocks add to it. */
253
- jsonLd: jsonLdSchema.optional()
254
+ jsonLd: jsonLdSchema.optional(),
255
+ /** `false` asks search engines to stay away: every page gets `noindex` and robots.txt disallows the site. Absent means true. */
256
+ robots: z.boolean().optional(),
257
+ /** `false` leaves `sitemap.xml` out of the build. Absent means true. */
258
+ sitemap: z.boolean().optional()
254
259
  }).strict();
255
260
  /**
256
261
  * Raw HTML snippets for analytics and similar tags. A theme renders `head` at the end of `<head>` and
@@ -459,4 +464,4 @@ function defineSite(config) {
459
464
  };
460
465
  }
461
466
  //#endregion
462
- export { API_PREFIX, BRAND_LOGO_HEIGHT, CONSENT_COPY, CONSENT_HREF, CONSENT_LIMITS, CONSENT_REOPEN, ContentError, ContentReadError, ContentValidationError, DEFAULT_IMAGE_FIT, DEFAULT_IMAGE_POSITION, DEFAULT_MAX_FOOTER_COLUMNS, DEFAULT_MAX_HEADER_ACTIONS, HEX_COLOR, HONEYPOT_FIELD, IMAGE_FITS, IMAGE_POSITIONS, MAX_NAV_DEPTH, SCHEMA_VERSION_KEY, SYSTEM_PAGES, TURNSTILE_FIELD, VIDEO_FILE, anchorSchema, applyTextMark, brandLogoSchema, buttonStyles, collection, consentCopy, consentTextIssues, contrastChecks, contrastRatio, createMigrator, createPageSchema, createSectionSchema, defaultTheme, defineSection, defineSite, defineTheme, defineThemePreview, defineWireframe, derivePalette, fontMarks, formatJsonLd, generateSiteJsonLd, hasJsonLdId, hasOverrides, hasThemeColors, hexToToken, htmlIdSchema, imageSchema, isImageFit, isImagePosition, isPlaceholderSiteUrl, isSystemPage, jsonLdSchema, jsonLdWarnings, linkSchema, markClass, marksFromEmphasis, mergeJsonLd, motionOption, parseJsonLdInput, parseMediaSource, reconcileMarks, renderMarkedHtml, richTextSchema, sectionIdSchema, seoSchema, siteAnalyticsSchema, siteConsentSchema, siteJsonLdIds, siteSeoSchema, splitMarkedText, textMarkSchema, textSchema, themeColorsSchema, themeCss, themeModes, themeSchema, tokenToHex, toneOption, toneSchema, tones, trackingIdSchema, upsertJsonLd, variantOption, weightMarks, wireKinds, wireframeIssues, withEmphasis, withoutOrphanSections };
467
+ export { API_PREFIX, BRAND_LOGO_HEIGHT, CONSENT_COPY, CONSENT_HREF, CONSENT_LIMITS, CONSENT_REOPEN, ContentError, ContentReadError, ContentValidationError, DEFAULT_IMAGE_FIT, DEFAULT_IMAGE_POSITION, DEFAULT_MAX_FOOTER_COLUMNS, DEFAULT_MAX_HEADER_ACTIONS, HEX_COLOR, HONEYPOT_FIELD, IMAGE_FITS, IMAGE_POSITIONS, LISTINGS_COLLECTION, MAX_NAV_DEPTH, SCHEMA_VERSION_KEY, SINGLES_COLLECTION, SYSTEM_PAGES, TURNSTILE_FIELD, VIDEO_FILE, anchorSchema, applyTextMark, brandLogoSchema, buttonStyles, collection, consentCopy, consentTextIssues, contrastChecks, contrastRatio, createMigrator, createPageSchema, createSectionSchema, defaultTheme, defineSection, defineSite, defineTheme, defineThemePreview, defineTypes, defineWireframe, derivePalette, findRoute, fontMarks, formatJsonLd, generateSiteJsonLd, hasJsonLdId, hasOverrides, hasThemeColors, hexToToken, htmlIdSchema, imageSchema, isDraft, isImageFit, isImagePosition, isPlaceholderSiteUrl, isSystemPage, jsonLdSchema, jsonLdWarnings, linkSchema, markClass, marksFromEmphasis, matchPath, mergeJsonLd, motionOption, multi, pageStatusSchema, parseJsonLdInput, parseMediaSource, reconcileMarks, renderMarkedHtml, resolveTypes, richTextSchema, sectionIdSchema, seoSchema, single, siteAnalyticsSchema, siteConsentSchema, siteJsonLdIds, siteRoutes, siteSeoSchema, splitMarkedText, textMarkSchema, textSchema, themeColorsSchema, themeCss, themeModes, themeSchema, tokenToHex, toneOption, toneSchema, tones, trackingIdSchema, upsertJsonLd, variantOption, weightMarks, wireKinds, wireframeIssues, withEmphasis, withoutOrphanSections };
@@ -20,7 +20,7 @@ function createMigrator(versioning = {}) {
20
20
  }
21
21
  return {
22
22
  version,
23
- upgrade(raw, kind) {
23
+ upgrade(raw, kind, type) {
24
24
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return {
25
25
  ok: true,
26
26
  value: raw
@@ -37,7 +37,7 @@ function createMigrator(versioning = {}) {
37
37
  message: `Written by a newer version of this site (${SCHEMA_VERSION_KEY} ${from}; this site supports up to ${version}).`
38
38
  };
39
39
  for (let step = from; step < version; step++) try {
40
- document = migrations[step](document, kind);
40
+ document = migrations[step](document, kind, type);
41
41
  } catch (error) {
42
42
  const reason = error instanceof Error ? error.message : String(error);
43
43
  return {
@@ -522,6 +522,8 @@ function resolvePageRules(input) {
522
522
  function isSystemPage(slug) {
523
523
  return SYSTEM_PAGES.includes(slug);
524
524
  }
525
+ /** Whether a page is built. A draft is left out of `astro build`, the listings and the sitemap; `astro dev` still shows it. */
526
+ const pageStatusSchema = z.enum(["published", "draft"]);
525
527
  const slugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Slug must be lowercase kebab-case (the home page uses \"index\")");
526
528
  const cache = /* @__PURE__ */ new WeakMap();
527
529
  const tolerantCache = /* @__PURE__ */ new WeakMap();
@@ -545,6 +547,8 @@ function buildPageSchema(section) {
545
547
  return z.object({
546
548
  slug: slugSchema,
547
549
  title: textSchema,
550
+ /** Absent means published, so files from before page status read as they always did. */
551
+ status: pageStatusSchema.optional(),
548
552
  seo: seoSchema,
549
553
  sections: z.array(section).superRefine((sections, ctx) => {
550
554
  addSectionIdentityIssues(sections, ctx);
@@ -563,4 +567,4 @@ function withoutOrphanSections(page, registry) {
563
567
  };
564
568
  }
565
569
  //#endregion
566
- export { textMarkSchema as A, isImagePosition as B, upsertJsonLd as C, imageSchema as D, htmlIdSchema as E, DEFAULT_IMAGE_FIT as F, toneOption as G, buttonStyles as H, DEFAULT_IMAGE_POSITION as I, tones as K, IMAGE_FITS as L, toneSchema as M, trackingIdSchema as N, linkSchema as O, withEmphasis as P, IMAGE_POSITIONS as R, siteJsonLdIds as S, addMarkIssues as T, motionOption as U, withImageLayout as V, themeModes as W, isPlaceholderSiteUrl as _, resolvePageRules as a, mergeJsonLd as b, withoutOrphanSections as c, isOrphanSection as d, sectionIdSchema as f, hasJsonLdId as g, generateSiteJsonLd as h, isSystemPage as i, textSchema as j, richTextSchema as k, anchorSchema as l, formatJsonLd as m, createPageSchema as n, seoSchema as o, walkLinkIds as p, variantOption as q, createTolerantPageSchema as r, slugSchema as s, SYSTEM_PAGES as t, createSectionSchema as u, jsonLdSchema as v, MAX_NAV_DEPTH as w, parseJsonLdInput as x, jsonLdWarnings as y, isImageFit as z };
570
+ export { imageSchema as A, IMAGE_FITS as B, mergeJsonLd as C, MAX_NAV_DEPTH as D, upsertJsonLd as E, toneSchema as F, buttonStyles as G, isImageFit as H, trackingIdSchema as I, toneOption as J, motionOption as K, withEmphasis as L, richTextSchema as M, textMarkSchema as N, addMarkIssues as O, textSchema as P, DEFAULT_IMAGE_FIT as R, jsonLdWarnings as S, siteJsonLdIds as T, isImagePosition as U, IMAGE_POSITIONS as V, withImageLayout as W, variantOption as X, tones as Y, formatJsonLd as _, isSystemPage as a, isPlaceholderSiteUrl as b, seoSchema as c, anchorSchema as d, createSectionSchema as f, walkLinkIds as g, sectionIdSchema as h, createTolerantPageSchema as i, linkSchema as j, htmlIdSchema as k, slugSchema as l, isOrphanSection as m, addSectionIdentityIssues as n, pageStatusSchema as o, createTolerantSectionSchema as p, themeModes as q, createPageSchema as r, resolvePageRules as s, SYSTEM_PAGES as t, withoutOrphanSections as u, generateSiteJsonLd as v, parseJsonLdInput as w, jsonLdSchema as x, hasJsonLdId as y, DEFAULT_IMAGE_POSITION as z };
@@ -402,6 +402,8 @@ declare const siteSeoSchema: z.ZodObject<{
402
402
  description: z.ZodOptional<z.ZodString>;
403
403
  ogImage: z.ZodOptional<z.ZodString>;
404
404
  jsonLd: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
405
+ robots: z.ZodOptional<z.ZodBoolean>;
406
+ sitemap: z.ZodOptional<z.ZodBoolean>;
405
407
  }, z.core.$strict>;
406
408
  /**
407
409
  * Raw HTML snippets for analytics and similar tags. A theme renders `head` at the end of `<head>` and
@@ -513,6 +515,8 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
513
515
  description: z.ZodOptional<z.ZodString>;
514
516
  ogImage: z.ZodOptional<z.ZodString>;
515
517
  jsonLd: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
518
+ robots: z.ZodOptional<z.ZodBoolean>;
519
+ sitemap: z.ZodOptional<z.ZodBoolean>;
516
520
  }, z.core.$strict>;
517
521
  analytics: z.ZodOptional<z.ZodObject<{
518
522
  head: z.ZodOptional<z.ZodString>;
@@ -694,6 +698,8 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
694
698
  description?: string | undefined;
695
699
  ogImage?: string | undefined;
696
700
  jsonLd?: Record<string, unknown>[] | undefined;
701
+ robots?: boolean | undefined;
702
+ sitemap?: boolean | undefined;
697
703
  };
698
704
  theme: {
699
705
  mode: "light" | "dark";
@@ -831,6 +837,8 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
831
837
  description?: string | undefined;
832
838
  ogImage?: string | undefined;
833
839
  jsonLd?: Record<string, unknown>[] | undefined;
840
+ robots?: boolean | undefined;
841
+ sitemap?: boolean | undefined;
834
842
  };
835
843
  theme: {
836
844
  mode: "light" | "dark";
@@ -1245,11 +1253,178 @@ interface SectionConfig<TType extends string, TSchema extends z.ZodType, TVarian
1245
1253
  }
1246
1254
  declare function defineSection<const TType extends string, TSchema extends z.ZodType, const TVariants extends readonly [string, ...string[]]>(config: SectionConfig<TType, TSchema, TVariants>): SectionDefinition<TType, TSchema, TVariants[number]>;
1247
1255
  //#endregion
1256
+ //#region src/section-schema.d.ts
1257
+ declare const sectionIdSchema: z.ZodString;
1258
+ declare const anchorSchema: z.ZodString;
1259
+ /** The shape every section has, whatever its type. `props` is typed per section by {@link SectionOf}. */
1260
+ interface BaseSection {
1261
+ id: string;
1262
+ type: string;
1263
+ anchor?: string | undefined;
1264
+ variant: string;
1265
+ tone: Tone;
1266
+ motion?: boolean | undefined;
1267
+ props: unknown;
1268
+ }
1269
+ type EntryOf<TKey extends string, TDefinition> = TDefinition extends SectionDefinition<string, infer TSchema, infer TVariant> ? {
1270
+ id: string;
1271
+ type: TKey;
1272
+ anchor?: string | undefined;
1273
+ variant: TVariant;
1274
+ tone: Tone;
1275
+ motion?: boolean | undefined;
1276
+ props: z.infer<TSchema>;
1277
+ } : never;
1278
+ /** The section union of a registry: one member per section type, with its own variants and props. */
1279
+ type SectionOf<TRegistry extends SectionRegistry> = { [TKey in keyof TRegistry & string]: EntryOf<TKey, TRegistry[TKey]>; }[keyof TRegistry & string];
1280
+ /** Props of one section type in a registry. */
1281
+ type PropsOf<TRegistry extends SectionRegistry, TKey extends keyof TRegistry & string> = z.infer<TRegistry[TKey]['schema']>;
1282
+ /**
1283
+ * Validates one section against the registry: the `type` picks the definition, which validates `variant` and `props`.
1284
+ * Unknown types fail with the list of registered ones.
1285
+ */
1286
+ declare function createSectionSchema<TRegistry extends SectionRegistry>(registry: TRegistry): z.ZodType<SectionOf<TRegistry>>;
1287
+ //#endregion
1288
+ //#region src/content-types.d.ts
1289
+ /** How the entries of a type are ordered in its listing and in the editor. */
1290
+ interface SortRule {
1291
+ /** `title`, or the name of one of the type's `fields`. The field must be required and a date, string, number, boolean or enum. */
1292
+ by: string;
1293
+ /** Default `asc`. */
1294
+ order?: 'asc' | 'desc';
1295
+ }
1296
+ /** The page that lists a type's entries, with pagination. */
1297
+ interface ListingOptions {
1298
+ /** The listing's address, one segment: `news` puts it at `/news` and `/news/page/2`. Default: the first segment of `path`. */
1299
+ slug?: string;
1300
+ /** Entries on one listing page, 1 to 100. Default 10. */
1301
+ perPage?: number;
1302
+ }
1303
+ interface TypeOptions {
1304
+ /** Set by `multi()`. A type written as a plain object is a multi type too. */
1305
+ kind?: 'multi';
1306
+ /** Where an entry is served: `/blog/{slug}`. One segment, then `{slug}`. Default `/<id>/{slug}`. */
1307
+ path?: string;
1308
+ /** Shown in the editor. Default: the id with a capital letter. */
1309
+ label?: string;
1310
+ /** Fields every entry of this type has besides its title, SEO and sections: `z.object({ date: z.iso.date() })`. */
1311
+ fields?: z.ZodObject;
1312
+ /** The section types an entry may use. Default: every section the site defines. */
1313
+ sections?: readonly string[];
1314
+ /** Default: by title, A to Z. */
1315
+ sort?: SortRule;
1316
+ /** `false` (the default) for no listing page, or its settings. `{}` turns it on with the defaults. */
1317
+ listing?: false | ListingOptions;
1318
+ /** Allow changing an entry's slug, which changes its address. Default true. */
1319
+ rename?: boolean;
1320
+ /** Allow deleting entries. Default true. */
1321
+ delete?: boolean;
1322
+ }
1323
+ /** A type with exactly one document at a fixed address, such as an About page nobody may rename or delete. */
1324
+ interface SingleOptions {
1325
+ kind: 'single';
1326
+ /** The document's address, one segment: `/about`. */
1327
+ path: string;
1328
+ /** Shown in the editor. Default: the id with a capital letter. */
1329
+ label?: string;
1330
+ /** Fields the document has besides its title, SEO and sections. */
1331
+ fields?: z.ZodObject;
1332
+ /** The section types the document may use. Default: every section the site defines. */
1333
+ sections?: readonly string[];
1334
+ }
1335
+ /** The `types` key of a content model: type options by id. */
1336
+ type ContentTypes = Record<string, TypeOptions | SingleOptions>;
1337
+ /** The Astro collection of listing page documents, one per type that has a listing. Entry id = type id. */
1338
+ declare const LISTINGS_COLLECTION = "bm-listings";
1339
+ /** The Astro collection of the singles a model declares. Entry id = type id. */
1340
+ declare const SINGLES_COLLECTION = "bm-singles";
1341
+ /** A type with exactly one document at a fixed address. It cannot be created, renamed or deleted. */
1342
+ interface SingleType {
1343
+ kind: 'single';
1344
+ id: string;
1345
+ label: string;
1346
+ /** `/`, `/404`, or the one-segment address of a single the site declares. */
1347
+ path: string;
1348
+ /** The slug inside the stored document: `index`, `404`, or the address segment. */
1349
+ slug: string;
1350
+ /** Store key of the document. */
1351
+ key: string;
1352
+ fields: z.ZodObject | null;
1353
+ /** Allowed section types, or null for all of them. */
1354
+ sections: readonly string[] | null;
1355
+ /** True for `home` and `not-found`, which every site has. */
1356
+ builtIn: boolean;
1357
+ }
1358
+ /** A type with any number of entries, each at `/<prefix>/<slug>` (or `/<slug>` for `pages`). */
1359
+ interface MultiType {
1360
+ kind: 'multi';
1361
+ id: string;
1362
+ label: string;
1363
+ /** The address segment before the slug. Empty for `pages`, whose entries sit at the root. */
1364
+ prefix: string;
1365
+ /** Store directory of the entries, relative to the content directory. */
1366
+ dir: string;
1367
+ fields: z.ZodObject | null;
1368
+ /** Allowed section types, or null for all of them. */
1369
+ sections: readonly string[] | null;
1370
+ /** Null keeps the order the store lists the files in (the built-in `pages` default). */
1371
+ sort: Required<SortRule> | null;
1372
+ listing: Required<ListingOptions> | null;
1373
+ rename: boolean;
1374
+ delete: boolean;
1375
+ }
1376
+ type ContentType = SingleType | MultiType;
1377
+ interface ResolvedTypes {
1378
+ home: SingleType;
1379
+ notFound: SingleType;
1380
+ /** `home`, `not-found`, then the singles the site declares. */
1381
+ singles: readonly SingleType[];
1382
+ /** The built-in `pages` type. */
1383
+ pages: MultiType;
1384
+ /** Every multi type, `pages` first, then the site's own in the order they were declared. */
1385
+ multi: readonly MultiType[];
1386
+ /** The type with this id, or undefined. */
1387
+ get(id: string): ContentType | undefined;
1388
+ }
1389
+ /** Declares a type with many entries. Checks the options that need nothing else now, so a typo fails where it was written. */
1390
+ declare function multi(options?: Omit<TypeOptions, 'kind'>): TypeOptions;
1391
+ /** Declares a type with one document at a fixed address: `single({ path: '/about' })`. */
1392
+ declare function single(options: Omit<SingleOptions, 'kind'>): SingleOptions;
1393
+ /** Declares the site's types. Checks every type and that no two share an address. */
1394
+ declare function defineTypes<TTypes extends ContentTypes>(types: TTypes): TTypes;
1395
+ interface TypesInput {
1396
+ types?: ContentTypes;
1397
+ /** The site's section registry. When given, each type's `sections` is checked against it. */
1398
+ sections?: SectionRegistry;
1399
+ }
1400
+ /**
1401
+ * The site's types with every default filled in: the three built-in ones plus what `types` declares. Throws when the
1402
+ * config is wrong, with the type and option to fix. Cached per `types` object.
1403
+ */
1404
+ declare function resolveTypes(model: TypesInput, pageRules?: {
1405
+ rename: boolean;
1406
+ delete: boolean;
1407
+ }): ResolvedTypes;
1408
+ /** An entry: a page plus, when its type declares them, `fields`. */
1409
+ interface Entry<TSection extends BaseSection = BaseSection> extends Page<TSection> {
1410
+ fields?: Record<string, unknown>;
1411
+ }
1412
+ /** The document of a listing page: what is shown above the list, and its SEO. It has no slug; the type's config owns the address. */
1413
+ interface ListingDocument<TSection extends BaseSection = BaseSection> {
1414
+ title: string;
1415
+ seo: Seo;
1416
+ sections: TSection[];
1417
+ }
1418
+ //#endregion
1248
1419
  //#region src/migrate.d.ts
1249
1420
  /** Which kind of document a migration is upgrading. */
1250
1421
  type DocumentKind = 'page' | 'site';
1251
- /** Upgrades one document from version N to N + 1. Return the new document; do not mutate the input. */
1252
- type ContentMigration = (document: Record<string, unknown>, kind: DocumentKind) => Record<string, unknown>;
1422
+ /**
1423
+ * Upgrades one document from version N to N + 1. Return the new document; do not mutate the input. `type` is the id of
1424
+ * the content type a `page` document belongs to (`pages`, `home`, `not-found`, or one the site declares); it is
1425
+ * undefined for the site, and `listing` for a type's listing page.
1426
+ */
1427
+ type ContentMigration = (document: Record<string, unknown>, kind: DocumentKind, type?: string) => Record<string, unknown>;
1253
1428
  /** How a site versions its content files. */
1254
1429
  interface ContentVersioning {
1255
1430
  /**
@@ -1273,7 +1448,7 @@ interface ContentMigrator {
1273
1448
  /** The version this site writes. */
1274
1449
  readonly version: number;
1275
1450
  /** Upgrade a parsed file to the current version and remove its version key. Non-objects pass through for the schema to reject. */
1276
- upgrade(raw: unknown, kind: DocumentKind): UpgradeResult;
1451
+ upgrade(raw: unknown, kind: DocumentKind, type?: string): UpgradeResult;
1277
1452
  /** The document as written to disk: its version key plus the content. */
1278
1453
  stamp<T extends object>(document: T): T & {
1279
1454
  schemaVersion: number;
@@ -1332,40 +1507,13 @@ interface ContentModel extends ContentVersioning {
1332
1507
  site: SiteDefinition;
1333
1508
  /** What the theme tells the editor (font slot labels and families). Default: {@link defaultTheme}. */
1334
1509
  theme?: ThemeDefinition;
1510
+ /**
1511
+ * The site's own content types, from `defineTypes`: `{ blog: multi({ path: '/blog/{slug}' }) }`. The home page, the
1512
+ * 404 page and `pages` are built in and need no entry here. Default: only the built-in ones.
1513
+ */
1514
+ types?: ContentTypes;
1335
1515
  }
1336
1516
  //#endregion
1337
- //#region src/section-schema.d.ts
1338
- declare const sectionIdSchema: z.ZodString;
1339
- declare const anchorSchema: z.ZodString;
1340
- /** The shape every section has, whatever its type. `props` is typed per section by {@link SectionOf}. */
1341
- interface BaseSection {
1342
- id: string;
1343
- type: string;
1344
- anchor?: string | undefined;
1345
- variant: string;
1346
- tone: Tone;
1347
- motion?: boolean | undefined;
1348
- props: unknown;
1349
- }
1350
- type EntryOf<TKey extends string, TDefinition> = TDefinition extends SectionDefinition<string, infer TSchema, infer TVariant> ? {
1351
- id: string;
1352
- type: TKey;
1353
- anchor?: string | undefined;
1354
- variant: TVariant;
1355
- tone: Tone;
1356
- motion?: boolean | undefined;
1357
- props: z.infer<TSchema>;
1358
- } : never;
1359
- /** The section union of a registry: one member per section type, with its own variants and props. */
1360
- type SectionOf<TRegistry extends SectionRegistry> = { [TKey in keyof TRegistry & string]: EntryOf<TKey, TRegistry[TKey]>; }[keyof TRegistry & string];
1361
- /** Props of one section type in a registry. */
1362
- type PropsOf<TRegistry extends SectionRegistry, TKey extends keyof TRegistry & string> = z.infer<TRegistry[TKey]['schema']>;
1363
- /**
1364
- * Validates one section against the registry: the `type` picks the definition, which validates `variant` and `props`.
1365
- * Unknown types fail with the list of registered ones.
1366
- */
1367
- declare function createSectionSchema<TRegistry extends SectionRegistry>(registry: TRegistry): z.ZodType<SectionOf<TRegistry>>;
1368
- //#endregion
1369
1517
  //#region src/page.d.ts
1370
1518
  declare const seoSchema: z.ZodObject<{
1371
1519
  title: z.ZodString;
@@ -1386,11 +1534,17 @@ declare const SYSTEM_PAGES: readonly ["404"];
1386
1534
  * asks (the editor, a script, an assistant), and its controls are hidden in the editor.
1387
1535
  */
1388
1536
  interface PageRules {
1389
- /** Change a page's slug, including making another page the home page (that moves two pages to new addresses). */
1537
+ /** Change a page's slug, which changes its address. */
1390
1538
  rename: boolean;
1391
1539
  delete: boolean;
1392
1540
  }
1393
1541
  declare function isSystemPage(slug: string): boolean;
1542
+ /** Whether a page is built. A draft is left out of `astro build`, the listings and the sitemap; `astro dev` still shows it. */
1543
+ declare const pageStatusSchema: z.ZodEnum<{
1544
+ published: "published";
1545
+ draft: "draft";
1546
+ }>;
1547
+ type PageStatus = z.infer<typeof pageStatusSchema>;
1394
1548
  /** Validates a page document: its own fields, and every section against the registry. Cached per registry. */
1395
1549
  declare function createPageSchema<TRegistry extends SectionRegistry>(registry: TRegistry): z.ZodType<Page<SectionOf<TRegistry>>>;
1396
1550
  type Seo = z.infer<typeof seoSchema>;
@@ -1398,6 +1552,8 @@ type Seo = z.infer<typeof seoSchema>;
1398
1552
  interface Page<TSection extends BaseSection = BaseSection> {
1399
1553
  slug: string;
1400
1554
  title: string;
1555
+ /** Absent means published. */
1556
+ status?: PageStatus;
1401
1557
  seo: Seo;
1402
1558
  sections: TSection[];
1403
1559
  }
@@ -1409,4 +1565,4 @@ declare function withoutOrphanSections<TPage extends {
1409
1565
  sections: readonly unknown[];
1410
1566
  }>(page: TPage, registry: SectionRegistry): TPage;
1411
1567
  //#endregion
1412
- export { mergeJsonLd as $, tones as $t, SectionDefinition as A, MAX_NAV_DEPTH as At, FieldIcons as B, toneSchema as Bt, ContentMigration as C, siteConsentSchema as Ct, SCHEMA_VERSION_KEY as D, ButtonStyle as Dt, DocumentKind as E, themeSchema as Et, defineWireframe as F, imageSchema as Ft, SiteJsonLdIds as G, EnumOption as Gt, ShowWhen as H, withEmphasis as Ht, wireKinds as I, linkSchema as It, generateSiteJsonLd as J, StringOption as Jt, SiteJsonLdSource as K, NumberOption as Kt, wireframeIssues as L, richTextSchema as Lt, WireKind as M, Text as Mt, WireRect as N, Tone as Nt, createMigrator as O, Image as Ot, Wireframe as P, htmlIdSchema as Pt, jsonLdWarnings as Q, toneOption as Qt, OptionalContent as R, textMarkSchema as Rt, defineTheme as S, siteAnalyticsSchema as St, ContentVersioning as T, themeColorsSchema as Tt, JsonLdBlock as U, BooleanOption as Ut, ShowCondition as V, trackingIdSchema as Vt, JsonLdResult as W, CountRule as Wt, isPlaceholderSiteUrl as X, motionOption as Xt, hasJsonLdId as Y, buttonStyles as Yt, jsonLdSchema as Z, themeModes as Zt, SectionRegistry as _, SiteSeo as _t, createPageSchema as a, DEFAULT_MAX_HEADER_ACTIONS as at, ThemeFont as b, brandLogoSchema as bt, withoutOrphanSections as c, FooterConfig as ct, SectionOf as d, Site as dt, variantOption as en, parseJsonLdInput as et, anchorSchema as f, SiteAnalytics as ft, ContentModel as g, SiteOf as gt, API_PREFIX as h, SiteDefinition as ht, Seo as i, DEFAULT_MAX_FOOTER_COLUMNS as it, defineSection as j, RichText as jt, SectionConfig as k, Link as kt, BaseSection as l, Header as lt, sectionIdSchema as m, SiteConsent as mt, PageRules as n, upsertJsonLd as nt, isSystemPage as o, Footer as ot, createSectionSchema as p, SiteConfig as pt, formatJsonLd as q, Option as qt, SYSTEM_PAGES as r, BRAND_LOGO_HEIGHT as rt, seoSchema as s, FooterColumn as st, Page as t, siteJsonLdIds as tt, PropsOf as u, HeaderConfig as ut, ThemeConfig as v, SiteWith as vt, ContentMigrator as w, siteSeoSchema as wt, defaultTheme as x, defineSite as xt, ThemeDefinition as y, Theme as yt, FieldChoices as z, textSchema as zt };
1568
+ export { WireRect as $, Tone as $t, ListingOptions as A, HeaderConfig as At, multi as B, brandLogoSchema as Bt, SCHEMA_VERSION_KEY as C, BRAND_LOGO_HEIGHT as Ct, Entry as D, FooterColumn as Dt, ContentTypes as E, Footer as Et, SingleType as F, SiteDefinition as Ft, SectionOf as G, themeColorsSchema as Gt, single as H, siteAnalyticsSchema as Ht, SortRule as I, SiteOf as It, sectionIdSchema as J, Image as Jt, anchorSchema as K, themeSchema as Kt, TypeOptions as L, SiteSeo as Lt, ResolvedTypes as M, SiteAnalytics as Mt, SINGLES_COLLECTION as N, SiteConfig as Nt, LISTINGS_COLLECTION as O, FooterConfig as Ot, SingleOptions as P, SiteConsent as Pt, WireKind as Q, Text as Qt, TypesInput as R, SiteWith as Rt, DocumentKind as S, upsertJsonLd as St, ContentType as T, DEFAULT_MAX_HEADER_ACTIONS as Tt, BaseSection as U, siteConsentSchema as Ut, resolveTypes as V, defineSite as Vt, PropsOf as W, siteSeoSchema as Wt, SectionDefinition as X, MAX_NAV_DEPTH as Xt, SectionConfig as Y, Link as Yt, defineSection as Z, RichText as Zt, defaultTheme as _, themeModes as _n, jsonLdSchema as _t, Seo as a, textSchema as an, FieldChoices as at, ContentMigrator as b, variantOption as bn, parseJsonLdInput as bt, pageStatusSchema as c, withEmphasis as cn, ShowWhen as ct, API_PREFIX as d, EnumOption as dn, SiteJsonLdIds as dt, htmlIdSchema as en, Wireframe as et, ContentModel as f, NumberOption as fn, SiteJsonLdSource as ft, ThemeFont as g, motionOption as gn, isPlaceholderSiteUrl as gt, ThemeDefinition as h, buttonStyles as hn, hasJsonLdId as ht, SYSTEM_PAGES as i, textMarkSchema as in, OptionalContent as it, MultiType as j, Site as jt, ListingDocument as k, Header as kt, seoSchema as l, BooleanOption as ln, JsonLdBlock as lt, ThemeConfig as m, StringOption as mn, generateSiteJsonLd as mt, PageRules as n, linkSchema as nn, wireKinds as nt, createPageSchema as o, toneSchema as on, FieldIcons as ot, SectionRegistry as p, Option as pn, formatJsonLd as pt, createSectionSchema as q, ButtonStyle as qt, PageStatus as r, richTextSchema as rn, wireframeIssues as rt, isSystemPage as s, trackingIdSchema as sn, ShowCondition as st, Page as t, imageSchema as tn, defineWireframe as tt, withoutOrphanSections as u, CountRule as un, JsonLdResult as ut, defineTheme as v, toneOption as vn, jsonLdWarnings as vt, createMigrator as w, DEFAULT_MAX_FOOTER_COLUMNS as wt, ContentVersioning as x, siteJsonLdIds as xt, ContentMigration as y, tones as yn, mergeJsonLd as yt, defineTypes as z, Theme as zt };
@@ -1,4 +1,4 @@
1
- import { s as slugSchema } from "./page-wlcQJAA-.js";
1
+ import { l as slugSchema } from "./page-C7zE_HD1.js";
2
2
  import { t as DEFAULT_IMAGE_BYTE_LIMIT } from "./upload-rules-Cao9uY5K.js";
3
3
  //#region src/request-guards.ts
4
4
  const JSON_BODY_LIMIT = 1048576;