bearminion 1.11.0 → 1.12.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 +10 -0
- package/dist/astro.d.ts +2 -2
- package/dist/astro.js +15 -6
- package/dist/cli.js +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/content.js +2 -2
- package/dist/{forms-dev-DQoWfcMA.js → forms-dev-CEab55ss.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/{options-NdG2XQv4.d.ts → options-WI_ztZTj.d.ts} +9 -1
- package/dist/{page-BfI9cD8g.d.ts → page-CwbIDegI.d.ts} +17 -8
- package/dist/{page-X-WnOu7-.js → page-wlcQJAA-.js} +17 -1
- package/dist/{preview-B_88I5Jm.js → preview-ImEm3T8k.js} +1 -1
- package/dist/{reload-CU0U52ja.js → reload-BIIa7pej.js} +1 -1
- package/dist/{security-BA9KzK-2.js → security-FLvgc2jD.js} +1 -1
- package/dist/{theme-Dv7_7B56.js → theme-BvqJ8UnS.js} +1 -1
- package/dist/ui/mount.js +63 -18
- package/package.json +1 -1
- package/registry/default/registry.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# bearminion
|
|
2
2
|
|
|
3
|
+
## 1.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1435da5: `bearminion({ pages: { rename: false, delete: false } })` locks page operations for sites whose addresses carry search ranking or are the target of redirects. Both default to `true`, so nothing changes unless you set them. A locked operation is refused by the API with `409` `operation_locked`, whoever asks: the rename route, the delete route, set-home, and a save that changes a slug (making another page the home page counts as a rename, because the old home page moves to a new address). The editor makes the slug read-only, disables the Home page switch and hides Delete. `GET /schema` reports the rules as `pageRules`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 1435da5: The New page form makes the slug from the title as you type it, until you edit the slug by hand, and numbers it when a page with that slug exists (`about-2`). Changing a title afterwards never changes the slug. A failed create now shows the server's reason in the form instead of doing nothing. `slugifyAnchor` writes accented letters as the plain letter (`ą` is `a`, `ł` is `l`, `ß` is `ss`) instead of turning them into hyphens, so `Łódź` is `lodz` and not `o-dz`; this also fixes section anchors suggested from non-ASCII headings.
|
|
12
|
+
|
|
3
13
|
## 1.11.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/astro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as StoreKeyError, c as createFileStore, i as FileStoreOptions, n as EditorContext, o as StoreOperation, r as ContentStore, s as UploadStore, t as BearminionOptions } from "./options-
|
|
1
|
+
import { A as ContentModel, X as SiteOf, Xt as ContentMigrator, Y as SiteDefinition, d as SectionOf, j as SectionRegistry, t as Page } from "./page-CwbIDegI.js";
|
|
2
|
+
import { a as StoreKeyError, c as createFileStore, i as FileStoreOptions, n as EditorContext, o as StoreOperation, r as ContentStore, s as UploadStore, t as BearminionOptions } from "./options-WI_ztZTj.js";
|
|
3
3
|
import { AstroIntegration } from "astro";
|
|
4
4
|
//#region src/integration.d.ts
|
|
5
5
|
interface BearminionIntegration extends AstroIntegration {
|
package/dist/astro.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as imageFields, c as ContentReadError, l as ContentValidationError, r as loadThemePreview, t as PreviewUnavailableError } from "./preview-
|
|
2
|
-
import { t as defaultTheme } from "./theme-
|
|
3
|
-
import {
|
|
1
|
+
import { a as imageFields, c as ContentReadError, l as ContentValidationError, r as loadThemePreview, t as PreviewUnavailableError } from "./preview-ImEm3T8k.js";
|
|
2
|
+
import { t as defaultTheme } from "./theme-BvqJ8UnS.js";
|
|
3
|
+
import { a as resolvePageRules, c as withoutOrphanSections, d as isOrphanSection, i as isSystemPage, n as createPageSchema$1, r as createTolerantPageSchema } from "./page-wlcQJAA-.js";
|
|
4
4
|
import { a as DEFAULT_UPLOADS_DIR, i as DEFAULT_CONTENT_DIR, n as createMigrator, o as DEFAULT_VIDEOS_DIR, r as API_PREFIX, t as SCHEMA_VERSION_KEY } from "./migrate-b408EaLp.js";
|
|
5
5
|
import { i as resolveMaxImageBytes, n as formatBytes, r as resolveConvert } from "./upload-rules-Cao9uY5K.js";
|
|
6
|
-
import { a as isLocalRequest, c as resolveInside, i as isInside, n as JSON_BODY_LIMIT, o as readSlug, r as asDirectory, s as resolveDir, t as IMAGE_BYTE_LIMIT } from "./security-
|
|
7
|
-
import { a as resolveFormsConfig, n as formFile, r as formsAreLive, t as createFormsMiddleware } from "./forms-dev-
|
|
6
|
+
import { a as isLocalRequest, c as resolveInside, i as isInside, n as JSON_BODY_LIMIT, o as readSlug, r as asDirectory, s as resolveDir, t as IMAGE_BYTE_LIMIT } from "./security-FLvgc2jD.js";
|
|
7
|
+
import { a as resolveFormsConfig, n as formFile, r as formsAreLive, t as createFormsMiddleware } from "./forms-dev-CEab55ss.js";
|
|
8
8
|
import { S as isAssetPath, b as describeSiteRef, c as projectId, v as assetRefs, y as describePageRef } from "./draft-store-1Y4-sn45.js";
|
|
9
|
-
import { n as contentReloadPlugin, r as dropEarlyReloadAfterSave } from "./reload-
|
|
9
|
+
import { n as contentReloadPlugin, r as dropEarlyReloadAfterSave } from "./reload-BIIa7pej.js";
|
|
10
10
|
import { i as syncSections, r as staleSectionsMessage } from "./sections-manifest-CO9QfJPG.js";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import fs from "node:fs";
|
|
@@ -445,6 +445,7 @@ function resolveEditorContext(options, rootInput) {
|
|
|
445
445
|
videosDir,
|
|
446
446
|
maxVideoBytes: options?.maxVideoBytes ?? 52428800,
|
|
447
447
|
maxImageBytes: resolveMaxImageBytes(options?.maxImageBytes),
|
|
448
|
+
pageRules: resolvePageRules(options?.pages),
|
|
448
449
|
imageConvert: resolveConvert(options?.imageConvert),
|
|
449
450
|
sections: options.sections,
|
|
450
451
|
site: options.site,
|
|
@@ -860,6 +861,7 @@ async function getSchema(context) {
|
|
|
860
861
|
fieldImages,
|
|
861
862
|
showWhen,
|
|
862
863
|
sectionForms,
|
|
864
|
+
pageRules: context.pageRules,
|
|
863
865
|
sectionDefaults,
|
|
864
866
|
sectionLabels,
|
|
865
867
|
sectionDescriptions,
|
|
@@ -1015,6 +1017,7 @@ async function planPageSave(context, input) {
|
|
|
1015
1017
|
removals: [],
|
|
1016
1018
|
after
|
|
1017
1019
|
};
|
|
1020
|
+
if (!context.pageRules.rename) return { response: locked("rename") };
|
|
1018
1021
|
if (from === "index") return { response: problem(409, "conflict", "The home page slug stays index. Set another page as home to move it.") };
|
|
1019
1022
|
if (isSystemPage(from) || isSystemPage(target)) return { response: problem(409, "reserved_slug", "System pages cannot be renamed, and no page can take their slug.") };
|
|
1020
1023
|
if (target !== "index") {
|
|
@@ -1143,7 +1146,11 @@ async function createPage(request, context) {
|
|
|
1143
1146
|
await writeDocuments(context, [[key, validated.data]]);
|
|
1144
1147
|
return json(201, validated.data);
|
|
1145
1148
|
}
|
|
1149
|
+
function locked(operation) {
|
|
1150
|
+
return problem(409, "operation_locked", `${operation === "rename" ? "Renaming pages" : "Deleting pages"} is turned off for this site (pages.${operation} in the bearminion() options).`);
|
|
1151
|
+
}
|
|
1146
1152
|
async function deletePage(context, slug) {
|
|
1153
|
+
if (!context.pageRules.delete) return locked("delete");
|
|
1147
1154
|
if (slug === "index") return problem(409, "conflict", "Refusing to delete the index page.");
|
|
1148
1155
|
if (isSystemPage(slug)) return problem(409, "reserved_slug", `"${slug}" is a system page and cannot be deleted.`);
|
|
1149
1156
|
const loaded = await loadStoredPages(context);
|
|
@@ -1165,6 +1172,7 @@ async function setHome(request, context, slug) {
|
|
|
1165
1172
|
if (body.response) return body.response;
|
|
1166
1173
|
const parsed = setHomeSchema.safeParse(body.value);
|
|
1167
1174
|
if (!parsed.success) return validation(fieldIssues(parsed.error));
|
|
1175
|
+
if (!context.pageRules.rename) return locked("rename");
|
|
1168
1176
|
if (slug === "index") return problem(409, "conflict", "That page is already the home page.");
|
|
1169
1177
|
if (isSystemPage(slug)) return problem(409, "reserved_slug", `"${slug}" is a system page and cannot be the home page.`);
|
|
1170
1178
|
const loaded = await loadStoredPages(context);
|
|
@@ -1207,6 +1215,7 @@ async function renamePage(request, context, slug) {
|
|
|
1207
1215
|
const parsed = renameSchema.safeParse(body.value);
|
|
1208
1216
|
if (!parsed.success) return validation(fieldIssues(parsed.error));
|
|
1209
1217
|
const nextSlug = parsed.data.slug;
|
|
1218
|
+
if (!context.pageRules.rename) return locked("rename");
|
|
1210
1219
|
if (nextSlug === slug) return problem(400, "invalid_slug", "The new slug is the same as the current slug.");
|
|
1211
1220
|
if (slug === "index") return problem(409, "conflict", "Refusing to rename the index page.");
|
|
1212
1221
|
if (isSystemPage(slug) || isSystemPage(nextSlug)) return problem(409, "reserved_slug", "System pages cannot be renamed, and no page can take their slug.");
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as readDotEnv } from "./forms-dev-
|
|
2
|
+
import { i as readDotEnv } from "./forms-dev-CEab55ss.js";
|
|
3
3
|
import { i as syncSections, r as staleSectionsMessage, t as SectionsError } from "./sections-manifest-CO9QfJPG.js";
|
|
4
4
|
import { i as writeLock, n as readLock, r as recordFiles, t as hashContent } from "./hash-BeBymBO1.js";
|
|
5
5
|
import fs from "node:fs";
|
package/dist/content.d.ts
CHANGED
package/dist/content.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as createPageSchema, r as createTolerantPageSchema } from "./page-
|
|
1
|
+
import { n as createPageSchema, r as createTolerantPageSchema } from "./page-wlcQJAA-.js";
|
|
2
2
|
import { n as createMigrator } from "./migrate-b408EaLp.js";
|
|
3
|
-
import { t as CONTENT_COLLECTIONS_MARKER } from "./reload-
|
|
3
|
+
import { t as CONTENT_COLLECTIONS_MARKER } from "./reload-BIIa7pej.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as Theme, $t as SCHEMA_VERSION_KEY, A as ContentModel, At as wireKinds, B as Footer, Bt as motionOption, C as jsonLdSchema, Ct as SectionConfig, D as siteJsonLdIds, Dt as WireRect, E as parseJsonLdInput, Et as WireKind, F as defaultTheme, Ft as EnumOption, G as Site, Gt as FieldChoices, H as FooterConfig, Ht as toneOption, I as defineTheme, It as NumberOption, J as SiteConsent, Jt as ShowWhen, K as SiteAnalytics, Kt as FieldIcons, L as BRAND_LOGO_HEIGHT, Lt as Option, M as ThemeConfig, Mt as OptionalContent, N as ThemeDefinition, Nt as BooleanOption, O as upsertJsonLd, Ot as Wireframe, P as ThemeFont, Pt as CountRule, Q as SiteWith, Qt as DocumentKind, R as DEFAULT_MAX_FOOTER_COLUMNS, Rt as StringOption, S as isPlaceholderSiteUrl, St as withEmphasis, T as mergeJsonLd, Tt as defineSection, U as Header, Ut as tones, V as FooterColumn, Vt as themeModes, W as HeaderConfig, Wt as variantOption, X as SiteOf, Xt as ContentMigrator, Y as SiteDefinition, Yt as ContentMigration, Z as SiteSeo, Zt as ContentVersioning, _ as SiteJsonLdIds, _t as richTextSchema, a as createPageSchema, at as themeColorsSchema, b as generateSiteJsonLd, bt as toneSchema, c as withoutOrphanSections, ct as Image, d as SectionOf, dt as RichText, en as createMigrator, et as brandLogoSchema, f as anchorSchema, ft as Text, g as JsonLdResult, gt as linkSchema, h as JsonLdBlock, ht as imageSchema, i as Seo, it as siteSeoSchema, j as SectionRegistry, jt as wireframeIssues, k as API_PREFIX, kt as defineWireframe, l as BaseSection, lt as Link, m as sectionIdSchema, mt as htmlIdSchema, nt as siteAnalyticsSchema, o as isSystemPage, ot as themeSchema, p as createSectionSchema, pt as Tone, q as SiteConfig, qt as ShowCondition, r as SYSTEM_PAGES, rt as siteConsentSchema, s as seoSchema, st as ButtonStyle, t as Page, tt as defineSite, u as PropsOf, ut as MAX_NAV_DEPTH, v as SiteJsonLdSource, vt as textMarkSchema, w as jsonLdWarnings, wt as SectionDefinition, x as hasJsonLdId, xt as trackingIdSchema, y as formatJsonLd, yt as textSchema, z as DEFAULT_MAX_HEADER_ACTIONS, zt as buttonStyles } from "./page-CwbIDegI.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 "./options-
|
|
3
|
+
import "./options-WI_ztZTj.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
5
|
//#region src/errors.d.ts
|
|
6
6
|
/** One schema problem, addressed by a dot path such as `sections.0.props.heading`. */
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as ContentReadError, i as enumFields, l as ContentValidationError, n as defineThemePreview, o as schemaProps, s as ContentError, u as formatContentIssues } from "./preview-
|
|
2
|
-
import { n as defineTheme, t as defaultTheme } from "./theme-
|
|
3
|
-
import { A as
|
|
1
|
+
import { c as ContentReadError, i as enumFields, l as ContentValidationError, n as defineThemePreview, o as schemaProps, s as ContentError, u as formatContentIssues } from "./preview-ImEm3T8k.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";
|
|
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
5
|
import { n as createMigrator, r as API_PREFIX, t as SCHEMA_VERSION_KEY } from "./migrate-b408EaLp.js";
|
|
6
6
|
import { n as TURNSTILE_FIELD, t as HONEYPOT_FIELD } from "./form-contract-CIDTNab-.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as ContentModel, N as ThemeDefinition, Xt as ContentMigrator, Y as SiteDefinition, j as SectionRegistry, n as PageRules } from "./page-CwbIDegI.js";
|
|
2
2
|
//#region src/images.d.ts
|
|
3
3
|
type ImageKind = 'png' | 'jpeg' | 'webp' | 'gif' | 'avif';
|
|
4
4
|
interface SavedImage {
|
|
@@ -142,6 +142,13 @@ interface BearminionOptions extends ContentModel {
|
|
|
142
142
|
* out larger is kept as it is. Default: off, images are uploaded as they are.
|
|
143
143
|
*/
|
|
144
144
|
imageConvert?: false | ImageConvertOptions;
|
|
145
|
+
/**
|
|
146
|
+
* Which page operations the editor allows: `{ rename: false, delete: false }` for a site whose addresses must not
|
|
147
|
+
* change (they carry search ranking or are the target of redirects). Both default to true. A locked operation is
|
|
148
|
+
* refused by the API as well as hidden in the editor. `rename: false` also blocks making another page the home page,
|
|
149
|
+
* because that moves the old home page to a new address.
|
|
150
|
+
*/
|
|
151
|
+
pages?: Partial<PageRules>;
|
|
145
152
|
/**
|
|
146
153
|
* Vite module id loaded by the dev server to render a draft page.
|
|
147
154
|
* Default `/src/lib/render-preview.ts`. Preview never writes to disk.
|
|
@@ -182,6 +189,7 @@ interface EditorContext {
|
|
|
182
189
|
videosDir: string;
|
|
183
190
|
maxVideoBytes: number;
|
|
184
191
|
maxImageBytes: number;
|
|
192
|
+
pageRules: PageRules;
|
|
185
193
|
/** `imageConvert`, validated and with its defaults filled in. `null` when conversion is off. */
|
|
186
194
|
imageConvert: UploadRules['convert'];
|
|
187
195
|
sections: SectionRegistry;
|
|
@@ -275,10 +275,10 @@ declare const textMarkSchema: z.ZodObject<{
|
|
|
275
275
|
start: z.ZodNumber;
|
|
276
276
|
end: z.ZodNumber;
|
|
277
277
|
weight: z.ZodOptional<z.ZodEnum<{
|
|
278
|
+
bold: "bold";
|
|
278
279
|
regular: "regular";
|
|
279
280
|
medium: "medium";
|
|
280
281
|
semibold: "semibold";
|
|
281
|
-
bold: "bold";
|
|
282
282
|
}>>;
|
|
283
283
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
284
284
|
font: z.ZodOptional<z.ZodEnum<{
|
|
@@ -319,10 +319,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
|
|
|
319
319
|
start: z.ZodNumber;
|
|
320
320
|
end: z.ZodNumber;
|
|
321
321
|
weight: z.ZodOptional<z.ZodEnum<{
|
|
322
|
+
bold: "bold";
|
|
322
323
|
regular: "regular";
|
|
323
324
|
medium: "medium";
|
|
324
325
|
semibold: "semibold";
|
|
325
|
-
bold: "bold";
|
|
326
326
|
}>>;
|
|
327
327
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
328
328
|
font: z.ZodOptional<z.ZodEnum<{
|
|
@@ -337,10 +337,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
|
|
|
337
337
|
start: z.ZodNumber;
|
|
338
338
|
end: z.ZodNumber;
|
|
339
339
|
weight: z.ZodOptional<z.ZodEnum<{
|
|
340
|
+
bold: "bold";
|
|
340
341
|
regular: "regular";
|
|
341
342
|
medium: "medium";
|
|
342
343
|
semibold: "semibold";
|
|
343
|
-
bold: "bold";
|
|
344
344
|
}>>;
|
|
345
345
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
346
346
|
font: z.ZodOptional<z.ZodEnum<{
|
|
@@ -357,10 +357,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
|
|
|
357
357
|
start: z.ZodNumber;
|
|
358
358
|
end: z.ZodNumber;
|
|
359
359
|
weight: z.ZodOptional<z.ZodEnum<{
|
|
360
|
+
bold: "bold";
|
|
360
361
|
regular: "regular";
|
|
361
362
|
medium: "medium";
|
|
362
363
|
semibold: "semibold";
|
|
363
|
-
bold: "bold";
|
|
364
364
|
}>>;
|
|
365
365
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
366
366
|
font: z.ZodOptional<z.ZodEnum<{
|
|
@@ -617,10 +617,10 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
|
|
|
617
617
|
start: z.ZodNumber;
|
|
618
618
|
end: z.ZodNumber;
|
|
619
619
|
weight: z.ZodOptional<z.ZodEnum<{
|
|
620
|
+
bold: "bold";
|
|
620
621
|
regular: "regular";
|
|
621
622
|
medium: "medium";
|
|
622
623
|
semibold: "semibold";
|
|
623
|
-
bold: "bold";
|
|
624
624
|
}>>;
|
|
625
625
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
626
626
|
font: z.ZodOptional<z.ZodEnum<{
|
|
@@ -852,7 +852,7 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
|
|
|
852
852
|
nameMarks: {
|
|
853
853
|
start: number;
|
|
854
854
|
end: number;
|
|
855
|
-
weight?: "
|
|
855
|
+
weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
|
|
856
856
|
italic?: boolean | undefined;
|
|
857
857
|
font?: "sans" | "serif" | "mono" | undefined;
|
|
858
858
|
}[] | undefined;
|
|
@@ -1110,7 +1110,7 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
|
|
|
1110
1110
|
nameMarks?: {
|
|
1111
1111
|
start: number;
|
|
1112
1112
|
end: number;
|
|
1113
|
-
weight?: "
|
|
1113
|
+
weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
|
|
1114
1114
|
italic?: boolean | undefined;
|
|
1115
1115
|
font?: "sans" | "serif" | "mono" | undefined;
|
|
1116
1116
|
}[] | undefined;
|
|
@@ -1374,6 +1374,15 @@ declare const seoSchema: z.ZodObject<{
|
|
|
1374
1374
|
* and refuses to create, delete, rename or promote them to the home page.
|
|
1375
1375
|
*/
|
|
1376
1376
|
declare const SYSTEM_PAGES: readonly ["404"];
|
|
1377
|
+
/**
|
|
1378
|
+
* Which page operations the editor allows. Both default to true. A locked operation is refused by the API, whoever
|
|
1379
|
+
* asks (the editor, a script, an assistant), and its controls are hidden in the editor.
|
|
1380
|
+
*/
|
|
1381
|
+
interface PageRules {
|
|
1382
|
+
/** Change a page's slug, including making another page the home page (that moves two pages to new addresses). */
|
|
1383
|
+
rename: boolean;
|
|
1384
|
+
delete: boolean;
|
|
1385
|
+
}
|
|
1377
1386
|
declare function isSystemPage(slug: string): boolean;
|
|
1378
1387
|
/** Validates a page document: its own fields, and every section against the registry. Cached per registry. */
|
|
1379
1388
|
declare function createPageSchema<TRegistry extends SectionRegistry>(registry: TRegistry): z.ZodType<Page<SectionOf<TRegistry>>>;
|
|
@@ -1393,4 +1402,4 @@ declare function withoutOrphanSections<TPage extends {
|
|
|
1393
1402
|
sections: readonly unknown[];
|
|
1394
1403
|
}>(page: TPage, registry: SectionRegistry): TPage;
|
|
1395
1404
|
//#endregion
|
|
1396
|
-
export {
|
|
1405
|
+
export { Theme as $, SCHEMA_VERSION_KEY as $t, ContentModel as A, wireKinds as At, Footer as B, motionOption as Bt, jsonLdSchema as C, SectionConfig as Ct, siteJsonLdIds as D, WireRect as Dt, parseJsonLdInput as E, WireKind as Et, defaultTheme as F, EnumOption as Ft, Site as G, FieldChoices as Gt, FooterConfig as H, toneOption as Ht, defineTheme as I, NumberOption as It, SiteConsent as J, ShowWhen as Jt, SiteAnalytics as K, FieldIcons as Kt, BRAND_LOGO_HEIGHT as L, Option as Lt, ThemeConfig as M, OptionalContent as Mt, ThemeDefinition as N, BooleanOption as Nt, upsertJsonLd as O, Wireframe as Ot, ThemeFont as P, CountRule as Pt, SiteWith as Q, DocumentKind as Qt, DEFAULT_MAX_FOOTER_COLUMNS as R, StringOption as Rt, isPlaceholderSiteUrl as S, withEmphasis as St, mergeJsonLd as T, defineSection as Tt, Header as U, tones as Ut, FooterColumn as V, themeModes as Vt, HeaderConfig as W, variantOption as Wt, SiteOf as X, ContentMigrator as Xt, SiteDefinition as Y, ContentMigration as Yt, SiteSeo as Z, ContentVersioning as Zt, SiteJsonLdIds as _, richTextSchema as _t, createPageSchema as a, themeColorsSchema as at, generateSiteJsonLd as b, toneSchema as bt, withoutOrphanSections as c, Image as ct, SectionOf as d, RichText as dt, createMigrator as en, brandLogoSchema as et, anchorSchema as f, Text as ft, JsonLdResult as g, linkSchema as gt, JsonLdBlock as h, imageSchema as ht, Seo as i, siteSeoSchema as it, SectionRegistry as j, wireframeIssues as jt, API_PREFIX as k, defineWireframe as kt, BaseSection as l, Link as lt, sectionIdSchema as m, htmlIdSchema as mt, PageRules as n, siteAnalyticsSchema as nt, isSystemPage as o, themeSchema as ot, createSectionSchema as p, Tone as pt, SiteConfig as q, ShowCondition as qt, SYSTEM_PAGES as r, siteConsentSchema as rt, seoSchema as s, ButtonStyle as st, Page as t, defineSite as tt, PropsOf as u, MAX_NAV_DEPTH as ut, SiteJsonLdSource as v, textMarkSchema as vt, jsonLdWarnings as w, SectionDefinition as wt, hasJsonLdId as x, trackingIdSchema as xt, formatJsonLd as y, textSchema as yt, DEFAULT_MAX_HEADER_ACTIONS as z, buttonStyles as zt };
|
|
@@ -503,6 +503,22 @@ const seoSchema = z.object({
|
|
|
503
503
|
* and refuses to create, delete, rename or promote them to the home page.
|
|
504
504
|
*/
|
|
505
505
|
const SYSTEM_PAGES = ["404"];
|
|
506
|
+
const DEFAULT_PAGE_RULES = {
|
|
507
|
+
rename: true,
|
|
508
|
+
delete: true
|
|
509
|
+
};
|
|
510
|
+
/** Check the `pages` option and fill in its defaults. */
|
|
511
|
+
function resolvePageRules(input) {
|
|
512
|
+
if (input === void 0) return DEFAULT_PAGE_RULES;
|
|
513
|
+
for (const [key, value] of Object.entries(input)) {
|
|
514
|
+
if (key !== "rename" && key !== "delete") throw new Error(`bearminion(): unknown option pages.${key}. Use pages.rename or pages.delete.`);
|
|
515
|
+
if (typeof value !== "boolean") throw new Error(`bearminion(): pages.${key} must be true or false.`);
|
|
516
|
+
}
|
|
517
|
+
return {
|
|
518
|
+
rename: input.rename ?? true,
|
|
519
|
+
delete: input.delete ?? true
|
|
520
|
+
};
|
|
521
|
+
}
|
|
506
522
|
function isSystemPage(slug) {
|
|
507
523
|
return SYSTEM_PAGES.includes(slug);
|
|
508
524
|
}
|
|
@@ -547,4 +563,4 @@ function withoutOrphanSections(page, registry) {
|
|
|
547
563
|
};
|
|
548
564
|
}
|
|
549
565
|
//#endregion
|
|
550
|
-
export {
|
|
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 };
|
package/dist/ui/mount.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as sectionFieldKey, i as isPropShown, t as defaultTheme } from "../theme-
|
|
2
|
-
import { B as
|
|
1
|
+
import { a as sectionFieldKey, i as isPropShown, t as defaultTheme } from "../theme-BvqJ8UnS.js";
|
|
2
|
+
import { B as isImagePosition, C as upsertJsonLd, F as DEFAULT_IMAGE_FIT, I as DEFAULT_IMAGE_POSITION, L as IMAGE_FITS, R as IMAGE_POSITIONS, V as withImageLayout, _ as isPlaceholderSiteUrl, h as generateSiteJsonLd, i as isSystemPage, m as formatJsonLd, x as parseJsonLdInput, y as jsonLdWarnings, z as isImageFit } from "../page-wlcQJAA-.js";
|
|
3
3
|
import { d as reconcileMarks, f as renderMarkedHtml, i as fontMarks, l as marksFromEmphasis, t as applyTextMark } from "../marks-DPBilumg.js";
|
|
4
4
|
import { _ as consentCopy, b as parseMediaSource, c as hasThemeColors, d as tokenToHex, f as CONSENT_COPY, h as CONSENT_LIMITS, i as contrastChecks, n as HEX_COLOR, o as derivePalette, r as OVERRIDE_TOKENS, s as hasOverrides, t as DEFAULT_BRAND, u as themeCss, v as consentTextIssues } from "../theme-colors-CHROGZkI.js";
|
|
5
5
|
import { n as formatBytes, t as DEFAULT_IMAGE_BYTE_LIMIT } from "../upload-rules-Cao9uY5K.js";
|
|
@@ -948,8 +948,32 @@ function navHeight(link) {
|
|
|
948
948
|
for (const child of children) max = Math.max(max, 1 + navHeight(child));
|
|
949
949
|
return max;
|
|
950
950
|
}
|
|
951
|
+
/** Letters that do not decompose into a base letter and an accent, with the plain letters they are written as. */
|
|
952
|
+
const PLAIN_LETTERS = {
|
|
953
|
+
ł: "l",
|
|
954
|
+
đ: "d",
|
|
955
|
+
ø: "o",
|
|
956
|
+
ð: "d",
|
|
957
|
+
þ: "th",
|
|
958
|
+
ß: "ss",
|
|
959
|
+
æ: "ae",
|
|
960
|
+
œ: "oe",
|
|
961
|
+
ı: "i"
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* A lowercase ASCII slug: accents are dropped (`ą` is `a`, `é` is `e`), letters with no accent form are written plainly
|
|
965
|
+
* (`ł` is `l`, `ß` is `ss`), and every other run of characters becomes one hyphen.
|
|
966
|
+
*/
|
|
951
967
|
function slugifyAnchor(value) {
|
|
952
|
-
return value.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
968
|
+
return value.toLowerCase().normalize("NFKD").replace(/\p{M}+/gu, "").replace(/[łđøðþßæœı]/g, (letter) => PLAIN_LETTERS[letter] ?? letter).replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* The slug to offer for a new page titled `title`: the title as a slug, made unique among `taken`. Empty when the
|
|
972
|
+
* title has no letters or digits, so the editor does not offer a slug that says nothing.
|
|
973
|
+
*/
|
|
974
|
+
function suggestPageSlug(title, taken) {
|
|
975
|
+
const stem = slugifyAnchor(title);
|
|
976
|
+
return stem === "" ? "" : uniqueAnchor(stem, taken);
|
|
953
977
|
}
|
|
954
978
|
function uniqueAnchor(base, taken) {
|
|
955
979
|
const stem = slugifyAnchor(base) || "section";
|
|
@@ -22413,7 +22437,7 @@ function SeoCard({ page, siteName, siteUrl, siteOgImage, system, onEdit }) {
|
|
|
22413
22437
|
}
|
|
22414
22438
|
//#endregion
|
|
22415
22439
|
//#region src/ui/forms/page-form.tsx
|
|
22416
|
-
function PageForm({ page, labels, siteName, siteUrl, siteOgImage, selectedId, onChange, savedSlug, onHomeChange, onEditSeo, onSelectSection, onMoveSection, onReorderSections, onDuplicateSection, onRemoveSection, onAddSection }) {
|
|
22440
|
+
function PageForm({ page, labels, siteName, siteUrl, siteOgImage, selectedId, onChange, savedSlug, canRename, onHomeChange, onEditSeo, onSelectSection, onMoveSection, onReorderSections, onDuplicateSection, onRemoveSection, onAddSection }) {
|
|
22417
22441
|
const [sectionDrag, setSectionDrag] = useState(null);
|
|
22418
22442
|
const isHome = page.slug === "index";
|
|
22419
22443
|
const isSystem = isSystemPage(page.slug);
|
|
@@ -22443,9 +22467,9 @@ function PageForm({ page, labels, siteName, siteUrl, siteOgImage, selectedId, on
|
|
|
22443
22467
|
...page,
|
|
22444
22468
|
slug: value
|
|
22445
22469
|
}),
|
|
22446
|
-
disabled: isHome || isSystem,
|
|
22447
|
-
mono: isHome || isSystem,
|
|
22448
|
-
hint: isHome ? "The home page is served at / and keeps the slug index." : isSystem ? "A system page: the site serves it for unknown addresses, so its slug is fixed and it stays out of search results." : void 0
|
|
22470
|
+
disabled: isHome || isSystem || !canRename,
|
|
22471
|
+
mono: isHome || isSystem || !canRename,
|
|
22472
|
+
hint: isHome ? "The home page is served at / and keeps the slug index." : isSystem ? "A system page: the site serves it for unknown addresses, so its slug is fixed and it stays out of search results." : canRename ? void 0 : "Renaming pages is turned off for this site, so this address stays as it is."
|
|
22449
22473
|
}),
|
|
22450
22474
|
!isSystem && /* @__PURE__ */ jsxs("label", {
|
|
22451
22475
|
class: "bm-switch-row",
|
|
@@ -22455,14 +22479,14 @@ function PageForm({ page, labels, siteName, siteUrl, siteOgImage, selectedId, on
|
|
|
22455
22479
|
class: "bm-switch-title",
|
|
22456
22480
|
children: ["Home page", /* @__PURE__ */ jsx(Info, {
|
|
22457
22481
|
label: "About Home page",
|
|
22458
|
-
text: savedHome ? "Set another page as home to move this one." : isHome ? "Becomes the home page when you save." : "Serve this page at / instead of its own URL."
|
|
22482
|
+
text: !canRename ? "Renaming pages is turned off for this site, and making a page home moves the old home page to a new address." : savedHome ? "Set another page as home to move this one." : isHome ? "Becomes the home page when you save." : "Serve this page at / instead of its own URL."
|
|
22459
22483
|
})]
|
|
22460
22484
|
})
|
|
22461
22485
|
}), /* @__PURE__ */ jsx("input", {
|
|
22462
22486
|
type: "checkbox",
|
|
22463
22487
|
role: "switch",
|
|
22464
22488
|
checked: isHome,
|
|
22465
|
-
disabled: savedHome,
|
|
22489
|
+
disabled: savedHome || !canRename,
|
|
22466
22490
|
onChange: (event) => onHomeChange(event.currentTarget.checked)
|
|
22467
22491
|
})]
|
|
22468
22492
|
})
|
|
@@ -22651,9 +22675,13 @@ function PageForm({ page, labels, siteName, siteUrl, siteOgImage, selectedId, on
|
|
|
22651
22675
|
}
|
|
22652
22676
|
//#endregion
|
|
22653
22677
|
//#region src/ui/forms/pages-form.tsx
|
|
22654
|
-
function PagesForm({ pages, labels, current, homeSlug, onCreated, onNavigate }) {
|
|
22655
|
-
const
|
|
22678
|
+
function PagesForm({ pages, labels, current, homeSlug, canDelete, onCreated, onNavigate }) {
|
|
22679
|
+
const taken = new Set(pages.map((item) => item.slug));
|
|
22656
22680
|
const [title, setTitle] = useState("Notes");
|
|
22681
|
+
const [slug, setSlug] = useState(() => suggestPageSlug("Notes", taken));
|
|
22682
|
+
/** True once the slug was typed by hand: from then on the title no longer changes it. */
|
|
22683
|
+
const [slugTyped, setSlugTyped] = useState(false);
|
|
22684
|
+
const [error, setError] = useState("");
|
|
22657
22685
|
const [template, setTemplate] = useState("hero");
|
|
22658
22686
|
const [creating, setCreating] = useState(false);
|
|
22659
22687
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -22711,7 +22739,7 @@ function PagesForm({ pages, labels, current, homeSlug, onCreated, onNavigate })
|
|
|
22711
22739
|
class: "bm-badge bm-badge-on",
|
|
22712
22740
|
children: "editing"
|
|
22713
22741
|
}),
|
|
22714
|
-
item.slug !== "index" && item.slug !== current && !item.system && /* @__PURE__ */ jsx("button", {
|
|
22742
|
+
canDelete && item.slug !== "index" && item.slug !== current && !item.system && /* @__PURE__ */ jsx("button", {
|
|
22715
22743
|
type: "button",
|
|
22716
22744
|
class: "bm-icon-btn bm-danger",
|
|
22717
22745
|
"aria-label": `Delete ${item.title}`,
|
|
@@ -22730,15 +22758,23 @@ function PagesForm({ pages, labels, current, homeSlug, onCreated, onNavigate })
|
|
|
22730
22758
|
creating && /* @__PURE__ */ jsxs("div", {
|
|
22731
22759
|
class: "bm-card",
|
|
22732
22760
|
children: [
|
|
22733
|
-
/* @__PURE__ */ jsx(Field, {
|
|
22734
|
-
label: "New slug",
|
|
22735
|
-
value: slug,
|
|
22736
|
-
onChange: setSlug
|
|
22737
|
-
}),
|
|
22738
22761
|
/* @__PURE__ */ jsx(Field, {
|
|
22739
22762
|
label: "New title",
|
|
22740
22763
|
value: title,
|
|
22741
|
-
onChange:
|
|
22764
|
+
onChange: (value) => {
|
|
22765
|
+
setTitle(value);
|
|
22766
|
+
if (!slugTyped) setSlug(suggestPageSlug(value, taken));
|
|
22767
|
+
}
|
|
22768
|
+
}),
|
|
22769
|
+
/* @__PURE__ */ jsx(Field, {
|
|
22770
|
+
label: "New slug",
|
|
22771
|
+
value: slug,
|
|
22772
|
+
mono: true,
|
|
22773
|
+
hint: "The page address. Made from the title until you change it, and the title never changes it afterwards.",
|
|
22774
|
+
onChange: (value) => {
|
|
22775
|
+
setSlug(value);
|
|
22776
|
+
setSlugTyped(true);
|
|
22777
|
+
}
|
|
22742
22778
|
}),
|
|
22743
22779
|
/* @__PURE__ */ jsxs("label", {
|
|
22744
22780
|
class: "bm-label",
|
|
@@ -22754,16 +22790,23 @@ function PagesForm({ pages, labels, current, homeSlug, onCreated, onNavigate })
|
|
|
22754
22790
|
/* @__PURE__ */ jsx("button", {
|
|
22755
22791
|
type: "button",
|
|
22756
22792
|
class: "bm-primary",
|
|
22793
|
+
disabled: slug === "",
|
|
22757
22794
|
onClick: () => {
|
|
22795
|
+
setError("");
|
|
22758
22796
|
createPage({
|
|
22759
22797
|
slug,
|
|
22760
22798
|
title,
|
|
22761
22799
|
template
|
|
22762
22800
|
}).then((result) => {
|
|
22763
22801
|
if (result.ok) onNavigate(pageHref(slug));
|
|
22802
|
+
else setError(result.status === 0 ? "Could not create the page." : result.message);
|
|
22764
22803
|
});
|
|
22765
22804
|
},
|
|
22766
22805
|
children: "Create page"
|
|
22806
|
+
}),
|
|
22807
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
22808
|
+
class: "bm-error",
|
|
22809
|
+
children: error
|
|
22767
22810
|
})
|
|
22768
22811
|
]
|
|
22769
22812
|
})
|
|
@@ -23178,6 +23221,7 @@ function PagesPanel({ catalog }) {
|
|
|
23178
23221
|
labels: catalog.sectionLabels,
|
|
23179
23222
|
current: savedSlug,
|
|
23180
23223
|
homeSlug: page && page.slug === "index" ? savedSlug : "index",
|
|
23224
|
+
canDelete: catalog.pageRules?.delete !== false,
|
|
23181
23225
|
onCreated: () => void session.load(doc.savedSlug.peek()),
|
|
23182
23226
|
onNavigate: session.requestLeave
|
|
23183
23227
|
}), page && /* @__PURE__ */ jsx(PageForm, {
|
|
@@ -23189,6 +23233,7 @@ function PagesPanel({ catalog }) {
|
|
|
23189
23233
|
selectedId: ui.selectedId.value,
|
|
23190
23234
|
onChange: (next) => edits.updatePage(next),
|
|
23191
23235
|
savedSlug,
|
|
23236
|
+
canRename: catalog.pageRules?.rename !== false,
|
|
23192
23237
|
onHomeChange: session.setHome,
|
|
23193
23238
|
onEditSeo: () => {
|
|
23194
23239
|
ui.dialog.value = { kind: "seo" };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bearminion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A git-based CMS for Astro with no database and no server: JSON content in your repo, edited by clicking on the page during astro dev.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jakub Lange",
|