@embedpdf/plugin-actions 3.0.0-next.14 → 3.0.0-next.16

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-BTPW8b4L.d.cts +557 -0
  8. package/dist/contract-Cn-7mBY8.d.ts +557 -0
  9. package/dist/contract-CwN3NAXU.js +175 -0
  10. package/dist/contract-CwN3NAXU.js.map +1 -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-BbODswDs.d.ts +165 -0
  18. package/dist/host-contract-D22Gz-qt.d.cts +165 -0
  19. package/dist/index.cjs +1588 -1072
  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 +1586 -1072
  24. package/dist/index.js.map +1 -1
  25. package/package.json +7 -11
  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
@@ -0,0 +1,175 @@
1
+ import { createCapabilityToken } from "@embedpdf/core";
2
+ import { annotationKey } from "@embedpdf/engine-core/runtime";
3
+ //#region src/token.ts
4
+ /** The package token, created once here; `contract.ts` re-exports it and
5
+ * `host-contract.ts` widens it to the host capability. */
6
+ const ActionsToken = createCapabilityToken("actions", {
7
+ hint: `add actionsPlugin() from '@embedpdf/plugin-actions' to your plugins list`,
8
+ promises: {
9
+ execute: true,
10
+ executeNamed: true,
11
+ getActionTree: true,
12
+ dispatch: true,
13
+ runDocumentVerb: true,
14
+ prepareClose: true
15
+ }
16
+ });
17
+ //#endregion
18
+ //#region src/hover-pump.ts
19
+ const sameTarget = (left, right) => {
20
+ if (left === null || right === null) return left === right;
21
+ return left.page.objectNumber === right.page.objectNumber && annotationKey(left.ref) === annotationKey(right.ref);
22
+ };
23
+ /**
24
+ * The one hover state machine every event plane shares: per pointer feed,
25
+ * `{ delivered, desired, inFlight }`. On each settle it delivers the
26
+ * transition `delivered → desired` as `Exit(delivered)` then
27
+ * `Enter(desired)`, submitted back to back synchronously: dispatch takes its
28
+ * queue slot before returning, so a slow resolution can never split or
29
+ * reorder the pair. Under pressure intermediate targets are skipped by
30
+ * design: the pointer sweeping A→B→C while A's exit is in flight delivers
31
+ * `Exit(A) → Enter(C)`, never a stale `Enter(B)`.
32
+ */
33
+ function createHoverPump(dispatch) {
34
+ let delivered = null;
35
+ let desired = null;
36
+ let inFlight = false;
37
+ const pump = () => {
38
+ if (inFlight || sameTarget(delivered, desired)) return;
39
+ inFlight = true;
40
+ const from = delivered;
41
+ const to = desired;
42
+ delivered = to;
43
+ const submissions = [];
44
+ if (from && from.events?.exit !== false) submissions.push(dispatch({
45
+ scope: "annotation",
46
+ event: "cursorExit",
47
+ ref: from.ref,
48
+ page: from.page,
49
+ ...from.source ? { source: from.source } : {}
50
+ }));
51
+ if (to && to.events?.enter !== false) submissions.push(dispatch({
52
+ scope: "annotation",
53
+ event: "cursorEnter",
54
+ ref: to.ref,
55
+ page: to.page,
56
+ ...to.source ? { source: to.source } : {}
57
+ }));
58
+ Promise.allSettled(submissions).then(() => {
59
+ inFlight = false;
60
+ pump();
61
+ });
62
+ };
63
+ return {
64
+ hover(target) {
65
+ desired = target;
66
+ pump();
67
+ },
68
+ reset() {
69
+ delivered = null;
70
+ desired = null;
71
+ }
72
+ };
73
+ }
74
+ //#endregion
75
+ //#region src/submit-encoding.ts
76
+ /**
77
+ * Encode a resolved submission dataset as `application/x-www-form-urlencoded`
78
+ * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than
79
+ * utf-8 is the handler's problem). A name-only entry (`value === null`, the
80
+ * IncludeNoValueFields shape) encodes as a bare name; a multi-select list
81
+ * box repeats the name per value, the HTML-form convention.
82
+ *
83
+ * Pure and dependency-free on purpose: a convenience for embedder handlers,
84
+ * never called by the plugin itself (the plugin never touches a network).
85
+ */
86
+ const submitEntriesToUrlEncoded = (entries) => entries.flatMap(({ name, value }) => value === null ? [encodeURIComponent(name)] : Array.isArray(value) ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`) : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`]).join("&");
87
+ //#endregion
88
+ //#region src/contract.ts
89
+ /** Trigger → provenance descriptor (the {@link ActionContext.event} axis). */
90
+ const eventOf = (trigger) => {
91
+ switch (trigger.scope) {
92
+ case "activate": return { scope: "activate" };
93
+ case "annotation": return {
94
+ scope: "annotation",
95
+ name: trigger.event
96
+ };
97
+ case "page": return {
98
+ scope: "page",
99
+ name: trigger.event
100
+ };
101
+ case "document": return {
102
+ scope: "document",
103
+ name: trigger.event
104
+ };
105
+ }
106
+ };
107
+ /** The one origin mapping, derived by the dispatcher and never claimed by a
108
+ * caller: a feed cannot launder a hover into a user gesture. */
109
+ const triggerOriginOf = (trigger) => {
110
+ switch (trigger.scope) {
111
+ case "activate": return "user";
112
+ case "annotation": return trigger.event === "cursorEnter" || trigger.event === "cursorExit" ? "hover" : "user";
113
+ case "page":
114
+ case "document": return "lifecycle";
115
+ }
116
+ };
117
+ /** What the actions settings are when the app registers none. */
118
+ const ACTIONS_DEFAULTS = {
119
+ policy: {
120
+ goto: {
121
+ user: "allow",
122
+ hover: "allow",
123
+ lifecycle: "allow"
124
+ },
125
+ named: {
126
+ user: "allow",
127
+ hover: "allow",
128
+ lifecycle: "allow"
129
+ },
130
+ hide: {
131
+ user: "allow",
132
+ hover: "allow",
133
+ lifecycle: "allow"
134
+ },
135
+ "reset-form": {
136
+ user: "allow",
137
+ hover: "allow",
138
+ lifecycle: "allow"
139
+ },
140
+ javascript: {
141
+ user: "allow",
142
+ hover: "allow",
143
+ lifecycle: "allow"
144
+ },
145
+ uri: {
146
+ user: "adapter",
147
+ hover: "report",
148
+ lifecycle: "report"
149
+ },
150
+ print: {
151
+ user: "adapter",
152
+ hover: "block",
153
+ lifecycle: "block"
154
+ },
155
+ "submit-form": {
156
+ user: "adapter",
157
+ hover: "block",
158
+ lifecycle: "block"
159
+ }
160
+ },
161
+ triggers: {
162
+ document: true,
163
+ page: true,
164
+ annotation: true
165
+ },
166
+ openSequence: "auto",
167
+ javascript: {
168
+ enabled: false,
169
+ identity: null
170
+ }
171
+ };
172
+ //#endregion
173
+ export { createHoverPump as a, submitEntriesToUrlEncoded as i, eventOf as n, ActionsToken as o, triggerOriginOf as r, ACTIONS_DEFAULTS as t };
174
+
175
+ //# sourceMappingURL=contract-CwN3NAXU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-CwN3NAXU.js","names":[],"sources":["../src/token.ts","../src/hover-pump.ts","../src/submit-encoding.ts","../src/contract.ts"],"sourcesContent":["/** The package token, created once here; `contract.ts` re-exports it and\n * `host-contract.ts` widens it to the host capability. */\nimport { createCapabilityToken } from '@embedpdf/core';\n\nimport type { ActionsCapability } from './contract';\n\nexport const ActionsToken = createCapabilityToken<ActionsCapability>('actions', {\n hint: `add actionsPlugin() from '@embedpdf/plugin-actions' to your plugins list`,\n // Without a document, an adapter's stand-in rejects these with `not-ready`, as the\n // capability would; the type asks for every member that returns a promise.\n promises: {\n execute: true,\n executeNamed: true,\n getActionTree: true,\n dispatch: true,\n runDocumentVerb: true,\n prepareClose: true,\n },\n});\n","import { annotationKey, type AnnotationRef, type PageRef } from '@embedpdf/engine-core/runtime';\n\nimport type { ActionSource, ActionTrigger, ActionTriggerResult } from './contract';\n\n/** One hoverable target, as a feed sees it. `events` lets a feed that knows\n * which trees exist (a folded model, a fill item) skip the inert half of a\n * pair; omitted flags default to true. */\nexport interface HoverTarget {\n ref: AnnotationRef;\n page: PageRef;\n /** Optional provenance hint forwarded on the trigger (widget/link feeds). */\n source?: ActionSource;\n events?: { enter?: boolean; exit?: boolean };\n}\n\nexport interface HoverPump {\n /** Report where the pointer is now (null = nowhere interesting). */\n hover(target: HoverTarget | null): void;\n /** Forget everything without dispatching (teardown; document switch). */\n reset(): void;\n}\n\nconst sameTarget = (left: HoverTarget | null, right: HoverTarget | null): boolean => {\n if (left === null || right === null) return left === right;\n return (\n left.page.objectNumber === right.page.objectNumber &&\n annotationKey(left.ref) === annotationKey(right.ref)\n );\n};\n\n/**\n * The one hover state machine every event plane shares: per pointer feed,\n * `{ delivered, desired, inFlight }`. On each settle it delivers the\n * transition `delivered → desired` as `Exit(delivered)` then\n * `Enter(desired)`, submitted back to back synchronously: dispatch takes its\n * queue slot before returning, so a slow resolution can never split or\n * reorder the pair. Under pressure intermediate targets are skipped by\n * design: the pointer sweeping A→B→C while A's exit is in flight delivers\n * `Exit(A) → Enter(C)`, never a stale `Enter(B)`.\n */\nexport function createHoverPump(\n dispatch: (trigger: ActionTrigger) => Promise<ActionTriggerResult>,\n): HoverPump {\n let delivered: HoverTarget | null = null;\n let desired: HoverTarget | null = null;\n let inFlight = false;\n\n const pump = (): void => {\n if (inFlight || sameTarget(delivered, desired)) return;\n inFlight = true;\n const from = delivered;\n const to = desired;\n delivered = to;\n const submissions: Array<Promise<unknown>> = [];\n if (from && from.events?.exit !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorExit',\n ref: from.ref,\n page: from.page,\n ...(from.source ? { source: from.source } : {}),\n }),\n );\n }\n if (to && to.events?.enter !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorEnter',\n ref: to.ref,\n page: to.page,\n ...(to.source ? { source: to.source } : {}),\n }),\n );\n }\n void Promise.allSettled(submissions).then(() => {\n inFlight = false;\n pump(); // the pointer may have moved on — deliver the latest transition\n });\n };\n\n return {\n hover(target) {\n desired = target;\n pump();\n },\n reset() {\n delivered = null;\n desired = null;\n },\n };\n}\n","import type { FormSubmissionEntry } from '@embedpdf/engine-core/runtime';\n\n/**\n * Encode a resolved submission dataset as `application/x-www-form-urlencoded`\n * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than\n * utf-8 is the handler's problem). A name-only entry (`value === null`, the\n * IncludeNoValueFields shape) encodes as a bare name; a multi-select list\n * box repeats the name per value, the HTML-form convention.\n *\n * Pure and dependency-free on purpose: a convenience for embedder handlers,\n * never called by the plugin itself (the plugin never touches a network).\n */\nexport const submitEntriesToUrlEncoded = (entries: FormSubmissionEntry[]): string =>\n entries\n .flatMap(({ name, value }) =>\n value === null\n ? [encodeURIComponent(name)]\n : Array.isArray(value)\n ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`)\n : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`],\n )\n .join('&');\n","/**\n * @embedpdf/plugin-actions/contract: the public action vocabulary: triggers,\n * contexts, results, policy, the UI adapter and submit handler ports, and\n * the capability itself. Sibling-plugin registration (commit sinks, script\n * realms, the page-state report) is the host lens (`/contract/host`).\n */\nimport type {\n DeepPartial,\n EventHook,\n OperationOptions,\n SettingsApi,\n Unsubscribe,\n} from '@embedpdf/core';\nimport type {\n ScriptBudget,\n ScriptDiagnostic,\n ScriptExecutionError,\n ScriptIdentity,\n ScriptSandboxFactory,\n} from '@embedpdf/core-acrojs';\nimport type {\n AnnotationRef,\n FormFieldRef,\n FormSubmissionEntry,\n FormSubmissionReceipt,\n OutlineItemRef,\n PageRef,\n PdfActionNode,\n PdfActionTargetRef,\n PdfActionTree,\n PdfActionType,\n} from '@embedpdf/engine-core/runtime';\n\nexport { ActionsToken } from './token';\n/** The action trees the verbs take and resolve: what a PDF's links, buttons, pages and document carry. */\nexport type { PdfActionNode, PdfActionTree, PdfActionType } from '@embedpdf/engine-core/runtime';\nexport { createHoverPump } from './hover-pump';\nexport type { HoverPump, HoverTarget } from './hover-pump';\nexport { submitEntriesToUrlEncoded } from './submit-encoding';\n\n// ── the when/who axes ──────────────────────────────────────────────────────\n\n/** Why a dispatch happened: `'user'` for a real activation gesture,\n * `'hover'` for pointer enter and exit, `'lifecycle'` for page and document\n * events. The policy decides per type and origin. */\nexport type ActionOrigin = 'user' | 'hover' | 'lifecycle';\n\n/** Who initiated the dispatch. Fields are required where an executor needs\n * them: the JavaScript executor builds `event.target` from the widget\n * source's `field`. Provenance only: policy never reads it. */\nexport type ActionSource =\n | { kind: 'widget'; field: FormFieldRef; annotation: AnnotationRef; page: PageRef }\n | { kind: 'link'; annotation?: AnnotationRef; page?: PageRef }\n /** An outline item the user followed: its /A, run as a link's is. */\n | { kind: 'outline'; item: OutlineItemRef }\n /** A non-widget annotation's own /AA event (E/X on squares, stamps, …). */\n | { kind: 'annotation'; annotation: AnnotationRef; page: PageRef }\n /** A page /AA tree (O/C) inside a page-trigger fan-out. */\n | { kind: 'page'; page: PageRef }\n /** The document-open sequence (openDestination / OpenAction). */\n | { kind: 'document' }\n | { kind: 'api' };\n\n/** The document lifecycle vocabulary: `open` (the document-open sequence)\n * plus the five catalog `/AA` verbs (ISO 32000-2 Table 200: /WC, /WS, /DS,\n * /WP, /DP). Whoever owns the verb dispatches them; `runDocumentVerb` is the\n * serialized door for save and print, `prepareClose` for close. */\nexport type DocumentTriggerEvent =\n | 'open'\n | 'will-save'\n | 'did-save'\n | 'will-print'\n | 'did-print'\n | 'will-close';\n\n/** Trigger provenance, derived beside {@link triggerOriginOf}: the\n * executor-visible \"which event fired\" (cursorEnter and cursorExit are both\n * `origin: 'hover'`; this carries the difference). */\nexport type ActionTriggerEvent =\n | { scope: 'activate' }\n | { scope: 'annotation'; name: PdfAnnotationEventKind }\n | { scope: 'page'; name: 'open' | 'close' | 'visible' | 'invisible' }\n | { scope: 'document'; name: DocumentTriggerEvent };\n\n/** The four field-level /AA scripts (ISO Table 198: K F V C). */\nexport type PdfFieldEventKind = 'keystroke' | 'format' | 'validate' | 'calculate';\n\n/** The Named verbs the viewer interprets (ISO Table 215's four page verbs\n * plus Adobe's `Print`); any other name is accepted and reported inert. */\nexport type PdfNamedAction =\n | 'NextPage'\n | 'PrevPage'\n | 'FirstPage'\n | 'LastPage'\n | 'Print'\n | (string & {});\n\n/**\n * Where an action tree lives, for {@link ActionsCapability.getActionTree}.\n * Each arm names its own event vocabulary; the annotation arm defaults to\n * the /A click tree, the page and document arms to their open trees.\n */\nexport type ActionTreeSource =\n | {\n kind: 'annotation';\n annotation: AnnotationRef;\n page: PageRef;\n event?: 'activate' | PdfAnnotationEventKind;\n }\n | { kind: 'field'; field: FormFieldRef; event: PdfFieldEventKind }\n | { kind: 'page'; page: PageRef; event?: 'open' | 'close' }\n | { kind: 'document'; event?: DocumentTriggerEvent }\n /** An outline item's /A. */\n | { kind: 'outline'; item: OutlineItemRef };\n\n/** The document-open sequence has run (once per document). */\nexport interface OpenSequenceCompletedEvent {\n readonly result: ActionTriggerResult;\n}\n\nexport interface ActionContext {\n origin: ActionOrigin;\n source: ActionSource;\n event: ActionTriggerEvent;\n}\n\n/** The six annotation /AA pointer and focus events (ISO 32000-2 Table 197:\n * /E /X /D /U /Fo /Bl). The page-lifecycle events (/PO /PC /PV /PI) are not\n * here: they fan out from page triggers, never from per-annotation dispatch. */\nexport type PdfAnnotationEventKind =\n | 'cursorEnter'\n | 'cursorExit'\n | 'mouseDown'\n | 'mouseUp'\n | 'focus'\n | 'blur';\n\n/**\n * Trigger vocabulary: what a feed reports. The dispatcher resolves trees,\n * derives the origin ({@link triggerOriginOf}) and fans out. `source` on the\n * annotation-addressed arms is an optional provenance hint from first-party\n * feeds (a widget feed passes its field ref so the JavaScript executor can\n * anchor `event.target`); policy never reads it and it cannot change origin.\n */\nexport type ActionTrigger =\n | { scope: 'activate'; ref: AnnotationRef; page: PageRef; source?: ActionSource }\n | {\n scope: 'annotation';\n event: PdfAnnotationEventKind;\n ref: AnnotationRef;\n page: PageRef;\n source?: ActionSource;\n }\n | { scope: 'page'; event: 'open' | 'close' | 'visible' | 'invisible'; page: PageRef }\n | { scope: 'document'; event: DocumentTriggerEvent };\n\n/** Trigger → provenance descriptor (the {@link ActionContext.event} axis). */\nexport const eventOf = (trigger: ActionTrigger): ActionTriggerEvent => {\n switch (trigger.scope) {\n case 'activate':\n return { scope: 'activate' };\n case 'annotation':\n return { scope: 'annotation', name: trigger.event };\n case 'page':\n return { scope: 'page', name: trigger.event };\n case 'document':\n return { scope: 'document', name: trigger.event };\n }\n};\n\n/** The one origin mapping, derived by the dispatcher and never claimed by a\n * caller: a feed cannot launder a hover into a user gesture. */\nexport const triggerOriginOf = (trigger: ActionTrigger): ActionOrigin => {\n switch (trigger.scope) {\n case 'activate':\n return 'user';\n case 'annotation':\n return trigger.event === 'cursorEnter' || trigger.event === 'cursorExit' ? 'hover' : 'user';\n case 'page':\n case 'document':\n return 'lifecycle';\n }\n};\n\n// ── results ────────────────────────────────────────────────────────────────\n\nexport type ActionNodeStatus =\n | 'executed' // the registered executor / built-in interpreter ran\n | 'blocked' // policy said no (submit-form, origin-gated uri, …)\n | 'no-executor' // nothing registered/installed for this type\n | 'inert' // an executor was present but declined (scripting off, unknown verb)\n | 'failed' // the executor threw or reported failure\n | 'skipped'; // an earlier document-lifetime failure stopped this node\n\nexport interface ActionNodeResult {\n /** Node address as child indexes from the root ([] = root, [0] = root.next[0]…). */\n path: number[];\n type: PdfActionType;\n status: ActionNodeStatus;\n detail?: string;\n}\n\nexport interface ActionDiagnostic {\n code:\n | 'incomplete-tree'\n | 'blocked'\n | 'no-executor'\n | 'no-adapter'\n | 'no-session-sink'\n | 'unresolved-target'\n | 'duplicate-executor'\n | 'executor-inert'\n | 'executor-failed'\n | 'trigger-disabled' // the `triggers` setting turned this family off\n | 'no-commit-sink' // a document effect had no registered owner sink\n | 'trigger-failed' // resolution threw — dispatch() never rejects\n | 'cascade-budget' // programmatic page-lifecycle rounds exceeded the cap\n | 'open-sequence-replayed' // a second document-open trigger arrived\n | 'no-submit-sink' // no handler installed and the document has no home\n | 'no-submit-resolver' // no form plugin registered a dataset resolver\n | 'submit-payload-unavailable' // older-runtime extraction: node stays inert\n | 'submit-entry-unsupported' // an explicitly included entry has no representable value\n | 'reentrant-print'; // a print request during a document print event — suppressed\n message: string;\n}\n\n/**\n * One logical dispatch transaction's outcome. Document-lifetime work is not\n * rolled back: an earlier successful reset or script write survives a later\n * failure; `status: 'partial'` says so, and `nodes` carries the per-node\n * truth. `'cancelled'`: the caller's signal fired while the tree ran, so the\n * walk stopped before its next node and no navigation or external effect\n * fired.\n */\nexport interface ActionDispatchResult {\n status: 'executed' | 'partial' | 'inert' | 'refused' | 'cancelled';\n nodes: ActionNodeResult[];\n diagnostics: ActionDiagnostic[];\n}\n\n/**\n * One tree's execution inside a trigger: its true source, its true tree, its\n * own node results (`path`s are real walk paths, never prefixed).\n * `onExecuted` fires once per step with exactly this tree and a context\n * built from this source, so fan-out never merges trees in the event.\n */\nexport interface ActionStepResult {\n source: ActionSource;\n tree: PdfActionTree;\n result: ActionDispatchResult;\n}\n\n/**\n * What `dispatch(trigger)` returns: the aggregate plus per-step truth. A step\n * failure never skips sibling steps (a broken annotation /PC must not cancel\n * the page's /C); deferred navigation and external effects flush per step,\n * not per trigger.\n */\nexport interface ActionTriggerResult {\n /** `'cancelled'`: the caller's signal fired before or while the trigger ran. */\n status: 'executed' | 'partial' | 'inert' | 'refused' | 'cancelled';\n steps: ActionStepResult[];\n /** Trigger-level diagnostics (disabled family, resolution failure);\n * per-node diagnostics live inside each step's `result`. */\n diagnostics: ActionDiagnostic[];\n}\n\n// ── events ─────────────────────────────────────────────────────────────────\n\n/** Actions ran: one tree, whatever started it (a click, a page, the document, your code). */\nexport interface ActionExecutedEvent {\n readonly tree: PdfActionTree;\n readonly result: ActionDispatchResult;\n /** What started them. */\n readonly source: ActionSource;\n}\n\n/**\n * An action was blocked, reported or couldn't run. `action` is its type and\n * `source` what started it; both are `null` for a diagnostic about no one\n * action (a trigger family turned off, an executor replaced). The result of\n * the run that reported it lists the same diagnostic with its message.\n */\nexport interface ActionDiagnosticReportedEvent {\n readonly code: ActionDiagnostic['code'];\n readonly action: PdfActionType | null;\n readonly source: ActionSource | null;\n}\n\n/**\n * A script was stopped from doing something, such as reaching the network,\n * or used something the viewer doesn't support.\n */\nexport type ScriptDiagnosticReportedEvent = Readonly<ScriptDiagnostic>;\n\n/**\n * A script threw an error. `source` is what started it, or `null` for a\n * script no action started: a form field's keystroke, format, validate or\n * calculate script, or a stamp's template.\n */\nexport interface ScriptFailedEvent {\n readonly error: ScriptExecutionError;\n readonly source: ActionSource | null;\n}\n\n// ── policy ─────────────────────────────────────────────────────────────────\n\n/** The decision per type and origin. `allow` executes; `adapter` routes\n * through the type's port (the UI adapter; for `submit-form`, the sink\n * chain: embedder handler → the document's home → blocked); `report`\n * records a blocked node without executing; `block` refuses. The `launch`,\n * `goto-remote`, `goto-embedded` and media types are fixed `'never'` and\n * not configurable. */\nexport type ActionPolicyDecision = 'allow' | 'adapter' | 'report' | 'block';\nexport type ActionPolicyRow = Readonly<Record<ActionOrigin, ActionPolicyDecision>>;\n\nexport interface ActionPolicy {\n readonly goto: ActionPolicyRow;\n readonly named: ActionPolicyRow;\n readonly hide: ActionPolicyRow;\n readonly 'reset-form': ActionPolicyRow;\n readonly javascript: ActionPolicyRow;\n readonly uri: ActionPolicyRow;\n /** The Named `Print` verb, owned by policy and the UI adapter, never the\n * stage. (An Acrobat-compatible extension: ISO 32000-2 Table 215 defines\n * only the four page verbs; an unrecognized name \"shall take no action\".) */\n readonly print: ActionPolicyRow;\n /** SubmitForm: `'adapter'` routes through the sink chain. Default: user\n * origin only; hover and lifecycle submits stay blocked. */\n readonly 'submit-form': ActionPolicyRow;\n}\n\n/** Who scripts think the user is: fields over the document's user, or a function that returns them. */\nexport type ActionsScriptIdentity = Partial<ScriptIdentity> | (() => Partial<ScriptIdentity>);\n\n/**\n * The actions plugin's settings. `actionsPlugin(config)` registers them over\n * {@link ACTIONS_DEFAULTS}, and `updateSettings()` changes them for every\n * document while the app runs. `policy`, `triggers` and\n * `javascript.identity` apply to the next action; `javascript.enabled`\n * applies to the documents opened after the change (a document's script\n * engine starts when it opens); `openSequence` applies until a document's\n * opening actions have run.\n */\nexport interface ActionsSettings {\n /** The rules: per kind of action and per origin. Rows merge, so a change names only what it changes. */\n readonly policy: ActionPolicy;\n /** Run the actions of the `document`, its `page`s, or `annotation`s. A click on a link or button always runs. */\n readonly triggers: {\n readonly document: boolean;\n readonly page: boolean;\n readonly annotation: boolean;\n };\n /**\n * When the document's opening actions run (the open destination, then the\n * catalog /OpenAction, then the first page's /O). `'auto'` runs them once\n * at the first sign of a person: a UI adapter installing, or a first\n * click; the first page's /O then comes from the Stage's page report.\n * `'headless'` runs them as the document opens, for an app without a\n * Stage; `'off'` never runs them.\n */\n readonly openSequence: 'auto' | 'headless' | 'off';\n readonly javascript: {\n /** Run the document's JavaScript. Off by default: no script engine ever loads. */\n readonly enabled: boolean;\n /** Who scripts think the user is, on top of the document's user. `null`: the document's user. */\n readonly identity: ActionsScriptIdentity | null;\n };\n}\n\n/** What the actions settings are when the app registers none. */\nexport const ACTIONS_DEFAULTS: ActionsSettings = {\n policy: {\n goto: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n named: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n hide: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n 'reset-form': { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n javascript: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n // No tab opens by itself: only a real click reaches the adapter.\n uri: { user: 'adapter', hover: 'report', lifecycle: 'report' },\n print: { user: 'adapter', hover: 'block', lifecycle: 'block' },\n // Form data leaves the viewer only on a click: handler, then the document's home.\n 'submit-form': { user: 'adapter', hover: 'block', lifecycle: 'block' },\n },\n triggers: { document: true, page: true, annotation: true },\n openSequence: 'auto',\n javascript: { enabled: false, identity: null },\n};\n\n/**\n * The script environment, given once when the plugin is registered: not a\n * setting, because a document's script engine is built with it when the\n * document opens.\n */\nexport interface ActionsScriptEnvironment {\n /** Override the lazy QuickJS factory (tests or another isolated VM). */\n readonly sandboxFactory?: ScriptSandboxFactory;\n readonly fileName?: () => string;\n /** Injected deterministic transaction environment. */\n readonly now?: () => number;\n readonly utcOffsetMinutes?: () => number;\n readonly randomSeed?: () => number;\n readonly budget?: ScriptBudget;\n /**\n * The deterministic aggregate: the most JavaScript nodes one dispatch may\n * run (default 16). A /Next chain shares it instead of multiplying the\n * per-run time budget, and a count stays deterministic where a wall-clock\n * aggregate would not. Once exhausted, the remaining JavaScript nodes\n * report inert with a budget reason.\n */\n readonly maxScriptNodesPerDispatch?: number;\n}\n\n/**\n * What `actionsPlugin(config)` takes: any of the settings, merged over the\n * defaults, and the script environment beside `javascript`'s settings.\n */\nexport interface ActionsConfig extends DeepPartial<Omit<ActionsSettings, 'javascript'>> {\n readonly javascript?: DeepPartial<ActionsSettings['javascript']> & ActionsScriptEnvironment;\n}\n\n// ── registration surfaces (host lens) ──────────────────────────────────────\n\nexport type ActionExecutorResult =\n | { status: 'executed' }\n | { status: 'inert'; reason: string }\n | { status: 'failed'; error: string };\n\n/** One node of one registered type, executed in dispatch order. Executors\n * never see the tree or the capability, so an executor cannot cascade into\n * further dispatches. */\nexport type ActionExecutor = (\n node: PdfActionNode,\n actionContext: ActionContext,\n) => Promise<ActionExecutorResult> | ActionExecutorResult;\n\n/** The origin and phase every script-produced UI request carries: the\n * default adapter's visibility matrix keys on it; embedder adapters receive\n * everything and decide for themselves. */\nexport interface ActionUiContext {\n origin: ActionOrigin;\n /** Script-model axis: `'boot'` = name-tree/document-open boot scripts. */\n phase: 'boot' | 'user';\n}\n\nexport interface ActionUiAdapter {\n /** A URI action to open; `isMap` is the /IsMap flag. */\n openUri(uri: string, options: { isMap: boolean; origin: ActionOrigin }): void;\n /** The Named `Print` verb and script `print()` requests (authority-gated\n * upstream: `doc.print` refusals never reach the adapter). */\n print(uiContext?: ActionUiContext): void;\n /** Script `app.alert`: the one alert port for every script origin. */\n alert?(message: string, options: ActionUiContext & { icon: number; title?: string }): void;\n /** Script `this.pageNum = n` navigation requests. */\n gotoPage?(page: number, uiContext: ActionUiContext): void;\n}\n\n// ── the submit pipeline: one intent, one resolver, one sink chain ──\n\n/**\n * A normalized submit intent, one shape for both sources: a SubmitForm action\n * node's extracted payload, or a script `doc.submitForm()` effect\n * (include-mode names, `exclude` false). Resolving it into a dataset is the\n * form plugin's job (it owns the field plane), through the registered\n * resolver.\n */\nexport interface SubmitIntent {\n url: string | null;\n /** ISO 32000-2 Table 239 targets (names and object numbers mixed); `null`\n * is the whole eligible form. */\n fields: PdfActionTargetRef[] | null;\n exclude: boolean;\n includeNoValueFields: boolean;\n format: 'fdf' | 'html' | 'xfdf' | 'pdf';\n method: 'post' | 'get';\n /** Raw ISO Table 240 word (0 for scripted submits without one). */\n flagsRaw: number;\n charSet?: string;\n}\n\n/**\n * The resolved dataset a sink receives. Entries carry the ISO semantics\n * already applied (descendants, the unconditional NoExport veto, push-button\n * and unsupported exclusion, diagnosed and never silent); the document's\n * declared routing survives as metadata. The stack never fetches `url`: an\n * embedder handler that chooses to must validate it (protocol and\n * destination allowlists) before any network call.\n */\nexport interface ActionSubmitRequest {\n url: string | null;\n method: 'post' | 'get';\n format: 'fdf' | 'html' | 'xfdf' | 'pdf';\n flagsRaw: number;\n charSet?: string;\n entries: FormSubmissionEntry[];\n origin: ActionOrigin;\n event: ActionTriggerEvent;\n}\n\n/**\n * The first sink of the chain: the embedder's application. Installing it is\n * the consent (it receives nothing the embedder could not already compute\n * from `forms.list()` under `doc.forms.read`, so no submit scope gates it).\n * Contract: synchronous acceptance marks the node `executed` (\"handed to the\n * embedder\", not \"delivered\"); a synchronous throw marks it `failed`; a\n * returned promise is not awaited, and a later rejection only emits a\n * diagnostic. `submitToDocumentHome` lets a handler compose with the second\n * sink (present only when the document has a submit-capable home).\n */\nexport type ActionSubmitHandler = (\n request: ActionSubmitRequest,\n chain: { submitToDocumentHome: (() => Promise<FormSubmissionReceipt>) | null },\n) => void | Promise<void>;\n\n// ── capabilities ───────────────────────────────────────────────────────────\n\n/**\n * The public capability, for embedders and chrome. Each `can*` twin takes the\n * same arguments as its verb and answers \"would the dispatcher accept this\n * and attempt execution\" (per-node truth lives in the result's `nodes`). Its\n * settings (`getSettings`, `updateSettings`, `resetSettings`,\n * `onSettingsChanged`) belong to the plugin, not to a document: a change\n * reaches every open document.\n */\nexport interface ActionsCapability extends SettingsApi<ActionsSettings> {\n /**\n * Run a resolved tree on the dispatch queue and fire `onExecuted`; a\n * failing node is reported in the result, not thrown. Rejects\n * `operation-cancelled` when `options.signal` fires: before the tree\n * starts, nothing runs; while it runs, it stops before its next node.\n */\n execute(\n tree: PdfActionTree,\n actionContext: ActionContext,\n options?: OperationOptions,\n ): Promise<ActionDispatchResult>;\n /** The tree is complete and its root node's policy decision is `allow` or `adapter`. */\n canExecute(tree: PdfActionTree, actionContext: ActionContext): boolean;\n /**\n * Run one Named verb (`NextPage`, `Print`, …) as a user-origin action\n * without building a tree — the programmatic twin of a Named link click.\n * `context` overrides the default `{ origin: 'user', source: { kind: 'api' } }`.\n * Rejects `operation-cancelled` like `execute()`.\n */\n executeNamed(\n name: PdfNamedAction,\n context?: Partial<ActionContext>,\n options?: OperationOptions,\n ): Promise<ActionDispatchResult>;\n /**\n * Whether the rules would run this Named verb from `context` (a click from\n * your code by default); `'Print'` also needs `doc.print`.\n */\n canExecuteNamed(name: PdfNamedAction, context?: Partial<ActionContext>): boolean;\n /**\n * Read the /A or /AA tree behind a source straight from the document\n * (`null` when absent). This is the raw tree: dispatch-time rules such as\n * ISO 32000-2 Table 197's \"/A shadows /AA U\" are not applied here. Rejects\n * `operation-cancelled` when `options.signal` fires.\n */\n getActionTree(\n source: ActionTreeSource,\n options?: OperationOptions,\n ): Promise<PdfActionTree | null>;\n /** Did `javascript.enabled` take effect — a script realm exists for this\n * document. */\n isScriptingEnabled(): boolean;\n /**\n * Report a trigger. Submission is synchronous: the queue slot is taken\n * before this returns, so two dispatch calls execute in call order even\n * when their resolutions race; all reads happen inside the queued\n * operation. Never rejects: resolution failures come back as `refused`\n * with a `trigger-failed` diagnostic, and a fired `options.signal` as\n * `cancelled`, so `void dispatch(...)` is safe.\n */\n dispatch(trigger: ActionTrigger, options?: OperationOptions): Promise<ActionTriggerResult>;\n /** The trigger's family is enabled (the `triggers` setting). */\n canDispatch(trigger: ActionTrigger): boolean;\n /** Identity-safe port install: the returned disposer clears the slot only\n * while this adapter is still current; `null` force-clears. Installing an\n * adapter fires an armed document-open sequence. */\n setUiAdapter(adapter: ActionUiAdapter | null): Unsubscribe;\n /**\n * Run one embedder-owned document verb as one serialized queue operation:\n * the document-open sequence if it is still armed → the before-event tree\n * (/WS, /WP) → `operation()` → the after-event tree (/DS, /DP). Two\n * concurrent calls never interleave their phases. A before-event failure\n * never cancels the operation; `operation()` throwing skips the\n * after-event and rethrows; the whole body honors `triggers.document:\n * false` (trees skipped, operation still runs); print verbs hold the\n * document-print latch, so nested `doc.print()` calls are suppressed with\n * a `reentrant-print` diagnostic. The queue is held for the operation's\n * duration on purpose: that is the serialization (/WS mutations are in the\n * bytes a save operation pulls). `options.signal` firing before\n * `operation()` starts skips it and rejects `operation-cancelled`; once it\n * has started, it finishes, and so does the after-event.\n */\n runDocumentVerb<T>(\n verb: 'save' | 'print',\n operation: () => Promise<T> | T,\n options?: OperationOptions,\n ): Promise<T>;\n /**\n * The cooperative /WC door: runs the catalog will-close tree (after the\n * document-open sequence) and resolves when its effects are committed.\n * Call `documents.close()` after this resolves. Scripts never run inside\n * teardown, so closing without this call skips /WC (unlike Acrobat); it is\n * not an error. Never rejects, like `dispatch()`.\n */\n prepareClose(options?: OperationOptions): Promise<ActionTriggerResult>;\n /**\n * The first sink of the submit chain (an identity-safe slot like the UI\n * adapter, but installing it does not fire the document-open sequence).\n * With no handler and no submit-capable document home, submits block with\n * a `no-submit-sink` diagnostic.\n */\n setSubmitHandler(handler: ActionSubmitHandler | null): Unsubscribe;\n /**\n * Interpret (or override) one action type from application code: the same\n * door the stage and form plugins use for GoTo, Named, Hide and ResetForm.\n * Deterministic last-wins on duplicates (a `duplicate-executor` diagnostic\n * is reported); the disposer removes the entry only while it is still the\n * current one.\n */\n registerExecutor(type: PdfActionType, executor: ActionExecutor): Unsubscribe;\n /** Actions ran, whatever started them: one event per tree. */\n readonly onExecuted: EventHook<ActionExecutedEvent>;\n /** An action was blocked, reported or couldn't run; also dispatch, sink and budget problems. */\n readonly onDiagnosticReported: EventHook<ActionDiagnosticReportedEvent>;\n /** A script was stopped from doing something, or used something the viewer doesn't support. */\n readonly onScriptDiagnosticReported: EventHook<ScriptDiagnosticReportedEvent>;\n /** A script run ended with an error. */\n readonly onScriptFailed: EventHook<ScriptFailedEvent>;\n /** The document-open sequence ran (OpenAction / open destination). */\n readonly onOpenSequenceCompleted: EventHook<OpenSequenceCompletedEvent>;\n}\n"],"mappings":"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"}
@@ -0,0 +1,210 @@
1
+ let _embedpdf_core = require("@embedpdf/core");
2
+ let _embedpdf_engine_core_runtime = require("@embedpdf/engine-core/runtime");
3
+ //#region src/token.ts
4
+ /** The package token, created once here; `contract.ts` re-exports it and
5
+ * `host-contract.ts` widens it to the host capability. */
6
+ const ActionsToken = (0, _embedpdf_core.createCapabilityToken)("actions", {
7
+ hint: `add actionsPlugin() from '@embedpdf/plugin-actions' to your plugins list`,
8
+ promises: {
9
+ execute: true,
10
+ executeNamed: true,
11
+ getActionTree: true,
12
+ dispatch: true,
13
+ runDocumentVerb: true,
14
+ prepareClose: true
15
+ }
16
+ });
17
+ //#endregion
18
+ //#region src/hover-pump.ts
19
+ const sameTarget = (left, right) => {
20
+ if (left === null || right === null) return left === right;
21
+ return left.page.objectNumber === right.page.objectNumber && (0, _embedpdf_engine_core_runtime.annotationKey)(left.ref) === (0, _embedpdf_engine_core_runtime.annotationKey)(right.ref);
22
+ };
23
+ /**
24
+ * The one hover state machine every event plane shares: per pointer feed,
25
+ * `{ delivered, desired, inFlight }`. On each settle it delivers the
26
+ * transition `delivered → desired` as `Exit(delivered)` then
27
+ * `Enter(desired)`, submitted back to back synchronously: dispatch takes its
28
+ * queue slot before returning, so a slow resolution can never split or
29
+ * reorder the pair. Under pressure intermediate targets are skipped by
30
+ * design: the pointer sweeping A→B→C while A's exit is in flight delivers
31
+ * `Exit(A) → Enter(C)`, never a stale `Enter(B)`.
32
+ */
33
+ function createHoverPump(dispatch) {
34
+ let delivered = null;
35
+ let desired = null;
36
+ let inFlight = false;
37
+ const pump = () => {
38
+ if (inFlight || sameTarget(delivered, desired)) return;
39
+ inFlight = true;
40
+ const from = delivered;
41
+ const to = desired;
42
+ delivered = to;
43
+ const submissions = [];
44
+ if (from && from.events?.exit !== false) submissions.push(dispatch({
45
+ scope: "annotation",
46
+ event: "cursorExit",
47
+ ref: from.ref,
48
+ page: from.page,
49
+ ...from.source ? { source: from.source } : {}
50
+ }));
51
+ if (to && to.events?.enter !== false) submissions.push(dispatch({
52
+ scope: "annotation",
53
+ event: "cursorEnter",
54
+ ref: to.ref,
55
+ page: to.page,
56
+ ...to.source ? { source: to.source } : {}
57
+ }));
58
+ Promise.allSettled(submissions).then(() => {
59
+ inFlight = false;
60
+ pump();
61
+ });
62
+ };
63
+ return {
64
+ hover(target) {
65
+ desired = target;
66
+ pump();
67
+ },
68
+ reset() {
69
+ delivered = null;
70
+ desired = null;
71
+ }
72
+ };
73
+ }
74
+ //#endregion
75
+ //#region src/submit-encoding.ts
76
+ /**
77
+ * Encode a resolved submission dataset as `application/x-www-form-urlencoded`
78
+ * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than
79
+ * utf-8 is the handler's problem). A name-only entry (`value === null`, the
80
+ * IncludeNoValueFields shape) encodes as a bare name; a multi-select list
81
+ * box repeats the name per value, the HTML-form convention.
82
+ *
83
+ * Pure and dependency-free on purpose: a convenience for embedder handlers,
84
+ * never called by the plugin itself (the plugin never touches a network).
85
+ */
86
+ const submitEntriesToUrlEncoded = (entries) => entries.flatMap(({ name, value }) => value === null ? [encodeURIComponent(name)] : Array.isArray(value) ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`) : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`]).join("&");
87
+ //#endregion
88
+ //#region src/contract.ts
89
+ /** Trigger → provenance descriptor (the {@link ActionContext.event} axis). */
90
+ const eventOf = (trigger) => {
91
+ switch (trigger.scope) {
92
+ case "activate": return { scope: "activate" };
93
+ case "annotation": return {
94
+ scope: "annotation",
95
+ name: trigger.event
96
+ };
97
+ case "page": return {
98
+ scope: "page",
99
+ name: trigger.event
100
+ };
101
+ case "document": return {
102
+ scope: "document",
103
+ name: trigger.event
104
+ };
105
+ }
106
+ };
107
+ /** The one origin mapping, derived by the dispatcher and never claimed by a
108
+ * caller: a feed cannot launder a hover into a user gesture. */
109
+ const triggerOriginOf = (trigger) => {
110
+ switch (trigger.scope) {
111
+ case "activate": return "user";
112
+ case "annotation": return trigger.event === "cursorEnter" || trigger.event === "cursorExit" ? "hover" : "user";
113
+ case "page":
114
+ case "document": return "lifecycle";
115
+ }
116
+ };
117
+ /** What the actions settings are when the app registers none. */
118
+ const ACTIONS_DEFAULTS = {
119
+ policy: {
120
+ goto: {
121
+ user: "allow",
122
+ hover: "allow",
123
+ lifecycle: "allow"
124
+ },
125
+ named: {
126
+ user: "allow",
127
+ hover: "allow",
128
+ lifecycle: "allow"
129
+ },
130
+ hide: {
131
+ user: "allow",
132
+ hover: "allow",
133
+ lifecycle: "allow"
134
+ },
135
+ "reset-form": {
136
+ user: "allow",
137
+ hover: "allow",
138
+ lifecycle: "allow"
139
+ },
140
+ javascript: {
141
+ user: "allow",
142
+ hover: "allow",
143
+ lifecycle: "allow"
144
+ },
145
+ uri: {
146
+ user: "adapter",
147
+ hover: "report",
148
+ lifecycle: "report"
149
+ },
150
+ print: {
151
+ user: "adapter",
152
+ hover: "block",
153
+ lifecycle: "block"
154
+ },
155
+ "submit-form": {
156
+ user: "adapter",
157
+ hover: "block",
158
+ lifecycle: "block"
159
+ }
160
+ },
161
+ triggers: {
162
+ document: true,
163
+ page: true,
164
+ annotation: true
165
+ },
166
+ openSequence: "auto",
167
+ javascript: {
168
+ enabled: false,
169
+ identity: null
170
+ }
171
+ };
172
+ //#endregion
173
+ Object.defineProperty(exports, "ACTIONS_DEFAULTS", {
174
+ enumerable: true,
175
+ get: function() {
176
+ return ACTIONS_DEFAULTS;
177
+ }
178
+ });
179
+ Object.defineProperty(exports, "ActionsToken", {
180
+ enumerable: true,
181
+ get: function() {
182
+ return ActionsToken;
183
+ }
184
+ });
185
+ Object.defineProperty(exports, "createHoverPump", {
186
+ enumerable: true,
187
+ get: function() {
188
+ return createHoverPump;
189
+ }
190
+ });
191
+ Object.defineProperty(exports, "eventOf", {
192
+ enumerable: true,
193
+ get: function() {
194
+ return eventOf;
195
+ }
196
+ });
197
+ Object.defineProperty(exports, "submitEntriesToUrlEncoded", {
198
+ enumerable: true,
199
+ get: function() {
200
+ return submitEntriesToUrlEncoded;
201
+ }
202
+ });
203
+ Object.defineProperty(exports, "triggerOriginOf", {
204
+ enumerable: true,
205
+ get: function() {
206
+ return triggerOriginOf;
207
+ }
208
+ });
209
+
210
+ //# sourceMappingURL=contract-_HB_UliT.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-_HB_UliT.cjs","names":[],"sources":["../src/token.ts","../src/hover-pump.ts","../src/submit-encoding.ts","../src/contract.ts"],"sourcesContent":["/** The package token, created once here; `contract.ts` re-exports it and\n * `host-contract.ts` widens it to the host capability. */\nimport { createCapabilityToken } from '@embedpdf/core';\n\nimport type { ActionsCapability } from './contract';\n\nexport const ActionsToken = createCapabilityToken<ActionsCapability>('actions', {\n hint: `add actionsPlugin() from '@embedpdf/plugin-actions' to your plugins list`,\n // Without a document, an adapter's stand-in rejects these with `not-ready`, as the\n // capability would; the type asks for every member that returns a promise.\n promises: {\n execute: true,\n executeNamed: true,\n getActionTree: true,\n dispatch: true,\n runDocumentVerb: true,\n prepareClose: true,\n },\n});\n","import { annotationKey, type AnnotationRef, type PageRef } from '@embedpdf/engine-core/runtime';\n\nimport type { ActionSource, ActionTrigger, ActionTriggerResult } from './contract';\n\n/** One hoverable target, as a feed sees it. `events` lets a feed that knows\n * which trees exist (a folded model, a fill item) skip the inert half of a\n * pair; omitted flags default to true. */\nexport interface HoverTarget {\n ref: AnnotationRef;\n page: PageRef;\n /** Optional provenance hint forwarded on the trigger (widget/link feeds). */\n source?: ActionSource;\n events?: { enter?: boolean; exit?: boolean };\n}\n\nexport interface HoverPump {\n /** Report where the pointer is now (null = nowhere interesting). */\n hover(target: HoverTarget | null): void;\n /** Forget everything without dispatching (teardown; document switch). */\n reset(): void;\n}\n\nconst sameTarget = (left: HoverTarget | null, right: HoverTarget | null): boolean => {\n if (left === null || right === null) return left === right;\n return (\n left.page.objectNumber === right.page.objectNumber &&\n annotationKey(left.ref) === annotationKey(right.ref)\n );\n};\n\n/**\n * The one hover state machine every event plane shares: per pointer feed,\n * `{ delivered, desired, inFlight }`. On each settle it delivers the\n * transition `delivered → desired` as `Exit(delivered)` then\n * `Enter(desired)`, submitted back to back synchronously: dispatch takes its\n * queue slot before returning, so a slow resolution can never split or\n * reorder the pair. Under pressure intermediate targets are skipped by\n * design: the pointer sweeping A→B→C while A's exit is in flight delivers\n * `Exit(A) → Enter(C)`, never a stale `Enter(B)`.\n */\nexport function createHoverPump(\n dispatch: (trigger: ActionTrigger) => Promise<ActionTriggerResult>,\n): HoverPump {\n let delivered: HoverTarget | null = null;\n let desired: HoverTarget | null = null;\n let inFlight = false;\n\n const pump = (): void => {\n if (inFlight || sameTarget(delivered, desired)) return;\n inFlight = true;\n const from = delivered;\n const to = desired;\n delivered = to;\n const submissions: Array<Promise<unknown>> = [];\n if (from && from.events?.exit !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorExit',\n ref: from.ref,\n page: from.page,\n ...(from.source ? { source: from.source } : {}),\n }),\n );\n }\n if (to && to.events?.enter !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorEnter',\n ref: to.ref,\n page: to.page,\n ...(to.source ? { source: to.source } : {}),\n }),\n );\n }\n void Promise.allSettled(submissions).then(() => {\n inFlight = false;\n pump(); // the pointer may have moved on — deliver the latest transition\n });\n };\n\n return {\n hover(target) {\n desired = target;\n pump();\n },\n reset() {\n delivered = null;\n desired = null;\n },\n };\n}\n","import type { FormSubmissionEntry } from '@embedpdf/engine-core/runtime';\n\n/**\n * Encode a resolved submission dataset as `application/x-www-form-urlencoded`\n * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than\n * utf-8 is the handler's problem). A name-only entry (`value === null`, the\n * IncludeNoValueFields shape) encodes as a bare name; a multi-select list\n * box repeats the name per value, the HTML-form convention.\n *\n * Pure and dependency-free on purpose: a convenience for embedder handlers,\n * never called by the plugin itself (the plugin never touches a network).\n */\nexport const submitEntriesToUrlEncoded = (entries: FormSubmissionEntry[]): string =>\n entries\n .flatMap(({ name, value }) =>\n value === null\n ? [encodeURIComponent(name)]\n : Array.isArray(value)\n ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`)\n : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`],\n )\n .join('&');\n","/**\n * @embedpdf/plugin-actions/contract: the public action vocabulary: triggers,\n * contexts, results, policy, the UI adapter and submit handler ports, and\n * the capability itself. Sibling-plugin registration (commit sinks, script\n * realms, the page-state report) is the host lens (`/contract/host`).\n */\nimport type {\n DeepPartial,\n EventHook,\n OperationOptions,\n SettingsApi,\n Unsubscribe,\n} from '@embedpdf/core';\nimport type {\n ScriptBudget,\n ScriptDiagnostic,\n ScriptExecutionError,\n ScriptIdentity,\n ScriptSandboxFactory,\n} from '@embedpdf/core-acrojs';\nimport type {\n AnnotationRef,\n FormFieldRef,\n FormSubmissionEntry,\n FormSubmissionReceipt,\n OutlineItemRef,\n PageRef,\n PdfActionNode,\n PdfActionTargetRef,\n PdfActionTree,\n PdfActionType,\n} from '@embedpdf/engine-core/runtime';\n\nexport { ActionsToken } from './token';\n/** The action trees the verbs take and resolve: what a PDF's links, buttons, pages and document carry. */\nexport type { PdfActionNode, PdfActionTree, PdfActionType } from '@embedpdf/engine-core/runtime';\nexport { createHoverPump } from './hover-pump';\nexport type { HoverPump, HoverTarget } from './hover-pump';\nexport { submitEntriesToUrlEncoded } from './submit-encoding';\n\n// ── the when/who axes ──────────────────────────────────────────────────────\n\n/** Why a dispatch happened: `'user'` for a real activation gesture,\n * `'hover'` for pointer enter and exit, `'lifecycle'` for page and document\n * events. The policy decides per type and origin. */\nexport type ActionOrigin = 'user' | 'hover' | 'lifecycle';\n\n/** Who initiated the dispatch. Fields are required where an executor needs\n * them: the JavaScript executor builds `event.target` from the widget\n * source's `field`. Provenance only: policy never reads it. */\nexport type ActionSource =\n | { kind: 'widget'; field: FormFieldRef; annotation: AnnotationRef; page: PageRef }\n | { kind: 'link'; annotation?: AnnotationRef; page?: PageRef }\n /** An outline item the user followed: its /A, run as a link's is. */\n | { kind: 'outline'; item: OutlineItemRef }\n /** A non-widget annotation's own /AA event (E/X on squares, stamps, …). */\n | { kind: 'annotation'; annotation: AnnotationRef; page: PageRef }\n /** A page /AA tree (O/C) inside a page-trigger fan-out. */\n | { kind: 'page'; page: PageRef }\n /** The document-open sequence (openDestination / OpenAction). */\n | { kind: 'document' }\n | { kind: 'api' };\n\n/** The document lifecycle vocabulary: `open` (the document-open sequence)\n * plus the five catalog `/AA` verbs (ISO 32000-2 Table 200: /WC, /WS, /DS,\n * /WP, /DP). Whoever owns the verb dispatches them; `runDocumentVerb` is the\n * serialized door for save and print, `prepareClose` for close. */\nexport type DocumentTriggerEvent =\n | 'open'\n | 'will-save'\n | 'did-save'\n | 'will-print'\n | 'did-print'\n | 'will-close';\n\n/** Trigger provenance, derived beside {@link triggerOriginOf}: the\n * executor-visible \"which event fired\" (cursorEnter and cursorExit are both\n * `origin: 'hover'`; this carries the difference). */\nexport type ActionTriggerEvent =\n | { scope: 'activate' }\n | { scope: 'annotation'; name: PdfAnnotationEventKind }\n | { scope: 'page'; name: 'open' | 'close' | 'visible' | 'invisible' }\n | { scope: 'document'; name: DocumentTriggerEvent };\n\n/** The four field-level /AA scripts (ISO Table 198: K F V C). */\nexport type PdfFieldEventKind = 'keystroke' | 'format' | 'validate' | 'calculate';\n\n/** The Named verbs the viewer interprets (ISO Table 215's four page verbs\n * plus Adobe's `Print`); any other name is accepted and reported inert. */\nexport type PdfNamedAction =\n | 'NextPage'\n | 'PrevPage'\n | 'FirstPage'\n | 'LastPage'\n | 'Print'\n | (string & {});\n\n/**\n * Where an action tree lives, for {@link ActionsCapability.getActionTree}.\n * Each arm names its own event vocabulary; the annotation arm defaults to\n * the /A click tree, the page and document arms to their open trees.\n */\nexport type ActionTreeSource =\n | {\n kind: 'annotation';\n annotation: AnnotationRef;\n page: PageRef;\n event?: 'activate' | PdfAnnotationEventKind;\n }\n | { kind: 'field'; field: FormFieldRef; event: PdfFieldEventKind }\n | { kind: 'page'; page: PageRef; event?: 'open' | 'close' }\n | { kind: 'document'; event?: DocumentTriggerEvent }\n /** An outline item's /A. */\n | { kind: 'outline'; item: OutlineItemRef };\n\n/** The document-open sequence has run (once per document). */\nexport interface OpenSequenceCompletedEvent {\n readonly result: ActionTriggerResult;\n}\n\nexport interface ActionContext {\n origin: ActionOrigin;\n source: ActionSource;\n event: ActionTriggerEvent;\n}\n\n/** The six annotation /AA pointer and focus events (ISO 32000-2 Table 197:\n * /E /X /D /U /Fo /Bl). The page-lifecycle events (/PO /PC /PV /PI) are not\n * here: they fan out from page triggers, never from per-annotation dispatch. */\nexport type PdfAnnotationEventKind =\n | 'cursorEnter'\n | 'cursorExit'\n | 'mouseDown'\n | 'mouseUp'\n | 'focus'\n | 'blur';\n\n/**\n * Trigger vocabulary: what a feed reports. The dispatcher resolves trees,\n * derives the origin ({@link triggerOriginOf}) and fans out. `source` on the\n * annotation-addressed arms is an optional provenance hint from first-party\n * feeds (a widget feed passes its field ref so the JavaScript executor can\n * anchor `event.target`); policy never reads it and it cannot change origin.\n */\nexport type ActionTrigger =\n | { scope: 'activate'; ref: AnnotationRef; page: PageRef; source?: ActionSource }\n | {\n scope: 'annotation';\n event: PdfAnnotationEventKind;\n ref: AnnotationRef;\n page: PageRef;\n source?: ActionSource;\n }\n | { scope: 'page'; event: 'open' | 'close' | 'visible' | 'invisible'; page: PageRef }\n | { scope: 'document'; event: DocumentTriggerEvent };\n\n/** Trigger → provenance descriptor (the {@link ActionContext.event} axis). */\nexport const eventOf = (trigger: ActionTrigger): ActionTriggerEvent => {\n switch (trigger.scope) {\n case 'activate':\n return { scope: 'activate' };\n case 'annotation':\n return { scope: 'annotation', name: trigger.event };\n case 'page':\n return { scope: 'page', name: trigger.event };\n case 'document':\n return { scope: 'document', name: trigger.event };\n }\n};\n\n/** The one origin mapping, derived by the dispatcher and never claimed by a\n * caller: a feed cannot launder a hover into a user gesture. */\nexport const triggerOriginOf = (trigger: ActionTrigger): ActionOrigin => {\n switch (trigger.scope) {\n case 'activate':\n return 'user';\n case 'annotation':\n return trigger.event === 'cursorEnter' || trigger.event === 'cursorExit' ? 'hover' : 'user';\n case 'page':\n case 'document':\n return 'lifecycle';\n }\n};\n\n// ── results ────────────────────────────────────────────────────────────────\n\nexport type ActionNodeStatus =\n | 'executed' // the registered executor / built-in interpreter ran\n | 'blocked' // policy said no (submit-form, origin-gated uri, …)\n | 'no-executor' // nothing registered/installed for this type\n | 'inert' // an executor was present but declined (scripting off, unknown verb)\n | 'failed' // the executor threw or reported failure\n | 'skipped'; // an earlier document-lifetime failure stopped this node\n\nexport interface ActionNodeResult {\n /** Node address as child indexes from the root ([] = root, [0] = root.next[0]…). */\n path: number[];\n type: PdfActionType;\n status: ActionNodeStatus;\n detail?: string;\n}\n\nexport interface ActionDiagnostic {\n code:\n | 'incomplete-tree'\n | 'blocked'\n | 'no-executor'\n | 'no-adapter'\n | 'no-session-sink'\n | 'unresolved-target'\n | 'duplicate-executor'\n | 'executor-inert'\n | 'executor-failed'\n | 'trigger-disabled' // the `triggers` setting turned this family off\n | 'no-commit-sink' // a document effect had no registered owner sink\n | 'trigger-failed' // resolution threw — dispatch() never rejects\n | 'cascade-budget' // programmatic page-lifecycle rounds exceeded the cap\n | 'open-sequence-replayed' // a second document-open trigger arrived\n | 'no-submit-sink' // no handler installed and the document has no home\n | 'no-submit-resolver' // no form plugin registered a dataset resolver\n | 'submit-payload-unavailable' // older-runtime extraction: node stays inert\n | 'submit-entry-unsupported' // an explicitly included entry has no representable value\n | 'reentrant-print'; // a print request during a document print event — suppressed\n message: string;\n}\n\n/**\n * One logical dispatch transaction's outcome. Document-lifetime work is not\n * rolled back: an earlier successful reset or script write survives a later\n * failure; `status: 'partial'` says so, and `nodes` carries the per-node\n * truth. `'cancelled'`: the caller's signal fired while the tree ran, so the\n * walk stopped before its next node and no navigation or external effect\n * fired.\n */\nexport interface ActionDispatchResult {\n status: 'executed' | 'partial' | 'inert' | 'refused' | 'cancelled';\n nodes: ActionNodeResult[];\n diagnostics: ActionDiagnostic[];\n}\n\n/**\n * One tree's execution inside a trigger: its true source, its true tree, its\n * own node results (`path`s are real walk paths, never prefixed).\n * `onExecuted` fires once per step with exactly this tree and a context\n * built from this source, so fan-out never merges trees in the event.\n */\nexport interface ActionStepResult {\n source: ActionSource;\n tree: PdfActionTree;\n result: ActionDispatchResult;\n}\n\n/**\n * What `dispatch(trigger)` returns: the aggregate plus per-step truth. A step\n * failure never skips sibling steps (a broken annotation /PC must not cancel\n * the page's /C); deferred navigation and external effects flush per step,\n * not per trigger.\n */\nexport interface ActionTriggerResult {\n /** `'cancelled'`: the caller's signal fired before or while the trigger ran. */\n status: 'executed' | 'partial' | 'inert' | 'refused' | 'cancelled';\n steps: ActionStepResult[];\n /** Trigger-level diagnostics (disabled family, resolution failure);\n * per-node diagnostics live inside each step's `result`. */\n diagnostics: ActionDiagnostic[];\n}\n\n// ── events ─────────────────────────────────────────────────────────────────\n\n/** Actions ran: one tree, whatever started it (a click, a page, the document, your code). */\nexport interface ActionExecutedEvent {\n readonly tree: PdfActionTree;\n readonly result: ActionDispatchResult;\n /** What started them. */\n readonly source: ActionSource;\n}\n\n/**\n * An action was blocked, reported or couldn't run. `action` is its type and\n * `source` what started it; both are `null` for a diagnostic about no one\n * action (a trigger family turned off, an executor replaced). The result of\n * the run that reported it lists the same diagnostic with its message.\n */\nexport interface ActionDiagnosticReportedEvent {\n readonly code: ActionDiagnostic['code'];\n readonly action: PdfActionType | null;\n readonly source: ActionSource | null;\n}\n\n/**\n * A script was stopped from doing something, such as reaching the network,\n * or used something the viewer doesn't support.\n */\nexport type ScriptDiagnosticReportedEvent = Readonly<ScriptDiagnostic>;\n\n/**\n * A script threw an error. `source` is what started it, or `null` for a\n * script no action started: a form field's keystroke, format, validate or\n * calculate script, or a stamp's template.\n */\nexport interface ScriptFailedEvent {\n readonly error: ScriptExecutionError;\n readonly source: ActionSource | null;\n}\n\n// ── policy ─────────────────────────────────────────────────────────────────\n\n/** The decision per type and origin. `allow` executes; `adapter` routes\n * through the type's port (the UI adapter; for `submit-form`, the sink\n * chain: embedder handler → the document's home → blocked); `report`\n * records a blocked node without executing; `block` refuses. The `launch`,\n * `goto-remote`, `goto-embedded` and media types are fixed `'never'` and\n * not configurable. */\nexport type ActionPolicyDecision = 'allow' | 'adapter' | 'report' | 'block';\nexport type ActionPolicyRow = Readonly<Record<ActionOrigin, ActionPolicyDecision>>;\n\nexport interface ActionPolicy {\n readonly goto: ActionPolicyRow;\n readonly named: ActionPolicyRow;\n readonly hide: ActionPolicyRow;\n readonly 'reset-form': ActionPolicyRow;\n readonly javascript: ActionPolicyRow;\n readonly uri: ActionPolicyRow;\n /** The Named `Print` verb, owned by policy and the UI adapter, never the\n * stage. (An Acrobat-compatible extension: ISO 32000-2 Table 215 defines\n * only the four page verbs; an unrecognized name \"shall take no action\".) */\n readonly print: ActionPolicyRow;\n /** SubmitForm: `'adapter'` routes through the sink chain. Default: user\n * origin only; hover and lifecycle submits stay blocked. */\n readonly 'submit-form': ActionPolicyRow;\n}\n\n/** Who scripts think the user is: fields over the document's user, or a function that returns them. */\nexport type ActionsScriptIdentity = Partial<ScriptIdentity> | (() => Partial<ScriptIdentity>);\n\n/**\n * The actions plugin's settings. `actionsPlugin(config)` registers them over\n * {@link ACTIONS_DEFAULTS}, and `updateSettings()` changes them for every\n * document while the app runs. `policy`, `triggers` and\n * `javascript.identity` apply to the next action; `javascript.enabled`\n * applies to the documents opened after the change (a document's script\n * engine starts when it opens); `openSequence` applies until a document's\n * opening actions have run.\n */\nexport interface ActionsSettings {\n /** The rules: per kind of action and per origin. Rows merge, so a change names only what it changes. */\n readonly policy: ActionPolicy;\n /** Run the actions of the `document`, its `page`s, or `annotation`s. A click on a link or button always runs. */\n readonly triggers: {\n readonly document: boolean;\n readonly page: boolean;\n readonly annotation: boolean;\n };\n /**\n * When the document's opening actions run (the open destination, then the\n * catalog /OpenAction, then the first page's /O). `'auto'` runs them once\n * at the first sign of a person: a UI adapter installing, or a first\n * click; the first page's /O then comes from the Stage's page report.\n * `'headless'` runs them as the document opens, for an app without a\n * Stage; `'off'` never runs them.\n */\n readonly openSequence: 'auto' | 'headless' | 'off';\n readonly javascript: {\n /** Run the document's JavaScript. Off by default: no script engine ever loads. */\n readonly enabled: boolean;\n /** Who scripts think the user is, on top of the document's user. `null`: the document's user. */\n readonly identity: ActionsScriptIdentity | null;\n };\n}\n\n/** What the actions settings are when the app registers none. */\nexport const ACTIONS_DEFAULTS: ActionsSettings = {\n policy: {\n goto: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n named: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n hide: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n 'reset-form': { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n javascript: { user: 'allow', hover: 'allow', lifecycle: 'allow' },\n // No tab opens by itself: only a real click reaches the adapter.\n uri: { user: 'adapter', hover: 'report', lifecycle: 'report' },\n print: { user: 'adapter', hover: 'block', lifecycle: 'block' },\n // Form data leaves the viewer only on a click: handler, then the document's home.\n 'submit-form': { user: 'adapter', hover: 'block', lifecycle: 'block' },\n },\n triggers: { document: true, page: true, annotation: true },\n openSequence: 'auto',\n javascript: { enabled: false, identity: null },\n};\n\n/**\n * The script environment, given once when the plugin is registered: not a\n * setting, because a document's script engine is built with it when the\n * document opens.\n */\nexport interface ActionsScriptEnvironment {\n /** Override the lazy QuickJS factory (tests or another isolated VM). */\n readonly sandboxFactory?: ScriptSandboxFactory;\n readonly fileName?: () => string;\n /** Injected deterministic transaction environment. */\n readonly now?: () => number;\n readonly utcOffsetMinutes?: () => number;\n readonly randomSeed?: () => number;\n readonly budget?: ScriptBudget;\n /**\n * The deterministic aggregate: the most JavaScript nodes one dispatch may\n * run (default 16). A /Next chain shares it instead of multiplying the\n * per-run time budget, and a count stays deterministic where a wall-clock\n * aggregate would not. Once exhausted, the remaining JavaScript nodes\n * report inert with a budget reason.\n */\n readonly maxScriptNodesPerDispatch?: number;\n}\n\n/**\n * What `actionsPlugin(config)` takes: any of the settings, merged over the\n * defaults, and the script environment beside `javascript`'s settings.\n */\nexport interface ActionsConfig extends DeepPartial<Omit<ActionsSettings, 'javascript'>> {\n readonly javascript?: DeepPartial<ActionsSettings['javascript']> & ActionsScriptEnvironment;\n}\n\n// ── registration surfaces (host lens) ──────────────────────────────────────\n\nexport type ActionExecutorResult =\n | { status: 'executed' }\n | { status: 'inert'; reason: string }\n | { status: 'failed'; error: string };\n\n/** One node of one registered type, executed in dispatch order. Executors\n * never see the tree or the capability, so an executor cannot cascade into\n * further dispatches. */\nexport type ActionExecutor = (\n node: PdfActionNode,\n actionContext: ActionContext,\n) => Promise<ActionExecutorResult> | ActionExecutorResult;\n\n/** The origin and phase every script-produced UI request carries: the\n * default adapter's visibility matrix keys on it; embedder adapters receive\n * everything and decide for themselves. */\nexport interface ActionUiContext {\n origin: ActionOrigin;\n /** Script-model axis: `'boot'` = name-tree/document-open boot scripts. */\n phase: 'boot' | 'user';\n}\n\nexport interface ActionUiAdapter {\n /** A URI action to open; `isMap` is the /IsMap flag. */\n openUri(uri: string, options: { isMap: boolean; origin: ActionOrigin }): void;\n /** The Named `Print` verb and script `print()` requests (authority-gated\n * upstream: `doc.print` refusals never reach the adapter). */\n print(uiContext?: ActionUiContext): void;\n /** Script `app.alert`: the one alert port for every script origin. */\n alert?(message: string, options: ActionUiContext & { icon: number; title?: string }): void;\n /** Script `this.pageNum = n` navigation requests. */\n gotoPage?(page: number, uiContext: ActionUiContext): void;\n}\n\n// ── the submit pipeline: one intent, one resolver, one sink chain ──\n\n/**\n * A normalized submit intent, one shape for both sources: a SubmitForm action\n * node's extracted payload, or a script `doc.submitForm()` effect\n * (include-mode names, `exclude` false). Resolving it into a dataset is the\n * form plugin's job (it owns the field plane), through the registered\n * resolver.\n */\nexport interface SubmitIntent {\n url: string | null;\n /** ISO 32000-2 Table 239 targets (names and object numbers mixed); `null`\n * is the whole eligible form. */\n fields: PdfActionTargetRef[] | null;\n exclude: boolean;\n includeNoValueFields: boolean;\n format: 'fdf' | 'html' | 'xfdf' | 'pdf';\n method: 'post' | 'get';\n /** Raw ISO Table 240 word (0 for scripted submits without one). */\n flagsRaw: number;\n charSet?: string;\n}\n\n/**\n * The resolved dataset a sink receives. Entries carry the ISO semantics\n * already applied (descendants, the unconditional NoExport veto, push-button\n * and unsupported exclusion, diagnosed and never silent); the document's\n * declared routing survives as metadata. The stack never fetches `url`: an\n * embedder handler that chooses to must validate it (protocol and\n * destination allowlists) before any network call.\n */\nexport interface ActionSubmitRequest {\n url: string | null;\n method: 'post' | 'get';\n format: 'fdf' | 'html' | 'xfdf' | 'pdf';\n flagsRaw: number;\n charSet?: string;\n entries: FormSubmissionEntry[];\n origin: ActionOrigin;\n event: ActionTriggerEvent;\n}\n\n/**\n * The first sink of the chain: the embedder's application. Installing it is\n * the consent (it receives nothing the embedder could not already compute\n * from `forms.list()` under `doc.forms.read`, so no submit scope gates it).\n * Contract: synchronous acceptance marks the node `executed` (\"handed to the\n * embedder\", not \"delivered\"); a synchronous throw marks it `failed`; a\n * returned promise is not awaited, and a later rejection only emits a\n * diagnostic. `submitToDocumentHome` lets a handler compose with the second\n * sink (present only when the document has a submit-capable home).\n */\nexport type ActionSubmitHandler = (\n request: ActionSubmitRequest,\n chain: { submitToDocumentHome: (() => Promise<FormSubmissionReceipt>) | null },\n) => void | Promise<void>;\n\n// ── capabilities ───────────────────────────────────────────────────────────\n\n/**\n * The public capability, for embedders and chrome. Each `can*` twin takes the\n * same arguments as its verb and answers \"would the dispatcher accept this\n * and attempt execution\" (per-node truth lives in the result's `nodes`). Its\n * settings (`getSettings`, `updateSettings`, `resetSettings`,\n * `onSettingsChanged`) belong to the plugin, not to a document: a change\n * reaches every open document.\n */\nexport interface ActionsCapability extends SettingsApi<ActionsSettings> {\n /**\n * Run a resolved tree on the dispatch queue and fire `onExecuted`; a\n * failing node is reported in the result, not thrown. Rejects\n * `operation-cancelled` when `options.signal` fires: before the tree\n * starts, nothing runs; while it runs, it stops before its next node.\n */\n execute(\n tree: PdfActionTree,\n actionContext: ActionContext,\n options?: OperationOptions,\n ): Promise<ActionDispatchResult>;\n /** The tree is complete and its root node's policy decision is `allow` or `adapter`. */\n canExecute(tree: PdfActionTree, actionContext: ActionContext): boolean;\n /**\n * Run one Named verb (`NextPage`, `Print`, …) as a user-origin action\n * without building a tree — the programmatic twin of a Named link click.\n * `context` overrides the default `{ origin: 'user', source: { kind: 'api' } }`.\n * Rejects `operation-cancelled` like `execute()`.\n */\n executeNamed(\n name: PdfNamedAction,\n context?: Partial<ActionContext>,\n options?: OperationOptions,\n ): Promise<ActionDispatchResult>;\n /**\n * Whether the rules would run this Named verb from `context` (a click from\n * your code by default); `'Print'` also needs `doc.print`.\n */\n canExecuteNamed(name: PdfNamedAction, context?: Partial<ActionContext>): boolean;\n /**\n * Read the /A or /AA tree behind a source straight from the document\n * (`null` when absent). This is the raw tree: dispatch-time rules such as\n * ISO 32000-2 Table 197's \"/A shadows /AA U\" are not applied here. Rejects\n * `operation-cancelled` when `options.signal` fires.\n */\n getActionTree(\n source: ActionTreeSource,\n options?: OperationOptions,\n ): Promise<PdfActionTree | null>;\n /** Did `javascript.enabled` take effect — a script realm exists for this\n * document. */\n isScriptingEnabled(): boolean;\n /**\n * Report a trigger. Submission is synchronous: the queue slot is taken\n * before this returns, so two dispatch calls execute in call order even\n * when their resolutions race; all reads happen inside the queued\n * operation. Never rejects: resolution failures come back as `refused`\n * with a `trigger-failed` diagnostic, and a fired `options.signal` as\n * `cancelled`, so `void dispatch(...)` is safe.\n */\n dispatch(trigger: ActionTrigger, options?: OperationOptions): Promise<ActionTriggerResult>;\n /** The trigger's family is enabled (the `triggers` setting). */\n canDispatch(trigger: ActionTrigger): boolean;\n /** Identity-safe port install: the returned disposer clears the slot only\n * while this adapter is still current; `null` force-clears. Installing an\n * adapter fires an armed document-open sequence. */\n setUiAdapter(adapter: ActionUiAdapter | null): Unsubscribe;\n /**\n * Run one embedder-owned document verb as one serialized queue operation:\n * the document-open sequence if it is still armed → the before-event tree\n * (/WS, /WP) → `operation()` → the after-event tree (/DS, /DP). Two\n * concurrent calls never interleave their phases. A before-event failure\n * never cancels the operation; `operation()` throwing skips the\n * after-event and rethrows; the whole body honors `triggers.document:\n * false` (trees skipped, operation still runs); print verbs hold the\n * document-print latch, so nested `doc.print()` calls are suppressed with\n * a `reentrant-print` diagnostic. The queue is held for the operation's\n * duration on purpose: that is the serialization (/WS mutations are in the\n * bytes a save operation pulls). `options.signal` firing before\n * `operation()` starts skips it and rejects `operation-cancelled`; once it\n * has started, it finishes, and so does the after-event.\n */\n runDocumentVerb<T>(\n verb: 'save' | 'print',\n operation: () => Promise<T> | T,\n options?: OperationOptions,\n ): Promise<T>;\n /**\n * The cooperative /WC door: runs the catalog will-close tree (after the\n * document-open sequence) and resolves when its effects are committed.\n * Call `documents.close()` after this resolves. Scripts never run inside\n * teardown, so closing without this call skips /WC (unlike Acrobat); it is\n * not an error. Never rejects, like `dispatch()`.\n */\n prepareClose(options?: OperationOptions): Promise<ActionTriggerResult>;\n /**\n * The first sink of the submit chain (an identity-safe slot like the UI\n * adapter, but installing it does not fire the document-open sequence).\n * With no handler and no submit-capable document home, submits block with\n * a `no-submit-sink` diagnostic.\n */\n setSubmitHandler(handler: ActionSubmitHandler | null): Unsubscribe;\n /**\n * Interpret (or override) one action type from application code: the same\n * door the stage and form plugins use for GoTo, Named, Hide and ResetForm.\n * Deterministic last-wins on duplicates (a `duplicate-executor` diagnostic\n * is reported); the disposer removes the entry only while it is still the\n * current one.\n */\n registerExecutor(type: PdfActionType, executor: ActionExecutor): Unsubscribe;\n /** Actions ran, whatever started them: one event per tree. */\n readonly onExecuted: EventHook<ActionExecutedEvent>;\n /** An action was blocked, reported or couldn't run; also dispatch, sink and budget problems. */\n readonly onDiagnosticReported: EventHook<ActionDiagnosticReportedEvent>;\n /** A script was stopped from doing something, or used something the viewer doesn't support. */\n readonly onScriptDiagnosticReported: EventHook<ScriptDiagnosticReportedEvent>;\n /** A script run ended with an error. */\n readonly onScriptFailed: EventHook<ScriptFailedEvent>;\n /** The document-open sequence ran (OpenAction / open destination). */\n readonly onOpenSequenceCompleted: EventHook<OpenSequenceCompletedEvent>;\n}\n"],"mappings":"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"}
package/dist/contract.cjs CHANGED
@@ -1,7 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_types = require("./types-BXJLAKXi.cjs");
3
- const require_contract = require("./contract-C1K3H4RP.cjs");
4
- exports.ActionsToken = require_types.ActionsToken;
2
+ const require_contract = require("./contract-_HB_UliT.cjs");
3
+ exports.ACTIONS_DEFAULTS = require_contract.ACTIONS_DEFAULTS;
4
+ exports.ActionsToken = require_contract.ActionsToken;
5
5
  exports.createHoverPump = require_contract.createHoverPump;
