@caelo-cms/shared 0.10.23 → 0.10.24

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 (59) hide show
  1. package/dist/ai-tools.d.ts +0 -60
  2. package/dist/ai-tools.d.ts.map +1 -1
  3. package/dist/ai-tools.js +1 -59
  4. package/dist/ai-tools.js.map +1 -1
  5. package/dist/base-css.d.ts +11 -0
  6. package/dist/base-css.d.ts.map +1 -1
  7. package/dist/base-css.js +13 -1
  8. package/dist/base-css.js.map +1 -1
  9. package/dist/design-draft-shell.d.ts +21 -0
  10. package/dist/design-draft-shell.d.ts.map +1 -0
  11. package/dist/design-draft-shell.js +81 -0
  12. package/dist/design-draft-shell.js.map +1 -0
  13. package/dist/genesis.d.ts +43 -3
  14. package/dist/genesis.d.ts.map +1 -1
  15. package/dist/genesis.js +72 -5
  16. package/dist/genesis.js.map +1 -1
  17. package/dist/i18n.d.ts +0 -50
  18. package/dist/i18n.d.ts.map +1 -1
  19. package/dist/i18n.js +8 -149
  20. package/dist/i18n.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/preview-compose.d.ts +9 -15
  26. package/dist/preview-compose.d.ts.map +1 -1
  27. package/dist/preview-compose.js +3 -43
  28. package/dist/preview-compose.js.map +1 -1
  29. package/dist/seo.d.ts +8 -21
  30. package/dist/seo.d.ts.map +1 -1
  31. package/dist/seo.js +4 -22
  32. package/dist/seo.js.map +1 -1
  33. package/dist/structured-sets.d.ts +0 -36
  34. package/dist/structured-sets.d.ts.map +1 -1
  35. package/dist/structured-sets.js +1 -52
  36. package/dist/structured-sets.js.map +1 -1
  37. package/dist/version.d.ts +2 -2
  38. package/dist/version.js +1 -1
  39. package/package.json +2 -2
  40. package/src/ai-tools.ts +1 -75
  41. package/src/base-css.ts +13 -1
  42. package/src/design-draft-shell.test.ts +85 -0
  43. package/src/design-draft-shell.ts +109 -0
  44. package/src/genesis.ts +76 -5
  45. package/src/i18n.test.ts +1 -217
  46. package/src/i18n.ts +8 -186
  47. package/src/index.ts +1 -1
  48. package/src/preview-compose.test.ts +35 -0
  49. package/src/preview-compose.ts +3 -56
  50. package/src/seo.test.ts +0 -40
  51. package/src/seo.ts +8 -36
  52. package/src/structured-sets.ts +1 -67
  53. package/src/version.ts +1 -1
  54. package/dist/translation.d.ts +0 -127
  55. package/dist/translation.d.ts.map +0 -1
  56. package/dist/translation.js +0 -208
  57. package/dist/translation.js.map +0 -1
  58. package/src/translation.test.ts +0 -160
  59. package/src/translation.ts +0 -295
package/dist/genesis.js CHANGED
@@ -1,11 +1,16 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
2
  /**
3
- * issue #163 — Site Genesis shared shapes.
3
+ * issue #163 — Site Genesis shared shapes; issue #375 generalises the
4
+ * same draft loop to growth-time.
4
5
  *
5
6
  * Design-time is divergent: the AI drafts complete freeform HTML pages
6
7
  * (one per design direction) and the operator picks one; the CMS
7
- * structure is derived FROM that choice (#164's compiler). These are
8
- * the boundary schemas for the brief + the draft rows.
8
+ * structure is derived FROM that choice (#164's compiler). Growth-time
9
+ * reuses the identical draft → present → select → materialise loop at
10
+ * smaller scope: `page` and `module` drafts are FRAGMENTS bound to the
11
+ * site's `var(--…)` theme tokens, composed into the real theme shell
12
+ * only at view time (never an AI approximation of the theme — #375).
13
+ * These are the boundary schemas for the brief + the draft rows.
9
14
  */
