@embedpdf/plugin-form 3.3.0 → 3.4.0
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/contract/host.cjs +1 -1
- package/dist/contract/host.cjs.map +1 -1
- package/dist/contract/host.d.cts +3 -3
- package/dist/contract/host.d.ts +3 -3
- package/dist/contract/host.js +1 -1
- package/dist/contract/host.js.map +1 -1
- package/dist/{contract-Bq_ewUE5.d.cts → contract-B7rB7jYx.d.cts} +201 -21
- package/dist/{contract-DJLVUeAe.d.ts → contract-BkTJQ39E.d.ts} +201 -21
- package/dist/{contract-DO7k0ua0.cjs → contract-CMb6PYbf.cjs} +4 -2
- package/dist/contract-CMb6PYbf.cjs.map +1 -0
- package/dist/{contract-Bu3RA2jA.js → contract-J_QN_Igp.js} +4 -2
- package/dist/contract-J_QN_Igp.js.map +1 -0
- package/dist/contract.cjs +1 -1
- package/dist/contract.d.cts +2 -2
- package/dist/contract.d.ts +2 -2
- package/dist/contract.js +1 -1
- package/dist/{host-contract-DI1Gf4fB.d.cts → host-contract-C8HiD6sJ.d.cts} +28 -6
- package/dist/{host-contract-D9NExKAu.d.ts → host-contract-cOcPAwaN.d.ts} +27 -5
- package/dist/index.cjs +504 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +514 -94
- package/dist/index.js.map +1 -1
- package/dist/scripting.d.cts +1 -1
- package/dist/scripting.d.ts +1 -1
- package/package.json +17 -17
- package/dist/contract-Bu3RA2jA.js.map +0 -1
- package/dist/contract-DO7k0ua0.cjs.map +0 -1
|
@@ -2,6 +2,7 @@ import { BatchResult, DeepPartial, EventHook, EventOrigin, HistoryOptions, Opera
|
|
|
2
2
|
import { ActionOrigin, ActionTriggerResult } from "@embedpdf/plugin-actions/contract";
|
|
3
3
|
import { AnnotationRef, FieldPosition, FormBundle, FormBundle as FormBundle$1, FormField, FormField as FormField$1, FormFieldDraft, FormFieldDraft as FormFieldDraft$1, FormFieldKind, FormFieldKind as FormFieldKind$1, FormFieldOption, FormFieldPatch, FormFieldPatch as FormFieldPatch$1, FormFieldRef, FormFieldRef as FormFieldRef$1, FormFieldValue, FormFieldValue as FormFieldValue$1, FormImportDrop, FormImportDrop as FormImportDrop$1, FormImportDropReason, FormImportOptions, FormImportOptions as FormImportOptions$1, FormKind, FormKind as FormKind$1, FormRepairOptions, FormRepairOptions as FormRepairOptions$1, FormRepairResult, FormRepairResult as FormRepairResult$1, FormSnapshot, FormSnapshot as FormSnapshot$1, FormWidget, PageRef, WidgetAnnotation, WidgetAnnotation as WidgetAnnotation$1, WidgetPatch, WidgetPlacement, toFieldRef as toFieldRef$1 } from "@embedpdf/engine-core/runtime";
|
|
4
4
|
import { FormTransfer } from "@embedpdf/engine-core/public";
|
|
5
|
+
import { RecordAccent } from "@embedpdf/core-annotation";
|
|
5
6
|
import { ScriptDiagnostic, ScriptExecutionError, ScriptUiEffect } from "@embedpdf/core-acrojs";
|
|
6
7
|
//#region src/model.d.ts
|
|
7
8
|
/** A page-space box (top-left origin, y-down, PDF points). */
|
|
@@ -37,11 +38,26 @@ interface FormWidgetLook {
|
|
|
37
38
|
readonly fontSize: number | null;
|
|
38
39
|
readonly textAlign: 'left' | 'center' | 'right';
|
|
39
40
|
}
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Where a widget is on its page, as the engine reads it: the frame its
|
|
43
|
+
* contents are laid out in, its quarter turn, and the rect it stands in. An
|
|
44
|
+
* unturned widget's frame is its rect.
|
|
45
|
+
*/
|
|
46
|
+
interface WidgetPlace {
|
|
47
|
+
/** The frame the widget's contents are laid out in, before its turn. */
|
|
48
|
+
readonly box: Box;
|
|
49
|
+
/** Its turn, degrees clockwise about the middle of `box`: a quarter turn (`/MK /R`), `0` upright. */
|
|
50
|
+
readonly rotation: 0 | 90 | 180 | 270;
|
|
51
|
+
/** Where it stands on its page: `box` turned (its sides swapped at 90 and 270). */
|
|
44
52
|
readonly rect: Box;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A widget a page shows: its address, where it is, the appearance state it
|
|
56
|
+
* shows, and how new its look is. Its picture and the painter's drawing both
|
|
57
|
+
* fill `rect`, where it stands: each holds the widget's turn already.
|
|
58
|
+
*/
|
|
59
|
+
interface ShownWidget extends WidgetPlace {
|
|
60
|
+
readonly ref: AnnotationRef;
|
|
45
61
|
/** The state it shows (`/AS`), or `null` for a widget without states. */
|
|
46
62
|
readonly appearanceState: string | null;
|
|
47
63
|
/**
|
|
@@ -52,25 +68,56 @@ interface ShownWidget {
|
|
|
52
68
|
/** Its confirmed picture version: a picture drawn at another one shows another look. */
|
|
53
69
|
readonly pictureVersion: number;
|
|
54
70
|
}
|
|
55
|
-
/** A widget hit: the annotation under the point
|
|
56
|
-
interface WidgetHit {
|
|
71
|
+
/** A widget hit: the annotation under the point, the field it belongs to, and where it is. */
|
|
72
|
+
interface WidgetHit extends WidgetPlace {
|
|
57
73
|
readonly annotObjectNumber: number;
|
|
58
74
|
readonly field: FormField;
|
|
59
|
-
/** The widget's page-space box. */
|
|
60
|
-
readonly box: Box;
|
|
61
75
|
}
|
|
62
76
|
/** The box the cursor is in: its field and its annotation object number. */
|
|
63
77
|
interface FocusedWidget {
|
|
64
78
|
readonly field: FieldKey;
|
|
65
79
|
readonly widget: number;
|
|
66
80
|
}
|
|
67
|
-
/**
|
|
81
|
+
/** A group as the app named it for this document (`setGroups()`): what it gave, nothing worked out. */
|
|
82
|
+
interface NamedGroup {
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly label: string | null;
|
|
85
|
+
readonly color: string | null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The plugin's session state: the box the cursor is in, the group that fields placed with a
|
|
89
|
+
* tool go in, and who the app says this document's groups are. A write in flight shows in the
|
|
90
|
+
* mirror's view.
|
|
91
|
+
*/
|
|
68
92
|
interface FormModel {
|
|
69
93
|
readonly focused: FocusedWidget | null;
|
|
94
|
+
/** The group a field placed with a tool goes in; `null` when it names none. */
|
|
95
|
+
readonly designGroup: string | null;
|
|
96
|
+
/** The groups the app named, in its order, each id once. */
|
|
97
|
+
readonly groups: readonly NamedGroup[];
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/services/groups.d.ts
|
|
101
|
+
/** One of the form's groups, as `listGroups()` gives it. */
|
|
102
|
+
interface FormGroup {
|
|
103
|
+
/** The group: the id its fields carry. */
|
|
104
|
+
readonly id: string;
|
|
105
|
+
/** Who the group is, for people; `null` when the app gives it no label. */
|
|
106
|
+
readonly label: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* The color its fields show in, a CSS color: the one the app gave, else one
|
|
109
|
+
* of {@link GROUP_COLORS} by the group's place in the list.
|
|
110
|
+
*/
|
|
111
|
+
readonly color: string;
|
|
70
112
|
}
|
|
71
113
|
//#endregion
|
|
72
114
|
//#region src/read/fill-items.d.ts
|
|
73
|
-
|
|
115
|
+
/** Where a radio button comes among its group's buttons: `position` from 1, of `size`. */
|
|
116
|
+
interface GroupPosition {
|
|
117
|
+
readonly position: number;
|
|
118
|
+
readonly size: number;
|
|
119
|
+
}
|
|
120
|
+
interface FormWidgetItemBase extends WidgetPlace {
|
|
74
121
|
key: FieldKey;
|
|
75
122
|
/** The field this widget belongs to: what the write verbs take. */
|
|
76
123
|
fieldRef: FormFieldRef;
|
|
@@ -78,13 +125,33 @@ interface FormWidgetItemBase {
|
|
|
78
125
|
annotObjectNumber: number;
|
|
79
126
|
/** The widget's annotation address (null until the engine has placed it). */
|
|
80
127
|
annotationRef: AnnotationRef | null;
|
|
81
|
-
/**
|
|
82
|
-
|
|
128
|
+
/** The box's own address: what `getWidget()` takes, and what UI anchored to the box is given. */
|
|
129
|
+
ref: AnnotationRef;
|
|
130
|
+
/** The group the field is in, or `null`. */
|
|
131
|
+
groupId: string | null;
|
|
132
|
+
/** The session may fill the field in, or sign it for a signature field: its permissions alone. */
|
|
133
|
+
canFill: boolean;
|
|
134
|
+
/** The form asks for a value: the field's Required flag. */
|
|
135
|
+
required: boolean;
|
|
136
|
+
/** The field holds nothing yet, by the rule `validate()` checks a required field with. */
|
|
137
|
+
empty: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* What the box shows its group in: the group's color, a CSS color, and how strongly it shows
|
|
140
|
+
* (the `fields.tint` setting), while the session may fill the field in and the field still
|
|
141
|
+
* takes a value (it isn't a push button, read-only, nor a signed signature). `null`
|
|
142
|
+
* otherwise, for a field in no group, and while the tint is `0`: the box shows as the PDF has
|
|
143
|
+
* it. The same shape a lent field has on the annotation layer.
|
|
144
|
+
*/
|
|
145
|
+
accent: RecordAccent | null;
|
|
83
146
|
/** How the widget looks in the PDF. */
|
|
84
147
|
look: FormWidgetLook;
|
|
85
148
|
/** A read-only field, no permission to fill, filling it turned off (`fillable`), or a write on its way: draw it, don't take input. */
|
|
86
149
|
disabled: boolean;
|
|
87
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* Accessible name: the field's tooltip (`/TU`) when it has one, else its full name. A radio
|
|
152
|
+
* button adds the option it stands for, its export value: `Plan: monthly`. A field of a group
|
|
153
|
+
* the app gives a label says whose it is last: `Plan: monthly, Dana Smith`.
|
|
154
|
+
*/
|
|
88
155
|
label: string;
|
|
89
156
|
}
|
|
90
157
|
/** One widget as a fill control draws it: where, how it looks, its control and its value. */
|
|
@@ -97,10 +164,21 @@ type FormWidgetItem = FormWidgetItemBase & ({
|
|
|
97
164
|
comb: boolean;
|
|
98
165
|
} | {
|
|
99
166
|
control: 'toggle';
|
|
100
|
-
kind: 'checkbox'
|
|
167
|
+
kind: 'checkbox';
|
|
101
168
|
checked: boolean;
|
|
102
169
|
/** The export value that checks this widget. */
|
|
103
170
|
exportValue: string;
|
|
171
|
+
} | {
|
|
172
|
+
control: 'toggle';
|
|
173
|
+
kind: 'radio';
|
|
174
|
+
checked: boolean;
|
|
175
|
+
/** The export value that checks this widget: the option it stands for. */
|
|
176
|
+
exportValue: string;
|
|
177
|
+
/**
|
|
178
|
+
* Where the button comes among its group's buttons, in the order the arrow keys go round
|
|
179
|
+
* (Tab's): for `aria-posinset` and `aria-setsize`. Null while that order isn't known.
|
|
180
|
+
*/
|
|
181
|
+
inGroup: GroupPosition | null;
|
|
104
182
|
} | {
|
|
105
183
|
control: 'choice';
|
|
106
184
|
kind: 'combo' | 'list';
|
|
@@ -132,7 +210,8 @@ declare const FormToken: import("@embedpdf/core").CapabilityToken<FormCapability
|
|
|
132
210
|
* document while the app runs. The colors are what the viewer draws around
|
|
133
211
|
* fields (a field's own colors are in the PDF); each can also come from CSS
|
|
134
212
|
* (`--epdf-form-focus`, `--epdf-form-field-border`,
|
|
135
|
-
* `--epdf-form-field-background`, `--epdf-form-field-color
|
|
213
|
+
* `--epdf-form-field-background`, `--epdf-form-field-color`,
|
|
214
|
+
* `--epdf-form-field-tint`), which wins.
|
|
136
215
|
*/
|
|
137
216
|
interface FormSettings {
|
|
138
217
|
/**
|
|
@@ -152,6 +231,11 @@ interface FormSettings {
|
|
|
152
231
|
readonly background: string;
|
|
153
232
|
/** The text of a field that has no color of its own. */
|
|
154
233
|
readonly color: string;
|
|
234
|
+
/**
|
|
235
|
+
* How strongly a field shows its group's color ({@link FormCapability.listGroups}): from
|
|
236
|
+
* `0`, not at all, to `1`.
|
|
237
|
+
*/
|
|
238
|
+
readonly tint: number;
|
|
155
239
|
};
|
|
156
240
|
/**
|
|
157
241
|
* Which fields people may fill in by hand: `true`, every one; `false`,
|
|
@@ -162,6 +246,19 @@ interface FormSettings {
|
|
|
162
246
|
*/
|
|
163
247
|
readonly fillable: FillableFields;
|
|
164
248
|
}
|
|
249
|
+
/** One of a document's groups, as the app names it with `setGroups()`. */
|
|
250
|
+
interface FormGroupInput {
|
|
251
|
+
/** The group: the id its fields carry, and the one the permissions name. */
|
|
252
|
+
readonly id: string;
|
|
253
|
+
/** Who the group is, for people: a legend shows it, and screen readers read it after a field's name. */
|
|
254
|
+
readonly label?: string;
|
|
255
|
+
/**
|
|
256
|
+
* The color its fields show in: a CSS color, so it can name a variable of
|
|
257
|
+
* the app's (`'var(--signer-1)'`). Left out, the group gets one of eight
|
|
258
|
+
* colors by its place in the list.
|
|
259
|
+
*/
|
|
260
|
+
readonly color?: string;
|
|
261
|
+
}
|
|
165
262
|
/** Which fields people may fill in by hand: all, none, or those of these kinds. */
|
|
166
263
|
type FillableFields = boolean | readonly FormFieldKind[];
|
|
167
264
|
/** What the form settings are when the app registers none. */
|
|
@@ -214,7 +311,10 @@ type FormFieldFlagSetting = 'required' | 'readOnly' | 'noExport' | 'multiline' |
|
|
|
214
311
|
* (`null`). `choice`: one of `options`, or any text when `free`. `choices`:
|
|
215
312
|
* any of `options`. `options`: the field's options, each a label and a value.
|
|
216
313
|
* `options` of a `choice` or `choices` are the field's own values, the
|
|
217
|
-
* document's words, shown as they are.
|
|
314
|
+
* document's words, shown as they are. The `groupId` setting's are the ids of
|
|
315
|
+
* the groups the user may put the field in: show each with its group's label
|
|
316
|
+
* (`listGroups()`), and none of them (`null`) takes the field out of its
|
|
317
|
+
* group. A field has it only while the document has groups.
|
|
218
318
|
*
|
|
219
319
|
* `label` is the English name and `labelKey` its translation key
|
|
220
320
|
* (`form.settings.tooltip`): a panel shows `t(setting.labelKey, { fallback:
|
|
@@ -248,6 +348,13 @@ type FormFieldSetting = {
|
|
|
248
348
|
readonly labelKey: string;
|
|
249
349
|
readonly options: readonly string[];
|
|
250
350
|
readonly free: boolean;
|
|
351
|
+
} | {
|
|
352
|
+
readonly key: 'groupId';
|
|
353
|
+
readonly control: 'choice';
|
|
354
|
+
readonly label: string;
|
|
355
|
+
readonly labelKey: string;
|
|
356
|
+
readonly options: readonly string[];
|
|
357
|
+
readonly free: false;
|
|
251
358
|
} | {
|
|
252
359
|
readonly key: 'defaultValue';
|
|
253
360
|
readonly control: 'choices';
|
|
@@ -269,6 +376,10 @@ interface FormFieldSettings {
|
|
|
269
376
|
readonly properties: readonly FormFieldSetting[];
|
|
270
377
|
readonly values: Readonly<Record<string, unknown>>;
|
|
271
378
|
}
|
|
379
|
+
/** What `moveToGroup()` resolves: the fields as they are now, in the order given. */
|
|
380
|
+
interface FormGroupMoveResult {
|
|
381
|
+
readonly fields: readonly FormField[];
|
|
382
|
+
}
|
|
272
383
|
/** What `create()`, `update()` and `removeWidget()` resolve: the field as it is now. */
|
|
273
384
|
interface FormFieldResult {
|
|
274
385
|
readonly field: FormField;
|
|
@@ -399,12 +510,25 @@ interface FormValidationRejectedEvent {
|
|
|
399
510
|
readonly field: FormField;
|
|
400
511
|
readonly issues: readonly ScriptDiagnostic[];
|
|
401
512
|
}
|
|
513
|
+
/** Where UI attaches to one box of a field: its page and where the box stands on it (page space). */
|
|
514
|
+
interface FormWidgetAnchor {
|
|
515
|
+
readonly page: PageRef;
|
|
516
|
+
readonly bounds: Box;
|
|
517
|
+
}
|
|
402
518
|
/** The cursor moved into a field, to another one, or out of the fields (`field` is then `null`). */
|
|
403
519
|
interface FormFocusChangedEvent {
|
|
404
520
|
readonly field: FormField | null;
|
|
405
521
|
/** The box the cursor is in. */
|
|
406
522
|
readonly widget: AnnotationRef | null;
|
|
407
523
|
}
|
|
524
|
+
/** The group that fields placed with a tool go in changed (`groupId` is `null` when it names none). */
|
|
525
|
+
interface FormDesignGroupChangedEvent {
|
|
526
|
+
readonly groupId: string | null;
|
|
527
|
+
}
|
|
528
|
+
/** `setGroups()` changed who the document's groups are: the groups as `listGroups()` gives them now. */
|
|
529
|
+
interface FormGroupsChangedEvent {
|
|
530
|
+
readonly groups: readonly FormGroup[];
|
|
531
|
+
}
|
|
408
532
|
/** The whole form was read. */
|
|
409
533
|
interface FormResyncedEvent {
|
|
410
534
|
readonly snapshot: FormSnapshot;
|
|
@@ -445,11 +569,13 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
445
569
|
/**
|
|
446
570
|
* Each widget on a page (its ref or its index), with its place, its look,
|
|
447
571
|
* its control, its value and whether it can be filled: for drawing the
|
|
448
|
-
* fields yourself.
|
|
449
|
-
*
|
|
572
|
+
* fields yourself. Its place is its frame (`box`), its quarter turn
|
|
573
|
+
* (`rotation`) and the rect it stands in (`rect`): a control goes in the
|
|
574
|
+
* frame, turned about its middle. The same array while nothing changes;
|
|
575
|
+
* empty for a page that isn't in the document.
|
|
450
576
|
*/
|
|
451
577
|
listWidgets(page: PageRef | number): readonly FormWidgetItem[];
|
|
452
|
-
/** The widget under a point on a page, with its field, or `null`. */
|
|
578
|
+
/** The widget under a point on a page, with its field and its place, or `null`. */
|
|
453
579
|
getWidgetAt(page: PageRef | number, point: {
|
|
454
580
|
x: number;
|
|
455
581
|
y: number;
|
|
@@ -459,8 +585,26 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
459
585
|
* field, such as a radio group's buttons. `null` otherwise.
|
|
460
586
|
*/
|
|
461
587
|
getSelectedField(): FormField | null;
|
|
588
|
+
/**
|
|
589
|
+
* Every field with a selected widget (in design mode), in the selection's order, each once.
|
|
590
|
+
* The same array while nothing changes.
|
|
591
|
+
*/
|
|
592
|
+
listSelectedFields(): readonly FormField[];
|
|
462
593
|
/** The field the cursor is in, or `null`. */
|
|
463
594
|
getFocusedField(): FormField | null;
|
|
595
|
+
/**
|
|
596
|
+
* The document's groups: the ones `setGroups()` named, in that order, then
|
|
597
|
+
* the other groups the form's fields are in. Each has its label (`null`
|
|
598
|
+
* where the app gave none) and the color its fields show in: the app's,
|
|
599
|
+
* else one of eight by the group's place in this list. The same array
|
|
600
|
+
* while nothing changes.
|
|
601
|
+
*/
|
|
602
|
+
listGroups(): readonly FormGroup[];
|
|
603
|
+
/**
|
|
604
|
+
* The group that fields placed with a tool go in (in design mode), or
|
|
605
|
+
* `null`, where it starts, when it names none.
|
|
606
|
+
*/
|
|
607
|
+
getDesignGroup(): string | null;
|
|
464
608
|
/**
|
|
465
609
|
* A field's settings, described for a settings panel, which writes them
|
|
466
610
|
* with `update()`; `null` for a field the form doesn't have. Every setting
|
|
@@ -579,6 +723,32 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
579
723
|
* `not-found` for a widget the form doesn't show.
|
|
580
724
|
*/
|
|
581
725
|
duplicateWidgets(widgets: readonly AnnotationRef[], options?: FormDuplicateOptions & OperationOptions): Promise<FormDuplicateResult>;
|
|
726
|
+
/**
|
|
727
|
+
* Say who this document's groups are, for the people who look at it: the
|
|
728
|
+
* whole list, and an empty one clears it. A field's group is an id in the
|
|
729
|
+
* PDF; its name and its color are the app's, and never written there. The
|
|
730
|
+
* first entry of an id is the group. Fires `onGroupsChanged`; the same
|
|
731
|
+
* list again changes nothing.
|
|
732
|
+
*/
|
|
733
|
+
setGroups(groups: readonly FormGroupInput[]): void;
|
|
734
|
+
/**
|
|
735
|
+
* Say who the next fields are for: a field placed with a tool goes into
|
|
736
|
+
* this group. With `null` it names none, and the field is in no group.
|
|
737
|
+
* Fires `onDesignGroupChanged`. Throws
|
|
738
|
+
* `permission-denied` for a group the user may not put a field in
|
|
739
|
+
* (`canSetGroup`).
|
|
740
|
+
*/
|
|
741
|
+
setDesignGroup(groupId: string | null): void;
|
|
742
|
+
/**
|
|
743
|
+
* Put fields in a group, or with `null` take them out of theirs, in one
|
|
744
|
+
* step to undo: each field not already there gets it as its `groupId`.
|
|
745
|
+
* Fires `onFieldUpdated` for each, and resolves the fields as they are
|
|
746
|
+
* now, in the order given. Rejects `permission-denied` without
|
|
747
|
+
* `doc.forms.modify` or for a group the user may not put a field in
|
|
748
|
+
* (`canSetGroup`; taking a field out of its group needs no more than
|
|
749
|
+
* `doc.forms.modify`), `not-found` for a field the form doesn't have.
|
|
750
|
+
*/
|
|
751
|
+
moveToGroup(fields: readonly FormFieldRef[], groupId: string | null, options?: OperationOptions): Promise<FormGroupMoveResult>;
|
|
582
752
|
/** Change a field's settings: pass only what changes. Fires `onFieldUpdated`. Rejects like `create()`. */
|
|
583
753
|
update(ref: FormFieldRef, patch: FormFieldPatch, options?: OperationOptions): Promise<FormFieldResult>;
|
|
584
754
|
/** Remove a field and every widget it has. Fires `onFieldDeleted`. Rejects `permission-denied` without `doc.forms.modify`, `not-found`. */
|
|
@@ -634,6 +804,12 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
634
804
|
canFill(field: FormFieldRef): boolean;
|
|
635
805
|
/** Whether adding, changing and removing fields is allowed: `doc.forms.modify`. */
|
|
636
806
|
canDesign(): boolean;
|
|
807
|
+
/**
|
|
808
|
+
* Whether the user may put a field in this group, with `create()`,
|
|
809
|
+
* `update()` or a tool: `doc.forms.modify`, and the group is the user's
|
|
810
|
+
* own or one a `fields:set-group` permission names.
|
|
811
|
+
*/
|
|
812
|
+
canSetGroup(groupId: string): boolean;
|
|
637
813
|
/**
|
|
638
814
|
* Whether an import may restore who created and filled in the fields it
|
|
639
815
|
* brings, instead of naming the importing user: `doc.forms.import`.
|
|
@@ -658,7 +834,11 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
658
834
|
readonly onResynced: EventHook<FormResyncedEvent>;
|
|
659
835
|
/** The cursor moved into a field, to another one, or out of the fields. */
|
|
660
836
|
readonly onFocusChanged: EventHook<FormFocusChangedEvent>;
|
|
837
|
+
/** The group that fields placed with a tool go in changed. */
|
|
838
|
+
readonly onDesignGroupChanged: EventHook<FormDesignGroupChangedEvent>;
|
|
839
|
+
/** `setGroups()` changed who the document's groups are. */
|
|
840
|
+
readonly onGroupsChanged: EventHook<FormGroupsChangedEvent>;
|
|
661
841
|
}
|
|
662
842
|
//#endregion
|
|
663
|
-
export {
|
|
664
|
-
//# sourceMappingURL=contract-
|
|
843
|
+
export { WidgetActivationResult as $, FormGroupMoveResult as A, FormResetResult as B, FormFieldUpdatedEvent as C, FormFocusNextOptions as D, FormFocusChangedEvent as E, FormImportResult as F, FormSnapshot$1 as G, FormSetValueResult as H, FormKind$1 as I, FormValidation as J, FormTransfer as K, FormPlainValue as L, FormImportDrop$1 as M, FormImportDropReason as N, FormFocusOptions as O, FormImportOptions$1 as P, FormWidgetAnchor as Q, FormRepairOptions$1 as R, FormFieldSettings as S, FormFilter as T, FormSetValueStatus as U, FormResyncedEvent as V, FormSettings as W, FormValueChangedEvent as X, FormValidationRejectedEvent as Y, FormWidgetAddResult as Z, FormFieldKind$1 as _, FormCommitResult as a, GroupPosition as at, FormFieldResult as b, FormDesignGroupChangedEvent as c, FormModel as ct, FormExportSelection as d, WidgetHit as dt, WidgetAddress as et, FormField$1 as f, WidgetPlace as ft, FormFieldFlagSetting as g, FormFieldDraft$1 as h, FormCapability as i, FormWidgetItem as it, FormGroupsChangedEvent as j, FormGroupInput as k, FormDuplicateOptions as l, FormWidgetLook as lt, FormFieldDeletedEvent as m, FillableFields as n, toFieldRef$1 as nt, FormCommitStatus as o, FormGroup as ot, FormFieldCreatedEvent as p, FormUiEffect as q, FormBundle$1 as r, FormToken as rt, FormConfig as s, Box as st, FORM_DEFAULTS as t, WidgetAnnotation$1 as tt, FormDuplicateResult as u, ShownWidget as ut, FormFieldPatch$1 as v, FormFieldValue$1 as w, FormFieldSetting as x, FormFieldRef$1 as y, FormRepairResult$1 as z };
|
|
844
|
+
//# sourceMappingURL=contract-BkTJQ39E.d.ts.map
|
|
@@ -20,6 +20,7 @@ const FormToken = (0, _embedpdf_core.createCapabilityToken)("form", {
|
|
|
20
20
|
duplicate: true,
|
|
21
21
|
duplicateWidgets: true,
|
|
22
22
|
update: true,
|
|
23
|
+
moveToGroup: true,
|
|
23
24
|
delete: true,
|
|
24
25
|
removeWidget: true,
|
|
25
26
|
updateWidget: true,
|
|
@@ -37,7 +38,8 @@ const FORM_DEFAULTS = {
|
|
|
37
38
|
fields: {
|
|
38
39
|
border: null,
|
|
39
40
|
background: "rgb(255 255 255 / 0.92)",
|
|
40
|
-
color: "#1f2a44"
|
|
41
|
+
color: "#1f2a44",
|
|
42
|
+
tint: .16
|
|
41
43
|
},
|
|
42
44
|
fillable: true
|
|
43
45
|
};
|
|
@@ -55,4 +57,4 @@ Object.defineProperty(exports, "FormToken", {
|
|
|
55
57
|
}
|
|
56
58
|
});
|
|
57
59
|
|
|
58
|
-
//# sourceMappingURL=contract-
|
|
60
|
+
//# sourceMappingURL=contract-CMb6PYbf.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-CMb6PYbf.cjs","names":[],"sources":["../src/token.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 { FormCapability } from './contract';\n\nexport const FormToken = createCapabilityToken<FormCapability>('form', {\n hint: `add formPlugin() from '@embedpdf/plugin-form' 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 setValue: true,\n setValues: true,\n importValues: true,\n reset: true,\n activateWidget: true,\n export: true,\n import: true,\n refresh: true,\n create: true,\n addWidget: true,\n duplicate: true,\n duplicateWidgets: true,\n update: true,\n moveToGroup: true,\n delete: true,\n removeWidget: true,\n updateWidget: true,\n deleteWidget: true,\n reorderCalculations: true,\n repair: true,\n },\n});\n","/**\n * @embedpdf/plugin-form/contract: the public form vocabulary. Fields are\n * addressed by `FormFieldRef` (`toFieldRef(name)` for a name you know),\n * widgets by their `AnnotationRef`; the scripting seams are the host lens\n * (`/contract/host`).\n */\nimport type {\n BatchResult,\n DeepPartial,\n EventHook,\n EventOrigin,\n HistoryOptions,\n OperationOptions,\n ResourceStatus,\n SettingsApi,\n} from '@embedpdf/core';\nimport type { ScriptDiagnostic, ScriptExecutionError, ScriptUiEffect } from '@embedpdf/core-acrojs';\nimport type {\n AnnotationRef,\n FieldPosition,\n FormBundle,\n FormFieldDraft,\n FormField,\n FormFieldKind,\n FormFieldPatch,\n FormFieldRef,\n FormFieldValue,\n FormImportDrop,\n FormImportOptions,\n FormKind,\n FormRepairOptions,\n FormRepairResult,\n FormSnapshot,\n FormWidget,\n PageRef,\n WidgetAnnotation,\n WidgetPatch,\n WidgetPlacement,\n} from '@embedpdf/engine-core/runtime';\nimport type { ActionOrigin, ActionTriggerResult } from '@embedpdf/plugin-actions/contract';\n\nimport type { Box, WidgetHit } from './model';\nimport type { FormWidgetItem } from './read/fill-items';\nimport type { FormGroup } from './services/groups';\n\nexport { FormToken } from './token';\nexport { toFieldRef } from '@embedpdf/engine-core/runtime';\nexport { FormTransfer } from '@embedpdf/engine-core/public';\nexport type { FormWidgetItem, FormWidgetLook, GroupPosition } from './read/fill-items';\nexport type { FormGroup } from './services/groups';\nexport type { Box, WidgetHit, WidgetPlace } from './model';\nexport type {\n FormBundle,\n FormFieldDraft,\n FormField,\n FormFieldKind,\n FormFieldPatch,\n FormFieldRef,\n FormFieldValue,\n FormImportDrop,\n FormImportDropReason,\n FormImportOptions,\n FormKind,\n FormRepairOptions,\n FormRepairResult,\n FormSnapshot,\n WidgetAnnotation,\n} from '@embedpdf/engine-core/runtime';\n\n// ── settings ──────────────────────────────────────────────────────────────\n\n/**\n * The form plugin's settings. `formPlugin(config)` registers them over\n * {@link FORM_DEFAULTS}, and `updateSettings()` changes them for every\n * document while the app runs. The colors are what the viewer draws around\n * fields (a field's own colors are in the PDF); each can also come from CSS\n * (`--epdf-form-focus`, `--epdf-form-field-border`,\n * `--epdf-form-field-background`, `--epdf-form-field-color`,\n * `--epdf-form-field-tint`), which wins.\n */\nexport interface FormSettings {\n /**\n * Run the form's own checks, the keystroke, validate, calculate and format\n * scripts, when a value is written (`'scripts'`, which needs JavaScript on\n * in `actionsPlugin({ javascript })`), or accept every value (`'none'`).\n */\n readonly validation: 'scripts' | 'none';\n readonly focus: {\n /** The ring around the field being filled in: a CSS color, or `null` for the viewer's accent. */\n readonly color: string | null;\n };\n readonly fields: {\n /** The edge of a field that has no border of its own: a CSS color, or `null` for the accent at 55%. */\n readonly border: string | null;\n /** Inside a field that has no background of its own, while it's being filled in. */\n readonly background: string;\n /** The text of a field that has no color of its own. */\n readonly color: string;\n /**\n * How strongly a field shows its group's color ({@link FormCapability.listGroups}): from\n * `0`, not at all, to `1`.\n */\n readonly tint: number;\n };\n /**\n * Which fields people may fill in by hand: `true`, every one; `false`,\n * none; or a list of field kinds (`'text'`, `'checkbox'`,\n * `'signature'`…). A field left out draws as a read-only one does, and\n * takes no typing, clicks or picks. Only the interface: your code still\n * fills it in (`setValue()`, `importValues()`), and `canFill()` doesn't change.\n */\n readonly fillable: FillableFields;\n}\n\n/** One of a document's groups, as the app names it with `setGroups()`. */\nexport interface FormGroupInput {\n /** The group: the id its fields carry, and the one the permissions name. */\n readonly id: string;\n /** Who the group is, for people: a legend shows it, and screen readers read it after a field's name. */\n readonly label?: string;\n /**\n * The color its fields show in: a CSS color, so it can name a variable of\n * the app's (`'var(--signer-1)'`). Left out, the group gets one of eight\n * colors by its place in the list.\n */\n readonly color?: string;\n}\n\n/** Which fields people may fill in by hand: all, none, or those of these kinds. */\nexport type FillableFields = boolean | readonly FormFieldKind[];\n\n/** What the form settings are when the app registers none. */\nexport const FORM_DEFAULTS: FormSettings = {\n validation: 'scripts',\n focus: { color: null },\n fields: { border: null, background: 'rgb(255 255 255 / 0.92)', color: '#1f2a44', tint: 0.16 },\n fillable: true,\n};\n\n/** What `formPlugin(config)` takes: any of the settings, merged over the defaults. */\nexport type FormConfig = DeepPartial<FormSettings>;\n\n// ── what the verbs take and give ──────────────────────────────────────────\n\n/** Which fields `list()` returns: all of them, or those that match every given part. */\nexport interface FormFilter {\n readonly kind?: FormFieldKind;\n /** Fields with a box on this page: its ref or its index. */\n readonly page?: PageRef | number;\n /** One full name, such as `'billing.name'`. */\n readonly name?: string;\n}\n\n/**\n * What a value write did: `'applied'`, `'unchanged'` (the field already held\n * it), or `'rejected'` when the form's own validation refused the value.\n */\nexport type FormSetValueStatus = 'applied' | 'unchanged' | 'rejected';\n\n/** What `setValue()` resolves: the field as it is now, and what the write did. */\nexport interface FormSetValueResult {\n readonly field: FormField;\n readonly status: FormSetValueStatus;\n}\n\n/**\n * A field's value as plain data, for your own backend: a text box's,\n * dropdown's or radio group's text (`null` when empty), a checkbox's\n * `true`/`false`, a list's selected values.\n */\nexport type FormPlainValue = string | boolean | readonly string[] | null;\n\n/** What `validate()` returns: whether every required field you fill in has a value, and the ones that don't. */\nexport interface FormValidation {\n readonly valid: boolean;\n /**\n * The required fields you may fill in that are empty, in page order (page,\n * then top to bottom, then left to right).\n */\n readonly missing: readonly FormField[];\n}\n\n/** What `reset()` resolves: the fields it changed, as they are now. */\nexport interface FormResetResult {\n readonly fields: readonly FormField[];\n}\n\n/** A field setting that is on or off. */\nexport type FormFieldFlagSetting =\n | 'required'\n | 'readOnly'\n | 'noExport'\n | 'multiline'\n | 'password'\n | 'comb'\n | 'radiosInUnison'\n | 'noToggleToOff'\n | 'edit'\n | 'multiSelect';\n\n/**\n * One setting of a field, as a settings panel draws it: `key` names it in\n * `update()`'s patch, and `control` says how it is edited. `text`: a line of\n * text. `flag`: on or off. `number`: a whole number from `min`, or none\n * (`null`). `choice`: one of `options`, or any text when `free`. `choices`:\n * any of `options`. `options`: the field's options, each a label and a value.\n * `options` of a `choice` or `choices` are the field's own values, the\n * document's words, shown as they are. The `groupId` setting's are the ids of\n * the groups the user may put the field in: show each with its group's label\n * (`listGroups()`), and none of them (`null`) takes the field out of its\n * group. A field has it only while the document has groups.\n *\n * `label` is the English name and `labelKey` its translation key\n * (`form.settings.tooltip`): a panel shows `t(setting.labelKey, { fallback:\n * setting.label })`, as the annotation kinds' style properties read.\n */\nexport type FormFieldSetting =\n | {\n readonly key: 'name' | 'alternateName';\n readonly control: 'text';\n readonly label: string;\n readonly labelKey: string;\n }\n | {\n readonly key: FormFieldFlagSetting;\n readonly control: 'flag';\n readonly label: string;\n readonly labelKey: string;\n }\n | {\n readonly key: 'maxLength';\n readonly control: 'number';\n readonly label: string;\n readonly labelKey: string;\n readonly min: number;\n }\n | {\n readonly key: 'defaultValue';\n readonly control: 'text';\n readonly label: string;\n readonly labelKey: string;\n }\n | {\n readonly key: 'defaultValue';\n readonly control: 'choice';\n readonly label: string;\n readonly labelKey: string;\n readonly options: readonly string[];\n readonly free: boolean;\n }\n | {\n readonly key: 'groupId';\n readonly control: 'choice';\n readonly label: string;\n readonly labelKey: string;\n readonly options: readonly string[];\n readonly free: false;\n }\n | {\n readonly key: 'defaultValue';\n readonly control: 'choices';\n readonly label: string;\n readonly labelKey: string;\n readonly options: readonly string[];\n }\n | {\n readonly key: 'options';\n readonly control: 'options';\n readonly label: string;\n readonly labelKey: string;\n };\n\n/**\n * What a settings panel shows for one field: its settings in display order,\n * and each one's value by key. `name` is the field's own part of its dotted\n * name, what `update({ name })` replaces.\n */\nexport interface FormFieldSettings {\n readonly properties: readonly FormFieldSetting[];\n readonly values: Readonly<Record<string, unknown>>;\n}\n\n/** What `moveToGroup()` resolves: the fields as they are now, in the order given. */\nexport interface FormGroupMoveResult {\n readonly fields: readonly FormField[];\n}\n\n/** What `create()`, `update()` and `removeWidget()` resolve: the field as it is now. */\nexport interface FormFieldResult {\n readonly field: FormField;\n}\n\n/** What `addWidget()` resolves: the field as it is now, and its new widget. */\nexport interface FormWidgetAddResult {\n readonly field: FormField;\n readonly widget: WidgetAnnotation;\n}\n\n/** How `duplicate()` and `duplicateWidgets()` copy. */\nexport interface FormDuplicateOptions {\n /** The page the copied widgets go on, as a ref or an index. Left out: each on its own page. */\n readonly page?: PageRef | number;\n /** How far each copied widget moves, in page points: `x` to the right, `y` down. */\n readonly offset?: { readonly x: number; readonly y: number };\n /** Whether a new field gets its original's value. Default `false`: it starts empty. */\n readonly values?: boolean;\n}\n\n/** What `duplicate()` and `duplicateWidgets()` resolve. */\nexport interface FormDuplicateResult {\n /** The fields that were made, and each field that got a new button, as they are now. */\n readonly fields: readonly FormField[];\n /** The new widgets. For `duplicateWidgets()`, in the order their originals were given. */\n readonly widgets: readonly WidgetAnnotation[];\n /** What was left out, and why. */\n readonly dropped: readonly FormImportDrop[];\n}\n\n/** Which fields `export()` takes, each whole. Without either, every field. */\nexport interface FormExportSelection {\n readonly fields?: readonly FormFieldRef[];\n /** Every field with a widget on these pages, as refs or indexes. */\n readonly pages?: readonly (PageRef | number)[];\n}\n\n/** What `import()` did: the new fields, where each bundle field went, and what was left out. */\nexport interface FormImportResult {\n /** The new fields, in bundle order. */\n readonly fields: readonly FormField[];\n /** Each imported field's ref in the bundle, and its new ref here. */\n readonly refMap: ReadonlyArray<{ readonly from: FormFieldRef; readonly to: FormFieldRef }>;\n /** What was left out, and why, in bundle order. */\n readonly dropped: readonly FormImportDrop[];\n}\n\n/**\n * A widget: its annotation ref, or a widget as a field or a signature names\n * it (`FormWidget`). Never a field: a field can show in several places, and\n * `getWidgets(ref)` gives them all.\n */\nexport type WidgetAddress = AnnotationRef | FormWidget;\n\n/** What one widget activation did: the form's own scripts ran, or the widget's action did. */\nexport type WidgetActivationResult =\n | { status: 'form'; result: FormCommitResult }\n | { status: 'dispatched'; result: ActionTriggerResult };\n\n/** How a write through the document's scripts ended. */\nexport type FormCommitStatus = 'applied' | 'unchanged' | 'rejected' | 'failed';\n\n/** A write through the document's keystroke, validate, calculate and format scripts, and what they asked for. */\nexport interface FormCommitResult {\n readonly status: FormCommitStatus;\n readonly scripted: boolean;\n readonly uiEffects: FormUiEffect[];\n readonly diagnostics: ScriptDiagnostic[];\n readonly error?: ScriptExecutionError;\n}\n\n/**\n * One request a document script made of the UI, such as an alert. `phase`\n * says who asked: `'boot'`, a script that runs when the document opens (many\n * PDF producers add a version check here that apps usually hide), or\n * `'user'`, a script a person's own action ran (a validation alert: show it).\n */\nexport type FormUiEffect = ScriptUiEffect & {\n phase: 'boot' | 'user';\n /**\n * What started the action the script ran in, when it ran in one: a page's\n * or the document's open action is not an open script, so the two are told\n * apart here and in `phase`.\n */\n origin?: ActionOrigin;\n};\n\n/** How `focus()` puts the cursor in a field. */\nexport interface FormFocusOptions {\n /** Which of the field's boxes: a radio button, or a field shown on several pages. Default: the first in Tab's order (a radio group's checked button). */\n widget?: WidgetAddress;\n /** Select a text box's text, so typing replaces it. */\n select?: boolean;\n}\n\n/** Where `focusNext()` moves the cursor. */\nexport interface FormFocusNextOptions {\n /** The field it goes on from. Default: the field the cursor is in, or was in last; with none, the start of the form. */\n from?: FormFieldRef;\n /** The field before, as Shift+Tab goes. */\n backward?: boolean;\n /** Only a field that is still empty. */\n empty?: boolean;\n /** Past the last field, start over at the first (the last, going backward). */\n wrap?: boolean;\n}\n\n// ── events ────────────────────────────────────────────────────────────────\n\n/** A field's value changed, whoever changed it: you, the form's scripts, or another session. */\nexport interface FormValueChangedEvent {\n readonly field: FormField;\n readonly origin: EventOrigin;\n}\n/** A field was added. */\nexport interface FormFieldCreatedEvent {\n readonly field: FormField;\n readonly origin: EventOrigin;\n}\n/** A field's settings or boxes changed. */\nexport interface FormFieldUpdatedEvent {\n readonly field: FormField;\n readonly origin: EventOrigin;\n}\n/** A field was removed, with every box it had. */\nexport interface FormFieldDeletedEvent {\n readonly ref: FormFieldRef;\n readonly origin: EventOrigin;\n}\n/** The form's own validation refused a value: the field kept the one it had. */\nexport interface FormValidationRejectedEvent {\n readonly field: FormField;\n readonly issues: readonly ScriptDiagnostic[];\n}\n/** Where UI attaches to one box of a field: its page and where the box stands on it (page space). */\nexport interface FormWidgetAnchor {\n readonly page: PageRef;\n readonly bounds: Box;\n}\n/** The cursor moved into a field, to another one, or out of the fields (`field` is then `null`). */\nexport interface FormFocusChangedEvent {\n readonly field: FormField | null;\n /** The box the cursor is in. */\n readonly widget: AnnotationRef | null;\n}\n/** The group that fields placed with a tool go in changed (`groupId` is `null` when it names none). */\nexport interface FormDesignGroupChangedEvent {\n readonly groupId: string | null;\n}\n/** `setGroups()` changed who the document's groups are: the groups as `listGroups()` gives them now. */\nexport interface FormGroupsChangedEvent {\n readonly groups: readonly FormGroup[];\n}\n/** The whole form was read. */\nexport interface FormResyncedEvent {\n readonly snapshot: FormSnapshot;\n}\n\n// ── the capability ────────────────────────────────────────────────────────\n\n/**\n * The form plugin's public capability: the document's fields, filling them\n * in, moving form data in and out, and building the form. Widgets stay\n * annotations; this owns the fields and their values. Its settings belong to\n * the plugin, not to a document: a change reaches every open document.\n */\nexport interface FormCapability extends SettingsApi<FormSettings> {\n // ── reading ──\n /** Everything at once, as the engine's `list()` returns it. The same object until something changes; `null` before the first read. */\n getSnapshot(): FormSnapshot | null;\n /** Whether the form is read. */\n getStatus(): ResourceStatus;\n /** What the document has: `'none'`, `'acroform'` or `'xfa'`. */\n getFormKind(): FormKind;\n /** Every field, or the fields that match `filter`. Without a filter, the same array while nothing changes. */\n list(filter?: FormFilter): readonly FormField[];\n /** One field, or `null` when the form has no such field. */\n get(ref: FormFieldRef): FormField | null;\n /** The field a widget belongs to, or `null`. */\n getFieldForWidget(widget: WidgetAddress): FormField | null;\n /**\n * A widget's row: where it is (`page`, `rect`), how it looks and its state,\n * or `null` when no page shows it. A field's `widgets` name them.\n */\n getWidget(widget: WidgetAddress): WidgetAnnotation | null;\n /**\n * Every place a field shows: its widgets' rows, in the field's order (a\n * radio group's buttons in order). Widgets no page shows are left out, and\n * a field the form doesn't have has none. The same array while they stay\n * the same.\n */\n getWidgets(ref: FormFieldRef): readonly WidgetAnnotation[];\n /** One field's value in the shape `setValue()` takes, or `null` for a field without one. */\n getValue(ref: FormFieldRef): FormFieldValue | null;\n /**\n * Each widget on a page (its ref or its index), with its place, its look,\n * its control, its value and whether it can be filled: for drawing the\n * fields yourself. Its place is its frame (`box`), its quarter turn\n * (`rotation`) and the rect it stands in (`rect`): a control goes in the\n * frame, turned about its middle. The same array while nothing changes;\n * empty for a page that isn't in the document.\n */\n listWidgets(page: PageRef | number): readonly FormWidgetItem[];\n /** The widget under a point on a page, with its field and its place, or `null`. */\n getWidgetAt(page: PageRef | number, point: { x: number; y: number }): WidgetHit | null;\n /**\n * The field whose widgets are selected (in design mode): one widget, or several of the same\n * field, such as a radio group's buttons. `null` otherwise.\n */\n getSelectedField(): FormField | null;\n /**\n * Every field with a selected widget (in design mode), in the selection's order, each once.\n * The same array while nothing changes.\n */\n listSelectedFields(): readonly FormField[];\n /** The field the cursor is in, or `null`. */\n getFocusedField(): FormField | null;\n /**\n * The document's groups: the ones `setGroups()` named, in that order, then\n * the other groups the form's fields are in. Each has its label (`null`\n * where the app gave none) and the color its fields show in: the app's,\n * else one of eight by the group's place in this list. The same array\n * while nothing changes.\n */\n listGroups(): readonly FormGroup[];\n /**\n * The group that fields placed with a tool go in (in design mode), or\n * `null`, where it starts, when it names none.\n */\n getDesignGroup(): string | null;\n /**\n * A field's settings, described for a settings panel, which writes them\n * with `update()`; `null` for a field the form doesn't have. Every setting\n * `update()` takes but scripts and `mappingName`.\n */\n getFieldSettings(field: FormFieldRef): FormFieldSettings | null;\n /**\n * Check the required fields you may fill in: `missing` lists the empty ones\n * in page order. Another signer's fields are theirs to fill.\n */\n validate(): FormValidation;\n /** Every value, keyed by full name, as plain data. Fields without a value are left out. */\n exportValues(): Readonly<Record<string, FormPlainValue>>;\n\n // ── filling ──\n /**\n * Put the cursor in a field: bring its box into view, on whatever page it is, and focus its\n * control, at once when its page is on screen, else as soon as the page comes in. `false` for a\n * field the user can't fill in, a box that doesn't show, or one off screen with no Stage to bring\n * it in.\n */\n focus(ref: FormFieldRef, options?: FormFocusOptions): boolean;\n /**\n * Move the cursor to the next field, as Tab does: in the document's order, from page to page,\n * skipping the fields the user can't fill in, a radio group being one stop. `false` when there's\n * no such field: Tab then leaves the form.\n */\n focusNext(options?: FormFocusNextOptions): boolean;\n /**\n * Fill in a field with `{ value }`, `{ checked }` or `{ selectedValues }`,\n * running the form's checks and scripts when the `validation` setting says\n * so. Fires `onValueChanged`, or `onValidationRejected` when the form\n * refuses the value. Rejects `permission-denied` for a field you may not\n * fill in (`canFill`), `not-found`, `invalid-input` for a value the field\n * can't take, `operation-cancelled`.\n */\n setValue(\n ref: FormFieldRef,\n value: FormFieldValue,\n options?: OperationOptions,\n ): Promise<FormSetValueResult>;\n /**\n * Fill in several fields, in order; one that fails, such as a field you may\n * not fill in, doesn't stop the rest.\n */\n setValues(\n entries: readonly { readonly ref: FormFieldRef; readonly value: FormFieldValue }[],\n options?: OperationOptions,\n ): Promise<BatchResult<FormFieldRef, FormFieldRef>>;\n /**\n * Fill in fields by full name from plain values (as `exportValues()` gives\n * them). A name the form doesn't have, a field you may not fill in, or a\n * value its field can't take, is skipped; the rest still land.\n */\n importValues(\n values: Readonly<Record<string, FormPlainValue>>,\n options?: OperationOptions,\n ): Promise<BatchResult<FormFieldRef, string>>;\n /**\n * Put back each field's default, for the fields you pass, or every field\n * you may fill in, then run the form's calculations. Fires\n * `onValueChanged` per changed field. Rejects `permission-denied` when you\n * pass a field you may not fill in.\n */\n reset(refs?: readonly FormFieldRef[], options?: OperationOptions): Promise<FormResetResult>;\n /** Do what a click on a widget does, such as running a button's action. Rejects `not-found` for a widget of no field. */\n activateWidget(\n widget: AnnotationRef,\n options?: OperationOptions,\n ): Promise<WidgetActivationResult>;\n\n // ── moving fields ──\n /**\n * Take fields out as a bundle: each whole, with its widgets, value,\n * scripts and actions. Every field, the ones named, or the ones on some\n * pages. Waits for pending writes first. Rejects `permission-denied`\n * without `doc.forms.read` or `doc.download`.\n */\n export(selection?: FormExportSelection, options?: OperationOptions): Promise<FormBundle>;\n /**\n * Copy a bundle's fields into this document, as one change and one step to\n * undo: their widgets on the same pages (or `options.pages`), their values,\n * and their place in the calculation order. `history: false` keeps it out\n * of undo and redo, for what your app adds by itself. A field whose name is\n * taken is left out, as are scripts, submits and links without\n * `doc.forms.script`. Fires `onFieldCreated` per field. Rejects\n * `permission-denied` without `doc.forms.modify` (and, for the default\n * `attribution: 'restore'`, `doc.forms.import`).\n */\n import(\n bundle: FormBundle,\n options?: FormImportOptions & OperationOptions & HistoryOptions,\n ): Promise<FormImportResult>;\n /** Read the whole form again; fires `onResynced`. */\n refresh(options?: OperationOptions): Promise<void>;\n\n // ── building ──\n /**\n * Add a field with a widget for each place it shows, with every setting the\n * engine takes. Fires `onFieldCreated`. Rejects `permission-denied` without\n * `doc.forms.modify`, or without `doc.forms.script` when the field or a\n * widget gets a script, a submit or a link; `invalid-input` (a name that's\n * taken, a radio button without its export value).\n */\n create(draft: FormFieldDraft, options?: OperationOptions): Promise<FormFieldResult>;\n /**\n * Show a field in one more place: a new widget, placed and styled as `create()`'s\n * `widgets` take them, every part optional. It looks like the field's last widget unless\n * you say otherwise. A radio group's new button gets the next free `Choice<n>` as its\n * value, and a checkbox's new box the field's own, so the boxes check together. Without a\n * `rect` it goes next in line after the field's widgets on the page (`page`, else the last\n * widget's): below them while they stand in a column, beside them while they stand in a\n * row, the same size and the same step; where that leaves the page, a new column (or row)\n * beside them. Fires `onFieldUpdated`. Rejects `permission-denied` without\n * `doc.forms.modify`, `not-found` for a field the form doesn't have.\n */\n addWidget(\n ref: FormFieldRef,\n placement?: Partial<WidgetPlacement>,\n options?: OperationOptions,\n ): Promise<FormWidgetAddResult>;\n /**\n * Copy whole fields: each a new field with its original's settings, scripts, default value\n * and widgets, named after it with the next free number (`email` becomes `email_2`). A\n * radio group's copy keeps its buttons' values. A copy has no value unless\n * `options.values` is true, and a signature never comes along. The copies show at once,\n * it is one step to undo, and it resolves the new fields, their widgets and what was left\n * out. Fires `onFieldCreated` for each. Rejects `permission-denied` without\n * `doc.forms.modify`, `not-found` for a field the form doesn't have.\n */\n duplicate(\n fields: readonly FormFieldRef[],\n options?: FormDuplicateOptions & OperationOptions,\n ): Promise<FormDuplicateResult>;\n /**\n * Copy widgets, as Duplicate does in a form designer. A radio button's copy is another\n * button of its group, with the next free `Choice<n>` as its value. Any other widget's\n * copy is a new field, as `duplicate()` makes one, and widgets of one field copied\n * together become one new field. The copies show at once, it is one step to undo, and it\n * resolves the fields made or changed, the new widgets in the order of the widgets given,\n * and what was left out. Rejects `permission-denied` without `doc.forms.modify`,\n * `not-found` for a widget the form doesn't show.\n */\n duplicateWidgets(\n widgets: readonly AnnotationRef[],\n options?: FormDuplicateOptions & OperationOptions,\n ): Promise<FormDuplicateResult>;\n /**\n * Say who this document's groups are, for the people who look at it: the\n * whole list, and an empty one clears it. A field's group is an id in the\n * PDF; its name and its color are the app's, and never written there. The\n * first entry of an id is the group. Fires `onGroupsChanged`; the same\n * list again changes nothing.\n */\n setGroups(groups: readonly FormGroupInput[]): void;\n /**\n * Say who the next fields are for: a field placed with a tool goes into\n * this group. With `null` it names none, and the field is in no group.\n * Fires `onDesignGroupChanged`. Throws\n * `permission-denied` for a group the user may not put a field in\n * (`canSetGroup`).\n */\n setDesignGroup(groupId: string | null): void;\n /**\n * Put fields in a group, or with `null` take them out of theirs, in one\n * step to undo: each field not already there gets it as its `groupId`.\n * Fires `onFieldUpdated` for each, and resolves the fields as they are\n * now, in the order given. Rejects `permission-denied` without\n * `doc.forms.modify` or for a group the user may not put a field in\n * (`canSetGroup`; taking a field out of its group needs no more than\n * `doc.forms.modify`), `not-found` for a field the form doesn't have.\n */\n moveToGroup(\n fields: readonly FormFieldRef[],\n groupId: string | null,\n options?: OperationOptions,\n ): Promise<FormGroupMoveResult>;\n /** Change a field's settings: pass only what changes. Fires `onFieldUpdated`. Rejects like `create()`. */\n update(\n ref: FormFieldRef,\n patch: FormFieldPatch,\n options?: OperationOptions,\n ): Promise<FormFieldResult>;\n /** Remove a field and every widget it has. Fires `onFieldDeleted`. Rejects `permission-denied` without `doc.forms.modify`, `not-found`. */\n delete(ref: FormFieldRef, options?: OperationOptions): Promise<void>;\n /**\n * Take one widget out of a field that shows in several places: it stays on\n * its page, in no field (`deleteWidget()` takes it off the page). Fires\n * `onFieldUpdated`. Rejects `permission-denied` without `doc.forms.modify`.\n */\n removeWidget(\n ref: FormFieldRef,\n widget: AnnotationRef,\n options?: OperationOptions,\n ): Promise<FormFieldResult>;\n /**\n * Change one widget's place or look: pass only what changes. Its field\n * keeps its value and settings. Rejects `permission-denied` without\n * `doc.forms.modify`, `invalid-input` for what the widget doesn't take (a\n * check style on a text field's widget).\n */\n updateWidget(\n widget: AnnotationRef,\n patch: WidgetPatch,\n options?: OperationOptions,\n ): Promise<{ readonly widget: WidgetAnnotation }>;\n /**\n * Delete a widget: it leaves its page, and its field when it has one, and\n * resolves that field as it is now (`null` for a widget in no field). Fires\n * `onFieldUpdated` when it had a field. A field shown in one place is\n * deleted with `delete()`. Rejects `permission-denied` without\n * `doc.forms.modify`.\n */\n deleteWidget(\n widget: AnnotationRef,\n options?: OperationOptions,\n ): Promise<{ readonly field: FormField | null }>;\n /**\n * Change the order the fields' calculate scripts run in: the fields go\n * together, in the order given, to `position`, next to a neighbour or at\n * `'start'` / `'end'`. A field is in the order while it has a calculate\n * script. Resolves the whole new order. Rejects `permission-denied`\n * without `doc.forms.modify`, `not-found` for a field not in the order.\n */\n reorderCalculations(\n fields: FormFieldRef[],\n position: FieldPosition,\n options?: OperationOptions,\n ): Promise<{ readonly calculationOrder: readonly FormFieldRef[] }>;\n /**\n * Fix a form other PDF apps read differently, such as fields missing from\n * the form's list, and resolve what was fixed. Fires `onResynced`. Rejects\n * `permission-denied` without `doc.forms.modify`.\n */\n repair(options?: FormRepairOptions & OperationOptions): Promise<FormRepairResult>;\n\n // ── permissions ──\n /** Whether reading the form is allowed: `doc.forms.read`. */\n canRead(): boolean;\n /**\n * Whether filling in this field is allowed: `doc.forms.fill`, or a\n * `fields:fill` permission for the field's group. `false` for a field the\n * form doesn't have.\n */\n canFill(field: FormFieldRef): boolean;\n /** Whether adding, changing and removing fields is allowed: `doc.forms.modify`. */\n canDesign(): boolean;\n /**\n * Whether the user may put a field in this group, with `create()`,\n * `update()` or a tool: `doc.forms.modify`, and the group is the user's\n * own or one a `fields:set-group` permission names.\n */\n canSetGroup(groupId: string): boolean;\n /**\n * Whether an import may restore who created and filled in the fields it\n * brings, instead of naming the importing user: `doc.forms.import`.\n */\n canRestoreAttribution(): boolean;\n /**\n * Whether scripts, submit buttons and links may be written into fields and\n * their widgets: `doc.forms.script`. Running a form's scripts never needs it.\n */\n canWriteScripts(): boolean;\n\n // ── events ──\n /** A field's value changed, whoever changed it. */\n readonly onValueChanged: EventHook<FormValueChangedEvent>;\n /** A field was added. */\n readonly onFieldCreated: EventHook<FormFieldCreatedEvent>;\n /** A field's settings or widgets changed. */\n readonly onFieldUpdated: EventHook<FormFieldUpdatedEvent>;\n /** A field was removed. */\n readonly onFieldDeleted: EventHook<FormFieldDeletedEvent>;\n /** The form's own validation refused a value. */\n readonly onValidationRejected: EventHook<FormValidationRejectedEvent>;\n /** The whole form was read, as when it opens, after `refresh()` or a repair. */\n readonly onResynced: EventHook<FormResyncedEvent>;\n /** The cursor moved into a field, to another one, or out of the fields. */\n readonly onFocusChanged: EventHook<FormFocusChangedEvent>;\n /** The group that fields placed with a tool go in changed. */\n readonly onDesignGroupChanged: EventHook<FormDesignGroupChangedEvent>;\n /** `setGroups()` changed who the document's groups are. */\n readonly onGroupsChanged: EventHook<FormGroupsChangedEvent>;\n}\n"],"mappings":";;;;;;AAMA,MAAa,aAAA,GAAA,eAAA,sBAAA,CAAkD,QAAQ;CACrE,MAAM;CAGN,UAAU;EACR,UAAU;EACV,WAAW;EACX,cAAc;EACd,OAAO;EACP,gBAAgB;EAChB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,WAAW;EACX,WAAW;EACX,kBAAkB;EAClB,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,cAAc;EACd,cAAc;EACd,cAAc;EACd,qBAAqB;EACrB,QAAQ;CACV;AACF,CAAC;;;;ACoGD,MAAa,gBAA8B;CACzC,YAAY;CACZ,OAAO,EAAE,OAAO,KAAK;CACrB,QAAQ;EAAE,QAAQ;EAAM,YAAY;EAA2B,OAAO;EAAW,MAAM;CAAK;CAC5F,UAAU;AACZ"}
|
|
@@ -20,6 +20,7 @@ const FormToken = createCapabilityToken("form", {
|
|
|
20
20
|
duplicate: true,
|
|
21
21
|
duplicateWidgets: true,
|
|
22
22
|
update: true,
|
|
23
|
+
moveToGroup: true,
|
|
23
24
|
delete: true,
|
|
24
25
|
removeWidget: true,
|
|
25
26
|
updateWidget: true,
|
|
@@ -37,11 +38,12 @@ const FORM_DEFAULTS = {
|
|
|
37
38
|
fields: {
|
|
38
39
|
border: null,
|
|
39
40
|
background: "rgb(255 255 255 / 0.92)",
|
|
40
|
-
color: "#1f2a44"
|
|
41
|
+
color: "#1f2a44",
|
|
42
|
+
tint: .16
|
|
41
43
|
},
|
|
42
44
|
fillable: true
|
|
43
45
|
};
|
|
44
46
|
//#endregion
|
|
45
47
|
export { FormToken as i, FormTransfer as n, toFieldRef$1 as r, FORM_DEFAULTS as t };
|
|
46
48
|
|
|
47
|
-
//# sourceMappingURL=contract-
|
|
49
|
+
//# sourceMappingURL=contract-J_QN_Igp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-J_QN_Igp.js","names":[],"sources":["../src/token.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 { FormCapability } from './contract';\n\nexport const FormToken = createCapabilityToken<FormCapability>('form', {\n hint: `add formPlugin() from '@embedpdf/plugin-form' 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 setValue: true,\n setValues: true,\n importValues: true,\n reset: true,\n activateWidget: true,\n export: true,\n import: true,\n refresh: true,\n create: true,\n addWidget: true,\n duplicate: true,\n duplicateWidgets: true,\n update: true,\n moveToGroup: true,\n delete: true,\n removeWidget: true,\n updateWidget: true,\n deleteWidget: true,\n reorderCalculations: true,\n repair: true,\n },\n});\n","/**\n * @embedpdf/plugin-form/contract: the public form vocabulary. Fields are\n * addressed by `FormFieldRef` (`toFieldRef(name)` for a name you know),\n * widgets by their `AnnotationRef`; the scripting seams are the host lens\n * (`/contract/host`).\n */\nimport type {\n BatchResult,\n DeepPartial,\n EventHook,\n EventOrigin,\n HistoryOptions,\n OperationOptions,\n ResourceStatus,\n SettingsApi,\n} from '@embedpdf/core';\nimport type { ScriptDiagnostic, ScriptExecutionError, ScriptUiEffect } from '@embedpdf/core-acrojs';\nimport type {\n AnnotationRef,\n FieldPosition,\n FormBundle,\n FormFieldDraft,\n FormField,\n FormFieldKind,\n FormFieldPatch,\n FormFieldRef,\n FormFieldValue,\n FormImportDrop,\n FormImportOptions,\n FormKind,\n FormRepairOptions,\n FormRepairResult,\n FormSnapshot,\n FormWidget,\n PageRef,\n WidgetAnnotation,\n WidgetPatch,\n WidgetPlacement,\n} from '@embedpdf/engine-core/runtime';\nimport type { ActionOrigin, ActionTriggerResult } from '@embedpdf/plugin-actions/contract';\n\nimport type { Box, WidgetHit } from './model';\nimport type { FormWidgetItem } from './read/fill-items';\nimport type { FormGroup } from './services/groups';\n\nexport { FormToken } from './token';\nexport { toFieldRef } from '@embedpdf/engine-core/runtime';\nexport { FormTransfer } from '@embedpdf/engine-core/public';\nexport type { FormWidgetItem, FormWidgetLook, GroupPosition } from './read/fill-items';\nexport type { FormGroup } from './services/groups';\nexport type { Box, WidgetHit, WidgetPlace } from './model';\nexport type {\n FormBundle,\n FormFieldDraft,\n FormField,\n FormFieldKind,\n FormFieldPatch,\n FormFieldRef,\n FormFieldValue,\n FormImportDrop,\n FormImportDropReason,\n FormImportOptions,\n FormKind,\n FormRepairOptions,\n FormRepairResult,\n FormSnapshot,\n WidgetAnnotation,\n} from '@embedpdf/engine-core/runtime';\n\n// ── settings ──────────────────────────────────────────────────────────────\n\n/**\n * The form plugin's settings. `formPlugin(config)` registers them over\n * {@link FORM_DEFAULTS}, and `updateSettings()` changes them for every\n * document while the app runs. The colors are what the viewer draws around\n * fields (a field's own colors are in the PDF); each can also come from CSS\n * (`--epdf-form-focus`, `--epdf-form-field-border`,\n * `--epdf-form-field-background`, `--epdf-form-field-color`,\n * `--epdf-form-field-tint`), which wins.\n */\nexport interface FormSettings {\n /**\n * Run the form's own checks, the keystroke, validate, calculate and format\n * scripts, when a value is written (`'scripts'`, which needs JavaScript on\n * in `actionsPlugin({ javascript })`), or accept every value (`'none'`).\n */\n readonly validation: 'scripts' | 'none';\n readonly focus: {\n /** The ring around the field being filled in: a CSS color, or `null` for the viewer's accent. */\n readonly color: string | null;\n };\n readonly fields: {\n /** The edge of a field that has no border of its own: a CSS color, or `null` for the accent at 55%. */\n readonly border: string | null;\n /** Inside a field that has no background of its own, while it's being filled in. */\n readonly background: string;\n /** The text of a field that has no color of its own. */\n readonly color: string;\n /**\n * How strongly a field shows its group's color ({@link FormCapability.listGroups}): from\n * `0`, not at all, to `1`.\n */\n readonly tint: number;\n };\n /**\n * Which fields people may fill in by hand: `true`, every one; `false`,\n * none; or a list of field kinds (`'text'`, `'checkbox'`,\n * `'signature'`…). A field left out draws as a read-only one does, and\n * takes no typing, clicks or picks. Only the interface: your code still\n * fills it in (`setValue()`, `importValues()`), and `canFill()` doesn't change.\n */\n readonly fillable: FillableFields;\n}\n\n/** One of a document's groups, as the app names it with `setGroups()`. */\nexport interface FormGroupInput {\n /** The group: the id its fields carry, and the one the permissions name. */\n readonly id: string;\n /** Who the group is, for people: a legend shows it, and screen readers read it after a field's name. */\n readonly label?: string;\n /**\n * The color its fields show in: a CSS color, so it can name a variable of\n * the app's (`'var(--signer-1)'`). Left out, the group gets one of eight\n * colors by its place in the list.\n */\n readonly color?: string;\n}\n\n/** Which fields people may fill in by hand: all, none, or those of these kinds. */\nexport type FillableFields = boolean | readonly FormFieldKind[];\n\n/** What the form settings are when the app registers none. */\nexport const FORM_DEFAULTS: FormSettings = {\n validation: 'scripts',\n focus: { color: null },\n fields: { border: null, background: 'rgb(255 255 255 / 0.92)', color: '#1f2a44', tint: 0.16 },\n fillable: true,\n};\n\n/** What `formPlugin(config)` takes: any of the settings, merged over the defaults. */\nexport type FormConfig = DeepPartial<FormSettings>;\n\n// ── what the verbs take and give ──────────────────────────────────────────\n\n/** Which fields `list()` returns: all of them, or those that match every given part. */\nexport interface FormFilter {\n readonly kind?: FormFieldKind;\n /** Fields with a box on this page: its ref or its index. */\n readonly page?: PageRef | number;\n /** One full name, such as `'billing.name'`. */\n readonly name?: string;\n}\n\n/**\n * What a value write did: `'applied'`, `'unchanged'` (the field already held\n * it), or `'rejected'` when the form's own validation refused the value.\n */\nexport type FormSetValueStatus = 'applied' | 'unchanged' | 'rejected';\n\n/** What `setValue()` resolves: the field as it is now, and what the write did. */\nexport interface FormSetValueResult {\n readonly field: FormField;\n readonly status: FormSetValueStatus;\n}\n\n/**\n * A field's value as plain data, for your own backend: a text box's,\n * dropdown's or radio group's text (`null` when empty), a checkbox's\n * `true`/`false`, a list's selected values.\n */\nexport type FormPlainValue = string | boolean | readonly string[] | null;\n\n/** What `validate()` returns: whether every required field you fill in has a value, and the ones that don't. */\nexport interface FormValidation {\n readonly valid: boolean;\n /**\n * The required fields you may fill in that are empty, in page order (page,\n * then top to bottom, then left to right).\n */\n readonly missing: readonly FormField[];\n}\n\n/** What `reset()` resolves: the fields it changed, as they are now. */\nexport interface FormResetResult {\n readonly fields: readonly FormField[];\n}\n\n/** A field setting that is on or off. */\nexport type FormFieldFlagSetting =\n | 'required'\n | 'readOnly'\n | 'noExport'\n | 'multiline'\n | 'password'\n | 'comb'\n | 'radiosInUnison'\n | 'noToggleToOff'\n | 'edit'\n | 'multiSelect';\n\n/**\n * One setting of a field, as a settings panel draws it: `key` names it in\n * `update()`'s patch, and `control` says how it is edited. `text`: a line of\n * text. `flag`: on or off. `number`: a whole number from `min`, or none\n * (`null`). `choice`: one of `options`, or any text when `free`. `choices`:\n * any of `options`. `options`: the field's options, each a label and a value.\n * `options` of a `choice` or `choices` are the field's own values, the\n * document's words, shown as they are. The `groupId` setting's are the ids of\n * the groups the user may put the field in: show each with its group's label\n * (`listGroups()`), and none of them (`null`) takes the field out of its\n * group. A field has it only while the document has groups.\n *\n * `label` is the English name and `labelKey` its translation key\n * (`form.settings.tooltip`): a panel shows `t(setting.labelKey, { fallback:\n * setting.label })`, as the annotation kinds' style properties read.\n */\nexport type FormFieldSetting =\n | {\n readonly key: 'name' | 'alternateName';\n readonly control: 'text';\n readonly label: string;\n readonly labelKey: string;\n }\n | {\n readonly key: FormFieldFlagSetting;\n readonly control: 'flag';\n readonly label: string;\n readonly labelKey: string;\n }\n | {\n readonly key: 'maxLength';\n readonly control: 'number';\n readonly label: string;\n readonly labelKey: string;\n readonly min: number;\n }\n | {\n readonly key: 'defaultValue';\n readonly control: 'text';\n readonly label: string;\n readonly labelKey: string;\n }\n | {\n readonly key: 'defaultValue';\n readonly control: 'choice';\n readonly label: string;\n readonly labelKey: string;\n readonly options: readonly string[];\n readonly free: boolean;\n }\n | {\n readonly key: 'groupId';\n readonly control: 'choice';\n readonly label: string;\n readonly labelKey: string;\n readonly options: readonly string[];\n readonly free: false;\n }\n | {\n readonly key: 'defaultValue';\n readonly control: 'choices';\n readonly label: string;\n readonly labelKey: string;\n readonly options: readonly string[];\n }\n | {\n readonly key: 'options';\n readonly control: 'options';\n readonly label: string;\n readonly labelKey: string;\n };\n\n/**\n * What a settings panel shows for one field: its settings in display order,\n * and each one's value by key. `name` is the field's own part of its dotted\n * name, what `update({ name })` replaces.\n */\nexport interface FormFieldSettings {\n readonly properties: readonly FormFieldSetting[];\n readonly values: Readonly<Record<string, unknown>>;\n}\n\n/** What `moveToGroup()` resolves: the fields as they are now, in the order given. */\nexport interface FormGroupMoveResult {\n readonly fields: readonly FormField[];\n}\n\n/** What `create()`, `update()` and `removeWidget()` resolve: the field as it is now. */\nexport interface FormFieldResult {\n readonly field: FormField;\n}\n\n/** What `addWidget()` resolves: the field as it is now, and its new widget. */\nexport interface FormWidgetAddResult {\n readonly field: FormField;\n readonly widget: WidgetAnnotation;\n}\n\n/** How `duplicate()` and `duplicateWidgets()` copy. */\nexport interface FormDuplicateOptions {\n /** The page the copied widgets go on, as a ref or an index. Left out: each on its own page. */\n readonly page?: PageRef | number;\n /** How far each copied widget moves, in page points: `x` to the right, `y` down. */\n readonly offset?: { readonly x: number; readonly y: number };\n /** Whether a new field gets its original's value. Default `false`: it starts empty. */\n readonly values?: boolean;\n}\n\n/** What `duplicate()` and `duplicateWidgets()` resolve. */\nexport interface FormDuplicateResult {\n /** The fields that were made, and each field that got a new button, as they are now. */\n readonly fields: readonly FormField[];\n /** The new widgets. For `duplicateWidgets()`, in the order their originals were given. */\n readonly widgets: readonly WidgetAnnotation[];\n /** What was left out, and why. */\n readonly dropped: readonly FormImportDrop[];\n}\n\n/** Which fields `export()` takes, each whole. Without either, every field. */\nexport interface FormExportSelection {\n readonly fields?: readonly FormFieldRef[];\n /** Every field with a widget on these pages, as refs or indexes. */\n readonly pages?: readonly (PageRef | number)[];\n}\n\n/** What `import()` did: the new fields, where each bundle field went, and what was left out. */\nexport interface FormImportResult {\n /** The new fields, in bundle order. */\n readonly fields: readonly FormField[];\n /** Each imported field's ref in the bundle, and its new ref here. */\n readonly refMap: ReadonlyArray<{ readonly from: FormFieldRef; readonly to: FormFieldRef }>;\n /** What was left out, and why, in bundle order. */\n readonly dropped: readonly FormImportDrop[];\n}\n\n/**\n * A widget: its annotation ref, or a widget as a field or a signature names\n * it (`FormWidget`). Never a field: a field can show in several places, and\n * `getWidgets(ref)` gives them all.\n */\nexport type WidgetAddress = AnnotationRef | FormWidget;\n\n/** What one widget activation did: the form's own scripts ran, or the widget's action did. */\nexport type WidgetActivationResult =\n | { status: 'form'; result: FormCommitResult }\n | { status: 'dispatched'; result: ActionTriggerResult };\n\n/** How a write through the document's scripts ended. */\nexport type FormCommitStatus = 'applied' | 'unchanged' | 'rejected' | 'failed';\n\n/** A write through the document's keystroke, validate, calculate and format scripts, and what they asked for. */\nexport interface FormCommitResult {\n readonly status: FormCommitStatus;\n readonly scripted: boolean;\n readonly uiEffects: FormUiEffect[];\n readonly diagnostics: ScriptDiagnostic[];\n readonly error?: ScriptExecutionError;\n}\n\n/**\n * One request a document script made of the UI, such as an alert. `phase`\n * says who asked: `'boot'`, a script that runs when the document opens (many\n * PDF producers add a version check here that apps usually hide), or\n * `'user'`, a script a person's own action ran (a validation alert: show it).\n */\nexport type FormUiEffect = ScriptUiEffect & {\n phase: 'boot' | 'user';\n /**\n * What started the action the script ran in, when it ran in one: a page's\n * or the document's open action is not an open script, so the two are told\n * apart here and in `phase`.\n */\n origin?: ActionOrigin;\n};\n\n/** How `focus()` puts the cursor in a field. */\nexport interface FormFocusOptions {\n /** Which of the field's boxes: a radio button, or a field shown on several pages. Default: the first in Tab's order (a radio group's checked button). */\n widget?: WidgetAddress;\n /** Select a text box's text, so typing replaces it. */\n select?: boolean;\n}\n\n/** Where `focusNext()` moves the cursor. */\nexport interface FormFocusNextOptions {\n /** The field it goes on from. Default: the field the cursor is in, or was in last; with none, the start of the form. */\n from?: FormFieldRef;\n /** The field before, as Shift+Tab goes. */\n backward?: boolean;\n /** Only a field that is still empty. */\n empty?: boolean;\n /** Past the last field, start over at the first (the last, going backward). */\n wrap?: boolean;\n}\n\n// ── events ────────────────────────────────────────────────────────────────\n\n/** A field's value changed, whoever changed it: you, the form's scripts, or another session. */\nexport interface FormValueChangedEvent {\n readonly field: FormField;\n readonly origin: EventOrigin;\n}\n/** A field was added. */\nexport interface FormFieldCreatedEvent {\n readonly field: FormField;\n readonly origin: EventOrigin;\n}\n/** A field's settings or boxes changed. */\nexport interface FormFieldUpdatedEvent {\n readonly field: FormField;\n readonly origin: EventOrigin;\n}\n/** A field was removed, with every box it had. */\nexport interface FormFieldDeletedEvent {\n readonly ref: FormFieldRef;\n readonly origin: EventOrigin;\n}\n/** The form's own validation refused a value: the field kept the one it had. */\nexport interface FormValidationRejectedEvent {\n readonly field: FormField;\n readonly issues: readonly ScriptDiagnostic[];\n}\n/** Where UI attaches to one box of a field: its page and where the box stands on it (page space). */\nexport interface FormWidgetAnchor {\n readonly page: PageRef;\n readonly bounds: Box;\n}\n/** The cursor moved into a field, to another one, or out of the fields (`field` is then `null`). */\nexport interface FormFocusChangedEvent {\n readonly field: FormField | null;\n /** The box the cursor is in. */\n readonly widget: AnnotationRef | null;\n}\n/** The group that fields placed with a tool go in changed (`groupId` is `null` when it names none). */\nexport interface FormDesignGroupChangedEvent {\n readonly groupId: string | null;\n}\n/** `setGroups()` changed who the document's groups are: the groups as `listGroups()` gives them now. */\nexport interface FormGroupsChangedEvent {\n readonly groups: readonly FormGroup[];\n}\n/** The whole form was read. */\nexport interface FormResyncedEvent {\n readonly snapshot: FormSnapshot;\n}\n\n// ── the capability ────────────────────────────────────────────────────────\n\n/**\n * The form plugin's public capability: the document's fields, filling them\n * in, moving form data in and out, and building the form. Widgets stay\n * annotations; this owns the fields and their values. Its settings belong to\n * the plugin, not to a document: a change reaches every open document.\n */\nexport interface FormCapability extends SettingsApi<FormSettings> {\n // ── reading ──\n /** Everything at once, as the engine's `list()` returns it. The same object until something changes; `null` before the first read. */\n getSnapshot(): FormSnapshot | null;\n /** Whether the form is read. */\n getStatus(): ResourceStatus;\n /** What the document has: `'none'`, `'acroform'` or `'xfa'`. */\n getFormKind(): FormKind;\n /** Every field, or the fields that match `filter`. Without a filter, the same array while nothing changes. */\n list(filter?: FormFilter): readonly FormField[];\n /** One field, or `null` when the form has no such field. */\n get(ref: FormFieldRef): FormField | null;\n /** The field a widget belongs to, or `null`. */\n getFieldForWidget(widget: WidgetAddress): FormField | null;\n /**\n * A widget's row: where it is (`page`, `rect`), how it looks and its state,\n * or `null` when no page shows it. A field's `widgets` name them.\n */\n getWidget(widget: WidgetAddress): WidgetAnnotation | null;\n /**\n * Every place a field shows: its widgets' rows, in the field's order (a\n * radio group's buttons in order). Widgets no page shows are left out, and\n * a field the form doesn't have has none. The same array while they stay\n * the same.\n */\n getWidgets(ref: FormFieldRef): readonly WidgetAnnotation[];\n /** One field's value in the shape `setValue()` takes, or `null` for a field without one. */\n getValue(ref: FormFieldRef): FormFieldValue | null;\n /**\n * Each widget on a page (its ref or its index), with its place, its look,\n * its control, its value and whether it can be filled: for drawing the\n * fields yourself. Its place is its frame (`box`), its quarter turn\n * (`rotation`) and the rect it stands in (`rect`): a control goes in the\n * frame, turned about its middle. The same array while nothing changes;\n * empty for a page that isn't in the document.\n */\n listWidgets(page: PageRef | number): readonly FormWidgetItem[];\n /** The widget under a point on a page, with its field and its place, or `null`. */\n getWidgetAt(page: PageRef | number, point: { x: number; y: number }): WidgetHit | null;\n /**\n * The field whose widgets are selected (in design mode): one widget, or several of the same\n * field, such as a radio group's buttons. `null` otherwise.\n */\n getSelectedField(): FormField | null;\n /**\n * Every field with a selected widget (in design mode), in the selection's order, each once.\n * The same array while nothing changes.\n */\n listSelectedFields(): readonly FormField[];\n /** The field the cursor is in, or `null`. */\n getFocusedField(): FormField | null;\n /**\n * The document's groups: the ones `setGroups()` named, in that order, then\n * the other groups the form's fields are in. Each has its label (`null`\n * where the app gave none) and the color its fields show in: the app's,\n * else one of eight by the group's place in this list. The same array\n * while nothing changes.\n */\n listGroups(): readonly FormGroup[];\n /**\n * The group that fields placed with a tool go in (in design mode), or\n * `null`, where it starts, when it names none.\n */\n getDesignGroup(): string | null;\n /**\n * A field's settings, described for a settings panel, which writes them\n * with `update()`; `null` for a field the form doesn't have. Every setting\n * `update()` takes but scripts and `mappingName`.\n */\n getFieldSettings(field: FormFieldRef): FormFieldSettings | null;\n /**\n * Check the required fields you may fill in: `missing` lists the empty ones\n * in page order. Another signer's fields are theirs to fill.\n */\n validate(): FormValidation;\n /** Every value, keyed by full name, as plain data. Fields without a value are left out. */\n exportValues(): Readonly<Record<string, FormPlainValue>>;\n\n // ── filling ──\n /**\n * Put the cursor in a field: bring its box into view, on whatever page it is, and focus its\n * control, at once when its page is on screen, else as soon as the page comes in. `false` for a\n * field the user can't fill in, a box that doesn't show, or one off screen with no Stage to bring\n * it in.\n */\n focus(ref: FormFieldRef, options?: FormFocusOptions): boolean;\n /**\n * Move the cursor to the next field, as Tab does: in the document's order, from page to page,\n * skipping the fields the user can't fill in, a radio group being one stop. `false` when there's\n * no such field: Tab then leaves the form.\n */\n focusNext(options?: FormFocusNextOptions): boolean;\n /**\n * Fill in a field with `{ value }`, `{ checked }` or `{ selectedValues }`,\n * running the form's checks and scripts when the `validation` setting says\n * so. Fires `onValueChanged`, or `onValidationRejected` when the form\n * refuses the value. Rejects `permission-denied` for a field you may not\n * fill in (`canFill`), `not-found`, `invalid-input` for a value the field\n * can't take, `operation-cancelled`.\n */\n setValue(\n ref: FormFieldRef,\n value: FormFieldValue,\n options?: OperationOptions,\n ): Promise<FormSetValueResult>;\n /**\n * Fill in several fields, in order; one that fails, such as a field you may\n * not fill in, doesn't stop the rest.\n */\n setValues(\n entries: readonly { readonly ref: FormFieldRef; readonly value: FormFieldValue }[],\n options?: OperationOptions,\n ): Promise<BatchResult<FormFieldRef, FormFieldRef>>;\n /**\n * Fill in fields by full name from plain values (as `exportValues()` gives\n * them). A name the form doesn't have, a field you may not fill in, or a\n * value its field can't take, is skipped; the rest still land.\n */\n importValues(\n values: Readonly<Record<string, FormPlainValue>>,\n options?: OperationOptions,\n ): Promise<BatchResult<FormFieldRef, string>>;\n /**\n * Put back each field's default, for the fields you pass, or every field\n * you may fill in, then run the form's calculations. Fires\n * `onValueChanged` per changed field. Rejects `permission-denied` when you\n * pass a field you may not fill in.\n */\n reset(refs?: readonly FormFieldRef[], options?: OperationOptions): Promise<FormResetResult>;\n /** Do what a click on a widget does, such as running a button's action. Rejects `not-found` for a widget of no field. */\n activateWidget(\n widget: AnnotationRef,\n options?: OperationOptions,\n ): Promise<WidgetActivationResult>;\n\n // ── moving fields ──\n /**\n * Take fields out as a bundle: each whole, with its widgets, value,\n * scripts and actions. Every field, the ones named, or the ones on some\n * pages. Waits for pending writes first. Rejects `permission-denied`\n * without `doc.forms.read` or `doc.download`.\n */\n export(selection?: FormExportSelection, options?: OperationOptions): Promise<FormBundle>;\n /**\n * Copy a bundle's fields into this document, as one change and one step to\n * undo: their widgets on the same pages (or `options.pages`), their values,\n * and their place in the calculation order. `history: false` keeps it out\n * of undo and redo, for what your app adds by itself. A field whose name is\n * taken is left out, as are scripts, submits and links without\n * `doc.forms.script`. Fires `onFieldCreated` per field. Rejects\n * `permission-denied` without `doc.forms.modify` (and, for the default\n * `attribution: 'restore'`, `doc.forms.import`).\n */\n import(\n bundle: FormBundle,\n options?: FormImportOptions & OperationOptions & HistoryOptions,\n ): Promise<FormImportResult>;\n /** Read the whole form again; fires `onResynced`. */\n refresh(options?: OperationOptions): Promise<void>;\n\n // ── building ──\n /**\n * Add a field with a widget for each place it shows, with every setting the\n * engine takes. Fires `onFieldCreated`. Rejects `permission-denied` without\n * `doc.forms.modify`, or without `doc.forms.script` when the field or a\n * widget gets a script, a submit or a link; `invalid-input` (a name that's\n * taken, a radio button without its export value).\n */\n create(draft: FormFieldDraft, options?: OperationOptions): Promise<FormFieldResult>;\n /**\n * Show a field in one more place: a new widget, placed and styled as `create()`'s\n * `widgets` take them, every part optional. It looks like the field's last widget unless\n * you say otherwise. A radio group's new button gets the next free `Choice<n>` as its\n * value, and a checkbox's new box the field's own, so the boxes check together. Without a\n * `rect` it goes next in line after the field's widgets on the page (`page`, else the last\n * widget's): below them while they stand in a column, beside them while they stand in a\n * row, the same size and the same step; where that leaves the page, a new column (or row)\n * beside them. Fires `onFieldUpdated`. Rejects `permission-denied` without\n * `doc.forms.modify`, `not-found` for a field the form doesn't have.\n */\n addWidget(\n ref: FormFieldRef,\n placement?: Partial<WidgetPlacement>,\n options?: OperationOptions,\n ): Promise<FormWidgetAddResult>;\n /**\n * Copy whole fields: each a new field with its original's settings, scripts, default value\n * and widgets, named after it with the next free number (`email` becomes `email_2`). A\n * radio group's copy keeps its buttons' values. A copy has no value unless\n * `options.values` is true, and a signature never comes along. The copies show at once,\n * it is one step to undo, and it resolves the new fields, their widgets and what was left\n * out. Fires `onFieldCreated` for each. Rejects `permission-denied` without\n * `doc.forms.modify`, `not-found` for a field the form doesn't have.\n */\n duplicate(\n fields: readonly FormFieldRef[],\n options?: FormDuplicateOptions & OperationOptions,\n ): Promise<FormDuplicateResult>;\n /**\n * Copy widgets, as Duplicate does in a form designer. A radio button's copy is another\n * button of its group, with the next free `Choice<n>` as its value. Any other widget's\n * copy is a new field, as `duplicate()` makes one, and widgets of one field copied\n * together become one new field. The copies show at once, it is one step to undo, and it\n * resolves the fields made or changed, the new widgets in the order of the widgets given,\n * and what was left out. Rejects `permission-denied` without `doc.forms.modify`,\n * `not-found` for a widget the form doesn't show.\n */\n duplicateWidgets(\n widgets: readonly AnnotationRef[],\n options?: FormDuplicateOptions & OperationOptions,\n ): Promise<FormDuplicateResult>;\n /**\n * Say who this document's groups are, for the people who look at it: the\n * whole list, and an empty one clears it. A field's group is an id in the\n * PDF; its name and its color are the app's, and never written there. The\n * first entry of an id is the group. Fires `onGroupsChanged`; the same\n * list again changes nothing.\n */\n setGroups(groups: readonly FormGroupInput[]): void;\n /**\n * Say who the next fields are for: a field placed with a tool goes into\n * this group. With `null` it names none, and the field is in no group.\n * Fires `onDesignGroupChanged`. Throws\n * `permission-denied` for a group the user may not put a field in\n * (`canSetGroup`).\n */\n setDesignGroup(groupId: string | null): void;\n /**\n * Put fields in a group, or with `null` take them out of theirs, in one\n * step to undo: each field not already there gets it as its `groupId`.\n * Fires `onFieldUpdated` for each, and resolves the fields as they are\n * now, in the order given. Rejects `permission-denied` without\n * `doc.forms.modify` or for a group the user may not put a field in\n * (`canSetGroup`; taking a field out of its group needs no more than\n * `doc.forms.modify`), `not-found` for a field the form doesn't have.\n */\n moveToGroup(\n fields: readonly FormFieldRef[],\n groupId: string | null,\n options?: OperationOptions,\n ): Promise<FormGroupMoveResult>;\n /** Change a field's settings: pass only what changes. Fires `onFieldUpdated`. Rejects like `create()`. */\n update(\n ref: FormFieldRef,\n patch: FormFieldPatch,\n options?: OperationOptions,\n ): Promise<FormFieldResult>;\n /** Remove a field and every widget it has. Fires `onFieldDeleted`. Rejects `permission-denied` without `doc.forms.modify`, `not-found`. */\n delete(ref: FormFieldRef, options?: OperationOptions): Promise<void>;\n /**\n * Take one widget out of a field that shows in several places: it stays on\n * its page, in no field (`deleteWidget()` takes it off the page). Fires\n * `onFieldUpdated`. Rejects `permission-denied` without `doc.forms.modify`.\n */\n removeWidget(\n ref: FormFieldRef,\n widget: AnnotationRef,\n options?: OperationOptions,\n ): Promise<FormFieldResult>;\n /**\n * Change one widget's place or look: pass only what changes. Its field\n * keeps its value and settings. Rejects `permission-denied` without\n * `doc.forms.modify`, `invalid-input` for what the widget doesn't take (a\n * check style on a text field's widget).\n */\n updateWidget(\n widget: AnnotationRef,\n patch: WidgetPatch,\n options?: OperationOptions,\n ): Promise<{ readonly widget: WidgetAnnotation }>;\n /**\n * Delete a widget: it leaves its page, and its field when it has one, and\n * resolves that field as it is now (`null` for a widget in no field). Fires\n * `onFieldUpdated` when it had a field. A field shown in one place is\n * deleted with `delete()`. Rejects `permission-denied` without\n * `doc.forms.modify`.\n */\n deleteWidget(\n widget: AnnotationRef,\n options?: OperationOptions,\n ): Promise<{ readonly field: FormField | null }>;\n /**\n * Change the order the fields' calculate scripts run in: the fields go\n * together, in the order given, to `position`, next to a neighbour or at\n * `'start'` / `'end'`. A field is in the order while it has a calculate\n * script. Resolves the whole new order. Rejects `permission-denied`\n * without `doc.forms.modify`, `not-found` for a field not in the order.\n */\n reorderCalculations(\n fields: FormFieldRef[],\n position: FieldPosition,\n options?: OperationOptions,\n ): Promise<{ readonly calculationOrder: readonly FormFieldRef[] }>;\n /**\n * Fix a form other PDF apps read differently, such as fields missing from\n * the form's list, and resolve what was fixed. Fires `onResynced`. Rejects\n * `permission-denied` without `doc.forms.modify`.\n */\n repair(options?: FormRepairOptions & OperationOptions): Promise<FormRepairResult>;\n\n // ── permissions ──\n /** Whether reading the form is allowed: `doc.forms.read`. */\n canRead(): boolean;\n /**\n * Whether filling in this field is allowed: `doc.forms.fill`, or a\n * `fields:fill` permission for the field's group. `false` for a field the\n * form doesn't have.\n */\n canFill(field: FormFieldRef): boolean;\n /** Whether adding, changing and removing fields is allowed: `doc.forms.modify`. */\n canDesign(): boolean;\n /**\n * Whether the user may put a field in this group, with `create()`,\n * `update()` or a tool: `doc.forms.modify`, and the group is the user's\n * own or one a `fields:set-group` permission names.\n */\n canSetGroup(groupId: string): boolean;\n /**\n * Whether an import may restore who created and filled in the fields it\n * brings, instead of naming the importing user: `doc.forms.import`.\n */\n canRestoreAttribution(): boolean;\n /**\n * Whether scripts, submit buttons and links may be written into fields and\n * their widgets: `doc.forms.script`. Running a form's scripts never needs it.\n */\n canWriteScripts(): boolean;\n\n // ── events ──\n /** A field's value changed, whoever changed it. */\n readonly onValueChanged: EventHook<FormValueChangedEvent>;\n /** A field was added. */\n readonly onFieldCreated: EventHook<FormFieldCreatedEvent>;\n /** A field's settings or widgets changed. */\n readonly onFieldUpdated: EventHook<FormFieldUpdatedEvent>;\n /** A field was removed. */\n readonly onFieldDeleted: EventHook<FormFieldDeletedEvent>;\n /** The form's own validation refused a value. */\n readonly onValidationRejected: EventHook<FormValidationRejectedEvent>;\n /** The whole form was read, as when it opens, after `refresh()` or a repair. */\n readonly onResynced: EventHook<FormResyncedEvent>;\n /** The cursor moved into a field, to another one, or out of the fields. */\n readonly onFocusChanged: EventHook<FormFocusChangedEvent>;\n /** The group that fields placed with a tool go in changed. */\n readonly onDesignGroupChanged: EventHook<FormDesignGroupChangedEvent>;\n /** `setGroups()` changed who the document's groups are. */\n readonly onGroupsChanged: EventHook<FormGroupsChangedEvent>;\n}\n"],"mappings":";;;;;;AAMA,MAAa,YAAY,sBAAsC,QAAQ;CACrE,MAAM;CAGN,UAAU;EACR,UAAU;EACV,WAAW;EACX,cAAc;EACd,OAAO;EACP,gBAAgB;EAChB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,WAAW;EACX,WAAW;EACX,kBAAkB;EAClB,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,cAAc;EACd,cAAc;EACd,cAAc;EACd,qBAAqB;EACrB,QAAQ;CACV;AACF,CAAC;;;;ACoGD,MAAa,gBAA8B;CACzC,YAAY;CACZ,OAAO,EAAE,OAAO,KAAK;CACrB,QAAQ;EAAE,QAAQ;EAAM,YAAY;EAA2B,OAAO;EAAW,MAAM;CAAK;CAC5F,UAAU;AACZ"}
|
package/dist/contract.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_contract = require("./contract-
|
|
2
|
+
const require_contract = require("./contract-CMb6PYbf.cjs");
|
|
3
3
|
let _embedpdf_engine_core_public = require("@embedpdf/engine-core/public");
|
|
4
4
|
let _embedpdf_engine_core_runtime = require("@embedpdf/engine-core/runtime");
|
|
5
5
|
exports.FORM_DEFAULTS = require_contract.FORM_DEFAULTS;
|
package/dist/contract.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, FormDuplicateOptions, FormDuplicateResult, FormExportSelection, type FormField, FormFieldCreatedEvent, FormFieldDeletedEvent, type FormFieldDraft, FormFieldFlagSetting, type FormFieldKind, type FormFieldPatch, type FormFieldRef, FormFieldResult, FormFieldSetting, FormFieldSettings, FormFieldUpdatedEvent, type FormFieldValue, FormFilter, FormFocusChangedEvent, FormFocusNextOptions, FormFocusOptions, type FormImportDrop, type FormImportDropReason, type FormImportOptions, FormImportResult, type FormKind, FormPlainValue, type FormRepairOptions, type FormRepairResult, FormResetResult, FormResyncedEvent, FormSetValueResult, FormSetValueStatus, FormSettings, type FormSnapshot, FormToken, FormTransfer, FormUiEffect, FormValidation, FormValidationRejectedEvent, FormValueChangedEvent, FormWidgetAddResult, type FormWidgetItem, type FormWidgetLook, WidgetActivationResult, WidgetAddress, type WidgetAnnotation, type WidgetHit, toFieldRef };
|
|
1
|
+
import { $ as WidgetActivationResult, A as FormGroupMoveResult, B as FormResetResult, C as FormFieldUpdatedEvent, D as FormFocusNextOptions, E as FormFocusChangedEvent, F as FormImportResult, G as FormSnapshot, H as FormSetValueResult, I as FormKind, J as FormValidation, K as FormTransfer, L as FormPlainValue, M as FormImportDrop, N as FormImportDropReason, O as FormFocusOptions, P as FormImportOptions, Q as FormWidgetAnchor, R as FormRepairOptions, S as FormFieldSettings, T as FormFilter, U as FormSetValueStatus, V as FormResyncedEvent, W as FormSettings, X as FormValueChangedEvent, Y as FormValidationRejectedEvent, Z as FormWidgetAddResult, _ as FormFieldKind, a as FormCommitResult, at as GroupPosition, b as FormFieldResult, c as FormDesignGroupChangedEvent, d as FormExportSelection, dt as WidgetHit, et as WidgetAddress, f as FormField, ft as WidgetPlace, g as FormFieldFlagSetting, h as FormFieldDraft, i as FormCapability, it as FormWidgetItem, j as FormGroupsChangedEvent, k as FormGroupInput, l as FormDuplicateOptions, lt as FormWidgetLook, m as FormFieldDeletedEvent, n as FillableFields, nt as toFieldRef, o as FormCommitStatus, ot as FormGroup, p as FormFieldCreatedEvent, q as FormUiEffect, r as FormBundle, rt as FormToken, s as FormConfig, st as Box, t as FORM_DEFAULTS, tt as WidgetAnnotation, u as FormDuplicateResult, v as FormFieldPatch, w as FormFieldValue, x as FormFieldSetting, y as FormFieldRef, z as FormRepairResult } from "./contract-B7rB7jYx.cjs";
|
|
2
|
+
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, FormDesignGroupChangedEvent, FormDuplicateOptions, FormDuplicateResult, FormExportSelection, type FormField, FormFieldCreatedEvent, FormFieldDeletedEvent, type FormFieldDraft, FormFieldFlagSetting, type FormFieldKind, type FormFieldPatch, type FormFieldRef, FormFieldResult, FormFieldSetting, FormFieldSettings, FormFieldUpdatedEvent, type FormFieldValue, FormFilter, FormFocusChangedEvent, FormFocusNextOptions, FormFocusOptions, type FormGroup, FormGroupInput, FormGroupMoveResult, FormGroupsChangedEvent, type FormImportDrop, type FormImportDropReason, type FormImportOptions, FormImportResult, type FormKind, FormPlainValue, type FormRepairOptions, type FormRepairResult, FormResetResult, FormResyncedEvent, FormSetValueResult, FormSetValueStatus, FormSettings, type FormSnapshot, FormToken, FormTransfer, FormUiEffect, FormValidation, FormValidationRejectedEvent, FormValueChangedEvent, FormWidgetAddResult, FormWidgetAnchor, type FormWidgetItem, type FormWidgetLook, type GroupPosition, WidgetActivationResult, WidgetAddress, type WidgetAnnotation, type WidgetHit, type WidgetPlace, toFieldRef };
|