@marktiderman/genesis-sites 0.4.1 → 0.5.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 (65) hide show
  1. package/README.md +155 -18
  2. package/SKILL.md +46 -0
  3. package/dist/assets/fonts/LICENSES.txt +1469 -0
  4. package/dist/assets/{form-island.dc9aedd556.js → form-island.c521219f1b.js} +1 -1
  5. package/dist/assets/{islands.88abb49942.js → islands.f275dc88cb.js} +1 -1
  6. package/dist/assets/sites-forms.490d10e01b.css +10 -0
  7. package/dist/assets/sites-forms.css +1 -1
  8. package/dist/assets/sites.1a40b828a5.css +2 -0
  9. package/dist/assets/sites.css +1 -1
  10. package/dist/assets.generated-P7NPIZHO.js +3 -0
  11. package/dist/{assets.generated-7FRY6LHS.js.map → assets.generated-P7NPIZHO.js.map} +1 -1
  12. package/dist/{chunk-P5MR34QQ.js → chunk-3XCKSU4Z.js} +143 -85
  13. package/dist/chunk-3XCKSU4Z.js.map +1 -0
  14. package/dist/{chunk-PN2VXOA5.js → chunk-BJ6NXVZI.js} +9 -8
  15. package/dist/chunk-BJ6NXVZI.js.map +1 -0
  16. package/dist/{chunk-3VKTBE7S.js → chunk-MU2Z2C4F.js} +2 -2
  17. package/dist/{chunk-3VKTBE7S.js.map → chunk-MU2Z2C4F.js.map} +1 -1
  18. package/dist/chunk-OFJISW3T.js +3 -0
  19. package/dist/chunk-OFJISW3T.js.map +1 -0
  20. package/dist/{chunk-FBQF2L7O.js → chunk-VLY75P7W.js} +190 -40
  21. package/dist/chunk-VLY75P7W.js.map +1 -0
  22. package/dist/{chunk-PA7IZF4X.js → chunk-VMJ67LCW.js} +97 -28
  23. package/dist/chunk-VMJ67LCW.js.map +1 -0
  24. package/dist/{chunk-KPOX7D4S.js → chunk-XOM334IK.js} +5 -5
  25. package/dist/chunk-XOM334IK.js.map +1 -0
  26. package/dist/{chunk-ZGWGQGT2.js → chunk-YAASBQTJ.js} +35 -22
  27. package/dist/chunk-YAASBQTJ.js.map +1 -0
  28. package/dist/editor.d.ts +5 -3
  29. package/dist/editor.js +14 -10
  30. package/dist/editor.js.map +1 -1
  31. package/dist/fonts.generated-HTXRHNVY.js +4 -0
  32. package/dist/handler-ESFMOYYF.js +10 -0
  33. package/dist/{handler-P7RRXR6K.js.map → handler-ESFMOYYF.js.map} +1 -1
  34. package/dist/import.d.ts +26 -62
  35. package/dist/import.js +11 -258
  36. package/dist/import.js.map +1 -1
  37. package/dist/index.d.ts +10 -95
  38. package/dist/index.js +5 -4
  39. package/dist/{registry-HBn1X60x.d.ts → registry-CeSBSfU8.d.ts} +187 -13
  40. package/dist/sections.d.ts +124 -9
  41. package/dist/sections.js +3 -3
  42. package/dist/{store-BXiZeZzH.d.ts → store-CUsfzNmK.d.ts} +42 -119
  43. package/dist/supabase.d.ts +5 -3
  44. package/dist/supabase.js +15 -6
  45. package/dist/supabase.js.map +1 -1
  46. package/dist/templates-DALVa71A.d.ts +92 -0
  47. package/dist/templates.d.ts +78 -0
  48. package/dist/templates.js +146 -0
  49. package/dist/templates.js.map +1 -0
  50. package/dist/theme-B3Vh_b-P.d.ts +136 -0
  51. package/dist/web.d.ts +72 -13
  52. package/dist/web.js +7 -6
  53. package/migrations/tests/0001_genesis_sites.test.sql +4 -4
  54. package/migrations/tests/0002_genesis_sites_posts.test.sql +2 -2
  55. package/package.json +47 -12
  56. package/dist/assets/sites-forms.e506c7dda2.css +0 -10
  57. package/dist/assets/sites.716b4ac1a5.css +0 -2
  58. package/dist/assets.generated-7FRY6LHS.js +0 -3
  59. package/dist/chunk-FBQF2L7O.js.map +0 -1
  60. package/dist/chunk-KPOX7D4S.js.map +0 -1
  61. package/dist/chunk-P5MR34QQ.js.map +0 -1
  62. package/dist/chunk-PA7IZF4X.js.map +0 -1
  63. package/dist/chunk-PN2VXOA5.js.map +0 -1
  64. package/dist/chunk-ZGWGQGT2.js.map +0 -1
  65. package/dist/handler-P7RRXR6K.js +0 -9
@@ -65,5 +65,5 @@ function normalizeRequestPath(pathname) {
65
65
  }
66
66
 
67
67
  export { DEFAULT_RESERVED_PATHS, MAX_PAGE_PATH_LENGTH, MAX_URL_LENGTH, PAGE_PATH, isExternalHref, isReservedPath, isSafeHref, isSafeImageSrc, normalizeRequestPath, pagePathProblems, validatePagePath };
