@embedpdf/plugin-actions 3.0.0-next.13 → 3.0.0-next.15

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 (41) hide show
  1. package/dist/contract/host.cjs +13 -1
  2. package/dist/contract/host.cjs.map +1 -1
  3. package/dist/contract/host.d.cts +3 -7
  4. package/dist/contract/host.d.ts +3 -7
  5. package/dist/contract/host.js +10 -3
  6. package/dist/contract/host.js.map +1 -1
  7. package/dist/contract-CNKZHb6w.d.ts +547 -0
  8. package/dist/contract-CwN3NAXU.js +175 -0
  9. package/dist/contract-CwN3NAXU.js.map +1 -0
  10. package/dist/contract-DSQysTqU.d.cts +547 -0
  11. package/dist/contract-_HB_UliT.cjs +210 -0
  12. package/dist/contract-_HB_UliT.cjs.map +1 -0
  13. package/dist/contract.cjs +5 -4
  14. package/dist/contract.d.cts +2 -3
  15. package/dist/contract.d.ts +2 -3
  16. package/dist/contract.js +2 -3
  17. package/dist/host-contract-CRNO2oZN.d.ts +165 -0
  18. package/dist/host-contract-DJ8TqDr3.d.cts +165 -0
  19. package/dist/index.cjs +1524 -1076
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +11 -9
  22. package/dist/index.d.ts +11 -9
  23. package/dist/index.js +1522 -1076
  24. package/dist/index.js.map +1 -1
  25. package/package.json +6 -10
  26. package/dist/contract-C1K3H4RP.cjs +0 -89
  27. package/dist/contract-C1K3H4RP.cjs.map +0 -1
  28. package/dist/contract-COk-w3Fo.d.ts +0 -50
  29. package/dist/contract-DAem-EST.js +0 -78
  30. package/dist/contract-DAem-EST.js.map +0 -1
  31. package/dist/contract-Os5y4NaD.d.cts +0 -50
  32. package/dist/internal.cjs +0 -3
  33. package/dist/internal.d.cts +0 -3
  34. package/dist/internal.d.ts +0 -3
  35. package/dist/internal.js +0 -2
  36. package/dist/types-BXJLAKXi.cjs +0 -52
  37. package/dist/types-BXJLAKXi.cjs.map +0 -1
  38. package/dist/types-D-DoiESj.d.cts +0 -504
  39. package/dist/types-D-DoiESj.d.ts +0 -504
  40. package/dist/types-DgBMy5nE.js +0 -35
  41. package/dist/types-DgBMy5nE.js.map +0 -1