10
15
  import { z } from "zod";
11
16
  /**
@@ -31,14 +36,45 @@ export const GENESIS_DRAFT_MAX_HTML_BYTES = 300_000;
31
36
  export const genesisDraftStatus = z.enum(["candidate", "selected", "discarded"]);
32
37
  /** issue #199 — where a draft came from. */
33
38
  export const genesisDraftSourceKind = z.enum(["genesis", "byod_image", "byod_html"]);
34
- export const genesisAddDraftInput = z
39
+ /**
40
+ * issue #375 — what a draft covers. `site` is the Genesis case (a whole
41
+ * new design); `page` / `module` are growth-time variants of something
42
+ * that already exists.
43
+ */
44
+ export const designDraftScope = z.enum(["site", "page", "module"]);
45
+ /**
46
+ * issue #375 — how a draft's HTML is stored. `site` drafts are complete
47
+ * standalone documents (Genesis, unchanged); `page`/`module` drafts are
48
+ * fragments that only become a renderable document when composed with
49
+ * the site's real theme shell at view time — so a stored variant never
50
+ * freezes a stale copy of the theme.
51
+ */
52
+ export const designDraftFormat = z.enum(["document", "fragment"]);
53
+ /** The stored format is fully determined by the scope (see the paired
54
+ * DB CHECK constraint): `site` → standalone document, else fragment. */
55
+ export function draftFormatForScope(scope) {
56
+ return scope === "site" ? "document" : "fragment";
57
+ }
58
+ const addDraftBase = z
35
59
  .object({
36
60
  /** Human-readable design direction ("bold editorial"). */
37
61
  direction: z.string().min(3).max(120),
38
62
  /** Why this direction fits the brief — shown beside the preview. */
39
63
  rationale: z.string().max(1000).default(""),
40
- /** Complete self-contained single-file HTML. */
64
+ /** Site scope: complete self-contained single-file HTML. Page/module
65
+ * scope: an HTML fragment bound to the site's `var(--…)` tokens. */
41
66
  html: z.string().min(200).max(GENESIS_DRAFT_MAX_HTML_BYTES),
67
+ /** issue #375 — what this draft covers; `site` is the Genesis case. */
68
+ scope: designDraftScope.default("site"),
69
+ /** issue #375 — page scope: the page this variant redesigns. Module
70
+ * scope: optional page context for "this module as used on …". */
71
+ targetPageId: z.string().uuid().optional(),
72
+ /** issue #375 — module scope: the module this variant restyles. */
73
+ targetModuleId: z.string().uuid().optional(),
74
+ /** issue #375 — groups one request's variants into one comparison.
75
+ * Omit on the first save (the op mints and returns it); pass it on
76
+ * every sibling save of the same round. */
77
+ variantSetId: z.string().uuid().optional(),
42
78
  /** issue #199 — 'byod_image' (AI reproduction of an operator
43
79
  * mockup) / 'byod_html' (operator HTML, sanitised at the op). */
44
80
  sourceKind: genesisDraftSourceKind.default("genesis"),
@@ -47,6 +83,37 @@ export const genesisAddDraftInput = z
47
83
  referenceAssetId: z.string().uuid().optional(),
48
84
  })
49
85
  .strict();
