bearminion 1.7.0 → 1.9.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 (92) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/astro.d.ts +2 -2
  3. package/dist/astro.js +17 -5
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +819 -0
  6. package/dist/content.d.ts +1 -1
  7. package/dist/content.js +2 -2
  8. package/dist/hash-BeBymBO1.js +59 -0
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +4 -4
  11. package/dist/marks-DPBilumg.js +174 -0
  12. package/dist/marks.js +1 -174
  13. package/dist/{options-BeJQnsZM.d.ts → options-4HWVEj9O.d.ts} +7 -1
  14. package/dist/{page-BfI9cD8g.d.ts → page-CA4iyFDS.d.ts} +7 -7
  15. package/dist/{page-NOFVEqn1.js → page-X-WnOu7-.js} +1 -1
  16. package/dist/{preview--S1QUrMM.js → preview-B_88I5Jm.js} +1 -1
  17. package/dist/{reload-BPkPoQ-P.js → reload-Dkp3xC0l.js} +1 -1
  18. package/dist/rich-text-70hddxMC.js +403 -0
  19. package/dist/rich-text.js +1 -403
  20. package/dist/sections-manifest-CO9QfJPG.js +97 -0
  21. package/dist/{theme-DFjHjgFO.js → theme-Dv7_7B56.js} +2 -2
  22. package/dist/ui/mount.js +20 -7
  23. package/package.json +7 -1
  24. package/registry/default/files/src/components/atoms/Button.astro +64 -0
  25. package/registry/default/files/src/components/atoms/Emphasis.astro +24 -0
  26. package/registry/default/files/src/components/atoms/Image.astro +78 -0
  27. package/registry/default/files/src/components/atoms/Typography.astro +53 -0
  28. package/registry/default/files/src/components/atoms/button.ts +31 -0
  29. package/registry/default/files/src/components/atoms/image.ts +34 -0
  30. package/registry/default/files/src/components/atoms/options.ts +39 -0
  31. package/registry/default/files/src/components/atoms/typography.ts +64 -0
  32. package/registry/default/files/src/components/molecules/CommandLine.astro +109 -0
  33. package/registry/default/files/src/components/molecules/MediaFrame.astro +71 -0
  34. package/registry/default/files/src/components/molecules/Pill.astro +24 -0
  35. package/registry/default/files/src/components/molecules/SectionHeader.astro +63 -0
  36. package/registry/default/files/src/components/molecules/SectionShell.astro +33 -0
  37. package/registry/default/files/src/components/sections/contact/Contact.astro +231 -0
  38. package/registry/default/files/src/components/sections/contact/definition.ts +52 -0
  39. package/registry/default/files/src/components/sections/contact/form.ts +313 -0
  40. package/registry/default/files/src/components/sections/contact/wireframe.ts +15 -0
  41. package/registry/default/files/src/components/sections/cta/Cta.astro +206 -0
  42. package/registry/default/files/src/components/sections/cta/definition.ts +49 -0
  43. package/registry/default/files/src/components/sections/cta/wireframe.ts +9 -0
  44. package/registry/default/files/src/components/sections/faq/Faq.astro +136 -0
  45. package/registry/default/files/src/components/sections/faq/definition.ts +54 -0
  46. package/registry/default/files/src/components/sections/faq/wireframe.ts +19 -0
  47. package/registry/default/files/src/components/sections/features/Features.astro +146 -0
  48. package/registry/default/files/src/components/sections/features/definition.ts +54 -0
  49. package/registry/default/files/src/components/sections/features/wireframe.ts +19 -0
  50. package/registry/default/files/src/components/sections/gallery/Gallery.astro +128 -0
  51. package/registry/default/files/src/components/sections/gallery/definition.ts +59 -0
  52. package/registry/default/files/src/components/sections/gallery/lightbox.ts +159 -0
  53. package/registry/default/files/src/components/sections/gallery/wireframe.ts +12 -0
  54. package/registry/default/files/src/components/sections/hero/Hero.astro +185 -0
  55. package/registry/default/files/src/components/sections/hero/HeroBadge.astro +26 -0
  56. package/registry/default/files/src/components/sections/hero/definition.ts +74 -0
  57. package/registry/default/files/src/components/sections/hero/wireframe.ts +12 -0
  58. package/registry/default/files/src/components/sections/logo-strip/LogoStrip.astro +107 -0
  59. package/registry/default/files/src/components/sections/logo-strip/definition.ts +30 -0
  60. package/registry/default/files/src/components/sections/logo-strip/wireframe.ts +11 -0
  61. package/registry/default/files/src/components/sections/media/Media.astro +118 -0
  62. package/registry/default/files/src/components/sections/media/MediaPlayer.astro +176 -0
  63. package/registry/default/files/src/components/sections/media/definition.ts +77 -0
  64. package/registry/default/files/src/components/sections/media/source.ts +3 -0
  65. package/registry/default/files/src/components/sections/media/wireframe.ts +9 -0
  66. package/registry/default/files/src/components/sections/pricing/Pricing.astro +210 -0
  67. package/registry/default/files/src/components/sections/pricing/definition.ts +62 -0
  68. package/registry/default/files/src/components/sections/pricing/wireframe.ts +18 -0
  69. package/registry/default/files/src/components/sections/shared.ts +13 -0
  70. package/registry/default/files/src/components/sections/stats/Stats.astro +110 -0
  71. package/registry/default/files/src/components/sections/stats/definition.ts +41 -0
  72. package/registry/default/files/src/components/sections/stats/wireframe.ts +15 -0
  73. package/registry/default/files/src/components/sections/steps/Steps.astro +139 -0
  74. package/registry/default/files/src/components/sections/steps/definition.ts +62 -0
  75. package/registry/default/files/src/components/sections/steps/icons.ts +27 -0
  76. package/registry/default/files/src/components/sections/steps/wireframe.ts +16 -0
  77. package/registry/default/files/src/components/sections/testimonials/Testimonials.astro +172 -0
  78. package/registry/default/files/src/components/sections/testimonials/definition.ts +42 -0
  79. package/registry/default/files/src/components/sections/testimonials/wireframe.ts +21 -0
  80. package/registry/default/files/src/components/sections/text/Text.astro +43 -0
  81. package/registry/default/files/src/components/sections/text/definition.ts +36 -0
  82. package/registry/default/files/src/components/sections/text/wireframe.ts +12 -0
  83. package/registry/default/files/src/components/sections/text-image/TextImage.astro +107 -0
  84. package/registry/default/files/src/components/sections/text-image/definition.ts +39 -0
  85. package/registry/default/files/src/components/sections/text-image/wireframe.ts +12 -0
  86. package/registry/default/files/src/lib/assets.ts +13 -0
  87. package/registry/default/files/src/lib/cn.ts +6 -0
  88. package/registry/default/files/src/lib/contact-form.ts +97 -0
  89. package/registry/default/files/src/lib/hidden-text.ts +32 -0
  90. package/registry/default/files/src/lib/image-url.ts +38 -0
  91. package/registry/default/files/src/lib/link-attrs.ts +74 -0
  92. package/registry/default/registry.json +670 -0