@@ -1,504 +0,0 @@
1
- import { DocumentMeta, EventHook, Unsubscribe } from "@embedpdf/core";
2
- import { ScriptAnnotEffect, ScriptBudget, ScriptDiagnostic, ScriptExecutionError, ScriptIdentity, ScriptSandboxFactory, ScriptTransaction, ScriptUiEffect } from "@embedpdf/core-acrojs";
3
- import { AnnotationRef, DocumentHandle, FormEffect, FormEffectsResult, FormFieldRef, FormSubmissionEntry, FormSubmissionReceipt, PageObjectNumber, PdfActionNode, PdfActionTargetRef, PdfActionTree, PdfActionType } from "@embedpdf/engine-core/runtime";
4
- //#region src/types.d.ts
5
- /** Why a dispatch happened. Phase 1 dispatches are all `'user'` (a real
6
- * activation gesture); `'hover'` and `'lifecycle'` arrive with Phase 2's
7
- * trigger sources — the policy axis ships full-shape now. */
8
- type ActionOrigin = 'user' | 'hover' | 'lifecycle';
9
- /** Who initiated the dispatch. Fields are REQUIRED where an executor needs
10
- * them: the interim JavaScript executor builds `event.target` from the
11
- * widget source's `field`. Provenance only — policy never reads it. */
12
- type ActionSource = {
13
- kind: 'widget';
14
- field: FormFieldRef;
15
- annotation: AnnotationRef;
16
- pon: PageObjectNumber;
17
- } | {
18
- kind: 'link';
19
- annotation?: AnnotationRef;
20
- pon?: PageObjectNumber;
21
- } |
22
- /** A non-widget annotation's own /AA event (E/X on squares, stamps, …). */
23
- {
24
- kind: 'annotation';
25
- annotation: AnnotationRef;
26
- pon: PageObjectNumber;
27
- } |
28
- /** A page /AA tree (O/C) inside a page-trigger fan-out. */
29
- {
30
- kind: 'page';
31
- pon: PageObjectNumber;
32
- } |
33
- /** The document-open sequence (openDestination / OpenAction). */
34
- {
35
- kind: 'document';
36
- } | {
37
- kind: 'api';
38
- };
39
- /** Trigger provenance, derived centrally beside {@link originOf} — the
40
- * executor-visible "which event fired" (cursorEnter vs cursorExit are both
41
- * `origin: 'hover'`; this carries the difference). */
42
- /** The document lifecycle vocabulary: `open` (§3.9's sequence) plus the
43
- * five catalog `/AA` verbs (ISO 32000-2 Table 200 — WC/WS/DS/WP/DP).
44
- * Whoever owns the verb dispatches them; `runDocumentVerb` is the
45
- * serialized door for save/print, `prepareClose` for close. */
46
- type DocumentTriggerEvent = 'open' | 'will-save' | 'did-save' | 'will-print' | 'did-print' | 'will-close';
47
- type ActionTriggerEvent = {
48
- scope: 'activate';
49
- } | {
50
- scope: 'annotation';
51
- name: PdfAnnotationEventKind;
52
- } | {
53
- scope: 'page';
54
- name: 'open' | 'close' | 'visible' | 'invisible';
55
- } | {
56
- scope: 'document';
57
- name: DocumentTriggerEvent;
58
- };
59
- interface ActionContext {
60
- origin: ActionOrigin;
61
- source: ActionSource;
62
- event: ActionTriggerEvent;
63
- }
64
- /** The six annotation /AA pointer/focus events (ISO Table 197: E X D U Fo Bl).
65
- * Page-lifecycle events (PO/PC/PV/PI) are NOT here — they fan out from page
66
- * triggers, never from per-annotation dispatch. */
67
- type PdfAnnotationEventKind = 'cursorEnter' | 'cursorExit' | 'mouseDown' | 'mouseUp' | 'focus' | 'blur';
68
- /**
69
- * Trigger vocabulary — what a feed reports; the dispatcher resolves trees,
70
- * derives the origin ({@link originOf}), and fans out. `source` on the
71
- * annotation-addressed arms is an optional PROVENANCE hint from first-party
72
- * feeds (a widget feed passes its field ref so the interim JS executor can
73
- * anchor `event.target`); policy never reads it and it cannot change origin.
74
- */
75
- type ActionTrigger = {
76
- scope: 'activate';
77
- ref: AnnotationRef;
78
- pon: PageObjectNumber;
79
- source?: ActionSource;
80
- } | {
81
- scope: 'annotation';
82
- event: PdfAnnotationEventKind;
83
- ref: AnnotationRef;
84
- pon: PageObjectNumber;
85
- source?: ActionSource;
86
- } | {
87
- scope: 'page';
88
- event: 'open' | 'close' | 'visible' | 'invisible';
89
- pon: PageObjectNumber;
90
- } | {
91
- scope: 'document';
92
- event: DocumentTriggerEvent;
93
- };
94
- /** The one origin mapping — derived by the dispatcher, never claimed by a
95
- * caller: a feed cannot launder a hover into a user gesture. */
96
- declare const originOf: (trigger: ActionTrigger) => ActionOrigin;
97
- type ActionNodeStatus = 'executed' | 'blocked' | 'no-executor' | 'inert' | 'failed' | 'skipped';
98
- interface ActionNodeResult {
99
- /** Node address as child indexes from the root ([] = root, [0] = root.next[0]…). */
100
- path: number[];
101
- type: PdfActionType;
102
- status: ActionNodeStatus;
103
- detail?: string;
104
- }
105
- interface ActionDiagnostic {
106
- code: 'incomplete-tree' | 'blocked' | 'no-executor' | 'no-adapter' | 'no-session-sink' | 'unresolved-target' | 'duplicate-executor' | 'executor-inert' | 'executor-failed' | 'trigger-disabled' | 'no-commit-sink' | 'trigger-failed' | 'cascade-budget' | 'open-sequence-replayed' | 'no-submit-sink' | 'no-submit-resolver' | 'submit-payload-unavailable' | 'submit-entry-unsupported' | 'reentrant-print';
107
- message: string;
108
- }
109
- /**
110
- * One logical dispatch transaction's outcome. Document-lifetime work is
111
- * NON-ROLLBACK-ATOMIC: an earlier successful reset/script write survives a
112
- * later failure — `status: 'partial'` says so, and `nodes` carries the
113
- * per-node truth.
114
- */
115
- interface ActionDispatchResult {
116
- status: 'executed' | 'partial' | 'inert' | 'refused';
117
- nodes: ActionNodeResult[];
118
- diagnostics: ActionDiagnostic[];
119
- }
120
- interface ActionDispatchEvent {
121
- ctx: ActionContext;
122
- tree: PdfActionTree;
123
- result: ActionDispatchResult;
124
- }
125
- /**
126
- * One tree's execution inside a trigger: its true source, its true tree, its
127
- * own node results — `path`s are REAL walk paths, never prefixed. `onAction`
128
- * fires once per step with exactly this tree and a ctx built from this
129
- * source, so the Phase-1 event contract is untouched by fan-out.
130
- */
131
- interface ActionStepResult {
132
- source: ActionSource;
133
- tree: PdfActionTree;
134
- result: ActionDispatchResult;
135
- }
136
- /**
137
- * What `dispatch(trigger)` returns: the aggregate plus per-step truth. A
138
- * step failure NEVER skips sibling steps (a broken annotation /PC must not
139
- * cancel the page's /C — degrade, never brick); deferred navigation/external
140
- * effects flush per step, not per trigger.
141
- */
142
- interface ActionTriggerResult {
143
- status: 'executed' | 'partial' | 'inert' | 'refused';
144
- steps: ActionStepResult[];
145
- /** Trigger-level diagnostics (disabled family, resolution failure);
146
- * per-node diagnostics live inside each step's `result`. */
147
- diagnostics: ActionDiagnostic[];
148
- }
149
- /**
150
- * Stage's page-truth report (the ONE door — see the lifecycle coordinator).
151
- * Stage stays authoritative for what page the viewer is on; the coordinator
152
- * owns WHEN page-lifecycle triggers fire: reports are buffered behind the
153
- * document-open barrier and diffed against the last-emitted state, so
154
- * pre-open motion (a restored view, the openDestination reveal) never emits
155
- * close/open churn. `cause` fuels the cascade budget: consecutive
156
- * programmatic rounds are capped; a user-caused report resets the counter.
157
- */
158
- interface PageStateReport {
159
- currentPon: PageObjectNumber | null;
160
- visiblePons: readonly PageObjectNumber[];
161
- /** False until layout exists; pre-placement reports are ignored. */
162
- placed: boolean;
163
- cause: 'user' | 'programmatic';
164
- }
165
- /** Per-(type × origin) decision. `allow` executes; `adapter` routes through
166
- * the type's port (the UI adapter; for `submit-form`, the sink chain —
167
- * embedder handler → the document's home → blocked); `report` records a
168
- * blocked node without executing; `block` refuses.
169
- * `launch`/`goto-remote`/`goto-embedded`/media arms are fixed `'never'`
170
- * and not configurable. */
171
- type ActionPolicyDecision = 'allow' | 'adapter' | 'report' | 'block';
172
- type ActionPolicyRow = Record<ActionOrigin, ActionPolicyDecision>;
173
- interface ActionPolicy {
174
- goto: ActionPolicyRow;
175
- named: ActionPolicyRow;
176
- hide: ActionPolicyRow;
177
- 'reset-form': ActionPolicyRow;
178
- javascript: ActionPolicyRow;
179
- uri: ActionPolicyRow;
180
- /** The Named `Print` verb — owned by policy + the UI adapter, never stage.
181
- * (An Adobe-compat extension: ISO Table 215 defines only the four page
182
- * verbs; an unrecognized name "shall take no action".) */
183
- print: ActionPolicyRow;
184
- /** SubmitForm — `'adapter'` routes through the sink chain. Default: user
185
- * origin only; hover/lifecycle submits stay blocked. */
186
- 'submit-form': ActionPolicyRow;
187
- }
188
- interface ActionsPluginConfig {
189
- /** Declarative overrides merged over the defaults (umbrella §3.5). */
190
- policy?: Partial<ActionPolicy>;
191
- /** Trigger-family gates, default all true. `activate` (the /A click) is
192
- * the Phase-1 core door and is never gated. */
193
- triggers?: {
194
- document?: boolean;
195
- page?: boolean;
196
- annotation?: boolean;
197
- };
198
- /**
199
- * The document-open sequence (§3.9): `'auto'` (default) fires once at the
200
- * earliest of a UI adapter installing or the first user-origin dispatch —
201
- * the initial page-open then comes from the stage's page-state report
202
- * (a stage-less embedder drives page triggers itself, or declares
203
- * headless); `'headless'` fires at bringup and falls back to the first
204
- * page for the initial open (no stage will ever report); `'off'` never
205
- * fires it — but still releases the page-lifecycle barrier.
206
- */
207
- openSequence?: 'auto' | 'headless' | 'off';
208
- /**
209
- * THE JavaScript switch (relocated from `formPlugin({ scripting })`).
210
- * Default off — no VM ever loads. When enabled, the plugin owns the ONE
211
- * per-document ScriptHost realm, registers the real `javascript` executor,
212
- * and exposes the transaction port on the host lens (form's K/V/C/F
213
- * pipeline rides it).
214
- */
215
- javascript?: {
216
- enabled: boolean;
217
- /** Override the lazy QuickJS factory (tests or another isolated VM). */
218
- sandboxFactory?: ScriptSandboxFactory;
219
- /** Embedder identity fields layered over engine/JWT identity. */
220
- identity?: Partial<ScriptIdentity> | (() => Partial<ScriptIdentity>);
221
- fileName?: () => string;
222
- /** Injected deterministic transaction environment. */
223
- now?: () => number;
224
- utcOffsetMinutes?: () => number;
225
- randomSeed?: () => number;
226
- budget?: ScriptBudget;
227
- /**
228
- * D11's deterministic aggregate: the max JS nodes ONE dispatch may run
229
- * (a /Next chain shares this instead of multiplying the per-run time
230
- * budget; a wall-clock aggregate would be the flake class we banned).
231
- * Exhausted → remaining JS nodes report inert with a budget reason.
232
- */
233
- maxScriptNodesPerDispatch?: number;
234
- };
235
- }
236
- type ActionExecutorResult = {
237
- status: 'executed';
238
- } | {
239
- status: 'inert';
240
- reason: string;
241
- } | {
242
- status: 'failed';
243
- error: string;
244
- };
245
- /** One node of one registered type, executed in dispatch order. Executors
246
- * never see the tree or the capability — the anti-cascade law. */
247
- type ActionExecutor = (node: PdfActionNode, ctx: ActionContext) => Promise<ActionExecutorResult> | ActionExecutorResult;
248
- /** One annotation-effect commit entry. `pageObjectNumber` may be absent for
249
- * bare Hide object-number targets — the sink resolves it from its model
250
- * (`obj:N` is a cross-page key there); unresolvable entries fail honestly. */
251
- interface AnnotCommitEntry {
252
- annotObjectNumber: number;
253
- pageObjectNumber?: number;
254
- patch: ScriptAnnotEffect['patch'];
255
- }
256
- interface AnnotCommitResult {
257
- results: Array<{
258
- annotObjectNumber: number;
259
- status: 'applied' | 'failed' | 'skipped';
260
- error?: string;
261
- }>;
262
- }
263
- type AnnotCommitSink = (entries: AnnotCommitEntry[]) => Promise<AnnotCommitResult>;
264
- /** The form plugin's document commit: engine `applyEffects` + snapshot
265
- * reconciliation (its existing commit tail, extracted). */
266
- type FormCommitSink = (effects: FormEffect[]) => Promise<FormEffectsResult>;
267
- /** What a script transaction surfaced besides document effects. */
268
- /**
269
- * Which realm produced a script result. `'document'` = this document's own
270
- * realm: every effect targets the viewer document. `'detached'` = a realm
271
- * minted for a document that is NOT displayed (a stamp asset): it has no
272
- * document surface, so only alerts reach the adapter — print, page
273
- * navigation, and submit are suppressed with a diagnostic rather than
274
- * acting on the wrong document.
275
- */
276
- type ScriptRealmKind = 'document' | 'detached';
277
- interface ScriptSurfaceResult {
278
- uiEffects: ScriptUiEffect[];
279
- diagnostics: ScriptDiagnostic[];
280
- error?: ScriptExecutionError;
281
- origin: ActionOrigin;
282
- phase: 'boot' | 'user';
283
- realm: ScriptRealmKind;
284
- }
285
- /** A K/V/C/F transaction's result as the form controller reports it: effects
286
- * carry their own phase (boot effects belong to the first transaction that
287
- * lazily booted the realm). Structurally `FormCommitResult`'s surface half —
288
- * typed here so the actions plane never imports the form package. */
289
- interface ScriptCommitSurface {
290
- uiEffects: Array<ScriptUiEffect & {
291
- phase: 'boot' | 'user';
292
- }>;
293
- diagnostics: ScriptDiagnostic[];
294
- error?: ScriptExecutionError;
295
- }
296
- /** What a realm is minted FOR. `doc` is the document the scripts operate on
297
- * (the viewer document, or a detached asset); `document()` is the metadata
298
- * scripts observe (`this.documentFileName` …) — for a detached stamp that is
299
- * the TARGET document's, by Acrobat's dynamic-stamp contract. */
300
- interface ScriptRealmTarget {
301
- doc: DocumentHandle;
302
- document(): DocumentMeta | null;
303
- /** Name-tree programs, fetched lazily once per realm build. */
304
- bootSources(): Promise<string[]>;
305
- }
306
- /** The realm transaction port plus the budget consumers apply as their
307
- * transaction aggregate — the same shape whether the realm is this
308
- * document's own (owned by actions) or a detached one (owned by the caller). */
309
- interface ScriptRealmPort {
310
- /** The body must perform prefetch, runs, sink commits, and reconciliation
311
- * before returning (commit-inside-the-boundary). */
312
- transaction<T>(body: (txn: ScriptTransaction) => Promise<T>): Promise<T>;
313
- budget: ScriptBudget;
314
- }
315
- /** A detached realm: the caller OWNS its lifetime. */
316
- interface DetachedScriptRealm extends ScriptRealmPort {
317
- dispose(): void;
318
- }
319
- /** Origin/phase context every script-produced UI request carries — the
320
- * DEFAULT adapter's visibility matrix keys on it; embedder adapters receive
321
- * everything and decide for themselves. */
322
- interface ActionUiContext {
323
- origin: ActionOrigin;
324
- /** Script-model axis: `'boot'` = name-tree/document-open boot scripts. */
325
- phase: 'boot' | 'user';
326
- }
327
- interface ActionUiAdapter {
328
- openUri(uri: string, opts: {
329
- isMap: boolean;
330
- origin: ActionOrigin;
331
- }): void;
332
- /** The Named `Print` verb AND script `print()` requests (authority-gated
333
- * upstream — `doc.print` refusals never reach the adapter). */
334
- print(opts?: ActionUiContext): void;
335
- /** Script `app.alert` — the ONE alert port for every script origin. */
336
- alert?(message: string, opts: ActionUiContext & {
337
- icon: number;
338
- title?: string;
339
- }): void;
340
- /** Script `this.pageNum = n` navigation requests. */
341
- gotoPage?(page: number, opts: ActionUiContext): void;
342
- }
343
- /**
344
- * A normalized submit INTENT — one shape for both sources: a SubmitForm
345
- * action node's extracted payload, or a script `doc.submitForm()` effect
346
- * (include-mode names, `exclude` false). Resolution into a dataset is the
347
- * FORM plugin's job (it owns the field plane) via the registered resolver.
348
- */
349
- interface SubmitIntent {
350
- url: string | null;
351
- /** Table-239 targets (mixed names/object numbers); `null` = the whole
352
- * eligible form. */
353
- fields: PdfActionTargetRef[] | null;
354
- exclude: boolean;
355
- includeNoValueFields: boolean;
356
- format: 'fdf' | 'html' | 'xfdf' | 'pdf';
357
- method: 'post' | 'get';
358
- /** Raw ISO Table 240 word (0 for scripted submits without one). */
359
- flagsRaw: number;
360
- charSet?: string;
361
- }
362
- /**
363
- * The resolved dataset a sink receives. Entries carry the ISO semantics
364
- * already applied (descendants, the unconditional NoExport veto,
365
- * push-button/unsupported exclusion — diagnosed, never silent); the
366
- * document's declared routing survives as METADATA. The stack never
367
- * fetches `url` — an embedder handler that chooses to must validate it
368
- * (protocol + destination allowlists) before any network call.
369
- */
370
- interface ActionSubmitRequest {
371
- url: string | null;
372
- method: 'post' | 'get';
373
- format: 'fdf' | 'html' | 'xfdf' | 'pdf';
374
- flagsRaw: number;
375
- charSet?: string;
376
- entries: FormSubmissionEntry[];
377
- origin: ActionOrigin;
378
- event: ActionTriggerEvent;
379
- }
380
- /**
381
- * Sink 1 of the chain: the embedder's application. Consent = installation
382
- * (it receives nothing the embedder couldn't already compute from
383
- * `forms.list()` under `doc.forms.read`, so no submit scope gates it).
384
- * Contract: synchronous acceptance marks the node `executed` — "handed to
385
- * the embedder", NOT "delivered"; a synchronous throw marks it `failed`; a
386
- * returned promise is DETACHED and a later rejection emits a diagnostic
387
- * only. `submitToDocumentHome` lets a handler COMPOSE with sink 2 (present
388
- * only when the document has a submit-capable home).
389
- */
390
- type ActionSubmitHandler = (request: ActionSubmitRequest, ctx: {
391
- submitToDocumentHome: (() => Promise<FormSubmissionReceipt>) | null;
392
- }) => void | Promise<void>;
393
- /** The form plugin's dataset resolver — registered on the host lens.
394
- * `diagnose` is the per-entry observability channel (the honesty rule: an
395
- * explicitly listed push-button/signature/unsupported value is DIAGNOSED
396
- * as `submit-entry-unsupported`, never silently dropped). */
397
- type SubmitResolver = (intent: SubmitIntent, ctx: ActionContext, diagnose: (diagnostic: ActionDiagnostic) => void) => Promise<ActionSubmitRequest>;
398
- /** PUBLIC — embedders and chrome. Twins follow permissions.md: same name,
399
- * same arguments, boolean, answering "would the dispatcher accept this and
400
- * attempt execution" (per-node truth lives in the result's `nodes`). */
401
- interface ActionsCapability {
402
- execute(tree: PdfActionTree, ctx: ActionContext): Promise<ActionDispatchResult>;
403
- canExecute(tree: PdfActionTree, ctx: ActionContext): boolean;
404
- /**
405
- * Report a trigger. Submission is SYNCHRONOUS — the queue slot is taken
406
- * before this returns, so two dispatch calls execute in call order even
407
- * when their resolutions race; all reads happen inside the queued
408
- * operation. Never rejects: resolution failures come back as `refused`
409
- * with a `trigger-failed` diagnostic, so `void dispatch(...)` is safe.
410
- */
411
- dispatch(trigger: ActionTrigger): Promise<ActionTriggerResult>;
412
- canDispatch(trigger: ActionTrigger): boolean;
413
- /** Identity-safe port install: the returned disposer clears the slot only
414
- * while THIS adapter is still current; `null` force-clears. */
415
- setUiAdapter(adapter: ActionUiAdapter | null): Unsubscribe;
416
- /**
417
- * Run one embedder-owned document verb as ONE serialized queue operation:
418
- * open-ordering guard → before-event tree (WS/WP) → `operation()` →
419
- * after-event tree (DS/DP). Two concurrent calls can never interleave
420
- * their phases. Laws: a before-event failure never cancels the operation;
421
- * `operation()` throwing skips the after-event and rethrows; the whole
422
- * body honors `triggers.document: false` (trees skipped, operation still
423
- * runs); print verbs hold the document-print latch, so nested
424
- * `doc.print()` calls are suppressed with a `reentrant-print` diagnostic.
425
- * The queue is deliberately held for the operation's duration — that IS
426
- * the serialization (WS mutations are in the bytes a save operation
427
- * pulls).
428
- */
429
- runDocumentVerb<T>(verb: 'save' | 'print', operation: () => Promise<T> | T): Promise<T>;
430
- /**
431
- * The cooperative WC door (D4): runs the catalog will-close tree (open
432
- * ordering guaranteed) and resolves when its effects are committed. Call
433
- * `documents.close()` AFTER this resolves. Scripts never run inside
434
- * teardown — closing without this call is a named Acrobat-parity
435
- * deviation, not an error.
436
- */
437
- prepareClose(): Promise<ActionTriggerResult>;
438
- /**
439
- * Sink 1 of the submit chain (identity-safe slot, like the UI adapter —
440
- * but installing it does NOT arm the open-sequence latch). With no
441
- * handler and no submit-capable document home, submits block with a
442
- * `no-submit-sink` diagnostic.
443
- */
444
- setSubmitHandler(handler: ActionSubmitHandler | null): Unsubscribe;
445
- onAction: EventHook<ActionDispatchEvent>;
446
- onDiagnostic: EventHook<ActionDiagnostic>;
447
- /** Script-plane observability (dispatch-driven AND K/V/C/F-driven — the
448
- * form pipeline surfaces through the same doors). */
449
- onScriptDiagnostic: EventHook<ScriptDiagnostic>;
450
- onScriptError: EventHook<ScriptExecutionError>;
451
- }
452
- /** HOST lens — plugin-to-plugin only; import the token from
453
- * `@embedpdf/plugin-actions/contract/host`, never from application code. */
454
- interface ActionsHostCapability extends ActionsCapability {
455
- /** Deterministic LAST-WINS on duplicates (a `duplicate-executor`
456
- * diagnostic is emitted); the disposer removes the entry only while it is
457
- * still the current one. */
458
- registerExecutor(type: PdfActionType, executor: ActionExecutor): Unsubscribe;
459
- registerAnnotCommitSink(sink: AnnotCommitSink): Unsubscribe;
460
- registerFormCommitSink(sink: FormCommitSink): Unsubscribe;
461
- /**
462
- * THIS document's realm — present ONLY when `javascript.enabled` (its
463
- * presence IS form's "scripting on" signal).
464
- */
465
- scriptRealm?: ScriptRealmPort;
466
- /**
467
- * Mint a realm for a DETACHED document under this document's policy and
468
- * environment (same sandbox factory, identity, clock, budget; a fresh
469
- * sandbox, so isolated globals). Present ONLY when `javascript.enabled`,
470
- * like `scriptRealm`. The caller owns the returned realm's lifetime and
471
- * surfaces its results with `realm: 'detached'`.
472
- */
473
- createDetachedScriptRealm?(target: ScriptRealmTarget): DetachedScriptRealm;
474
- /** Surface a script transaction's UI effects/diagnostics/error through the
475
- * ONE port (adapter matrix + authority print gate + script hooks). */
476
- surfaceScriptResult(result: ScriptSurfaceResult): void;
477
- /** Surface a K/V/C/F commit result: splits boot-phase and user-phase
478
- * effects into their own surfaces (diagnostics and the error ride the
479
- * user phase) — the one place that split lives. */
480
- surfaceScriptCommit(commit: ScriptCommitSurface, context: {
481
- origin: ActionOrigin;
482
- realm: ScriptRealmKind;
483
- }): void;
484
- /** Stage's page-truth push door — see {@link PageStateReport}. */
485
- reportPageState(report: PageStateReport): void;
486
- /**
487
- * The form plugin's dataset resolver (D7): both submit sources — action
488
- * nodes and script `doc.submitForm()` effects — normalize to a
489
- * {@link SubmitIntent} and resolve through this one door. Identity-safe;
490
- * without it every submit blocks with `no-submit-resolver`.
491
- */
492
- registerSubmitResolver(resolver: SubmitResolver): Unsubscribe;
493
- }
494
- interface ActionsState {
495
- /** Monotonic dispatch counter — store-visible observability. */
496
- seq: number;
497
- }
498
- type ActionsAction = {
499
- type: 'ACTIONS_DISPATCHED';
500
- };
501
- declare const ActionsToken: import("@embedpdf/core").CapabilityToken<ActionsCapability>;
502
- //#endregion
503
- export { DetachedScriptRealm as A, SubmitIntent as B, ActionsHostCapability as C, AnnotCommitEntry as D, ActionsToken as E, ScriptCommitSurface as F, originOf as H, ScriptRealmKind as I, ScriptRealmPort as L, FormCommitSink as M, PageStateReport as N, AnnotCommitResult as O, PdfAnnotationEventKind as P, ScriptRealmTarget as R, ActionsCapability as S, ActionsState as T, SubmitResolver as V, ActionTrigger as _, ActionExecutor as a, ActionUiContext as b, ActionNodeStatus as c, ActionPolicyDecision as d, ActionPolicyRow as f, ActionSubmitRequest as g, ActionSubmitHandler as h, ActionDispatchResult as i, DocumentTriggerEvent as j, AnnotCommitSink as k, ActionOrigin as l, ActionStepResult as m, ActionDiagnostic as n, ActionExecutorResult as o, ActionSource as p, ActionDispatchEvent as r, ActionNodeResult as s, ActionContext as t, ActionPolicy as u, ActionTriggerResult as v, ActionsPluginConfig as w, ActionsAction as x, ActionUiAdapter as y, ScriptSurfaceResult as z };
504
- //# sourceMappingURL=types-D-DoiESj.d.cts.map