86
+ /** Scope/target pairing rules shared by the op and the AI tool. */
87
+ export const genesisAddDraftInput = addDraftBase.superRefine((v, ctx) => {
88
+ if (v.scope === "site") {
89
+ if (v.targetPageId !== undefined || v.targetModuleId !== undefined) {
90
+ ctx.addIssue({
91
+ code: z.ZodIssueCode.custom,
92
+ message: "site-scope drafts take no target — drop targetPageId/targetModuleId",
93
+ });
94
+ }
95
+ }
96
+ else if (v.sourceKind !== "genesis") {
97
+ ctx.addIssue({
98
+ code: z.ZodIssueCode.custom,
99
+ message: "byod drafts are site-scope only (issue #199); growth-time variants use sourceKind 'genesis'",
100
+ });
101
+ }
102
+ else if (v.scope === "page") {
103
+ if (v.targetPageId === undefined || v.targetModuleId !== undefined) {
104
+ ctx.addIssue({
105
+ code: z.ZodIssueCode.custom,
106
+ message: "page-scope drafts need targetPageId (and no targetModuleId)",
107
+ });
108
+ }
109
+ }
110
+ else if (v.targetModuleId === undefined) {
111
+ ctx.addIssue({
112
+ code: z.ZodIssueCode.custom,
113
+ message: "module-scope drafts need targetModuleId (targetPageId is optional page context)",
114
+ });
115
+ }
116
+ });
50
117
  /**
51
118
  * issue #199 — strip <script> blocks from operator-provided draft
52
119
  * HTML. Defense in depth: drafts render inside sandbox="" iframes
@@ -1 +1 @@
1
- {"version":3,"file":"genesis.js","sourceRoot":"","sources":["../src/genesis.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC/C,iEAAiE;IACjE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC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
package/dist/i18n.d.ts CHANGED
@@ -14,13 +14,6 @@ export declare function trimSlashes(s: string): string;
14
14
  * characters.
15
15
  */
16
16
  export declare function trimTrailingSlashes(s: string): string;
17
- export interface LocaleConfig {
18
- code: string;
19
- displayName: string;
20
- urlStrategy: "none" | "subdirectory" | "subdomain" | "domain";
21
- urlHost: string | null;
22
- isDefault: boolean;
23
- }
24
17
  /**
25
18
  * The "magic slug" sentinel test: a page whose slug is empty, `home`,
26
19
  * or `index` is the locale root by convention even without an explicit
@@ -40,53 +33,10 @@ export declare function isHomeSlug(slug: string): boolean;
40
33
  * (null/undefined when no page is designated).
41
34
  */
42
35
  export declare function pageIsLocaleHome(pageId: string, slug: string, localeHomePageId: string | null | undefined): boolean;
43
- /**
44
- * Build a public-facing URL for a (locale, slug) tuple. Pure function —
45
- * no DB access — so the static generator can call it for every page
46
- * without round-trips.
47
- *
48
- * @param locale The target locale's full config row.
49
- * @param slug Path component (e.g. "about", "blog/post-1"). No leading slash.
50
- * @param siteBaseUrl Default base URL when the strategy is `none` or
51
- * `subdirectory` (e.g. "https://example.com").
52
- * @param pageUrlStyle Page emission style (see below).
53
- * @param isHomePage Explicit homepage designation (0184 —
54
- * `locales.home_page_id`). When true this page IS the
55
- * locale root and resolves to `<base>/` regardless of
56
- * its own slug. The explicit flag WINS over the slug
57
- * sentinel below; the sentinel stays as a back-compat
58
- * fallback for callers that can't cheaply surface the
59
- * designation.
60
- * @returns Absolute URL, including scheme + host.
61
- */
62
- export declare function resolveLocaleUrl(locale: LocaleConfig, slug: string, siteBaseUrl: string, pageUrlStyle?: "directory" | "no-extension", isHomePage?: boolean): string;
63
- /**
64
- * Emit `<link rel="alternate" hreflang="…">` tags for every locale
65
- * that has a published variant of this page. The default locale also
66
- * gets an `x-default` entry per Google's i18n guidance.
67
- *
68
- * Returned as a single string suitable for splicing into <head>.
69
- */
70
- export declare function buildHreflangLinks(perLocaleUrls: ReadonlyArray<{
71
- localeCode: string;
72
- url: string;
73
- isDefault: boolean;
74
- }>): string;
75
36
  /**
76
37
  * Canonical-JSON serializer + sha256 → hex. Stable across runs because
77
38
  * keys are sorted. The output is used for `pages.content_hash` so that
78
39
  * a Mode-2 translation can detect whether its source has changed.
79
40
  */
