canopycms 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,9 +5,9 @@ packages release together, at one version.
5
5
 
6
6
  ## This build
7
7
 
8
- Version `0.10.0`, built from [`e2c1dc9`](https://github.com/safeinsights/canopycms/tree/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7).
8
+ Version `0.11.0`, built from [`5c6c8f1`](https://github.com/safeinsights/canopycms/tree/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7).
9
9
 
10
- Its entries are [0.10.0](#0100), under **Released**.
10
+ Its entries are [0.11.0](#0110), under **Released**.
11
11
 
12
12
  If you upgraded from a build on another branch, compare the `<!-- changeset: … -->` slugs in your previous build's `CHANGELOG.md` (`npm pack canopycms@<old>` fetches it) with this one's: entries whose slug your old file lacks are new to you.
13
13
 
@@ -24,7 +24,7 @@ Each entry has up to three parts:
24
24
  `node_modules/canopycms/CHANGELOG.md`, assembled for that build: its **This build** section lists
25
25
  what is new since the previous int on the same branch, or on a stable release links its entries, and its links point at the commit the build
26
26
  came from. The copy in the repository holds released history and the entries from before changesets;
27
- every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/.changeset/README.md) until a stable release
27
+ every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/.changeset/README.md) until a stable release
28
28
  moves it here.
29
29
 
30
30
  **Find your starting point.** From a stable pin, start at the first version under **Released**
@@ -62,6 +62,20 @@ entries under **Released**.
62
62
 
63
63
  ## Released
64
64
 
65
+ ### 0.11.0
66
+
67
+ #### The preview follows the form to the field you're on
68
+
69
+ <!-- changeset: preview-follows-form -->
70
+
71
+ _First in 0.11.0._
72
+
73
+ **What changed.** Focusing a field in the form, or opening its comments, scrolls the preview to the element the page marks for that field with `fieldProps`, else to the first mark inside it, else to its nearest marked ancestor, and outlines it briefly. Nothing moves when the element already shows as much as it can, focus stays in the form, focus coming back to the same field leaves the preview where you scrolled it, and reduced motion jumps instead of scrolling. It is on by default; the preview toolbar's "Scroll the preview to the field you're on" toggle turns it off, remembered per browser like the other preview controls. The editor sends a new `canopycms:preview:reveal` message, which a page accepts only from its editor, as it does the others.
74
+
75
+ **To adopt.** Nothing for a page on `useCanopyPreview` or `withCanopyPreview` once it runs this version of `canopycms/preview`. A page on an older version ignores the message, so the preview just doesn't follow. A page that wires the bridge's hooks itself adds `usePreviewReveal({ editorOrigin })` beside `usePreviewHighlight`.
76
+
77
+ **Now deletable.** Nothing.
78
+
65
79
  ### 0.10.0
66
80
 
67
81
  #### Archived branches move out of the way, with optional retention
@@ -84,7 +98,7 @@ _First in 0.9.0._
84
98
 
85
99
  **What changed.** A new scalar field type, `date`, holds a calendar day as a `YYYY-MM-DD` string, edited with a day picker. `datetime` stores an instant, so a day picked in one zone can read as the day before in another; a `date` is the same day everywhere. A save and a production build refuse a value that is not a real day, such as `2026-02-30` or `2026-5-1`; YAML rolls an unquoted `2026-02-30` forward first, so quote hand-written days. A hand-written unquoted `2024-05-01` in md or mdx frontmatter reads as that day in every zone, and survives a save on its own line. `list: true` is refused on a `date`; use an object list with a `date` field inside, which `itemTitleField` may name. `stampOnPublish` stays on `datetime`, and `datetime` values and checks are unchanged. Editor field errors now meet 4.5:1 contrast.
86
100
 
87
- **To adopt.** Change `type: 'string'` to `type: 'date'` on a field that holds `YYYY-MM-DD`: `TypeFromEntrySchema` still gives `string`, and every `YYYY-MM-DD` value stays as it is. A production build lists any entry whose value is not a real day, such as `2026-5-1`; fix those by hand. A custom field type that was named `date` keeps its `customRenderers` entry but is now checked as a `date`, so rename it if its values differ. See [Field Types](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/.changeset/README.md#field-types).
101
+ **To adopt.** Change `type: 'string'` to `type: 'date'` on a field that holds `YYYY-MM-DD`: `TypeFromEntrySchema` still gives `string`, and every `YYYY-MM-DD` value stays as it is. A production build lists any entry whose value is not a real day, such as `2026-5-1`; fix those by hand. A custom field type that was named `date` keeps its `customRenderers` entry but is now checked as a `date`, so rename it if its values differ. See [Field Types](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/.changeset/README.md#field-types).
88
102
 
89
103
  **Now deletable.** A `string` field with a hand-written `YYYY-MM-DD` format check, and site code that reads a `datetime` back into a day.
90
104
 
@@ -360,7 +374,7 @@ _First in 0.7.0._
360
374
 
361
375
  **What changed.** The pull request a submit opens now lists the branch's unresolved editor comment threads: where each one is, the first line of its first comment (80 characters at most) and a link to it in the editor. Once every thread is resolved, it says so. The list is updated whenever a comment is added, replied to or resolved, as well as on submit. Comment excerpts are visible to everyone who can read the pull request, which on a public repository means everyone. Open threads do not block the merge or keep the pull request in draft. A pull request opened before this release shows no list until its branch is next submitted.
362
376
 
363
- **To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#rolling-the-worker-from-ci).
377
+ **To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#rolling-the-worker-from-ci).
364
378
 
365
379
  #### Pull request bodies link back to the editor
366
380
 
@@ -370,7 +384,7 @@ _First in 0.7.0._
370
384
 
371
385
  **What changed.** The pull request a submit opens links to the branch in the editor, and each changed entry to that entry. A notice tells reviewers that comments on the pull request do not reach the editor, so the author will not see them. The links use the editor's URL from the submit, accepted only when its host is the one the request was addressed to (`X-Forwarded-Host`, else `Host`), which holds behind `canopycms-cdk`'s CloudFront distribution as it stands.
372
386
 
373
- **To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#definecanopyconfig-options).
387
+ **To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#definecanopyconfig-options).
374
388
 
375
389
  #### CloudFront origin read timeout accepted up to 120 s; the editor waits 135 s
376
390
 
@@ -456,7 +470,7 @@ _First in 0.6.0._
456
470
 
457
471
  **What changed.** `CanopyCmsService` takes `clerkOrganizationsAsGroups` (default `true`, unchanged), which the worker honours; in a deployment it, not the plugin's `useOrganizationsAsGroups`, decides the groups. When Clerk refuses the organization list with a 403 (Organizations disabled), the refresh now writes users with no groups and logs a warning, instead of failing whole; any other failure still keeps the last snapshot. Memberships are fetched instance-wide rather than per user. The scaffolds write `false` explicitly: `useOrganizationsAsGroups` in `canopycms init`'s `canopy.ts`, and `clerkOrganizationsAsGroups` in `canopycms init-deploy aws`'s CDK stack.
458
472
 
459
- **To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md).
473
+ **To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md).
460
474
 
461
475
  ### 0.5.0
462
476
 
@@ -468,7 +482,7 @@ _First in 0.5.0._
468
482
 
469
483
  **What changed.** A `type: 'reference', list: true` field now edits as rows in stored order, like an `object` list: drag a row or use its "…" menu to move or remove it, open a row to swap its entry in place, and pick from Add under the rows to append. Neither control offers an entry the list already holds. Any `list: true` field, and any `block` field, takes `maxItems`. The editor stops adding at the cap and says why, a save over it is refused, and a production build fails on an entry over it, naming the entry, field, count and cap. Adding `maxItems` to a list that already holds more therefore fails the build until an editor removes the extra items. `maxItems` on a field that holds no items is refused when the entry schema registry is created.
470
484
 
471
- **To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#field-types).
485
+ **To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#field-types).
472
486
 
473
487
  #### SEO field location moves into config; reference pickers mark hidden entries and take a sort order — **breaking: `createNextCanopyContext({ seo })` and `AIContentConfig.seo` are removed**
474
488
 
@@ -478,7 +492,7 @@ _First in 0.5.0._
478
492
 
479
493
  **What changed.** `defineCanopyConfig` takes `seo: { group?, fields? }`, the one place every surface reads an entry's `noindex` flag: the sitemap and `entryToMetadata` that `createNextCanopyContext` returns, AI content and the editor's reference picker. A per-call `seo`/`group`/`fields` still overrides it. The free `generateContentSitemap` takes `seo` as an argument and refuses to run without it when the config sets one; `createNextCanopyContext` and the AI content config refuse a leftover `seo`. A reference picker now badges an entry hidden from search as "Hidden from search", and picking one adds a note naming the setting on that entry's form, since a page listing only indexed entries won't show it. A reference field takes `optionSort`: `'label'` (the default), `'collection'`, or `{ field, direction }`. Point `field` at an ISO date, since strings compare as text.
480
494
 
481
- **To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#sitemap-and-seo-metadata) and [How References Work in the Editor](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#how-references-work-in-the-editor).
495
+ **To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#sitemap-and-seo-metadata) and [How References Work in the Editor](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#how-references-work-in-the-editor).
482
496
 
483
497
  **Now deletable.** A shared `seo` constant passed separately to the Next context and the AI content config.
484
498
 
@@ -506,7 +520,7 @@ resolved without it.
506
520
  **To adopt.** Where a reference renders its target's prose, set `includeBody: true` on that
507
521
  reference field. Code that reads the body from a link-only reference's resolved type now sees
508
522
  `string | undefined`; either set `includeBody: true` or handle the missing value. See
509
- [Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#resolving-references-in-a-listing).
523
+ [Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#resolving-references-in-a-listing).
510
524
 
511
525
  ### 0.3.3
512
526
 
@@ -923,7 +937,7 @@ URL.
923
937
  2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
924
938
  `app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
925
939
  route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
926
- [Live Preview](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#live-preview)).
940
+ [Live Preview](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#live-preview)).
927
941
  3. A test reading view content from the route's server HTML must load the page in a browser.
928
942
  Server output rendered during a preview request carries the signed-in asset prefix; keep it out
929
943
  of cross-request caches (`unstable_cache`, module memos).
@@ -938,7 +952,7 @@ kept site styles ahead of Mantine's in the preview.
938
952
  server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
939
953
  path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
940
954
  refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
941
- [Live Preview](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#live-preview).
955
+ [Live Preview](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#live-preview).
942
956
 
943
957
  **To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
944
958
  as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
@@ -1020,7 +1034,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
1020
1034
  fields are nested or renamed, pass the AI config's `seo` the same object you pass
1021
1035
  `createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
1022
1036
  place. A field that links to a hidden section by plain URL needs a field transform; the README
1023
- shows [the recipe](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#ai-content-configuration).
1037
+ shows [the recipe](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#ai-content-configuration).
1024
1038
 
1025
1039
  **Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
1026
1040
 
@@ -1042,7 +1056,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
1042
1056
  field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
1043
1057
  `MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
1044
1058
  `{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
1045
- [MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#mdx-content-cannot-run-code).
1059
+ [MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#mdx-content-cannot-run-code).
1046
1060
 
1047
1061
  **To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
1048
1062
  `mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
@@ -1179,7 +1193,7 @@ a format check.
1179
1193
 
1180
1194
  - (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
1181
1195
  re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
1182
- ([reference](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#definecanopyconfig-options)).
1196
+ ([reference](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#definecanopyconfig-options)).
1183
1197
  - (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
1184
1198
  the PR-body section every user who edited the branch, not only the submitter; settings commits
1185
1199
  (permissions, groups) carry the acting user's trailer.
@@ -1203,7 +1217,7 @@ saves only push the branch, and no failing PR task lands in System health.
1203
1217
  that entry type goes unavailable: the editor says so, and its entries answer 503 with
1204
1218
  `code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
1205
1219
  worker holds the base branch for up to 30 minutes while that lasts; see
1206
- [New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
1220
+ [New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
1207
1221
  Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
1208
1222
  `ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
1209
1223
 
@@ -1241,7 +1255,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
1241
1255
  new stack needs no steps.
1242
1256
 
1243
1257
  **What changed.** (int.109) Detailed in
1244
- [The worker instance](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
1258
+ [The worker instance](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
1245
1259
  bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
1246
1260
  refusing clients without TLS or IAM, replacing the worker's
1247
1261
  `AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
@@ -1295,10 +1309,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
1295
1309
  with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
1296
1310
  unchanged.
1297
1311
  - `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
1298
- [Worker-down alarm](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#worker-down-alarm).
1312
+ [Worker-down alarm](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#worker-down-alarm).
1299
1313
 
1300
1314
  **To adopt.** Optional. For parameter-only change sets, see
1301
- [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
1315
+ [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
1302
1316
  `alarmTopic`.
1303
1317
 
1304
1318
  **Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
@@ -1309,7 +1323,7 @@ worker, and a hand-built alarm on the worker log group.
1309
1323
  **What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
1310
1324
  swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
1311
1325
  `alarmTopic` if set; a retried step names itself when it gives up. See
1312
- [The worker instance](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#the-worker-instance).
1326
+ [The worker instance](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#the-worker-instance).
1313
1327
 
1314
1328
  **To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
1315
1329
  not Template first and the worker contract stays at 1.
@@ -1375,7 +1389,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
1375
1389
 
1376
1390
  **To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
1377
1391
  mirror, so the root volume needs room for two
1378
- ([details](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#the-worker-instance)).
1392
+ ([details](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#the-worker-instance)).
1379
1393
 
1380
1394
  #### The worker follows a rebased or deleted GitHub branch
1381
1395
 
@@ -1397,7 +1411,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
1397
1411
  bundle-only roll is safe.
1398
1412
 
1399
1413
  **To adopt.** Parameter mode: gate bundle-only rolls on the contract
1400
- ([recipe](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
1414
+ ([recipe](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
1401
1415
  `WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
1402
1416
  copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
1403
1417
 
@@ -1414,8 +1428,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
1414
1428
  template, then roll the bundle; on an older template it stops with `template too old for this
1415
1429
  bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
1416
1430
  takes `worker/`'s three units and `gateway.env.example`
1417
- ([steps](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
1418
- [checklist](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#first-deploy-checklist).
1431
+ ([steps](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
1432
+ [checklist](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#first-deploy-checklist).
1419
1433
 
1420
1434
  #### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
1421
1435
 
@@ -1426,7 +1440,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
1426
1440
  `X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
1427
1441
  its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
1428
1442
  marked `noindex`. The editor's default preview is same-origin and unaffected. See
1429
- [Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
1443
+ [Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
1430
1444
 
1431
1445
  **To adopt.** If you wired the Function URL into your own distribution by hand, delete those
1432
1446
  behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
@@ -1602,7 +1616,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
1602
1616
  **To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
1603
1617
  apply the same rule here, for example `referenceLink: (target, { body }) =>
1604
1618
  !body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
1605
- [AI Content Configuration](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#ai-content-configuration).
1619
+ [AI Content Configuration](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#ai-content-configuration).
1606
1620
 
1607
1621
  **Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
1608
1622
  change its link.
@@ -1677,7 +1691,7 @@ _First in int.115._
1677
1691
  entry the base branch also changed, the "updated on the base branch" notice and the branch's
1678
1692
  conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
1679
1693
  base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
1680
- and Unpublishing](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#drafts-and-unpublishing) section covers long-lived branches and
1694
+ and Unpublishing](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#drafts-and-unpublishing) section covers long-lived branches and
1681
1695
  unpublishing.
1682
1696
 
1683
1697
  #### The editor calls the content drawer "All content"
@@ -1989,7 +2003,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
1989
2003
  The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
1990
2004
 
1991
2005
  **To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
1992
- `{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#stamping-a-publication-date).
2006
+ `{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#stamping-a-publication-date).
1993
2007
 
1994
2008
  **Now deletable.** A build step or hook that writes a missing publication date into new entries.
1995
2009
 
@@ -2036,7 +2050,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
2036
2050
  stored at, and `react-split-pane` is no longer a dependency.
2037
2051
  `EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
2038
2052
  no longer exported from `canopycms/client`. See
2039
- [Your root layout](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#editor-customization).
2053
+ [Your root layout](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#editor-customization).
2040
2054
 
2041
2055
  **To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
2042
2056
  instead, which lays out its own panes. Hiding your site chrome on the editor route is now
@@ -2147,7 +2161,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
2147
2161
  **To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
2148
2162
  `ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
2149
2163
  own pages, mount the hook as in
2150
- [Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
2164
+ [Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
2151
2165
  Your own Server Actions in the CMS build still 403 behind OAC.
2152
2166
 
2153
2167
  **Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
@@ -2188,12 +2202,12 @@ fast naming the ARN, the field and the keys present, never a value.
2188
2202
  **To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
2189
2203
  prop. The scaffolded stack fills them from the repository _variables_
2190
2204
  `CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
2191
- ([why the prefix](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
2205
+ ([why the prefix](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
2192
2206
  adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
2193
2207
  lines to `.github/workflows/deploy-cms.yml`, or re-runs the generator and diffs. `cdk synth` refuses a `…JsonField` prop without its `…SecretArn`, and an ARN carrying the ECS `:KEY::` suffix
2194
2208
  (also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
2195
2209
  resource's configuration, readable by anyone who can describe it. Only `CLERK_SECRET_KEY` goes through Secrets Manager; `CLERK_JWT_KEY` and the publishable
2196
- key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#security-model)).
2210
+ key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#security-model)).
2197
2211
 
2198
2212
  **Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
2199
2213
  worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
@@ -2205,7 +2219,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
2205
2219
  `githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
2206
2220
  nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
2207
2221
  anyone holding an App's key can mint a token for any of its installations
2208
- ([why](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
2222
+ ([why](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
2209
2223
 
2210
2224
  **To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
2211
2225
  `githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
@@ -2218,7 +2232,7 @@ anyone holding an App's key can mint a token for any of its installations
2218
2232
  `verify` checks an existing installation's permissions: run it, since an App missing a
2219
2233
  permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
2220
2234
  never edits an existing JSON secret (create one and point the JSON-field prop at it)
2221
- ([details](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
2235
+ ([details](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
2222
2236
  2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
2223
2237
  of the three is refused at synth, and so is an App alongside a token.
2224
2238
  3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
@@ -2229,7 +2243,7 @@ anyone holding an App's key can mint a token for any of its installations
2229
2243
 
2230
2244
  The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
2231
2245
  IAM policy automatically, so you need not add it to `secretsArns`. See
2232
- [Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#authenticating-as-a-github-app).
2246
+ [Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#authenticating-as-a-github-app).
2233
2247
 
2234
2248
  ```bash
2235
2249
  canopycms init-github-app create -- \
@@ -2277,7 +2291,7 @@ downloads the `.pem` from the App's settings page.
2277
2291
 
2278
2292
  **What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
2279
2293
  key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
2280
- [Rotating a secret](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#rotating-a-secret).
2294
+ [Rotating a secret](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#rotating-a-secret).
2281
2295
 
2282
2296
  **To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
2283
2297
  GitHub App private key is still read only at boot: store the new key, replace the instance, and
@@ -2331,12 +2345,12 @@ also check the bucket policy for its grant.
2331
2345
  5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
2332
2346
  Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
2333
2347
  `webpack` and it can read your Next version. A webpack build still fails its image transforms
2334
- ([Dual Build Support](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#dual-build-support)).
2348
+ ([Dual Build Support](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#dual-build-support)).
2335
2349
 
2336
2350
  **Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
2337
2351
  function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
2338
2352
  function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
2339
- on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#where-the-image-is-built)).
2353
+ on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#where-the-image-is-built)).
2340
2354
 
2341
2355
  **To adopt.**
2342
2356
 
@@ -2365,7 +2379,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
2365
2379
 
2366
2380
  **What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
2367
2381
  replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
2368
- uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#media-configuration) for the
2382
+ uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#media-configuration) for the
2369
2383
  CloudFront behavior it expects.
2370
2384
 
2371
2385
  **To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
@@ -2390,7 +2404,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
2390
2404
  bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
2391
2405
  `Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
2392
2406
  `AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
2393
- pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#cross-account-asset-bucket).
2407
+ pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#cross-account-asset-bucket).
2394
2408
 
2395
2409
  **To adopt.** Optional:
2396
2410
 
@@ -2500,7 +2514,7 @@ public JWKS PEM, used only to verify signatures.
2500
2514
  to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
2501
2515
  deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
2502
2516
  `clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
2503
- `clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/docs/deploying-to-aws.md#security-model)).
2517
+ `clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/docs/deploying-to-aws.md#security-model)).
2504
2518
 
2505
2519
  #### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
2506
2520
 
@@ -2599,7 +2613,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
2599
2613
  Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
2600
2614
  no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
2601
2615
  `AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
2602
- is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#media-configuration)). Two traps:
2616
+ is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#media-configuration)). Two traps:
2603
2617
 
2604
2618
  - Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
2605
2619
  a nested route prefix and emits zero params, building green.
@@ -2758,7 +2772,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
2758
2772
  `withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
2759
2773
  `canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
2760
2774
  `createNextCanopyContext`'s result. See
2761
- [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#sitemap-and-seo-metadata). Every routable entry type is in
2775
+ [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#sitemap-and-seo-metadata). Every routable entry type is in
2762
2776
  the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
2763
2777
  sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
2764
2778
  filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
@@ -2815,7 +2829,7 @@ underscore-prefixed files are skipped.
2815
2829
 
2816
2830
  **What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
2817
2831
  `defaultPathAccess: { read: 'allow' }`
2818
- ([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#public-read-on-server-deployments)).
2832
+ ([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#public-read-on-server-deployments)).
2819
2833
 
2820
2834
  **To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
2821
2835
  consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
@@ -2868,7 +2882,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
2868
2882
  **What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
2869
2883
  gives one template's value type) requires exactly
2870
2884
  one component per block template name when written as an object literal. See
2871
- [Block Component Registries](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#block-component-registries) and
2885
+ [Block Component Registries](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#block-component-registries) and
2872
2886
  `apps/example1/app/components/PostView.tsx`.
2873
2887
 
2874
2888
  ```ts
@@ -2890,7 +2904,7 @@ templates against the schema.
2890
2904
 
2891
2905
  **What changed.** Spreading a `const` field array into several schemas, and nesting
2892
2906
  `defineInlineFieldGroup()` inside a block template, are documented
2893
- ([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
2907
+ ([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
2894
2908
  identity helper for them.
2895
2909
 
2896
2910
  ```ts
@@ -2909,7 +2923,7 @@ field by composing from the same `const` field object.
2909
2923
  A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
2910
2924
  it, and listings do with
2911
2925
  [`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
2912
- (0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#shared--referenced-blocks).
2926
+ (0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#shared--referenced-blocks).
2913
2927
 
2914
2928
  **Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
2915
2929
 
@@ -2931,7 +2945,7 @@ Not retro-documented, apart from these:
2931
2945
 
2932
2946
  #### The registry is keyed by entry-type name (0.0.42)
2933
2947
 
2934
- **What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/e2c1dc9f026d0139864d54ee56e10caf6e98d9b7/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
2948
+ **What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/5c6c8f1378edd82c6c0cd54923dfb2fa1bb4d4d7/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
2935
2949
 
2936
2950
  **To adopt.**
2937
2951
 
@@ -64,6 +64,7 @@ import { formatCanopyPath } from './canopy-path.js';
64
64
  import { itemKeysOnPath, resolveThreadPath, withItemKeys } from '../item-keys.js';
65
65
  import { ENTRY_NOT_LOADED_COMMENT_MESSAGE, NEW_ITEM_COMMENT_MESSAGE, } from './comments/item-anchor-copy.js';
66
66
  import { findFieldTarget, focusFieldTarget } from './field-target.js';
67
+ import { PreviewFollowContext, usePreviewFollow } from './hooks/usePreviewFollow.js';
67
68
  import { UndoToastMessage } from './components/UndoToastMessage.js';
68
69
  import { getNotificationDuration } from './utils/env.js';
69
70
  import { MayHaveLandedError } from './unanswered.js';
@@ -149,7 +150,7 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
149
150
  const commentUserId = userContext?.userId ?? currentUser;
150
151
  // Below 64em (1024px) the editor starts stacked and the content panel never docks.
151
152
  const wideWindow = useMediaQuery('(min-width: 64em)', true, { getInitialValueInEffect: false }) !== false;
152
- const { loaded: layoutLoaded, layout, setLayout, highlightEnabled, setHighlightEnabled, sideSplitPercent, stackedSplitPercent, setSplitPercent, previewWidth, setPreviewWidth, siteChrome, setSiteChrome, contentPanelOpen, setContentPanelOpen, contentPanelWidth, setContentPanelWidth, } = useEditorLayout({
153
+ const { loaded: layoutLoaded, layout, setLayout, highlightEnabled, setHighlightEnabled, previewFollowsForm, setPreviewFollowsForm, sideSplitPercent, stackedSplitPercent, setSplitPercent, previewWidth, setPreviewWidth, siteChrome, setSiteChrome, contentPanelOpen, setContentPanelOpen, contentPanelWidth, setContentPanelWidth, } = useEditorLayout({
153
154
  storageKey: editorLayoutStorageKey(basePath),
154
155
  defaultLayout: wideWindow ? 'side' : 'stacked',
155
156
  });
@@ -388,6 +389,11 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
388
389
  if (branch === branchNameState)
389
390
  void loadComments(branchNameState);
390
391
  };
392
+ const { reveal: previewReveal, follow: followInPreview } = usePreviewFollow({
393
+ enabled: previewFollowsForm,
394
+ branch: branchNameState,
395
+ entryId: currentEntry?.contentId,
396
+ });
391
397
  const { groupsData, groupsLoading, handleSaveGroups, handleSearchUsers, handleGetUserMetadata, handleSearchExternalGroups, } = useGroupManager({ isOpen: groupManagerOpen });
392
398
  // The comments and branches responses name their people, without email; a privileged lookup
393
399
  // adds the email.
@@ -535,9 +541,14 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
535
541
  ]);
536
542
  // A jump into another entry waits for its value to place the thread; the stored path may be stale.
537
543
  const [pendingFieldJump, setPendingFieldJump] = useState(null);
544
+ // A field whose comments are already open is still followed in the preview.
545
+ const jumpToField = (entryPath, canopyPath, threadId) => {
546
+ handleJumpToField(entryPath, canopyPath, threadId);
547
+ followInPreview?.(canopyPath);
548
+ };
538
549
  const jumpToThreadField = (entryPath, canopyPath, threadId) => {
539
550
  if (entryPath === currentEntry?.path) {
540
- handleJumpToField(entryPath, canopyPath, threadId);
551
+ jumpToField(entryPath, canopyPath, threadId);
541
552
  return;
542
553
  }
543
554
  setPendingFieldJump({ entryPath, canopyPath, threadId });
@@ -559,7 +570,8 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
559
570
  if (placed?.onRemovedItem)
560
571
  handleJumpToEntry(entryPath, threadId);
561
572
  else
562
- handleJumpToField(entryPath, placed?.canopyPath ?? canopyPath, threadId);
573
+ jumpToField(entryPath, placed?.canopyPath ?? canopyPath, threadId);
574
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- jumpToField reads this render's follow
563
575
  }, [pendingFieldJump, selectedPath, currentEntry, displayValue, displayComments]);
564
576
  // A thread on an item only the draft has is refused: a discard would leave it on nothing.
565
577
  const handleAddDisplayedComment = async (text, type, entryPath, canopyPath, threadId) => {
@@ -1504,7 +1516,15 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
1504
1516
  if (maximized && !contentPanelDocked)
1505
1517
  setNavigatorOpen(false);
1506
1518
  setPreviewMaximized(maximized);
1507
- }, resizing: paneResizing, siteChrome: siteChrome, onSiteChromeChange: setSiteChrome, onNavigate: openPreviewLink, notice: previewError && (_jsx(Alert, { color: "red", title: "Preview error", withCloseButton: true, onClose: () => setPreviewError(null), radius: 0, children: previewErrorField
1519
+ }, resizing: paneResizing, siteChrome: siteChrome, onSiteChromeChange: setSiteChrome, reveal: previewReveal, previewFollowsForm: previewFollowsForm,
1520
+ // Only beside a form, the one thing it follows.
1521
+ onPreviewFollowsFormChange: !currentEntryUnavailable &&
1522
+ currentEntry?.canEdit !== false &&
1523
+ schema.length > 0 &&
1524
+ // Kept while the next entry loads, so the toolbar never changes under a switch.
1525
+ (displayValue || previewPending)
1526
+ ? setPreviewFollowsForm
1527
+ : undefined, onNavigate: openPreviewLink, notice: previewError && (_jsx(Alert, { color: "red", title: "Preview error", withCloseButton: true, onClose: () => setPreviewError(null), radius: 0, children: previewErrorField
1508
1528
  ? `${previewErrorField}: ${previewError.message}`
1509
1529
  : previewError.message })) })) : (_jsx(Paper, { withBorder: true, shadow: "xs", h: "100%", bg: "var(--mantine-color-body)", style: {
1510
1530
  display: 'flex',
@@ -1654,26 +1674,26 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
1654
1674
  ? 'Setting up your branch workspace…'
1655
1675
  : entriesInitializing
1656
1676
  ? 'Loading content…'
1657
- : 'Select an item to start editing.' })) : currentEntryUnavailable ? (_jsx(UnavailableEntryNotice, { schemaRefs: currentEntry.unavailable ? [currentEntry.unavailable.schemaRef] : [] })) : currentEntry.canEdit === false ? (_jsx(NoEditPermissionNotice, { entryLabel: currentEntry.label })) : schema.length > 0 && displayValue ? (_jsx(EntryLinkContext.Provider, { value: entryLinkContextValue, children: _jsx(SiteMdxAllowContext.Provider, { value: mdxAllow, children: _jsx(FormRenderer, { notice: hiddenDraftNotice && (_jsx(ReadOnlyDraftNotice, { permanentlyReadOnly: (currentBranch?.isProtected ?? true) ||
1658
- currentBranch?.status === 'archived',
1659
- // A hidden draft's discard changes nothing on screen, so it says so.
1660
- onDiscard: () => handleDiscardFileDraft(() => navigatorToggleRef.current, {
1661
- announce: true,
1662
- }) })), fields: schema, value: displayValue, readOnly: contentReadOnly, onRemoved: handleFieldRemoved, savedValue: loadedValue, commentBlockedReason: commentBlockedReason, removedItemFieldLabel: commentFieldLabel, onGetUserMetadata: getCommentUserMetadata, header: {
1663
- title: currentEntry.label,
1664
- typeLabel: entryTypeLabel(activeCollections, currentEntry),
1665
- },
1666
- // The one writer of drafts. Read-only content gets none, whatever a
1667
- // field emits (MDXEditor's mount-time normalisation included).
1668
- onChange: (next) => {
1669
- const contentId = currentEntry?.contentId;
1670
- if (contentId && !contentReadOnlyRef.current) {
1671
- // Every list item keeps a key, whatever field made it.
1672
- const keyed = withItemKeys(schema, next, 'random');
1673
- setDrafts((prev) => ({ ...prev, [contentId]: keyed }));
1674
- }
1675
- }, customRenderers: customRenderers, branch: branchNameState, comments: displayComments, currentEntryPath: selectedPath, currentUserId: commentUserId, canResolve: canResolveAnyComment, focusedFieldPath: focusedFieldPath, highlightThreadId: highlightThreadId, onAddComment: handleAddDisplayedComment, onResolveThread: handleResolveThread, fieldErrors: fieldErrors, format: currentEntry.format, conflictNotice: !!(currentEntry?.contentId &&
1676
- currentBranch?.conflictFiles?.includes(currentEntry.contentId)) }) }) })) : schema.length === 0 ? (_jsx(CenteredMessage, { children: "No fields to edit." })) : loadFailedKey !== `${branchNameState}:${currentEntry.contentId}` ? (_jsx(Stack, { gap: "lg", p: "md", "data-testid": "entry-loading-skeleton", children: [0, 1, 2].map((row) => (_jsxs(Stack, { gap: 6, children: [_jsx(Skeleton, { h: 12, w: 120 }), _jsx(Skeleton, { h: 36 })] }, row))) })) : (_jsx(Alert, { color: "red", variant: "light", m: "md", title: "This entry couldn't be loaded.", "data-testid": "entry-load-failed", children: _jsx(Button, { variant: "default", onClick: () => {
1677
+ : 'Select an item to start editing.' })) : currentEntryUnavailable ? (_jsx(UnavailableEntryNotice, { schemaRefs: currentEntry.unavailable ? [currentEntry.unavailable.schemaRef] : [] })) : currentEntry.canEdit === false ? (_jsx(NoEditPermissionNotice, { entryLabel: currentEntry.label })) : schema.length > 0 && displayValue ? (_jsx(EntryLinkContext.Provider, { value: entryLinkContextValue, children: _jsx(SiteMdxAllowContext.Provider, { value: mdxAllow, children: _jsx(PreviewFollowContext.Provider, { value: followInPreview ?? null, children: _jsx(FormRenderer, { notice: hiddenDraftNotice && (_jsx(ReadOnlyDraftNotice, { permanentlyReadOnly: (currentBranch?.isProtected ?? true) ||
1678
+ currentBranch?.status === 'archived',
1679
+ // A hidden draft's discard changes nothing on screen, so it says so.
1680
+ onDiscard: () => handleDiscardFileDraft(() => navigatorToggleRef.current, {
1681
+ announce: true,
1682
+ }) })), fields: schema, value: displayValue, readOnly: contentReadOnly, onRemoved: handleFieldRemoved, savedValue: loadedValue, commentBlockedReason: commentBlockedReason, removedItemFieldLabel: commentFieldLabel, onGetUserMetadata: getCommentUserMetadata, header: {
1683
+ title: currentEntry.label,
1684
+ typeLabel: entryTypeLabel(activeCollections, currentEntry),
1685
+ },
1686
+ // The one writer of drafts. Read-only content gets none, whatever a
1687
+ // field emits (MDXEditor's mount-time normalisation included).
1688
+ onChange: (next) => {
1689
+ const contentId = currentEntry?.contentId;
1690
+ if (contentId && !contentReadOnlyRef.current) {
1691
+ // Every list item keeps a key, whatever field made it.
1692
+ const keyed = withItemKeys(schema, next, 'random');
1693
+ setDrafts((prev) => ({ ...prev, [contentId]: keyed }));
1694
+ }
1695
+ }, customRenderers: customRenderers, branch: branchNameState, comments: displayComments, currentEntryPath: selectedPath, currentUserId: commentUserId, canResolve: canResolveAnyComment, focusedFieldPath: focusedFieldPath, highlightThreadId: highlightThreadId, onAddComment: handleAddDisplayedComment, onResolveThread: handleResolveThread, fieldErrors: fieldErrors, format: currentEntry.format, conflictNotice: !!(currentEntry?.contentId &&
1696
+ currentBranch?.conflictFiles?.includes(currentEntry.contentId)) }) }) }) })) : schema.length === 0 ? (_jsx(CenteredMessage, { children: "No fields to edit." })) : loadFailedKey !== `${branchNameState}:${currentEntry.contentId}` ? (_jsx(Stack, { gap: "lg", p: "md", "data-testid": "entry-loading-skeleton", children: [0, 1, 2].map((row) => (_jsxs(Stack, { gap: 6, children: [_jsx(Skeleton, { h: 12, w: 120 }), _jsx(Skeleton, { h: 36 })] }, row))) })) : (_jsx(Alert, { color: "red", variant: "light", m: "md", title: "This entry couldn't be loaded.", "data-testid": "entry-load-failed", children: _jsx(Button, { variant: "default", onClick: () => {
1677
1697
  setLoadFailedKey(null);
1678
1698
  setLoadAttempt((attempt) => attempt + 1);
1679
1699
  }, children: "Retry" }) })) }) })] }), overlays: _jsxs(_Fragment, { children: [_jsx(BranchesDrawer, { opened: branchManagerOpen, onClose: () => setBranchManagerOpen(false), confirmOpen: branchConfirmOpen, returnFocusTo: branchReturnTarget, children: _jsx(BranchManager, { startCreating: branchManagerOpening.create, branches: branchSummaries, mode: operatingMode, user: userContext, currentBranchName: currentBranch?.name ?? branchNameState, currentWorkflowBlockedReason: saveAllProgress ? 'Wait for Save all to finish.' : undefined, onSelect: async (name) => {
@@ -4,6 +4,11 @@ export interface PreviewMarks {
4
4
  count: number;
5
5
  paths?: string[];
6
6
  }
7
+ /** A field to bring into view in the preview; a new `id` asks again for the same field. */
8
+ export interface PreviewReveal {
9
+ path: string;
10
+ id: number;
11
+ }
7
12
  /**
8
13
  * What a page's handshake says of the site's header and footer: its ready message says it renders
9
14
  * them for `chrome=1` or that it does not, or no ready message came in `READY_TIMEOUT_MS`.
@@ -15,7 +20,7 @@ export type SiteChromeSupport = 'supported' | 'unsupported' | 'unanswered';
15
20
  * runs until the preview's ready message arrives; when none does, a "Live updates off" chip offers
16
21
  * to reload the preview. While `busy`, the page stays in view, dimmed and inert, under the bar.
17
22
  */
18
- export declare const PreviewFrame: ({ src, path, data, isLoading, className, style, highlightEnabled, onPreviewError, onMarks, assetBase, iframeStyle, onReload, onSiteChrome, onNavigate, busy, }: {
23
+ export declare const PreviewFrame: ({ src, path, data, isLoading, className, style, highlightEnabled, onPreviewError, onMarks, assetBase, iframeStyle, onReload, onSiteChrome, onNavigate, reveal, busy, }: {
19
24
  src: string;
20
25
  path: string;
21
26
  data?: unknown;
@@ -48,4 +53,6 @@ export declare const PreviewFrame: ({ src, path, data, isLoading, className, sty
48
53
  onNavigate?: (href: string) => void;
49
54
  /** The editor is loading the next page's data: this page stays in view, dimmed and inert. */
50
55
  busy?: boolean;
56
+ /** Sent once the page connects, and each time its `id` changes. */
57
+ reveal?: PreviewReveal;
51
58
  }) => import("react/jsx-runtime").JSX.Element;