payload-live-preview 2.2.0 → 2.2.1

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 (79) hide show
  1. package/README.md +32 -18
  2. package/dist/adapters/astro/index.js +1 -1
  3. package/dist/adapters/astro/index.js.map +1 -1
  4. package/dist/adapters/astro/middleware-entry.js +1 -1
  5. package/dist/adapters/astro/middleware-entry.js.map +1 -1
  6. package/dist/adapters/nextjs/index.js +1 -1
  7. package/dist/adapters/nextjs/index.js.map +1 -1
  8. package/dist/adapters/nuxt/index.js +1 -1
  9. package/dist/adapters/nuxt/index.js.map +1 -1
  10. package/dist/adapters/react/index.d.ts +2 -2
  11. package/dist/adapters/react/index.js +1 -1
  12. package/dist/adapters/react/index.js.map +1 -1
  13. package/dist/adapters/sveltekit/index.js +1 -1
  14. package/dist/adapters/sveltekit/index.js.map +1 -1
  15. package/dist/adapters/vue/index.d.ts +2 -2
  16. package/dist/adapters/vue/index.js +1 -1
  17. package/dist/adapters/vue/index.js.map +1 -1
  18. package/dist/annotate.d.ts +22 -15
  19. package/dist/annotate.js +1 -1
  20. package/dist/annotate.js.map +1 -1
  21. package/dist/client.cjs +1 -1
  22. package/dist/client.cjs.map +1 -1
  23. package/dist/client.d.cts +112 -112
  24. package/dist/client.d.ts +112 -112
  25. package/dist/client.js +1 -1
  26. package/dist/client.js.map +1 -1
  27. package/dist/codegen-cli.js +1 -1
  28. package/dist/codegen-cli.js.map +1 -1
  29. package/dist/codegen.cjs +1 -1
  30. package/dist/codegen.cjs.map +1 -1
  31. package/dist/codegen.d.cts +14 -16
  32. package/dist/codegen.d.ts +14 -16
  33. package/dist/codegen.js +1 -1
  34. package/dist/codegen.js.map +1 -1
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.cjs.map +1 -1
  37. package/dist/core.d.cts +176 -170
  38. package/dist/core.d.ts +176 -170
  39. package/dist/core.js +1 -1
  40. package/dist/core.js.map +1 -1
  41. package/dist/doctor-cli.d.ts +1 -1
  42. package/dist/doctor-cli.js +1 -1
  43. package/dist/doctor-cli.js.map +1 -1
  44. package/dist/doctor.d.ts +2 -2
  45. package/dist/doctor.js +1 -1
  46. package/dist/doctor.js.map +1 -1
  47. package/dist/{document-session-DWi9H3Qk.d.ts → document-session-Bkd181PV.d.ts} +3 -2
  48. package/dist/fragment.cjs.map +1 -1
  49. package/dist/fragment.d.cts +1 -1
  50. package/dist/fragment.d.ts +1 -1
  51. package/dist/fragment.js.map +1 -1
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.cts +181 -175
  55. package/dist/index.d.ts +181 -175
  56. package/dist/index.js +1 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/lean.cjs +1 -1
  59. package/dist/lean.cjs.map +1 -1
  60. package/dist/lean.js +1 -1
  61. package/dist/lean.js.map +1 -1
  62. package/dist/lexical.cjs +1 -1
  63. package/dist/lexical.cjs.map +1 -1
  64. package/dist/lexical.js +1 -1
  65. package/dist/lexical.js.map +1 -1
  66. package/dist/plugins.cjs +1 -1
  67. package/dist/plugins.cjs.map +1 -1
  68. package/dist/plugins.d.cts +1 -1
  69. package/dist/plugins.d.ts +1 -1
  70. package/dist/plugins.js +1 -1
  71. package/dist/plugins.js.map +1 -1
  72. package/dist/{probe-DpMZ4fOS.d.ts → probe-D-IHg9dF.d.ts} +1 -1
  73. package/dist/structural.cjs +2 -2
  74. package/dist/structural.cjs.map +1 -1
  75. package/dist/structural.d.cts +27 -27
  76. package/dist/structural.d.ts +27 -27
  77. package/dist/structural.js +2 -2
  78. package/dist/structural.js.map +1 -1
  79. package/package.json +7 -6