package/dist/content.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { k as ContentModel, t as Page, u as SectionOf } from "./page-BfI9cD8g.js";
1
+ import { k as ContentModel, t as Page, u as SectionOf } from "./page-CA4iyFDS.js";
2
2
  import { z } from "zod";
3
3
  //#region src/content.d.ts
4
4
  export interface ContentCollectionsOptions {
package/dist/content.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as createPageSchema, r as createTolerantPageSchema } from "./page-NOFVEqn1.js";
1
+ import { n as createPageSchema, r as createTolerantPageSchema } from "./page-X-WnOu7-.js";
2
2
  import { n as createMigrator } from "./migrate-b408EaLp.js";
3
- import { t as CONTENT_COLLECTIONS_MARKER } from "./reload-BPkPoQ-P.js";
3
+ import { t as CONTENT_COLLECTIONS_MARKER } from "./reload-Dkp3xC0l.js";
4
4
  import { z } from "zod";
5
5
  import path from "node:path";
6
6
  import { pathToFileURL } from "node:url";
@@ -0,0 +1,59 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { createHash } from "node:crypto";
4
+ //#region src/registry/types.ts
5
+ /** The lock file in a site's root. */
6
+ const LOCK_FILE = "bearminion.lock.json";
7
+ //#endregion
8
+ //#region src/add/lock.ts
9
+ /** The site's lock file, or an empty one for the template when it has none. */
10
+ function readLock(root, template) {
11
+ const file = path.join(root, LOCK_FILE);
12
+ if (!fs.existsSync(file)) return {
13
+ schemaVersion: 1,
14
+ template,
15
+ files: {}
16
+ };
17
+ const lock = JSON.parse(fs.readFileSync(file, "utf8"));
18
+ if (lock.template !== template) throw new Error(`${LOCK_FILE} belongs to the "${lock.template}" template, and this is "${template}".`);
19
+ return lock;
20
+ }
21
+ /**
22
+ * Notes that `paths` now hold what `registry` has, keeping an older entry whose hash is still right: the file has not
23
+ * changed since that release, and that release is the one a later update has to start from.
24
+ */
25
+ function recordFiles(lock, registry, paths) {
26
+ const files = { ...lock.files };
27
+ for (const file of paths) {
28
+ const hash = registry.files[file]?.hash;
29
+ if (hash === void 0) continue;
30
+ if (files[file]?.hash !== hash) files[file] = {
31
+ version: registry.version,
32
+ hash
33
+ };
34
+ }
35
+ return {
36
+ ...lock,
37
+ files: Object.fromEntries(Object.entries(files).sort(([a], [b]) => a < b ? -1 : 1))
38
+ };
39
+ }
40
+ function writeLock(root, lock) {
41
+ fs.writeFileSync(path.join(root, LOCK_FILE), `${JSON.stringify(lock, null, 2)}\n`);
42
+ }
43
+ //#endregion
44
+ //#region src/registry/hash.ts
45
+ const TEXT_FILE = /\.(?:astro|ts|mts|js|mjs|json|css|md|svg|html)$/;
46
+ /**
47
+ * The hash of a file's content, as hex. Text files hash with `\r\n` read as `\n`, so a Windows checkout with
48
+ * autocrlf and a Unix one agree.
49
+ */
50
+ function hashContent(file, content) {
51
+ const hash = createHash("sha256");
52
+ if (TEXT_FILE.test(file)) {
53
+ const text = typeof content === "string" ? content : Buffer.from(content).toString("utf8");
54
+ hash.update(text.replace(/\r\n/g, "\n"));
55
+ } else hash.update(typeof content === "string" ? content : Buffer.from(content));
56
+ return hash.digest("hex");
57
+ }
58
+ //#endregion
59
+ export { writeLock as i, readLock as n, recordFiles as r, hashContent as t };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as brandLogoSchema, $t as createMigrator, A as SectionRegistry, At as wireframeIssues, B as FooterColumn, Bt as themeModes, C as jsonLdWarnings, Ct as SectionDefinition, D as upsertJsonLd, Dt as Wireframe, E as siteJsonLdIds, Et as WireRect, F as defineTheme, Ft as NumberOption, G as SiteAnalytics, Gt as FieldIcons, H as Header, Ht as tones, I as BRAND_LOGO_HEIGHT, It as Option, J as SiteDefinition, Jt as ContentMigration, K as SiteConfig, Kt as ShowCondition, L as DEFAULT_MAX_FOOTER_COLUMNS, Lt as StringOption, M as ThemeDefinition, Mt as BooleanOption, N as ThemeFont, Nt as CountRule, O as API_PREFIX, Ot as defineWireframe, P as defaultTheme, Pt as EnumOption, Q as Theme, Qt as SCHEMA_VERSION_KEY, R as DEFAULT_MAX_HEADER_ACTIONS, Rt as buttonStyles, S as jsonLdSchema, St as SectionConfig, T as parseJsonLdInput, Tt as WireKind, U as HeaderConfig, Ut as variantOption, V as FooterConfig, Vt as toneOption, W as Site, Wt as FieldChoices, X as SiteSeo, Xt as ContentVersioning, Y as SiteOf, Yt as ContentMigrator, Z as SiteWith, Zt as DocumentKind, _ as SiteJsonLdSource, _t as textMarkSchema, a as isSystemPage, at as themeSchema, b as hasJsonLdId, bt as trackingIdSchema, c as BaseSection, ct as Link, d as anchorSchema, dt as Text, et as defineSite, f as createSectionSchema, ft as Tone, g as SiteJsonLdIds, gt as richTextSchema, h as JsonLdResult, ht as linkSchema, i as createPageSchema, it as themeColorsSchema, j as ThemeConfig, jt as OptionalContent, k as ContentModel, kt as wireKinds, l as PropsOf, lt as MAX_NAV_DEPTH, m as JsonLdBlock, mt as imageSchema, n as SYSTEM_PAGES, nt as siteConsentSchema, o as seoSchema, ot as ButtonStyle, p as sectionIdSchema, pt as htmlIdSchema, q as SiteConsent, qt as ShowWhen, r as Seo, rt as siteSeoSchema, s as withoutOrphanSections, st as Image, t as Page, tt as siteAnalyticsSchema, u as SectionOf, ut as RichText, v as formatJsonLd, vt as textSchema, w as mergeJsonLd, wt as defineSection, x as isPlaceholderSiteUrl, xt as withEmphasis, y as generateSiteJsonLd, yt as toneSchema, z as Footer, zt as motionOption } from "./page-BfI9cD8g.js";
1
+ import { $ as brandLogoSchema, $t as createMigrator, A as SectionRegistry, At as wireframeIssues, B as FooterColumn, Bt as themeModes, C as jsonLdWarnings, Ct as SectionDefinition, D as upsertJsonLd, Dt as Wireframe, E as siteJsonLdIds, Et as WireRect, F as defineTheme, Ft as NumberOption, G as SiteAnalytics, Gt as FieldIcons, H as Header, Ht as tones, I as BRAND_LOGO_HEIGHT, It as Option, J as SiteDefinition, Jt as ContentMigration, K as SiteConfig, Kt as ShowCondition, L as DEFAULT_MAX_FOOTER_COLUMNS, Lt as StringOption, M as ThemeDefinition, Mt as BooleanOption, N as ThemeFont, Nt as CountRule, O as API_PREFIX, Ot as defineWireframe, P as defaultTheme, Pt as EnumOption, Q as Theme, Qt as SCHEMA_VERSION_KEY, R as DEFAULT_MAX_HEADER_ACTIONS, Rt as buttonStyles, S as jsonLdSchema, St as SectionConfig, T as parseJsonLdInput, Tt as WireKind, U as HeaderConfig, Ut as variantOption, V as FooterConfig, Vt as toneOption, W as Site, Wt as FieldChoices, X as SiteSeo, Xt as ContentVersioning, Y as SiteOf, Yt as ContentMigrator, Z as SiteWith, Zt as DocumentKind, _ as SiteJsonLdSource, _t as textMarkSchema, a as isSystemPage, at as themeSchema, b as hasJsonLdId, bt as trackingIdSchema, c as BaseSection, ct as Link, d as anchorSchema, dt as Text, et as defineSite, f as createSectionSchema, ft as Tone, g as SiteJsonLdIds, gt as richTextSchema, h as JsonLdResult, ht as linkSchema, i as createPageSchema, it as themeColorsSchema, j as ThemeConfig, jt as OptionalContent, k as ContentModel, kt as wireKinds, l as PropsOf, lt as MAX_NAV_DEPTH, m as JsonLdBlock, mt as imageSchema, n as SYSTEM_PAGES, nt as siteConsentSchema, o as seoSchema, ot as ButtonStyle, p as sectionIdSchema, pt as htmlIdSchema, q as SiteConsent, qt as ShowWhen, r as Seo, rt as siteSeoSchema, s as withoutOrphanSections, st as Image, t as Page, tt as siteAnalyticsSchema, u as SectionOf, ut as RichText, v as formatJsonLd, vt as textSchema, w as mergeJsonLd, wt as defineSection, x as isPlaceholderSiteUrl, xt as withEmphasis, y as generateSiteJsonLd, yt as toneSchema, z as Footer, zt as motionOption } from "./page-CA4iyFDS.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-BeJQnsZM.js";
3
+ import "./options-4HWVEj9O.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,7 +1,7 @@
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--S1QUrMM.js";
2
- import { n as defineTheme, t as defaultTheme } from "./theme-DFjHjgFO.js";
3
- import { A as textSchema, C as MAX_NAV_DEPTH, D as linkSchema, E as imageSchema, F as DEFAULT_IMAGE_POSITION, G as tones, H as motionOption, I as IMAGE_FITS, K as variantOption, L as IMAGE_POSITIONS, M as trackingIdSchema, N as withEmphasis, O as richTextSchema, P as DEFAULT_IMAGE_FIT, R as isImageFit, S as upsertJsonLd, T as htmlIdSchema, U as themeModes, V as buttonStyles, W as toneOption, _ as jsonLdSchema, a as seoSchema, b as parseJsonLdInput, c as anchorSchema, d as sectionIdSchema, f as walkLinkIds, g as isPlaceholderSiteUrl, h as hasJsonLdId, i as isSystemPage, j as toneSchema, k as textMarkSchema, l as createSectionSchema, m as generateSiteJsonLd, n as createPageSchema, p as formatJsonLd, s as withoutOrphanSections, t as SYSTEM_PAGES, v as jsonLdWarnings, w as addMarkIssues, x as siteJsonLdIds, y as mergeJsonLd, z as isImagePosition } from "./page-NOFVEqn1.js";
4
- import { applyTextMark, fontMarks, markClass, marksFromEmphasis, reconcileMarks, renderMarkedHtml, splitMarkedText, weightMarks } from "./marks.js";
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-B_88I5Jm.js";
2
+ import { n as defineTheme, t as defaultTheme } from "./theme-Dv7_7B56.js";
3
+ import { A as textSchema, C as MAX_NAV_DEPTH, D as linkSchema, E as imageSchema, F as DEFAULT_IMAGE_POSITION, G as tones, H as motionOption, I as IMAGE_FITS, K as variantOption, L as IMAGE_POSITIONS, M as trackingIdSchema, N as withEmphasis, O as richTextSchema, P as DEFAULT_IMAGE_FIT, R as isImageFit, S as upsertJsonLd, T as htmlIdSchema, U as themeModes, V as buttonStyles, W as toneOption, _ as jsonLdSchema, a as seoSchema, b as parseJsonLdInput, c as anchorSchema, d as sectionIdSchema, f as walkLinkIds, g as isPlaceholderSiteUrl, h as hasJsonLdId, i as isSystemPage, j as toneSchema, k as textMarkSchema, l as createSectionSchema, m as generateSiteJsonLd, n as createPageSchema, p as formatJsonLd, s as withoutOrphanSections, t as SYSTEM_PAGES, v as jsonLdWarnings, w as addMarkIssues, x as siteJsonLdIds, y as mergeJsonLd, z as isImagePosition } from "./page-X-WnOu7-.js";
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";
7
7
  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";
