payload-live-preview 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/dist/adapters/astro/RichText.astro +55 -0
  4. package/dist/adapters/astro/index.cjs +370 -0
  5. package/dist/adapters/astro/index.cjs.map +1 -0
  6. package/dist/adapters/astro/index.d.cts +105 -0
  7. package/dist/adapters/astro/index.d.ts +105 -0
  8. package/dist/adapters/astro/index.js +364 -0
  9. package/dist/adapters/astro/index.js.map +1 -0
  10. package/dist/adapters/astro/middleware-entry.cjs +303 -0
  11. package/dist/adapters/astro/middleware-entry.cjs.map +1 -0
  12. package/dist/adapters/astro/middleware-entry.d.cts +15 -0
  13. package/dist/adapters/astro/middleware-entry.d.ts +15 -0
  14. package/dist/adapters/astro/middleware-entry.js +297 -0
  15. package/dist/adapters/astro/middleware-entry.js.map +1 -0
  16. package/dist/adapters/nextjs/index.cjs +309 -0
  17. package/dist/adapters/nextjs/index.cjs.map +1 -0
  18. package/dist/adapters/nextjs/index.d.cts +75 -0
  19. package/dist/adapters/nextjs/index.d.ts +75 -0
  20. package/dist/adapters/nextjs/index.js +306 -0
  21. package/dist/adapters/nextjs/index.js.map +1 -0
  22. package/dist/adapters/nuxt/index.cjs +299 -0
  23. package/dist/adapters/nuxt/index.cjs.map +1 -0
  24. package/dist/adapters/nuxt/index.d.cts +126 -0
  25. package/dist/adapters/nuxt/index.d.ts +126 -0
  26. package/dist/adapters/nuxt/index.js +294 -0
  27. package/dist/adapters/nuxt/index.js.map +1 -0
  28. package/dist/adapters/sveltekit/index.cjs +275 -0
  29. package/dist/adapters/sveltekit/index.cjs.map +1 -0
  30. package/dist/adapters/sveltekit/index.d.cts +80 -0
  31. package/dist/adapters/sveltekit/index.d.ts +80 -0
  32. package/dist/adapters/sveltekit/index.js +273 -0
  33. package/dist/adapters/sveltekit/index.js.map +1 -0
  34. package/dist/bind-BSgxoQhN.d.cts +1137 -0
  35. package/dist/bind-BSgxoQhN.d.ts +1137 -0
  36. package/dist/codegen-astro.cjs +612 -0
  37. package/dist/codegen-astro.cjs.map +1 -0
  38. package/dist/codegen-astro.d.cts +54 -0
  39. package/dist/codegen-astro.d.ts +54 -0
  40. package/dist/codegen-astro.js +610 -0
  41. package/dist/codegen-astro.js.map +1 -0
  42. package/dist/codegen-cli.cjs +669 -0
  43. package/dist/codegen-cli.cjs.map +1 -0
  44. package/dist/codegen-cli.d.cts +19 -0
  45. package/dist/codegen-cli.d.ts +19 -0
  46. package/dist/codegen-cli.js +667 -0
  47. package/dist/codegen-cli.js.map +1 -0
  48. package/dist/codegen.cjs +551 -0
  49. package/dist/codegen.cjs.map +1 -0
  50. package/dist/codegen.d.cts +162 -0
  51. package/dist/codegen.d.ts +162 -0
  52. package/dist/codegen.js +547 -0
  53. package/dist/codegen.js.map +1 -0
  54. package/dist/core.cjs +3684 -0
  55. package/dist/core.cjs.map +1 -0
  56. package/dist/core.d.cts +24 -0
  57. package/dist/core.d.ts +24 -0
  58. package/dist/core.js +3657 -0
  59. package/dist/core.js.map +1 -0
  60. package/dist/index.cjs +4083 -0
  61. package/dist/index.cjs.map +1 -0
  62. package/dist/index.d.cts +472 -0
  63. package/dist/index.d.ts +472 -0
  64. package/dist/index.js +4040 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/middleware-BwIlf0jW.d.cts +168 -0
  67. package/dist/middleware-BwIlf0jW.d.ts +168 -0
  68. package/dist/payload.cjs +31 -0
  69. package/dist/payload.cjs.map +1 -0
  70. package/dist/payload.d.cts +87 -0
  71. package/dist/payload.d.ts +87 -0
  72. package/dist/payload.js +29 -0
  73. package/dist/payload.js.map +1 -0
  74. package/dist/preview-request-DAvxm18T.d.cts +68 -0
  75. package/dist/preview-request-DAvxm18T.d.ts +68 -0
  76. package/package.json +186 -0