package/README.md CHANGED
@@ -18,7 +18,7 @@ One runtime serves every framework. The Astro, Next.js, SvelteKit and Nuxt adapt
18
18
 
19
19
  ## Highlights
20
20
 
21
- - **One runtime, every frontend.** One TypeScript runtime compiled to a self-contained inline script of about 44 KB gzip — 36 KB with the lean artifact, 47 to 49 KB once the route or fragment prelude is appended ([docs/options.md](docs/options.md)). The adapters for Astro, Next.js, SvelteKit and Nuxt deliver it; where they decide per request they also authorize the request, merge `frame-ancestors` into your CSP and mark the changed response `private, no-store`. They provide the fragment endpoint and, outside Astro, the route that serves the runtime asset.
21
+ - **One runtime, every frontend.** One TypeScript runtime compiled to a self-contained inline script of about 46 KB gzip — 37 KB with the lean artifact, 48 to 50 KB once the route or fragment prelude is appended ([docs/options.md](docs/options.md)). The adapters for Astro, Next.js, SvelteKit and Nuxt deliver it; where they decide per request they also authorize the request, merge `frame-ancestors` into your CSP and mark the changed response `private, no-store`. They provide the fragment endpoint and, outside Astro, the route that serves the runtime asset.
22
22
  - **Patch, fragment, route.** A binding is patched in place; a `data-payload-fragment` boundary is rendered again by your server from the unsaved form state; a patch that fell short, or a change nothing binds, goes to the fragment render or a route refresh when the page has one ([below](#patch-fragment-route)).
23
23
  - **Delivery.** Inline, or a bootstrap that fetches the content-hashed, SRI-verified runtime only inside a preview (`delivery: 'asset'`; Astro's static equivalent is `mode: 'loader'`). Where something decides per request — Astro's middleware, `await LivePreviewScript(…)` in Next.js, the SvelteKit handle, the Nuxt Nitro plugin — a public visitor receives no script at all ([docs/deployment.md](docs/deployment.md#what-a-public-visitor-pays)).
24
24
  - **Payload 3.x native.** `serverURL` re-fetches the populated document, like the official client, so relationship and upload fields render as content rather than as IDs — but only when an edit needs one: in the DOM runtime, typing into a text field costs no request, and a burst on a relationship costs two requests, at its start and its end, rather than one per keystroke.
@@ -31,13 +31,13 @@ One runtime serves every framework. The Astro, Next.js, SvelteKit and Nuxt adapt
31
31
 
32
32
  ## Compatibility
33
33
 
34
- | Payload | Status | Checked by |
35
- | ------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36
- | 2.x | supported in 2.x; ends with 3.0 | the 2.32.3 wire corpus replayed in CI; real-admin release checks of the DOM runtime and the React and Vue hooks ([docs/testing.md](docs/testing.md#local-release-checks)) |
37
- | 3.x | supported | the real admin on every push (3.92.0, three engines); the 3.85, 3.88 and 3.89 wire corpora replayed in CI |
38
- | 4.x | pre-release, the direction of this package | the 4.0.0-beta.4 wire corpus replayed in CI; the real-admin suite against `payload@beta` every night, as an early warning; a 2.2 release candidate on a site running 4.0.0-beta.4 with Astro 7.4.2 |
34
+ | Payload | Status | Checked by |
35
+ | ------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
36
+ | 2.x | supported in 2.x; ends with 3.0 | the 2.32.3 wire corpus replayed in CI; real-admin release checks of the DOM runtime and the React and Vue hooks ([docs/testing.md](docs/testing.md#local-release-checks)) |
37
+ | 3.x | supported | the real admin on every push (3.92.1, three engines); the 3.85, 3.88 and 3.89 wire corpora replayed in CI |
38
+ | 4.x | pre-release, the direction of this package | the 4.0.0-beta.4 wire corpus replayed in CI; the real-admin suite against `payload@beta` every day, as an early warning; a 2.2 release candidate on a site running 4.0.0-beta.4 with Astro 7.4.2 |
39
39
 
40
- **Payload 4** is where this package is headed. Its pre-releases are followed as they appear, and support becomes official with the stable 4.0 release; until then the nightly run against `payload@beta` warns early and does not gate a release. The Payload 4 pre-release captured so far passes the same protocol checks as the 3.x corpora. As of 4.0.0-beta.4, Payload 4 needs Node 24.22.1 or later, and its admin Next.js 16.4 or later. Payload 2.x support ends with the next major release of this package: 3.0 supports Payload 3.x and 4.x, and every 2.x release keeps supporting Payload 2 ([ADR 0007 ledger, entry 25](docs/architecture/0007-v2-defaults-and-renames-ledger.md#ledger), [Preparing for 3.0](docs/migration.md#preparing-for-30)). Payload 3.x stays supported. The manifest declares `payload` as an optional peer, `^2.0.0 || ^3.0.0 || ^4.0.0-0`: npm never installs it, and a project that has Payload outside that range gets npm's `ERESOLVE` error.
40
+ **Payload 4** is where this package is headed. Its pre-releases are followed as they appear, and support becomes official with the stable 4.0 release; until then the daily run against `payload@beta` warns early and does not gate a release. The Payload 4 pre-release captured so far passes the same protocol checks as the 3.x corpora. As of 4.0.0-beta.4, Payload 4 needs Node 24.22.1 or later, and its admin Next.js 16.4 or a later 16.x release. Payload 2.x support ends with the next major release of this package: 3.0 supports Payload 3.x and 4.x, and every 2.x release keeps supporting Payload 2 ([ADR 0007 ledger, entry 25](docs/architecture/0007-v2-defaults-and-renames-ledger.md#ledger), [Preparing for 3.0](docs/migration.md#preparing-for-30)). Payload 3.x stays supported. The manifest declares `payload` as an optional peer, `^2.0.0 || ^3.0.0 || ^4.0.0-0`: npm never installs it, and a project that has Payload outside that range gets npm's `ERESOLVE` error.
41
41
 
42
42
  What differs between Payload 2, 3 and 4:
43
43
 
@@ -54,22 +54,22 @@ What differs between Payload 2, 3 and 4:
54
54
  | --------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
55
55
  | Astro | >=4.0.0 <8.0.0 | 7.4.2 (chromium, firefox, webkit); 6.x (chromium); 5.x (chromium); 4.x (chromium) |
56
56
  | Next.js | App Router, 15.5 and 16 | 16.4.3 (chromium, firefox, webkit); 15.x (chromium) |
57
- | SvelteKit | 2.x | 2.70.2 (chromium, firefox, webkit) |
57
+ | SvelteKit | 2.x | 2.70.3 (chromium, firefox, webkit) |
58
58
  | Nuxt | 3.x (end of life since 31 July 2026: kept working, not officially supported) | 3.21.11 (chromium, firefox, webkit) |
59
59
 
60
60
  Node >=20.19.0; the unit and integration suites run on Node 20, 22, 24, 26. Every version in the table is what the fixture lockfile or the matrix job installs, checked by `npm run compat:check`.
61
61
 
62
62
  Vite 5 through 8: that is what the supported framework majors install (Astro 7 → 8, Astro 6 → 7, Astro 5 → 6, Astro 4 → 5, SvelteKit 2 → 5/6/7/8, Nuxt 3 → 7), measured 2026-09-06. `npm run compat:check` keeps the devDependency and the fixture lockfiles inside that span; `npm run compat:refresh` re-reads it from the registry.
63
63
 
64
- The framework hooks and fragment renderers run twice on every push: at the floor of each peer range, as unit tests in jsdom that the `hook-matrix` job runs after installing the floors over the lockfile (React 18.0.0, Vue 3.3.0, Svelte 5.0.0), and at what the lockfile installs (React 19.2.8, Vue 3.5.42, Svelte 5.56.9), in the unit tests and the browser suites; the SvelteKit renderer is measured against a component compiled by `svelte/compiler` and rendered by the real `svelte/server`.
64
+ The framework hooks and fragment renderers run twice on every push: at the floor of each peer range, as unit tests in jsdom that the `hook-matrix` job runs after installing the floors over the lockfile (React 18.0.0, Vue 3.3.0, Svelte 5.0.0), and at what the lockfile installs (React 19.3.1, Vue 3.5.44, Svelte 5.57.3), in the unit tests and the browser suites; the SvelteKit renderer is measured against a component compiled by `svelte/compiler` and rendered by the real `svelte/server`.
65
65
 
66
66
  - Payload 2.32.3: wire corpus captured from a real admin and replayed in tests/integration/wire-corpus.test.ts, plus fieldSchemaJSON typing in tests/integration/schema-driven.test.ts; local release checks also exercise the real admin in DOM, React and Vue previews, each in frontend-only and serverURL modes (24 browser cases per variant), and run the React hook and the Vue composable through three lifecycle journeys (9 browser cases per variant) and seven guard journeys (21 browser cases per variant) in development builds; the legacy dependency graph retains upstream audit findings.
67
67
  - Payload 3.85.0: wire corpus captured from a real admin, replayed in tests/integration/wire-corpus.test.ts.
68
68
  - Payload 3.88.0: wire corpus captured from a real admin, replayed in tests/integration/wire-corpus.test.ts.
69
69
  - Payload 3.89.0: wire corpus captured from a real admin, replayed in tests/integration/wire-corpus.test.ts.
70
- - Payload 3.92.0: real admin E2E fixture (examples/payload-backend), run by CI on every push.
70
+ - Payload 3.92.1: real admin E2E fixture (examples/payload-backend), run by CI on every push.
71
71
  - Payload 4.0.0-beta.4: wire corpus captured on 2026-10-26 from a real Payload 4 admin (examples/payload-backend with payload@4.0.0-beta.4 installed over it, Node 24.22.1), replayed in tests/integration/wire-corpus.test.ts; the fixture itself stays on 3.x.
72
- - Payload 4.0.0-beta.4 (pre-release): measured once on 2026-10-24, outside CI, in a consumer project that runs 2.1.0 from npm (Next 16, Node 24, Postgres 18, the real admin driven by headless Chromium). The config plugin type-checks against Payload's declarations and passes its config sanitizing. For six collection documents in two locales, the admin's preview frame loads the URL a hand-written callback produced, apart from the order of the query parameters, with the same breakpoint menu and no page errors, and the locale reaches the path resolvers. Against an admin with a `csrf` list, the `payload-session` strategy authorizes once its `origin` option is set. That run did not cover globals, the create screen, drafts and autosave, other plugins that write a Live Preview URL, or replacing existing breakpoints. Since 2026-10-25 the nightly protocol watch installs payload@beta into the admin fixture as a soft-fail early warning.
72
+ - Payload 4.0.0-beta.4 (pre-release): measured once on 2026-10-24, outside CI, in a consumer project that runs 2.1.0 from npm (Next 16, Node 24, Postgres 18, the real admin driven by headless Chromium). The config plugin type-checks against Payload's declarations and passes its config sanitizing. For six collection documents in two locales, the admin's preview frame loads the URL a hand-written callback produced, apart from the order of the query parameters, with the same breakpoint menu and no page errors, and the locale reaches the path resolvers. Against an admin with a `csrf` list, the `payload-session` strategy authorizes once its `origin` option is set. That run did not cover globals, the create screen, drafts and autosave, other plugins that write a Live Preview URL, or replacing existing breakpoints. Since 2026-10-25 the daily protocol watch installs payload@beta into the admin fixture as a soft-fail early warning.
73
73
  - Payload 4.0.0-beta.4 with Astro 7.4.2 (pre-release): measured on 2026-10-26, outside CI, with a 2.2 release candidate on a consumer site (the real admin driven by headless Chromium). Typing into a title and a text line patched the preview, typing into a rich-text field updated it through 7 fragment renders that answered 200, the frame never reloaded, and all 31 live-preview messages had the shape of the recorded capture. Relationship and upload population were not part of the run.
74
74
  - Payload latest: daily protocol watch executes @payloadcms/live-preview@latest against the corpus.
75
75
  - Payload 4.0 pre-releases: daily protocol watch against @payloadcms/live-preview@beta and the real admin against payload@beta, early warning only.
@@ -80,7 +80,7 @@ Nuxt 4 has no row because no CI job installs it. A copy of the Nuxt example in N
80
80
 
81
81
  SvelteKit 3 has no row either: no CI job installs it. A copy of the SvelteKit example, moved to SvelteKit 3.1.0 with `npx sv migrate sveltekit-3`, built with adapter-node 6 and passed the 32 SvelteKit cases of the browser suite against the mock admin in Chromium, Firefox and WebKit on 2026-10-26; it was not a real-admin run. The example needed the migration's changes ([docs/sveltekit.md](docs/sveltekit.md)); the package needed none.
82
82
 
83
- **A client-rendered app takes a hook.** `useLivePreviewDocument()` from `payload-live-preview/react` or `payload-live-preview/vue` returns the merged document and re-renders your tree. Payload 3 updates use the method-override merge request; Payload 2 scalar updates settle locally and raw relationships use schema-based collection GETs. A newer update aborts any request in flight; an HTTP error is refused instead of becoming the document; each hook has a session of its own, so two previews on one page keep their own documents ([docs/react.md](docs/react.md), [docs/vue.md](docs/vue.md)). The official [`@payloadcms/live-preview-react`](https://payloadcms.com/docs/live-preview/client) / `-vue` hooks ship in lockstep with Payload and remain the safe default if that matters more to you; running either alongside the DOM runtime on one page: [docs/interop.md](docs/interop.md).
83
+ **A client-rendered app takes a hook.** `useLivePreviewDocument()` from `payload-live-preview/react` or `payload-live-preview/vue` returns the merged document and re-renders your tree. Payload 3 updates use the method-override merge request; Payload 2 scalar updates settle locally and raw relationships use schema-based collection GETs. A newer update aborts any request in flight; an HTTP error is refused instead of becoming the document; each hook keeps its own state, requests and errors, and every hook on the page follows the document the admin sends, whichever one it started from ([docs/react.md](docs/react.md), [docs/vue.md](docs/vue.md)). The official [`@payloadcms/live-preview-react`](https://payloadcms.com/docs/live-preview/client) / `-vue` hooks ship in lockstep with Payload and remain the safe default if that matters more to you; running either alongside the DOM runtime on one page: [docs/interop.md](docs/interop.md).
84
84
 
85
85
  ## Install
86
86
 
@@ -128,7 +128,7 @@ transform run after any plugin that may write a Live Preview URL in Payload's
128
128
  effective execution order, or compose both routing policies explicitly. The
129
129
  complete merge and conflict rules are in [docs/payload.md](docs/payload.md).
130
130
 
131
- In the Payload 3.92.0 admin, a collection document gets its native Live
131
+ In the Payload 3.92.1 admin, a collection document gets its native Live
132
132
  Preview after its first save. The create screen has no preview toggle and no
133
133
  frame, for a function-valued URL and for a fixed string alike. The frame that
134
134
  appears after the save loads the URL the plugin's function builds from the saved
@@ -336,7 +336,7 @@ Without a server to render it — on a static build, for one — the fields are
336
336
  <img data-payload-field="hero" alt="…" src="…" />
337
337
  ```
338
338
 
339
- Which to reach for, and what each costs: [docs/bindings.md](docs/bindings.md#how-much-markup-this-actually-needs). `pll-codegen annotate` adds the unambiguous bindings and names each one it refuses, with the reason; without `--write` it only reports, and exits with `3` when it found work.
339
+ Which to reach for, and what each costs: [docs/bindings.md](docs/bindings.md#how-much-markup-this-actually-needs). `pll-codegen annotate` adds the unambiguous bindings and names each one it refuses, with the reason; without `--write` it only reports, and exits with `3` when it found work and with `2` when the config yields no collection or global.
340
340
 
341
341
  That is it: the runtime detects the admin's iframe and starts patching. Rich text is written from the value shape, and a value that holds an upload or a relationship has the runtime ask Payload to fill it in ([docs/renderers.md](docs/renderers.md#media-urls)). The admin posts raw form values, so relationship and upload fields arrive as IDs until `serverURL` with `mergeDepth` re-fetches the populated document ([docs/options.md](docs/options.md)). Authorization and the initial draft read: your framework's guide and [docs/authorization.md](docs/authorization.md).
342
342
 
@@ -355,7 +355,19 @@ Astro also writes the runtime into a static build (`inline`, `loader`). Its `Ric
355
355
 
356
356
  ## Patch, fragment, route
357
357
 
358
- A binding is patched in place by default. A `data-payload-fragment` boundary is rendered by your server from the unsaved form state instead — conditional sections, derived values, custom blocks, the component's own logic — and morphed into the page. Compatible retained nodes keep their focus and live properties; a node that changes kind, loses its pairing or crosses an ownership boundary is replaced and loses that state. The runtime posts the fields to the same-origin endpoint named in `fragments: { endpoint }`, built with `createFragmentEndpoint()`, which every adapter entry exports — Astro renders through its container API, Next.js through `react-dom/server`, SvelteKit through `svelte/server`, Nuxt through `vue/server-renderer` — and patches the boundary's own bindings when the server cannot render. With `routeStrategy: true` or `fragments` set, a binding in `<head>`, or one marked `data-payload-strategy="route"`, refreshes the whole route once per revision. The route morph follows the same retention rule and restores focus after a retained keyed move; it does not promise state for replaced nodes. Without either strategy the binding is patched like any other. The route is matched by top-level field name, so a dotted binding such as `meta.title` refreshes it only with `data-payload-depends="meta"`. Markup, endpoint, deployment requirements and the abuse model: [docs/hybrid.md](docs/hybrid.md).
358
+ Who renders what, and from which data:
359
+
360
+ | What updates | Who renders it | From | What it cannot do |
361
+ | ----------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
362
+ | A bound element (patch) | the runtime, in the preview frame | the unsaved values; with `serverURL`, Payload fills in relationships and uploads | create a section the template leaves out, or run a component's logic |
363
+ | A boundary, Astro | your server, through Astro's container API | the unsaved values | — |
364
+ | A boundary, Next.js | your server, `renderToString()` from `react-dom/server` | the unsaved values | await its own data: one synchronous component, with no App Router context around it (no layout, no provider) |
365
+ | A boundary, SvelteKit | your server, `render()` from `svelte/server` | the unsaved values | write the head: only its `body` is delivered |
366
+ | A boundary, Nuxt | your server, a Vue SSR app of its own per render | the unsaved values | call Nuxt's app composables (`useHead()`, `useNuxtApp()`) |
367
+ | The route | your server, an ordinary GET of the page, or the router's own refresh | the saved document | show unsaved values outside the bindings: the result is `partial`, and the runtime writes the unsaved values back into the bindings it reaches |
368
+ | A hook's tree | React or Vue, in the browser | the merged document from `useLivePreviewDocument()` | — |
369
+
370
+ A binding is patched in place by default. A `data-payload-fragment` boundary is rendered by your server from the unsaved form state instead — conditional sections, derived values, custom blocks, the component's own logic — and morphed into the page. Compatible retained nodes keep their focus and live properties; a node that changes kind, loses its pairing or crosses an ownership boundary is replaced and loses that state. The runtime posts the fields to the same-origin endpoint named in `fragments: { endpoint }`, built with `createFragmentEndpoint()`, which every adapter entry exports, and patches the boundary's own bindings when the server cannot render. With `routeStrategy: true` or `fragments` set, a binding in `<head>`, or one marked `data-payload-strategy="route"`, refreshes the whole route once per revision. The route morph follows the same retention rule and restores focus after a retained keyed move; it does not promise state for replaced nodes. Without either strategy the binding is patched like any other. The route is matched by top-level field name, so a dotted binding such as `meta.title` refreshes it only with `data-payload-depends="meta"`. Markup, endpoint, deployment requirements and the abuse model: [docs/hybrid.md](docs/hybrid.md).
359
371
 
360
372
  Custom elements are protected from fragment, route and structural morphs by
361
373
  default. Add the opt-in attribute `data-payload-morph` to a custom element in
@@ -381,8 +393,10 @@ and nested protected descendants remain protected. Ordinary elements are unchang
381
393
  The morph makes the host's attributes and light DOM match the server's markup,
382
394
  so what a component added to its own host or built inside it is removed or
383
395
  replaced on the next update (the state attributes `open`, `value`, `checked` and
384
- `selected` are left alone unless the template names them). Keep markup a
385
- component owns in its shadow root, or mark it `data-payload-owned`. Components
396
+ `selected` are left alone unless the template names them). That includes
397
+ `popover`, `popovertarget` or `hidden` set by an enhancement script; render
398
+ them on the server in the preview instead. Keep markup a component owns in its
399
+ shadow root, or mark it `data-payload-owned`. Components
386
400
  must react to child changes, refresh cached references, preserve UI state, and
387
401
  clean up listeners or observers. `connectedCallback` does not rerun for child
388
402
  updates; DOM moves can still reconnect a retained host. Consumers may emit the
@@ -421,7 +435,7 @@ Full details in [docs/security.md](docs/security.md). Report vulnerabilities per
421
435
  - **The preview iframe refuses to load.** The host sets `X-Frame-Options` or a restrictive `frame-ancestors`. The adapters merge `frame-ancestors` on authorized preview responses, and browsers frame by that directive alone; an `X-Frame-Options: DENY` from a proxy still blocks a preview response that has none, so it must go there.
422
436
  - **The adapter refuses the configuration.** The strict default needs `authorizePreview`, a non-empty `allowedOrigins` (`https:` in production) and no referer trust; the deprecated `defaults: 'v1'` stages a migration one row at a time, and `pll migrate` writes out the rows it stands for.
423
437
 
424
- `inspect()` readings, `pll doctor` and every diagnostic code: [docs/troubleshooting.md](docs/troubleshooting.md). `pll doctor` sends its preview request with `?preview=true`; a preview behind `authorizePreview` is audited with an editor's credential. A signed token goes in the URL as `?previewToken=…`, which the visitor request drops; `--header "x-preview-token: …"` works only where the token strategy sets `transport: { kind: 'header' }`; a Payload session is `--header "Cookie: payload-token=…"`.
438
+ `inspect()` readings, `pll doctor` and every diagnostic code: [docs/troubleshooting.md](docs/troubleshooting.md). `pll doctor` sends its preview request with `?preview=true`; a preview behind `authorizePreview` is audited with an editor's credential. A signed token goes in the URL as `?previewToken=$PREVIEW_TOKEN`, which the visitor request drops; `--header "x-preview-token: $PREVIEW_TOKEN"` works only where the token strategy sets `transport: { kind: 'header' }`; a Payload session is `--header "Cookie: payload-token=$PAYLOAD_TOKEN"`. Keep the credential in an environment variable and run `node_modules/.bin/pll`, not `npx pll`, which prints the whole command line.
425
439
 
426
440
  ## Documentation
427
441