6
- exports.originOf = require_types.originOf;
6
+ exports.eventOf = require_contract.eventOf;
7
7
  exports.submitEntriesToUrlEncoded = require_contract.submitEntriesToUrlEncoded;
8
+ exports.triggerOriginOf = require_contract.triggerOriginOf;
@@ -1,3 +1,2 @@
1
- import { B as SubmitIntent, E as ActionsToken, H as originOf, P as PdfAnnotationEventKind, S as ActionsCapability, _ as ActionTrigger, b as ActionUiContext, c as ActionNodeStatus, d as ActionPolicyDecision, f as ActionPolicyRow, g as ActionSubmitRequest, h as ActionSubmitHandler, i as ActionDispatchResult, j as DocumentTriggerEvent, l as ActionOrigin, m as ActionStepResult, n as ActionDiagnostic, p as ActionSource, r as ActionDispatchEvent, s as ActionNodeResult, t as ActionContext, u as ActionPolicy, v as ActionTriggerResult, w as ActionsPluginConfig, y as ActionUiAdapter } from "./types-D-DoiESj.cjs";
2
- import { i as createHoverPump, n as HoverPump, r as HoverTarget, t as submitEntriesToUrlEncoded } from "./contract-Os5y4NaD.cjs";
3
- export { type ActionContext, type ActionDiagnostic, type ActionDispatchEvent, type ActionDispatchResult, type ActionNodeResult, type ActionNodeStatus, type ActionOrigin, type ActionPolicy, type ActionPolicyDecision, type ActionPolicyRow, type ActionSource, type ActionStepResult, type ActionSubmitHandler, type ActionSubmitRequest, type ActionTrigger, type ActionTriggerResult, type ActionUiAdapter, type ActionUiContext, type ActionsCapability, type ActionsPluginConfig, ActionsToken, type DocumentTriggerEvent, type HoverPump, type HoverTarget, type PdfAnnotationEventKind, type SubmitIntent, createHoverPump, originOf, submitEntriesToUrlEncoded };
1
+ import { A as DocumentTriggerEvent, B as SubmitIntent, C as ActionUiAdapter, D as ActionsScriptEnvironment, E as ActionsConfig, F as PdfAnnotationEventKind, G as HoverTarget, H as triggerOriginOf, I as PdfFieldEventKind, K as createHoverPump, L as PdfNamedAction, M as PdfActionNode, N as PdfActionTree, O as ActionsScriptIdentity, P as PdfActionType, R as ScriptDiagnosticReportedEvent, S as ActionTriggerResult, T as ActionsCapability, U as submitEntriesToUrlEncoded, V as eventOf, W as HoverPump, _ as ActionSubmitHandler, a as ActionDispatchResult, b as ActionTrigger, c as ActionExecutorResult, d as ActionOrigin, f as ActionPolicy, g as ActionStepResult, h as ActionSource, i as ActionDiagnosticReportedEvent, j as OpenSequenceCompletedEvent, k as ActionsSettings, l as ActionNodeResult, m as ActionPolicyRow, n as ActionContext, o as ActionExecutedEvent, p as ActionPolicyDecision, q as ActionsToken, r as ActionDiagnostic, s as ActionExecutor, t as ACTIONS_DEFAULTS, u as ActionNodeStatus, v as ActionSubmitRequest, w as ActionUiContext, x as ActionTriggerEvent, y as ActionTreeSource, z as ScriptFailedEvent } from "./contract-BTPW8b4L.cjs";
2
+ export { ACTIONS_DEFAULTS, ActionContext, ActionDiagnostic, ActionDiagnosticReportedEvent, ActionDispatchResult, ActionExecutedEvent, ActionExecutor, ActionExecutorResult, ActionNodeResult, ActionNodeStatus, ActionOrigin, ActionPolicy, ActionPolicyDecision, ActionPolicyRow, ActionSource, ActionStepResult, ActionSubmitHandler, ActionSubmitRequest, ActionTreeSource, ActionTrigger, ActionTriggerEvent, ActionTriggerResult, ActionUiAdapter, ActionUiContext, ActionsCapability, ActionsConfig, ActionsScriptEnvironment, ActionsScriptIdentity, ActionsSettings, ActionsToken, DocumentTriggerEvent, type HoverPump, type HoverTarget, OpenSequenceCompletedEvent, type PdfActionNode, type PdfActionTree, type PdfActionType, PdfAnnotationEventKind, PdfFieldEventKind, PdfNamedAction, ScriptDiagnosticReportedEvent, ScriptFailedEvent, SubmitIntent, createHoverPump, eventOf, submitEntriesToUrlEncoded, triggerOriginOf };
@@ -1,3 +1,2 @@
1
- import { B as SubmitIntent, E as ActionsToken, H as originOf, P as PdfAnnotationEventKind, S as ActionsCapability, _ as ActionTrigger, b as ActionUiContext, c as ActionNodeStatus, d as ActionPolicyDecision, f as ActionPolicyRow, g as ActionSubmitRequest, h as ActionSubmitHandler, i as ActionDispatchResult, j as DocumentTriggerEvent, l as ActionOrigin, m as ActionStepResult, n as ActionDiagnostic, p as ActionSource, r as ActionDispatchEvent, s as ActionNodeResult, t as ActionContext, u as ActionPolicy, v as ActionTriggerResult, w as ActionsPluginConfig, y as ActionUiAdapter } from "./types-D-DoiESj.js";
2
- import { i as createHoverPump, n as HoverPump, r as HoverTarget, t as submitEntriesToUrlEncoded } from "./contract-COk-w3Fo.js";
3
- export { type ActionContext, type ActionDiagnostic, type ActionDispatchEvent, type ActionDispatchResult, type ActionNodeResult, type ActionNodeStatus, type ActionOrigin, type ActionPolicy, type ActionPolicyDecision, type ActionPolicyRow, type ActionSource, type ActionStepResult, type ActionSubmitHandler, type ActionSubmitRequest, type ActionTrigger, type ActionTriggerResult, type ActionUiAdapter, type ActionUiContext, type ActionsCapability, type ActionsPluginConfig, ActionsToken, type DocumentTriggerEvent, type HoverPump, type HoverTarget, type PdfAnnotationEventKind, type SubmitIntent, createHoverPump, originOf, submitEntriesToUrlEncoded };
1
+ import { A as DocumentTriggerEvent, B as SubmitIntent, C as ActionUiAdapter, D as ActionsScriptEnvironment, E as ActionsConfig, F as PdfAnnotationEventKind, G as HoverTarget, H as triggerOriginOf, I as PdfFieldEventKind, K as createHoverPump, L as PdfNamedAction, M as PdfActionNode, N as PdfActionTree, O as ActionsScriptIdentity, P as PdfActionType, R as ScriptDiagnosticReportedEvent, S as ActionTriggerResult, T as ActionsCapability, U as submitEntriesToUrlEncoded, V as eventOf, W as HoverPump, _ as ActionSubmitHandler, a as ActionDispatchResult, b as ActionTrigger, c as ActionExecutorResult, d as ActionOrigin, f as ActionPolicy, g as ActionStepResult, h as ActionSource, i as ActionDiagnosticReportedEvent, j as OpenSequenceCompletedEvent, k as ActionsSettings, l as ActionNodeResult, m as ActionPolicyRow, n as ActionContext, o as ActionExecutedEvent, p as ActionPolicyDecision, q as ActionsToken, r as ActionDiagnostic, s as ActionExecutor, t as ACTIONS_DEFAULTS, u as ActionNodeStatus, v as ActionSubmitRequest, w as ActionUiContext, x as ActionTriggerEvent, y as ActionTreeSource, z as ScriptFailedEvent } from "./contract-Cn-7mBY8.js";
2
+ export { ACTIONS_DEFAULTS, ActionContext, ActionDiagnostic, ActionDiagnosticReportedEvent, ActionDispatchResult, ActionExecutedEvent, ActionExecutor, ActionExecutorResult, ActionNodeResult, ActionNodeStatus, ActionOrigin, ActionPolicy, ActionPolicyDecision, ActionPolicyRow, ActionSource, ActionStepResult, ActionSubmitHandler, ActionSubmitRequest, ActionTreeSource, ActionTrigger, ActionTriggerEvent, ActionTriggerResult, ActionUiAdapter, ActionUiContext, ActionsCapability, ActionsConfig, ActionsScriptEnvironment, ActionsScriptIdentity, ActionsSettings, ActionsToken, DocumentTriggerEvent, type HoverPump, type HoverTarget, OpenSequenceCompletedEvent, type PdfActionNode, type PdfActionTree, type PdfActionType, PdfAnnotationEventKind, PdfFieldEventKind, PdfNamedAction, ScriptDiagnosticReportedEvent, ScriptFailedEvent, SubmitIntent, createHoverPump, eventOf, submitEntriesToUrlEncoded, triggerOriginOf };
package/dist/contract.js CHANGED
@@ -1,3 +1,2 @@
1
- import { r as originOf, t as ActionsToken } from "./types-DgBMy5nE.js";
2
- import { n as createHoverPump, t as submitEntriesToUrlEncoded } from "./contract-DAem-EST.js";
3
- export { ActionsToken, createHoverPump, originOf, submitEntriesToUrlEncoded };
1
+ import { a as createHoverPump, i as submitEntriesToUrlEncoded, n as eventOf, o as ActionsToken, r as triggerOriginOf, t as ACTIONS_DEFAULTS } from "./contract-CwN3NAXU.js";
2
+ export { ACTIONS_DEFAULTS, ActionsToken, createHoverPump, eventOf, submitEntriesToUrlEncoded, triggerOriginOf };