68
- //# sourceMappingURL=chunk-3VKTBE7S.js.map
69
- //# sourceMappingURL=chunk-3VKTBE7S.js.map
68
+ //# sourceMappingURL=chunk-MU2Z2C4F.js.map
69
+ //# sourceMappingURL=chunk-MU2Z2C4F.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/urls.ts"],"names":[],"mappings":";AAYO,IAAM,cAAA,GAAiB;AAE9B,IAAM,YAAA,uBAAmB,GAAA,CAAI,CAAC,UAAU,OAAA,EAAS,SAAA,EAAW,MAAM,CAAC,CAAA;AAInE,IAAM,YAAA,GAAe,2BAAA;AAGd,SAAS,WAAW,KAAA,EAAiC;AAC1D,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,CAAM,WAAW,CAAA,IAAK,KAAA,CAAM,MAAA,GAAS,cAAA,EAAgB,OAAO,KAAA;AAC7F,EAAA,IAAI,YAAA,CAAa,IAAA,CAAK,KAAK,CAAA,EAAG,OAAO,KAAA;AACrC,EAAA,IAAI,KAAA,CAAM,UAAA,CAAW,GAAG,CAAA,EAAG,OAAO,IAAA;AAClC,EAAA,IAAI,KAAA,CAAM,WAAW,GAAG,CAAA,SAAU,CAAC,KAAA,CAAM,WAAW,IAAI,CAAA;AACxD,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,IAAI,KAAK,CAAA;AAAA,EACrB,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,CAAC,YAAA,CAAa,GAAA,CAAI,GAAA,CAAI,QAAQ,GAAG,OAAO,KAAA;AAC5C,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,OAAA,IAAW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AG,EAAE,CAAA;AAClE,EAAA,OAAO,KAAK,WAAA,EAAY;AAC1B","file":"chunk-3VKTBE7S.js","sourcesContent":["/**\n * URL and path rules shared by the schemas, the renderer and the database.\n *\n * Every link a site renders comes from stored props, so every link is\n * untrusted. A link is safe when it is a site path (`/about`), a fragment\n * (`#pricing`), or an absolute `https:`, `http:`, `mailto:` or `tel:` URL.\n * Everything else (`javascript:`, `data:`, `vbscript:`, protocol-relative\n * `//host`, a backslash trick, a control character) is refused, both when a\n * document is parsed and again when it is rendered.\n */\n\n/** The longest URL a site stores. */\nexport const MAX_URL_LENGTH = 2048;\n\nconst SAFE_SCHEMES = new Set([\"https:\", \"http:\", \"mailto:\", \"tel:\"]);\n// C0 controls, DEL, whitespace other than a plain space, and the backslash\n// (browsers read `\\` as `/` in special URLs, so `/\\evil.test` is `//evil.test`).\n// eslint-disable-next-line no-control-regex\nconst UNSAFE_CHARS = /[\\u0000-\\u001f\\u007f\\\\\\s]/;\n\n/** Is this a link a site may render: a site path, a fragment, or an http(s), mailto or tel URL? */\nexport function isSafeHref(value: unknown): value is string {\n if (typeof value !== \"string\" || value.length === 0 || value.length > MAX_URL_LENGTH) return false;\n if (UNSAFE_CHARS.test(value)) return false;\n if (value.startsWith(\"#\")) return true;\n if (value.startsWith(\"/\")) return !value.startsWith(\"//\");\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return false;\n }\n if (!SAFE_SCHEMES.has(url.protocol)) return false;\n if (url.protocol === \"http:\" || url.protocol === \"https:\") return url.hostname.length > 0 && !url.username && !url.password;\n return true;\n}\n\n/** Is this a URL an image may load from: a site path or an `https:` URL? */\nexport function isSafeImageSrc(value: unknown): value is string {\n if (!isSafeHref(value)) return false;\n if (value.startsWith(\"/\")) return true;\n return value.startsWith(\"https://\");\n}\n\n/** Is this an external (absolute) link, opened with `rel=\"noopener noreferrer\"`? */\nexport function isExternalHref(href: string): boolean {\n return /^https?:\\/\\//i.test(href);\n}\n\n/**\n * A page's path: `/`, or lowercase segments of letters, digits and hyphens\n * (`/about`, `/classes/strength`). No trailing slash, no dots, at most 8\n * segments and 200 characters. The database checks the same pattern.\n */\nexport const PAGE_PATH = /^\\/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:\\/[a-z0-9]+(?:-[a-z0-9]+)*){0,7})?$/;\nexport const MAX_PAGE_PATH_LENGTH = 200;\n\n/**\n * Paths a site never owns, because it shares its hostname with the host app:\n * the app's API and server functions, its auth callbacks, and this package's\n * own assets. A host passes its own list (or a predicate) to\n * `handleSiteRequest` and `validatePagePath`; the database's default is the\n * same list (`genesis_sites.reserved_paths()`).\n */\nexport const DEFAULT_RESERVED_PATHS: readonly string[] = Object.freeze([\"/api\", \"/_server\", \"/auth\", \"/_gs\"]);\n\n/** A reserved-path rule: a list of path prefixes, or a predicate. */\nexport type ReservedPaths = readonly string[] | ((path: string) => boolean);\n\n/** Is `path` reserved: equal to a reserved prefix, or under it (`/api`, `/api/x`, not `/apiary`)? */\nexport function isReservedPath(path: string, reserved: ReservedPaths = DEFAULT_RESERVED_PATHS): boolean {\n if (typeof reserved === \"function\") return reserved(path);\n // Case-insensitive, like the database's check: /AUTH is the app's /auth on a case-insensitive router.\n const probe = path.toLowerCase();\n return reserved.some((prefix) => {\n const lower = prefix.toLowerCase();\n const p = lower.endsWith(\"/\") && lower.length > 1 ? lower.slice(0, -1) : lower;\n return probe === p || probe.startsWith(`${p}/`);\n });\n}\n\n/** Problems with a page path, empty when it is fine. */\nexport function pagePathProblems(path: unknown, reserved: ReservedPaths = DEFAULT_RESERVED_PATHS): string[] {\n if (typeof path !== \"string\") return [\"A page path is text.\"];\n const problems: string[] = [];\n if (path.length > MAX_PAGE_PATH_LENGTH) problems.push(`A page path has at most ${MAX_PAGE_PATH_LENGTH} characters.`);\n if (!PAGE_PATH.test(path)) {\n problems.push('A page path starts with \"/\" and uses lowercase letters, digits and single hyphens, with no trailing slash (for example \"/about\").');\n }\n if (isReservedPath(path, reserved)) problems.push(`\"${path}\" is reserved for the app this site shares its address with.`);\n return problems;\n}\n\n/** Throws when the path can't be a page's. */\nexport function validatePagePath(path: string, reserved: ReservedPaths = DEFAULT_RESERVED_PATHS): string {\n const problems = pagePathProblems(path, reserved);\n if (problems.length) throw new Error(problems.join(\" \"));\n return path;\n}\n\n/**\n * The page path a request path asks for: decoded, lowercase, without a\n * trailing slash. Returns null for a path that can't name a page (so the\n * caller falls through to the host app).\n */\nexport function normalizeRequestPath(pathname: string): string | null {\n let path: string;\n try {\n path = decodeURIComponent(pathname);\n } catch {\n return null;\n }\n if (UNSAFE_CHARS.test(path) || path.includes(\"//\")) return null;\n if (path.length > 1 && path.endsWith(\"/\")) path = path.slice(0, -1);\n return path.toLowerCase();\n}\n"]}
1
+ {"version":3,"sources":["../src/core/urls.ts"],"names":[],"mappings":";AAYO,IAAM,cAAA,GAAiB;AAE9B,IAAM,YAAA,uBAAmB,GAAA,CAAI,CAAC,UAAU,OAAA,EAAS,SAAA,EAAW,MAAM,CAAC,CAAA;AAInE,IAAM,YAAA,GAAe,2BAAA;AAGd,SAAS,WAAW,KAAA,EAAiC;AAC1D,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,CAAM,WAAW,CAAA,IAAK,KAAA,CAAM,MAAA,GAAS,cAAA,EAAgB,OAAO,KAAA;AAC7F,EAAA,IAAI,YAAA,CAAa,IAAA,CAAK,KAAK,CAAA,EAAG,OAAO,KAAA;AACrC,EAAA,IAAI,KAAA,CAAM,UAAA,CAAW,GAAG,CAAA,EAAG,OAAO,IAAA;AAClC,EAAA,IAAI,KAAA,CAAM,WAAW,GAAG,CAAA,SAAU,CAAC,KAAA,CAAM,WAAW,IAAI,CAAA;AACxD,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,IAAI,KAAK,CAAA;AAAA,EACrB,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,CAAC,YAAA,CAAa,GAAA,CAA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,IAAK,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,EAAG,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA;AAClE,EAAA,OAAO,KAAK,WAAA,EAAY;AAC1B","file":"chunk-MU2Z2C4F.js","sourcesContent":["/**\n * URL and path rules shared by the schemas, the renderer and the database.\n *\n * Every link a site renders comes from stored props, so every link is\n * untrusted. A link is safe when it is a site path (`/about`), a fragment\n * (`#pricing`), or an absolute `https:`, `http:`, `mailto:` or `tel:` URL.\n * Everything else (`javascript:`, `data:`, `vbscript:`, protocol-relative\n * `//host`, a backslash trick, a control character) is refused, both when a\n * document is parsed and again when it is rendered.\n */\n\n/** The longest URL a site stores. */\nexport const MAX_URL_LENGTH = 2048;\n\nconst SAFE_SCHEMES = new Set([\"https:\", \"http:\", \"mailto:\", \"tel:\"]);\n// C0 controls, DEL, whitespace other than a plain space, and the backslash\n// (browsers read `\\` as `/` in special URLs, so `/\\evil.test` is `//evil.test`).\n// eslint-disable-next-line no-control-regex\nconst UNSAFE_CHARS = /[\\u0000-\\u001f\\u007f\\\\\\s]/;\n\n/** Is this a link a site may render: a site path, a fragment, or an http(s), mailto or tel URL? */\nexport function isSafeHref(value: unknown): value is string {\n if (typeof value !== \"string\" || value.length === 0 || value.length > MAX_URL_LENGTH) return false;\n if (UNSAFE_CHARS.test(value)) return false;\n if (value.startsWith(\"#\")) return true;\n if (value.startsWith(\"/\")) return !value.startsWith(\"//\");\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return false;\n }\n if (!SAFE_SCHEMES.has(url.protocol)) return false;\n if (url.protocol === \"http:\" || url.protocol === \"https:\") return url.hostname.length > 0 && !url.username && !url.password;\n return true;\n}\n\n/** Is this a URL an image may load from: a site path or an `https:` URL? */\nexport function isSafeImageSrc(value: unknown): value is string {\n if (!isSafeHref(value)) return false;\n if (value.startsWith(\"/\")) return true;\n return value.startsWith(\"https://\");\n}\n\n/** Is this an external (absolute) link, opened with `rel=\"noopener noreferrer\"`? */\nexport function isExternalHref(href: string): boolean {\n return /^https?:\\/\\//i.test(href);\n}\n\n/**\n * A page's path: `/`, or lowercase segments of letters, digits and hyphens\n * (`/about`, `/services/repairs`). No trailing slash, no dots, at most 8\n * segments and 200 characters. The database checks the same pattern.\n */\nexport const PAGE_PATH = /^\\/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:\\/[a-z0-9]+(?:-[a-z0-9]+)*){0,7})?$/;\nexport const MAX_PAGE_PATH_LENGTH = 200;\n\n/**\n * Paths a site never owns, because it shares its hostname with the host app:\n * the app's API and server functions, its auth callbacks, and this package's\n * own assets. A host passes its own list (or a predicate) to\n * `handleSiteRequest` and `validatePagePath`; the database's default is the\n * same list (`genesis_sites.reserved_paths()`).\n */\nexport const DEFAULT_RESERVED_PATHS: readonly string[] = Object.freeze([\"/api\", \"/_server\", \"/auth\", \"/_gs\"]);\n\n/** A reserved-path rule: a list of path prefixes, or a predicate. */\nexport type ReservedPaths = readonly string[] | ((path: string) => boolean);\n\n/** Is `path` reserved: equal to a reserved prefix, or under it (`/api`, `/api/x`, not `/apiary`)? */\nexport function isReservedPath(path: string, reserved: ReservedPaths = DEFAULT_RESERVED_PATHS): boolean {\n if (typeof reserved === \"function\") return reserved(path);\n // Case-insensitive, like the database's check: /AUTH is the app's /auth on a case-insensitive router.\n const probe = path.toLowerCase();\n return reserved.some((prefix) => {\n const lower = prefix.toLowerCase();\n const p = lower.endsWith(\"/\") && lower.length > 1 ? lower.slice(0, -1) : lower;\n return probe === p || probe.startsWith(`${p}/`);\n });\n}\n\n/** Problems with a page path, empty when it is fine. */\nexport function pagePathProblems(path: unknown, reserved: ReservedPaths = DEFAULT_RESERVED_PATHS): string[] {\n if (typeof path !== \"string\") return [\"A page path is text.\"];\n const problems: string[] = [];\n if (path.length > MAX_PAGE_PATH_LENGTH) problems.push(`A page path has at most ${MAX_PAGE_PATH_LENGTH} characters.`);\n if (!PAGE_PATH.test(path)) {\n problems.push('A page path starts with \"/\" and uses lowercase letters, digits and single hyphens, with no trailing slash (for example \"/about\").');\n }\n if (isReservedPath(path, reserved)) problems.push(`\"${path}\" is reserved for the app this site shares its address with.`);\n return problems;\n}\n\n/** Throws when the path can't be a page's. */\nexport function validatePagePath(path: string, reserved: ReservedPaths = DEFAULT_RESERVED_PATHS): string {\n const problems = pagePathProblems(path, reserved);\n if (problems.length) throw new Error(problems.join(\" \"));\n return path;\n}\n\n/**\n * The page path a request path asks for: decoded, lowercase, without a\n * trailing slash. Returns null for a path that can't name a page (so the\n * caller falls through to the host app).\n */\nexport function normalizeRequestPath(pathname: string): string | null {\n let path: string;\n try {\n path = decodeURIComponent(pathname);\n } catch {\n return null;\n }\n if (UNSAFE_CHARS.test(path) || path.includes(\"//\")) return null;\n if (path.length > 1 && path.endsWith(\"/\")) path = path.slice(0, -1);\n return path.toLowerCase();\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { LATIN_UNICODE_RANGE, SELF_HOSTED_FONTS, fontFileKey } from '@marktiderman/genesis-design-system/fonts';
2
+ //# sourceMappingURL=chunk-OFJISW3T.js.map
3
+ //# sourceMappingURL=chunk-OFJISW3T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-OFJISW3T.js","sourcesContent":[]}
@@ -1,20 +1,8 @@
1
- import { getSection, PostSlug, PostDoc, ReleaseSnapshot, validatePostSlug, MAX_IMPORT_POSTS, MAX_LIVE_POSTS, postSummary, redirectsAfterMove, PageDoc, SiteDoc } from './chunk-ZGWGQGT2.js';
2
- import { pagePathProblems, isReservedPath, DEFAULT_RESERVED_PATHS, validatePagePath } from './chunk-3VKTBE7S.js';
3
- import { genesisBrand, themeFromBrand } from '@marktiderman/genesis-design-system';
1
+ import { getSection, PostSlug, PostDoc, ReleaseSnapshot, validatePostSlug, MAX_IMPORT_POSTS, MAX_LIVE_POSTS, postSummary, redirectsAfterMove, PageDoc, SiteDoc } from './chunk-YAASBQTJ.js';
2
+ import { pagePathProblems, isReservedPath, DEFAULT_RESERVED_PATHS, validatePagePath } from './chunk-MU2Z2C4F.js';
3
+ import { FONT_CHOICES, genesisBrand, themeFromBrand } from '@marktiderman/genesis-design-system';
4
+ export { FONT_CHOICES } from '@marktiderman/genesis-design-system';
4
5
 
5
- var FONT_CHOICES = Object.freeze({
6
- system: { label: "System", stack: 'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif' },
7
- inter: { label: "Inter", stack: "Inter, ui-sans-serif, system-ui, sans-serif", google: "Inter:wght@400;500;600;700" },
8
- "dm-sans": { label: "DM Sans", stack: '"DM Sans", ui-sans-serif, system-ui, sans-serif', google: "DM+Sans:wght@400;500;700" },
9
- "work-sans": { label: "Work Sans", stack: '"Work Sans", ui-sans-serif, system-ui, sans-serif', google: "Work+Sans:wght@400;500;700" },
10
- montserrat: { label: "Montserrat", stack: "Montserrat, ui-sans-serif, system-ui, sans-serif", google: "Montserrat:wght@400;600;700" },
11
- poppins: { label: "Poppins", stack: "Poppins, ui-sans-serif, system-ui, sans-serif", google: "Poppins:wght@400;600;700" },
12
- "space-grotesk": { label: "Space Grotesk", stack: '"Space Grotesk", ui-sans-serif, system-ui, sans-serif', google: "Space+Grotesk:wght@400;500;700" },
13
- "source-serif": { label: "Source Serif", stack: '"Source Serif 4", Georgia, serif', google: "Source+Serif+4:wght@400;600;700" },
14
- merriweather: { label: "Merriweather", stack: "Merriweather, Georgia, serif", google: "Merriweather:wght@400;700" },
15
- "playfair-display": { label: "Playfair Display", stack: '"Playfair Display", Georgia, serif', google: "Playfair+Display:wght@400;600;700" },
16
- lora: { label: "Lora", stack: "Lora, Georgia, serif", google: "Lora:wght@400;600;700" }
17
- });
18
6
  var RADIUS = { none: "0rem", sm: "0.25rem", md: "0.5rem", lg: "0.75rem", full: "1.25rem" };
19
7
  var HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
20
8
  function parseHex(hex) {
@@ -73,15 +61,19 @@ function toCanonicalBrand(brand) {
73
61
  parseHex(primary);
74
62
  const primaryDark = (brand.colors.primaryDark ?? mix(primary, 0.35)).toLowerCase();
75
63
  parseHex(primaryDark);
64
+ const secondary = brand.colors.secondary?.toLowerCase();
65
+ if (secondary) parseHex(secondary);
76
66
  const heading = FONT_CHOICES[brand.fonts?.heading ?? "inter"] ?? FONT_CHOICES.inter;
77
- const body = FONT_CHOICES[brand.fonts?.body ?? "inter"] ?? FONT_CHOICES.inter;
67
+ const chosenBody = FONT_CHOICES[brand.fonts?.body ?? "inter"];
68
+ const body = chosenBody && !chosenBody.headingOnly ? chosenBody : FONT_CHOICES.inter;
78
69
  return {
79
70
  ...genesisBrand,
80
71
  name: brand.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "site",
81
- accent: { DEFAULT: primary, light: primary, dark: primaryDark },
72
+ accent: { DEFAULT: primary, light: primary, dark: primaryDark, ...secondary ? { secondary } : {} },
82
73
  typography: {
83
74
  fontFamily: { body: body.stack.split(/,\s*/), display: heading.stack.split(/,\s*/) }
84
- }
75
+ },
76
+ ...brand.designSystem ? { designSystem: brand.designSystem } : {}
85
77
  };
86
78
  }
87
79
  function brandDisplayName(brand) {
@@ -148,10 +140,23 @@ function stableHash(value) {
148
140
  }
149
141
  return h1.toString(16).padStart(8, "0") + h2.toString(16).padStart(8, "0");
150
142
  }
151
- function siteTheme(brand, theme = {}) {
143
+ function withoutDesignSystem(brand) {
144
+ const { designSystem: _designSystem, ...rest } = brand;
145
+ return rest;
146
+ }
147
+ function enginePairs(pairs, mode, primary, background) {
148
+ return [
149
+ ...pairs.filter((p) => p.mode === mode).map(({ name, foreground, background: bg, minimum }) => ({ name, mode, foreground, background: bg, minimum })),
150
+ // The sections still draw the fill colour as a marker (a timetable chip's edge, the picked day): as in classic, it warns.
151
+ { name: "the primary colour as a border or marker on the page", mode, foreground: primary, background, minimum: 3, severity: "warning" }
152
+ ];
153
+ }
154
+ function siteTheme(brand, theme = {}, options = {}) {
152
155
  const canonical = toCanonicalBrand(brand);
153
156
  const overrides = theme.overrides ?? {};
154
- const base = themeFromBrand(canonical).variables;
157
+ const made = themeFromBrand(canonical, options.designSystem ? { designSystem: options.designSystem } : {});
158
+ const base = made.variables;
159
+ const design = made.designSystem;
155
160
  const fontStack = (family) => canonical.typography?.fontFamily?.[family]?.join(", ");
156
161
  const headingFont = overrides.headingFont ? FONT_CHOICES[overrides.headingFont] : void 0;
157
162
  const bodyFont = overrides.bodyFont ? FONT_CHOICES[overrides.bodyFont] : void 0;
@@ -161,22 +166,50 @@ function siteTheme(brand, theme = {}) {
161
166
  if (sans) fontVars["--font-sans"] = sans;
162
167
  if (display) fontVars["--font-display"] = display;
163
168
  if (overrides.radius) fontVars["--radius"] = RADIUS[overrides.radius];
164
- const light = modeColours(canonical, "light");
165
- const dark = modeColours(canonical, "dark");
166
169
  const usedFonts = /* @__PURE__ */ new Map();
170
+ const choiceFor = (stack) => Object.values(FONT_CHOICES).find((f) => f.stack === stack);
167
171
  for (const stack of [sans, display]) {
168
- const info = Object.values(FONT_CHOICES).find((f) => f.stack === stack);
169
- if (info) usedFonts.set(info.label, info);
172
+ const info = choiceFor(stack);
173
+ if (info) usedFonts.set(info.id, info);
170
174
  }
175
+ const headingChoice = choiceFor(display);
171
176
  const colorScheme = theme.colorScheme ?? "light";
172
- const pairs = colorScheme === "light" ? pairsFor(light, "light") : colorScheme === "dark" ? pairsFor(dark, "dark") : [...pairsFor(light, "light"), ...pairsFor(dark, "dark")];
177
+ const palette = design?.palette;
178
+ let light;
179
+ let dark;
180
+ let pairsLight;
181
+ let pairsDark;
182
+ if (palette && design) {
183
+ light = { ...base.light, ...fontVars };
184
+ dark = { ...base.dark, ...fontVars };
185
+ pairsLight = enginePairs(design.pairs, "light", palette.light.accentFill, palette.light.ground);
186
+ pairsDark = enginePairs(design.pairs, "dark", palette.dark.accentFill, palette.dark.ground);
187
+ } else {
188
+ const lightColours = modeColours(canonical, "light");
189
+ const darkColours = modeColours(canonical, "dark");
190
+ light = { ...base.light, ...roleVars(lightColours), ...fontVars };
191
+ dark = { ...base.dark, ...roleVars(darkColours), ...fontVars };
192
+ pairsLight = pairsFor(lightColours, "light");
193
+ pairsDark = pairsFor(darkColours, "dark");
194
+ }
195
+ const pairs = colorScheme === "light" ? pairsLight : colorScheme === "dark" ? pairsDark : [...pairsLight, ...pairsDark];
196
+ const designSystem = design?.id ?? "classic@1";
173
197
  return {
174
- light: { ...base.light, ...roleVars(light), ...fontVars },
175
- dark: { ...base.dark, ...roleVars(dark), ...fontVars },
198
+ light,
199
+ dark,
176
200
  colorScheme,
177
201
  fonts: [...usedFonts.values()],
202
+ ...headingChoice ? { headingFont: headingChoice } : {},
178
203
  pairs,
179
- brandHash: stableHash({ brand: canonical, overrides, colorScheme })
204
+ // A design system other than classic (and the brand's choices for it) is in the hash, so a
205
+ // swap is checked again at the next publish; naming classic, or nothing, hashes as before.
206
+ brandHash: stableHash({
207
+ brand: withoutDesignSystem(canonical),
208
+ overrides,
209
+ colorScheme,
210
+ ...design && designSystem !== "classic@1" ? { designSystem, choices: design.choices } : {}
211
+ }),
212
+ designSystem
180
213
  };
181
214
  }
182
215
  function cssValue(value) {
@@ -289,7 +322,51 @@ function images(value, path = []) {
289
322
  if (Array.isArray(value)) return value.flatMap((v, i) => images(v, [...path, String(i)]));
290
323
  const record = value;
291
324
  const found = typeof record.src === "string" && !("mime" in record) && ("alt" in record || "decorative" in record || /\.(png|jpe?g|webp|avif|gif|svg)(\?|$)/i.test(record.src)) ? [{ path: path.join("."), image: record }] : [];
292
- return [...found, ...Object.entries(record).flatMap(([k, v]) => k === "src" ? [] : images(v, [...path, k]))];
325
+ return [...found, ...Object.entries(record).flatMap(([k, v]) => k === "src" || found.length && k === "phone" ? [] : images(v, [...path, k]))];
326
+ }
327
+ function sources(value, path = []) {
328
+ if (!value || typeof value !== "object") return [];
329
+ if (Array.isArray(value)) return value.flatMap((v, i) => sources(v, [...path, String(i)]));
330
+ const record = value;
331
+ const found = typeof record.src === "string" ? [{ path: path.join("."), src: record.src, file: "mime" in record }] : [];
332
+ return [...found, ...Object.entries(record).flatMap(([k, v]) => k === "src" ? [] : sources(v, [...path, k]))];
333
+ }
334
+ function isOwnUrl(src, origins = []) {
335
+ if (src.startsWith("/") && !src.startsWith("//") && !src.startsWith("/\\")) return true;
336
+ let origin;
337
+ try {
338
+ origin = new URL(src).origin;
339
+ } catch {
340
+ return false;
341
+ }
342
+ return origins.some((o) => {
343
+ try {
344
+ return new URL(o).origin === origin;
345
+ } catch {
346
+ return false;
347
+ }
348
+ });
349
+ }
350
+ var hostOf = (src) => {
351
+ try {
352
+ return new URL(src).host;
353
+ } catch {
354
+ return "another site";
355
+ }
356
+ };
357
+ function hostIssues(value, at, where, options, base = {}) {
358
+ const issues = [];
359
+ for (const { path, src, file } of sources(value)) {
360
+ if (isOwnUrl(src, options.assetOrigins)) continue;
361
+ const what = file ? "a file" : "an image";
362
+ issues.push({
363
+ ...base,
364
+ severity: options.images === "own" ? "error" : "warning",
365
+ code: "asset-host",
366
+ message: `${at}: ${what} ${where}(${path || "image"}) loads from ${hostOf(src)}, not from the site. Upload it to the site again, or copy the old site's files over with importAssets.`
367
+ });
368
+ }
369
+ return issues;
293
370
  }
294
371
  function richTextHeadings(value) {
295
372
  if (!value || typeof value !== "object") return [];
@@ -401,6 +478,32 @@ function checkRelease(snapshot, options = {}) {
401
478
  }
402
479
  }
403
480
  if (options.theme) issues.push(...checkContrast(options.theme));
481
+ issues.push(...checkAssetHosts(snapshot, { ...options, lookup }));
482
+ return issues;
483
+ }
484
+ function checkAssetHosts(snapshot, options = {}) {
485
+ const lookup = options.lookup ?? getSection;
486
+ const hosts = { ...snapshot.site.images ? { images: snapshot.site.images } : {}, ...options.assetOrigins ? { assetOrigins: options.assetOrigins } : {} };
487
+ const issues = [];
488
+ const nodes = (list, at, page) => {
489
+ for (const node of list) {
490
+ if (node.hidden) continue;
491
+ const def = lookup(node.type);
492
+ const migrated = migrateNode(node, lookup).node;
493
+ if (!def || !migrated) continue;
494
+ issues.push(...hostIssues(migrated.props, at, `in the ${def.label} section `, hosts, { ...page ? { pageId: page.id, path: page.path } : {}, sectionId: node.id }));
495
+ }
496
+ };
497
+ nodes(snapshot.site.header, "the site header");
498
+ nodes(snapshot.site.footer, "the site footer");
499
+ for (const page of snapshot.pages) nodes(page.doc.content, page.path, page);
500
+ if (options.logo && !isOwnUrl(options.logo, hosts.assetOrigins)) {
501
+ issues.push({
502
+ severity: hosts.images === "own" ? "error" : "warning",
503
+ code: "asset-host",
504
+ message: `The brand's logo loads from ${hostOf(options.logo)}, not from the site. Upload it to the site again, or copy it over with importAssets.`
505
+ });
506
+ }
404
507
  return issues;
405
508
  }
406
509
  function checkBlog(snapshot, lookup = getSection) {
@@ -428,7 +531,7 @@ function checkBlog(snapshot, lookup = getSection) {
428
531
  }
429
532
  return issues;
430
533
  }
431
- function checkPost(slug, doc) {
534
+ function checkPost(slug, doc, hosts = {}) {
432
535
  const issues = [];
433
536
  const at = `The post ${JSON.stringify(slug)}`;
434
537
  if (!PostSlug.safeParse(slug).success) issues.push({ severity: "error", code: "post-slug", message: `${at}: a slug is lowercase letters, digits and single hyphens.` });
@@ -449,24 +552,64 @@ function checkPost(slug, doc) {
449
552
  if (level === 1) issues.push({ severity: "error", code: "heading-h1", message: `${at}: the text can't hold a level 1 heading; the post's title is the page's.` });
450
553
  else if (level > previous + 1) issues.push({ severity: "error", code: "heading-order", message: `${at}: a level ${level} heading follows a level ${previous}; don't skip a level.` });
451
554
  }
555
+ issues.push(...hostIssues({ ...parsed.data, seo: void 0 }, at, "", hosts));
452
556
  if (!parsed.data.excerpt && !parsed.data.seo?.description) issues.push({ severity: "warning", code: "seo-description", message: `${at}: no excerpt for the list, search results and the feed.` });
453
557
  return issues;
454
558
  }
455
559
  function checkHtmlOutline(html) {
456
560
  const issues = [];
457
- const body = html.replace(/<script\b[\s\S]*?<\/script>/gi, "").replace(/<style\b[\s\S]*?<\/style>/gi, "");
458
- const levels = [...body.matchAll(/<h([1-6])\b/gi)].map((m) => Number(m[1]));
561
+ const { levels, images: images2 } = outlineTags(html);
459
562
  const h1 = levels.filter((l) => l === 1).length;
460
563
  if (h1 !== 1) issues.push({ severity: "error", code: "h1-count", message: `The page has ${h1} h1 elements; it needs exactly one.` });
461
564
  if (levels[0] !== void 0 && levels[0] !== 1) issues.push({ severity: "error", code: "heading-order", message: `The first heading is an h${levels[0]}, not the h1.` });
462
565
  for (let i = 1; i < levels.length; i++) {
463
566
  if (levels[i] > levels[i - 1] + 1) issues.push({ severity: "error", code: "heading-order", message: `An h${levels[i]} follows an h${levels[i - 1]}.` });
464
567
  }
465
- for (const m of body.matchAll(/<img\b[^>]*>/gi)) {
466
- if (!/\salt=/.test(m[0])) issues.push({ severity: "error", code: "image-alt", message: `An image has no alt attribute: ${m[0].slice(0, 120)}` });
568
+ for (const tag of images2) {
569
+ if (!/\salt=/i.test(tag)) issues.push({ severity: "error", code: "image-alt", message: `An image has no alt attribute: ${tag.slice(0, 120)}` });
467
570
  }
468
571
  return issues;
469
572
  }
573
+ var WORD_CHAR = /\w/;
574
+ var RAW_TEXT = ["script", "style"];
575
+ function tagAt(lower, at, name) {
576
+ if (!lower.startsWith(name, at)) return false;
577
+ const next = lower[at + name.length];
578
+ return next === void 0 || !WORD_CHAR.test(next);
579
+ }
580
+ function outlineTags(html) {
581
+ const lower = html.replace(/[A-Z]/g, (c) => c.toLowerCase());
582
+ const levels = [];
583
+ const images2 = [];
584
+ let unclosed = false;
585
+ let i = lower.indexOf("<");
586
+ while (i >= 0 && i < lower.length) {
587
+ const raw = RAW_TEXT.find((name) => tagAt(lower, i + 1, name));
588
+ if (raw) {
589
+ let close = lower.indexOf(`</${raw}`, i + 1 + raw.length);
590
+ while (close >= 0 && !tagAt(lower, close + 2, raw)) close = lower.indexOf(`</${raw}`, close + 2);
591
+ if (close < 0) break;
592
+ const end = lower.indexOf(">", close);
593
+ if (end < 0) break;
594
+ i = lower.indexOf("<", end + 1);
595
+ continue;
596
+ }
597
+ const h = lower[i + 1] === "h" ? lower[i + 2] : void 0;
598
+ if (h !== void 0 && h >= "1" && h <= "6" && tagAt(lower, i + 1, `h${h}`)) {
599
+ levels.push(Number(h));
600
+ } else if (!unclosed && tagAt(lower, i + 1, "img")) {
601
+ const end = lower.indexOf(">", i);
602
+ if (end < 0) unclosed = true;
603
+ if (end >= 0) {
604
+ images2.push(html.slice(i, end + 1));
605
+ i = lower.indexOf("<", end + 1);
606
+ continue;
607
+ }
608
+ }
609
+ i = lower.indexOf("<", i + 1);
610
+ }
611
+ return { levels, images: images2 };
612
+ }
470
613
 
471
614
  // src/core/store.ts
472
615
  var isConflict = (result) => "conflict" in result;
@@ -506,7 +649,13 @@ function prepareRelease(site, pages, options = {}) {
506
649
  pages: releasePages.map((p) => ({ ...p, doc: { ...p.doc, content: visible(p.doc.content) } }))
507
650
  });
508
651
  const theme = options.brand ? siteTheme(options.brand, snapshot.site.theme) : void 0;
509
- const issues = checkRelease(snapshot, { ...theme ? { theme } : {}, reserved: options.reserved ?? DEFAULT_RESERVED_PATHS });
652
+ const logo = options.brand && "logo" in options.brand ? options.brand.logo?.src : void 0;
653
+ const issues = checkRelease(snapshot, {
654
+ ...theme ? { theme } : {},
655
+ reserved: options.reserved ?? DEFAULT_RESERVED_PATHS,
656
+ ...options.assetOrigins ? { assetOrigins: options.assetOrigins } : {},
657
+ ...logo ? { logo } : {}
658
+ });
510
659
  if (!theme) issues.push({ severity: "error", code: "brand-missing", message: "Publish with the site's brand (`brand`), so its colours can be checked for contrast." });
511
660
  if (!isPublishable(issues)) throw new PublishBlockedError(issues);
512
661
  return { snapshot, issues, migratedPages, migratedSite: migratedSite.changed ? migratedSite.site : null, brandHash: theme?.brandHash ?? null };
@@ -820,7 +969,8 @@ function createMemorySiteStore(options = {}) {
820
969
  async publishPost(postId) {
821
970
  const p = editablePost(postId);
822
971
  if (sites.get(p.siteId)?.status === "archived") throw new Error("An archived site can't publish posts.");
823
- const issues = checkPost(p.slug, p.doc);
972
+ const images2 = sites.get(p.siteId)?.site.images;
973
+ const issues = checkPost(p.slug, p.doc, images2 ? { images: images2 } : {});
824
974
  if (!isPublishable(issues)) throw new PublishBlockedError(issues);
825
975
  const at = now().toISOString();
826
976
  p.published = { doc: clone(p.doc), at };
@@ -873,6 +1023,6 @@ function createMemorySiteStore(options = {}) {
873
1023
  return store;
874
1024
  }
875
1025
 
876
- export { ASSET_TYPES, FONT_CHOICES, PublishBlockedError, SiteConflictError, assetPath, brandDisplayName, checkBlog, checkContrast, checkHtmlOutline, checkPage, checkPost, checkRelease, checkSiteDoc, contrastRatio, createMemorySiteStore, formCacheTag, hexToHslTriplet, isConflict, isPublishable, isSiteBrand, luminance, migrateNode, migratePage, migrateSite, mix, parseHex, prepareImportPost, prepareRelease, siteCacheTag, siteTheme, stableHash, themeCss, toCanonicalBrand, withCacheInvalidation };
877
- //# sourceMappingURL=chunk-FBQF2L7O.js.map
878
- //# sourceMappingURL=chunk-FBQF2L7O.js.map
1026
+ export { ASSET_TYPES, PublishBlockedError, SiteConflictError, assetPath, brandDisplayName, checkAssetHosts, checkBlog, checkContrast, checkHtmlOutline, checkPage, checkPost, checkRelease, checkSiteDoc, contrastRatio, createMemorySiteStore, formCacheTag, hexToHslTriplet, isConflict, isOwnUrl, isPublishable, isSiteBrand, luminance, migrateNode, migratePage, migrateSite, mix, parseHex, prepareImportPost, prepareRelease, siteCacheTag, siteTheme, stableHash, themeCss, toCanonicalBrand, withCacheInvalidation };
1027
+ //# sourceMappingURL=chunk-VLY75P7W.js.map
1028
+ //# sourceMappingURL=chunk-VLY75P7W.js.map