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/dist/client.d.cts CHANGED
@@ -91,7 +91,7 @@ declare const DIAGNOSTIC_CODES: Readonly<{
91
91
  readonly AuditGateThresholdExceeded: "LP0705";
92
92
  /** Owner markers exist, but some bindings are outside all of them. */
93
93
  readonly AuditUnownedBindings: "LP0706";
94
- /** The preview response carries no bindings at all. */
94
+ /** The preview response carries no bindings and no fragment boundary. */
95
95
  readonly AuditNoBindings: "LP0707";
96
96
  /** The URL did not return an HTML page, so nothing else can be judged. */
97
97
  readonly AuditNotAPage: "LP0708";
@@ -165,6 +165,116 @@ type PayloadFieldType = 'text' | 'textarea' | 'richText' | 'email' | 'number' |
165
165
  /** `admin.condition` is a function in source and cannot cross `postMessage`; modelled, not consumed. */
166
166
  type PayloadFieldCondition = (data: unknown, siblingData: unknown) => boolean;
167
167
 
168
+ /**
169
+ * `'strict'` (default) strips `id`, `name` and `data-payload-*` and passes
170
+ * other `data-*` only via `allowedDataAttributes`; `'compat'` keeps them.
171
+ */
172
+ type SanitizerPolicyMode = 'compat' | 'strict';
173
+
174
+ /** Types shared by the runtime primitives. */
175
+
176
+ /** Payload's field set plus the DOM-binding categories `html`, `url`, `image` and `structural-array`. */
177
+ type FieldType = PayloadFieldType | 'html' | 'url' | 'image' | 'structural-array';
178
+ /** A namespaced project renderer key, so a typo of a built-in type can never become one. */
179
+ type CustomRendererKey = `${string}:${string}`;
180
+ /** What a renderer may be registered under and an element may ask for. */
181
+ type RendererKey = FieldType | CustomRendererKey;
182
+ /**
183
+ * A project rich-text renderer, shared by SSR and preview. Its output goes
184
+ * through the sanitizer; call the same `sanitizeHtml()` server-side for byte equality.
185
+ */
186
+ type RichTextRenderer = (value: unknown, context: {
187
+ readonly fieldName: string;
188
+ readonly element: Element;
189
+ readonly locale: string | undefined;
190
+ }) => string;
191
+ /** One registered binding. Several may share a field name when it renders in several places. */
192
+ interface CachedElement {
193
+ /** The bound DOM element. */
194
+ readonly element: Element;
195
+ /** Payload field path, e.g., `title` or `hero.subtitle`. */
196
+ readonly fieldName: string;
197
+ /** Resolved from attributes and tag heuristics; the schema may override it unless explicit. */
198
+ readonly fieldType: RendererKey;
199
+ /** Whether `data-payload-type` set the type, in which case the schema must not override it. */
200
+ readonly explicitFieldType?: boolean;
201
+ /** Fields this binding depends on (`data-payload-depends`); a change in any re-applies it under `skipUnchanged`. */
202
+ readonly dependsOn?: readonly string[];
203
+ /** Raw `data-payload-strategy` value. */
204
+ readonly strategy?: string;
205
+ /** How the runtime brings this binding up to date; `'unknown'` for an unrecognised strategy. Resolved by the cache. */
206
+ readonly strategyKind?: UpdateSource | 'unknown';
207
+ /** Nearest enclosing `data-payload-fragment` boundary. Resolved by the cache. */
208
+ readonly fragmentBoundary?: Element;
209
+ /** `data-payload-boundary`: an anchor that hides itself while its field is empty. */
210
+ readonly hidesWhenEmpty?: boolean;
211
+ /** Write the value into this attribute instead of the content; policed writes. */
212
+ readonly targetAttribute?: string;
213
+ /** Optional sibling-field path bound to the element's `href` attribute. */
214
+ readonly hrefField?: string;
215
+ /** Optional sibling-field path bound to the element's `src` attribute. */
216
+ readonly srcField?: string;
217
+ /** Optional sibling-field path bound to the element's `alt` attribute. */
218
+ readonly altField?: string;
219
+ /** Optional inline template for array/blocks rendering. */
220
+ readonly arrayTemplate?: string;
221
+ /** Optional separator for primitive-array stringification. */
222
+ readonly arraySeparator?: string;
223
+ /** Optional locale code locked onto this element (overrides the global locale). */
224
+ readonly locale?: string;
225
+ /** Raw `data-payload-format`; the date and number renderers read the vocabulary. */
226
+ readonly format?: string;
227
+ /** The document this binding belongs to, from the nearest `data-payload-owner`. */
228
+ readonly owner?: string;
229
+ /**
230
+ * The value an auto-binding matched on (`data-payload-guessed`), for a
231
+ * binding the runtime found by value rather than one the template declared.
232
+ * Absent for a declared binding.
233
+ */
234
+ readonly guessed?: string;
235
+ }
236
+ /** What a renderer is given; `allFields` lets it resolve a sibling field. */
237
+ interface RenderContext {
238
+ /** Full field map for the current update — used for sibling lookups. */
239
+ readonly allFields: Record<string, unknown>;
240
+ /** Active locale, or `undefined` when none is established. */
241
+ readonly locale: string | undefined;
242
+ /** Optional schema descriptor for the field, when available. */
243
+ readonly schema: PayloadFieldSchema | undefined;
244
+ /** The project's rich-text renderer, when the client was configured with one. */
245
+ readonly renderRichText?: RichTextRenderer;
246
+ /**
247
+ * The Payload server the runtime reads populated documents from (`serverURL`),
248
+ * absent without one. A renderer that writes a URL out of a media document
249
+ * resolves a path against it, as Payload's admin does; the built-in `upload`
250
+ * and `image` renderers do.
251
+ */
252
+ readonly serverURL?: string;
253
+ /**
254
+ * This instance's sanitizer policy, for every HTML write the renderer makes.
255
+ * Absent, the process default set by `setSanitizerPolicy()` applies.
256
+ */
257
+ readonly sanitizerPolicy?: SanitizerPolicyMode;
258
+ /**
259
+ * Say that this write cannot reproduce what the server drew, so
260
+ * `onUnfaithfulPatch` can have a strategy render the region instead of
261
+ * leaving a degraded patch on the page. The built-in rich-text renderer
262
+ * calls it for a Lexical block whose markup it had to drop; a project
263
+ * renderer may call it for any value it can only approximate. `reason`
264
+ * completes the sentence 'field "x" …' in LP0411.
265
+ */
266
+ readonly reportUnfaithful?: (target: CachedElement, reason: string) => void;
267
+ }
268
+ /**
269
+ * A renderer writes one value into its element. It must not throw: one bad
270
+ * field may not stop an update. The result stays `void` — the internal
271
+ * no-write sentinel is not part of the contract.
272
+ */
273
+ interface FieldRenderer {
274
+ readonly name: RendererKey;
275
+ render(target: CachedElement, value: unknown, context: RenderContext): void;
276
+ }
277
+
168
278
  /**
169
279
  * How a bound region is brought up to date: the runtime patches it, a server
170
280
  * renders a `data-payload-fragment` boundary from the unsaved form state, or
@@ -391,116 +501,6 @@ declare class EventEmitter<TMap extends object = LivePreviewEventMap> {
391
501
  eventNames(): (keyof TMap)[];
392
502
  }
393
503
 
394
- /**
395
- * `'strict'` (default) strips `id`, `name` and `data-payload-*` and passes
396
- * other `data-*` only via `allowedDataAttributes`; `'compat'` keeps them.
397
- */
398
- type SanitizerPolicyMode = 'compat' | 'strict';
399
-
400
- /** Types shared by the runtime primitives. */
401
-
402
- /** Payload's field set plus the DOM-binding categories `html`, `url`, `image` and `structural-array`. */
403
- type FieldType = PayloadFieldType | 'html' | 'url' | 'image' | 'structural-array';
404
- /** A namespaced project renderer key, so a typo of a built-in type can never become one. */
405
- type CustomRendererKey = `${string}:${string}`;
406
- /** What a renderer may be registered under and an element may ask for. */
407
- type RendererKey = FieldType | CustomRendererKey;
408
- /**
409
- * A project rich-text renderer, shared by SSR and preview. Its output goes
410
- * through the sanitizer; call the same `sanitizeHtml()` server-side for byte equality.
411
- */
412
- type RichTextRenderer = (value: unknown, context: {
413
- readonly fieldName: string;
414
- readonly element: Element;
415
- readonly locale: string | undefined;
416
- }) => string;
417
- /** One registered binding. Several may share a field name when it renders in several places. */
418
- interface CachedElement {
419
- /** The bound DOM element. */
420
- readonly element: Element;
421
- /** Payload field path, e.g., `title` or `hero.subtitle`. */
422
- readonly fieldName: string;
423
- /** Resolved from attributes and tag heuristics; the schema may override it unless explicit. */
424
- readonly fieldType: RendererKey;
425
- /** Whether `data-payload-type` set the type, in which case the schema must not override it. */
426
- readonly explicitFieldType?: boolean;
427
- /** Fields this binding depends on (`data-payload-depends`); a change in any re-applies it under `skipUnchanged`. */
428
- readonly dependsOn?: readonly string[];
429
- /** Raw `data-payload-strategy` value. */
430
- readonly strategy?: string;
431
- /** How the runtime brings this binding up to date; `'unknown'` for an unrecognised strategy. Resolved by the cache. */
432
- readonly strategyKind?: UpdateSource | 'unknown';
433
- /** Nearest enclosing `data-payload-fragment` boundary. Resolved by the cache. */
434
- readonly fragmentBoundary?: Element;
435
- /** `data-payload-boundary`: an anchor that hides itself while its field is empty. */
436
- readonly hidesWhenEmpty?: boolean;
437
- /** Write the value into this attribute instead of the content; policed writes. */
438
- readonly targetAttribute?: string;
439
- /** Optional sibling-field path bound to the element's `href` attribute. */
440
- readonly hrefField?: string;
441
- /** Optional sibling-field path bound to the element's `src` attribute. */
442
- readonly srcField?: string;
443
- /** Optional sibling-field path bound to the element's `alt` attribute. */
444
- readonly altField?: string;
445
- /** Optional inline template for array/blocks rendering. */
446
- readonly arrayTemplate?: string;
447
- /** Optional separator for primitive-array stringification. */
448
- readonly arraySeparator?: string;
449
- /** Optional locale code locked onto this element (overrides the global locale). */
450
- readonly locale?: string;
451
- /** Raw `data-payload-format`; the date and number renderers read the vocabulary. */
452
- readonly format?: string;
453
- /** The document this binding belongs to, from the nearest `data-payload-owner`. */
454
- readonly owner?: string;
455
- /**
456
- * The value an auto-binding matched on (`data-payload-guessed`), for a
457
- * binding the runtime found by value rather than one the template declared.
458
- * Absent for a declared binding.
459
- */
460
- readonly guessed?: string;
461
- }
462
- /** What a renderer is given; `allFields` lets it resolve a sibling field. */
463
- interface RenderContext {
464
- /** Full field map for the current update — used for sibling lookups. */
465
- readonly allFields: Record<string, unknown>;
466
- /** Active locale, or `undefined` when none is established. */
467
- readonly locale: string | undefined;
468
- /** Optional schema descriptor for the field, when available. */
469
- readonly schema: PayloadFieldSchema | undefined;
470
- /** The project's rich-text renderer, when the client was configured with one. */
471
- readonly renderRichText?: RichTextRenderer;
472
- /**
473
- * The Payload server the runtime reads populated documents from (`serverURL`),
474
- * absent without one. A renderer that writes a URL out of a media document
475
- * resolves a path against it, as Payload's admin does; the built-in `upload`
476
- * and `image` renderers do.
477
- */
478
- readonly serverURL?: string;
479
- /**
480
- * This instance's sanitizer policy, for every HTML write the renderer makes.
481
- * Absent, the process default set by `setSanitizerPolicy()` applies.
482
- */
483
- readonly sanitizerPolicy?: SanitizerPolicyMode;
484
- /**
485
- * Say that this write cannot reproduce what the server drew, so
486
- * `onUnfaithfulPatch` can have a strategy render the region instead of
487
- * leaving a degraded patch on the page. The built-in rich-text renderer
488
- * calls it for a Lexical block whose markup it had to drop; a project
489
- * renderer may call it for any value it can only approximate. `reason`
490
- * completes the sentence 'field "x" …' in LP0411.
491
- */
492
- readonly reportUnfaithful?: (target: CachedElement, reason: string) => void;
493
- }
494
- /**
495
- * A renderer writes one value into its element. It must not throw: one bad
496
- * field may not stop an update. The result stays `void` — the internal
497
- * no-write sentinel is not part of the contract.
498
- */
499
- interface FieldRenderer {
500
- readonly name: RendererKey;
501
- render(target: CachedElement, value: unknown, context: RenderContext): void;
502
- }
503
-
504
504
  /** Connection status and the heartbeat that decides a disconnect. */
505
505
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected';
506
506
 
@@ -720,7 +720,7 @@ interface InspectionFidelity {
720
720
  readonly canEscalate: boolean;
721
721
  /** Bindings reported unfaithful since start — once per element, like LP0411, and under every mode. */
722
722
  readonly unfaithful: number;
723
- /** Of those, how many were handed to the fragment or route strategy. */
723
+ /** How many times one of those was handed to the fragment or route strategy; a later edit hands it again. */
724
724
  readonly escalated: number;
725
725
  /** The field names behind `unfaithful`, sorted. Cumulative. */
726
726
  readonly fields: readonly string[];
package/dist/client.d.ts CHANGED
@@ -91,7 +91,7 @@ declare const DIAGNOSTIC_CODES: Readonly<{
91
91
  readonly AuditGateThresholdExceeded: "LP0705";
92
92
  /** Owner markers exist, but some bindings are outside all of them. */
93
93
  readonly AuditUnownedBindings: "LP0706";
94
- /** The preview response carries no bindings at all. */
94
+ /** The preview response carries no bindings and no fragment boundary. */
95
95
  readonly AuditNoBindings: "LP0707";
96
96
  /** The URL did not return an HTML page, so nothing else can be judged. */
97
97
  readonly AuditNotAPage: "LP0708";
@@ -165,6 +165,116 @@ type PayloadFieldType = 'text' | 'textarea' | 'richText' | 'email' | 'number' |
165
165
  /** `admin.condition` is a function in source and cannot cross `postMessage`; modelled, not consumed. */
166
166
  type PayloadFieldCondition = (data: unknown, siblingData: unknown) => boolean;
167
167
 
168
+ /**
169
+ * `'strict'` (default) strips `id`, `name` and `data-payload-*` and passes
170
+ * other `data-*` only via `allowedDataAttributes`; `'compat'` keeps them.
171
+ */
172
+ type SanitizerPolicyMode = 'compat' | 'strict';
173
+
174
+ /** Types shared by the runtime primitives. */
175
+
176
+ /** Payload's field set plus the DOM-binding categories `html`, `url`, `image` and `structural-array`. */
177
+ type FieldType = PayloadFieldType | 'html' | 'url' | 'image' | 'structural-array';
178
+ /** A namespaced project renderer key, so a typo of a built-in type can never become one. */
179
+ type CustomRendererKey = `${string}:${string}`;
180
+ /** What a renderer may be registered under and an element may ask for. */
181
+ type RendererKey = FieldType | CustomRendererKey;
182
+ /**
183
+ * A project rich-text renderer, shared by SSR and preview. Its output goes
184
+ * through the sanitizer; call the same `sanitizeHtml()` server-side for byte equality.
185
+ */
186
+ type RichTextRenderer = (value: unknown, context: {
187
+ readonly fieldName: string;
188
+ readonly element: Element;
189
+ readonly locale: string | undefined;
190
+ }) => string;
191
+ /** One registered binding. Several may share a field name when it renders in several places. */
192
+ interface CachedElement {
193
+ /** The bound DOM element. */
194
+ readonly element: Element;
195
+ /** Payload field path, e.g., `title` or `hero.subtitle`. */
196
+ readonly fieldName: string;
197
+ /** Resolved from attributes and tag heuristics; the schema may override it unless explicit. */
198
+ readonly fieldType: RendererKey;
199
+ /** Whether `data-payload-type` set the type, in which case the schema must not override it. */
200
+ readonly explicitFieldType?: boolean;
201
+ /** Fields this binding depends on (`data-payload-depends`); a change in any re-applies it under `skipUnchanged`. */
202
+ readonly dependsOn?: readonly string[];
203
+ /** Raw `data-payload-strategy` value. */
204
+ readonly strategy?: string;
205
+ /** How the runtime brings this binding up to date; `'unknown'` for an unrecognised strategy. Resolved by the cache. */
206
+ readonly strategyKind?: UpdateSource | 'unknown';
207
+ /** Nearest enclosing `data-payload-fragment` boundary. Resolved by the cache. */
208
+ readonly fragmentBoundary?: Element;
209
+ /** `data-payload-boundary`: an anchor that hides itself while its field is empty. */
210
+ readonly hidesWhenEmpty?: boolean;
211
+ /** Write the value into this attribute instead of the content; policed writes. */
212
+ readonly targetAttribute?: string;
213
+ /** Optional sibling-field path bound to the element's `href` attribute. */
214
+ readonly hrefField?: string;
215
+ /** Optional sibling-field path bound to the element's `src` attribute. */
216
+ readonly srcField?: string;
217
+ /** Optional sibling-field path bound to the element's `alt` attribute. */
218
+ readonly altField?: string;
219
+ /** Optional inline template for array/blocks rendering. */
220
+ readonly arrayTemplate?: string;
221
+ /** Optional separator for primitive-array stringification. */
222
+ readonly arraySeparator?: string;
223
+ /** Optional locale code locked onto this element (overrides the global locale). */
224
+ readonly locale?: string;
225
+ /** Raw `data-payload-format`; the date and number renderers read the vocabulary. */
226
+ readonly format?: string;
227
+ /** The document this binding belongs to, from the nearest `data-payload-owner`. */
228
+ readonly owner?: string;
229
+ /**
230
+ * The value an auto-binding matched on (`data-payload-guessed`), for a
231
+ * binding the runtime found by value rather than one the template declared.
232
+ * Absent for a declared binding.
233
+ */
234
+ readonly guessed?: string;
235
+ }
236
+ /** What a renderer is given; `allFields` lets it resolve a sibling field. */
237
+ interface RenderContext {
238
+ /** Full field map for the current update — used for sibling lookups. */
239
+ readonly allFields: Record<string, unknown>;
240
+ /** Active locale, or `undefined` when none is established. */
241
+ readonly locale: string | undefined;
242
+ /** Optional schema descriptor for the field, when available. */
243
+ readonly schema: PayloadFieldSchema | undefined;
244
+ /** The project's rich-text renderer, when the client was configured with one. */
245
+ readonly renderRichText?: RichTextRenderer;
246
+ /**
247
+ * The Payload server the runtime reads populated documents from (`serverURL`),
248
+ * absent without one. A renderer that writes a URL out of a media document
249
+ * resolves a path against it, as Payload's admin does; the built-in `upload`
250
+ * and `image` renderers do.
251
+ */
252
+ readonly serverURL?: string;
253
+ /**
254
+ * This instance's sanitizer policy, for every HTML write the renderer makes.
255
+ * Absent, the process default set by `setSanitizerPolicy()` applies.
256
+ */
257
+ readonly sanitizerPolicy?: SanitizerPolicyMode;
258
+ /**
259
+ * Say that this write cannot reproduce what the server drew, so
260
+ * `onUnfaithfulPatch` can have a strategy render the region instead of
261
+ * leaving a degraded patch on the page. The built-in rich-text renderer
262
+ * calls it for a Lexical block whose markup it had to drop; a project
263
+ * renderer may call it for any value it can only approximate. `reason`
264
+ * completes the sentence 'field "x" …' in LP0411.
265
+ */
266
+ readonly reportUnfaithful?: (target: CachedElement, reason: string) => void;
267
+ }
268
+ /**
269
+ * A renderer writes one value into its element. It must not throw: one bad
270
+ * field may not stop an update. The result stays `void` — the internal
271
+ * no-write sentinel is not part of the contract.
272
+ */
273
+ interface FieldRenderer {
274
+ readonly name: RendererKey;
275
+ render(target: CachedElement, value: unknown, context: RenderContext): void;
276
+ }
277
+
168
278
  /**
169
279
  * How a bound region is brought up to date: the runtime patches it, a server
170
280
  * renders a `data-payload-fragment` boundary from the unsaved form state, or
@@ -391,116 +501,6 @@ declare class EventEmitter<TMap extends object = LivePreviewEventMap> {
391
501
  eventNames(): (keyof TMap)[];
392
502
  }
393
503
 
394
- /**
395
- * `'strict'` (default) strips `id`, `name` and `data-payload-*` and passes
396
- * other `data-*` only via `allowedDataAttributes`; `'compat'` keeps them.
397
- */
398
- type SanitizerPolicyMode = 'compat' | 'strict';
399
-
400
- /** Types shared by the runtime primitives. */
401
-
402
- /** Payload's field set plus the DOM-binding categories `html`, `url`, `image` and `structural-array`. */
403
- type FieldType = PayloadFieldType | 'html' | 'url' | 'image' | 'structural-array';
404
- /** A namespaced project renderer key, so a typo of a built-in type can never become one. */
405
- type CustomRendererKey = `${string}:${string}`;
406
- /** What a renderer may be registered under and an element may ask for. */
407
- type RendererKey = FieldType | CustomRendererKey;
408
- /**
409
- * A project rich-text renderer, shared by SSR and preview. Its output goes
410
- * through the sanitizer; call the same `sanitizeHtml()` server-side for byte equality.
411
- */
412
- type RichTextRenderer = (value: unknown, context: {
413
- readonly fieldName: string;
414
- readonly element: Element;
415
- readonly locale: string | undefined;
416
- }) => string;
417
- /** One registered binding. Several may share a field name when it renders in several places. */
418
- interface CachedElement {
419
- /** The bound DOM element. */
420
- readonly element: Element;
421
- /** Payload field path, e.g., `title` or `hero.subtitle`. */
422
- readonly fieldName: string;
423
- /** Resolved from attributes and tag heuristics; the schema may override it unless explicit. */
424
- readonly fieldType: RendererKey;
425
- /** Whether `data-payload-type` set the type, in which case the schema must not override it. */
426
- readonly explicitFieldType?: boolean;
427
- /** Fields this binding depends on (`data-payload-depends`); a change in any re-applies it under `skipUnchanged`. */
428
- readonly dependsOn?: readonly string[];
429
- /** Raw `data-payload-strategy` value. */
430
- readonly strategy?: string;
431
- /** How the runtime brings this binding up to date; `'unknown'` for an unrecognised strategy. Resolved by the cache. */
432
- readonly strategyKind?: UpdateSource | 'unknown';
433
- /** Nearest enclosing `data-payload-fragment` boundary. Resolved by the cache. */
434
- readonly fragmentBoundary?: Element;
435
- /** `data-payload-boundary`: an anchor that hides itself while its field is empty. */
436
- readonly hidesWhenEmpty?: boolean;
437
- /** Write the value into this attribute instead of the content; policed writes. */
438
- readonly targetAttribute?: string;
439
- /** Optional sibling-field path bound to the element's `href` attribute. */
440
- readonly hrefField?: string;
441
- /** Optional sibling-field path bound to the element's `src` attribute. */
442
- readonly srcField?: string;
443
- /** Optional sibling-field path bound to the element's `alt` attribute. */
444
- readonly altField?: string;
445
- /** Optional inline template for array/blocks rendering. */
446
- readonly arrayTemplate?: string;
447
- /** Optional separator for primitive-array stringification. */
448
- readonly arraySeparator?: string;
449
- /** Optional locale code locked onto this element (overrides the global locale). */
450
- readonly locale?: string;
451
- /** Raw `data-payload-format`; the date and number renderers read the vocabulary. */
452
- readonly format?: string;
453
- /** The document this binding belongs to, from the nearest `data-payload-owner`. */
454
- readonly owner?: string;
455
- /**
456
- * The value an auto-binding matched on (`data-payload-guessed`), for a
457
- * binding the runtime found by value rather than one the template declared.
458
- * Absent for a declared binding.
459
- */
460
- readonly guessed?: string;
461
- }
462
- /** What a renderer is given; `allFields` lets it resolve a sibling field. */
463
- interface RenderContext {
464
- /** Full field map for the current update — used for sibling lookups. */
465
- readonly allFields: Record<string, unknown>;
466
- /** Active locale, or `undefined` when none is established. */
467
- readonly locale: string | undefined;
468
- /** Optional schema descriptor for the field, when available. */
469
- readonly schema: PayloadFieldSchema | undefined;
470
- /** The project's rich-text renderer, when the client was configured with one. */
471
- readonly renderRichText?: RichTextRenderer;
472
- /**
473
- * The Payload server the runtime reads populated documents from (`serverURL`),
474
- * absent without one. A renderer that writes a URL out of a media document
475
- * resolves a path against it, as Payload's admin does; the built-in `upload`
476
- * and `image` renderers do.
477
- */
478
- readonly serverURL?: string;
479
- /**
480
- * This instance's sanitizer policy, for every HTML write the renderer makes.
481
- * Absent, the process default set by `setSanitizerPolicy()` applies.
482
- */
483
- readonly sanitizerPolicy?: SanitizerPolicyMode;
484
- /**
485
- * Say that this write cannot reproduce what the server drew, so
486
- * `onUnfaithfulPatch` can have a strategy render the region instead of
487
- * leaving a degraded patch on the page. The built-in rich-text renderer
488
- * calls it for a Lexical block whose markup it had to drop; a project
489
- * renderer may call it for any value it can only approximate. `reason`
490
- * completes the sentence 'field "x" …' in LP0411.
491
- */
492
- readonly reportUnfaithful?: (target: CachedElement, reason: string) => void;
493
- }
494
- /**
495
- * A renderer writes one value into its element. It must not throw: one bad
496
- * field may not stop an update. The result stays `void` — the internal
497
- * no-write sentinel is not part of the contract.
498
- */
499
- interface FieldRenderer {
500
- readonly name: RendererKey;
501
- render(target: CachedElement, value: unknown, context: RenderContext): void;
502
- }
503
-
504
504
  /** Connection status and the heartbeat that decides a disconnect. */
505
505
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected';
506
506
 
@@ -720,7 +720,7 @@ interface InspectionFidelity {
720
720
  readonly canEscalate: boolean;
721
721
  /** Bindings reported unfaithful since start — once per element, like LP0411, and under every mode. */
722
722
  readonly unfaithful: number;
723
- /** Of those, how many were handed to the fragment or route strategy. */
723
+ /** How many times one of those was handed to the fragment or route strategy; a later edit hands it again. */
724
724
  readonly escalated: number;
725
725
  /** The field names behind `unfaithful`, sorted. Cumulative. */
726
726
  readonly fields: readonly string[];