@embedpdf/react 3.0.0-next.10 → 3.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.ts → AnnotationListSnapshot-C1U3XUxP-6kGwNoxy.d.cts} +223 -24
- package/dist/{AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.cts → AnnotationListSnapshot-C1U3XUxP-6kGwNoxy.d.ts} +223 -24
- package/dist/actions.cjs +42 -0
- package/dist/actions.cjs.map +1 -0
- package/dist/actions.d.cts +18 -0
- package/dist/actions.d.ts +18 -0
- package/dist/actions.js +34 -0
- package/dist/actions.js.map +1 -0
- package/dist/annotation-BCED_p9H.d.cts +160 -0
- package/dist/annotation-anchors-CetwM1g7.js +15 -0
- package/dist/annotation-anchors-CetwM1g7.js.map +1 -0
- package/dist/annotation-anchors-DuYRBJLl.cjs +26 -0
- package/dist/annotation-anchors-DuYRBJLl.cjs.map +1 -0
- package/dist/annotation-hooks-BB5ZhPpf.cjs +16 -0
- package/dist/annotation-hooks-BB5ZhPpf.cjs.map +1 -0
- package/dist/annotation-hooks-Df8EmzDO.js +11 -0
- package/dist/annotation-hooks-Df8EmzDO.js.map +1 -0
- package/dist/annotation-k38KDlIZ.d.ts +160 -0
- package/dist/annotation-menu.cjs +5 -5
- package/dist/annotation-menu.cjs.map +1 -1
- package/dist/annotation-menu.js +2 -2
- package/dist/annotation-menu.js.map +1 -1
- package/dist/annotation.cjs +5 -19
- package/dist/annotation.cjs.map +1 -1
- package/dist/annotation.d.cts +2 -159
- package/dist/annotation.d.ts +2 -159
- package/dist/annotation.js +2 -16
- package/dist/annotation.js.map +1 -1
- package/dist/form-BwrLFpKN.js +805 -0
- package/dist/form-BwrLFpKN.js.map +1 -0
- package/dist/form-D-ZSfGmB.cjs +836 -0
- package/dist/form-D-ZSfGmB.cjs.map +1 -0
- package/dist/form.cjs +8 -551
- package/dist/form.d.cts +4 -21
- package/dist/form.d.ts +4 -21
- package/dist/form.js +3 -544
- package/dist/index.cjs +15 -11
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +8 -5
- package/dist/link.cjs +48 -8
- package/dist/link.cjs.map +1 -1
- package/dist/link.d.cts +2 -2
- package/dist/link.d.ts +2 -2
- package/dist/link.js +49 -9
- package/dist/link.js.map +1 -1
- package/dist/{runtime-Cvi0wQ4d.d.cts → runtime-DE76hlnl.d.ts} +13 -5
- package/dist/{runtime-DXxr8T4L.d.ts → runtime-umHA_xHt.d.cts} +13 -5
- package/dist/runtime.cjs +19 -0
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +19 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scrollbar.cjs +3 -3
- package/dist/scrollbar.cjs.map +1 -1
- package/dist/scrollbar.d.cts +1 -1
- package/dist/scrollbar.d.ts +1 -1
- package/dist/scrollbar.js +1 -1
- package/dist/scrollbar.js.map +1 -1
- package/dist/search.d.cts +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/selection.cjs +2 -2
- package/dist/selection.cjs.map +1 -1
- package/dist/selection.d.cts +1 -1
- package/dist/selection.d.ts +1 -1
- package/dist/selection.js +1 -1
- package/dist/selection.js.map +1 -1
- package/dist/stage.cjs +2 -2
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +1 -1
- package/dist/stage.d.ts +1 -1
- package/dist/stage.js +1 -1
- package/dist/stage.js.map +1 -1
- package/dist/toolbar.cjs +4 -4
- package/dist/toolbar.cjs.map +1 -1
- package/dist/toolbar.d.cts +1 -1
- package/dist/toolbar.d.ts +1 -1
- package/dist/toolbar.js +1 -1
- package/dist/toolbar.js.map +1 -1
- package/package.json +29 -23
- package/dist/form.cjs.map +0 -1
- package/dist/form.js.map +0 -1
|
@@ -1,19 +1,229 @@
|
|
|
1
|
-
//#region ../../engine/core/dist/AnnotationListSnapshot-
|
|
1
|
+
//#region ../../engine/core/dist/AnnotationListSnapshot-C1U3XUxP.d.ts
|
|
2
2
|
//#endregion
|
|
3
|
-
//#region src/
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
//#region src/identity/PageObjectNumber.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* PDF indirect object number for a page.
|
|
6
|
+
*
|
|
7
|
+
* Resolved via the PDFium runtime helper `EPDFPage_GetObjectNumber(pagePtr)`.
|
|
8
|
+
* Always > 0 for well-formed PDFs. This replaces the v2 page index as the
|
|
9
|
+
* primary addressing key. The page index is kept on `PageHandle` as display
|
|
10
|
+
* metadata only, because it can shift when pages are inserted, deleted, or
|
|
11
|
+
* reordered while a session is open.
|
|
12
|
+
*/
|
|
13
|
+
type PageObjectNumber = number;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/dto/PdfDestination.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* An explicit PDF destination (ISO 32000-1 §12.3.2.2): a page, a location,
|
|
18
|
+
* and a magnification. Produced by outlines/bookmarks, link annotations,
|
|
19
|
+
* `/OpenAction`, and GoTo actions; named destinations resolve to one of
|
|
20
|
+
* these through the catalog's `/Dests` dictionary or name tree — the
|
|
21
|
+
* ENGINE does that resolution, so the viewer only ever sees this explicit
|
|
22
|
+
* form.
|
|
23
|
+
*
|
|
24
|
+
* Coordinates are PDF user space (y-up, points, absolute — NOT
|
|
25
|
+
* crop-relative). `null` means "retain the current value" (the spec's
|
|
26
|
+
* meaning for null array entries); a `/XYZ` zoom of `0` is equivalent to
|
|
27
|
+
* null. The `fitB*` kinds refer to the page's content BOUNDING box rather
|
|
28
|
+
* than the crop box.
|
|
29
|
+
*
|
|
30
|
+
* Viewers translate these onto the stage's reveal primitive — see
|
|
31
|
+
* `destinationToReveal` in `@embedpdf/plugin-stage`.
|
|
32
|
+
*/
|
|
33
|
+
type PdfDestination = {
|
|
34
|
+
kind: 'xyz';
|
|
35
|
+
pageObjectNumber: PageObjectNumber;
|
|
36
|
+
left?: number | null;
|
|
37
|
+
top?: number | null;
|
|
38
|
+
zoom?: number | null;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'fit';
|
|
41
|
+
pageObjectNumber: PageObjectNumber;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'fitH';
|
|
44
|
+
pageObjectNumber: PageObjectNumber;
|
|
45
|
+
top?: number | null;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'fitV';
|
|
48
|
+
pageObjectNumber: PageObjectNumber;
|
|
49
|
+
left?: number | null;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'fitR';
|
|
52
|
+
pageObjectNumber: PageObjectNumber;
|
|
53
|
+
left: number;
|
|
54
|
+
bottom: number;
|
|
55
|
+
right: number;
|
|
56
|
+
top: number;
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'fitB';
|
|
59
|
+
pageObjectNumber: PageObjectNumber;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'fitBH';
|
|
62
|
+
pageObjectNumber: PageObjectNumber;
|
|
63
|
+
top?: number | null;
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'fitBV';
|
|
66
|
+
pageObjectNumber: PageObjectNumber;
|
|
67
|
+
left?: number | null;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* One Hide `/T` or ResetForm `/Fields` entry. Deliberately UNSCOPED: a
|
|
71
|
+
* dictionary reference carries no page, so resolution (a name to widgets, an
|
|
72
|
+
* object number to an annotation or field) is the interpreter's job — never
|
|
73
|
+
* the extractor's.
|
|
74
|
+
*/
|
|
75
|
+
type PdfActionTargetRef = {
|
|
76
|
+
kind: 'name';
|
|
77
|
+
name: string;
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'objectNumber';
|
|
80
|
+
objectNumber: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Decoded SubmitForm `/Flags` word (ISO 32000-2:2020 Table 240) plus the raw
|
|
84
|
+
* value. `exclude` is DERIVED from bit 1 — never stored separately, so the
|
|
85
|
+
* two cannot disagree. Note the two easily-missed positions verified against
|
|
86
|
+
* the spec: bit 12 is `ExclFKey` (not "ExclFDFTemplate") and bit 13 is
|
|
87
|
+
* reserved/undefined, so `EmbedForm` is bit 14.
|
|
88
|
+
*/
|
|
89
|
+
interface SubmitFormFlags {
|
|
90
|
+
raw: number;
|
|
91
|
+
/** Bit 1: set → `fields` lists EXCLUDED fields. */
|
|
92
|
+
exclude: boolean;
|
|
93
|
+
/** Bit 2: submit designated valueless fields too, as name-only entries. */
|
|
94
|
+
includeNoValueFields: boolean;
|
|
95
|
+
/** Bits 3/6/9 folded into one verdict: bit 9 SubmitPDF dominates ("all
|
|
96
|
+
* other flags shall be ignored except GetMethod"), else bit 6 XFDF, else
|
|
97
|
+
* bit 3 HTML Form format, else FDF (the Table 240 default). */
|
|
98
|
+
format: 'fdf' | 'html' | 'xfdf' | 'pdf';
|
|
99
|
+
/** Bit 4. ISO makes GetMethod meaningful only with ExportFormat set, and
|
|
100
|
+
* the bit-9 rule keeps it alive for SubmitPDF — so `'get'` only for
|
|
101
|
+
* `'html'` and `'pdf'`; everything else posts. */
|
|
102
|
+
method: 'post' | 'get';
|
|
103
|
+
/** Bit 5 (meaningful only with ExportFormat; passed through — this stack
|
|
104
|
+
* does not capture click coordinates). */
|
|
105
|
+
submitCoordinates: boolean;
|
|
106
|
+
/** Bit 7 (FDF only): include incremental updates via FDF `Differences`. */
|
|
107
|
+
includeAppendSaves: boolean;
|
|
108
|
+
/** Bit 8 (FDF only): include markup annotations. */
|
|
109
|
+
includeAnnotations: boolean;
|
|
110
|
+
/** Bit 10: convert date-like values to the standard date format. */
|
|
111
|
+
canonicalFormat: boolean;
|
|
112
|
+
/** Bit 11 (FDF, with IncludeAnnotations): only the current user's
|
|
113
|
+
* annotations. */
|
|
114
|
+
exclNonUserAnnots: boolean;
|
|
115
|
+
/** Bit 12: the submitted FDF excludes its `F` entry. */
|
|
116
|
+
exclFKey: boolean;
|
|
117
|
+
/** Bit 14 (bit 13 is reserved): the FDF `F` entry embeds the source PDF. */
|
|
118
|
+
embedForm: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* SubmitForm's extracted intent. ATOMIC on purpose: either every required
|
|
122
|
+
* component resolved (a complete, executable payload) or the node carries no
|
|
123
|
+
* payload at all — partial states are unrepresentable. An unreadable
|
|
124
|
+
* REQUIRED component (`/F`) degrades the whole node to `unknown` +
|
|
125
|
+
* `payload-dropped` at read time instead.
|
|
126
|
+
*/
|
|
127
|
+
interface SubmitFormPayload {
|
|
128
|
+
/** Resolved `/F` URL — a `<< /FS /URL >>` file specification (7.11.5,
|
|
129
|
+
* `/UF` preferred over `/F` per 7.11.2); a bare string `/F` is accepted
|
|
130
|
+
* as a producer-compat extension. */
|
|
131
|
+
url: string;
|
|
132
|
+
/**
|
|
133
|
+
* `null` = `/Fields` ABSENT → Include/Exclude is ignored and every field
|
|
134
|
+
* except NoExport-flagged ones is submitted (Table 239). `[]` =
|
|
135
|
+
* present-but-empty: include mode submits NOTHING, exclude mode submits
|
|
136
|
+
* everything eligible — presence and emptiness are different states.
|
|
137
|
+
*/
|
|
138
|
+
fields: PdfActionTargetRef[] | null;
|
|
139
|
+
flags: SubmitFormFlags;
|
|
140
|
+
/** `/CharSet` (PDF 2.0), extracted but not encoded by this stack. */
|
|
141
|
+
charSet?: string;
|
|
142
|
+
}
|
|
143
|
+
interface PdfActionNodeCommon {
|
|
9
144
|
/** Raw `/S` name, retained for unknown and future action types. */
|
|
10
145
|
subtype: string;
|
|
11
|
-
/** Decoded `/JS` source for JavaScript and Rendition actions. */
|
|
12
|
-
script?: string;
|
|
13
146
|
/** Normalized `/Next` children in PDF order. */
|
|
14
147
|
next: PdfActionNode[];
|
|
15
148
|
}
|
|
16
|
-
|
|
149
|
+
/**
|
|
150
|
+
* One detached node in a normalized PDF action tree, discriminated on the
|
|
151
|
+
* interpreter that would execute it. Every executable arm carries its full
|
|
152
|
+
* payload — a `goto` without a destination or a `uri` without a URI is
|
|
153
|
+
* unrepresentable. A payload the reader cannot materialize degrades the node
|
|
154
|
+
* to `unknown` (original `/S` kept on `subtype`) and appends the tree-level
|
|
155
|
+
* `'payload-dropped'` warning.
|
|
156
|
+
*/
|
|
157
|
+
type PdfActionNode = PdfActionNodeCommon & ({
|
|
158
|
+
type: 'javascript';
|
|
159
|
+
script: string;
|
|
160
|
+
} | {
|
|
161
|
+
type: 'goto';
|
|
162
|
+
destination: PdfDestination;
|
|
163
|
+
} | {
|
|
164
|
+
type: 'uri';
|
|
165
|
+
uri: string;
|
|
166
|
+
isMap: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
type: 'named';
|
|
169
|
+
name: string;
|
|
170
|
+
} | {
|
|
171
|
+
type: 'hide';
|
|
172
|
+
targets: PdfActionTargetRef[];
|
|
173
|
+
hide: boolean;
|
|
174
|
+
} | {
|
|
175
|
+
type: 'reset-form';
|
|
176
|
+
/**
|
|
177
|
+
* `null` = `/Fields` ABSENT → reset every field (`exclude` is
|
|
178
|
+
* meaningless). `[]` = present-but-empty: with `exclude` false reset
|
|
179
|
+
* NOTHING, with `exclude` true reset EVERYTHING — PDFium's executor
|
|
180
|
+
* branches on presence first.
|
|
181
|
+
*/
|
|
182
|
+
fields: PdfActionTargetRef[] | null;
|
|
183
|
+
exclude: boolean;
|
|
184
|
+
} |
|
|
185
|
+
/** Reported, never executed. */
|
|
186
|
+
{
|
|
187
|
+
type: 'goto-remote';
|
|
188
|
+
filePath: string;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'goto-embedded';
|
|
191
|
+
filePath: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: 'launch';
|
|
194
|
+
filePath: string;
|
|
195
|
+
} |
|
|
196
|
+
/** ISO allows `/Rendition` to carry `/JS`; preserved, not collected. */
|
|
197
|
+
{
|
|
198
|
+
type: 'rendition';
|
|
199
|
+
script?: string;
|
|
200
|
+
} |
|
|
201
|
+
/** Recognized; executable only when `payload` is present. Absent payload
|
|
202
|
+
* = extracted by an older runtime (skew) — the node stays
|
|
203
|
+
* recognized-inert exactly as before this payload existed. */
|
|
204
|
+
{
|
|
205
|
+
type: 'submit-form';
|
|
206
|
+
payload?: SubmitFormPayload;
|
|
207
|
+
} | {
|
|
208
|
+
type: 'thread';
|
|
209
|
+
} | {
|
|
210
|
+
type: 'sound';
|
|
211
|
+
} | {
|
|
212
|
+
type: 'movie';
|
|
213
|
+
} | {
|
|
214
|
+
type: 'import-data';
|
|
215
|
+
} | {
|
|
216
|
+
type: 'set-ocg-state';
|
|
217
|
+
} | {
|
|
218
|
+
type: 'transition';
|
|
219
|
+
} | {
|
|
220
|
+
type: 'goto-3d-view';
|
|
221
|
+
} | {
|
|
222
|
+
type: 'unknown';
|
|
223
|
+
});
|
|
224
|
+
type PdfActionWarning = 'cycle-dropped' | 'malformed-next' | 'incomplete' |
|
|
225
|
+
/** A node's payload could not be read; that node degraded to `unknown`. */
|
|
226
|
+
'payload-dropped';
|
|
17
227
|
/**
|
|
18
228
|
* One extracted action root plus the native reader's safety verdict.
|
|
19
229
|
* Consumers must never execute a tree whose `incomplete` flag is true.
|
|
@@ -22,7 +232,8 @@ interface PdfActionTree {
|
|
|
22
232
|
/** Null when the model was valid but its root exceeded a safety bound. */
|
|
23
233
|
root: PdfActionNode | null;
|
|
24
234
|
incomplete: boolean;
|
|
25
|
-
/** Raw native bits, retained so newer warnings survive older SDKs.
|
|
235
|
+
/** Raw native bits, retained so newer warnings survive older SDKs.
|
|
236
|
+
* TS-detected warnings (`payload-dropped`) appear only in `warnings`. */
|
|
26
237
|
warningFlags: number;
|
|
27
238
|
warnings: PdfActionWarning[];
|
|
28
239
|
}
|
|
@@ -33,18 +244,6 @@ interface PdfFieldActions {
|
|
|
33
244
|
calculate?: PdfActionTree;
|
|
34
245
|
}
|
|
35
246
|
//#endregion
|
|
36
|
-
//#region src/identity/PageObjectNumber.d.ts
|
|
37
|
-
/**
|
|
38
|
-
* PDF indirect object number for a page.
|
|
39
|
-
*
|
|
40
|
-
* Resolved via the PDFium runtime helper `EPDFPage_GetObjectNumber(pagePtr)`.
|
|
41
|
-
* Always > 0 for well-formed PDFs. This replaces the v2 page index as the
|
|
42
|
-
* primary addressing key. The page index is kept on `PageHandle` as display
|
|
43
|
-
* metadata only, because it can shift when pages are inserted, deleted, or
|
|
44
|
-
* reordered while a session is open.
|
|
45
|
-
*/
|
|
46
|
-
type PageObjectNumber = number;
|
|
47
|
-
//#endregion
|
|
48
247
|
//#region src/identity/FormFieldRef.d.ts
|
|
49
248
|
/**
|
|
50
249
|
* How callers address a logical form field.
|
|
@@ -344,4 +543,4 @@ interface SearchQuery {
|
|
|
344
543
|
}
|
|
345
544
|
//#endregion
|
|
346
545
|
export { SearchQuery as n, FormSnapshot as t };
|
|
347
|
-
//# sourceMappingURL=AnnotationListSnapshot-
|
|
546
|
+
//# sourceMappingURL=AnnotationListSnapshot-C1U3XUxP-6kGwNoxy.d.cts.map
|
|
@@ -1,19 +1,229 @@
|
|
|
1
|
-
//#region ../../engine/core/dist/AnnotationListSnapshot-
|
|
1
|
+
//#region ../../engine/core/dist/AnnotationListSnapshot-C1U3XUxP.d.ts
|
|
2
2
|
//#endregion
|
|
3
|
-
//#region src/
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
//#region src/identity/PageObjectNumber.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* PDF indirect object number for a page.
|
|
6
|
+
*
|
|
7
|
+
* Resolved via the PDFium runtime helper `EPDFPage_GetObjectNumber(pagePtr)`.
|
|
8
|
+
* Always > 0 for well-formed PDFs. This replaces the v2 page index as the
|
|
9
|
+
* primary addressing key. The page index is kept on `PageHandle` as display
|
|
10
|
+
* metadata only, because it can shift when pages are inserted, deleted, or
|
|
11
|
+
* reordered while a session is open.
|
|
12
|
+
*/
|
|
13
|
+
type PageObjectNumber = number;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/dto/PdfDestination.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* An explicit PDF destination (ISO 32000-1 §12.3.2.2): a page, a location,
|
|
18
|
+
* and a magnification. Produced by outlines/bookmarks, link annotations,
|
|
19
|
+
* `/OpenAction`, and GoTo actions; named destinations resolve to one of
|
|
20
|
+
* these through the catalog's `/Dests` dictionary or name tree — the
|
|
21
|
+
* ENGINE does that resolution, so the viewer only ever sees this explicit
|
|
22
|
+
* form.
|
|
23
|
+
*
|
|
24
|
+
* Coordinates are PDF user space (y-up, points, absolute — NOT
|
|
25
|
+
* crop-relative). `null` means "retain the current value" (the spec's
|
|
26
|
+
* meaning for null array entries); a `/XYZ` zoom of `0` is equivalent to
|
|
27
|
+
* null. The `fitB*` kinds refer to the page's content BOUNDING box rather
|
|
28
|
+
* than the crop box.
|
|
29
|
+
*
|
|
30
|
+
* Viewers translate these onto the stage's reveal primitive — see
|
|
31
|
+
* `destinationToReveal` in `@embedpdf/plugin-stage`.
|
|
32
|
+
*/
|
|
33
|
+
type PdfDestination = {
|
|
34
|
+
kind: 'xyz';
|
|
35
|
+
pageObjectNumber: PageObjectNumber;
|
|
36
|
+
left?: number | null;
|
|
37
|
+
top?: number | null;
|
|
38
|
+
zoom?: number | null;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'fit';
|
|
41
|
+
pageObjectNumber: PageObjectNumber;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'fitH';
|
|
44
|
+
pageObjectNumber: PageObjectNumber;
|
|
45
|
+
top?: number | null;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'fitV';
|
|
48
|
+
pageObjectNumber: PageObjectNumber;
|
|
49
|
+
left?: number | null;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'fitR';
|
|
52
|
+
pageObjectNumber: PageObjectNumber;
|
|
53
|
+
left: number;
|
|
54
|
+
bottom: number;
|
|
55
|
+
right: number;
|
|
56
|
+
top: number;
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'fitB';
|
|
59
|
+
pageObjectNumber: PageObjectNumber;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'fitBH';
|
|
62
|
+
pageObjectNumber: PageObjectNumber;
|
|
63
|
+
top?: number | null;
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'fitBV';
|
|
66
|
+
pageObjectNumber: PageObjectNumber;
|
|
67
|
+
left?: number | null;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* One Hide `/T` or ResetForm `/Fields` entry. Deliberately UNSCOPED: a
|
|
71
|
+
* dictionary reference carries no page, so resolution (a name to widgets, an
|
|
72
|
+
* object number to an annotation or field) is the interpreter's job — never
|
|
73
|
+
* the extractor's.
|
|
74
|
+
*/
|
|
75
|
+
type PdfActionTargetRef = {
|
|
76
|
+
kind: 'name';
|
|
77
|
+
name: string;
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'objectNumber';
|
|
80
|
+
objectNumber: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Decoded SubmitForm `/Flags` word (ISO 32000-2:2020 Table 240) plus the raw
|
|
84
|
+
* value. `exclude` is DERIVED from bit 1 — never stored separately, so the
|
|
85
|
+
* two cannot disagree. Note the two easily-missed positions verified against
|
|
86
|
+
* the spec: bit 12 is `ExclFKey` (not "ExclFDFTemplate") and bit 13 is
|
|
87
|
+
* reserved/undefined, so `EmbedForm` is bit 14.
|
|
88
|
+
*/
|
|
89
|
+
interface SubmitFormFlags {
|
|
90
|
+
raw: number;
|
|
91
|
+
/** Bit 1: set → `fields` lists EXCLUDED fields. */
|
|
92
|
+
exclude: boolean;
|
|
93
|
+
/** Bit 2: submit designated valueless fields too, as name-only entries. */
|
|
94
|
+
includeNoValueFields: boolean;
|
|
95
|
+
/** Bits 3/6/9 folded into one verdict: bit 9 SubmitPDF dominates ("all
|
|
96
|
+
* other flags shall be ignored except GetMethod"), else bit 6 XFDF, else
|
|
97
|
+
* bit 3 HTML Form format, else FDF (the Table 240 default). */
|
|
98
|
+
format: 'fdf' | 'html' | 'xfdf' | 'pdf';
|
|
99
|
+
/** Bit 4. ISO makes GetMethod meaningful only with ExportFormat set, and
|
|
100
|
+
* the bit-9 rule keeps it alive for SubmitPDF — so `'get'` only for
|
|
101
|
+
* `'html'` and `'pdf'`; everything else posts. */
|
|
102
|
+
method: 'post' | 'get';
|
|
103
|
+
/** Bit 5 (meaningful only with ExportFormat; passed through — this stack
|
|
104
|
+
* does not capture click coordinates). */
|
|
105
|
+
submitCoordinates: boolean;
|
|
106
|
+
/** Bit 7 (FDF only): include incremental updates via FDF `Differences`. */
|
|
107
|
+
includeAppendSaves: boolean;
|
|
108
|
+
/** Bit 8 (FDF only): include markup annotations. */
|
|
109
|
+
includeAnnotations: boolean;
|
|
110
|
+
/** Bit 10: convert date-like values to the standard date format. */
|
|
111
|
+
canonicalFormat: boolean;
|
|
112
|
+
/** Bit 11 (FDF, with IncludeAnnotations): only the current user's
|
|
113
|
+
* annotations. */
|
|
114
|
+
exclNonUserAnnots: boolean;
|
|
115
|
+
/** Bit 12: the submitted FDF excludes its `F` entry. */
|
|
116
|
+
exclFKey: boolean;
|
|
117
|
+
/** Bit 14 (bit 13 is reserved): the FDF `F` entry embeds the source PDF. */
|
|
118
|
+
embedForm: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* SubmitForm's extracted intent. ATOMIC on purpose: either every required
|
|
122
|
+
* component resolved (a complete, executable payload) or the node carries no
|
|
123
|
+
* payload at all — partial states are unrepresentable. An unreadable
|
|
124
|
+
* REQUIRED component (`/F`) degrades the whole node to `unknown` +
|
|
125
|
+
* `payload-dropped` at read time instead.
|
|
126
|
+
*/
|
|
127
|
+
interface SubmitFormPayload {
|
|
128
|
+
/** Resolved `/F` URL — a `<< /FS /URL >>` file specification (7.11.5,
|
|
129
|
+
* `/UF` preferred over `/F` per 7.11.2); a bare string `/F` is accepted
|
|
130
|
+
* as a producer-compat extension. */
|
|
131
|
+
url: string;
|
|
132
|
+
/**
|
|
133
|
+
* `null` = `/Fields` ABSENT → Include/Exclude is ignored and every field
|
|
134
|
+
* except NoExport-flagged ones is submitted (Table 239). `[]` =
|
|
135
|
+
* present-but-empty: include mode submits NOTHING, exclude mode submits
|
|
136
|
+
* everything eligible — presence and emptiness are different states.
|
|
137
|
+
*/
|
|
138
|
+
fields: PdfActionTargetRef[] | null;
|
|
139
|
+
flags: SubmitFormFlags;
|
|
140
|
+
/** `/CharSet` (PDF 2.0), extracted but not encoded by this stack. */
|
|
141
|
+
charSet?: string;
|
|
142
|
+
}
|
|
143
|
+
interface PdfActionNodeCommon {
|
|
9
144
|
/** Raw `/S` name, retained for unknown and future action types. */
|
|
10
145
|
subtype: string;
|
|
11
|
-
/** Decoded `/JS` source for JavaScript and Rendition actions. */
|
|
12
|
-
script?: string;
|
|
13
146
|
/** Normalized `/Next` children in PDF order. */
|
|
14
147
|
next: PdfActionNode[];
|
|
15
148
|
}
|
|
16
|
-
|
|
149
|
+
/**
|
|
150
|
+
* One detached node in a normalized PDF action tree, discriminated on the
|
|
151
|
+
* interpreter that would execute it. Every executable arm carries its full
|
|
152
|
+
* payload — a `goto` without a destination or a `uri` without a URI is
|
|
153
|
+
* unrepresentable. A payload the reader cannot materialize degrades the node
|
|
154
|
+
* to `unknown` (original `/S` kept on `subtype`) and appends the tree-level
|
|
155
|
+
* `'payload-dropped'` warning.
|
|
156
|
+
*/
|
|
157
|
+
type PdfActionNode = PdfActionNodeCommon & ({
|
|
158
|
+
type: 'javascript';
|
|
159
|
+
script: string;
|
|
160
|
+
} | {
|
|
161
|
+
type: 'goto';
|
|
162
|
+
destination: PdfDestination;
|
|
163
|
+
} | {
|
|
164
|
+
type: 'uri';
|
|
165
|
+
uri: string;
|
|
166
|
+
isMap: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
type: 'named';
|
|
169
|
+
name: string;
|
|
170
|
+
} | {
|
|
171
|
+
type: 'hide';
|
|
172
|
+
targets: PdfActionTargetRef[];
|
|
173
|
+
hide: boolean;
|
|
174
|
+
} | {
|
|
175
|
+
type: 'reset-form';
|
|
176
|
+
/**
|
|
177
|
+
* `null` = `/Fields` ABSENT → reset every field (`exclude` is
|
|
178
|
+
* meaningless). `[]` = present-but-empty: with `exclude` false reset
|
|
179
|
+
* NOTHING, with `exclude` true reset EVERYTHING — PDFium's executor
|
|
180
|
+
* branches on presence first.
|
|
181
|
+
*/
|
|
182
|
+
fields: PdfActionTargetRef[] | null;
|
|
183
|
+
exclude: boolean;
|
|
184
|
+
} |
|
|
185
|
+
/** Reported, never executed. */
|
|
186
|
+
{
|
|
187
|
+
type: 'goto-remote';
|
|
188
|
+
filePath: string;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'goto-embedded';
|
|
191
|
+
filePath: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: 'launch';
|
|
194
|
+
filePath: string;
|
|
195
|
+
} |
|
|
196
|
+
/** ISO allows `/Rendition` to carry `/JS`; preserved, not collected. */
|
|
197
|
+
{
|
|
198
|
+
type: 'rendition';
|
|
199
|
+
script?: string;
|
|
200
|
+
} |
|
|
201
|
+
/** Recognized; executable only when `payload` is present. Absent payload
|
|
202
|
+
* = extracted by an older runtime (skew) — the node stays
|
|
203
|
+
* recognized-inert exactly as before this payload existed. */
|
|
204
|
+
{
|
|
205
|
+
type: 'submit-form';
|
|
206
|
+
payload?: SubmitFormPayload;
|
|
207
|
+
} | {
|
|
208
|
+
type: 'thread';
|
|
209
|
+
} | {
|
|
210
|
+
type: 'sound';
|
|
211
|
+
} | {
|
|
212
|
+
type: 'movie';
|
|
213
|
+
} | {
|
|
214
|
+
type: 'import-data';
|
|
215
|
+
} | {
|
|
216
|
+
type: 'set-ocg-state';
|
|
217
|
+
} | {
|
|
218
|
+
type: 'transition';
|
|
219
|
+
} | {
|
|
220
|
+
type: 'goto-3d-view';
|
|
221
|
+
} | {
|
|
222
|
+
type: 'unknown';
|
|
223
|
+
});
|
|
224
|
+
type PdfActionWarning = 'cycle-dropped' | 'malformed-next' | 'incomplete' |
|
|
225
|
+
/** A node's payload could not be read; that node degraded to `unknown`. */
|
|
226
|
+
'payload-dropped';
|
|
17
227
|
/**
|
|
18
228
|
* One extracted action root plus the native reader's safety verdict.
|
|
19
229
|
* Consumers must never execute a tree whose `incomplete` flag is true.
|
|
@@ -22,7 +232,8 @@ interface PdfActionTree {
|
|
|
22
232
|
/** Null when the model was valid but its root exceeded a safety bound. */
|
|
23
233
|
root: PdfActionNode | null;
|
|
24
234
|
incomplete: boolean;
|
|
25
|
-
/** Raw native bits, retained so newer warnings survive older SDKs.
|
|
235
|
+
/** Raw native bits, retained so newer warnings survive older SDKs.
|
|
236
|
+
* TS-detected warnings (`payload-dropped`) appear only in `warnings`. */
|
|
26
237
|
warningFlags: number;
|
|
27
238
|
warnings: PdfActionWarning[];
|
|
28
239
|
}
|
|
@@ -33,18 +244,6 @@ interface PdfFieldActions {
|
|
|
33
244
|
calculate?: PdfActionTree;
|
|
34
245
|
}
|
|
35
246
|
//#endregion
|
|
36
|
-
//#region src/identity/PageObjectNumber.d.ts
|
|
37
|
-
/**
|
|
38
|
-
* PDF indirect object number for a page.
|
|
39
|
-
*
|
|
40
|
-
* Resolved via the PDFium runtime helper `EPDFPage_GetObjectNumber(pagePtr)`.
|
|
41
|
-
* Always > 0 for well-formed PDFs. This replaces the v2 page index as the
|
|
42
|
-
* primary addressing key. The page index is kept on `PageHandle` as display
|
|
43
|
-
* metadata only, because it can shift when pages are inserted, deleted, or
|
|
44
|
-
* reordered while a session is open.
|
|
45
|
-
*/
|
|
46
|
-
type PageObjectNumber = number;
|
|
47
|
-
//#endregion
|
|
48
247
|
//#region src/identity/FormFieldRef.d.ts
|
|
49
248
|
/**
|
|
50
249
|
* How callers address a logical form field.
|
|
@@ -344,4 +543,4 @@ interface SearchQuery {
|
|
|
344
543
|
}
|
|
345
544
|
//#endregion
|
|
346
545
|
export { SearchQuery as n, FormSnapshot as t };
|
|
347
|
-
//# sourceMappingURL=AnnotationListSnapshot-
|
|
546
|
+
//# sourceMappingURL=AnnotationListSnapshot-C1U3XUxP-6kGwNoxy.d.ts.map
|
package/dist/actions.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./runtime.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let _embedpdf_web = require("@embedpdf/web");
|
|
5
|
+
let _embedpdf_plugin_stage_contract = require("@embedpdf/plugin-stage/contract");
|
|
6
|
+
let _embedpdf_plugin_actions = require("@embedpdf/plugin-actions");
|
|
7
|
+
//#region src/actions.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Install the UI adapter for the active document's action dispatcher. The
|
|
10
|
+
* DEFAULT policy — the origin×phase visibility matrix, sanitizeExternalUri
|
|
11
|
+
* URI opens, browser print/alert fallbacks — is `@embedpdf/web`'s
|
|
12
|
+
* `createDefaultActionsUiAdapter`, written ONCE for every binding; this
|
|
13
|
+
* hook is React glue only (late-bound handlers, stage navigation,
|
|
14
|
+
* identity-safe install/uninstall). The doc.print AUTHORITY gate is
|
|
15
|
+
* upstream (the actions plugin) and not overridable.
|
|
16
|
+
*/
|
|
17
|
+
function useActionsUiAdapter(handlers) {
|
|
18
|
+
const actions = require_runtime.useOptionalCapability(_embedpdf_plugin_actions.ActionsToken);
|
|
19
|
+
const stage = require_runtime.useOptionalCapability(_embedpdf_plugin_stage_contract.StageToken);
|
|
20
|
+
const handlersRef = (0, react.useRef)(handlers);
|
|
21
|
+
handlersRef.current = handlers;
|
|
22
|
+
(0, react.useEffect)(() => {
|
|
23
|
+
if (!actions) return;
|
|
24
|
+
const adapter = (0, _embedpdf_web.createDefaultActionsUiAdapter)({
|
|
25
|
+
overrides: () => handlersRef.current,
|
|
26
|
+
goToPage: (page) => stage?.goToPage(page)
|
|
27
|
+
});
|
|
28
|
+
return actions.setUiAdapter(adapter);
|
|
29
|
+
}, [actions, stage]);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.useActionsUiAdapter = useActionsUiAdapter;
|
|
33
|
+
Object.keys(_embedpdf_plugin_actions).forEach(function(k) {
|
|
34
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function() {
|
|
37
|
+
return _embedpdf_plugin_actions[k];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=actions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.cjs","names":["useOptionalCapability","ActionsToken","StageToken"],"sources":["../src/actions.tsx"],"sourcesContent":["/**\n * The React view of @embedpdf/plugin-actions — the action engine's UI port.\n *\n * The plugin is DOM-free; opening tabs and printing are this layer's job.\n * `useActionsUiAdapter()` installs the browser-default adapter (the same\n * sanitizer + window.open the link layer uses; print = the browser dialog),\n * overridable per handler. Without it, `adapter`-routed actions (URI, Print)\n * report `no-adapter` diagnostics instead of executing.\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-actions';\nimport { useEffect, useRef } from 'react';\nimport { ActionsToken, type ActionUiAdapter } from '@embedpdf/plugin-actions';\nimport { StageToken } from '@embedpdf/plugin-stage/contract';\nimport { createDefaultActionsUiAdapter } from '@embedpdf/web';\n\nimport { useOptionalCapability } from './runtime';\n\n/** Override any subset of the default adapter policy. */\nexport type ActionsUiHandlers = Partial<ActionUiAdapter>;\n\n/**\n * Install the UI adapter for the active document's action dispatcher. The\n * DEFAULT policy — the origin×phase visibility matrix, sanitizeExternalUri\n * URI opens, browser print/alert fallbacks — is `@embedpdf/web`'s\n * `createDefaultActionsUiAdapter`, written ONCE for every binding; this\n * hook is React glue only (late-bound handlers, stage navigation,\n * identity-safe install/uninstall). The doc.print AUTHORITY gate is\n * upstream (the actions plugin) and not overridable.\n */\nexport function useActionsUiAdapter(handlers?: ActionsUiHandlers): void {\n const actions = useOptionalCapability(ActionsToken);\n const stage = useOptionalCapability(StageToken);\n const handlersRef = useRef(handlers);\n handlersRef.current = handlers;\n\n useEffect(() => {\n if (!actions) return;\n const adapter: ActionUiAdapter = createDefaultActionsUiAdapter({\n overrides: () => handlersRef.current,\n goToPage: (page) => stage?.goToPage(page),\n });\n return actions.setUiAdapter(adapter);\n }, [actions, stage]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,SAAgB,oBAAoB,UAAoC;CACtE,MAAM,UAAUA,gBAAAA,sBAAsBC,yBAAAA,YAAY;CAClD,MAAM,QAAQD,gBAAAA,sBAAsBE,gCAAAA,UAAU;CAC9C,MAAM,eAAA,GAAA,MAAA,OAAA,CAAqB,QAAQ;CACnC,YAAY,UAAU;CAEtB,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,CAAC,SAAS;EACd,MAAM,WAAA,GAAA,cAAA,8BAAA,CAAyD;GAC7D,iBAAiB,YAAY;GAC7B,WAAW,SAAS,OAAO,SAAS,IAAI;EAC1C,CAAC;EACD,OAAO,QAAQ,aAAa,OAAO;CACrC,GAAG,CAAC,SAAS,KAAK,CAAC;AACrB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActionUiAdapter } from "@embedpdf/plugin-actions";
|
|
2
|
+
export * from "@embedpdf/plugin-actions";
|
|
3
|
+
//#region src/actions.d.ts
|
|
4
|
+
/** Override any subset of the default adapter policy. */
|
|
5
|
+
type ActionsUiHandlers = Partial<ActionUiAdapter>;
|
|
6
|
+
/**
|
|
7
|
+
* Install the UI adapter for the active document's action dispatcher. The
|
|
8
|
+
* DEFAULT policy — the origin×phase visibility matrix, sanitizeExternalUri
|
|
9
|
+
* URI opens, browser print/alert fallbacks — is `@embedpdf/web`'s
|
|
10
|
+
* `createDefaultActionsUiAdapter`, written ONCE for every binding; this
|
|
11
|
+
* hook is React glue only (late-bound handlers, stage navigation,
|
|
12
|
+
* identity-safe install/uninstall). The doc.print AUTHORITY gate is
|
|
13
|
+
* upstream (the actions plugin) and not overridable.
|
|
14
|
+
*/
|
|
15
|
+
declare function useActionsUiAdapter(handlers?: ActionsUiHandlers): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ActionsUiHandlers, useActionsUiAdapter };
|
|
18
|
+
//# sourceMappingURL=actions.d.cts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActionUiAdapter } from "@embedpdf/plugin-actions";
|
|
2
|
+
export * from "@embedpdf/plugin-actions";
|
|
3
|
+
//#region src/actions.d.ts
|
|
4
|
+
/** Override any subset of the default adapter policy. */
|
|
5
|
+
type ActionsUiHandlers = Partial<ActionUiAdapter>;
|
|
6
|
+
/**
|
|
7
|
+
* Install the UI adapter for the active document's action dispatcher. The
|
|
8
|
+
* DEFAULT policy — the origin×phase visibility matrix, sanitizeExternalUri
|
|
9
|
+
* URI opens, browser print/alert fallbacks — is `@embedpdf/web`'s
|
|
10
|
+
* `createDefaultActionsUiAdapter`, written ONCE for every binding; this
|
|
11
|
+
* hook is React glue only (late-bound handlers, stage navigation,
|
|
12
|
+
* identity-safe install/uninstall). The doc.print AUTHORITY gate is
|
|
13
|
+
* upstream (the actions plugin) and not overridable.
|
|
14
|
+
*/
|
|
15
|
+
declare function useActionsUiAdapter(handlers?: ActionsUiHandlers): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ActionsUiHandlers, useActionsUiAdapter };
|
|
18
|
+
//# sourceMappingURL=actions.d.ts.map
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useOptionalCapability } from "./runtime.js";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { createDefaultActionsUiAdapter } from "@embedpdf/web";
|
|
4
|
+
import { StageToken } from "@embedpdf/plugin-stage/contract";
|
|
5
|
+
import { ActionsToken } from "@embedpdf/plugin-actions";
|
|
6
|
+
export * from "@embedpdf/plugin-actions";
|
|
7
|
+
//#region src/actions.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Install the UI adapter for the active document's action dispatcher. The
|
|
10
|
+
* DEFAULT policy — the origin×phase visibility matrix, sanitizeExternalUri
|
|
11
|
+
* URI opens, browser print/alert fallbacks — is `@embedpdf/web`'s
|
|
12
|
+
* `createDefaultActionsUiAdapter`, written ONCE for every binding; this
|
|
13
|
+
* hook is React glue only (late-bound handlers, stage navigation,
|
|
14
|
+
* identity-safe install/uninstall). The doc.print AUTHORITY gate is
|
|
15
|
+
* upstream (the actions plugin) and not overridable.
|
|
16
|
+
*/
|
|
17
|
+
function useActionsUiAdapter(handlers) {
|
|
18
|
+
const actions = useOptionalCapability(ActionsToken);
|
|
19
|
+
const stage = useOptionalCapability(StageToken);
|
|
20
|
+
const handlersRef = useRef(handlers);
|
|
21
|
+
handlersRef.current = handlers;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!actions) return;
|
|
24
|
+
const adapter = createDefaultActionsUiAdapter({
|
|
25
|
+
overrides: () => handlersRef.current,
|
|
26
|
+
goToPage: (page) => stage?.goToPage(page)
|
|
27
|
+
});
|
|
28
|
+
return actions.setUiAdapter(adapter);
|
|
29
|
+
}, [actions, stage]);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useActionsUiAdapter };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","names":[],"sources":["../src/actions.tsx"],"sourcesContent":["/**\n * The React view of @embedpdf/plugin-actions — the action engine's UI port.\n *\n * The plugin is DOM-free; opening tabs and printing are this layer's job.\n * `useActionsUiAdapter()` installs the browser-default adapter (the same\n * sanitizer + window.open the link layer uses; print = the browser dialog),\n * overridable per handler. Without it, `adapter`-routed actions (URI, Print)\n * report `no-adapter` diagnostics instead of executing.\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-actions';\nimport { useEffect, useRef } from 'react';\nimport { ActionsToken, type ActionUiAdapter } from '@embedpdf/plugin-actions';\nimport { StageToken } from '@embedpdf/plugin-stage/contract';\nimport { createDefaultActionsUiAdapter } from '@embedpdf/web';\n\nimport { useOptionalCapability } from './runtime';\n\n/** Override any subset of the default adapter policy. */\nexport type ActionsUiHandlers = Partial<ActionUiAdapter>;\n\n/**\n * Install the UI adapter for the active document's action dispatcher. The\n * DEFAULT policy — the origin×phase visibility matrix, sanitizeExternalUri\n * URI opens, browser print/alert fallbacks — is `@embedpdf/web`'s\n * `createDefaultActionsUiAdapter`, written ONCE for every binding; this\n * hook is React glue only (late-bound handlers, stage navigation,\n * identity-safe install/uninstall). The doc.print AUTHORITY gate is\n * upstream (the actions plugin) and not overridable.\n */\nexport function useActionsUiAdapter(handlers?: ActionsUiHandlers): void {\n const actions = useOptionalCapability(ActionsToken);\n const stage = useOptionalCapability(StageToken);\n const handlersRef = useRef(handlers);\n handlersRef.current = handlers;\n\n useEffect(() => {\n if (!actions) return;\n const adapter: ActionUiAdapter = createDefaultActionsUiAdapter({\n overrides: () => handlersRef.current,\n goToPage: (page) => stage?.goToPage(page),\n });\n return actions.setUiAdapter(adapter);\n }, [actions, stage]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,SAAgB,oBAAoB,UAAoC;CACtE,MAAM,UAAU,sBAAsB,YAAY;CAClD,MAAM,QAAQ,sBAAsB,UAAU;CAC9C,MAAM,cAAc,OAAO,QAAQ;CACnC,YAAY,UAAU;CAEtB,gBAAgB;EACd,IAAI,CAAC,SAAS;EACd,MAAM,UAA2B,8BAA8B;GAC7D,iBAAiB,YAAY;GAC7B,WAAW,SAAS,OAAO,SAAS,IAAI;EAC1C,CAAC;EACD,OAAO,QAAQ,aAAa,OAAO;CACrC,GAAG,CAAC,SAAS,KAAK,CAAC;AACrB"}
|