inlaycms 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 (128) hide show
  1. package/README.md +18 -709
  2. package/assets/admin/admin.css +1 -1
  3. package/assets/admin/editor.js +63 -46
  4. package/assets/site/consent.js +1 -0
  5. package/dist/adapters/admin/context.d.ts +1 -1
  6. package/dist/adapters/admin/context.js +1 -0
  7. package/dist/adapters/admin/routes.d.ts +2 -0
  8. package/dist/adapters/admin/routes.js +2 -0
  9. package/dist/adapters/admin/screens/backups.js +2 -2
  10. package/dist/adapters/admin/screens/editor.js +2 -1
  11. package/dist/adapters/admin/screens/integrations.d.ts +4 -0
  12. package/dist/adapters/admin/screens/integrations.js +140 -0
  13. package/dist/adapters/admin/screens/lists.js +2 -1
  14. package/dist/adapters/admin/screens/releases.js +1 -1
  15. package/dist/adapters/admin/views/layout.js +3 -0
  16. package/dist/adapters/cli/bin.js +8 -3
  17. package/dist/adapters/mcp/tools/read.js +17 -2
  18. package/dist/adapters/mcp/tools/write.js +4 -0
  19. package/dist/adapters/site/cache.d.ts +8 -2
  20. package/dist/adapters/site/cache.js +13 -4
  21. package/dist/adapters/site/code-files.d.ts +44 -0
  22. package/dist/adapters/site/code-files.js +212 -0
  23. package/dist/adapters/site/consent.d.ts +9 -0
  24. package/dist/adapters/site/consent.js +26 -0
  25. package/dist/adapters/site/context.d.ts +5 -0
  26. package/dist/adapters/site/context.js +97 -20
  27. package/dist/adapters/site/csp.d.ts +11 -0
  28. package/dist/adapters/site/csp.js +36 -0
  29. package/dist/adapters/site/head.js +1 -14
  30. package/dist/adapters/site/headers.d.ts +5 -2
  31. package/dist/adapters/site/headers.js +13 -6
  32. package/dist/adapters/site/integrations.d.ts +48 -0
  33. package/dist/adapters/site/integrations.js +118 -0
  34. package/dist/adapters/site/media-routes.d.ts +2 -0
  35. package/dist/adapters/site/media-routes.js +2 -1
  36. package/dist/adapters/site/plugin.d.ts +2 -0
  37. package/dist/adapters/site/plugin.js +64 -34
  38. package/dist/adapters/site/render.d.ts +31 -14
  39. package/dist/adapters/site/render.js +26 -5
  40. package/dist/adapters/site/routes.d.ts +3 -0
  41. package/dist/adapters/site/routes.js +7 -3
  42. package/dist/adapters/site/scripts.d.ts +6 -0
  43. package/dist/adapters/site/scripts.js +27 -0
  44. package/dist/core/auth/roles.d.ts +1 -1
  45. package/dist/core/auth/roles.js +1 -0
  46. package/dist/core/boot.d.ts +2 -0
  47. package/dist/core/boot.js +3 -0
  48. package/dist/core/content/shipped-input.js +1 -2
  49. package/dist/core/content/validate.d.ts +7 -0
  50. package/dist/core/content/validate.js +24 -1
  51. package/dist/core/core.d.ts +29 -0
  52. package/dist/core/core.js +10 -2
  53. package/dist/core/db/migrate.js +2 -0
  54. package/dist/core/db/migrations/0008_integrations.d.ts +3 -0
  55. package/dist/core/db/migrations/0008_integrations.js +11 -0
  56. package/dist/core/db/schema.d.ts +11 -0
  57. package/dist/core/export/export.js +4 -0
  58. package/dist/core/export/format.d.ts +11 -0
  59. package/dist/core/export/format.js +4 -0
  60. package/dist/core/export/import.js +2 -1
  61. package/dist/core/export/replace.d.ts +6 -1
  62. package/dist/core/export/replace.js +4 -1
  63. package/dist/core/export/report.d.ts +6 -0
  64. package/dist/core/export/report.js +7 -0
  65. package/dist/core/fields/builtins.d.ts +4 -0
  66. package/dist/core/fields/builtins.js +11 -1
  67. package/dist/core/fields/widgets.js +5 -1
  68. package/dist/core/integrations/integrations.d.ts +32 -0
  69. package/dist/core/integrations/integrations.js +80 -0
  70. package/dist/core/integrations/warnings.d.ts +4 -0
  71. package/dist/core/integrations/warnings.js +29 -0
  72. package/dist/core/media/store.d.ts +2 -0
  73. package/dist/core/media/store.js +17 -1
  74. package/dist/core/media/variants.d.ts +14 -0
  75. package/dist/core/media/variants.js +54 -0
  76. package/dist/core/messages/en.d.ts +73 -0
  77. package/dist/core/messages/en.js +73 -0
  78. package/dist/core/registry/code-image.d.ts +16 -0
  79. package/dist/core/registry/code-image.js +13 -0
  80. package/dist/core/registry/define.d.ts +7 -0
  81. package/dist/core/registry/define.js +2 -0
  82. package/dist/core/registry/designed.d.ts +6 -0
  83. package/dist/core/registry/designed.js +8 -0
  84. package/dist/core/registry/integration.d.ts +48 -0
  85. package/dist/core/registry/integration.js +29 -0
  86. package/dist/core/registry/js.d.ts +9 -0
  87. package/dist/core/registry/js.js +39 -0
  88. package/dist/core/registry/registry.js +46 -0
  89. package/dist/core/registry/render.d.ts +39 -4
  90. package/dist/core/release/bundle.d.ts +3 -1
  91. package/dist/core/release/bundle.js +169 -11
  92. package/dist/core/release/manifest.d.ts +29 -1
  93. package/dist/core/release/manifest.js +26 -1
  94. package/dist/core/release/pack.js +13 -2
  95. package/dist/core/release/pointer.js +14 -3
  96. package/dist/core/release/read.d.ts +2 -0
  97. package/dist/core/release/read.js +1 -0
  98. package/dist/core/report.d.ts +3 -0
  99. package/dist/core/richtext/headings.d.ts +10 -0
  100. package/dist/core/richtext/headings.js +37 -0
  101. package/dist/core/richtext/html.d.ts +10 -1
  102. package/dist/core/richtext/html.js +17 -6
  103. package/dist/core/richtext/markdown-text.d.ts +24 -0
  104. package/dist/core/richtext/markdown-text.js +38 -0
  105. package/dist/core/richtext/markdown.js +44 -3
  106. package/dist/core/richtext/schema.d.ts +12 -3
  107. package/dist/core/richtext/schema.js +34 -0
  108. package/dist/core/site/live.d.ts +6 -0
  109. package/dist/core/site/live.js +25 -0
  110. package/dist/host/app.d.ts +2 -0
  111. package/dist/host/app.js +1 -0
  112. package/dist/host/diff.d.ts +11 -0
  113. package/dist/host/diff.js +40 -0
  114. package/dist/host/ipc.d.ts +2 -0
  115. package/dist/host/ipc.js +5 -1
  116. package/dist/host/preview-worker.js +2 -2
  117. package/dist/host/primary.js +15 -4
  118. package/dist/host/push.js +1 -1
  119. package/dist/host/serve.js +1 -1
  120. package/dist/host/store.d.ts +1 -2
  121. package/dist/host/store.js +32 -6
  122. package/dist/image-modules.d.ts +29 -0
  123. package/dist/image-modules.js +1 -0
  124. package/dist/index.d.ts +7 -1
  125. package/dist/index.js +4 -0
  126. package/dist/site.d.ts +8 -1
  127. package/dist/site.js +5 -0
  128. package/package.json +5 -1
