@embedpdf/react 3.0.0-next.1 → 3.0.0-next.10
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.cts +347 -0
- package/dist/AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.ts +347 -0
- package/dist/anchored.cjs +89 -0
- package/dist/anchored.cjs.map +1 -0
- package/dist/anchored.d.cts +45 -0
- package/dist/anchored.d.ts +45 -0
- package/dist/anchored.js +60 -0
- package/dist/anchored.js.map +1 -0
- package/dist/annotation-menu.cjs +33 -84
- package/dist/annotation-menu.cjs.map +1 -1
- package/dist/annotation-menu.d.cts +28 -2
- package/dist/annotation-menu.d.ts +28 -2
- package/dist/annotation-menu.js +27 -78
- package/dist/annotation-menu.js.map +1 -1
- package/dist/annotation.cjs +752 -16
- package/dist/annotation.cjs.map +1 -0
- package/dist/annotation.d.cts +159 -2
- package/dist/annotation.d.ts +159 -2
- package/dist/annotation.js +737 -3
- package/dist/annotation.js.map +1 -0
- package/dist/commands.js +1 -0
- package/dist/commands.js.map +1 -1
- package/dist/form.cjs +3 -3
- package/dist/form.cjs.map +1 -1
- package/dist/form.d.cts +2 -2
- package/dist/form.d.ts +2 -2
- package/dist/form.js +3 -3
- package/dist/form.js.map +1 -1
- package/dist/index.cjs +34 -5
- package/dist/index.d.cts +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +8 -6
- package/dist/interaction.cjs +17 -4
- package/dist/interaction.cjs.map +1 -1
- package/dist/interaction.d.cts +2 -2
- package/dist/interaction.d.ts +2 -2
- package/dist/interaction.js +7 -5
- package/dist/interaction.js.map +1 -1
- package/dist/link.cjs +29 -6
- package/dist/link.cjs.map +1 -1
- package/dist/link.d.cts +12 -3
- package/dist/link.d.ts +12 -3
- package/dist/link.js +31 -8
- package/dist/link.js.map +1 -1
- package/dist/metadata.js +1 -0
- package/dist/metadata.js.map +1 -1
- package/dist/page-edit.js +1 -0
- package/dist/page-edit.js.map +1 -1
- package/dist/page-view.cjs +62 -38
- package/dist/page-view.cjs.map +1 -1
- package/dist/page-view.js +59 -37
- package/dist/page-view.js.map +1 -1
- package/dist/redaction.js +1 -0
- package/dist/redaction.js.map +1 -1
- package/dist/render.cjs +67 -50
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +6 -19
- package/dist/render.d.ts +6 -19
- package/dist/render.js +71 -52
- package/dist/render.js.map +1 -1
- package/dist/rolldown-runtime-BBjsoOtd.js +27 -0
- package/dist/{runtime-DV98q7I0.d.ts → runtime-Cvi0wQ4d.d.cts} +23 -10
- package/dist/{runtime-CMxIuF2O.d.cts → runtime-DXxr8T4L.d.ts} +23 -10
- package/dist/runtime.cjs +6 -5
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +7 -5
- package/dist/runtime.js.map +1 -1
- package/dist/search.cjs +36 -19
- package/dist/search.cjs.map +1 -1
- package/dist/search.d.cts +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/search.js +36 -19
- package/dist/search.js.map +1 -1
- package/dist/selection.cjs +217 -22
- package/dist/selection.cjs.map +1 -1
- package/dist/selection.d.cts +60 -2
- package/dist/selection.d.ts +60 -2
- package/dist/selection.js +214 -27
- package/dist/selection.js.map +1 -1
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +1 -1
- package/dist/stage.cjs +47 -146
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +18 -5
- package/dist/stage.d.ts +18 -5
- package/dist/stage.js +50 -148
- package/dist/stage.js.map +1 -1
- package/dist/stamp.js +1 -0
- package/dist/stamp.js.map +1 -1
- package/dist/toolbar.js +1 -0
- package/dist/toolbar.js.map +1 -1
- package/dist/views.js +1 -0
- package/dist/views.js.map +1 -1
- package/package.json +27 -26
- package/dist/AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.cts +0 -2593
- package/dist/AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.ts +0 -2593
- package/dist/annotation-B6jwfTCh.d.cts +0 -173
- package/dist/annotation-Ct6dFtzJ.cjs +0 -913
- package/dist/annotation-Ct6dFtzJ.cjs.map +0 -1
- package/dist/annotation-DjGWJljY.js +0 -829
- package/dist/annotation-DjGWJljY.js.map +0 -1
- package/dist/annotation-nUMefyjw.d.ts +0 -173
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
//#region ../../engine/core/dist/AnnotationListSnapshot-DDxHpJQU.d.ts
|
|
2
|
+
//#endregion
|
|
3
|
+
//#region src/dto/PdfAction.d.ts
|
|
4
|
+
/** Normalized values of an action dictionary's `/S` name. */
|
|
5
|
+
type PdfActionType = 'unknown' | 'goto' | 'goto-remote' | 'goto-embedded' | 'launch' | 'thread' | 'uri' | 'sound' | 'movie' | 'hide' | 'named' | 'submit-form' | 'reset-form' | 'import-data' | 'javascript' | 'set-ocg-state' | 'rendition' | 'transition' | 'goto-3d-view';
|
|
6
|
+
/** One detached node in a normalized PDF action tree. */
|
|
7
|
+
interface PdfActionNode {
|
|
8
|
+
type: PdfActionType;
|
|
9
|
+
/** Raw `/S` name, retained for unknown and future action types. */
|
|
10
|
+
subtype: string;
|
|
11
|
+
/** Decoded `/JS` source for JavaScript and Rendition actions. */
|
|
12
|
+
script?: string;
|
|
13
|
+
/** Normalized `/Next` children in PDF order. */
|
|
14
|
+
next: PdfActionNode[];
|
|
15
|
+
}
|
|
16
|
+
type PdfActionWarning = 'cycle-dropped' | 'malformed-next' | 'incomplete';
|
|
17
|
+
/**
|
|
18
|
+
* One extracted action root plus the native reader's safety verdict.
|
|
19
|
+
* Consumers must never execute a tree whose `incomplete` flag is true.
|
|
20
|
+
*/
|
|
21
|
+
interface PdfActionTree {
|
|
22
|
+
/** Null when the model was valid but its root exceeded a safety bound. */
|
|
23
|
+
root: PdfActionNode | null;
|
|
24
|
+
incomplete: boolean;
|
|
25
|
+
/** Raw native bits, retained so newer warnings survive older SDKs. */
|
|
26
|
+
warningFlags: number;
|
|
27
|
+
warnings: PdfActionWarning[];
|
|
28
|
+
}
|
|
29
|
+
interface PdfFieldActions {
|
|
30
|
+
keystroke?: PdfActionTree;
|
|
31
|
+
format?: PdfActionTree;
|
|
32
|
+
validate?: PdfActionTree;
|
|
33
|
+
calculate?: PdfActionTree;
|
|
34
|
+
}
|
|
35
|
+
//#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
|
+
//#region src/identity/FormFieldRef.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* How callers address a logical form field.
|
|
51
|
+
*
|
|
52
|
+
* - `objectNumber` — the indirect object number of the field dictionary.
|
|
53
|
+
* ISO 32000 guarantees every real AcroForm field dictionary is an
|
|
54
|
+
* indirect object, and the layer runtime never renumbers (frozen base +
|
|
55
|
+
* incremental deltas), so this is the durable identity for the lifetime
|
|
56
|
+
* of a document. Preferred for all engine calls.
|
|
57
|
+
* - `fqn` — the fully qualified field name ("billing.name"). The portable,
|
|
58
|
+
* semantic identity used by interchange formats (FDF/XFDF) and analytics;
|
|
59
|
+
* survives document rewrites but is only as unique as the producer made
|
|
60
|
+
* it. The engine resolves it against the reconciled field tree.
|
|
61
|
+
*/
|
|
62
|
+
type FormFieldRef = {
|
|
63
|
+
kind: 'objectNumber';
|
|
64
|
+
fieldObjectNumber: number;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'fqn';
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
/** A widget annotation of a field, as the forms subsystem sees it. */
|
|
70
|
+
interface FormWidgetRef {
|
|
71
|
+
/**
|
|
72
|
+
* Indirect object number of the widget annotation — the join key to the
|
|
73
|
+
* annotation subsystem's `objectNumber` refs. `0` when the widget is
|
|
74
|
+
* stored as a direct object (spec-violating; cannot be addressed).
|
|
75
|
+
*/
|
|
76
|
+
annotObjectNumber: number;
|
|
77
|
+
/**
|
|
78
|
+
* Object number of the page whose /Annots array references the widget.
|
|
79
|
+
* `0` when the widget is not reachable from any page ("unplaced").
|
|
80
|
+
*/
|
|
81
|
+
pageObjectNumber: PageObjectNumber;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/forms/value-entry.d.ts
|
|
85
|
+
/** Lossless shape of a field's effective PDF `/V` or `/DV` object. */
|
|
86
|
+
type FormValueEntry = {
|
|
87
|
+
kind: 'none';
|
|
88
|
+
} | {
|
|
89
|
+
kind: 'scalar';
|
|
90
|
+
value: string;
|
|
91
|
+
} | {
|
|
92
|
+
kind: 'array';
|
|
93
|
+
values: string[];
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'unsupported';
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/forms/field.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* The field family — the discriminant of {@link FormFieldDTO}. Narrowing on
|
|
101
|
+
* it reveals exactly the members that are meaningful for that family, the
|
|
102
|
+
* same way annotation DTOs narrow on `subtype`.
|
|
103
|
+
*/
|
|
104
|
+
type FormFieldFamily = 'text' | 'checkbox' | 'radio' | 'combobox' | 'listbox' | 'pushbutton' | 'signature' | 'unknown';
|
|
105
|
+
/**
|
|
106
|
+
* Where the field was found.
|
|
107
|
+
*
|
|
108
|
+
* - `acroform` — reachable from the /AcroForm /Fields tree, as the spec
|
|
109
|
+
* requires.
|
|
110
|
+
* - `recovered` — only reachable through a page's /Annots array (a common
|
|
111
|
+
* producer bug). The engine reconciles these on every read so they work
|
|
112
|
+
* like any other field, but other PDF processors will not see them until
|
|
113
|
+
* {@link DocumentFormsService.repair} makes the fix durable.
|
|
114
|
+
*/
|
|
115
|
+
type FormFieldOrigin = 'acroform' | 'recovered';
|
|
116
|
+
/**
|
|
117
|
+
* The /Ff flags every field family shares. Family-specific flags (comb,
|
|
118
|
+
* multi-select, radios-in-unison, ...) live as plain booleans on the
|
|
119
|
+
* family DTOs where they are always meaningful.
|
|
120
|
+
*/
|
|
121
|
+
interface FormFieldFlags {
|
|
122
|
+
/**
|
|
123
|
+
* The user must not change the value. The engine's write transactions
|
|
124
|
+
* still accept programmatic writes to read-only fields (calculated
|
|
125
|
+
* fields are read-only yet script-written); enforcing fill policy is
|
|
126
|
+
* the application's job.
|
|
127
|
+
*/
|
|
128
|
+
readOnly: boolean;
|
|
129
|
+
required: boolean;
|
|
130
|
+
noExport: boolean;
|
|
131
|
+
/** The raw /Ff integer, for anything not surfaced. */
|
|
132
|
+
raw: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A widget of a toggle (checkbox/radio) field. Toggle widgets always carry
|
|
136
|
+
* their appearance-state machinery — no nullable fields to probe.
|
|
137
|
+
*/
|
|
138
|
+
interface ToggleFieldWidget extends FormWidgetRef {
|
|
139
|
+
/**
|
|
140
|
+
* The widget's appearance state name (the non-"Off" key of its /AP /N
|
|
141
|
+
* dictionary) — the token toggle writes address widgets by.
|
|
142
|
+
*/
|
|
143
|
+
onState: string;
|
|
144
|
+
/**
|
|
145
|
+
* The widget's export value (/Opt entry when present, else the
|
|
146
|
+
* on-state). The identity FDF/XFDF carry.
|
|
147
|
+
*/
|
|
148
|
+
exportValue: string;
|
|
149
|
+
/** Whether this widget is currently checked. */
|
|
150
|
+
checked: boolean;
|
|
151
|
+
}
|
|
152
|
+
/** One option of a choice (combo/list box) field. */
|
|
153
|
+
interface FormFieldOption {
|
|
154
|
+
/** Display label shown to the user. */
|
|
155
|
+
label: string;
|
|
156
|
+
/** Export value used by /V, interchange, and `FormFieldValue.choice`. */
|
|
157
|
+
value: string;
|
|
158
|
+
/** Whether the option is currently selected. */
|
|
159
|
+
selected: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The trunk every field family shares: identity, provenance, universal
|
|
163
|
+
* flags, and widget placement. A logical field is the document-scoped
|
|
164
|
+
* record that holds the value; its widgets are page-scoped views — join
|
|
165
|
+
* them to the annotation subsystem via `annotObjectNumber`.
|
|
166
|
+
*/
|
|
167
|
+
interface FormFieldBase {
|
|
168
|
+
/** Durable ref (`objectNumber` whenever the field dictionary is indirect). */
|
|
169
|
+
ref: FormFieldRef;
|
|
170
|
+
/** Field dictionary object number; `0` for direct (spec-violating) dicts. */
|
|
171
|
+
fieldObjectNumber: number;
|
|
172
|
+
/** Fully qualified name, e.g. `"billing.name"`. */
|
|
173
|
+
name: string;
|
|
174
|
+
family: FormFieldFamily;
|
|
175
|
+
origin: FormFieldOrigin;
|
|
176
|
+
flags: FormFieldFlags;
|
|
177
|
+
/** /TU — the accessible tooltip / alternate name. */
|
|
178
|
+
alternateName: string | null;
|
|
179
|
+
/** /TM — the export mapping name. */
|
|
180
|
+
mappingName: string | null;
|
|
181
|
+
/** Exact effective `/V` object shape; family conveniences below are derived. */
|
|
182
|
+
valueEntry: FormValueEntry;
|
|
183
|
+
/** Exact effective `/DV` object shape, including absent and malformed values. */
|
|
184
|
+
defaultValueEntry: FormValueEntry;
|
|
185
|
+
/** Effective inherited field `/AA` actions. */
|
|
186
|
+
actions?: PdfFieldActions;
|
|
187
|
+
/** The field's widget annotations, in control order. May be empty ("unplaced"). */
|
|
188
|
+
widgets: FormWidgetRef[];
|
|
189
|
+
}
|
|
190
|
+
/** A text field. Write with `{ type: 'text', value }`. */
|
|
191
|
+
interface TextFieldDTO extends FormFieldBase {
|
|
192
|
+
family: 'text';
|
|
193
|
+
value: string;
|
|
194
|
+
/** /DV — restored by `reset()`. */
|
|
195
|
+
defaultValue: string;
|
|
196
|
+
/** /MaxLen; `null` when unlimited. Longer writes are truncated to this length. */
|
|
197
|
+
maxLength: number | null;
|
|
198
|
+
multiline: boolean;
|
|
199
|
+
password: boolean;
|
|
200
|
+
/** Fixed character cells; meaningful with `maxLength`. */
|
|
201
|
+
comb: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** A checkbox. Write with `{ type: 'toggle', state: onState | null }`. */
|
|
204
|
+
interface CheckboxFieldDTO extends FormFieldBase {
|
|
205
|
+
family: 'checkbox';
|
|
206
|
+
checked: boolean;
|
|
207
|
+
/** The export value reported while checked ("Off" is never exported). */
|
|
208
|
+
exportValue: string;
|
|
209
|
+
widgets: ToggleFieldWidget[];
|
|
210
|
+
}
|
|
211
|
+
/** A radio group: ONE field, N widgets. Write with `{ type: 'toggle', state }`. */
|
|
212
|
+
interface RadioFieldDTO extends FormFieldBase {
|
|
213
|
+
family: 'radio';
|
|
214
|
+
/** The checked widget's export value, or `"Off"` when the group is clear. */
|
|
215
|
+
value: string;
|
|
216
|
+
/** Widgets sharing an export value check together. */
|
|
217
|
+
radiosInUnison: boolean;
|
|
218
|
+
/** The group cannot be cleared once a choice is made. */
|
|
219
|
+
noToggleToOff: boolean;
|
|
220
|
+
widgets: ToggleFieldWidget[];
|
|
221
|
+
}
|
|
222
|
+
/** A combo box (dropdown). Write with `{ type: 'choice', values: [v] }`. */
|
|
223
|
+
interface ComboBoxFieldDTO extends FormFieldBase {
|
|
224
|
+
family: 'combobox';
|
|
225
|
+
/** An option export value — or free text when `edit` is set. */
|
|
226
|
+
value: string;
|
|
227
|
+
/** /DV — restored by `reset()`. */
|
|
228
|
+
defaultValue: string;
|
|
229
|
+
/** Free text is allowed in addition to the options. */
|
|
230
|
+
edit: boolean;
|
|
231
|
+
options: FormFieldOption[];
|
|
232
|
+
}
|
|
233
|
+
/** A list box. Write with `{ type: 'choice', values }`. */
|
|
234
|
+
interface ListBoxFieldDTO extends FormFieldBase {
|
|
235
|
+
family: 'listbox';
|
|
236
|
+
/** Selected option export values, in option order. */
|
|
237
|
+
selectedValues: string[];
|
|
238
|
+
/** Whether several options may be selected at once. */
|
|
239
|
+
multiSelect: boolean;
|
|
240
|
+
options: FormFieldOption[];
|
|
241
|
+
}
|
|
242
|
+
/** A push button: pure trigger, holds no value. Never written or exported. */
|
|
243
|
+
interface PushButtonFieldDTO extends FormFieldBase {
|
|
244
|
+
family: 'pushbutton';
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* A signature field. Identity and placement only for now — the engine
|
|
248
|
+
* never writes signature values; signing is a future capability.
|
|
249
|
+
*/
|
|
250
|
+
interface SignatureFieldDTO extends FormFieldBase {
|
|
251
|
+
family: 'signature';
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Forward-compat placeholder for field types the engine does not model,
|
|
255
|
+
* mirroring the `unsupported` annotation kind. Round-trips safely.
|
|
256
|
+
*/
|
|
257
|
+
interface UnknownFieldDTO extends FormFieldBase {
|
|
258
|
+
family: 'unknown';
|
|
259
|
+
/** The raw /V value as text, for diagnostics. */
|
|
260
|
+
rawValue: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* A logical form field. Discriminated on `family`:
|
|
264
|
+
*
|
|
265
|
+
* ```ts
|
|
266
|
+
* if (field.family === 'listbox') {
|
|
267
|
+
* field.selectedValues; // string[]
|
|
268
|
+
* }
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
type FormFieldDTO = TextFieldDTO | CheckboxFieldDTO | RadioFieldDTO | ComboBoxFieldDTO | ListBoxFieldDTO | PushButtonFieldDTO | SignatureFieldDTO | UnknownFieldDTO;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/forms/snapshot.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* What kind of interactive form the document declares.
|
|
276
|
+
*
|
|
277
|
+
* - `none` — no /AcroForm dictionary. Recovered fields may still exist
|
|
278
|
+
* (see {@link FormFieldOrigin}); `repair()` can bootstrap the dictionary.
|
|
279
|
+
* - `acroform` — a standard AcroForm.
|
|
280
|
+
* - `xfa` — the /AcroForm carries an /XFA entry. The engine serves the
|
|
281
|
+
* AcroForm shell read-only and never executes XFA.
|
|
282
|
+
*/
|
|
283
|
+
type FormKind = 'none' | 'acroform' | 'xfa';
|
|
284
|
+
/**
|
|
285
|
+
* The document's complete form state at one instant: the reconciled field
|
|
286
|
+
* tree flattened to terminal fields with fully qualified names.
|
|
287
|
+
*
|
|
288
|
+
* Snapshots are detached and immutable — any mutation (a value write, an
|
|
289
|
+
* annotation edit, a page operation) makes previously returned snapshots
|
|
290
|
+
* stale. Re-read after mutating; the engine caches the underlying model
|
|
291
|
+
* per document version, so repeated reads between mutations are cheap.
|
|
292
|
+
*/
|
|
293
|
+
interface FormSnapshot {
|
|
294
|
+
formKind: FormKind;
|
|
295
|
+
/**
|
|
296
|
+
* Whether the /AcroForm sets /NeedAppearances (viewer-generated widget
|
|
297
|
+
* appearances). The engine bakes appearances on every write regardless;
|
|
298
|
+
* `repair({ bakeAppearances: true })` can clear the flag document-wide.
|
|
299
|
+
*/
|
|
300
|
+
needsAppearances: boolean;
|
|
301
|
+
fields: FormFieldDTO[];
|
|
302
|
+
/** `/AcroForm /CO` order; null preserves each malformed/unresolved slot. */
|
|
303
|
+
calculationOrder: Array<FormFieldRef | null>;
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/search/types.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* What to search for — THE one shape, engine → wire → plugin state →
|
|
309
|
+
* search box. One flat object; the flags define behavior per mode instead
|
|
310
|
+
* of the mode changing the shape:
|
|
311
|
+
*
|
|
312
|
+
* | flag | literal | regex |
|
|
313
|
+
* |-------------------|------------------|--------------------------------|
|
|
314
|
+
* | `matchCase` | fold case | `i` flag |
|
|
315
|
+
* | `wholeWord` | boundary check | pattern is `\b(?:…)\b`-wrapped |
|
|
316
|
+
* | `matchDiacritics` | mark fold | REJECTED (`InvalidArg`) |
|
|
317
|
+
*
|
|
318
|
+
* Literal queries match over FOLDED text; regex queries run the portable
|
|
319
|
+
* dialect against the RAW page text — which is why `matchDiacritics`
|
|
320
|
+
* cannot apply to them (diacritic folding is a property of the folded
|
|
321
|
+
* text plane). Validate with `validateSearchQuery` for early UI feedback;
|
|
322
|
+
* engines re-validate and reject with `EngineErrorCode.InvalidArg`.
|
|
323
|
+
*/
|
|
324
|
+
interface SearchQuery {
|
|
325
|
+
/**
|
|
326
|
+
* The literal text — or, when `regex`, a pattern in the portable
|
|
327
|
+
* search-regex dialect: JavaScript `u`-mode syntax MINUS backreferences
|
|
328
|
+
* and lookaround, so every valid pattern also runs on RE2 (the
|
|
329
|
+
* server-side engine).
|
|
330
|
+
*/
|
|
331
|
+
text: string;
|
|
332
|
+
/** Interpret `text` as a regex pattern. Default false (literal). */
|
|
333
|
+
regex?: boolean;
|
|
334
|
+
/** Exact-case matching. Default false (case-folded / `i` semantics). */
|
|
335
|
+
matchCase?: boolean;
|
|
336
|
+
/** Only match at word boundaries (letters/digits end the word). */
|
|
337
|
+
wholeWord?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Treat diacritics as significant ("café" ≠ "cafe"). Default false —
|
|
340
|
+
* marks are stripped on both sides, which is what viewers ship.
|
|
341
|
+
* LITERAL ONLY: combined with `regex` the query is rejected.
|
|
342
|
+
*/
|
|
343
|
+
matchDiacritics?: boolean;
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
export { SearchQuery as n, FormSnapshot as t };
|
|
347
|
+
//# sourceMappingURL=AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.cts.map
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
//#region ../../engine/core/dist/AnnotationListSnapshot-DDxHpJQU.d.ts
|
|
2
|
+
//#endregion
|
|
3
|
+
//#region src/dto/PdfAction.d.ts
|
|
4
|
+
/** Normalized values of an action dictionary's `/S` name. */
|
|
5
|
+
type PdfActionType = 'unknown' | 'goto' | 'goto-remote' | 'goto-embedded' | 'launch' | 'thread' | 'uri' | 'sound' | 'movie' | 'hide' | 'named' | 'submit-form' | 'reset-form' | 'import-data' | 'javascript' | 'set-ocg-state' | 'rendition' | 'transition' | 'goto-3d-view';
|
|
6
|
+
/** One detached node in a normalized PDF action tree. */
|
|
7
|
+
interface PdfActionNode {
|
|
8
|
+
type: PdfActionType;
|
|
9
|
+
/** Raw `/S` name, retained for unknown and future action types. */
|
|
10
|
+
subtype: string;
|
|
11
|
+
/** Decoded `/JS` source for JavaScript and Rendition actions. */
|
|
12
|
+
script?: string;
|
|
13
|
+
/** Normalized `/Next` children in PDF order. */
|
|
14
|
+
next: PdfActionNode[];
|
|
15
|
+
}
|
|
16
|
+
type PdfActionWarning = 'cycle-dropped' | 'malformed-next' | 'incomplete';
|
|
17
|
+
/**
|
|
18
|
+
* One extracted action root plus the native reader's safety verdict.
|
|
19
|
+
* Consumers must never execute a tree whose `incomplete` flag is true.
|
|
20
|
+
*/
|
|
21
|
+
interface PdfActionTree {
|
|
22
|
+
/** Null when the model was valid but its root exceeded a safety bound. */
|
|
23
|
+
root: PdfActionNode | null;
|
|
24
|
+
incomplete: boolean;
|
|
25
|
+
/** Raw native bits, retained so newer warnings survive older SDKs. */
|
|
26
|
+
warningFlags: number;
|
|
27
|
+
warnings: PdfActionWarning[];
|
|
28
|
+
}
|
|
29
|
+
interface PdfFieldActions {
|
|
30
|
+
keystroke?: PdfActionTree;
|
|
31
|
+
format?: PdfActionTree;
|
|
32
|
+
validate?: PdfActionTree;
|
|
33
|
+
calculate?: PdfActionTree;
|
|
34
|
+
}
|
|
35
|
+
//#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
|
+
//#region src/identity/FormFieldRef.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* How callers address a logical form field.
|
|
51
|
+
*
|
|
52
|
+
* - `objectNumber` — the indirect object number of the field dictionary.
|
|
53
|
+
* ISO 32000 guarantees every real AcroForm field dictionary is an
|
|
54
|
+
* indirect object, and the layer runtime never renumbers (frozen base +
|
|
55
|
+
* incremental deltas), so this is the durable identity for the lifetime
|
|
56
|
+
* of a document. Preferred for all engine calls.
|
|
57
|
+
* - `fqn` — the fully qualified field name ("billing.name"). The portable,
|
|
58
|
+
* semantic identity used by interchange formats (FDF/XFDF) and analytics;
|
|
59
|
+
* survives document rewrites but is only as unique as the producer made
|
|
60
|
+
* it. The engine resolves it against the reconciled field tree.
|
|
61
|
+
*/
|
|
62
|
+
type FormFieldRef = {
|
|
63
|
+
kind: 'objectNumber';
|
|
64
|
+
fieldObjectNumber: number;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'fqn';
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
/** A widget annotation of a field, as the forms subsystem sees it. */
|
|
70
|
+
interface FormWidgetRef {
|
|
71
|
+
/**
|
|
72
|
+
* Indirect object number of the widget annotation — the join key to the
|
|
73
|
+
* annotation subsystem's `objectNumber` refs. `0` when the widget is
|
|
74
|
+
* stored as a direct object (spec-violating; cannot be addressed).
|
|
75
|
+
*/
|
|
76
|
+
annotObjectNumber: number;
|
|
77
|
+
/**
|
|
78
|
+
* Object number of the page whose /Annots array references the widget.
|
|
79
|
+
* `0` when the widget is not reachable from any page ("unplaced").
|
|
80
|
+
*/
|
|
81
|
+
pageObjectNumber: PageObjectNumber;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/forms/value-entry.d.ts
|
|
85
|
+
/** Lossless shape of a field's effective PDF `/V` or `/DV` object. */
|
|
86
|
+
type FormValueEntry = {
|
|
87
|
+
kind: 'none';
|
|
88
|
+
} | {
|
|
89
|
+
kind: 'scalar';
|
|
90
|
+
value: string;
|
|
91
|
+
} | {
|
|
92
|
+
kind: 'array';
|
|
93
|
+
values: string[];
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'unsupported';
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/forms/field.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* The field family — the discriminant of {@link FormFieldDTO}. Narrowing on
|
|
101
|
+
* it reveals exactly the members that are meaningful for that family, the
|
|
102
|
+
* same way annotation DTOs narrow on `subtype`.
|
|
103
|
+
*/
|
|
104
|
+
type FormFieldFamily = 'text' | 'checkbox' | 'radio' | 'combobox' | 'listbox' | 'pushbutton' | 'signature' | 'unknown';
|
|
105
|
+
/**
|
|
106
|
+
* Where the field was found.
|
|
107
|
+
*
|
|
108
|
+
* - `acroform` — reachable from the /AcroForm /Fields tree, as the spec
|
|
109
|
+
* requires.
|
|
110
|
+
* - `recovered` — only reachable through a page's /Annots array (a common
|
|
111
|
+
* producer bug). The engine reconciles these on every read so they work
|
|
112
|
+
* like any other field, but other PDF processors will not see them until
|
|
113
|
+
* {@link DocumentFormsService.repair} makes the fix durable.
|
|
114
|
+
*/
|
|
115
|
+
type FormFieldOrigin = 'acroform' | 'recovered';
|
|
116
|
+
/**
|
|
117
|
+
* The /Ff flags every field family shares. Family-specific flags (comb,
|
|
118
|
+
* multi-select, radios-in-unison, ...) live as plain booleans on the
|
|
119
|
+
* family DTOs where they are always meaningful.
|
|
120
|
+
*/
|
|
121
|
+
interface FormFieldFlags {
|
|
122
|
+
/**
|
|
123
|
+
* The user must not change the value. The engine's write transactions
|
|
124
|
+
* still accept programmatic writes to read-only fields (calculated
|
|
125
|
+
* fields are read-only yet script-written); enforcing fill policy is
|
|
126
|
+
* the application's job.
|
|
127
|
+
*/
|
|
128
|
+
readOnly: boolean;
|
|
129
|
+
required: boolean;
|
|
130
|
+
noExport: boolean;
|
|
131
|
+
/** The raw /Ff integer, for anything not surfaced. */
|
|
132
|
+
raw: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A widget of a toggle (checkbox/radio) field. Toggle widgets always carry
|
|
136
|
+
* their appearance-state machinery — no nullable fields to probe.
|
|
137
|
+
*/
|
|
138
|
+
interface ToggleFieldWidget extends FormWidgetRef {
|
|
139
|
+
/**
|
|
140
|
+
* The widget's appearance state name (the non-"Off" key of its /AP /N
|
|
141
|
+
* dictionary) — the token toggle writes address widgets by.
|
|
142
|
+
*/
|
|
143
|
+
onState: string;
|
|
144
|
+
/**
|
|
145
|
+
* The widget's export value (/Opt entry when present, else the
|
|
146
|
+
* on-state). The identity FDF/XFDF carry.
|
|
147
|
+
*/
|
|
148
|
+
exportValue: string;
|
|
149
|
+
/** Whether this widget is currently checked. */
|
|
150
|
+
checked: boolean;
|
|
151
|
+
}
|
|
152
|
+
/** One option of a choice (combo/list box) field. */
|
|
153
|
+
interface FormFieldOption {
|
|
154
|
+
/** Display label shown to the user. */
|
|
155
|
+
label: string;
|
|
156
|
+
/** Export value used by /V, interchange, and `FormFieldValue.choice`. */
|
|
157
|
+
value: string;
|
|
158
|
+
/** Whether the option is currently selected. */
|
|
159
|
+
selected: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The trunk every field family shares: identity, provenance, universal
|
|
163
|
+
* flags, and widget placement. A logical field is the document-scoped
|
|
164
|
+
* record that holds the value; its widgets are page-scoped views — join
|
|
165
|
+
* them to the annotation subsystem via `annotObjectNumber`.
|
|
166
|
+
*/
|
|
167
|
+
interface FormFieldBase {
|
|
168
|
+
/** Durable ref (`objectNumber` whenever the field dictionary is indirect). */
|
|
169
|
+
ref: FormFieldRef;
|
|
170
|
+
/** Field dictionary object number; `0` for direct (spec-violating) dicts. */
|
|
171
|
+
fieldObjectNumber: number;
|
|
172
|
+
/** Fully qualified name, e.g. `"billing.name"`. */
|
|
173
|
+
name: string;
|
|
174
|
+
family: FormFieldFamily;
|
|
175
|
+
origin: FormFieldOrigin;
|
|
176
|
+
flags: FormFieldFlags;
|
|
177
|
+
/** /TU — the accessible tooltip / alternate name. */
|
|
178
|
+
alternateName: string | null;
|
|
179
|
+
/** /TM — the export mapping name. */
|
|
180
|
+
mappingName: string | null;
|
|
181
|
+
/** Exact effective `/V` object shape; family conveniences below are derived. */
|
|
182
|
+
valueEntry: FormValueEntry;
|
|
183
|
+
/** Exact effective `/DV` object shape, including absent and malformed values. */
|
|
184
|
+
defaultValueEntry: FormValueEntry;
|
|
185
|
+
/** Effective inherited field `/AA` actions. */
|
|
186
|
+
actions?: PdfFieldActions;
|
|
187
|
+
/** The field's widget annotations, in control order. May be empty ("unplaced"). */
|
|
188
|
+
widgets: FormWidgetRef[];
|
|
189
|
+
}
|
|
190
|
+
/** A text field. Write with `{ type: 'text', value }`. */
|
|
191
|
+
interface TextFieldDTO extends FormFieldBase {
|
|
192
|
+
family: 'text';
|
|
193
|
+
value: string;
|
|
194
|
+
/** /DV — restored by `reset()`. */
|
|
195
|
+
defaultValue: string;
|
|
196
|
+
/** /MaxLen; `null` when unlimited. Longer writes are truncated to this length. */
|
|
197
|
+
maxLength: number | null;
|
|
198
|
+
multiline: boolean;
|
|
199
|
+
password: boolean;
|
|
200
|
+
/** Fixed character cells; meaningful with `maxLength`. */
|
|
201
|
+
comb: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** A checkbox. Write with `{ type: 'toggle', state: onState | null }`. */
|
|
204
|
+
interface CheckboxFieldDTO extends FormFieldBase {
|
|
205
|
+
family: 'checkbox';
|
|
206
|
+
checked: boolean;
|
|
207
|
+
/** The export value reported while checked ("Off" is never exported). */
|
|
208
|
+
exportValue: string;
|
|
209
|
+
widgets: ToggleFieldWidget[];
|
|
210
|
+
}
|
|
211
|
+
/** A radio group: ONE field, N widgets. Write with `{ type: 'toggle', state }`. */
|
|
212
|
+
interface RadioFieldDTO extends FormFieldBase {
|
|
213
|
+
family: 'radio';
|
|
214
|
+
/** The checked widget's export value, or `"Off"` when the group is clear. */
|
|
215
|
+
value: string;
|
|
216
|
+
/** Widgets sharing an export value check together. */
|
|
217
|
+
radiosInUnison: boolean;
|
|
218
|
+
/** The group cannot be cleared once a choice is made. */
|
|
219
|
+
noToggleToOff: boolean;
|
|
220
|
+
widgets: ToggleFieldWidget[];
|
|
221
|
+
}
|
|
222
|
+
/** A combo box (dropdown). Write with `{ type: 'choice', values: [v] }`. */
|
|
223
|
+
interface ComboBoxFieldDTO extends FormFieldBase {
|
|
224
|
+
family: 'combobox';
|
|
225
|
+
/** An option export value — or free text when `edit` is set. */
|
|
226
|
+
value: string;
|
|
227
|
+
/** /DV — restored by `reset()`. */
|
|
228
|
+
defaultValue: string;
|
|
229
|
+
/** Free text is allowed in addition to the options. */
|
|
230
|
+
edit: boolean;
|
|
231
|
+
options: FormFieldOption[];
|
|
232
|
+
}
|
|
233
|
+
/** A list box. Write with `{ type: 'choice', values }`. */
|
|
234
|
+
interface ListBoxFieldDTO extends FormFieldBase {
|
|
235
|
+
family: 'listbox';
|
|
236
|
+
/** Selected option export values, in option order. */
|
|
237
|
+
selectedValues: string[];
|
|
238
|
+
/** Whether several options may be selected at once. */
|
|
239
|
+
multiSelect: boolean;
|
|
240
|
+
options: FormFieldOption[];
|
|
241
|
+
}
|
|
242
|
+
/** A push button: pure trigger, holds no value. Never written or exported. */
|
|
243
|
+
interface PushButtonFieldDTO extends FormFieldBase {
|
|
244
|
+
family: 'pushbutton';
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* A signature field. Identity and placement only for now — the engine
|
|
248
|
+
* never writes signature values; signing is a future capability.
|
|
249
|
+
*/
|
|
250
|
+
interface SignatureFieldDTO extends FormFieldBase {
|
|
251
|
+
family: 'signature';
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Forward-compat placeholder for field types the engine does not model,
|
|
255
|
+
* mirroring the `unsupported` annotation kind. Round-trips safely.
|
|
256
|
+
*/
|
|
257
|
+
interface UnknownFieldDTO extends FormFieldBase {
|
|
258
|
+
family: 'unknown';
|
|
259
|
+
/** The raw /V value as text, for diagnostics. */
|
|
260
|
+
rawValue: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* A logical form field. Discriminated on `family`:
|
|
264
|
+
*
|
|
265
|
+
* ```ts
|
|
266
|
+
* if (field.family === 'listbox') {
|
|
267
|
+
* field.selectedValues; // string[]
|
|
268
|
+
* }
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
type FormFieldDTO = TextFieldDTO | CheckboxFieldDTO | RadioFieldDTO | ComboBoxFieldDTO | ListBoxFieldDTO | PushButtonFieldDTO | SignatureFieldDTO | UnknownFieldDTO;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/forms/snapshot.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* What kind of interactive form the document declares.
|
|
276
|
+
*
|
|
277
|
+
* - `none` — no /AcroForm dictionary. Recovered fields may still exist
|
|
278
|
+
* (see {@link FormFieldOrigin}); `repair()` can bootstrap the dictionary.
|
|
279
|
+
* - `acroform` — a standard AcroForm.
|
|
280
|
+
* - `xfa` — the /AcroForm carries an /XFA entry. The engine serves the
|
|
281
|
+
* AcroForm shell read-only and never executes XFA.
|
|
282
|
+
*/
|
|
283
|
+
type FormKind = 'none' | 'acroform' | 'xfa';
|
|
284
|
+
/**
|
|
285
|
+
* The document's complete form state at one instant: the reconciled field
|
|
286
|
+
* tree flattened to terminal fields with fully qualified names.
|
|
287
|
+
*
|
|
288
|
+
* Snapshots are detached and immutable — any mutation (a value write, an
|
|
289
|
+
* annotation edit, a page operation) makes previously returned snapshots
|
|
290
|
+
* stale. Re-read after mutating; the engine caches the underlying model
|
|
291
|
+
* per document version, so repeated reads between mutations are cheap.
|
|
292
|
+
*/
|
|
293
|
+
interface FormSnapshot {
|
|
294
|
+
formKind: FormKind;
|
|
295
|
+
/**
|
|
296
|
+
* Whether the /AcroForm sets /NeedAppearances (viewer-generated widget
|
|
297
|
+
* appearances). The engine bakes appearances on every write regardless;
|
|
298
|
+
* `repair({ bakeAppearances: true })` can clear the flag document-wide.
|
|
299
|
+
*/
|
|
300
|
+
needsAppearances: boolean;
|
|
301
|
+
fields: FormFieldDTO[];
|
|
302
|
+
/** `/AcroForm /CO` order; null preserves each malformed/unresolved slot. */
|
|
303
|
+
calculationOrder: Array<FormFieldRef | null>;
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/search/types.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* What to search for — THE one shape, engine → wire → plugin state →
|
|
309
|
+
* search box. One flat object; the flags define behavior per mode instead
|
|
310
|
+
* of the mode changing the shape:
|
|
311
|
+
*
|
|
312
|
+
* | flag | literal | regex |
|
|
313
|
+
* |-------------------|------------------|--------------------------------|
|
|
314
|
+
* | `matchCase` | fold case | `i` flag |
|
|
315
|
+
* | `wholeWord` | boundary check | pattern is `\b(?:…)\b`-wrapped |
|
|
316
|
+
* | `matchDiacritics` | mark fold | REJECTED (`InvalidArg`) |
|
|
317
|
+
*
|
|
318
|
+
* Literal queries match over FOLDED text; regex queries run the portable
|
|
319
|
+
* dialect against the RAW page text — which is why `matchDiacritics`
|
|
320
|
+
* cannot apply to them (diacritic folding is a property of the folded
|
|
321
|
+
* text plane). Validate with `validateSearchQuery` for early UI feedback;
|
|
322
|
+
* engines re-validate and reject with `EngineErrorCode.InvalidArg`.
|
|
323
|
+
*/
|
|
324
|
+
interface SearchQuery {
|
|
325
|
+
/**
|
|
326
|
+
* The literal text — or, when `regex`, a pattern in the portable
|
|
327
|
+
* search-regex dialect: JavaScript `u`-mode syntax MINUS backreferences
|
|
328
|
+
* and lookaround, so every valid pattern also runs on RE2 (the
|
|
329
|
+
* server-side engine).
|
|
330
|
+
*/
|
|
331
|
+
text: string;
|
|
332
|
+
/** Interpret `text` as a regex pattern. Default false (literal). */
|
|
333
|
+
regex?: boolean;
|
|
334
|
+
/** Exact-case matching. Default false (case-folded / `i` semantics). */
|
|
335
|
+
matchCase?: boolean;
|
|
336
|
+
/** Only match at word boundaries (letters/digits end the word). */
|
|
337
|
+
wholeWord?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Treat diacritics as significant ("café" ≠ "cafe"). Default false —
|
|
340
|
+
* marks are stripped on both sides, which is what viewers ship.
|
|
341
|
+
* LITERAL ONLY: combined with `regex` the query is rejected.
|
|
342
|
+
*/
|
|
343
|
+
matchDiacritics?: boolean;
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
export { SearchQuery as n, FormSnapshot as t };
|
|
347
|
+
//# sourceMappingURL=AnnotationListSnapshot-DDxHpJQU-BG32YXxG.d.ts.map
|