@@ -0,0 +1,174 @@
1
+ //#region src/marks.ts
2
+ /**
3
+ * Inline marks for headings and the site wordmark.
4
+ * A heading stays a plain string. Marks name ranges inside it.
5
+ * No HTML and no arbitrary CSS: each mark is a weight, italic, and/or a font token.
6
+ */
7
+ const fontMarks = [
8
+ "sans",
9
+ "serif",
10
+ "mono"
11
+ ];
12
+ const weightMarks = [
13
+ "regular",
14
+ "medium",
15
+ "semibold",
16
+ "bold"
17
+ ];
18
+ const fonts = new Set(fontMarks);
19
+ const weights = new Set(weightMarks);
20
+ function isFontMark(value) {
21
+ return typeof value === "string" && fonts.has(value);
22
+ }
23
+ function isWeightMark(value) {
24
+ return typeof value === "string" && weights.has(value);
25
+ }
26
+ /** The legacy `em` / `nameEm` accent: Instrument Serif italic on that substring. */
27
+ function marksFromEmphasis(text, em) {
28
+ if (!em) return void 0;
29
+ const start = text.indexOf(em);
30
+ if (start < 0) return void 0;
31
+ return [{
32
+ start,
33
+ end: start + em.length,
34
+ italic: true,
35
+ font: "serif"
36
+ }];
37
+ }
38
+ function markHasStyle(mark) {
39
+ return mark.weight !== void 0 || mark.italic === true || mark.font !== void 0;
40
+ }
41
+ /** Drop marks that fall outside the text or carry no style. */
42
+ function clampMarks(text, marks) {
43
+ if (!marks || marks.length === 0) return [];
44
+ return marks.map((mark) => ({
45
+ ...mark,
46
+ start: Math.max(0, Math.trunc(mark.start)),
47
+ end: Math.min(text.length, Math.trunc(mark.end))
48
+ })).filter((mark) => mark.end > mark.start && markHasStyle(mark)).sort((a, b) => a.start - b.start || a.end - b.end);
49
+ }
50
+ /**
51
+ * Shift marks across a plain-text edit.
52
+ * A mark that still names a unique substring is kept when the edit overlaps it.
53
+ */
54
+ function reconcileMarks(previous, next, marks) {
55
+ const source = clampMarks(previous, marks);
56
+ if (source.length === 0) return [];
57
+ if (previous === next) return source;
58
+ let prefix = 0;
59
+ const limit = Math.min(previous.length, next.length);
60
+ while (prefix < limit && previous[prefix] === next[prefix]) prefix += 1;
61
+ let suffix = 0;
62
+ while (suffix < previous.length - prefix && suffix < next.length - prefix && previous[previous.length - 1 - suffix] === next[next.length - 1 - suffix]) suffix += 1;
63
+ const delta = next.length - previous.length;
64
+ const changeEnd = previous.length - suffix;
65
+ const clamped = clampMarks(next, source.flatMap((mark) => {
66
+ if (mark.end <= prefix) return [mark];
67
+ if (mark.start >= changeEnd) return [{
68
+ ...mark,
69
+ start: mark.start + delta,
70
+ end: mark.end + delta
71
+ }];
72
+ return [];
73
+ }));
74
+ if (clamped.length > 0 || source.length !== 1) return clamped;
75
+ const only = source[0];
76
+ if (!only) return clamped;
77
+ const slice = previous.slice(only.start, only.end);
78
+ if (slice.length === 0) return clamped;
79
+ const at = next.indexOf(slice);
80
+ if (at < 0 || next.indexOf(slice, at + 1) !== -1) return clamped;
81
+ return [{
82
+ ...only,
83
+ start: at,
84
+ end: at + slice.length
85
+ }];
86
+ }
87
+ /** Apply one style to [start, end), keeping styles on either side of the range. */
88
+ function applyTextMark(text, marks, start, end, patch) {
89
+ const from = Math.max(0, Math.trunc(start));
90
+ const to = Math.min(text.length, Math.trunc(end));
91
+ const current = clampMarks(text, marks);
92
+ if (to <= from) return current;
93
+ const pieces = [];
94
+ let covering;
95
+ for (const mark of current) {
96
+ if (mark.end <= from || mark.start >= to) {
97
+ pieces.push(mark);
98
+ continue;
99
+ }
100
+ covering ??= mark;
101
+ if (mark.start < from) pieces.push({
102
+ ...mark,
103
+ end: from
104
+ });
105
+ if (mark.end > to) pieces.push({
106
+ ...mark,
107
+ start: to
108
+ });
109
+ }
110
+ const next = {
111
+ start: from,
112
+ end: to,
113
+ weight: "weight" in patch ? patch.weight : covering?.weight,
114
+ italic: "italic" in patch ? patch.italic : covering?.italic,
115
+ font: "font" in patch ? patch.font : covering?.font
116
+ };
117
+ if (next.italic !== true) delete next.italic;
118
+ if (next.weight === void 0) delete next.weight;
119
+ if (next.font === void 0) delete next.font;
120
+ if (markHasStyle(next)) pieces.push(next);
121
+ return clampMarks(text, pieces);
122
+ }
123
+ function splitMarkedText(text, marks) {
124
+ const sorted = clampMarks(text, marks);
125
+ const runs = [];
126
+ let cursor = 0;
127
+ for (const mark of sorted) {
128
+ if (mark.start < cursor) continue;
129
+ if (mark.start > cursor) runs.push({ text: text.slice(cursor, mark.start) });
130
+ runs.push({
131
+ text: text.slice(mark.start, mark.end),
132
+ weight: mark.weight,
133
+ italic: mark.italic,
134
+ font: mark.font
135
+ });
136
+ cursor = mark.end;
137
+ }
138
+ if (cursor < text.length) runs.push({ text: text.slice(cursor) });
139
+ return runs.filter((run) => run.text.length > 0);
140
+ }
141
+ /** Classes from the typography tokens: font-sans/serif/mono and the weight scale. */
142
+ function markClass(run) {
143
+ const classes = [];
144
+ if (run.font === "sans") classes.push("font-sans");
145
+ else if (run.font === "mono") classes.push("font-mono");
146
+ else if (run.font === "serif" || run.italic) classes.push("font-serif");
147
+ if (run.italic && (run.font === void 0 || run.font === "serif")) classes.push("bm-em");
148
+ else if (run.italic) classes.push("italic");
149
+ if (run.weight === "regular") classes.push("font-normal");
150
+ else if (run.weight === "medium") classes.push("font-medium");
151
+ else if (run.weight === "semibold") classes.push("font-semibold");
152
+ else if (run.weight === "bold") classes.push("font-bold");
153
+ return classes.join(" ");
154
+ }
155
+ function escapeHtml(value) {
156
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;");
157
+ }
158
+ function renderMarkedHtml(text, marks) {
159
+ return splitMarkedText(text, marks).map((run) => {
160
+ const cls = markClass(run);
161
+ return cls ? `<span class="${cls}">${escapeHtml(run.text)}</span>` : escapeHtml(run.text);
162
+ }).join("");
163
+ }
164
+ function marksOverlap(marks) {
165
+ const sorted = [...marks].sort((a, b) => a.start - b.start || a.end - b.end);
166
+ for (let index = 1; index < sorted.length; index += 1) {
167
+ const previous = sorted[index - 1];
168
+ const mark = sorted[index];
169
+ if (previous && mark && mark.start < previous.end) return true;
170
+ }
171
+ return false;
172
+ }
173
+ //#endregion
174
+ export { isFontMark as a, markHasStyle as c, reconcileMarks as d, renderMarkedHtml as f, fontMarks as i, marksFromEmphasis as l, weightMarks as m, clampMarks as n, isWeightMark as o, splitMarkedText as p, escapeHtml as r, markClass as s, applyTextMark as t, marksOverlap as u };
package/dist/marks.js CHANGED
@@ -1,174 +1 @@
1
- //#region src/marks.ts
2
- /**
3
- * Inline marks for headings and the site wordmark.
4
- * A heading stays a plain string. Marks name ranges inside it.
5
- * No HTML and no arbitrary CSS: each mark is a weight, italic, and/or a font token.
6
- */
7
- const fontMarks = [
8
- "sans",
9
- "serif",
10
- "mono"
11
- ];
12
- const weightMarks = [
13
- "regular",
14
- "medium",
15
- "semibold",
16
- "bold"
17
- ];
18
- const fonts = new Set(fontMarks);
19
- const weights = new Set(weightMarks);
20
- function isFontMark(value) {
21
- return typeof value === "string" && fonts.has(value);
22
- }
23
- function isWeightMark(value) {
24
- return typeof value === "string" && weights.has(value);
25
- }
26
- /** The legacy `em` / `nameEm` accent: Instrument Serif italic on that substring. */
27
- function marksFromEmphasis(text, em) {
28
- if (!em) return void 0;
29
- const start = text.indexOf(em);
30
- if (start < 0) return void 0;
31
- return [{
32
- start,
33
- end: start + em.length,
34
- italic: true,
35
- font: "serif"
36
- }];
37
- }
38
- function markHasStyle(mark) {
39
- return mark.weight !== void 0 || mark.italic === true || mark.font !== void 0;
40
- }
41
- /** Drop marks that fall outside the text or carry no style. */
42
- function clampMarks(text, marks) {
43
- if (!marks || marks.length === 0) return [];
44
- return marks.map((mark) => ({
45
- ...mark,
46
- start: Math.max(0, Math.trunc(mark.start)),
47
- end: Math.min(text.length, Math.trunc(mark.end))
48
- })).filter((mark) => mark.end > mark.start && markHasStyle(mark)).sort((a, b) => a.start - b.start || a.end - b.end);
49
- }
50
- /**
51
- * Shift marks across a plain-text edit.
52
- * A mark that still names a unique substring is kept when the edit overlaps it.
53
- */
54
- function reconcileMarks(previous, next, marks) {
55
- const source = clampMarks(previous, marks);
56
- if (source.length === 0) return [];
57
- if (previous === next) return source;
58
- let prefix = 0;
59
- const limit = Math.min(previous.length, next.length);
60
- while (prefix < limit && previous[prefix] === next[prefix]) prefix += 1;
61
- let suffix = 0;
62
- while (suffix < previous.length - prefix && suffix < next.length - prefix && previous[previous.length - 1 - suffix] === next[next.length - 1 - suffix]) suffix += 1;
63
- const delta = next.length - previous.length;
64
- const changeEnd = previous.length - suffix;
65
- const clamped = clampMarks(next, source.flatMap((mark) => {
66
- if (mark.end <= prefix) return [mark];
67
- if (mark.start >= changeEnd) return [{
68
- ...mark,
69
- start: mark.start + delta,
70
- end: mark.end + delta
71
- }];
72
- return [];
73
- }));
74
- if (clamped.length > 0 || source.length !== 1) return clamped;
75
- const only = source[0];
76
- if (!only) return clamped;
77
- const slice = previous.slice(only.start, only.end);
78
- if (slice.length === 0) return clamped;
79
- const at = next.indexOf(slice);
80
- if (at < 0 || next.indexOf(slice, at + 1) !== -1) return clamped;
81
- return [{
82
- ...only,
83
- start: at,
84
- end: at + slice.length
85
- }];
86
- }
87
- /** Apply one style to [start, end), keeping styles on either side of the range. */
88
- function applyTextMark(text, marks, start, end, patch) {
89
- const from = Math.max(0, Math.trunc(start));
90
- const to = Math.min(text.length, Math.trunc(end));
91
- const current = clampMarks(text, marks);
92
- if (to <= from) return current;
93
- const pieces = [];
94
- let covering;
95
- for (const mark of current) {
96
- if (mark.end <= from || mark.start >= to) {
97
- pieces.push(mark);
98
- continue;
99
- }
100
- covering ??= mark;
101
- if (mark.start < from) pieces.push({
102
- ...mark,
103
- end: from
104
- });
105
- if (mark.end > to) pieces.push({
106
- ...mark,
107
- start: to
108
- });
109
- }
110
- const next = {
111
- start: from,
112
- end: to,
113
- weight: "weight" in patch ? patch.weight : covering?.weight,
114
- italic: "italic" in patch ? patch.italic : covering?.italic,
115
- font: "font" in patch ? patch.font : covering?.font
116
- };
117
- if (next.italic !== true) delete next.italic;
118
- if (next.weight === void 0) delete next.weight;
119
- if (next.font === void 0) delete next.font;
120
- if (markHasStyle(next)) pieces.push(next);
121
- return clampMarks(text, pieces);
122
- }
123
- function splitMarkedText(text, marks) {
124
- const sorted = clampMarks(text, marks);
125
- const runs = [];
126
- let cursor = 0;
127
- for (const mark of sorted) {
128
- if (mark.start < cursor) continue;
129
- if (mark.start > cursor) runs.push({ text: text.slice(cursor, mark.start) });
130
- runs.push({
131
- text: text.slice(mark.start, mark.end),
132
- weight: mark.weight,
133
- italic: mark.italic,
134
- font: mark.font
135
- });
136
- cursor = mark.end;
137
- }
138
- if (cursor < text.length) runs.push({ text: text.slice(cursor) });
139
- return runs.filter((run) => run.text.length > 0);
140
- }
141
- /** Classes from the typography tokens: font-sans/serif/mono and the weight scale. */
142
- function markClass(run) {
143
- const classes = [];
144
- if (run.font === "sans") classes.push("font-sans");
145
- else if (run.font === "mono") classes.push("font-mono");
146
- else if (run.font === "serif" || run.italic) classes.push("font-serif");
147
- if (run.italic && (run.font === void 0 || run.font === "serif")) classes.push("bm-em");
148
- else if (run.italic) classes.push("italic");
149
- if (run.weight === "regular") classes.push("font-normal");
150
- else if (run.weight === "medium") classes.push("font-medium");
151
- else if (run.weight === "semibold") classes.push("font-semibold");
152
- else if (run.weight === "bold") classes.push("font-bold");
153
- return classes.join(" ");
154
- }
155
- function escapeHtml(value) {
156
- return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;");
157
- }
158
- function renderMarkedHtml(text, marks) {
159
- return splitMarkedText(text, marks).map((run) => {
160
- const cls = markClass(run);
161
- return cls ? `<span class="${cls}">${escapeHtml(run.text)}</span>` : escapeHtml(run.text);
162
- }).join("");
163
- }
164
- function marksOverlap(marks) {
165
- const sorted = [...marks].sort((a, b) => a.start - b.start || a.end - b.end);
166
- for (let index = 1; index < sorted.length; index += 1) {
167
- const previous = sorted[index - 1];
168
- const mark = sorted[index];
169
- if (previous && mark && mark.start < previous.end) return true;
170
- }
171
- return false;
172
- }
173
- //#endregion
174
- export { applyTextMark, clampMarks, escapeHtml, fontMarks, isFontMark, isWeightMark, markClass, markHasStyle, marksFromEmphasis, marksOverlap, reconcileMarks, renderMarkedHtml, splitMarkedText, weightMarks };
1
+ export { t as applyTextMark, n as clampMarks, r as escapeHtml, i as fontMarks, a as isFontMark, o as isWeightMark, s as markClass, c as markHasStyle, l as marksFromEmphasis, u as marksOverlap, d as reconcileMarks, f as renderMarkedHtml, p as splitMarkedText, m as weightMarks } from "./marks-DPBilumg.js";
@@ -1,4 +1,4 @@
1
- import { A as SectionRegistry, J as SiteDefinition, M as ThemeDefinition, Yt as ContentMigrator, k as ContentModel } from "./page-BfI9cD8g.js";
1
+ import { A as SectionRegistry, J as SiteDefinition, M as ThemeDefinition, Yt as ContentMigrator, k as ContentModel } from "./page-CA4iyFDS.js";
2
2
  //#region src/images.d.ts