@@ -8,4 +8,6 @@ export interface MediaStore {
8
8
  putVariant(id: string, width: number, format: string, bytes: Uint8Array): Promise<void>;
9
9
  remove(id: string): Promise<void>;
10
10
  }
11
+ /** Removes the cached variants of code images (`cache/code-<sha>`) whose sha isn't in `keep`. Other cache folders stay. */
12
+ export declare function sweepCodeVariants(mediaDir: string, keep: ReadonlySet<string>): Promise<void>;
11
13
  export declare function fileMediaStore(dir: string): MediaStore;
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { access, mkdir, rename, rm, writeFile } from 'node:fs/promises';
2
+ import { access, mkdir, readdir, rename, rm, writeFile } from 'node:fs/promises';
3
3
  import { dirname, join } from 'node:path';
4
4
  async function exists(path) {
5
5
  try {
@@ -22,6 +22,22 @@ async function writeAtomic(dir, target, bytes) {
22
22
  throw err;
23
23
  }
24
24
  }
25
+ /** Removes the cached variants of code images (`cache/code-<sha>`) whose sha isn't in `keep`. Other cache folders stay. */
26
+ export async function sweepCodeVariants(mediaDir, keep) {
27
+ const cache = join(mediaDir, 'cache');
28
+ let names;
29
+ try {
30
+ names = await readdir(cache);
31
+ }
32
+ catch {
33
+ return;
34
+ }
35
+ for (const name of names) {
36
+ if (!name.startsWith('code-') || keep.has(name.slice('code-'.length)))
37
+ continue;
38
+ await rm(join(cache, name), { recursive: true, force: true });
39
+ }
40
+ }
25
41
  export function fileMediaStore(dir) {
26
42
  const path = (id) => join(dir, id);
27
43
  const variantPath = (id, width, format) => join(dir, 'cache', id, `${width}.${format}`);
@@ -8,3 +8,17 @@ export declare function mediaVariant(deps: CoreDeps, id: string, opts: {
8
8
  path: string;
9
9
  mime: string;
10
10
  }>;
11
+ /**
12
+ * A resized variant of an image site code names (an import or a Markdown image), made from the file at `file.path`
13
+ * and cached in the media store under `code-<sha>`. The caller vouches for the file; there is no media-library lookup.
14
+ */
15
+ export declare function codeImageVariant(deps: CoreDeps, file: {
16
+ sha: string;
17
+ path: string;
18
+ }, opts: {
19
+ width: number;
20
+ format: VariantFormat;
21
+ }): Promise<{
22
+ path: string;
23
+ mime: string;
24
+ }>;
@@ -1,3 +1,5 @@
1
+ import { access } from 'node:fs/promises';
2
+ import { basename } from 'node:path';
1
3
  import sharp from 'sharp';
2
4
  import { InlayError } from '../errors.js';
3
5
  import { isRasterImage } from './detect.js';
@@ -57,3 +59,55 @@ export async function mediaVariant(deps, id, opts) {
57
59
  await job;
58
60
  return { path, mime };
59
61
  }
62
+ const SHA = /^[0-9a-f]{64}$/;
63
+ /**
64
+ * A resized variant of an image site code names (an import or a Markdown image), made from the file at `file.path`
65
+ * and cached in the media store under `code-<sha>`. The caller vouches for the file; there is no media-library lookup.
66
+ */
67
+ export async function codeImageVariant(deps, file, opts) {
68
+ const store = deps.media;
69
+ if (!store)
70
+ throw new InlayError('invalid_operation', 'error.mediaNotConfigured');
71
+ const { width, format } = opts;
72
+ if (!IMAGE_WIDTHS.includes(width) || !Object.hasOwn(MIME, format))
73
+ throw notFound();
74
+ if (!SHA.test(file.sha))
75
+ throw notFound();
76
+ const id = `code-${file.sha}`;
77
+ const path = store.variantPath(id, width, format);
78
+ const mime = MIME[format];
79
+ if (await store.hasVariant(id, width, format))
80
+ return { path, mime };
81
+ let pending = inFlight.get(store);
82
+ if (!pending)
83
+ inFlight.set(store, (pending = new Map()));
84
+ const key = `${id}/${width}.${format}`;
85
+ let job = pending.get(key);
86
+ if (!job) {
87
+ const jobs = pending;
88
+ job = (async () => {
89
+ try {
90
+ await access(file.path);
91
+ }
92
+ catch {
93
+ throw notFound();
94
+ }
95
+ let bytes;
96
+ try {
97
+ bytes = await sharp(file.path)
98
+ .rotate()
99
+ .resize({ width, withoutEnlargement: true })
100
+ .toFormat(format)
101
+ .toBuffer();
102
+ }
103
+ catch {
104
+ throw new InlayError('invalid_operation', 'error.mediaUnreadable', { filename: basename(file.path) });
105
+ }
106
+ await store.putVariant(id, width, format, bytes);
107
+ return path;
108
+ })().finally(() => jobs.delete(key));
109
+ pending.set(key, job);
110
+ }
111
+ await job;
112
+ return { path, mime };
113
+ }
@@ -33,6 +33,7 @@ export declare const en: {
33
33
  readonly 'issue.tooShort': '{field} is too short (at least {min} characters).';
34
34
  readonly 'issue.tooMany': '{field} has too many items (at most {max}).';
35
35
  readonly 'issue.tooFew': '{field} has too few items (at least {min}).';
36
+ readonly 'issue.pattern': "{field} isn't in the expected format.{hint}";
36
37
  readonly 'issue.tooHigh': '{field} must be at most {max}.';
37
38
  readonly 'issue.tooLow': '{field} must be at least {min}.';
38
39
  readonly 'definition.localeInvalid': 'The locale "{locale}" is not a valid locale code. Use a lowercase language code such as "en", optionally followed by a region such as "pt-BR".';
@@ -57,11 +58,15 @@ export declare const en: {
57
58
  readonly 'config.renderMissing': 'The template "{name}" has no render function, so its pages can\'t be shown. Add a render function to the template.';
58
59
  readonly 'config.headJsonLd': "A template added JSON-LD that can't be written as JSON.";
59
60
  readonly 'config.headHref': 'A template added a link to "{href}", which isn\'t a safe address. Use a path on this site or an http or https URL.';
61
+ readonly 'config.scriptValue': "A template put a value into a script that can't be written as JSON (value number {position}). Use text, numbers, true or false, null, lists and plain objects.";
62
+ readonly 'config.scriptCode': "A template's script contains </script or <!--, which can't be written safely into a page.";
63
+ readonly 'config.scriptSrc': 'A template added a script from "{src}", which isn\'t allowed. Use an https URL or a path on this site.';
60
64
  readonly 'config.publicKey': "That isn't a public key. It should look like ed25519: followed by letters and digits (as printed by inlaycms keygen), but it was: {text}";
61
65
  readonly 'config.baseUrl': 'The baseUrl option "{value}" can\'t be used. It must be the full address of the site starting with https:// or http://, with nothing after the domain, such as https://example.com.';
62
66
  readonly 'config.secret': 'The secret option must be at least 32 characters long. Use a long random value and keep it private.';
63
67
  readonly 'config.adminTheme': 'The admin theme option "{value}" can\'t be used. Use the name of a built-in theme, or colors written as hex values such as #0b5fff.';
64
68
  readonly 'config.adminAssetsMissing': 'The admin\'s style and script files are missing from {dir}. Run "pnpm run build:admin" to create them.';
69
+ readonly 'config.siteAssetsMissing': 'The script Inlay adds to pages for visitor consent is missing from {dir}. Run "pnpm run build:admin" to create it.';
65
70
  readonly 'config.backupKeep': 'The backupSchedule option keep is "{value}", but it must be a whole number of at least 1, such as 14.';
66
71
  readonly 'config.backupsMissing': 'Backups aren\'t set up for this site, so none can be listed or made. Set the backups folder in the site options.';
67
72
  readonly 'config.host.dataDir': 'INLAY_DATA_DIR is not set. Set it to the folder where the site keeps its database, media, backups and releases, such as /data.';
@@ -120,6 +125,9 @@ export declare const en: {
120
125
  readonly 'import.siteLock.exportOn': 'This export makes the site private.';
121
126
  readonly 'import.siteLock.exportOff': 'This export makes the site public.';
122
127
  readonly 'import.siteLock.exportNoPassword': 'This export has no site password.';
128
+ readonly 'import.integrations.replace': 'Integration settings will be replaced: {list}';
129
+ readonly 'import.integrations.on': '{name} (on)';
130
+ readonly 'import.integrations.off': '{name} (off)';
123
131
  readonly 'site.notFound.title': 'Page not found';
124
132
  readonly 'site.notFound': "We couldn't find the page you were looking for. It may have moved, or the address may be mistyped.";
125
133
  readonly 'site.error.title': 'Something went wrong';
@@ -134,6 +142,8 @@ export declare const en: {
134
142
  readonly 'site.lock.wrong': "That password isn't right. Check it and try again.";
135
143
  readonly 'site.lock.tooMany': 'Too many tries. Wait a minute and try again.';
136
144
  readonly 'log.renderFailed': 'The page {path} could not be shown because of an error.';
145
+ readonly 'log.integrationFailed': 'The integration {name} was left out of a page because of an error.';
146
+ readonly 'log.integrationsUnreadable': 'The integration settings could not be read, so a page was shown without its integrations.';
137
147
  readonly 'site.unsupported.title': "This can't be sent here";
138
148
  readonly 'site.unsupported': 'This address accepts only plain form fields or JSON. Files and other kinds of data can\'t be sent here.';
139
149
  readonly 'site.tooLarge.title': 'Too much to send';
@@ -171,6 +181,16 @@ export declare const en: {
171
181
  readonly 'definition.secretName': 'The site\'s secrets list "{name}" more than once or in the wrong form. Each secret is listed once, in capital letters, digits and underscores starting with a letter, such as SLACK_WEBHOOK.';
172
182
  readonly 'definition.headerName': 'The site\'s headers list "{name}", which is not allowed. List each header once, by a name made of letters, digits and hyphens, such as Permissions-Policy. Inlay sets Cache-Control, Content-Type, Set-Cookie, Location, ETag and Vary itself.';
173
183
  readonly 'definition.headerValue': 'The site\'s header "{name}" has a value that is not allowed. Give it a single line of text, or false to leave Inlay\'s default out.';
184
+ readonly 'definition.integrationName': 'An integration is named "{name}". Name each integration in lowercase letters and digits, with single hyphens between words, such as tag-manager.';
185
+ readonly 'definition.integrationDuplicate': 'Two integrations are named "{name}". Give each integration its own name.';
186
+ readonly 'definition.integrationField': 'The integration "{name}" has a field "{field}" that integrations can\'t use. Use text, text area, number, yes/no or select fields.';
187
+ readonly 'definition.integrationRender': 'The integration "{name}" has nothing to render. Give it a head, bodyStart or bodyEnd function.';
188
+ readonly 'definition.integrationConsent': 'The integration "{name}" asks for the consent category "{value}". Use analytics, marketing or functional.';
189
+ readonly 'definition.integrationFieldReserved': 'The integration "{name}" has a field called "enabled", a name the admin uses for its on/off switch. Give the field another name.';
190
+ readonly 'definition.cspOwnerSite': 'The site';
191
+ readonly 'definition.cspOwnerIntegration': 'The integration "{name}"';
192
+ readonly 'definition.cspDirective': '{where} lists sources for "{directive}", which can\'t be declared. Use one of: {directives}.';
193
+ readonly 'definition.cspSource': '{where} lists "{source}" under {directive}, which is not a valid source. Use an origin in lowercase with no path, such as https://www.example.com or https://*.example.com, a scheme such as data:, or \'unsafe-inline\' or \'unsafe-eval\' with the quotes.';
174
194
  readonly 'definition.migrationName': 'The site\'s migrations use the name "{name}" more than once or leave it empty. Give each migration its own name, such as team-to-people.';
175
195
  readonly 'definition.routePath': 'The route path "{path}" must start with "/", have no empty or dot segments, no "/" at the end, and contain no ":", "*", "?", "#" or "%".';
176
196
  readonly 'definition.routeReserved': 'The route path "{path}" belongs to Inlay itself (the home page, the admin, sign-in, MCP, media, public files, the sitemap or robots.txt). Pick another path.';
@@ -205,6 +225,7 @@ export declare const en: {
205
225
  readonly 'error.createLocale': 'New entries are created in the default language ({locale}). Add other languages as translations of an entry.';
206
226
  readonly 'label.system': 'System';
207
227
  readonly 'label.sitePassword': 'Site password';
228
+ readonly 'integrations.unknown': 'This site has no integration called "{name}".';
208
229
  readonly 'error.sitePasswordMissing': 'Set a site password before making the site private.';
209
230
  readonly 'label.untitled': 'Untitled';
210
231
  readonly 'issue.notFound': "{field} points to content that doesn't exist.";
@@ -272,6 +293,23 @@ export declare const en: {
272
293
  readonly 'error.packFile': 'The shipped content names the file {path}, but there is no file there.';
273
294
  readonly 'error.markdownImageReference': "{file}, line {line}: this image is written as a reference ([alt][name]), which Inlay can't follow in a Markdown file. Write the image inline instead, such as ![A chart](images/chart.png).";
274
295
  readonly 'error.markdownImageUnplaced': "{file}, line {line}: Inlay couldn't work out where this image's file is. Put the image on a line of its own, written simply, such as ![A chart](images/chart.png).";
296
+ readonly 'error.markdownProblem': '{file}: {problem}';
297
+ readonly 'error.markdownImageMissing': '{file}, line {line}: there is no file for the image {src}.';
298
+ readonly 'error.markdownImageOutside': "{file}, line {line}: the image {src} isn't inside the site folder, so a release can't include it.";
299
+ readonly 'error.markdownImageNotImage': "{file}, line {line}: the file for the image {src} isn't a picture Inlay can use.";
300
+ readonly 'error.markdownImageRemote': "{file}, line {line}: the image {src} is on another website, and a release never downloads anything. Download it into the site folder and name it by its path from this file, such as images/chart.png.";
301
+ readonly 'error.markdownImageRooted': '{file}, line {line}: the image {src} starts with "/", which is an address on the site, not a file. Name the file by its path from this file, such as images/chart.png.';
302
+ readonly 'error.markdownImageOther': "{file}, line {line}: the image {src} isn't a file Inlay can find. Name a picture file by its path from this file, such as images/chart.png.";
303
+ readonly 'error.markdownImageSvg': "{file}, line {line}: the image {src} is an SVG file, which Inlay doesn't show. Save it as a PNG or WebP picture instead.";
304
+ readonly 'error.markdownImageExtension': "{file}, line {line}: the name of the image {src} doesn't end in one of {extensions}. Rename the file so its name ends in the one for its kind of picture.";
305
+ readonly 'error.markdownImageMismatch': "{file}, line {line}: the name of the image {src} ends in {ext}, but the file holds another kind of picture. Rename the file so its name ends in the one for its kind of picture.";
306
+ readonly 'error.imageImportOutside': "{file} imports the image {image}, which isn't inside the site folder, so a release can't include it.";
307
+ readonly 'error.imageImportSvg': "{file} imports the image {image}, an SVG file, which Inlay doesn't resize or show as an image. Save it as a PNG or WebP picture instead.";
308
+ readonly 'error.imageImportMismatch': "{file} imports the image {image}, whose name ends in one kind of picture but whose file holds another. Rename the file so its name ends in the one for its kind of picture.";
309
+ readonly 'error.imageImportUnreadable': "{file} imports the image {image}, which can't be read as a picture: the file may be damaged or cut short. Save it again from your image editor.";
310
+ readonly 'error.imageNotImported': "ctx.image was given a value that isn't an image imported through Inlay. Import the picture in the site's own code (import hero from './hero.jpg'), which Inlay bundles, and pass what the import gives.";
311
+ readonly 'error.markdownRender': "This page's Markdown couldn't be shown. {problem}";
312
+ readonly 'error.markdownRenderImage': "This page's Markdown couldn't be shown. Line {line}: the image {src} can't be used. Use an image from the media library, or put the Markdown in a .md file the site imports and name the picture by its path from there.";
275
313
  readonly 'error.releaseSignature': "This release isn't signed by a trusted key, so it wasn't opened.";
276
314
  readonly 'error.releaseInvalid': "This release file is damaged or wasn't made by inlaycms pack.";
277
315
  readonly 'error.releaseVersion': 'This release needs Inlay {need} or a later {series} version, but this server runs Inlay {version}.';
@@ -350,6 +388,11 @@ export declare const en: {
350
388
  readonly 'diff.release.redirectAdded': 'Adds the redirect {from} to {to} ({status}).';
351
389
  readonly 'diff.release.redirectRemoved': 'Removes the redirect {from} to {to}.';
352
390
  readonly 'diff.release.redirectChanged': 'The redirect from {from} now goes to {to} ({status}).';
391
+ readonly 'diff.release.integrationAdded': 'Adds the integration {name}.';
392
+ readonly 'diff.release.integrationRemoved': 'Removes the integration {name}.';
393
+ readonly 'diff.release.integrationChanged': 'The integration {name} changed.';
394
+ readonly 'diff.release.cspAdded': 'The site may now load from: {source}';
395
+ readonly 'diff.release.cspRemoved': 'The site may no longer load from: {source}';
353
396
  readonly 'diff.release.secrets': 'Needs the {count|secret|secrets} {names} set on the server.';
354
397
  readonly 'error.previewUnavailable': "The preview of this release couldn't be started. Try again in a moment.";
355
398
  readonly 'error.previewNotStaged': "{name} isn't waiting to go live any more (it was made live or deleted), so it can't be previewed.";
@@ -429,6 +472,10 @@ export declare const en: {
429
472
  readonly 'report.slugShadowed': '"{title}" ({locale}) has the slug "{slug}", but its page {path} is hidden by a page or path Inlay serves first. Editors can\'t save it until the slug changes.';
430
473
  readonly 'report.redirectHidden': 'The redirect from {from} never fires: a published page now answers at that address. That is expected once the page has replaced the old URL, and you can remove the rule from the code when convenient.';
431
474
  readonly 'report.redirectLoop': 'The redirect from {from} sends visitors round in a loop together with the other redirects, so the server skips it. Change its target or remove one of the rules.';
475
+ readonly 'report.cspUnsafeInline': "{owner} allows 'unsafe-inline' scripts, which switches off the protection the Content-Security-Policy gives against injected scripts. Use ctx.script or page.script for inline code instead.";
476
+ readonly 'report.cspUnsafeEval': "{owner} allows 'unsafe-eval' scripts, which lets text be run as code and weakens the Content-Security-Policy. Remove it if the script works without.";
477
+ readonly 'report.cspScriptScheme': "{owner} allows scripts from any {source} address, which switches off the protection the Content-Security-Policy gives against injected scripts. List the exact sites the scripts come from instead, such as https://tags.example.";
478
+ readonly 'report.cspOverridden': "The site sets its own content-security-policy header, so the sources that integrations declare are not added to it. Remove the header, or list the sources in it yourself.";
432
479
  readonly 'richtext.unsupported': "Line {line}: rich text can't contain {feature}. Remove it, or write it as normal text instead.";
433
480
  readonly 'richtext.notAllowed': "Line {line}: this field can't contain {feature}. Remove it, or write it as normal text instead.";
434
481
  readonly 'richtext.headingLevel': "Line {line}: this field can't contain a level {level} heading (one with {level} # signs). Use one of these levels instead: {levels}.";
@@ -436,6 +483,9 @@ export declare const en: {
436
483
  readonly 'richtext.tableNested': "Line {line}: tables can't go inside a list or a quote. Move the table out so it stands on its own.";
437
484
  readonly 'richtext.tableCell': "Line {line}: table cells can't contain {feature}. Keep each cell to text, bold, italic, code and links.";
438
485
  readonly 'richtext.codeEmphasis': "Line {line}: code can't be bold or italic. Move the code (the text between backticks) out of the bold or italic text.";
486
+ readonly 'richtext.codeLanguage': 'Line {line}: "{language}" can\'t be used as the language of a code block. Write only the language\'s name after the opening backticks or tildes, like ```ts, or leave it out.';
487
+ readonly 'richtext.unclosedCode': 'Line {line}: this code block is never closed. Put the same line of backticks (or tildes) that opens it after the code to end it.';
488
+ readonly 'richtext.indentedCode': 'Line {line}: this text is indented by four or more spaces, which makes it a code block. Put a line of three backticks (```) before and after it to keep it as code, or remove the indent.';
439
489
  readonly 'richtext.imageSource': 'Line {line}: images must come from the media library, not from another address ("{src}"). Upload the image to the media library and use that instead.';
440
490
  readonly 'richtext.linkUrl': 'Line {line}: the link address "{href}" can\'t be used. Links must start with https://, http://, mailto:, tel: or /, or point to a page of this site.';
441
491
  readonly 'richtext.title': "Line {line}: {feature} can't have a title (the text in quotes after the address). Remove the title.";
@@ -532,6 +582,7 @@ export declare const en: {
532
582
  readonly 'admin.nav.users': 'Users';
533
583
  readonly 'admin.nav.backups': 'Backups & export';
534
584
  readonly 'admin.nav.security': 'Security';
585
+ readonly 'admin.nav.integrations': 'Integrations';
535
586
  readonly 'admin.nav.account': 'Your account';
536
587
  readonly 'admin.nav.content': 'Content';
537
588
  readonly 'admin.nav.blocks': 'Building blocks';
@@ -576,6 +627,20 @@ export declare const en: {
576
627
  readonly 'admin.notice.siteLocked': 'Your site is now private.';
577
628
  readonly 'admin.notice.siteUnlocked': 'Your site is now public.';
578
629
  readonly 'admin.notice.sitePasswordSaved': 'The site password is saved.';
630
+ readonly 'admin.notice.integrationSaved': 'The integration is saved.';
631
+ readonly 'admin.integrations.title': 'Integrations';
632
+ readonly 'admin.integrations.description': "Scripts your site's developer has set up. Switch one on and fill in its details.";
633
+ readonly 'admin.integrations.public': "What you enter here is visible in your pages' source.";
634
+ readonly 'admin.integrations.on': 'Switched on';
635
+ readonly 'admin.integrations.consent': 'Waits for visitors to agree to: {category}';
636
+ readonly 'admin.integrations.always': 'Loads for every visitor';
637
+ readonly 'admin.integrations.preview': 'Also runs in preview';
638
+ readonly 'admin.integrations.unsafeInline': "This switches off part of your site's script protection.";
639
+ readonly 'admin.integrations.notRunning': "This is switched on but isn't running, because its details no longer fit what the site expects. Check the details below and save again.";
640
+ readonly 'admin.integrations.save': 'Save';
641
+ readonly 'admin.integrations.category.analytics': 'analytics';
642
+ readonly 'admin.integrations.category.marketing': 'marketing';
643
+ readonly 'admin.integrations.category.functional': 'functional';
579
644
  readonly 'admin.security.title': 'Security';
580
645
  readonly 'admin.security.description': 'Choose whether people need a password to see your site.';
581
646
  readonly 'admin.security.statusOn': 'Your site is private. Visitors need the password to see it.';
@@ -624,6 +689,7 @@ export declare const en: {
624
689
  readonly 'admin.import.damaged': 'Damaged media files';
625
690
  readonly 'admin.import.shippedTitle': 'Shipped content that will be added or updated';
626
691
  readonly 'admin.import.siteLockTitle': 'Site password';
692
+ readonly 'admin.import.integrationsTitle': 'Integrations';
627
693
  readonly 'admin.import.replaceWarning': 'Restoring replaces all of the site\'s content and media with what is in this export. A backup of the current content is made first. Users and their passwords stay as they are.';
628
694
  readonly 'admin.import.restore': 'Restore content';
629
695
  readonly 'admin.import.cannotRestore': 'This export can\'t be restored. Ask whoever looks after the server for help.';
@@ -892,6 +958,7 @@ export declare const en: {
892
958
  readonly 'admin.gaps.intro': "A site update requires information that some published content doesn't have yet.";
893
959
  readonly 'admin.gaps.summary': '{label}: {count} published {count|item needs|items need} attention';
894
960
  readonly 'admin.gaps.badge': 'Needs attention';
961
+ readonly 'admin.list.designedInCode': 'Designed in code';
895
962
  readonly 'admin.gaps.editor': 'This is live with {count} required {count|field|fields} left empty: {labels}. Fill {count|it|them} in and publish again.';
896
963
  readonly 'admin.activity.today': 'Today';
897
964
  readonly 'admin.activity.yesterday': 'Yesterday';
@@ -1034,6 +1101,7 @@ export declare const en: {
1034
1101
  readonly 'admin.history.backToEditor': 'Back to the page';
1035
1102
  readonly 'admin.editor.unpublish': 'Unpublish';
1036
1103
  readonly 'admin.editor.unsaved': 'Your changes are not saved yet. Choose Save when you are done.';
1104
+ readonly 'admin.editor.designedInCode': "This page is designed in code: its words and layout are part of the site's design, so there is nothing to edit here. To change them, ask your developer.";
1037
1105
  readonly 'admin.editor.problems': 'Your changes are not saved yet. Fix the problems marked below, then save again.';
1038
1106
  readonly 'admin.editor.badBase': "This form is out of date, so your changes weren't saved. Copy anything you typed that you want to keep, then open the page again.";
1039
1107
  readonly 'admin.editor.conflict': '{name} ({source}) saved changes to this page while you were editing, so your changes are not saved yet. To keep their changes, copy what you typed, then open the page again. To replace their changes with yours, choose "Save over their changes".';
@@ -1063,6 +1131,10 @@ export declare const en: {
1063
1131
  readonly 'admin.richtext.bulletList': 'Bulleted list';
1064
1132
  readonly 'admin.richtext.orderedList': 'Numbered list';
1065
1133
  readonly 'admin.richtext.blockquote': 'Quote';
1134
+ readonly 'admin.richtext.codeBlock': 'Code block';
1135
+ readonly 'admin.richtext.codeLanguage': 'Code language';
1136
+ readonly 'admin.richtext.codeLanguageHint': 'Language, for example ts';
1137
+ readonly 'admin.richtext.codeLanguageInvalid': 'Use only letters, digits and + # _ . - (up to 32), with no spaces.';
1066
1138
  readonly 'admin.richtext.image': 'Image';
1067
1139
  readonly 'admin.richtext.hardBreak': 'Line break';
1068
1140
  readonly 'admin.richtext.table': 'Insert table';
@@ -1231,6 +1303,7 @@ export declare const en: {
1231
1303
  readonly 'mcp.change.required': "{field} is required, so it can't be removed. Give it a new value instead.";
1232
1304
  readonly 'mcp.change.neither': 'This change has no value. Give a value to set the field, or remove: true to remove it.';
1233
1305
  readonly 'mcp.tool.update_document.title': 'Change a page or entry';
1306
+ readonly 'mcp.designedInCode': "This page is designed in code: its words and layout are written into the site's template, so it has nothing to edit. Tell the person to ask their developer to change it.";
1234
1307
  readonly 'mcp.tool.update_document.description': "Changes fields of one page, entry or global in one language, saved as a draft that visitors don't see until it is published. Give its document id and the revisionId you got from get_document as baseRevisionId. Each change sets the value at a dotted path (such as slots.hero.data.headline or fields.faq.0.question), in the same form get_document returns, or removes an optional field with remove: true. If anything is wrong, nothing is saved. Returns the new revisionId, the changes in plain words, and a preview link to give the user.";
1235
1308
  readonly 'mcp.tool.create_entry.title': 'Add an entry';
1236
1309
  readonly 'mcp.tool.create_entry.description': "Adds a new entry to a collection, as an unpublished draft. Give the collection's name from describe_site and the content in the form get_document returns (read describe_type first). Leave out the slug to make one from the title. Entries are created in the main language; add other languages with create_translation. Returns the new entry's id and groupId, and a preview link to give the user.";
@@ -33,6 +33,7 @@ export const en = {
33
33
  'issue.tooShort': '{field} is too short (at least {min} characters).',
34
34
  'issue.tooMany': '{field} has too many items (at most {max}).',
35
35
  'issue.tooFew': '{field} has too few items (at least {min}).',
36
+ 'issue.pattern': "{field} isn't in the expected format.{hint}",
36
37
  'issue.tooHigh': '{field} must be at most {max}.',
37
38
  'issue.tooLow': '{field} must be at least {min}.',
38
39
  'definition.localeInvalid': 'The locale "{locale}" is not a valid locale code. Use a lowercase language code such as "en", optionally followed by a region such as "pt-BR".',
@@ -57,11 +58,15 @@ export const en = {
57
58
  'config.renderMissing': 'The template "{name}" has no render function, so its pages can\'t be shown. Add a render function to the template.',
58
59
  'config.headJsonLd': "A template added JSON-LD that can't be written as JSON.",
59
60
  'config.headHref': 'A template added a link to "{href}", which isn\'t a safe address. Use a path on this site or an http or https URL.',
61
+ 'config.scriptValue': "A template put a value into a script that can't be written as JSON (value number {position}). Use text, numbers, true or false, null, lists and plain objects.",
62
+ 'config.scriptCode': "A template's script contains </script or <!--, which can't be written safely into a page.",
63
+ 'config.scriptSrc': 'A template added a script from "{src}", which isn\'t allowed. Use an https URL or a path on this site.',
60
64
  'config.publicKey': "That isn't a public key. It should look like ed25519: followed by letters and digits (as printed by inlaycms keygen), but it was: {text}",
61
65
  'config.baseUrl': 'The baseUrl option "{value}" can\'t be used. It must be the full address of the site starting with https:// or http://, with nothing after the domain, such as https://example.com.',
62
66
  'config.secret': 'The secret option must be at least 32 characters long. Use a long random value and keep it private.',
63
67
  'config.adminTheme': 'The admin theme option "{value}" can\'t be used. Use the name of a built-in theme, or colors written as hex values such as #0b5fff.',
64
68
  'config.adminAssetsMissing': 'The admin\'s style and script files are missing from {dir}. Run "pnpm run build:admin" to create them.',
69
+ 'config.siteAssetsMissing': 'The script Inlay adds to pages for visitor consent is missing from {dir}. Run "pnpm run build:admin" to create it.',
65
70
  'config.backupKeep': 'The backupSchedule option keep is "{value}", but it must be a whole number of at least 1, such as 14.',
66
71
  'config.backupsMissing': 'Backups aren\'t set up for this site, so none can be listed or made. Set the backups folder in the site options.',
67
72
  'config.host.dataDir': 'INLAY_DATA_DIR is not set. Set it to the folder where the site keeps its database, media, backups and releases, such as /data.',
@@ -120,6 +125,9 @@ export const en = {
120
125
  'import.siteLock.exportOn': 'This export makes the site private.',
121
126
  'import.siteLock.exportOff': 'This export makes the site public.',
122
127
  'import.siteLock.exportNoPassword': 'This export has no site password.',
128
+ 'import.integrations.replace': 'Integration settings will be replaced: {list}',
129
+ 'import.integrations.on': '{name} (on)',
130
+ 'import.integrations.off': '{name} (off)',
123
131
  'site.notFound.title': 'Page not found',
124
132
  'site.notFound': "We couldn't find the page you were looking for. It may have moved, or the address may be mistyped.",
125
133
  'site.error.title': 'Something went wrong',
@@ -134,6 +142,8 @@ export const en = {
134
142
  'site.lock.wrong': "That password isn't right. Check it and try again.",
135
143
  'site.lock.tooMany': 'Too many tries. Wait a minute and try again.',
136
144
  'log.renderFailed': 'The page {path} could not be shown because of an error.',
145
+ 'log.integrationFailed': 'The integration {name} was left out of a page because of an error.',
146
+ 'log.integrationsUnreadable': 'The integration settings could not be read, so a page was shown without its integrations.',
137
147
  'site.unsupported.title': "This can't be sent here",
138
148
  'site.unsupported': 'This address accepts only plain form fields or JSON. Files and other kinds of data can\'t be sent here.',
139
149
  'site.tooLarge.title': 'Too much to send',
@@ -171,6 +181,16 @@ export const en = {
171
181
  'definition.secretName': 'The site\'s secrets list "{name}" more than once or in the wrong form. Each secret is listed once, in capital letters, digits and underscores starting with a letter, such as SLACK_WEBHOOK.',
172
182
  'definition.headerName': 'The site\'s headers list "{name}", which is not allowed. List each header once, by a name made of letters, digits and hyphens, such as Permissions-Policy. Inlay sets Cache-Control, Content-Type, Set-Cookie, Location, ETag and Vary itself.',
173
183
  'definition.headerValue': 'The site\'s header "{name}" has a value that is not allowed. Give it a single line of text, or false to leave Inlay\'s default out.',
184
+ 'definition.integrationName': 'An integration is named "{name}". Name each integration in lowercase letters and digits, with single hyphens between words, such as tag-manager.',
185
+ 'definition.integrationDuplicate': 'Two integrations are named "{name}". Give each integration its own name.',
186
+ 'definition.integrationField': 'The integration "{name}" has a field "{field}" that integrations can\'t use. Use text, text area, number, yes/no or select fields.',
187
+ 'definition.integrationRender': 'The integration "{name}" has nothing to render. Give it a head, bodyStart or bodyEnd function.',
188
+ 'definition.integrationConsent': 'The integration "{name}" asks for the consent category "{value}". Use analytics, marketing or functional.',
189
+ 'definition.integrationFieldReserved': 'The integration "{name}" has a field called "enabled", a name the admin uses for its on/off switch. Give the field another name.',
190
+ 'definition.cspOwnerSite': 'The site',
191
+ 'definition.cspOwnerIntegration': 'The integration "{name}"',
192
+ 'definition.cspDirective': '{where} lists sources for "{directive}", which can\'t be declared. Use one of: {directives}.',
193
+ 'definition.cspSource': '{where} lists "{source}" under {directive}, which is not a valid source. Use an origin in lowercase with no path, such as https://www.example.com or https://*.example.com, a scheme such as data:, or \'unsafe-inline\' or \'unsafe-eval\' with the quotes.',
174
194
  'definition.migrationName': 'The site\'s migrations use the name "{name}" more than once or leave it empty. Give each migration its own name, such as team-to-people.',
175
195
  'definition.routePath': 'The route path "{path}" must start with "/", have no empty or dot segments, no "/" at the end, and contain no ":", "*", "?", "#" or "%".',
176
196
  'definition.routeReserved': 'The route path "{path}" belongs to Inlay itself (the home page, the admin, sign-in, MCP, media, public files, the sitemap or robots.txt). Pick another path.',
@@ -205,6 +225,7 @@ export const en = {
205
225
  'error.createLocale': 'New entries are created in the default language ({locale}). Add other languages as translations of an entry.',
206
226
  'label.system': 'System',
207
227
  'label.sitePassword': 'Site password',
228
+ 'integrations.unknown': 'This site has no integration called "{name}".',
208
229
  'error.sitePasswordMissing': 'Set a site password before making the site private.',
209
230
  'label.untitled': 'Untitled',
210
231
  'issue.notFound': "{field} points to content that doesn't exist.",
@@ -272,6 +293,23 @@ export const en = {
272
293
  'error.packFile': 'The shipped content names the file {path}, but there is no file there.',
273
294
  'error.markdownImageReference': "{file}, line {line}: this image is written as a reference ([alt][name]), which Inlay can't follow in a Markdown file. Write the image inline instead, such as ![A chart](images/chart.png).",
274
295
  'error.markdownImageUnplaced': "{file}, line {line}: Inlay couldn't work out where this image's file is. Put the image on a line of its own, written simply, such as ![A chart](images/chart.png).",
296
+ 'error.markdownProblem': '{file}: {problem}',
297
+ 'error.markdownImageMissing': '{file}, line {line}: there is no file for the image {src}.',
298
+ 'error.markdownImageOutside': "{file}, line {line}: the image {src} isn't inside the site folder, so a release can't include it.",
299
+ 'error.markdownImageNotImage': "{file}, line {line}: the file for the image {src} isn't a picture Inlay can use.",
300
+ 'error.markdownImageRemote': "{file}, line {line}: the image {src} is on another website, and a release never downloads anything. Download it into the site folder and name it by its path from this file, such as images/chart.png.",
301
+ 'error.markdownImageRooted': '{file}, line {line}: the image {src} starts with "/", which is an address on the site, not a file. Name the file by its path from this file, such as images/chart.png.',
302
+ 'error.markdownImageOther': "{file}, line {line}: the image {src} isn't a file Inlay can find. Name a picture file by its path from this file, such as images/chart.png.",
303
+ 'error.markdownImageSvg': "{file}, line {line}: the image {src} is an SVG file, which Inlay doesn't show. Save it as a PNG or WebP picture instead.",
304
+ 'error.markdownImageExtension': "{file}, line {line}: the name of the image {src} doesn't end in one of {extensions}. Rename the file so its name ends in the one for its kind of picture.",
305
+ 'error.markdownImageMismatch': "{file}, line {line}: the name of the image {src} ends in {ext}, but the file holds another kind of picture. Rename the file so its name ends in the one for its kind of picture.",
306
+ 'error.imageImportOutside': "{file} imports the image {image}, which isn't inside the site folder, so a release can't include it.",
307
+ 'error.imageImportSvg': "{file} imports the image {image}, an SVG file, which Inlay doesn't resize or show as an image. Save it as a PNG or WebP picture instead.",
308
+ 'error.imageImportMismatch': "{file} imports the image {image}, whose name ends in one kind of picture but whose file holds another. Rename the file so its name ends in the one for its kind of picture.",
309
+ 'error.imageImportUnreadable': "{file} imports the image {image}, which can't be read as a picture: the file may be damaged or cut short. Save it again from your image editor.",
310
+ 'error.imageNotImported': "ctx.image was given a value that isn't an image imported through Inlay. Import the picture in the site's own code (import hero from './hero.jpg'), which Inlay bundles, and pass what the import gives.",
311
+ 'error.markdownRender': "This page's Markdown couldn't be shown. {problem}",
312
+ 'error.markdownRenderImage': "This page's Markdown couldn't be shown. Line {line}: the image {src} can't be used. Use an image from the media library, or put the Markdown in a .md file the site imports and name the picture by its path from there.",
275
313
  'error.releaseSignature': "This release isn't signed by a trusted key, so it wasn't opened.",
276
314
  'error.releaseInvalid': "This release file is damaged or wasn't made by inlaycms pack.",
277
315
  'error.releaseVersion': 'This release needs Inlay {need} or a later {series} version, but this server runs Inlay {version}.',
@@ -350,6 +388,11 @@ export const en = {
350
388
  'diff.release.redirectAdded': 'Adds the redirect {from} to {to} ({status}).',
351
389
  'diff.release.redirectRemoved': 'Removes the redirect {from} to {to}.',
352
390
  'diff.release.redirectChanged': 'The redirect from {from} now goes to {to} ({status}).',
391
+ 'diff.release.integrationAdded': 'Adds the integration {name}.',
392
+ 'diff.release.integrationRemoved': 'Removes the integration {name}.',
393
+ 'diff.release.integrationChanged': 'The integration {name} changed.',
394
+ 'diff.release.cspAdded': 'The site may now load from: {source}',
395
+ 'diff.release.cspRemoved': 'The site may no longer load from: {source}',
353
396
  'diff.release.secrets': 'Needs the {count|secret|secrets} {names} set on the server.',
354
397
  'error.previewUnavailable': "The preview of this release couldn't be started. Try again in a moment.",
355
398
  'error.previewNotStaged': "{name} isn't waiting to go live any more (it was made live or deleted), so it can't be previewed.",
@@ -429,6 +472,10 @@ export const en = {
429
472
  'report.slugShadowed': '"{title}" ({locale}) has the slug "{slug}", but its page {path} is hidden by a page or path Inlay serves first. Editors can\'t save it until the slug changes.',
430
473
  'report.redirectHidden': 'The redirect from {from} never fires: a published page now answers at that address. That is expected once the page has replaced the old URL, and you can remove the rule from the code when convenient.',
431
474
  'report.redirectLoop': 'The redirect from {from} sends visitors round in a loop together with the other redirects, so the server skips it. Change its target or remove one of the rules.',
475
+ 'report.cspUnsafeInline': "{owner} allows 'unsafe-inline' scripts, which switches off the protection the Content-Security-Policy gives against injected scripts. Use ctx.script or page.script for inline code instead.",
476
+ 'report.cspUnsafeEval': "{owner} allows 'unsafe-eval' scripts, which lets text be run as code and weakens the Content-Security-Policy. Remove it if the script works without.",
477
+ 'report.cspScriptScheme': "{owner} allows scripts from any {source} address, which switches off the protection the Content-Security-Policy gives against injected scripts. List the exact sites the scripts come from instead, such as https://tags.example.",
478
+ 'report.cspOverridden': "The site sets its own content-security-policy header, so the sources that integrations declare are not added to it. Remove the header, or list the sources in it yourself.",
432
479
  'richtext.unsupported': "Line {line}: rich text can't contain {feature}. Remove it, or write it as normal text instead.",
433
480
  'richtext.notAllowed': "Line {line}: this field can't contain {feature}. Remove it, or write it as normal text instead.",
434
481
  'richtext.headingLevel': "Line {line}: this field can't contain a level {level} heading (one with {level} # signs). Use one of these levels instead: {levels}.",
@@ -436,6 +483,9 @@ export const en = {
436
483
  'richtext.tableNested': "Line {line}: tables can't go inside a list or a quote. Move the table out so it stands on its own.",
437
484
  'richtext.tableCell': "Line {line}: table cells can't contain {feature}. Keep each cell to text, bold, italic, code and links.",
438
485
  'richtext.codeEmphasis': "Line {line}: code can't be bold or italic. Move the code (the text between backticks) out of the bold or italic text.",
486
+ 'richtext.codeLanguage': 'Line {line}: "{language}" can\'t be used as the language of a code block. Write only the language\'s name after the opening backticks or tildes, like ```ts, or leave it out.',
487
+ 'richtext.unclosedCode': 'Line {line}: this code block is never closed. Put the same line of backticks (or tildes) that opens it after the code to end it.',
488
+ 'richtext.indentedCode': 'Line {line}: this text is indented by four or more spaces, which makes it a code block. Put a line of three backticks (```) before and after it to keep it as code, or remove the indent.',
439
489
  'richtext.imageSource': 'Line {line}: images must come from the media library, not from another address ("{src}"). Upload the image to the media library and use that instead.',
440
490
  'richtext.linkUrl': 'Line {line}: the link address "{href}" can\'t be used. Links must start with https://, http://, mailto:, tel: or /, or point to a page of this site.',
441
491
  'richtext.title': "Line {line}: {feature} can't have a title (the text in quotes after the address). Remove the title.",
@@ -532,6 +582,7 @@ export const en = {
532
582
  'admin.nav.users': 'Users',
533
583
  'admin.nav.backups': 'Backups & export',
534
584
  'admin.nav.security': 'Security',
585
+ 'admin.nav.integrations': 'Integrations',
535
586
  'admin.nav.account': 'Your account',
536
587
  'admin.nav.content': 'Content',
537
588
  'admin.nav.blocks': 'Building blocks',
@@ -576,6 +627,20 @@ export const en = {
576
627
  'admin.notice.siteLocked': 'Your site is now private.',
577
628
  'admin.notice.siteUnlocked': 'Your site is now public.',
578
629
  'admin.notice.sitePasswordSaved': 'The site password is saved.',
630
+ 'admin.notice.integrationSaved': 'The integration is saved.',
631
+ 'admin.integrations.title': 'Integrations',
632
+ 'admin.integrations.description': "Scripts your site's developer has set up. Switch one on and fill in its details.",
633
+ 'admin.integrations.public': "What you enter here is visible in your pages' source.",
634
+ 'admin.integrations.on': 'Switched on',
635
+ 'admin.integrations.consent': 'Waits for visitors to agree to: {category}',
636
+ 'admin.integrations.always': 'Loads for every visitor',
637
+ 'admin.integrations.preview': 'Also runs in preview',
638
+ 'admin.integrations.unsafeInline': "This switches off part of your site's script protection.",
639
+ 'admin.integrations.notRunning': "This is switched on but isn't running, because its details no longer fit what the site expects. Check the details below and save again.",
640
+ 'admin.integrations.save': 'Save',
641
+ 'admin.integrations.category.analytics': 'analytics',
642
+ 'admin.integrations.category.marketing': 'marketing',
643
+ 'admin.integrations.category.functional': 'functional',
579
644
  'admin.security.title': 'Security',
580
645
  'admin.security.description': 'Choose whether people need a password to see your site.',
581
646
  'admin.security.statusOn': 'Your site is private. Visitors need the password to see it.',
@@ -624,6 +689,7 @@ export const en = {
624
689
  'admin.import.damaged': 'Damaged media files',
625
690
  'admin.import.shippedTitle': 'Shipped content that will be added or updated',
626
691
  'admin.import.siteLockTitle': 'Site password',
692
+ 'admin.import.integrationsTitle': 'Integrations',
627
693
  'admin.import.replaceWarning': 'Restoring replaces all of the site\'s content and media with what is in this export. A backup of the current content is made first. Users and their passwords stay as they are.',
628
694
  'admin.import.restore': 'Restore content',
629
695
  'admin.import.cannotRestore': 'This export can\'t be restored. Ask whoever looks after the server for help.',
@@ -892,6 +958,7 @@ export const en = {
892
958
  'admin.gaps.intro': "A site update requires information that some published content doesn't have yet.",
893
959
  'admin.gaps.summary': '{label}: {count} published {count|item needs|items need} attention',
894
960
  'admin.gaps.badge': 'Needs attention',
961
+ 'admin.list.designedInCode': 'Designed in code',
895
962
  'admin.gaps.editor': 'This is live with {count} required {count|field|fields} left empty: {labels}. Fill {count|it|them} in and publish again.',
896
963
  'admin.activity.today': 'Today',
897
964
  'admin.activity.yesterday': 'Yesterday',
@@ -1034,6 +1101,7 @@ export const en = {
1034
1101
  'admin.history.backToEditor': 'Back to the page',
1035
1102
  'admin.editor.unpublish': 'Unpublish',
1036
1103
  'admin.editor.unsaved': 'Your changes are not saved yet. Choose Save when you are done.',
1104
+ 'admin.editor.designedInCode': "This page is designed in code: its words and layout are part of the site's design, so there is nothing to edit here. To change them, ask your developer.",
1037
1105
  'admin.editor.problems': 'Your changes are not saved yet. Fix the problems marked below, then save again.',
1038
1106
  'admin.editor.badBase': "This form is out of date, so your changes weren't saved. Copy anything you typed that you want to keep, then open the page again.",
1039
1107
  'admin.editor.conflict': '{name} ({source}) saved changes to this page while you were editing, so your changes are not saved yet. To keep their changes, copy what you typed, then open the page again. To replace their changes with yours, choose "Save over their changes".',
@@ -1063,6 +1131,10 @@ export const en = {
1063
1131
  'admin.richtext.bulletList': 'Bulleted list',
1064
1132
  'admin.richtext.orderedList': 'Numbered list',
1065
1133
  'admin.richtext.blockquote': 'Quote',
1134
+ 'admin.richtext.codeBlock': 'Code block',
1135
+ 'admin.richtext.codeLanguage': 'Code language',
1136
+ 'admin.richtext.codeLanguageHint': 'Language, for example ts',
1137
+ 'admin.richtext.codeLanguageInvalid': 'Use only letters, digits and + # _ . - (up to 32), with no spaces.',
1066
1138
  'admin.richtext.image': 'Image',
1067
1139
  'admin.richtext.hardBreak': 'Line break',
1068
1140
  'admin.richtext.table': 'Insert table',
@@ -1240,6 +1312,7 @@ export const en = {
1240
1312
  'mcp.change.required': "{field} is required, so it can't be removed. Give it a new value instead.",
1241
1313
  'mcp.change.neither': 'This change has no value. Give a value to set the field, or remove: true to remove it.',
1242
1314
  'mcp.tool.update_document.title': 'Change a page or entry',
1315
+ 'mcp.designedInCode': "This page is designed in code: its words and layout are written into the site's template, so it has nothing to edit. Tell the person to ask their developer to change it.",
1243
1316
  'mcp.tool.update_document.description': "Changes fields of one page, entry or global in one language, saved as a draft that visitors don't see until it is published. Give its document id and the revisionId you got from get_document as baseRevisionId. Each change sets the value at a dotted path (such as slots.hero.data.headline or fields.faq.0.question), in the same form get_document returns, or removes an optional field with remove: true. If anything is wrong, nothing is saved. Returns the new revisionId, the changes in plain words, and a preview link to give the user.",
1244
1317
  'mcp.tool.create_entry.title': 'Add an entry',
1245
1318
  'mcp.tool.create_entry.description': "Adds a new entry to a collection, as an unpublished draft. Give the collection's name from describe_site and the content in the form get_document returns (read describe_type first). Leave out the slug to make one from the title. Entries are created in the main language; add other languages with create_translation. Returns the new entry's id and groupId, and a preview link to give the user.",
@@ -0,0 +1,16 @@
1
+ /**
2
+ * An image site code imports (`import hero from './hero.jpg'`), measured when the site is bundled: `source` is the
3
+ * file's `file:` URL, `sha` the sha256 hex of its bytes, `ext` its lowercase extension, and `width` and `height` its
4
+ * displayed size in pixels (after EXIF rotation).
5
+ */
6
+ export interface CodeImage {
7
+ readonly kind: 'codeImage';
8
+ source: string;
9
+ sha: string;
10
+ ext: string;
11
+ mime: string;
12
+ width: number;
13
+ height: number;
14
+ }
15
+ /** True if `v` has the shape of a `CodeImage`. */
16
+ export declare function isCodeImage(v: unknown): v is CodeImage;
@@ -0,0 +1,13 @@
1
+ /** True if `v` has the shape of a `CodeImage`. */
2
+ export function isCodeImage(v) {
3
+ if (typeof v !== 'object' || v === null)
4
+ return false;
5
+ const o = v;
6
+ return (o.kind === 'codeImage' &&
7
+ typeof o.source === 'string' &&
8
+ typeof o.sha === 'string' &&
9
+ typeof o.ext === 'string' &&
10
+ typeof o.mime === 'string' &&
11
+ typeof o.width === 'number' &&
12
+ typeof o.height === 'number');
13
+ }
@@ -1,6 +1,7 @@
1
1
  import type { z } from 'zod';
2
2
  import type { Renderable, SafeHtml } from '../../jsx/html.js';
3
3
  import type { AdminTheme } from '../types.js';
4
+ import type { CspSources, IntegrationDef } from './integration.js';
4
5
  import type { ShippedContent } from './content.js';
5
6
  import type { ReleaseMigration } from './migration.js';
6
7
  import type { PageInfo, RenderContext } from './render.js';
@@ -156,6 +157,10 @@ export interface SiteDefinition {
156
157
  * sets itself (the admin's CSP, a route's own) wins over both.
157
158
  */
158
159
  headers: Record<string, string | false>;
160
+ /** Third-party scripts the owner can switch on in the admin. */
161
+ integrations: IntegrationDef[];
162
+ /** Sources the site's own code needs in the Content-Security-Policy, by directive. */
163
+ csp: CspSources;
159
164
  routes: RouteDef[];
160
165
  /** Redirects shipped with the site's code. */
161
166
  redirects: RedirectDef[];
@@ -178,6 +183,8 @@ export interface SiteInput {
178
183
  publicPaths?: string[];
179
184
  secrets?: string[];
180
185
  headers?: Record<string, string | false>;
186
+ integrations?: IntegrationDef[];
187
+ csp?: CspSources;
181
188
  routes?: RouteDef[];
182
189
  redirects?: RedirectDef[];
183
190
  migrations?: ReleaseMigration[];
@@ -37,6 +37,8 @@ export function defineSite(def) {
37
37
  publicPaths: def.publicPaths ?? [],
38
38
  secrets: def.secrets ?? [],
39
39
  headers: def.headers ?? {},
40
+ integrations: def.integrations ?? [],
41
+ csp: def.csp ?? {},
40
42
  routes: def.routes ?? [],
41
43
  redirects: def.redirects ?? [],
42
44
  migrations: def.migrations ?? [],
@@ -0,0 +1,6 @@
1
+ import type { TemplateDef } from './define.js';
2
+ /**
3
+ * True when `template` has no fields and no slots: a page designed in code, whose words are all in the template.
4
+ * The admin and MCP say so instead of offering an empty form.
5
+ */
6
+ export declare function designedInCode(template: TemplateDef): boolean;