80
41
  export declare function computeContentHash(value: unknown): Promise<string>;
81
- export interface LocaleLintWarning {
82
- code: string;
83
- message: string;
84
- }
85
- /**
86
- * Cross-row config sanity checks. Run at:
87
- * - propose-time (warnings stored on the proposal preview)
88
- * - render-time (no fail-loudly per CLAUDE.md §2 since the renderer
89
- * can still emit; surfaced in admin UI as banners)
90
- */
91
- export declare function lintLocaleConfig(locales: ReadonlyArray<LocaleConfig>, advancedUrlRouting: boolean): LocaleLintWarning[];
92
42
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AA6BA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC9D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAET;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,g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AC,MAAM,CAAC,CAWxE"}
package/dist/i18n.js CHANGED
@@ -1,27 +1,14 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
2
  /**
3
- * P9 — i18n primitives shared between the static generator, the
4
- * preview op, and the admin UI:
3
+ * Slug/URL primitives shared between the static generator, the preview
4
+ * op, and the admin UI. Epic #380 Phase A (#383): locale URL shaping
5
+ * (resolveLocaleUrl, buildHreflangLinks) is deleted — URL shape beyond
6
+ * base + slug becomes a plugin contribution on the URL composition
7
+ * point (#390). What survives until the page-identity cut (#384):
5
8
  *
6
- * computeContentHash(page, modules) — sha256 of canonical-JSON
7
- * content. Drives `pages.content_hash` + the translation_status
8
- * recompute path.
9
- *
10
- * resolveLocaleUrl(locale, slug, siteBaseUrl, pageUrlStyle?, isHomePage?) —
11
- * builds the public URL for a (locale, slug) tuple given the
12
- * locale's url_strategy + url_host. `isHomePage` forces the locale
13
- * root (0184 explicit designation). Used by:
14
- * - hreflang emitter
15
- * - sitemap.xml emitter (when extended for i18n)
16
- * - language-selector module
17
- *
18
- * buildHreflangLinks(currentLocale, perLocaleUrls, defaultLocaleCode) —
19
- * emits the `<link rel="alternate" hreflang=...>` markup.
20
- *
21
- * lintLocaleConfig(locales, advancedUrlRouting) — surfaces config
22
- * warnings (mixed strategies, missing url_host for subdomain/
23
- * domain, default locale using `none` alongside subdirectory
24
- * siblings, advanced strategy chosen while toggle is off).
9
+ * isHomeSlug / pageIsLocaleHome — the home-decision predicate.
10
+ * computeContentHash — drives `pages.content_hash` (removed in #384).
11
+ * trimSlashes / trimTrailingSlashes — linear-scan slug hygiene.
25
12
  */
26
13
  const TEXT_ENCODER = new TextEncoder();