3
3
  type ImageKind = 'png' | 'jpeg' | 'webp' | 'gif' | 'avif';
4
4
  interface SavedImage {
@@ -117,6 +117,12 @@ interface BearminionOptions extends ContentModel {
117
117
  * Default `/src/lib/render-preview.ts`. Preview never writes to disk.
118
118
  */
119
119
  previewModule?: string;
120
+ /**
121
+ * The folder that holds the section directories and the files `bearminion sync` generates from them, relative to the
122
+ * project root. When set, `astro build`, `astro check` and `astro sync` stop if those files are stale, and
123
+ * `astro dev` warns. Default: not checked.
124
+ */
125
+ sectionsDir?: string;
120
126
  /**
121
127
  * The dev route for the forms in your site. A file `src/forms/contact.ts` that default-exports `defineForm(...)`
122
128
  * answers at `/api/contact` during `astro dev`, as a dry run unless `BEARMINION_FORMS_LIVE=on`. `dir` is the folder
@@ -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?: "regular" | "medium" | "semibold" | "bold" | undefined;
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?: "regular" | "medium" | "semibold" | "bold" | undefined;
1113
+ weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
1114
1114
  italic?: boolean | undefined;
1115
1115
  font?: "sans" | "serif" | "mono" | undefined;
1116
1116
  }[] | undefined;
@@ -1,4 +1,4 @@
1
- import { fontMarks, markHasStyle, marksFromEmphasis, marksOverlap, weightMarks } from "./marks.js";
1
+ import { c as markHasStyle, i as fontMarks, l as marksFromEmphasis, m as weightMarks, u as marksOverlap } from "./marks-DPBilumg.js";
2
2
  import { z } from "zod";
3
3
  //#region src/section-options.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { r as fieldKey } from "./theme-DFjHjgFO.js";
1
+ import { r as fieldKey } from "./theme-Dv7_7B56.js";
2
2
  //#region src/errors.ts
3
3
  function formatContentIssues(issues) {
4
4
  return issues.map((issue) => {
@@ -1,4 +1,4 @@
1
- import { o as slugSchema } from "./page-NOFVEqn1.js";
1
+ import { o as slugSchema } from "./page-X-WnOu7-.js";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  //#region src/security.ts