@@ -0,0 +1,472 @@
1
+ import { l as LivePreviewPlugin, e as FieldRenderer } from './bind-BSgxoQhN.cjs';
2
+ export { B as BindOptions, C as CachedElement, a as CspDirectiveMerge, E as EventEmitter, b as EventHandler, F as FieldBindingAttributes, c as FieldName, d as FieldPath, f as FieldTransform, g as FieldType, h as FrameAncestorsOptions, L as LIBRARY_PROTOCOL_VERSION, i as LivePreviewClient, j as LivePreviewClientConfig, k as LivePreviewEventMap, O as OriginDetector, P as PayloadFieldSchema, m as PayloadFieldType, n as PayloadLivePreviewData, o as PayloadLivePreviewMessage, p as PluginContext, q as ProtocolCapability, r as ProtocolNegotiation, R as RenderContext, S as SanitizerDocument, U as Unsubscribe, V as VERSION, s as ValueAt, t as bind, u as bindByPath, v as buildFrameAncestors, w as buildScriptSrcWithNonce, x as detectInitialLocale, y as escapeHtml, z as escapeHtmlAttribute, A as generateCspNonce, D as hasCapability, G as initLivePreview, H as isDevMode, I as isExternalHttpUrl, J as isInIframe, K as isInPopup, M as isInPreviewContext, N as isSafeUrl, Q as mergeCspHeader, T as negotiateProtocol, W as sanitizeHtml, X as setCspCrypto, Y as setSanitizerDocument } from './bind-BSgxoQhN.cjs';
3
+ export { P as PreviewRequestLike, a as PreviewRequestOptions, i as isPreviewRequest } from './preview-request-DAvxm18T.cjs';
4
+
5
+ interface RuntimeBuildInfo {
6
+ readonly generatedAt: string;
7
+ readonly size: number;
8
+ }
9
+
10
+ /**
11
+ * Inline script generator.
12
+ *
13
+ * Wraps the build-time-generated runtime IIFE with consumer-provided
14
+ * configuration. Returns a JavaScript string suitable for embedding
15
+ * via `<script>` in any framework.
16
+ *
17
+ * The runtime body is identical to the one used by the high-level
18
+ * client because both originate from `src/core/runtime.ts`. There is
19
+ * no parallel implementation to drift out of sync.
20
+ *
21
+ * @module @inline/generator
22
+ */
23
+
24
+ interface InlineScriptConfig {
25
+ /** Additional trusted origins to merge with auto-detected ones. */
26
+ readonly allowedOrigins?: readonly string[];
27
+ /**
28
+ * Payload server origin, e.g. `https://cms.example.com`. When set,
29
+ * every incoming update is re-fetched through the Payload REST API
30
+ * (`X-Payload-HTTP-Method-Override: GET`, same strategy as the
31
+ * official client) so relationship and upload fields render
32
+ * populated instead of as bare IDs. Strongly recommended for
33
+ * Payload 3.x. Requires the preview page to be able to reach the
34
+ * API with credentials (same-site cookies or CORS `credentials`).
35
+ */
36
+ readonly serverURL?: string;
37
+ /** REST API route prefix used with `serverURL`. Defaults to `/api`. */
38
+ readonly apiRoute?: string;
39
+ /** Population depth used with `serverURL`. Defaults to `1`. */
40
+ readonly mergeDepth?: number;
41
+ /** Enable verbose console logging. Defaults to `false`. */
42
+ readonly debug?: boolean;
43
+ /** Debounce window for incoming updates in ms. Defaults to `50`. */
44
+ readonly debounceMs?: number;
45
+ /** Enable screen-reader live region. Defaults to `true`. */
46
+ readonly enableA11y?: boolean;
47
+ /**
48
+ * Heartbeat timeout in ms. Defaults to `0` (disabled). The Payload
49
+ * admin only posts messages on form edits — there is no protocol
50
+ * keepalive — so an idle-based timeout would fire spurious
51
+ * disconnects while the editor pauses. Enable only if your admin
52
+ * setup sends periodic messages.
53
+ */
54
+ readonly heartbeatMs?: number;
55
+ /**
56
+ * Bypass the visibility-gate optimisation and apply every update
57
+ * regardless of viewport position. Default `false` — the gate kicks
58
+ * in when the cache exceeds `visibilityGateThreshold` entries.
59
+ */
60
+ readonly disableVisibilityGate?: boolean;
61
+ /**
62
+ * Cache-size threshold above which the visibility gate activates.
63
+ * Default `50`. Off-screen elements above this threshold are queued
64
+ * for replay on intersection instead of being updated immediately.
65
+ */
66
+ readonly visibilityGateThreshold?: number;
67
+ /**
68
+ * `rootMargin` passed to the `IntersectionObserver` watching the
69
+ * cached elements. Default `'200px'`. Increase to pre-render
70
+ * further off-screen content; decrease for tighter visibility.
71
+ */
72
+ readonly intersectionRootMargin?: string;
73
+ /**
74
+ * Opt out of `document.referrer`-based origin auto-detection.
75
+ * Useful when the page is loaded under `Referrer-Policy: no-referrer`
76
+ * and you want predictable behaviour. Default `false`.
77
+ */
78
+ readonly disableReferrerDetection?: boolean;
79
+ /**
80
+ * Opt out of the dev-mode localhost-pattern matcher (any port on
81
+ * `localhost` / `127.0.0.1`). Useful when running locally against
82
+ * a production-like origin list. Default `false`.
83
+ */
84
+ readonly disableLocalhostMatching?: boolean;
85
+ /**
86
+ * Optional CSP nonce for the generated `<script>` tag. When provided
87
+ * via `wrapWithScriptTag()` the nonce is set on the tag. Useful for
88
+ * strict CSP policies that disallow `unsafe-inline`.
89
+ */
90
+ readonly nonce?: string;
91
+ }
92
+ /**
93
+ * Build an inline script body. The result is a self-contained IIFE
94
+ * with the build-time runtime, prefixed by a configuration block.
95
+ *
96
+ * The string does NOT include the `<script>` tags — use
97
+ * `wrapWithScriptTag()` when you need them.
98
+ */
99
+ declare function generateInlineScript(config?: InlineScriptConfig): string;
100
+ /**
101
+ * Wrap an inline script body in a `<script>` tag. When a nonce is
102
+ * provided it is added as the `nonce` attribute so CSP policies that
103
+ * require `'nonce-...'` accept the script.
104
+ */
105
+ declare function wrapWithScriptTag(body: string, options?: {
106
+ nonce?: string;
107
+ }): string;
108
+ /**
109
+ * Snapshot of the build-time information for diagnostics.
110
+ */
111
+ declare function runtimeBuildInfo(): RuntimeBuildInfo;
112
+
113
+ /**
114
+ * Draft-aware document fetching for the initial preview render.
115
+ *
116
+ * The live-preview runtime patches the DOM *after* the page loads —
117
+ * the initial server render is the consumer's job. With Payload
118
+ * drafts enabled, a preview must render the **draft** version on
119
+ * first load, otherwise editors see stale published content until
120
+ * their first keystroke.
121
+ *
122
+ * These helpers wrap the two REST queries every preview loader needs,
123
+ * with the right flags (`draft=true`, `depth`) and an explicit nudge
124
+ * to keep `depth` in sync with the runtime's `mergeDepth` — a
125
+ * mismatch makes populated relationships degrade to IDs after the
126
+ * first edit.
127
+ *
128
+ * Isomorphic and dependency-free: works in Astro frontmatter,
129
+ * SvelteKit `load`, Next.js server components, or any Node/edge
130
+ * runtime with `fetch`.
131
+ *
132
+ * ```ts
133
+ * // Astro frontmatter
134
+ * const page = await fetchPreviewDocument<Page>({
135
+ * serverURL: import.meta.env.PAYLOAD_URL,
136
+ * collection: 'pages',
137
+ * where: { slug: { equals: Astro.params.slug } },
138
+ * draft: isPreviewRequest(Astro.request),
139
+ * headers: { Authorization: `users API-Key ${import.meta.env.PAYLOAD_PREVIEW_KEY}` },
140
+ * });
141
+ * ```
142
+ *
143
+ * @module @preview-fetch
144
+ */
145
+ interface PreviewFetchBaseOptions {
146
+ /** Payload server origin, e.g. `https://cms.example.com`. */
147
+ readonly serverURL: string;
148
+ /** REST API route prefix. Defaults to `/api`. */
149
+ readonly apiRoute?: string;
150
+ /**
151
+ * Population depth. Defaults to `1`. ⚠️ Keep this equal to the
152
+ * runtime's `mergeDepth` — the live-merge re-fetches with that
153
+ * depth, and a mismatch makes nested relationships flip between
154
+ * objects and IDs mid-session.
155
+ */
156
+ readonly depth?: number;
157
+ /**
158
+ * Fetch the draft version. Defaults to `true` (this is a *preview*
159
+ * fetch). Pass the result of `isPreviewRequest(request)` to make
160
+ * the same loader serve published content to normal traffic.
161
+ */
162
+ readonly draft?: boolean;
163
+ /** Locale to fetch. */
164
+ readonly locale?: string;
165
+ /**
166
+ * Extra request headers — typically auth, since draft reads require
167
+ * an authenticated user (e.g. `Authorization: users API-Key …`).
168
+ */
169
+ readonly headers?: Readonly<Record<string, string>>;
170
+ /** Injectable fetch implementation (tests, custom agents). */
171
+ readonly fetchFn?: typeof fetch;
172
+ }
173
+ /** Payload `where` clause — kept loose on purpose (server validates). */
174
+ type PreviewWhere = Readonly<Record<string, unknown>>;
175
+ interface FetchPreviewDocumentOptions extends PreviewFetchBaseOptions {
176
+ /** Collection slug. */
177
+ readonly collection: string;
178
+ /** Fetch a single document by id. Mutually exclusive with `where`. */
179
+ readonly id?: string | number;
180
+ /**
181
+ * Fetch the first document matching this Payload `where` clause,
182
+ * e.g. `{ slug: { equals: 'about' } }`.
183
+ */
184
+ readonly where?: PreviewWhere;
185
+ }
186
+ interface FetchPreviewGlobalOptions extends PreviewFetchBaseOptions {
187
+ /** Global slug. */
188
+ readonly global: string;
189
+ }
190
+ /**
191
+ * Fetch a single collection document (draft-first by default).
192
+ * Returns `null` when nothing matches or the request fails —
193
+ * loaders should fall back to their regular data path or a 404.
194
+ */
195
+ declare function fetchPreviewDocument<T = Record<string, unknown>>(options: FetchPreviewDocumentOptions): Promise<T | null>;
196
+ /**
197
+ * Fetch a global (draft-first by default). Returns `null` on failure.
198
+ */
199
+ declare function fetchPreviewGlobal<T = Record<string, unknown>>(options: FetchPreviewGlobalOptions): Promise<T | null>;
200
+
201
+ /**
202
+ * Generic Lexical node. Concrete renderers consume specific subtypes
203
+ * through narrow type guards in their own modules.
204
+ */
205
+ interface LexicalNode {
206
+ readonly type: string;
207
+ readonly version?: number;
208
+ readonly format?: number | string;
209
+ readonly indent?: number;
210
+ readonly direction?: 'ltr' | 'rtl' | null;
211
+ readonly children?: readonly LexicalNode[];
212
+ readonly text?: string;
213
+ readonly [extra: string]: unknown;
214
+ }
215
+ /**
216
+ * Root of a Lexical document.
217
+ */
218
+ interface LexicalRoot {
219
+ readonly root: {
220
+ readonly type?: string;
221
+ readonly children: readonly LexicalNode[];
222
+ readonly direction?: 'ltr' | 'rtl' | null;
223
+ readonly format?: number | string;
224
+ readonly indent?: number;
225
+ readonly [extra: string]: unknown;
226
+ };
227
+ }
228
+
229
+ /**
230
+ * Top-level Lexical → HTML renderer.
231
+ *
232
+ * Walks the document tree, dispatching each node to the renderer
233
+ * registered for its `type`. Unknown nodes are handled gracefully:
234
+ * children are rendered (so the user sees content), the wrapper is
235
+ * skipped.
236
+ *
237
+ * @module @lexical/render
238
+ */
239
+
240
+ interface LexicalRenderOptions {
241
+ /**
242
+ * When `true` (default), the resulting HTML is passed through the
243
+ * isomorphic `sanitizeHtml()` for defence-in-depth.
244
+ */
245
+ readonly sanitize?: boolean;
246
+ }
247
+ /**
248
+ * Identify whether a value looks like a Lexical root payload.
249
+ */
250
+ declare function isLexicalContent(value: unknown): value is LexicalRoot;
251
+ /**
252
+ * Convert a Lexical root payload to an HTML string. By default the
253
+ * result is sanitised through `sanitizeHtml`. The renderer is
254
+ * security-first; per-node renderers already escape text and validate
255
+ * URLs, but the final sanitiser closes any gap.
256
+ */
257
+ declare function lexicalToHtml(content: LexicalRoot, options?: LexicalRenderOptions): string;
258
+ /**
259
+ * Extract the plain text content of a Lexical document.
260
+ *
261
+ * Paragraphs are separated by `\n`. Used by the text/textarea renderer
262
+ * when a rich-text value is bound to a non-rich-text element.
263
+ */
264
+ declare function lexicalToPlainText(content: LexicalRoot): string;
265
+
266
+ /**
267
+ * Block-renderer sub-registry.
268
+ *
269
+ * Payload's BlocksFeature emits Lexical `block` nodes with a
270
+ * `blockType` slug. The default `block`-node renderer (in
271
+ * `../nodes/block.ts`) only emits a generic
272
+ * `<div data-block-type="…">` — useful as a hook, but unhelpful when
273
+ * the consumer wants out-of-the-box rendering for common block types.
274
+ *
275
+ * This registry maps `blockType` → renderer. Default renderers ship
276
+ * for the most common Payload block patterns (callout, image,
277
+ * video, code, cta). Custom slugs override defaults via
278
+ * `registerBlockRenderer(slug, renderer)`.
279
+ *
280
+ * @module @lexical/blocks/registry
281
+ */
282
+
283
+ /**
284
+ * Context passed to a block renderer. Includes the recursive
285
+ * `renderChildren` function so blocks that house nested Lexical
286
+ * content can delegate back to the main renderer.
287
+ */
288
+ interface BlockRenderContext {
289
+ /** Renders a list of Lexical children to HTML. */
290
+ readonly renderChildren: (children: readonly LexicalNode[]) => string;
291
+ }
292
+ /**
293
+ * Renderer signature. Receives the block node *and* its already-read
294
+ * `fields` payload (the parser pulls these out so individual block
295
+ * renderers don't have to reach into `node['fields']` themselves).
296
+ */
297
+ type BlockRenderer = (fields: Record<string, unknown>, context: BlockRenderContext) => string;
298
+ /** Register or replace the renderer for `blockType`. */
299
+ declare function registerBlockRenderer(blockType: string, renderer: BlockRenderer): void;
300
+
301
+ /**
302
+ * `highlight` plugin — flashes an outline on updated elements so the
303
+ * editor can see what changed.
304
+ *
305
+ * Respects `prefers-reduced-motion`. Adds at most one style tag per
306
+ * document.
307
+ *
308
+ * @module @plugins/built-in/highlight
309
+ */
310
+
311
+ declare const highlightPlugin: LivePreviewPlugin;
312
+
313
+ /**
314
+ * `debug` plugin — logs every lifecycle event via the plugin context.
315
+ *
316
+ * @module @plugins/built-in/debug
317
+ */
318
+
319
+ declare const debugPlugin: LivePreviewPlugin;
320
+
321
+ /**
322
+ * `analytics` plugin — accumulates summary statistics about the
323
+ * update stream. Useful for performance dashboards.
324
+ *
325
+ * The plugin owns its own state (no module singleton) and exposes it
326
+ * via the `getStats` factory passed through the plugin's `init` hook
327
+ * by closing over a local object.
328
+ *
329
+ * @module @plugins/built-in/analytics
330
+ */
331
+
332
+ interface AnalyticsSnapshot {
333
+ readonly updateCount: number;
334
+ readonly totalElements: number;
335
+ readonly totalDurationMs: number;
336
+ readonly averageDurationMs: number;
337
+ }
338
+ declare function createAnalyticsPlugin(): LivePreviewPlugin & {
339
+ readonly getStats: () => AnalyticsSnapshot;
340
+ };
341
+
342
+ /**
343
+ * `documentSave` plugin — react to Payload document-save events with
344
+ * out-of-the-box strategies. Most consumers just want one of these:
345
+ *
346
+ * - `'silent'` (default) → only emit the event, do nothing else.
347
+ * - `'reload'` → reload the page, **preserving the scroll
348
+ * position** across the reload (the
349
+ * framework-agnostic analog of Payload's
350
+ * `RefreshRouteOnSave`).
351
+ * - `'revalidate'` → POST to a revalidation endpoint (Astro,
352
+ * Next.js convention) so SSR caches refresh
353
+ * without losing client state.
354
+ * - `'fetch'` → custom async handler supplied by the user.
355
+ *
356
+ * Each strategy is intentionally narrow so consumers can compose them
357
+ * — e.g. revalidate, then if revalidation fails, fall back to reload.
358
+ *
359
+ * @module @plugins/built-in/document-save
360
+ */
361
+
362
+ type DocumentSaveStrategy = 'silent' | 'reload' | 'revalidate' | 'fetch';
363
+ interface DocumentSavePluginOptions {
364
+ /** Strategy to invoke on each `documentSave` event. Default `'silent'`. */
365
+ readonly strategy?: DocumentSaveStrategy;
366
+ /**
367
+ * For `'revalidate'`: endpoint to POST to. Defaults to `/api/revalidate`.
368
+ * The request body is `{ source: 'payload-live-preview' }` JSON.
369
+ */
370
+ readonly revalidateUrl?: string;
371
+ /**
372
+ * For `'revalidate'`: extra headers (e.g., `Authorization: Bearer …`).
373
+ * The `Content-Type: application/json` header is set automatically.
374
+ */
375
+ readonly revalidateHeaders?: Readonly<Record<string, string>>;
376
+ /**
377
+ * For `'fetch'`: async handler called on each event. The plugin
378
+ * awaits it; rejections are logged but don't crash the runtime.
379
+ */
380
+ readonly handler?: () => void | Promise<void>;
381
+ /**
382
+ * Optional fallback strategy when `'revalidate'` POST fails (network
383
+ * error or non-2xx). Set to `'reload'` to hard-refresh the page when
384
+ * SSR-cache invalidation can't be confirmed.
385
+ */
386
+ readonly onRevalidateFailure?: 'silent' | 'reload';
387
+ }
388
+ /**
389
+ * Build the plugin. Pass it to `client.use(documentSavePlugin({ … }))`.
390
+ */
391
+ declare function documentSavePlugin(options?: DocumentSavePluginOptions): LivePreviewPlugin;
392
+
393
+ /**
394
+ * Field-renderer registry.
395
+ *
396
+ * Maps a `FieldType` to the function that mutates a DOM element with
397
+ * the new value. The registry pattern decouples the lifecycle from the
398
+ * concrete renderers, so:
399
+ *
400
+ * - Tests can substitute mock renderers.
401
+ * - Plugins can register custom renderers via the high-level client.
402
+ * - New field types ship without touching `lifecycle.ts`.
403
+ *
404
+ * The built-in renderers are collected through `registerBuiltinRenderer`
405
+ * from each renderer module. To avoid tree-shaking, the explicit
406
+ * aggregator `buildBuiltinRenderers` accepts an *additional* renderer
407
+ * array — `@field-types/index` invokes it with every concrete renderer
408
+ * so the references stay reachable.
409
+ *
410
+ * @module @field-types/registry
411
+ */
412
+
413
+ /**
414
+ * Register a built-in renderer. Called from each individual renderer
415
+ * module's side-effecting registration.
416
+ */
417
+ declare function registerBuiltinRenderer(renderer: FieldRenderer): void;
418
+
419
+ /**
420
+ * Shared shapes for the field-type renderers.
421
+ *
422
+ * @module @field-types/types
423
+ */
424
+ interface PayloadMedia {
425
+ readonly id?: string | number;
426
+ readonly url?: string;
427
+ readonly alt?: string;
428
+ readonly filename?: string;
429
+ readonly mimeType?: string;
430
+ readonly width?: number;
431
+ readonly height?: number;
432
+ readonly sizes?: Readonly<Record<string, {
433
+ readonly url?: string;
434
+ readonly width?: number;
435
+ readonly height?: number;
436
+ }>>;
437
+ }
438
+ /**
439
+ * Generic relationship payload. The optional `TSlug` parameter is a
440
+ * phantom marker that codegen uses to record the target collection(s)
441
+ * without changing the runtime shape — `PayloadRelationship<'users'>`
442
+ * and `PayloadRelationship<'users' | 'authors'>` behave identically at
443
+ * runtime but carry different types at compile time.
444
+ */
445
+ interface PayloadRelationship<TSlug extends string = string> {
446
+ readonly id?: string | number;
447
+ readonly title?: string;
448
+ readonly name?: string;
449
+ readonly slug?: string;
450
+ readonly url?: string;
451
+ readonly relationTo?: TSlug;
452
+ readonly [extra: string]: unknown;
453
+ }
454
+
455
+ /**
456
+ * Public barrel for built-in field renderers.
457
+ *
458
+ * Each renderer is imported as a named binding (not a side-effect)
459
+ * and assembled into the registry through `buildBuiltinRenderers`.
460
+ * The bundler keeps every reference reachable, so the registry is
461
+ * fully populated at runtime even under `sideEffects: false`.
462
+ *
463
+ * @module @field-types
464
+ */
465
+
466
+ /**
467
+ * Built-in renderer map. Calling this from the runtime adds every
468
+ * concrete renderer to the registry and snapshots the result.
469
+ */
470
+ declare function buildBuiltinRenderers(): Readonly<Record<string, FieldRenderer>>;
471
+
472
+ export { type AnalyticsSnapshot, type BlockRenderContext, type BlockRenderer, type DocumentSavePluginOptions, type DocumentSaveStrategy, type FetchPreviewDocumentOptions, type FetchPreviewGlobalOptions, FieldRenderer, type InlineScriptConfig, type LexicalNode, type LexicalRoot, LivePreviewPlugin, type PayloadMedia, type PayloadRelationship, type PreviewFetchBaseOptions, type PreviewWhere, buildBuiltinRenderers, createAnalyticsPlugin, debugPlugin, documentSavePlugin, fetchPreviewDocument, fetchPreviewGlobal, generateInlineScript, highlightPlugin, isLexicalContent, lexicalToHtml, lexicalToPlainText, registerBlockRenderer, registerBuiltinRenderer, runtimeBuildInfo, wrapWithScriptTag };