payload-live-preview 2.1.2 → 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.
- package/README.md +191 -62
- package/dist/adapters/astro/index.d.ts +7 -7
- package/dist/adapters/astro/index.js +1 -1
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/astro/middleware-entry.d.ts +3 -3
- package/dist/adapters/astro/middleware-entry.js +1 -1
- package/dist/adapters/astro/middleware-entry.js.map +1 -1
- package/dist/adapters/nextjs/index.d.ts +2 -2
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nuxt/index.d.ts +4 -4
- package/dist/adapters/nuxt/index.js +1 -1
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/nuxt/module.d.ts +1 -1
- package/dist/adapters/react/index.d.ts +2 -2
- package/dist/adapters/react/index.js +1 -1
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.d.ts +5 -5
- package/dist/adapters/sveltekit/index.js +1 -1
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/adapters/vue/index.d.ts +2 -2
- package/dist/adapters/vue/index.js +1 -1
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/annotate.d.ts +22 -15
- package/dist/annotate.js +1 -1
- package/dist/annotate.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +114 -114
- package/dist/client.d.ts +114 -114
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/codegen-cli.js +1 -1
- package/dist/codegen-cli.js.map +1 -1
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.d.cts +14 -16
- package/dist/codegen.d.ts +14 -16
- package/dist/codegen.js +1 -1
- package/dist/codegen.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +178 -172
- package/dist/core.d.ts +178 -172
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/doctor-cli.d.ts +1 -1
- package/dist/doctor-cli.js +1 -1
- package/dist/doctor-cli.js.map +1 -1
- package/dist/doctor.d.ts +15 -2
- package/dist/doctor.js +1 -1
- package/dist/doctor.js.map +1 -1
- package/dist/{document-session-DWi9H3Qk.d.ts → document-session-Bkd181PV.d.ts} +3 -2
- package/dist/{fragment-endpoint-B2qcRw5T.d.ts → fragment-endpoint-DGGLIijM.d.ts} +1 -1
- package/dist/fragment.cjs.map +1 -1
- package/dist/fragment.d.cts +3 -3
- package/dist/fragment.d.ts +3 -3
- package/dist/fragment.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +183 -177
- package/dist/index.d.ts +183 -177
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lean.cjs +1 -1
- package/dist/lean.cjs.map +1 -1
- package/dist/lean.js +1 -1
- package/dist/lean.js.map +1 -1
- package/dist/lexical.cjs +1 -1
- package/dist/lexical.cjs.map +1 -1
- package/dist/lexical.js +1 -1
- package/dist/lexical.js.map +1 -1
- package/dist/{locals-B1mF3aTb.d.ts → locals-zz2gi9dj.d.ts} +1 -1
- package/dist/{middleware-BGobLN9P.d.ts → middleware-CI-UTf6R.d.ts} +2 -2
- package/dist/{options-Cm8fC7dj.d.ts → options-CnYybG51.d.ts} +8 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/{probe-DGPDsnbj.d.ts → probe-D-IHg9dF.d.ts} +3 -3
- package/dist/structural.cjs +2 -2
- package/dist/structural.cjs.map +1 -1
- package/dist/structural.d.cts +27 -27
- package/dist/structural.d.ts +27 -27
- package/dist/structural.js +2 -2
- package/dist/structural.js.map +1 -1
- package/package.json +11 -6
package/dist/core.d.ts
CHANGED
|
@@ -91,11 +91,11 @@ declare const DIAGNOSTIC_CODES: Readonly<{
|
|
|
91
91
|
readonly AuditFrameOptionsBlocks: "LP0703";
|
|
92
92
|
/** Binding attributes are served to anonymous visitors. */
|
|
93
93
|
readonly AuditBindingsExposed: "LP0704";
|
|
94
|
-
/** More bindings than the
|
|
94
|
+
/** More bindings than the visibility gate will write eagerly. */
|
|
95
95
|
readonly AuditGateThresholdExceeded: "LP0705";
|
|
96
96
|
/** Owner markers exist, but some bindings are outside all of them. */
|
|
97
97
|
readonly AuditUnownedBindings: "LP0706";
|
|
98
|
-
/** The preview response carries no bindings
|
|
98
|
+
/** The preview response carries no bindings and no fragment boundary. */
|
|
99
99
|
readonly AuditNoBindings: "LP0707";
|
|
100
100
|
/** The URL did not return an HTML page, so nothing else can be judged. */
|
|
101
101
|
readonly AuditNotAPage: "LP0708";
|
|
@@ -113,7 +113,7 @@ declare const DIAGNOSTIC_CODES: Readonly<{
|
|
|
113
113
|
readonly FragmentStrategyUnavailable: "LP0806";
|
|
114
114
|
/** A revision changed a field with no binding; `onUnfaithfulPatch` refreshed the route. */
|
|
115
115
|
readonly UnboundChangeRefresh: "LP0807";
|
|
116
|
-
/** `onUnfaithfulPatch: 'escalate'` found no route or fragment strategy to hand an unfaithful patch to; the page keeps it. */
|
|
116
|
+
/** `onUnfaithfulPatch: 'escalate'` found no route or fragment strategy, or no boundary, to hand an unfaithful patch to; the page keeps it. */
|
|
117
117
|
readonly EscalationUnavailable: "LP0808";
|
|
118
118
|
/** A fragment inserted an Astro island the page cannot start: it never loaded the island element or that client directive. */
|
|
119
119
|
readonly IslandStartUnavailable: "LP0809";
|
|
@@ -190,6 +190,172 @@ type PayloadFieldType = 'text' | 'textarea' | 'richText' | 'email' | 'number' |
|
|
|
190
190
|
/** `admin.condition` is a function in source and cannot cross `postMessage`; modelled, not consumed. */
|
|
191
191
|
type PayloadFieldCondition = (data: unknown, siblingData: unknown) => boolean;
|
|
192
192
|
|
|
193
|
+
/**
|
|
194
|
+
* `'strict'` (default) strips `id`, `name` and `data-payload-*` and passes
|
|
195
|
+
* other `data-*` only via `allowedDataAttributes`; `'compat'` keeps them.
|
|
196
|
+
*/
|
|
197
|
+
type SanitizerPolicyMode = 'compat' | 'strict';
|
|
198
|
+
interface SanitizeOptions {
|
|
199
|
+
/** Overrides the module default set by `setSanitizerPolicy()`. */
|
|
200
|
+
readonly policy?: SanitizerPolicyMode;
|
|
201
|
+
/** `data-*` attributes (full names) that pass under `'strict'`; `data-payload-*` never does. */
|
|
202
|
+
readonly allowedDataAttributes?: readonly string[];
|
|
203
|
+
/**
|
|
204
|
+
* Keep `input`, `button`, `textarea`, `select`, `option` and `label` — only
|
|
205
|
+
* for markup the page author wrote, never for CMS content. `form`,
|
|
206
|
+
* handlers, `style` and unsafe URLs stay dropped.
|
|
207
|
+
*/
|
|
208
|
+
readonly allowFormControls?: boolean;
|
|
209
|
+
/** Extra tags to allow. Lower-case, untrimmed. */
|
|
210
|
+
readonly additionalAllowedTags?: readonly string[];
|
|
211
|
+
/**
|
|
212
|
+
* Extra per-tag attributes, lower-case. Cannot re-admit handlers, `style`,
|
|
213
|
+
* or — under `'strict'` — `id`, `name` and `data-payload-*`.
|
|
214
|
+
*/
|
|
215
|
+
readonly additionalAllowedAttributes?: Readonly<Record<string, readonly string[]>>;
|
|
216
|
+
/**
|
|
217
|
+
* The input is a page-author item template, so `'strict'` keeps the
|
|
218
|
+
* applier's reconciliation attributes (`TEMPLATE_ATTRIBUTES`) and nothing
|
|
219
|
+
* else — every other `data-payload-*` is still stripped, so a template can
|
|
220
|
+
* never add a binding.
|
|
221
|
+
*/
|
|
222
|
+
readonly templateMode?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* The DOM to parse with, for this call: an SSR document such as linkedom's
|
|
225
|
+
* or jsdom's. Wins over `setSanitizerDocument()` and over the global
|
|
226
|
+
* `document`, and two callers with two documents never share one.
|
|
227
|
+
*/
|
|
228
|
+
readonly document?: SanitizerDocument;
|
|
229
|
+
}
|
|
230
|
+
/** The `Document` surface the sanitizer needs; jsdom, linkedom and happy-dom all provide it. */
|
|
231
|
+
interface SanitizerDocument {
|
|
232
|
+
createElement: (tagName: string) => {
|
|
233
|
+
innerHTML: string;
|
|
234
|
+
readonly content: ParentNode;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Supply a `Document` for SSR, e.g. linkedom's `parseHTML(...).document`;
|
|
239
|
+
* `null` clears it, for every entry. The fallback for a call that names no
|
|
240
|
+
* document of its own.
|
|
241
|
+
*
|
|
242
|
+
* @deprecated Since 2.1 a call names its document: `sanitizeHtml(html, { document })`,
|
|
243
|
+
* `lexicalToHtml(content, { document })`. The process-wide slot stays until 3.0
|
|
244
|
+
* (ADR 0007 ledger).
|
|
245
|
+
*/
|
|
246
|
+
declare function setSanitizerDocument(doc: SanitizerDocument | null): void;
|
|
247
|
+
/**
|
|
248
|
+
* Sanitize `html`; malformed input is recovered by the parser first. The
|
|
249
|
+
* result is a fixed point: sanitising it again changes nothing.
|
|
250
|
+
*
|
|
251
|
+
* @throws {SanitizerEnvironmentError} when no DOM is available.
|
|
252
|
+
*/
|
|
253
|
+
declare function sanitizeHtml(html: string, options?: SanitizeOptions): string;
|
|
254
|
+
|
|
255
|
+
/** Types shared by the runtime primitives. */
|
|
256
|
+
|
|
257
|
+
/** Payload's field set plus the DOM-binding categories `html`, `url`, `image` and `structural-array`. */
|
|
258
|
+
type FieldType = PayloadFieldType | 'html' | 'url' | 'image' | 'structural-array';
|
|
259
|
+
/** A namespaced project renderer key, so a typo of a built-in type can never become one. */
|
|
260
|
+
type CustomRendererKey = `${string}:${string}`;
|
|
261
|
+
/** What a renderer may be registered under and an element may ask for. */
|
|
262
|
+
type RendererKey = FieldType | CustomRendererKey;
|
|
263
|
+
/**
|
|
264
|
+
* A project rich-text renderer, shared by SSR and preview. Its output goes
|
|
265
|
+
* through the sanitizer; call the same `sanitizeHtml()` server-side for byte equality.
|
|
266
|
+
*/
|
|
267
|
+
type RichTextRenderer = (value: unknown, context: {
|
|
268
|
+
readonly fieldName: string;
|
|
269
|
+
readonly element: Element;
|
|
270
|
+
readonly locale: string | undefined;
|
|
271
|
+
}) => string;
|
|
272
|
+
/** One registered binding. Several may share a field name when it renders in several places. */
|
|
273
|
+
interface CachedElement {
|
|
274
|
+
/** The bound DOM element. */
|
|
275
|
+
readonly element: Element;
|
|
276
|
+
/** Payload field path, e.g., `title` or `hero.subtitle`. */
|
|
277
|
+
readonly fieldName: string;
|
|
278
|
+
/** Resolved from attributes and tag heuristics; the schema may override it unless explicit. */
|
|
279
|
+
readonly fieldType: RendererKey;
|
|
280
|
+
/** Whether `data-payload-type` set the type, in which case the schema must not override it. */
|
|
281
|
+
readonly explicitFieldType?: boolean;
|
|
282
|
+
/** Fields this binding depends on (`data-payload-depends`); a change in any re-applies it under `skipUnchanged`. */
|
|
283
|
+
readonly dependsOn?: readonly string[];
|
|
284
|
+
/** Raw `data-payload-strategy` value. */
|
|
285
|
+
readonly strategy?: string;
|
|
286
|
+
/** How the runtime brings this binding up to date; `'unknown'` for an unrecognised strategy. Resolved by the cache. */
|
|
287
|
+
readonly strategyKind?: UpdateSource | 'unknown';
|
|
288
|
+
/** Nearest enclosing `data-payload-fragment` boundary. Resolved by the cache. */
|
|
289
|
+
readonly fragmentBoundary?: Element;
|
|
290
|
+
/** `data-payload-boundary`: an anchor that hides itself while its field is empty. */
|
|
291
|
+
readonly hidesWhenEmpty?: boolean;
|
|
292
|
+
/** Write the value into this attribute instead of the content; policed writes. */
|
|
293
|
+
readonly targetAttribute?: string;
|
|
294
|
+
/** Optional sibling-field path bound to the element's `href` attribute. */
|
|
295
|
+
readonly hrefField?: string;
|
|
296
|
+
/** Optional sibling-field path bound to the element's `src` attribute. */
|
|
297
|
+
readonly srcField?: string;
|
|
298
|
+
/** Optional sibling-field path bound to the element's `alt` attribute. */
|
|
299
|
+
readonly altField?: string;
|
|
300
|
+
/** Optional inline template for array/blocks rendering. */
|
|
301
|
+
readonly arrayTemplate?: string;
|
|
302
|
+
/** Optional separator for primitive-array stringification. */
|
|
303
|
+
readonly arraySeparator?: string;
|
|
304
|
+
/** Optional locale code locked onto this element (overrides the global locale). */
|
|
305
|
+
readonly locale?: string;
|
|
306
|
+
/** Raw `data-payload-format`; the date and number renderers read the vocabulary. */
|
|
307
|
+
readonly format?: string;
|
|
308
|
+
/** The document this binding belongs to, from the nearest `data-payload-owner`. */
|
|
309
|
+
readonly owner?: string;
|
|
310
|
+
/**
|
|
311
|
+
* The value an auto-binding matched on (`data-payload-guessed`), for a
|
|
312
|
+
* binding the runtime found by value rather than one the template declared.
|
|
313
|
+
* Absent for a declared binding.
|
|
314
|
+
*/
|
|
315
|
+
readonly guessed?: string;
|
|
316
|
+
}
|
|
317
|
+
/** What a renderer is given; `allFields` lets it resolve a sibling field. */
|
|
318
|
+
interface RenderContext {
|
|
319
|
+
/** Full field map for the current update — used for sibling lookups. */
|
|
320
|
+
readonly allFields: Record<string, unknown>;
|
|
321
|
+
/** Active locale, or `undefined` when none is established. */
|
|
322
|
+
readonly locale: string | undefined;
|
|
323
|
+
/** Optional schema descriptor for the field, when available. */
|
|
324
|
+
readonly schema: PayloadFieldSchema | undefined;
|
|
325
|
+
/** The project's rich-text renderer, when the client was configured with one. */
|
|
326
|
+
readonly renderRichText?: RichTextRenderer;
|
|
327
|
+
/**
|
|
328
|
+
* The Payload server the runtime reads populated documents from (`serverURL`),
|
|
329
|
+
* absent without one. A renderer that writes a URL out of a media document
|
|
330
|
+
* resolves a path against it, as Payload's admin does; the built-in `upload`
|
|
331
|
+
* and `image` renderers do.
|
|
332
|
+
*/
|
|
333
|
+
readonly serverURL?: string;
|
|
334
|
+
/**
|
|
335
|
+
* This instance's sanitizer policy, for every HTML write the renderer makes.
|
|
336
|
+
* Absent, the process default set by `setSanitizerPolicy()` applies.
|
|
337
|
+
*/
|
|
338
|
+
readonly sanitizerPolicy?: SanitizerPolicyMode;
|
|
339
|
+
/**
|
|
340
|
+
* Say that this write cannot reproduce what the server drew, so
|
|
341
|
+
* `onUnfaithfulPatch` can have a strategy render the region instead of
|
|
342
|
+
* leaving a degraded patch on the page. The built-in rich-text renderer
|
|
343
|
+
* calls it for a Lexical block whose markup it had to drop; a project
|
|
344
|
+
* renderer may call it for any value it can only approximate. `reason`
|
|
345
|
+
* completes the sentence 'field "x" …' in LP0411.
|
|
346
|
+
*/
|
|
347
|
+
readonly reportUnfaithful?: (target: CachedElement, reason: string) => void;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* A renderer writes one value into its element. It must not throw: one bad
|
|
351
|
+
* field may not stop an update. The result stays `void` — the internal
|
|
352
|
+
* no-write sentinel is not part of the contract.
|
|
353
|
+
*/
|
|
354
|
+
interface FieldRenderer {
|
|
355
|
+
readonly name: RendererKey;
|
|
356
|
+
render(target: CachedElement, value: unknown, context: RenderContext): void;
|
|
357
|
+
}
|
|
358
|
+
|
|
193
359
|
/**
|
|
194
360
|
* How a bound region is brought up to date: the runtime patches it, a server
|
|
195
361
|
* renders a `data-payload-fragment` boundary from the unsaved form state, or
|
|
@@ -416,172 +582,6 @@ declare class EventEmitter<TMap extends object = LivePreviewEventMap> {
|
|
|
416
582
|
eventNames(): (keyof TMap)[];
|
|
417
583
|
}
|
|
418
584
|
|
|
419
|
-
/**
|
|
420
|
-
* `'strict'` (default) strips `id`, `name` and `data-payload-*` and passes
|
|
421
|
-
* other `data-*` only via `allowedDataAttributes`; `'compat'` keeps them.
|
|
422
|
-
*/
|
|
423
|
-
type SanitizerPolicyMode = 'compat' | 'strict';
|
|
424
|
-
interface SanitizeOptions {
|
|
425
|
-
/** Overrides the module default set by `setSanitizerPolicy()`. */
|
|
426
|
-
readonly policy?: SanitizerPolicyMode;
|
|
427
|
-
/** `data-*` attributes (full names) that pass under `'strict'`; `data-payload-*` never does. */
|
|
428
|
-
readonly allowedDataAttributes?: readonly string[];
|
|
429
|
-
/**
|
|
430
|
-
* Keep `input`, `button`, `textarea`, `select`, `option` and `label` — only
|
|
431
|
-
* for markup the page author wrote, never for CMS content. `form`,
|
|
432
|
-
* handlers, `style` and unsafe URLs stay dropped.
|
|
433
|
-
*/
|
|
434
|
-
readonly allowFormControls?: boolean;
|
|
435
|
-
/** Extra tags to allow. Lower-case, untrimmed. */
|
|
436
|
-
readonly additionalAllowedTags?: readonly string[];
|
|
437
|
-
/**
|
|
438
|
-
* Extra per-tag attributes, lower-case. Cannot re-admit handlers, `style`,
|
|
439
|
-
* or — under `'strict'` — `id`, `name` and `data-payload-*`.
|
|
440
|
-
*/
|
|
441
|
-
readonly additionalAllowedAttributes?: Readonly<Record<string, readonly string[]>>;
|
|
442
|
-
/**
|
|
443
|
-
* The input is a page-author item template, so `'strict'` keeps the
|
|
444
|
-
* applier's reconciliation attributes (`TEMPLATE_ATTRIBUTES`) and nothing
|
|
445
|
-
* else — every other `data-payload-*` is still stripped, so a template can
|
|
446
|
-
* never add a binding.
|
|
447
|
-
*/
|
|
448
|
-
readonly templateMode?: boolean;
|
|
449
|
-
/**
|
|
450
|
-
* The DOM to parse with, for this call: an SSR document such as linkedom's
|
|
451
|
-
* or jsdom's. Wins over `setSanitizerDocument()` and over the global
|
|
452
|
-
* `document`, and two callers with two documents never share one.
|
|
453
|
-
*/
|
|
454
|
-
readonly document?: SanitizerDocument;
|
|
455
|
-
}
|
|
456
|
-
/** The `Document` surface the sanitizer needs; jsdom, linkedom and happy-dom all provide it. */
|
|
457
|
-
interface SanitizerDocument {
|
|
458
|
-
createElement: (tagName: string) => {
|
|
459
|
-
innerHTML: string;
|
|
460
|
-
readonly content: ParentNode;
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Supply a `Document` for SSR, e.g. linkedom's `parseHTML(...).document`;
|
|
465
|
-
* `null` clears it, for every entry. The fallback for a call that names no
|
|
466
|
-
* document of its own.
|
|
467
|
-
*
|
|
468
|
-
* @deprecated Since 2.1 a call names its document: `sanitizeHtml(html, { document })`,
|
|
469
|
-
* `lexicalToHtml(content, { document })`. The process-wide slot stays until 3.0
|
|
470
|
-
* (ADR 0007 ledger).
|
|
471
|
-
*/
|
|
472
|
-
declare function setSanitizerDocument(doc: SanitizerDocument | null): void;
|
|
473
|
-
/**
|
|
474
|
-
* Sanitize `html`; malformed input is recovered by the parser first. The
|
|
475
|
-
* result is a fixed point: sanitising it again changes nothing.
|
|
476
|
-
*
|
|
477
|
-
* @throws {SanitizerEnvironmentError} when no DOM is available.
|
|
478
|
-
*/
|
|
479
|
-
declare function sanitizeHtml(html: string, options?: SanitizeOptions): string;
|
|
480
|
-
|
|
481
|
-
/** Types shared by the runtime primitives. */
|
|
482
|
-
|
|
483
|
-
/** Payload's field set plus the DOM-binding categories `html`, `url`, `image` and `structural-array`. */
|
|
484
|
-
type FieldType = PayloadFieldType | 'html' | 'url' | 'image' | 'structural-array';
|
|
485
|
-
/** A namespaced project renderer key, so a typo of a built-in type can never become one. */
|
|
486
|
-
type CustomRendererKey = `${string}:${string}`;
|
|
487
|
-
/** What a renderer may be registered under and an element may ask for. */
|
|
488
|
-
type RendererKey = FieldType | CustomRendererKey;
|
|
489
|
-
/**
|
|
490
|
-
* A project rich-text renderer, shared by SSR and preview. Its output goes
|
|
491
|
-
* through the sanitizer; call the same `sanitizeHtml()` server-side for byte equality.
|
|
492
|
-
*/
|
|
493
|
-
type RichTextRenderer = (value: unknown, context: {
|
|
494
|
-
readonly fieldName: string;
|
|
495
|
-
readonly element: Element;
|
|
496
|
-
readonly locale: string | undefined;
|
|
497
|
-
}) => string;
|
|
498
|
-
/** One registered binding. Several may share a field name when it renders in several places. */
|
|
499
|
-
interface CachedElement {
|
|
500
|
-
/** The bound DOM element. */
|
|
501
|
-
readonly element: Element;
|
|
502
|
-
/** Payload field path, e.g., `title` or `hero.subtitle`. */
|
|
503
|
-
readonly fieldName: string;
|
|
504
|
-
/** Resolved from attributes and tag heuristics; the schema may override it unless explicit. */
|
|
505
|
-
readonly fieldType: RendererKey;
|
|
506
|
-
/** Whether `data-payload-type` set the type, in which case the schema must not override it. */
|
|
507
|
-
readonly explicitFieldType?: boolean;
|
|
508
|
-
/** Fields this binding depends on (`data-payload-depends`); a change in any re-applies it under `skipUnchanged`. */
|
|
509
|
-
readonly dependsOn?: readonly string[];
|
|
510
|
-
/** Raw `data-payload-strategy` value. */
|
|
511
|
-
readonly strategy?: string;
|
|
512
|
-
/** How the runtime brings this binding up to date; `'unknown'` for an unrecognised strategy. Resolved by the cache. */
|
|
513
|
-
readonly strategyKind?: UpdateSource | 'unknown';
|
|
514
|
-
/** Nearest enclosing `data-payload-fragment` boundary. Resolved by the cache. */
|
|
515
|
-
readonly fragmentBoundary?: Element;
|
|
516
|
-
/** `data-payload-boundary`: an anchor that hides itself while its field is empty. */
|
|
517
|
-
readonly hidesWhenEmpty?: boolean;
|
|
518
|
-
/** Write the value into this attribute instead of the content; policed writes. */
|
|
519
|
-
readonly targetAttribute?: string;
|
|
520
|
-
/** Optional sibling-field path bound to the element's `href` attribute. */
|
|
521
|
-
readonly hrefField?: string;
|
|
522
|
-
/** Optional sibling-field path bound to the element's `src` attribute. */
|
|
523
|
-
readonly srcField?: string;
|
|
524
|
-
/** Optional sibling-field path bound to the element's `alt` attribute. */
|
|
525
|
-
readonly altField?: string;
|
|
526
|
-
/** Optional inline template for array/blocks rendering. */
|
|
527
|
-
readonly arrayTemplate?: string;
|
|
528
|
-
/** Optional separator for primitive-array stringification. */
|
|
529
|
-
readonly arraySeparator?: string;
|
|
530
|
-
/** Optional locale code locked onto this element (overrides the global locale). */
|
|
531
|
-
readonly locale?: string;
|
|
532
|
-
/** Raw `data-payload-format`; the date and number renderers read the vocabulary. */
|
|
533
|
-
readonly format?: string;
|
|
534
|
-
/** The document this binding belongs to, from the nearest `data-payload-owner`. */
|
|
535
|
-
readonly owner?: string;
|
|
536
|
-
/**
|
|
537
|
-
* The value an auto-binding matched on (`data-payload-guessed`), for a
|
|
538
|
-
* binding the runtime found by value rather than one the template declared.
|
|
539
|
-
* Absent for a declared binding.
|
|
540
|
-
*/
|
|
541
|
-
readonly guessed?: string;
|
|
542
|
-
}
|
|
543
|
-
/** What a renderer is given; `allFields` lets it resolve a sibling field. */
|
|
544
|
-
interface RenderContext {
|
|
545
|
-
/** Full field map for the current update — used for sibling lookups. */
|
|
546
|
-
readonly allFields: Record<string, unknown>;
|
|
547
|
-
/** Active locale, or `undefined` when none is established. */
|
|
548
|
-
readonly locale: string | undefined;
|
|
549
|
-
/** Optional schema descriptor for the field, when available. */
|
|
550
|
-
readonly schema: PayloadFieldSchema | undefined;
|
|
551
|
-
/** The project's rich-text renderer, when the client was configured with one. */
|
|
552
|
-
readonly renderRichText?: RichTextRenderer;
|
|
553
|
-
/**
|
|
554
|
-
* The Payload server the runtime reads populated documents from (`serverURL`),
|
|
555
|
-
* absent without one. A renderer that writes a URL out of a media document
|
|
556
|
-
* resolves a path against it, as Payload's admin does; the built-in `upload`
|
|
557
|
-
* and `image` renderers do.
|
|
558
|
-
*/
|
|
559
|
-
readonly serverURL?: string;
|
|
560
|
-
/**
|
|
561
|
-
* This instance's sanitizer policy, for every HTML write the renderer makes.
|
|
562
|
-
* Absent, the process default set by `setSanitizerPolicy()` applies.
|
|
563
|
-
*/
|
|
564
|
-
readonly sanitizerPolicy?: SanitizerPolicyMode;
|
|
565
|
-
/**
|
|
566
|
-
* Say that this write cannot reproduce what the server drew, so
|
|
567
|
-
* `onUnfaithfulPatch` can have a strategy render the region instead of
|
|
568
|
-
* leaving a degraded patch on the page. The built-in rich-text renderer
|
|
569
|
-
* calls it for a Lexical block whose markup it had to drop; a project
|
|
570
|
-
* renderer may call it for any value it can only approximate. `reason`
|
|
571
|
-
* completes the sentence 'field "x" …' in LP0411.
|
|
572
|
-
*/
|
|
573
|
-
readonly reportUnfaithful?: (target: CachedElement, reason: string) => void;
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* A renderer writes one value into its element. It must not throw: one bad
|
|
577
|
-
* field may not stop an update. The result stays `void` — the internal
|
|
578
|
-
* no-write sentinel is not part of the contract.
|
|
579
|
-
*/
|
|
580
|
-
interface FieldRenderer {
|
|
581
|
-
readonly name: RendererKey;
|
|
582
|
-
render(target: CachedElement, value: unknown, context: RenderContext): void;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
585
|
/**
|
|
586
586
|
* Protocol negotiation. A capability is granted either by the version a peer
|
|
587
587
|
* announces or by observation, since the stock Payload admin announces none:
|
|
@@ -869,7 +869,7 @@ interface InspectionFidelity {
|
|
|
869
869
|
readonly canEscalate: boolean;
|
|
870
870
|
/** Bindings reported unfaithful since start — once per element, like LP0411, and under every mode. */
|
|
871
871
|
readonly unfaithful: number;
|
|
872
|
-
/**
|
|
872
|
+
/** How many times one of those was handed to the fragment or route strategy; a later edit hands it again. */
|
|
873
873
|
readonly escalated: number;
|
|
874
874
|
/** The field names behind `unfaithful`, sorted. Cumulative. */
|
|
875
875
|
readonly fields: readonly string[];
|
|
@@ -1259,7 +1259,8 @@ declare function isDevMode(): boolean;
|
|
|
1259
1259
|
/**
|
|
1260
1260
|
* Which admin origins the runtime trusts: explicit ones always, the
|
|
1261
1261
|
* `document.referrer` origin only when none is configured, any localhost port
|
|
1262
|
-
* in development. See docs/security.md §1.
|
|
1262
|
+
* in development. See docs/security.md §1. The handshake goes to the trusted
|
|
1263
|
+
* origins, and to guessed localhost ports only while the browser names no parent.
|
|
1263
1264
|
*/
|
|
1264
1265
|
interface OriginDetectorOptions {
|
|
1265
1266
|
/** Explicit origins to trust. Always allowed. */
|
|
@@ -1284,7 +1285,12 @@ declare class OriginDetector {
|
|
|
1284
1285
|
/** Release the lock (heartbeat timeout) so another allow-listed origin may reconnect. Returns the previous lock. */
|
|
1285
1286
|
unlockOrigin(): string | undefined;
|
|
1286
1287
|
get lockedOrigin(): string | undefined;
|
|
1287
|
-
/**
|
|
1288
|
+
/**
|
|
1289
|
+
* Every origin the `ready` handshake is broadcast to. The localhost pattern
|
|
1290
|
+
* expands to the common dev ports, a guess that costs a console error per
|
|
1291
|
+
* wrong port, so a parent the browser names replaces it: that origin when the
|
|
1292
|
+
* pattern trusts it, none when it is not on localhost.
|
|
1293
|
+
*/
|
|
1288
1294
|
enumerate(): string[];
|
|
1289
1295
|
/** Whether `document.referrer` contributed an origin (absent under `Referrer-Policy: no-referrer`). */
|
|
1290
1296
|
get referrerWasAvailable(): boolean;
|