27
14
  /**
@@ -77,96 +64,6 @@ export function isHomeSlug(slug) {
77
64
  export function pageIsLocaleHome(pageId, slug, localeHomePageId) {
78
65
  return (localeHomePageId != null && pageId === localeHomePageId) || isHomeSlug(slug);
79
66
  }
80
- /**
81
- * Build a public-facing URL for a (locale, slug) tuple. Pure function —
82
- * no DB access — so the static generator can call it for every page
83
- * without round-trips.
84
- *
85
- * @param locale The target locale's full config row.
86
- * @param slug Path component (e.g. "about", "blog/post-1"). No leading slash.
87
- * @param siteBaseUrl Default base URL when the strategy is `none` or
88
- * `subdirectory` (e.g. "https://example.com").
89
- * @param pageUrlStyle Page emission style (see below).
90
- * @param isHomePage Explicit homepage designation (0184 —
91
- * `locales.home_page_id`). When true this page IS the
92
- * locale root and resolves to `<base>/` regardless of
93
- * its own slug. The explicit flag WINS over the slug
94
- * sentinel below; the sentinel stays as a back-compat
95
- * fallback for callers that can't cheaply surface the
96
- * designation.
97
- * @returns Absolute URL, including scheme + host.
98
- */
99
- export function resolveLocaleUrl(locale, slug, siteBaseUrl,
100
- // v0.2.85 — page emission style. 'directory' (default) builds
101
- // URLs ending in `/<slug>/`; 'no-extension' builds URLs ending
102
- // in `/<slug>` (no trailing slash) to match what the bucket
103
- // actually serves when pages are emitted as bare slugs. Home
104
- // page is always `<base>/` regardless of style.
105
- pageUrlStyle = "directory", isHomePage) {
106
- const stripped = trimSlashes(slug);
107
- // 0184 — the explicit designation wins; the slug sentinel
108
- // (""/`home`/`index`) survives as a back-compat fallback so a page the
109
- // AI never ran set_home_page on still resolves to the root. Shared
110
- // `isHomeSlug` keeps this test identical across every home-decision site.
111
- const isHome = isHomePage === true || isHomeSlug(stripped);
112
- // tail: the path component appended after `<base>/` or `<base>/<locale>/`.
113
- // 'directory' style: trailing slash for non-home so the URL points at
114
- // the directory the bucket serves index.html from.
115
- // 'no-extension' style: no trailing slash, no extension — the URL
116
- // points at the bare-slug object the bucket serves directly.
117
- const tail = isHome ? "" : pageUrlStyle === "no-extension" ? stripped : `${stripped}/`;
118
- const base = trimTrailingSlashes(siteBaseUrl);
119
- switch (locale.urlStrategy) {
120
- case "none":
121
- return tail ? `${base}/${tail}` : `${base}/`;
122
- case "subdirectory":
123
- // Default locale with strategy `subdirectory` still gets the prefix
124
- // unless the migration set strategy=none for it. The decision is
125
- // explicit per locale row, not implicit on isDefault.
126
- return tail ? `${base}/${locale.code}/${tail}` : `${base}/${locale.code}/`;
127
- case "subdomain": {
128
- if (!locale.urlHost) {
129
- throw new Error(`locale '${locale.code}' uses url_strategy='subdomain' without url_host — config invalid`);
130
- }
131
- const protocol = base.startsWith("http://") ? "http://" : "https://";
132
- return tail ? `${protocol}${locale.urlHost}/${tail}` : `${protocol}${locale.urlHost}/`;
133
- }
134
- case "domain": {
135
- if (!locale.urlHost) {
136
- throw new Error(`locale '${locale.code}' uses url_strategy='domain' without url_host — config invalid`);
137
- }
138
- const protocol = base.startsWith("http://") ? "http://" : "https://";
139
- return tail ? `${protocol}${locale.urlHost}/${tail}` : `${protocol}${locale.urlHost}/`;
140
- }
141
- }
142
- }
143
- /**
144
- * Emit `<link rel="alternate" hreflang="…">` tags for every locale
145
- * that has a published variant of this page. The default locale also
146
- * gets an `x-default` entry per Google's i18n guidance.
147
- *
148
- * Returned as a single string suitable for splicing into <head>.
149
- */
150
- export function buildHreflangLinks(perLocaleUrls) {
151
- if (perLocaleUrls.length === 0)
152
- return "";
153
- const lines = [];
154
- for (const v of perLocaleUrls) {
155
- lines.push(`<link rel="alternate" hreflang="${escapeAttr(v.localeCode)}" href="${escapeAttr(v.url)}" />`);
156
- }
157
- const def = perLocaleUrls.find((v) => v.isDefault);
158
- if (def) {
159
- lines.push(`<link rel="alternate" hreflang="x-default" href="${escapeAttr(def.url)}" />`);
160
- }
161
- return lines.join("\n");
162
- }
163
- function escapeAttr(s) {
164
- return s
165
- .replace(/&/g, "&amp;")
166
- .replace(/"/g, "&quot;")
167
- .replace(/</g, "&lt;")
168
- .replace(/>/g, "&gt;");
169
- }
170
67
  /**
171
68
  * Canonical-JSON serializer + sha256 → hex. Stable across runs because
172
69
  * keys are sorted. The output is used for `pages.content_hash` so that
@@ -185,42 +82,4 @@ export async function computeContentHash(value) {
185
82
  const digest = await crypto.subtle.digest("SHA-256", TEXT_ENCODER.encode(canonical));
186
83
  return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
187
84
  }
188
- /**
189
- * Cross-row config sanity checks. Run at:
190
- * - propose-time (warnings stored on the proposal preview)
191
- * - render-time (no fail-loudly per CLAUDE.md §2 since the renderer
192
- * can still emit; surfaced in admin UI as banners)
193
- */
194
- export function lintLocaleConfig(locales, advancedUrlRouting) {
195
- const warnings = [];
196
- const usingAdvanced = locales.some((l) => l.urlStrategy === "subdomain" || l.urlStrategy === "domain");
197
- if (usingAdvanced && !advancedUrlRouting) {
198
- warnings.push({
199
- code: "advanced-routing-disabled",
200
- message: "one or more locales use 'subdomain' or 'domain' strategy but Advanced URL Routing is disabled — enable it under /security/locales",
201
- });
202
- }
203
- for (const l of locales) {
204
- if ((l.urlStrategy === "subdomain" || l.urlStrategy === "domain") && !l.urlHost) {
205
- warnings.push({
206
- code: "missing-url-host",
207
- message: `locale '${l.code}' uses url_strategy='${l.urlStrategy}' without url_host`,
208
- });
209
- }
210
- }
211
- // Default-locale 'none' alongside subdirectory siblings is a common
212
- // mixed config; surface it so users know the default's URL stays bare
213
- // while siblings get prefixed.
214
- const def = locales.find((l) => l.isDefault);
215
- const subdirSiblings = locales.filter((l) => !l.isDefault && l.urlStrategy === "subdirectory");
216
- if (def && def.urlStrategy === "none" && subdirSiblings.length > 0) {
217
- warnings.push({
218
- code: "mixed-default-none-subdir",
219
- message: `default locale '${def.code}' uses 'none' while ${subdirSiblings
220
- .map((l) => l.code)
221
- .join(", ")} use 'subdirectory' — this is valid but unusual; verify hreflang renders correctly`,
222
- });
223
- }
224
- return warnings;
225
- }
226
85
  //# sourceMappingURL=i18n.js.map
package/dist/i18n.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,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E,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC"}
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from "./content.js";
8
8
  export * from "./context.js";
9
9
  export * from "./css-gradient-scan.js";
10
10
  export * from "./css-var-scan.js";
11
+ export * from "./design-draft-shell.js";
11
12
  export * from "./design-manifest.js";
12
13
  export * from "./fonts.js";
13
14
  export * from "./genesis.js";
@@ -42,6 +43,5 @@ export * from "./theme-ramp.js";
42
43
  export * from "./theme-render.js";
43
44
  export * from "./themes.js";
44
45
  export * from "./themes-errors.js";
45
- export * from "./translation.js";
46
46
  export { CAELO_VERSION, CALEO_VERSION, type CaeloVersion, parseVersion } from "./version.js";
47
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,cAAc,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,UAAU,EACV,aAAa,EACb,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,aA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AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,UAAU,EACV,aAAa,EACb,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "./content.js";
9
9
  export * from "./context.js";
10
10
  export * from "./css-gradient-scan.js";
11
11
  export * from "./css-var-scan.js";
12
+ export * from "./design-draft-shell.js";
12
13
  export * from "./design-manifest.js";
13
14
  export * from "./fonts.js";
14
15
  export * from "./genesis.js";
@@ -43,6 +44,5 @@ export * from "./theme-ramp.js";
43
44
  export * from "./theme-render.js";
44
45
  export * from "./themes.js";
45
46
  export * from "./themes-errors.js";
46
- export * from "./translation.js";
47
47
  export { CAELO_VERSION, CALEO_VERSION, parseVersion } from "./version.js";
48
48
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAKL,UAAU,EACV,aAAa,EACb,MAAM,GAGP,MAAM,aAAa,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAA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,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAqB,YAAY,EAAE,MAAM,cAAc,CAAC"}
@@ -52,20 +52,6 @@ export interface ComposeStructuredSets {
52
52
  /** Map keyed by `<kind>/<slug>` (e.g. `nav-menu/header-main`). */
53
53
  readonly byKindSlug: Readonly<Record<string, readonly unknown[]>>;
54
54
  }
55
- /**
56
- * P9 — language-selector context. The caller (preview op + static
57
- * generator) resolves the current page's per-locale URLs once and
58
- * threads them in. The composer renders the selector when a module
59
- * slug starts with `language-selector-`.
60
- */
61
- export interface ComposeLanguageSelector {
62
- readonly availableLocales: ReadonlyArray<{
63
- code: string;
64
- displayName: string;
65
- href: string;
66
- isCurrent: boolean;
67
- }>;
68
- }
69
55
  /**
70
56
  * v0.11.0 — Theme context resolved by the preview op + static generator
71
57
  * (#45 Phase 3). Carries the active theme's DTCG tokens jsonb plus the
@@ -105,7 +91,6 @@ export interface ComposeInput {
105
91
  readonly templateCss: string;
106
92
  readonly blocks: readonly ComposeBlock[];
107
93
  readonly structuredSets?: ComposeStructuredSets;
108
- readonly languageSelector?: ComposeLanguageSelector;
109
94
  /**
110
95
  * v0.11.0 — active theme threaded through from the preview op + static
111
96
  * generator. Undefined when no theme row exists OR when the caller
@@ -121,6 +106,15 @@ export interface ComposeOutput {
121
106
  readonly replacedSlots: readonly string[];
122
107
  readonly missingSlots: readonly string[];
123
108
  }
109
+ /**
110
+ * issue #150 — head fragment for resolved web fonts: preload links (the
111
+ * `crossorigin` attribute is REQUIRED for font preloads even same-origin,
112
+ * per the fetch spec's font-destination CORS rule) + the @font-face
113
+ * block. Empty css with no preloads → null (system-stack-only theme).
114
+ * Exported for the design-draft theme shell (#375) so draft previews
115
+ * load the identical fonts as the page preview.
116
+ */
117
+ export declare function fontsHeadFragment(fonts: ComposeFonts | undefined): string | null;
124
118
  export declare function composePagePreview(input: ComposeInput): ComposeOutput;
125
119
  export declare function tagModuleId(html: string, moduleId: string): string;
126
120
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"preview-compose.d.ts","sourceRoot":"","sources":["../src/preview-compose.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAWpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,eAAe,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,EAA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otReplacements, extractInnerOfTopLevelContentSlot, listSlotNames, } from "./preview-scanner.js";
29
29
  import { stripCdataGuards } from "./strip-cdata.js";
30
- import { renderLanguageSelector } from "./structured-sets.js";
31
30
  import { renderTemplate } from "./template-engine.js";
32
31
  import { renderThemeCss as renderThemeCssFromTokens } from "./theme-render.js";
33
32
  const HEAD_CLOSE_RE = /<\/head\s*>/i;
@@ -44,8 +43,10 @@ function injectBefore(source, marker, fragment) {
44
43
  * `crossorigin` attribute is REQUIRED for font preloads even same-origin,
45
44
  * per the fetch spec's font-destination CORS rule) + the @font-face
46
45
  * block. Empty css with no preloads → null (system-stack-only theme).
46
+ * Exported for the design-draft theme shell (#375) so draft previews
47
+ * load the identical fonts as the page preview.
47
48
  */
48
- function fontsHeadFragment(fonts) {
49
+ export function fontsHeadFragment(fonts) {
49
50
  if (fonts === undefined)
50
51
  return null;
51
52
  const links = fonts.preloads
@@ -77,15 +78,11 @@ export function composePagePreview(input) {
77
78
  // module HTML.
78
79
  const renderedModuleHtml = block.modules.map((m) => {
79
80
  const navMenuItems = lookupNavMenuItems(m.slug, input.structuredSets);
80
- const langSelector = lookupLanguageSelector(m.slug, input);
81
81
  let baseHtml;
82
82
  if (navMenuItems !== null) {
83
83
  navRendered = true;
84
84
  baseHtml = renderNavMenuHtml(navMenuItems);
85
85
  }
86
- else if (langSelector !== null) {
87
- baseHtml = langSelector;
88
- }
89
86
  else {
90
87
  baseHtml = applyFieldSubstitution(m.html, m.fields, m.contentValues, input.theme);
91
88
  }
@@ -169,35 +166,6 @@ function lookupNavMenuItems(moduleSlug, sets) {
169
166
  const items = sets.byKindSlug[`nav-menu/${setSlug}`];
170
167
  return items ?? null;
171
168
  }
172
- /**
173
- * P9 — return rendered language-selector HTML when a module's slug
174
- * starts with `language-selector-`. The set's items act as overrides
175
- * (relabel a locale, hide one); the available-locale list comes from
176
- * the caller via `input.languageSelector`. Returns null when the
177
- * module is not a language selector.
178
- *
179
- * Convention: a module slug `language-selector-header` resolves to
180
- * structuredSets[`language-selector/header`] for overrides, and the
181
- * rendered HTML lists every locale that has a published variant of
182
- * the current page.
183
- */
184
- function lookupLanguageSelector(moduleSlug, input) {
185
- const prefix = "language-selector-";
186
- if (!moduleSlug.startsWith(prefix))
187
- return null;
188
- if (!input.languageSelector || input.languageSelector.availableLocales.length === 0) {
189
- return null;
190
- }
191
- const setSlug = moduleSlug.slice(prefix.length);
192
- const overridesUnknown = input.structuredSets?.byKindSlug[`language-selector/${setSlug}`];
193
- const overrides = Array.isArray(overridesUnknown)
194
- ? overridesUnknown
195
- : undefined;
196
- return renderLanguageSelector({
197
- availableLocales: input.languageSelector.availableLocales,
198
- overrides,
199
- });
200
- }
201
169
  function escapeAttr(s) {
202
170
  return s
203
171
  .replace(/&/g, "&amp;")
@@ -403,15 +371,11 @@ export function composePageWithLayout(input) {
403
371
  for (const block of input.blocks) {
404
372
  const renderedModuleHtml = block.modules.map((m) => {
405
373
  const navMenuItems = lookupNavMenuItems(m.slug, input.structuredSets);
406
- const langSelector = lookupLanguageSelector(m.slug, input);
407
374
  let baseHtml;
408
375
  if (navMenuItems !== null) {
409
376
  navRendered = true;
410
377
  baseHtml = renderNavMenuHtml(navMenuItems);
411
378
  }
412
- else if (langSelector !== null) {
413
- baseHtml = langSelector;
414
- }
415
379
  else {
416
380
  baseHtml = applyFieldSubstitution(m.html, m.fields, m.contentValues, input.theme);
417
381
  }
@@ -443,15 +407,11 @@ export function composePageWithLayout(input) {
443
407
  continue; // reserved for the page body
444
408
  const renderedModuleHtml = block.modules.map((m) => {
445
409
  const navMenuItems = lookupNavMenuItems(m.slug, input.structuredSets);
446
- const langSelector = lookupLanguageSelector(m.slug, input);
447
410
  let baseHtml;
448
411
  if (navMenuItems !== null) {
449
412
  navRendered = true;
450
413
  baseHtml = renderNavMenuHtml(navMenuItems);
451
414
  }
452
- else if (langSelector !== null) {
453
- baseHtml = langSelector;
454
- }
455
415
  else {
456
416
  baseHtml = applyFieldSubstitution(m.html, m.fields, m.contentValues, input.theme);
457
417
  }