payload-live-preview 2.0.6 → 2.1.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 +148 -38
- package/dist/adapters/astro/FragmentBridge.astro +25 -0
- package/dist/adapters/astro/PreviewBoundary.astro +2 -4
- package/dist/adapters/astro/RichText.astro +26 -5
- package/dist/adapters/astro/index.d.ts +41 -9
- 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 +17 -12
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nuxt/index.d.ts +11 -6
- package/dist/adapters/nuxt/index.js +1 -1
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/nuxt/module.d.ts +64 -13
- package/dist/adapters/nuxt/module.js +1 -1
- package/dist/adapters/nuxt/module.js.map +1 -1
- package/dist/adapters/react/index.d.ts +11 -7
- package/dist/adapters/react/index.js +1 -1
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.d.ts +10 -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 +10 -7
- package/dist/adapters/vue/index.js +1 -1
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/annotate.d.ts +15 -2
- 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 +367 -266
- package/dist/client.d.ts +367 -266
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/codegen-cli.js.map +1 -1
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.d.cts +7 -1
- package/dist/codegen.d.ts +7 -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 +549 -393
- package/dist/core.d.ts +549 -393
- 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 +2 -2
- package/dist/doctor.js +1 -1
- package/dist/doctor.js.map +1 -1
- package/dist/{document-session-BfBfLVpg.d.ts → document-session-DWi9H3Qk.d.ts} +7 -0
- package/dist/{fragment-endpoint-DATKU183.d.ts → fragment-endpoint-B2qcRw5T.d.ts} +22 -7
- package/dist/fragment.cjs +1 -1
- package/dist/fragment.cjs.map +1 -1
- package/dist/fragment.d.cts +37 -16
- package/dist/fragment.d.ts +37 -16
- package/dist/fragment.js +1 -1
- 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 +607 -405
- package/dist/index.d.ts +607 -405
- 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.d.cts +5 -2
- package/dist/lean.d.ts +5 -2
- 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.d.cts +32 -11
- package/dist/lexical.d.ts +32 -11
- package/dist/lexical.js +1 -1
- package/dist/lexical.js.map +1 -1
- package/dist/{locals-CNUGYbA_.d.ts → locals-B1mF3aTb.d.ts} +1 -1
- package/dist/{middleware-CWObDO37.d.ts → middleware-BGobLN9P.d.ts} +11 -5
- package/dist/migrate.js +1 -1
- package/dist/migrate.js.map +1 -1
- package/dist/{options-uHKrDM2U.d.ts → options-Cm8fC7dj.d.ts} +31 -1
- package/dist/payload.cjs +1 -1
- package/dist/payload.cjs.map +1 -1
- package/dist/payload.d.cts +18 -2
- package/dist/payload.d.ts +18 -2
- package/dist/payload.js +1 -1
- package/dist/payload.js.map +1 -1
- package/dist/plugin.cjs +2 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +30 -0
- package/dist/plugin.d.ts +30 -0
- package/dist/plugin.js +2 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.cts +102 -29
- package/dist/plugins.d.ts +102 -29
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/{probe-Bzm4fYFL.d.ts → probe-DGPDsnbj.d.ts} +6 -2
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +51 -7
- package/dist/server.d.ts +51 -7
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/structural.cjs +2 -2
- package/dist/structural.cjs.map +1 -1
- package/dist/structural.d.cts +61 -13
- package/dist/structural.d.ts +61 -13
- package/dist/structural.js +2 -2
- package/dist/structural.js.map +1 -1
- package/package.json +33 -4
package/dist/client.d.ts
CHANGED
|
@@ -1,256 +1,3 @@
|
|
|
1
|
-
/** Connection status and the heartbeat that decides a disconnect. */
|
|
2
|
-
type ConnectionStatus = 'disconnected' | 'connecting' | 'connected';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Shape of the `inspect()` snapshot. It only re-reads what the page already
|
|
6
|
-
* shows — origins from the injected script, field names from the DOM,
|
|
7
|
-
* counters derived from both — so it stays available in production, where a
|
|
8
|
-
* misbehaving preview is exactly the case worth diagnosing. Reading one
|
|
9
|
-
* performs no I/O and transmits nothing.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/** Origin trust as the runtime currently sees it. */
|
|
13
|
-
interface InspectionOrigins {
|
|
14
|
-
/** Configured origins; empty means the referrer and localhost heuristics decide instead. */
|
|
15
|
-
readonly trusted: readonly string[];
|
|
16
|
-
/** The origin locked onto by the first accepted update; every other is then refused. */
|
|
17
|
-
readonly locked: string | undefined;
|
|
18
|
-
}
|
|
19
|
-
/** Protocol versions and the capabilities they enable. */
|
|
20
|
-
interface InspectionProtocol {
|
|
21
|
-
/** This library's protocol version. */
|
|
22
|
-
readonly ours: number;
|
|
23
|
-
/** The remote party's version, or `undefined` if it never announced one. */
|
|
24
|
-
readonly theirs: number | undefined;
|
|
25
|
-
/** `min(ours, theirs ?? 1)` — what both sides actually share. */
|
|
26
|
-
readonly negotiated: number;
|
|
27
|
-
/** Capability flags enabled at the negotiated version. */
|
|
28
|
-
readonly capabilities: readonly string[];
|
|
29
|
-
/** The subset of `capabilities` seen on the wire rather than granted by version. */
|
|
30
|
-
readonly observed: readonly string[];
|
|
31
|
-
/** The Payload profile the observed capabilities imply: `unknown`, `payload-2` or `payload-3`. */
|
|
32
|
-
readonly profile: string;
|
|
33
|
-
}
|
|
34
|
-
/** Revision accounting for the update pipeline. */
|
|
35
|
-
interface InspectionRevisions {
|
|
36
|
-
/** Updates accepted since the runtime started. */
|
|
37
|
-
readonly accepted: number;
|
|
38
|
-
/**
|
|
39
|
-
* Updates that were still in flight when a newer one arrived and were
|
|
40
|
-
* therefore abandoned. A number that tracks `accepted` closely means the
|
|
41
|
-
* editor is out-typing the pipeline, which is normal; it is only a problem
|
|
42
|
-
* when the last update is among the abandoned ones.
|
|
43
|
-
*/
|
|
44
|
-
readonly superseded: number;
|
|
45
|
-
/**
|
|
46
|
-
* Updates whose scheduled writes reached the DOM. What is neither
|
|
47
|
-
* superseded nor completed is in flight or was cancelled; a `superseded`
|
|
48
|
-
* that tracks `accepted` while `completed` stays low is the editor
|
|
49
|
-
* out-typing the pipeline.
|
|
50
|
-
*/
|
|
51
|
-
readonly completed: number;
|
|
52
|
-
/**
|
|
53
|
-
* Bindings not scheduled because their value was identical to the one last
|
|
54
|
-
* applied. Cumulative since start; always `0` unless `skipUnchanged` is on.
|
|
55
|
-
* A large number beside a small `accepted` is the optimisation working.
|
|
56
|
-
*/
|
|
57
|
-
readonly skippedUnchanged: number;
|
|
58
|
-
/** Revision currently in flight, or `undefined` when the pipeline is idle. */
|
|
59
|
-
readonly active: number | undefined;
|
|
60
|
-
}
|
|
61
|
-
/** What the DOM offers the runtime to write into. */
|
|
62
|
-
interface InspectionBindings {
|
|
63
|
-
/** Elements carrying a binding. */
|
|
64
|
-
readonly elements: number;
|
|
65
|
-
/** Distinct field names across those elements. */
|
|
66
|
-
readonly fields: number;
|
|
67
|
-
/** Those field names, sorted. */
|
|
68
|
-
readonly fieldNames: readonly string[];
|
|
69
|
-
/**
|
|
70
|
-
* Bound fields some update carried no value for, so the binding kept its old
|
|
71
|
-
* text — why a binding can stay stale while its siblings update. Cumulative.
|
|
72
|
-
*/
|
|
73
|
-
readonly absentFields: readonly string[];
|
|
74
|
-
/**
|
|
75
|
-
* Field names that arrived but matched no binding — a markup problem.
|
|
76
|
-
* A name in neither this list nor `fieldNames` was never sent. Cumulative.
|
|
77
|
-
*/
|
|
78
|
-
readonly orphanFields: readonly string[];
|
|
79
|
-
/** Whether `scopeBindingsByOwner` is active. */
|
|
80
|
-
readonly ownerScoped: boolean;
|
|
81
|
-
/** Distinct document owners currently on the page, sorted. */
|
|
82
|
-
readonly owners: readonly string[];
|
|
83
|
-
/**
|
|
84
|
-
* Bindings the runtime found by value on the connection's first message
|
|
85
|
-
* (`autoBind: 'unique'`, ADR 0014), sorted by field, each with the value it
|
|
86
|
-
* matched on and the attribute it matched in — `undefined` for a text match.
|
|
87
|
-
* These are the elements that change without a `data-payload-field` in the
|
|
88
|
-
* template; every one of them carries `data-payload-guessed` in the DOM.
|
|
89
|
-
*/
|
|
90
|
-
readonly guessed: readonly {
|
|
91
|
-
readonly field: string;
|
|
92
|
-
readonly matched: string;
|
|
93
|
-
readonly attribute: string | undefined;
|
|
94
|
-
}[];
|
|
95
|
-
/** `autoBind` as configured, and what the one search cost; `searchMs` is `undefined` until it ran. */
|
|
96
|
-
readonly autoBind: {
|
|
97
|
-
readonly mode: 'off' | 'unique';
|
|
98
|
-
readonly searchMs: number | undefined;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
/** Scheduler work in progress. */
|
|
102
|
-
interface InspectionScheduler {
|
|
103
|
-
/** Writes buffered for the next flush. */
|
|
104
|
-
readonly pending: number;
|
|
105
|
-
/** Writes held back offscreen above `visibilityGateThreshold`; applied when scrolled into view. */
|
|
106
|
-
readonly deferred: number;
|
|
107
|
-
/** The binding count above which the visibility gate starts deferring. */
|
|
108
|
-
readonly visibilityGateThreshold: number;
|
|
109
|
-
/** Whether the binding count is above that threshold right now. */
|
|
110
|
-
readonly visibilityGateActive: boolean;
|
|
111
|
-
/** Stats of the most recent flush, or `undefined` if none has run. */
|
|
112
|
-
readonly lastFlush: {
|
|
113
|
-
readonly applied: number;
|
|
114
|
-
/** Which fields the flush wrote; a count alone cannot say a binding was skipped. */
|
|
115
|
-
readonly appliedFields: readonly string[];
|
|
116
|
-
readonly deferred: number;
|
|
117
|
-
readonly durationMs: number;
|
|
118
|
-
} | undefined;
|
|
119
|
-
}
|
|
120
|
-
/** A point-in-time read; plain values only, with no references into runtime internals. */
|
|
121
|
-
interface LivePreviewInspection {
|
|
122
|
-
/** Package version that produced this snapshot. */
|
|
123
|
-
readonly version: string;
|
|
124
|
-
/** Whether the runtime is started, and whether it has been destroyed. */
|
|
125
|
-
readonly started: boolean;
|
|
126
|
-
/** Connection status as reported to the `connect`/`disconnect` events. */
|
|
127
|
-
readonly status: ConnectionStatus;
|
|
128
|
-
readonly origins: InspectionOrigins;
|
|
129
|
-
readonly protocol: InspectionProtocol;
|
|
130
|
-
readonly revisions: InspectionRevisions;
|
|
131
|
-
readonly bindings: InspectionBindings;
|
|
132
|
-
readonly scheduler: InspectionScheduler;
|
|
133
|
-
/** Field types with a registered renderer, sorted. */
|
|
134
|
-
readonly renderers: readonly string[];
|
|
135
|
-
/** Registered plugins and their live registrations; empty on a bare runtime. */
|
|
136
|
-
readonly plugins: readonly PluginInspection[];
|
|
137
|
-
/** Server-rendered fragment boundaries: whether a handler exists and what happened to renders. */
|
|
138
|
-
readonly fragments: InspectionFragments;
|
|
139
|
-
/** Route refreshes: whether a strategy exists, how many ran, failed, were paced, or were stopped by the loop guard. */
|
|
140
|
-
readonly route: InspectionRoute;
|
|
141
|
-
/** Patches the runtime knew could not match the server's render, and what became of them. */
|
|
142
|
-
readonly fidelity: InspectionFidelity;
|
|
143
|
-
/**
|
|
144
|
-
* Whether the page declared a framework that hydrates it, and how far the
|
|
145
|
-
* wait for its first commit — React's, or Vue's mount — got (ADR 0015).
|
|
146
|
-
* `waiting` is why a preview on a Next or Nuxt page is not connected yet;
|
|
147
|
-
* `timed-out` is LP0607.
|
|
148
|
-
*/
|
|
149
|
-
readonly hydration: {
|
|
150
|
-
readonly mode: 'off' | 'react' | 'vue';
|
|
151
|
-
readonly state: 'idle' | 'waiting' | 'committed' | 'timed-out';
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* The fidelity verdicts as `inspect()` reports them (LP0411). A positive
|
|
156
|
-
* `unfaithful` beside `escalated: 0` is a page that keeps a degraded patch —
|
|
157
|
-
* because `mode` says so, or because `canEscalate` is false: neither
|
|
158
|
-
* `fragments.handler` nor `route.handler` is there to escalate to, which the
|
|
159
|
-
* runtime also says once as LP0808 when `mode` is `'escalate'`.
|
|
160
|
-
*/
|
|
161
|
-
interface InspectionFidelity {
|
|
162
|
-
/** `onUnfaithfulPatch` as resolved from both of its names. */
|
|
163
|
-
readonly mode: 'ignore' | 'warn' | 'escalate';
|
|
164
|
-
/** Whether a fragment or route strategy exists for `'escalate'` to hand a patch to. */
|
|
165
|
-
readonly canEscalate: boolean;
|
|
166
|
-
/** Bindings reported unfaithful since start — once per element, like LP0411, and under every mode. */
|
|
167
|
-
readonly unfaithful: number;
|
|
168
|
-
/** Of those, how many were handed to the fragment or route strategy. */
|
|
169
|
-
readonly escalated: number;
|
|
170
|
-
/** The field names behind `unfaithful`, sorted. Cumulative. */
|
|
171
|
-
readonly fields: readonly string[];
|
|
172
|
-
}
|
|
173
|
-
/** The route strategy as `inspect()` reports it. */
|
|
174
|
-
interface InspectionRoute {
|
|
175
|
-
readonly handler: boolean;
|
|
176
|
-
readonly refreshes: number;
|
|
177
|
-
/** Refreshes that broke: the request, the answer, or the morph. */
|
|
178
|
-
readonly failed: number;
|
|
179
|
-
/**
|
|
180
|
-
* Refreshes the strategy's own minimum interval held back (LP0805). Each is
|
|
181
|
-
* run once the window closes unless a newer revision takes its place, so this
|
|
182
|
-
* counts pacing and not loss — and it is deliberately not `failed`.
|
|
183
|
-
*/
|
|
184
|
-
readonly refused: number;
|
|
185
|
-
/** Second refresh requests for one revision, refused with LP0805. */
|
|
186
|
-
readonly loopStopped: number;
|
|
187
|
-
}
|
|
188
|
-
/** The fragment strategy as `inspect()` reports it. */
|
|
189
|
-
interface InspectionFragments {
|
|
190
|
-
/** Whether a fragment handler is configured; without one, boundaries are patched. */
|
|
191
|
-
readonly handler: boolean;
|
|
192
|
-
readonly inFlight: number;
|
|
193
|
-
readonly rendered: number;
|
|
194
|
-
readonly failed: number;
|
|
195
|
-
readonly superseded: number;
|
|
196
|
-
}
|
|
197
|
-
/** One plugin as `inspect().plugins` reports it. */
|
|
198
|
-
interface PluginInspection {
|
|
199
|
-
readonly name: string;
|
|
200
|
-
readonly version: string | undefined;
|
|
201
|
-
/** `initializing` while `init` runs, `active` afterwards, `tearing-down` while `destroy` runs. */
|
|
202
|
-
readonly state: 'initializing' | 'active' | 'tearing-down';
|
|
203
|
-
/** Live registrations owned by the plugin's scope, by kind. */
|
|
204
|
-
readonly registrations: {
|
|
205
|
-
readonly transforms: number;
|
|
206
|
-
readonly renderers: number;
|
|
207
|
-
readonly subscriptions: number;
|
|
208
|
-
readonly cleanups: number;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/** Payload's `DocumentEvent` shape (admin `providers/DocumentEvents`). */
|
|
213
|
-
interface PayloadDocumentEventDetail {
|
|
214
|
-
readonly entitySlug: string;
|
|
215
|
-
readonly operation?: 'create' | 'update';
|
|
216
|
-
readonly id?: string | number;
|
|
217
|
-
readonly updatedAt?: string;
|
|
218
|
-
readonly [extra: string]: unknown;
|
|
219
|
-
}
|
|
220
|
-
/** A validated update as events expose it. */
|
|
221
|
-
interface PayloadLivePreviewData {
|
|
222
|
-
readonly fields: Record<string, unknown>;
|
|
223
|
-
readonly schema?: readonly PayloadFieldSchema[];
|
|
224
|
-
readonly globalSlug?: string;
|
|
225
|
-
readonly collectionSlug?: string;
|
|
226
|
-
readonly locale?: string;
|
|
227
|
-
}
|
|
228
|
-
/** The subset of Payload's field schema the runtime reads; extra properties are kept opaquely. */
|
|
229
|
-
interface PayloadFieldSchema {
|
|
230
|
-
readonly name: string;
|
|
231
|
-
readonly type: PayloadFieldType;
|
|
232
|
-
readonly label?: string;
|
|
233
|
-
readonly required?: boolean;
|
|
234
|
-
readonly localized?: boolean;
|
|
235
|
-
readonly fields?: readonly PayloadFieldSchema[];
|
|
236
|
-
readonly blocks?: readonly PayloadBlockSchema[];
|
|
237
|
-
readonly relationTo?: string | readonly string[];
|
|
238
|
-
readonly hasMany?: boolean;
|
|
239
|
-
readonly admin?: {
|
|
240
|
-
readonly condition?: PayloadFieldCondition;
|
|
241
|
-
};
|
|
242
|
-
readonly [extra: string]: unknown;
|
|
243
|
-
}
|
|
244
|
-
interface PayloadBlockSchema {
|
|
245
|
-
readonly slug: string;
|
|
246
|
-
readonly fields: readonly PayloadFieldSchema[];
|
|
247
|
-
readonly [extra: string]: unknown;
|
|
248
|
-
}
|
|
249
|
-
/** Payload's core field types. `tabs` is a structural container; `group` flattens. */
|
|
250
|
-
type PayloadFieldType = 'text' | 'textarea' | 'richText' | 'email' | 'number' | 'checkbox' | 'date' | 'select' | 'radio' | 'array' | 'blocks' | 'group' | 'tabs' | 'row' | 'collapsible' | 'relationship' | 'upload' | 'point' | 'json' | 'code' | 'ui';
|
|
251
|
-
/** `admin.condition` is a function in source and cannot cross `postMessage`; modelled, not consumed. */
|
|
252
|
-
type PayloadFieldCondition = (data: unknown, siblingData: unknown) => boolean;
|
|
253
|
-
|
|
254
1
|
/**
|
|
255
2
|
* Every diagnostic code the runtime and tools emit, so a consumer can branch
|
|
256
3
|
* on `e.code` instead of matching message text. A code is never reused for a
|
|
@@ -330,13 +77,13 @@ declare const DIAGNOSTIC_CODES: Readonly<{
|
|
|
330
77
|
readonly StartupFailed: "LP0605";
|
|
331
78
|
/** Sending the ready handshake failed. */
|
|
332
79
|
readonly ReadyFailed: "LP0606";
|
|
333
|
-
/** The page declared hydration, but no React commit or
|
|
80
|
+
/** The page declared hydration, but no React commit, Vue mount or SvelteKit mount came within the cap; the runtime started without waiting. */
|
|
334
81
|
readonly HydrationWaitTimedOut: "LP0607";
|
|
335
82
|
/** The audit found no runtime in a response that carried preview intent. */
|
|
336
83
|
readonly AuditRuntimeMissing: "LP0701";
|
|
337
84
|
/** The preview response declares no `frame-ancestors`. */
|
|
338
85
|
readonly AuditNoFrameAncestors: "LP0702";
|
|
339
|
-
/** `X-Frame-Options` forbids framing
|
|
86
|
+
/** `X-Frame-Options` forbids framing on a response that declares no `frame-ancestors`; `SAMEORIGIN` forbids it from another origin only. */
|
|
340
87
|
readonly AuditFrameOptionsBlocks: "LP0703";
|
|
341
88
|
/** Binding attributes are served to anonymous visitors. */
|
|
342
89
|
readonly AuditBindingsExposed: "LP0704";
|
|
@@ -364,6 +111,10 @@ declare const DIAGNOSTIC_CODES: Readonly<{
|
|
|
364
111
|
readonly UnboundChangeRefresh: "LP0807";
|
|
365
112
|
/** `onUnfaithfulPatch: 'escalate'` found no route or fragment strategy to hand an unfaithful patch to; the page keeps it. */
|
|
366
113
|
readonly EscalationUnavailable: "LP0808";
|
|
114
|
+
/** A fragment inserted an Astro island the page cannot start: it never loaded the island element or that client directive. */
|
|
115
|
+
readonly IslandStartUnavailable: "LP0809";
|
|
116
|
+
/** The host's route refresh returned no promise, so the revision was re-applied before the host committed. */
|
|
117
|
+
readonly RouteRefreshUnconfirmed: "LP0810";
|
|
367
118
|
/** A readiness row is not yet at its 2.0 value; `pll doctor --v2` reports it. */
|
|
368
119
|
readonly V2ReadinessGap: "LP0709";
|
|
369
120
|
/** The preview runtime is served to anonymous visitors, not only inside the admin frame. */
|
|
@@ -372,6 +123,48 @@ declare const DIAGNOSTIC_CODES: Readonly<{
|
|
|
372
123
|
/** A diagnostic code, as it appears in log output and on the `error` event. */
|
|
373
124
|
type DiagnosticCode = (typeof DIAGNOSTIC_CODES)[keyof typeof DIAGNOSTIC_CODES];
|
|
374
125
|
|
|
126
|
+
/** Payload's `DocumentEvent` shape (admin `providers/DocumentEvents`). */
|
|
127
|
+
interface PayloadDocumentEventDetail {
|
|
128
|
+
readonly entitySlug: string;
|
|
129
|
+
readonly operation?: 'create' | 'update';
|
|
130
|
+
readonly id?: string | number;
|
|
131
|
+
readonly updatedAt?: string;
|
|
132
|
+
readonly [extra: string]: unknown;
|
|
133
|
+
}
|
|
134
|
+
/** A validated update as events expose it. */
|
|
135
|
+
interface PayloadLivePreviewData {
|
|
136
|
+
readonly fields: Record<string, unknown>;
|
|
137
|
+
readonly schema?: readonly PayloadFieldSchema[];
|
|
138
|
+
readonly globalSlug?: string;
|
|
139
|
+
readonly collectionSlug?: string;
|
|
140
|
+
readonly locale?: string;
|
|
141
|
+
}
|
|
142
|
+
/** The subset of Payload's field schema the runtime reads; extra properties are kept opaquely. */
|
|
143
|
+
interface PayloadFieldSchema {
|
|
144
|
+
readonly name: string;
|
|
145
|
+
readonly type: PayloadFieldType;
|
|
146
|
+
readonly label?: string;
|
|
147
|
+
readonly required?: boolean;
|
|
148
|
+
readonly localized?: boolean;
|
|
149
|
+
readonly fields?: readonly PayloadFieldSchema[];
|
|
150
|
+
readonly blocks?: readonly PayloadBlockSchema[];
|
|
151
|
+
readonly relationTo?: string | readonly string[];
|
|
152
|
+
readonly hasMany?: boolean;
|
|
153
|
+
readonly admin?: {
|
|
154
|
+
readonly condition?: PayloadFieldCondition;
|
|
155
|
+
};
|
|
156
|
+
readonly [extra: string]: unknown;
|
|
157
|
+
}
|
|
158
|
+
interface PayloadBlockSchema {
|
|
159
|
+
readonly slug: string;
|
|
160
|
+
readonly fields: readonly PayloadFieldSchema[];
|
|
161
|
+
readonly [extra: string]: unknown;
|
|
162
|
+
}
|
|
163
|
+
/** Payload's core field types. `tabs` is a structural container; `group` flattens. */
|
|
164
|
+
type PayloadFieldType = 'text' | 'textarea' | 'richText' | 'email' | 'number' | 'checkbox' | 'date' | 'select' | 'radio' | 'array' | 'blocks' | 'group' | 'tabs' | 'row' | 'collapsible' | 'relationship' | 'upload' | 'point' | 'json' | 'code' | 'ui';
|
|
165
|
+
/** `admin.condition` is a function in source and cannot cross `postMessage`; modelled, not consumed. */
|
|
166
|
+
type PayloadFieldCondition = (data: unknown, siblingData: unknown) => boolean;
|
|
167
|
+
|
|
375
168
|
/**
|
|
376
169
|
* How a bound region is brought up to date: the runtime patches it, a server
|
|
377
170
|
* renders a `data-payload-fragment` boundary from the unsaved form state, or
|
|
@@ -395,9 +188,9 @@ interface FragmentContext {
|
|
|
395
188
|
readonly signal: AbortSignal;
|
|
396
189
|
/** Whether this revision is still the current one. */
|
|
397
190
|
readonly isCurrent: () => boolean;
|
|
398
|
-
/** Morph server-rendered HTML into a boundary (Trusted Types and the keyed morph apply). */
|
|
191
|
+
/** Morph server-rendered HTML into a boundary; no-op after supersession (Trusted Types and the keyed morph apply). */
|
|
399
192
|
readonly morph: (boundary: Element, html: string) => void;
|
|
400
|
-
/** Patch the boundary's
|
|
193
|
+
/** Patch the boundary's owned bindings from this revision; no-op after supersession. */
|
|
401
194
|
readonly patch: (boundary: Element) => void;
|
|
402
195
|
/** Debug log through the runtime's logger, with the diagnostic code. */
|
|
403
196
|
readonly log: (code: DiagnosticCode, detail: string) => void;
|
|
@@ -422,8 +215,13 @@ interface FragmentStrategy {
|
|
|
422
215
|
interface RouteContext {
|
|
423
216
|
readonly revision: number;
|
|
424
217
|
readonly receivedAt: number;
|
|
425
|
-
/** Aborted when a newer revision
|
|
218
|
+
/** Aborted when a newer revision asks for a refresh of its own, a navigation commits, or the runtime stops. */
|
|
426
219
|
readonly signal: AbortSignal;
|
|
220
|
+
/**
|
|
221
|
+
* Whether the refresh may still land. A newer revision that asks for no
|
|
222
|
+
* refresh of its own does not end it: the route is the server's, so the
|
|
223
|
+
* refresh lands for that revision, which the runtime then re-applies.
|
|
224
|
+
*/
|
|
427
225
|
readonly isCurrent: () => boolean;
|
|
428
226
|
readonly log: (code: DiagnosticCode, detail: string) => void;
|
|
429
227
|
/**
|
|
@@ -436,18 +234,30 @@ interface RouteContext {
|
|
|
436
234
|
readonly retryAfter?: (delayMs: number) => void;
|
|
437
235
|
}
|
|
438
236
|
/**
|
|
439
|
-
* What one refresh did. `
|
|
440
|
-
*
|
|
441
|
-
*
|
|
237
|
+
* What one refresh did. `refreshed` asserts that the strategy rendered the
|
|
238
|
+
* current unsaved revision. `partial` completed a render whose data source was
|
|
239
|
+
* not proven current; the runtime still reapplies every binding it can reach.
|
|
240
|
+
* `refused` is the strategy's own brake and not a failure.
|
|
442
241
|
*/
|
|
443
|
-
type RouteOutcome = 'refreshed' | 'failed' | 'refused' | 'superseded';
|
|
242
|
+
type RouteOutcome = 'refreshed' | 'partial' | 'failed' | 'refused' | 'superseded';
|
|
243
|
+
/** What the runtime tells a route planner about the update it plans for. */
|
|
244
|
+
interface RoutePlanContext {
|
|
245
|
+
/**
|
|
246
|
+
* Whether an element belongs to the update: always `true` without
|
|
247
|
+
* `scopeBindingsByOwner`, otherwise only inside the document the update
|
|
248
|
+
* names. A marker outside it asks for nothing.
|
|
249
|
+
*/
|
|
250
|
+
readonly inScope: (element: Element) => boolean;
|
|
251
|
+
}
|
|
444
252
|
/**
|
|
445
253
|
* Whether a revision needs the whole route re-rendered, and how. After a
|
|
446
|
-
* refresh the runtime rescans and re-applies the revision, so
|
|
447
|
-
*
|
|
254
|
+
* refresh the runtime rescans and re-applies the revision, so reachable
|
|
255
|
+
* unsaved bindings land on the fresh markup. The runtime always passes
|
|
256
|
+
* `context`; a planner written before it existed still works, but plans for
|
|
257
|
+
* markers of every document.
|
|
448
258
|
*/
|
|
449
259
|
interface RouteStrategy {
|
|
450
|
-
readonly plan: (root: ParentNode, changedFields: ReadonlySet<string
|
|
260
|
+
readonly plan: (root: ParentNode, changedFields: ReadonlySet<string>, context?: RoutePlanContext) => boolean;
|
|
451
261
|
readonly refresh: (context: RouteContext) => Promise<RouteOutcome>;
|
|
452
262
|
}
|
|
453
263
|
interface StrategyHandlers {
|
|
@@ -517,6 +327,12 @@ interface LivePreviewEventMap {
|
|
|
517
327
|
readonly revision: number;
|
|
518
328
|
readonly receivedAt: number;
|
|
519
329
|
};
|
|
330
|
+
/**
|
|
331
|
+
* A revision left `pending`: it is current, partial (with the shortfalls
|
|
332
|
+
* that kept it from being current), unconfirmed by an island, or superseded.
|
|
333
|
+
* Fires again when an unconfirmed revision is confirmed (ADR 0023).
|
|
334
|
+
*/
|
|
335
|
+
readonly revisionDisplay: RevisionDisplay;
|
|
520
336
|
/** A `payload-document-event` message arrived (document save). */
|
|
521
337
|
readonly documentSave: {
|
|
522
338
|
readonly timestamp: number;
|
|
@@ -653,6 +469,13 @@ interface RenderContext {
|
|
|
653
469
|
readonly schema: PayloadFieldSchema | undefined;
|
|
654
470
|
/** The project's rich-text renderer, when the client was configured with one. */
|
|
655
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;
|
|
656
479
|
/**
|
|
657
480
|
* This instance's sanitizer policy, for every HTML write the renderer makes.
|
|
658
481
|
* Absent, the process default set by `setSanitizerPolicy()` applies.
|
|
@@ -678,6 +501,271 @@ interface FieldRenderer {
|
|
|
678
501
|
render(target: CachedElement, value: unknown, context: RenderContext): void;
|
|
679
502
|
}
|
|
680
503
|
|
|
504
|
+
/** Connection status and the heartbeat that decides a disconnect. */
|
|
505
|
+
type ConnectionStatus = 'disconnected' | 'connecting' | 'connected';
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* How completely the page shows one revision (ADR 0023). The session counters
|
|
509
|
+
* say what happened over a session; this says, for the revision in flight,
|
|
510
|
+
* whether work is outstanding and which step fell short, so a host does not
|
|
511
|
+
* have to attribute route outcomes and fragment fallbacks itself.
|
|
512
|
+
*/
|
|
513
|
+
|
|
514
|
+
/** Where a revision stands: work left, shown, shown with shortfalls, awaiting an island, or replaced (ADR 0023). */
|
|
515
|
+
type RevisionDisplayState = 'pending' | 'current' | 'partial' | 'unconfirmed' | 'superseded';
|
|
516
|
+
/** One step that kept a settled revision from being current. */
|
|
517
|
+
type RevisionShortfall = {
|
|
518
|
+
readonly kind: 'fragment';
|
|
519
|
+
readonly id: string;
|
|
520
|
+
readonly key: string | undefined;
|
|
521
|
+
readonly code: DiagnosticCode;
|
|
522
|
+
} | {
|
|
523
|
+
readonly kind: 'route-saved';
|
|
524
|
+
} | {
|
|
525
|
+
readonly kind: 'route-failed';
|
|
526
|
+
readonly outcome: RouteOutcome;
|
|
527
|
+
} | {
|
|
528
|
+
readonly kind: 'unfaithful' | 'unbound';
|
|
529
|
+
readonly field: string;
|
|
530
|
+
} | {
|
|
531
|
+
readonly kind: 'write';
|
|
532
|
+
readonly field: string;
|
|
533
|
+
readonly code: DiagnosticCode;
|
|
534
|
+
} | {
|
|
535
|
+
readonly kind: 'merge';
|
|
536
|
+
};
|
|
537
|
+
/** How completely the page shows one accepted revision (ADR 0023). */
|
|
538
|
+
interface RevisionDisplay {
|
|
539
|
+
/** The message revision this record is about. */
|
|
540
|
+
readonly revision: number;
|
|
541
|
+
/** `pending` while work is left; the other states once it settled. */
|
|
542
|
+
readonly state: RevisionDisplayState;
|
|
543
|
+
/** What kept a settled revision from being current; empty unless `state` is `partial`. */
|
|
544
|
+
readonly shortfalls: readonly RevisionShortfall[];
|
|
545
|
+
/** Writes the visibility gate holds until their element is seen; they count as landed. */
|
|
546
|
+
readonly deferred: number;
|
|
547
|
+
/** Islands the revision was handed to that have not called `displayed()`. */
|
|
548
|
+
readonly awaitingIslands: number;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Shape of the `inspect()` snapshot. It only re-reads what the page already
|
|
553
|
+
* shows — origins from the injected script, field names from the DOM,
|
|
554
|
+
* counters derived from both — so it stays available in production, where a
|
|
555
|
+
* misbehaving preview is exactly the case worth diagnosing. Reading one
|
|
556
|
+
* performs no I/O and transmits nothing.
|
|
557
|
+
*/
|
|
558
|
+
|
|
559
|
+
/** Origin trust as the runtime currently sees it. */
|
|
560
|
+
interface InspectionOrigins {
|
|
561
|
+
/** Configured origins; empty means the referrer and localhost heuristics decide instead. */
|
|
562
|
+
readonly trusted: readonly string[];
|
|
563
|
+
/** The origin locked onto by the first accepted update; every other is then refused. */
|
|
564
|
+
readonly locked: string | undefined;
|
|
565
|
+
}
|
|
566
|
+
/** Protocol versions and the capabilities they enable. */
|
|
567
|
+
interface InspectionProtocol {
|
|
568
|
+
/** This library's protocol version. */
|
|
569
|
+
readonly ours: number;
|
|
570
|
+
/** The remote party's version, or `undefined` if it never announced one. */
|
|
571
|
+
readonly theirs: number | undefined;
|
|
572
|
+
/** `min(ours, theirs ?? 1)` — what both sides actually share. */
|
|
573
|
+
readonly negotiated: number;
|
|
574
|
+
/** Capability flags enabled at the negotiated version. */
|
|
575
|
+
readonly capabilities: readonly string[];
|
|
576
|
+
/** The subset of `capabilities` seen on the wire rather than granted by version. */
|
|
577
|
+
readonly observed: readonly string[];
|
|
578
|
+
/** The Payload profile the observed capabilities imply: `unknown`, `payload-2` or `payload-3`. */
|
|
579
|
+
readonly profile: string;
|
|
580
|
+
}
|
|
581
|
+
/** Revision accounting for the update pipeline. */
|
|
582
|
+
interface InspectionRevisions {
|
|
583
|
+
/** Updates accepted since the runtime started. */
|
|
584
|
+
readonly accepted: number;
|
|
585
|
+
/**
|
|
586
|
+
* Updates that were still in flight when a newer one arrived and were
|
|
587
|
+
* therefore abandoned. A number that tracks `accepted` closely means the
|
|
588
|
+
* editor is out-typing the pipeline, which is normal; it is only a problem
|
|
589
|
+
* when the last update is among the abandoned ones.
|
|
590
|
+
*/
|
|
591
|
+
readonly superseded: number;
|
|
592
|
+
/**
|
|
593
|
+
* Updates whose scheduled writes reached the DOM. What is neither
|
|
594
|
+
* superseded nor completed is in flight or was cancelled; a `superseded`
|
|
595
|
+
* that tracks `accepted` while `completed` stays low is the editor
|
|
596
|
+
* out-typing the pipeline.
|
|
597
|
+
*/
|
|
598
|
+
readonly completed: number;
|
|
599
|
+
/**
|
|
600
|
+
* Bindings not scheduled because their value was identical to the one last
|
|
601
|
+
* applied. Cumulative since start; always `0` unless `skipUnchanged` is on.
|
|
602
|
+
* A large number beside a small `accepted` is the optimisation working.
|
|
603
|
+
*/
|
|
604
|
+
readonly skippedUnchanged: number;
|
|
605
|
+
/** Revision currently in flight, or `undefined` when the pipeline is idle. */
|
|
606
|
+
readonly active: number | undefined;
|
|
607
|
+
/**
|
|
608
|
+
* How completely the page shows the latest accepted revision (ADR 0023):
|
|
609
|
+
* `pending`, `current`, `partial` with its shortfalls, or `unconfirmed` while
|
|
610
|
+
* an island it was handed has not called `displayed()`. `undefined` before
|
|
611
|
+
* the first message.
|
|
612
|
+
*/
|
|
613
|
+
readonly display: RevisionDisplay | undefined;
|
|
614
|
+
}
|
|
615
|
+
/** What the DOM offers the runtime to write into. */
|
|
616
|
+
interface InspectionBindings {
|
|
617
|
+
/** Elements carrying a binding. */
|
|
618
|
+
readonly elements: number;
|
|
619
|
+
/** Distinct field names across those elements. */
|
|
620
|
+
readonly fields: number;
|
|
621
|
+
/** Those field names, sorted. */
|
|
622
|
+
readonly fieldNames: readonly string[];
|
|
623
|
+
/**
|
|
624
|
+
* Bound fields some update carried no value for, so the binding kept its old
|
|
625
|
+
* text — why a binding can stay stale while its siblings update. Cumulative.
|
|
626
|
+
*/
|
|
627
|
+
readonly absentFields: readonly string[];
|
|
628
|
+
/**
|
|
629
|
+
* Scalar fields (and one group level) that arrived but matched no binding.
|
|
630
|
+
* Arrays, relationships, rich text, `null` and the fields Payload sends with
|
|
631
|
+
* every update are never listed. Cumulative.
|
|
632
|
+
*/
|
|
633
|
+
readonly orphanFields: readonly string[];
|
|
634
|
+
/** Whether `scopeBindingsByOwner` is active. */
|
|
635
|
+
readonly ownerScoped: boolean;
|
|
636
|
+
/** Distinct document owners currently on the page, sorted. */
|
|
637
|
+
readonly owners: readonly string[];
|
|
638
|
+
/**
|
|
639
|
+
* Bindings the runtime found by value on the connection's first message
|
|
640
|
+
* (`autoBind: 'unique'`, ADR 0014), sorted by field, each with the value it
|
|
641
|
+
* matched on and the attribute it matched in — `undefined` for a text match.
|
|
642
|
+
* These are the elements that change without a `data-payload-field` in the
|
|
643
|
+
* template; every one of them carries `data-payload-guessed` in the DOM.
|
|
644
|
+
*/
|
|
645
|
+
readonly guessed: readonly {
|
|
646
|
+
readonly field: string;
|
|
647
|
+
readonly matched: string;
|
|
648
|
+
readonly attribute: string | undefined;
|
|
649
|
+
}[];
|
|
650
|
+
/** `autoBind` as configured, and what the one search cost; `searchMs` is `undefined` until it ran. */
|
|
651
|
+
readonly autoBind: {
|
|
652
|
+
readonly mode: 'off' | 'unique';
|
|
653
|
+
readonly searchMs: number | undefined;
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
/** Scheduler work in progress. */
|
|
657
|
+
interface InspectionScheduler {
|
|
658
|
+
/** Writes buffered for the next flush. */
|
|
659
|
+
readonly pending: number;
|
|
660
|
+
/** Writes held back offscreen above `visibilityGateThreshold`; applied when scrolled into view. */
|
|
661
|
+
readonly deferred: number;
|
|
662
|
+
/** The binding count above which the visibility gate starts deferring. */
|
|
663
|
+
readonly visibilityGateThreshold: number;
|
|
664
|
+
/** Whether the binding count is above that threshold right now. */
|
|
665
|
+
readonly visibilityGateActive: boolean;
|
|
666
|
+
/** Stats of the most recent flush, or `undefined` if none has run. */
|
|
667
|
+
readonly lastFlush: {
|
|
668
|
+
readonly applied: number;
|
|
669
|
+
/** Which fields the flush wrote; a count alone cannot say a binding was skipped. */
|
|
670
|
+
readonly appliedFields: readonly string[];
|
|
671
|
+
readonly deferred: number;
|
|
672
|
+
readonly durationMs: number;
|
|
673
|
+
} | undefined;
|
|
674
|
+
}
|
|
675
|
+
/** A point-in-time read; plain values only, with no references into runtime internals. */
|
|
676
|
+
interface LivePreviewInspection {
|
|
677
|
+
/** Package version that produced this snapshot. */
|
|
678
|
+
readonly version: string;
|
|
679
|
+
/** Whether the runtime is started, and whether it has been destroyed. */
|
|
680
|
+
readonly started: boolean;
|
|
681
|
+
/** Connection status as reported to the `connect`/`disconnect` events. */
|
|
682
|
+
readonly status: ConnectionStatus;
|
|
683
|
+
readonly origins: InspectionOrigins;
|
|
684
|
+
readonly protocol: InspectionProtocol;
|
|
685
|
+
readonly revisions: InspectionRevisions;
|
|
686
|
+
readonly bindings: InspectionBindings;
|
|
687
|
+
readonly scheduler: InspectionScheduler;
|
|
688
|
+
/** Field types with a registered renderer, sorted. */
|
|
689
|
+
readonly renderers: readonly string[];
|
|
690
|
+
/** Registered plugins and their live registrations; empty on a bare runtime. */
|
|
691
|
+
readonly plugins: readonly PluginInspection[];
|
|
692
|
+
/** Server-rendered fragment boundaries: whether a handler exists and what happened to renders. */
|
|
693
|
+
readonly fragments: InspectionFragments;
|
|
694
|
+
/** Route refreshes: whether a strategy exists, how many ran, failed, were paced, or were stopped by the loop guard. */
|
|
695
|
+
readonly route: InspectionRoute;
|
|
696
|
+
/** Patches the runtime knew could not match the server's render, and what became of them. */
|
|
697
|
+
readonly fidelity: InspectionFidelity;
|
|
698
|
+
/**
|
|
699
|
+
* Whether the page declared a framework that hydrates it, and how far the
|
|
700
|
+
* wait for its first commit — React's, Vue's mount, or SvelteKit's root
|
|
701
|
+
* mounting — got (ADR 0015). `waiting` is why a preview on a Next, Nuxt or
|
|
702
|
+
* SvelteKit page is not connected yet; `timed-out` is LP0607.
|
|
703
|
+
*/
|
|
704
|
+
readonly hydration: {
|
|
705
|
+
readonly mode: 'off' | 'react' | 'vue' | 'sveltekit';
|
|
706
|
+
readonly state: 'idle' | 'waiting' | 'committed' | 'timed-out';
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* The fidelity verdicts as `inspect()` reports them (LP0411). A positive
|
|
711
|
+
* `unfaithful` beside `escalated: 0` is a page that keeps a degraded patch —
|
|
712
|
+
* because `mode` says so, or because `canEscalate` is false: neither
|
|
713
|
+
* `fragments.handler` nor `route.handler` is there to escalate to, which the
|
|
714
|
+
* runtime also says once as LP0808 when `mode` is `'escalate'`.
|
|
715
|
+
*/
|
|
716
|
+
interface InspectionFidelity {
|
|
717
|
+
/** `onUnfaithfulPatch` as resolved from both of its names. */
|
|
718
|
+
readonly mode: 'ignore' | 'warn' | 'escalate';
|
|
719
|
+
/** Whether a fragment or route strategy exists for `'escalate'` to hand a patch to. */
|
|
720
|
+
readonly canEscalate: boolean;
|
|
721
|
+
/** Bindings reported unfaithful since start — once per element, like LP0411, and under every mode. */
|
|
722
|
+
readonly unfaithful: number;
|
|
723
|
+
/** Of those, how many were handed to the fragment or route strategy. */
|
|
724
|
+
readonly escalated: number;
|
|
725
|
+
/** The field names behind `unfaithful`, sorted. Cumulative. */
|
|
726
|
+
readonly fields: readonly string[];
|
|
727
|
+
}
|
|
728
|
+
/** The route strategy as `inspect()` reports it. */
|
|
729
|
+
interface InspectionRoute {
|
|
730
|
+
readonly handler: boolean;
|
|
731
|
+
readonly refreshes: number;
|
|
732
|
+
/** Successful refreshes whose server render was not proven to contain the current unsaved revision. */
|
|
733
|
+
readonly partial: number;
|
|
734
|
+
/** Refreshes that broke: the request, the answer, or the morph. */
|
|
735
|
+
readonly failed: number;
|
|
736
|
+
/**
|
|
737
|
+
* Refreshes the strategy's own minimum interval held back (LP0805). Each is
|
|
738
|
+
* run once the window closes unless a newer revision takes its place, so this
|
|
739
|
+
* counts pacing and not loss — and it is deliberately not `failed`.
|
|
740
|
+
*/
|
|
741
|
+
readonly refused: number;
|
|
742
|
+
/** Second refresh requests for one revision, refused with LP0805. */
|
|
743
|
+
readonly loopStopped: number;
|
|
744
|
+
}
|
|
745
|
+
/** The fragment strategy as `inspect()` reports it. */
|
|
746
|
+
interface InspectionFragments {
|
|
747
|
+
/** Whether a fragment handler is configured; without one, boundaries are patched. */
|
|
748
|
+
readonly handler: boolean;
|
|
749
|
+
readonly inFlight: number;
|
|
750
|
+
readonly rendered: number;
|
|
751
|
+
readonly failed: number;
|
|
752
|
+
readonly superseded: number;
|
|
753
|
+
}
|
|
754
|
+
/** One plugin as `inspect().plugins` reports it. */
|
|
755
|
+
interface PluginInspection {
|
|
756
|
+
readonly name: string;
|
|
757
|
+
readonly version: string | undefined;
|
|
758
|
+
/** `initializing` while `init` runs, `active` afterwards, `tearing-down` while `destroy` runs. */
|
|
759
|
+
readonly state: 'initializing' | 'active' | 'tearing-down';
|
|
760
|
+
/** Live registrations owned by the plugin's scope, by kind. */
|
|
761
|
+
readonly registrations: {
|
|
762
|
+
readonly transforms: number;
|
|
763
|
+
readonly renderers: number;
|
|
764
|
+
readonly subscriptions: number;
|
|
765
|
+
readonly cleanups: number;
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
|
|
681
769
|
/**
|
|
682
770
|
* Plugin compatibility claims. The range grammar is the subset a plugin
|
|
683
771
|
* author writes (`*`, `1.2.3`, `^`, `~`, `>=`, `>`, `<`, `<=`, space-joined
|
|
@@ -790,6 +878,13 @@ interface LivePreviewClientConfig {
|
|
|
790
878
|
* and listed in `inspect().bindings.guessed`. Default `'off'`.
|
|
791
879
|
*/
|
|
792
880
|
readonly autoBind?: 'off' | 'unique';
|
|
881
|
+
/**
|
|
882
|
+
* How a group counts as covered (ADR 0022). `'descendant'` (default): one
|
|
883
|
+
* bound path inside it covers all of it. `'declared'`: each changed path
|
|
884
|
+
* inside such a group needs its own binding or a `data-payload-covers`
|
|
885
|
+
* declaration; an uncovered one is an unbound change.
|
|
886
|
+
*/
|
|
887
|
+
readonly subfieldCoverage?: 'descendant' | 'declared';
|
|
793
888
|
/** Fields whose change re-applies other bindings regardless of their own value: `{ price: ['priceLabel'] }`. Used with `skipUnchanged`. */
|
|
794
889
|
readonly dependencies?: Readonly<Record<string, readonly string[]>>;
|
|
795
890
|
/** Strategy handlers beyond patching; `createFragmentStrategy()` from `payload-live-preview/fragment` builds one. */
|
|
@@ -855,7 +950,10 @@ declare class LivePreviewClient {
|
|
|
855
950
|
use(plugin: LivePreviewPlugin): Promise<void>;
|
|
856
951
|
/** Unregister a plugin and release everything its registration owned. Still allowed from a destroy hook during teardown. */
|
|
857
952
|
unuse(name: string): Promise<void>;
|
|
953
|
+
/** Re-scan bindings after replacing markup without crossing a navigation boundary. */
|
|
858
954
|
refreshCache(): void;
|
|
955
|
+
/** Re-scan bindings and locally replay the last accepted document after a router commit. */
|
|
956
|
+
refreshAfterNavigation(): void;
|
|
859
957
|
get events(): EventEmitter;
|
|
860
958
|
/** Names of the registered plugins. */
|
|
861
959
|
get plugins(): readonly string[];
|
|
@@ -914,6 +1012,9 @@ declare function createPreviewFocusReporter(resolveTarget: () => FocusReportTarg
|
|
|
914
1012
|
* A host's own route refresh. It must settle once the fresh markup is
|
|
915
1013
|
* committed: the runtime re-applies the revision on top of it, and doing that
|
|
916
1014
|
* against the markup being replaced would write into nodes about to be dropped.
|
|
1015
|
+
* A function that returns nothing is taken as already committed; the route
|
|
1016
|
+
* strategy says once that it could not wait (LP0810), and 3.0 requires the
|
|
1017
|
+
* promise (ADR 0028).
|
|
917
1018
|
*/
|
|
918
1019
|
type RouteRefresh = () => void | Promise<void>;
|
|
919
1020
|
/**
|
|
@@ -924,4 +1025,4 @@ type RouteRefresh = () => void | Promise<void>;
|
|
|
924
1025
|
*/
|
|
925
1026
|
declare function registerRouteRefresh(refresh: RouteRefresh): () => void;
|
|
926
1027
|
|
|
927
|
-
export { type CachedElement, type ConnectionStatus, type CustomRendererKey, DIAGNOSTIC_CODES, type DefaultsProfile, type DiagnosticCode, EventEmitter, type EventHandler, type EventSourcePolicy, type FieldRenderer, type FieldTransform, type FieldType, type FocusReportTarget, type FragmentContext, type FragmentReport, type FragmentStrategy, type InspectionBindings, type InspectionFidelity, type InspectionFragments, type InspectionOrigins, type InspectionProtocol, type InspectionRevisions, type InspectionRoute, type InspectionScheduler, LivePreviewClient, type LivePreviewClientConfig, type LivePreviewEventMap, type LivePreviewInspection, type LivePreviewPlugin, type PayloadBlockSchema, type PayloadDocumentEventDetail, type PayloadFieldCondition, type PayloadFieldSchema, type PayloadFieldType, type PayloadLivePreviewData, type PluginCompatibility, type PluginContext, type PluginDisposer, type PluginEvents, type PluginInspection, type PreviewFocusMessage, type RenderContext, type RendererKey, type RichTextRenderer, type RouteContext, type RouteOutcome, type RouteRefresh, type RouteStrategy, type SanitizerPolicyMode, type StrategyHandlers, type Unsubscribe, type UpdateSource, createPreviewFocusReporter, initLivePreview, registerRouteRefresh, reportPreviewFocus };
|
|
1028
|
+
export { type CachedElement, type ConnectionStatus, type CustomRendererKey, DIAGNOSTIC_CODES, type DefaultsProfile, type DiagnosticCode, EventEmitter, type EventHandler, type EventSourcePolicy, type FieldRenderer, type FieldTransform, type FieldType, type FocusReportTarget, type FragmentContext, type FragmentReport, type FragmentStrategy, type InspectionBindings, type InspectionFidelity, type InspectionFragments, type InspectionOrigins, type InspectionProtocol, type InspectionRevisions, type InspectionRoute, type InspectionScheduler, LivePreviewClient, type LivePreviewClientConfig, type LivePreviewEventMap, type LivePreviewInspection, type LivePreviewPlugin, type PayloadBlockSchema, type PayloadDocumentEventDetail, type PayloadFieldCondition, type PayloadFieldSchema, type PayloadFieldType, type PayloadLivePreviewData, type PluginCompatibility, type PluginContext, type PluginDisposer, type PluginEvents, type PluginInspection, type PreviewFocusMessage, type RenderContext, type RendererKey, type RevisionDisplay, type RevisionDisplayState, type RevisionShortfall, type RichTextRenderer, type RouteContext, type RouteOutcome, type RoutePlanContext, type RouteRefresh, type RouteStrategy, type SanitizerPolicyMode, type StrategyHandlers, type Unsubscribe, type UpdateSource, createPreviewFocusReporter, initLivePreview, registerRouteRefresh, reportPreviewFocus };
|