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.
- package/CHANGELOG.md +35 -0
- package/README.md +3 -3
- package/dist/astro.d.ts +16 -7
- package/dist/astro.js +212 -93
- package/dist/cli.js +903 -4
- package/dist/content-types-46XqPaW4.js +505 -0
- package/dist/content.d.ts +24 -3
- package/dist/content.js +83 -6
- package/dist/{editor-context-DzRwKENi.d.ts → editor-context-D1yfPp21.d.ts} +95 -8
- package/dist/{github-store-Dt_YuOPD.js → github-store-B2folBeq.js} +551 -206
- package/dist/{github-store-DsLCe5MR.d.ts → github-store-CuhvbFCh.d.ts} +1 -1
- package/dist/hosted-astro.js +1 -1
- package/dist/{hosted-middleware-CsROahka.js → hosted-middleware-DHLIedeV.js} +1 -1
- package/dist/hosted-overlay.js +1 -1
- package/dist/hosted.d.ts +10 -4
- package/dist/hosted.js +68 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -6
- package/dist/{migrate-b408EaLp.js → migrate-Cm30puW8.js} +2 -2
- package/dist/{page-wlcQJAA-.js → page-C7zE_HD1.js} +5 -1
- package/dist/{page-BGSTL63-.d.ts → page-CpVElMPH.d.ts} +193 -37
- package/dist/{request-guards-BcSUj8Gc.js → request-guards-DtNVdqQ7.js} +1 -1
- package/dist/{collections-Bm3RWg2K.js → routing-jKeq4LwO.js} +213 -57
- package/dist/routing-yPy8hEfZ.d.ts +137 -0
- package/dist/{theme-BvqJ8UnS.js → theme-DTVVNMlr.js} +1 -1
- package/dist/ui/mount.js +3294 -1259
- package/package.json +2 -2
- package/registry/default/files/src/components/organisms/EntryList.astro +83 -0
- package/registry/default/files/src/components/organisms/Pagination.astro +56 -0
- package/registry/default/files/src/components/sections/contact/definition.ts +6 -2
- package/registry/default/files/src/components/sections/faq/definition.ts +2 -2
- package/registry/default/files/src/components/sections/media/Media.astro +2 -2
- package/registry/default/files/src/components/sections/media/MediaPlayer.astro +2 -2
- package/registry/default/files/src/components/sections/pricing/definition.ts +16 -1
- package/registry/default/files/src/components/sections/shared.ts +3 -0
- package/registry/default/files/src/components/sections/stats/definition.ts +6 -1
- package/registry/default/files/src/components/sections/testimonials/definition.ts +13 -1
- package/registry/default/files/src/components/sections/text-image/definition.ts +1 -1
- package/registry/default/files/src/components/seo/Seo.astro +3 -1
- package/registry/default/files/src/content.config.ts +21 -0
- package/registry/default/files/src/env.d.ts +2 -0
- package/registry/default/files/src/lib/content.ts +81 -0
- package/registry/default/files/src/lib/editing.ts +6 -0
- package/registry/default/files/src/lib/sitemap.ts +48 -0
- package/registry/default/files/src/pages/[...slug].astro +30 -16
- package/registry/default/registry.json +77 -21
- package/dist/preview-DFLna-Be.d.ts +0 -42
package/dist/hosted.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as StoreKeyError, n as githubStore, r as StoreError, t as GithubStoreOptions } from "./github-store-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 {
|
|
2
|
-
import { t as defaultTheme } from "./theme-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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-
|
|
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-
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
|
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 {
|
|
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
|
|
2
|
-
import { n as defineTheme, t as defaultTheme } from "./theme-
|
|
3
|
-
import { A as
|
|
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
|
|
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 {
|
|
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
|
-
/**
|
|
1252
|
-
|
|
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,
|
|
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 {
|
|
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 };
|