@embedpdf/plugin-form 3.1.0 → 3.3.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/README.md +61 -0
- package/dist/contract/host.cjs +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-Djti7ew8.d.cts → contract-Bq_ewUE5.d.cts} +57 -12
- package/dist/{contract-BdEaLXUK.js → contract-Bu3RA2jA.js} +3 -1
- package/dist/contract-Bu3RA2jA.js.map +1 -0
- package/dist/{contract-6YEsObRl.d.ts → contract-DJLVUeAe.d.ts} +57 -12
- package/dist/{contract-CU0jrI_D.cjs → contract-DO7k0ua0.cjs} +3 -1
- package/dist/contract-DO7k0ua0.cjs.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-XqkfFuoy.d.ts → host-contract-D9NExKAu.d.ts} +2 -2
- package/dist/{host-contract-DO9xsBoD.d.cts → host-contract-DI1Gf4fB.d.cts} +2 -2
- package/dist/index.cjs +530 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +531 -93
- package/dist/index.js.map +1 -1
- package/dist/scripting.d.cts +1 -1
- package/dist/scripting.d.ts +1 -1
- package/package.json +18 -18
- package/dist/contract-BdEaLXUK.js.map +0 -1
- package/dist/contract-CU0jrI_D.cjs.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- Generated from docs/content/headless/forms/index.mdx and docs/content/headless/forms/building.mdx by docs/content/scripts/readmes.mjs. Edit there, then run `pnpm readme:sync`. -->
|
|
2
|
+
|
|
3
|
+
# @embedpdf/plugin-form
|
|
4
|
+
|
|
5
|
+
PDF forms for EmbedPDF: fills in fields and builds forms.
|
|
6
|
+
|
|
7
|
+
This plugin comes with each EmbedPDF framework package. Import it from the one you use:
|
|
8
|
+
|
|
9
|
+
| Framework | Import from | Docs |
|
|
10
|
+
| :-------- | :---------- | :--- |
|
|
11
|
+
| React | `@embedpdf/react/form` | [Filling forms](https://www.embedpdf.com/docs/headless/react/forms) |
|
|
12
|
+
| Vue | `@embedpdf/vue/form` | [Filling forms](https://www.embedpdf.com/docs/headless/vue/forms) |
|
|
13
|
+
| Svelte | `@embedpdf/svelte/form` | [Filling forms](https://www.embedpdf.com/docs/headless/svelte/forms) |
|
|
14
|
+
| Angular | `@embedpdf/angular/form` | [Filling forms](https://www.embedpdf.com/docs/headless/angular/forms) |
|
|
15
|
+
|
|
16
|
+
## In React
|
|
17
|
+
|
|
18
|
+
Many PDFs are forms: text boxes, checkboxes, dropdowns, signature fields. Register `formPlugin()` and
|
|
19
|
+
put `<FormLayer>` in each page, and people can fill them in:
|
|
20
|
+
|
|
21
|
+
**`form-layer.tsx`**
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { FormLayer, formPlugin } from '@embedpdf/react/form';
|
|
25
|
+
import { interactionPlugin } from '@embedpdf/react/interaction';
|
|
26
|
+
import { RenderLayer, renderPlugin } from '@embedpdf/react/render';
|
|
27
|
+
import { Viewer } from '@embedpdf/react/runtime';
|
|
28
|
+
import { Stage, stagePlugin } from '@embedpdf/react/stage';
|
|
29
|
+
import { engine } from './pdf';
|
|
30
|
+
|
|
31
|
+
const plugins = [stagePlugin(), renderPlugin(), interactionPlugin(), formPlugin()];
|
|
32
|
+
|
|
33
|
+
export function FormViewer() {
|
|
34
|
+
return (
|
|
35
|
+
<Viewer engine={engine} plugins={plugins}>
|
|
36
|
+
<Stage>
|
|
37
|
+
{() => (
|
|
38
|
+
<>
|
|
39
|
+
<RenderLayer />
|
|
40
|
+
<FormLayer />
|
|
41
|
+
</>
|
|
42
|
+
)}
|
|
43
|
+
</Stage>
|
|
44
|
+
</Viewer>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Each field becomes a real HTML control, placed and styled like the field in the PDF: people type in text
|
|
50
|
+
boxes, tick checkboxes, pick from lists, and move between fields with Tab. A value is saved into the
|
|
51
|
+
document as it's entered, so it's there when the PDF is downloaded, and every PDF app shows it. The
|
|
52
|
+
form layer paints the fields as the engine draws them, so while it's on the page, the render layer
|
|
53
|
+
leaves them out of the page picture.
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
- [Building forms](https://www.embedpdf.com/docs/headless/react/forms/building): Turn any PDF into a form: place text boxes, checkboxes, radio buttons, lists and signature fields, and change their settings.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
Apache-2.0
|
package/dist/contract/host.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-DO7k0ua0.cjs");
|
|
3
3
|
let _embedpdf_core = require("@embedpdf/core");
|
|
4
4
|
let _embedpdf_engine_core_public = require("@embedpdf/engine-core/public");
|
|
5
5
|
let _embedpdf_engine_core_runtime = require("@embedpdf/engine-core/runtime");
|
package/dist/contract/host.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as WidgetPainting, i as TextEditorLayout, n as FormHostCapability, r as FormToken, t as FormFocusTarget } from "../host-contract-
|
|
3
|
-
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, FormExportSelection, type FormField, FormFieldCreatedEvent, FormFieldDeletedEvent, type FormFieldDraft, FormFieldFlagSetting, type FormFieldKind, type FormFieldPatch, type FormFieldRef, FormFieldResult, FormFieldSetting, FormFieldSettings, FormFieldUpdatedEvent, type FormFieldValue, FormFilter, FormFocusChangedEvent, FormFocusNextOptions, FormFocusOptions, FormFocusTarget, FormHostCapability, 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, type ShownWidget, type TextEditorLayout, WidgetActivationResult, WidgetAddress, type WidgetAnnotation, type WidgetHit, type WidgetPainting, toFieldRef };
|
|
1
|
+
import { $ as FormWidgetItem, A as FormImportOptions, B as FormSettings, C as FormFieldValue, D as FormFocusOptions, E as FormFocusNextOptions, F as FormRepairResult, G as FormValidationRejectedEvent, H as FormTransfer, I as FormResetResult, J as WidgetActivationResult, K as FormValueChangedEvent, L as FormResyncedEvent, M as FormKind, N as FormPlainValue, O as FormImportDrop, P as FormRepairOptions, R as FormSetValueResult, S as FormFieldUpdatedEvent, T as FormFocusChangedEvent, U as FormUiEffect, V as FormSnapshot, W as FormValidation, X as WidgetAnnotation, Y as WidgetAddress, Z as toFieldRef, _ as FormFieldPatch, a as FormCommitResult, b as FormFieldSetting, c as FormDuplicateOptions, d as FormField, et as Box, f as FormFieldCreatedEvent, g as FormFieldKind, h as FormFieldFlagSetting, i as FormCapability, it as WidgetHit, j as FormImportResult, k as FormImportDropReason, l as FormDuplicateResult, m as FormFieldDraft, n as FillableFields, nt as FormWidgetLook, o as FormCommitStatus, p as FormFieldDeletedEvent, q as FormWidgetAddResult, r as FormBundle, rt as ShownWidget, s as FormConfig, t as FORM_DEFAULTS, u as FormExportSelection, v as FormFieldRef, w as FormFilter, x as FormFieldSettings, y as FormFieldResult, z as FormSetValueStatus } from "../contract-Bq_ewUE5.cjs";
|
|
2
|
+
import { a as WidgetPainting, i as TextEditorLayout, n as FormHostCapability, r as FormToken, t as FormFocusTarget } from "../host-contract-DI1Gf4fB.cjs";
|
|
3
|
+
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, FormFocusTarget, FormHostCapability, 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, type ShownWidget, type TextEditorLayout, WidgetActivationResult, WidgetAddress, type WidgetAnnotation, type WidgetHit, type WidgetPainting, toFieldRef };
|
package/dist/contract/host.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as WidgetPainting, i as TextEditorLayout, n as FormHostCapability, r as FormToken, t as FormFocusTarget } from "../host-contract-
|
|
3
|
-
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, FormExportSelection, type FormField, FormFieldCreatedEvent, FormFieldDeletedEvent, type FormFieldDraft, FormFieldFlagSetting, type FormFieldKind, type FormFieldPatch, type FormFieldRef, FormFieldResult, FormFieldSetting, FormFieldSettings, FormFieldUpdatedEvent, type FormFieldValue, FormFilter, FormFocusChangedEvent, FormFocusNextOptions, FormFocusOptions, FormFocusTarget, FormHostCapability, 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, type ShownWidget, type TextEditorLayout, WidgetActivationResult, WidgetAddress, type WidgetAnnotation, type WidgetHit, type WidgetPainting, toFieldRef };
|
|
1
|
+
import { $ as FormWidgetItem, A as FormImportOptions, B as FormSettings, C as FormFieldValue, D as FormFocusOptions, E as FormFocusNextOptions, F as FormRepairResult, G as FormValidationRejectedEvent, H as FormTransfer, I as FormResetResult, J as WidgetActivationResult, K as FormValueChangedEvent, L as FormResyncedEvent, M as FormKind, N as FormPlainValue, O as FormImportDrop, P as FormRepairOptions, R as FormSetValueResult, S as FormFieldUpdatedEvent, T as FormFocusChangedEvent, U as FormUiEffect, V as FormSnapshot, W as FormValidation, X as WidgetAnnotation, Y as WidgetAddress, Z as toFieldRef, _ as FormFieldPatch, a as FormCommitResult, b as FormFieldSetting, c as FormDuplicateOptions, d as FormField, et as Box, f as FormFieldCreatedEvent, g as FormFieldKind, h as FormFieldFlagSetting, i as FormCapability, it as WidgetHit, j as FormImportResult, k as FormImportDropReason, l as FormDuplicateResult, m as FormFieldDraft, n as FillableFields, nt as FormWidgetLook, o as FormCommitStatus, p as FormFieldDeletedEvent, q as FormWidgetAddResult, r as FormBundle, rt as ShownWidget, s as FormConfig, t as FORM_DEFAULTS, u as FormExportSelection, v as FormFieldRef, w as FormFilter, x as FormFieldSettings, y as FormFieldResult, z as FormSetValueStatus } from "../contract-DJLVUeAe.js";
|
|
2
|
+
import { a as WidgetPainting, i as TextEditorLayout, n as FormHostCapability, r as FormToken, t as FormFocusTarget } from "../host-contract-D9NExKAu.js";
|
|
3
|
+
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, FormFocusTarget, FormHostCapability, 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, type ShownWidget, type TextEditorLayout, WidgetActivationResult, WidgetAddress, type WidgetAnnotation, type WidgetHit, type WidgetPainting, toFieldRef };
|
package/dist/contract/host.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as FormToken$1, n as FormTransfer, r as toFieldRef, t as FORM_DEFAULTS } from "../contract-
|
|
1
|
+
import { i as FormToken$1, n as FormTransfer, r as toFieldRef, t as FORM_DEFAULTS } from "../contract-Bu3RA2jA.js";
|
|
2
2
|
import { createHostToken } from "@embedpdf/core";
|
|
3
3
|
//#region src/host-contract.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchResult, DeepPartial, EventHook, EventOrigin, OperationOptions, ResourceStatus, SettingsApi } from "@embedpdf/core";
|
|
1
|
+
import { BatchResult, DeepPartial, EventHook, EventOrigin, HistoryOptions, OperationOptions, ResourceStatus, SettingsApi } from "@embedpdf/core";
|
|
2
2
|
import { ScriptDiagnostic, ScriptExecutionError, ScriptUiEffect } from "@embedpdf/core-acrojs";
|
|
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 } from "@embedpdf/engine-core/runtime";
|
|
4
4
|
import { ActionOrigin, ActionTriggerResult } from "@embedpdf/plugin-actions/contract";
|
|
@@ -278,6 +278,27 @@ interface FormWidgetAddResult {
|
|
|
278
278
|
readonly field: FormField;
|
|
279
279
|
readonly widget: WidgetAnnotation;
|
|
280
280
|
}
|
|
281
|
+
/** How `duplicate()` and `duplicateWidgets()` copy. */
|
|
282
|
+
interface FormDuplicateOptions {
|
|
283
|
+
/** The page the copied widgets go on, as a ref or an index. Left out: each on its own page. */
|
|
284
|
+
readonly page?: PageRef | number;
|
|
285
|
+
/** How far each copied widget moves, in page points: `x` to the right, `y` down. */
|
|
286
|
+
readonly offset?: {
|
|
287
|
+
readonly x: number;
|
|
288
|
+
readonly y: number;
|
|
289
|
+
};
|
|
290
|
+
/** Whether a new field gets its original's value. Default `false`: it starts empty. */
|
|
291
|
+
readonly values?: boolean;
|
|
292
|
+
}
|
|
293
|
+
/** What `duplicate()` and `duplicateWidgets()` resolve. */
|
|
294
|
+
interface FormDuplicateResult {
|
|
295
|
+
/** The fields that were made, and each field that got a new button, as they are now. */
|
|
296
|
+
readonly fields: readonly FormField[];
|
|
297
|
+
/** The new widgets. For `duplicateWidgets()`, in the order their originals were given. */
|
|
298
|
+
readonly widgets: readonly WidgetAnnotation[];
|
|
299
|
+
/** What was left out, and why. */
|
|
300
|
+
readonly dropped: readonly FormImportDrop[];
|
|
301
|
+
}
|
|
281
302
|
/** Which fields `export()` takes, each whole. Without either, every field. */
|
|
282
303
|
interface FormExportSelection {
|
|
283
304
|
readonly fields?: readonly FormFieldRef[];
|
|
@@ -433,7 +454,10 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
433
454
|
x: number;
|
|
434
455
|
y: number;
|
|
435
456
|
}): WidgetHit | null;
|
|
436
|
-
/**
|
|
457
|
+
/**
|
|
458
|
+
* The field whose widgets are selected (in design mode): one widget, or several of the same
|
|
459
|
+
* field, such as a radio group's buttons. `null` otherwise.
|
|
460
|
+
*/
|
|
437
461
|
getSelectedField(): FormField | null;
|
|
438
462
|
/** The field the cursor is in, or `null`. */
|
|
439
463
|
getFocusedField(): FormField | null;
|
|
@@ -503,15 +527,16 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
503
527
|
*/
|
|
504
528
|
export(selection?: FormExportSelection, options?: OperationOptions): Promise<FormBundle>;
|
|
505
529
|
/**
|
|
506
|
-
* Copy a bundle's fields into this document, as one change
|
|
507
|
-
* their widgets on the same pages (or `options.pages`), their values,
|
|
508
|
-
* their place in the calculation order.
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
* `doc.forms.
|
|
512
|
-
* `doc.forms.
|
|
530
|
+
* Copy a bundle's fields into this document, as one change and one step to
|
|
531
|
+
* undo: their widgets on the same pages (or `options.pages`), their values,
|
|
532
|
+
* and their place in the calculation order. `history: false` keeps it out
|
|
533
|
+
* of undo and redo, for what your app adds by itself. A field whose name is
|
|
534
|
+
* taken is left out, as are scripts, submits and links without
|
|
535
|
+
* `doc.forms.script`. Fires `onFieldCreated` per field. Rejects
|
|
536
|
+
* `permission-denied` without `doc.forms.modify` (and, for the default
|
|
537
|
+
* `attribution: 'restore'`, `doc.forms.import`).
|
|
513
538
|
*/
|
|
514
|
-
import(bundle: FormBundle, options?: FormImportOptions & OperationOptions): Promise<FormImportResult>;
|
|
539
|
+
import(bundle: FormBundle, options?: FormImportOptions & OperationOptions & HistoryOptions): Promise<FormImportResult>;
|
|
515
540
|
/** Read the whole form again; fires `onResynced`. */
|
|
516
541
|
refresh(options?: OperationOptions): Promise<void>;
|
|
517
542
|
/**
|
|
@@ -534,6 +559,26 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
534
559
|
* `doc.forms.modify`, `not-found` for a field the form doesn't have.
|
|
535
560
|
*/
|
|
536
561
|
addWidget(ref: FormFieldRef, placement?: Partial<WidgetPlacement>, options?: OperationOptions): Promise<FormWidgetAddResult>;
|
|
562
|
+
/**
|
|
563
|
+
* Copy whole fields: each a new field with its original's settings, scripts, default value
|
|
564
|
+
* and widgets, named after it with the next free number (`email` becomes `email_2`). A
|
|
565
|
+
* radio group's copy keeps its buttons' values. A copy has no value unless
|
|
566
|
+
* `options.values` is true, and a signature never comes along. The copies show at once,
|
|
567
|
+
* it is one step to undo, and it resolves the new fields, their widgets and what was left
|
|
568
|
+
* out. Fires `onFieldCreated` for each. Rejects `permission-denied` without
|
|
569
|
+
* `doc.forms.modify`, `not-found` for a field the form doesn't have.
|
|
570
|
+
*/
|
|
571
|
+
duplicate(fields: readonly FormFieldRef[], options?: FormDuplicateOptions & OperationOptions): Promise<FormDuplicateResult>;
|
|
572
|
+
/**
|
|
573
|
+
* Copy widgets, as Duplicate does in a form designer. A radio button's copy is another
|
|
574
|
+
* button of its group, with the next free `Choice<n>` as its value. Any other widget's
|
|
575
|
+
* copy is a new field, as `duplicate()` makes one, and widgets of one field copied
|
|
576
|
+
* together become one new field. The copies show at once, it is one step to undo, and it
|
|
577
|
+
* resolves the fields made or changed, the new widgets in the order of the widgets given,
|
|
578
|
+
* and what was left out. Rejects `permission-denied` without `doc.forms.modify`,
|
|
579
|
+
* `not-found` for a widget the form doesn't show.
|
|
580
|
+
*/
|
|
581
|
+
duplicateWidgets(widgets: readonly AnnotationRef[], options?: FormDuplicateOptions & OperationOptions): Promise<FormDuplicateResult>;
|
|
537
582
|
/** Change a field's settings: pass only what changes. Fires `onFieldUpdated`. Rejects like `create()`. */
|
|
538
583
|
update(ref: FormFieldRef, patch: FormFieldPatch, options?: OperationOptions): Promise<FormFieldResult>;
|
|
539
584
|
/** Remove a field and every widget it has. Fires `onFieldDeleted`. Rejects `permission-denied` without `doc.forms.modify`, `not-found`. */
|
|
@@ -615,5 +660,5 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
615
660
|
readonly onFocusChanged: EventHook<FormFocusChangedEvent>;
|
|
616
661
|
}
|
|
617
662
|
//#endregion
|
|
618
|
-
export {
|
|
619
|
-
//# sourceMappingURL=contract-
|
|
663
|
+
export { FormWidgetItem as $, FormImportOptions$1 as A, FormSettings as B, FormFieldValue$1 as C, FormFocusOptions as D, FormFocusNextOptions as E, FormRepairResult$1 as F, FormValidationRejectedEvent as G, FormTransfer as H, FormResetResult as I, WidgetActivationResult as J, FormValueChangedEvent as K, FormResyncedEvent as L, FormKind$1 as M, FormPlainValue as N, FormImportDrop$1 as O, FormRepairOptions$1 as P, FormToken as Q, FormSetValueResult as R, FormFieldUpdatedEvent as S, FormFocusChangedEvent as T, FormUiEffect as U, FormSnapshot$1 as V, FormValidation as W, WidgetAnnotation$1 as X, WidgetAddress as Y, toFieldRef as Z, FormFieldPatch$1 as _, FormCommitResult as a, FormFieldSetting as b, FormDuplicateOptions as c, FormField$1 as d, Box as et, FormFieldCreatedEvent as f, FormFieldKind$1 as g, FormFieldFlagSetting as h, FormCapability as i, WidgetHit as it, FormImportResult as j, FormImportDropReason as k, FormDuplicateResult as l, FormFieldDraft$1 as m, FillableFields as n, FormWidgetLook as nt, FormCommitStatus as o, FormFieldDeletedEvent as p, FormWidgetAddResult as q, FormBundle$1 as r, ShownWidget as rt, FormConfig as s, FORM_DEFAULTS as t, FormModel as tt, FormExportSelection as u, FormFieldRef$1 as v, FormFilter as w, FormFieldSettings as x, FormFieldResult as y, FormSetValueStatus as z };
|
|
664
|
+
//# sourceMappingURL=contract-Bq_ewUE5.d.cts.map
|
|
@@ -17,6 +17,8 @@ const FormToken = createCapabilityToken("form", {
|
|
|
17
17
|
refresh: true,
|
|
18
18
|
create: true,
|
|
19
19
|
addWidget: true,
|
|
20
|
+
duplicate: true,
|
|
21
|
+
duplicateWidgets: true,
|
|
20
22
|
update: true,
|
|
21
23
|
delete: true,
|
|
22
24
|
removeWidget: true,
|
|
@@ -42,4 +44,4 @@ const FORM_DEFAULTS = {
|
|
|
42
44
|
//#endregion
|
|
43
45
|
export { FormToken as i, FormTransfer as n, toFieldRef$1 as r, FORM_DEFAULTS as t };
|
|
44
46
|
|
|
45
|
-
//# sourceMappingURL=contract-
|
|
47
|
+
//# sourceMappingURL=contract-Bu3RA2jA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-Bu3RA2jA.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 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 { WidgetHit } from './model';\nimport type { FormWidgetItem } from './read/fill-items';\n\nexport { FormToken } from './token';\nexport { toFieldRef } from '@embedpdf/engine-core/runtime';\nexport { FormTransfer } from '@embedpdf/engine-core/public';\nexport type { FormWidgetItem, FormWidgetLook } from './read/fill-items';\nexport type { Box, WidgetHit } 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`), 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 /**\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/** 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' },\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.\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: '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 `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/** 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 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. The same array while nothing changes; empty for a page\n * 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, 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 /** The field the cursor is in, or `null`. */\n getFocusedField(): FormField | 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 /** 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 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}\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,QAAQ;EACR,cAAc;EACd,cAAc;EACd,cAAc;EACd,qBAAqB;EACrB,QAAQ;CACV;AACF,CAAC;;;;AC+ED,MAAa,gBAA8B;CACzC,YAAY;CACZ,OAAO,EAAE,OAAO,KAAK;CACrB,QAAQ;EAAE,QAAQ;EAAM,YAAY;EAA2B,OAAO;CAAU;CAChF,UAAU;AACZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchResult, DeepPartial, EventHook, EventOrigin, OperationOptions, ResourceStatus, SettingsApi } from "@embedpdf/core";
|
|
1
|
+
import { BatchResult, DeepPartial, EventHook, EventOrigin, HistoryOptions, OperationOptions, ResourceStatus, SettingsApi } from "@embedpdf/core";
|
|
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";
|
|
@@ -278,6 +278,27 @@ interface FormWidgetAddResult {
|
|
|
278
278
|
readonly field: FormField;
|
|
279
279
|
readonly widget: WidgetAnnotation;
|
|
280
280
|
}
|
|
281
|
+
/** How `duplicate()` and `duplicateWidgets()` copy. */
|
|
282
|
+
interface FormDuplicateOptions {
|
|
283
|
+
/** The page the copied widgets go on, as a ref or an index. Left out: each on its own page. */
|
|
284
|
+
readonly page?: PageRef | number;
|
|
285
|
+
/** How far each copied widget moves, in page points: `x` to the right, `y` down. */
|
|
286
|
+
readonly offset?: {
|
|
287
|
+
readonly x: number;
|
|
288
|
+
readonly y: number;
|
|
289
|
+
};
|
|
290
|
+
/** Whether a new field gets its original's value. Default `false`: it starts empty. */
|
|
291
|
+
readonly values?: boolean;
|
|
292
|
+
}
|
|
293
|
+
/** What `duplicate()` and `duplicateWidgets()` resolve. */
|
|
294
|
+
interface FormDuplicateResult {
|
|
295
|
+
/** The fields that were made, and each field that got a new button, as they are now. */
|
|
296
|
+
readonly fields: readonly FormField[];
|
|
297
|
+
/** The new widgets. For `duplicateWidgets()`, in the order their originals were given. */
|
|
298
|
+
readonly widgets: readonly WidgetAnnotation[];
|
|
299
|
+
/** What was left out, and why. */
|
|
300
|
+
readonly dropped: readonly FormImportDrop[];
|
|
301
|
+
}
|
|
281
302
|
/** Which fields `export()` takes, each whole. Without either, every field. */
|
|
282
303
|
interface FormExportSelection {
|
|
283
304
|
readonly fields?: readonly FormFieldRef[];
|
|
@@ -433,7 +454,10 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
433
454
|
x: number;
|
|
434
455
|
y: number;
|
|
435
456
|
}): WidgetHit | null;
|
|
436
|
-
/**
|
|
457
|
+
/**
|
|
458
|
+
* The field whose widgets are selected (in design mode): one widget, or several of the same
|
|
459
|
+
* field, such as a radio group's buttons. `null` otherwise.
|
|
460
|
+
*/
|
|
437
461
|
getSelectedField(): FormField | null;
|
|
438
462
|
/** The field the cursor is in, or `null`. */
|
|
439
463
|
getFocusedField(): FormField | null;
|
|
@@ -503,15 +527,16 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
503
527
|
*/
|
|
504
528
|
export(selection?: FormExportSelection, options?: OperationOptions): Promise<FormBundle>;
|
|
505
529
|
/**
|
|
506
|
-
* Copy a bundle's fields into this document, as one change
|
|
507
|
-
* their widgets on the same pages (or `options.pages`), their values,
|
|
508
|
-
* their place in the calculation order.
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
* `doc.forms.
|
|
512
|
-
* `doc.forms.
|
|
530
|
+
* Copy a bundle's fields into this document, as one change and one step to
|
|
531
|
+
* undo: their widgets on the same pages (or `options.pages`), their values,
|
|
532
|
+
* and their place in the calculation order. `history: false` keeps it out
|
|
533
|
+
* of undo and redo, for what your app adds by itself. A field whose name is
|
|
534
|
+
* taken is left out, as are scripts, submits and links without
|
|
535
|
+
* `doc.forms.script`. Fires `onFieldCreated` per field. Rejects
|
|
536
|
+
* `permission-denied` without `doc.forms.modify` (and, for the default
|
|
537
|
+
* `attribution: 'restore'`, `doc.forms.import`).
|
|
513
538
|
*/
|
|
514
|
-
import(bundle: FormBundle, options?: FormImportOptions & OperationOptions): Promise<FormImportResult>;
|
|
539
|
+
import(bundle: FormBundle, options?: FormImportOptions & OperationOptions & HistoryOptions): Promise<FormImportResult>;
|
|
515
540
|
/** Read the whole form again; fires `onResynced`. */
|
|
516
541
|
refresh(options?: OperationOptions): Promise<void>;
|
|
517
542
|
/**
|
|
@@ -534,6 +559,26 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
534
559
|
* `doc.forms.modify`, `not-found` for a field the form doesn't have.
|
|
535
560
|
*/
|
|
536
561
|
addWidget(ref: FormFieldRef, placement?: Partial<WidgetPlacement>, options?: OperationOptions): Promise<FormWidgetAddResult>;
|
|
562
|
+
/**
|
|
563
|
+
* Copy whole fields: each a new field with its original's settings, scripts, default value
|
|
564
|
+
* and widgets, named after it with the next free number (`email` becomes `email_2`). A
|
|
565
|
+
* radio group's copy keeps its buttons' values. A copy has no value unless
|
|
566
|
+
* `options.values` is true, and a signature never comes along. The copies show at once,
|
|
567
|
+
* it is one step to undo, and it resolves the new fields, their widgets and what was left
|
|
568
|
+
* out. Fires `onFieldCreated` for each. Rejects `permission-denied` without
|
|
569
|
+
* `doc.forms.modify`, `not-found` for a field the form doesn't have.
|
|
570
|
+
*/
|
|
571
|
+
duplicate(fields: readonly FormFieldRef[], options?: FormDuplicateOptions & OperationOptions): Promise<FormDuplicateResult>;
|
|
572
|
+
/**
|
|
573
|
+
* Copy widgets, as Duplicate does in a form designer. A radio button's copy is another
|
|
574
|
+
* button of its group, with the next free `Choice<n>` as its value. Any other widget's
|
|
575
|
+
* copy is a new field, as `duplicate()` makes one, and widgets of one field copied
|
|
576
|
+
* together become one new field. The copies show at once, it is one step to undo, and it
|
|
577
|
+
* resolves the fields made or changed, the new widgets in the order of the widgets given,
|
|
578
|
+
* and what was left out. Rejects `permission-denied` without `doc.forms.modify`,
|
|
579
|
+
* `not-found` for a widget the form doesn't show.
|
|
580
|
+
*/
|
|
581
|
+
duplicateWidgets(widgets: readonly AnnotationRef[], options?: FormDuplicateOptions & OperationOptions): Promise<FormDuplicateResult>;
|
|
537
582
|
/** Change a field's settings: pass only what changes. Fires `onFieldUpdated`. Rejects like `create()`. */
|
|
538
583
|
update(ref: FormFieldRef, patch: FormFieldPatch, options?: OperationOptions): Promise<FormFieldResult>;
|
|
539
584
|
/** Remove a field and every widget it has. Fires `onFieldDeleted`. Rejects `permission-denied` without `doc.forms.modify`, `not-found`. */
|
|
@@ -615,5 +660,5 @@ interface FormCapability extends SettingsApi<FormSettings> {
|
|
|
615
660
|
readonly onFocusChanged: EventHook<FormFocusChangedEvent>;
|
|
616
661
|
}
|
|
617
662
|
//#endregion
|
|
618
|
-
export {
|
|
619
|
-
//# sourceMappingURL=contract-
|
|
663
|
+
export { FormWidgetItem as $, FormImportOptions$1 as A, FormSettings as B, FormFieldValue$1 as C, FormFocusOptions as D, FormFocusNextOptions as E, FormRepairResult$1 as F, FormValidationRejectedEvent as G, FormTransfer as H, FormResetResult as I, WidgetActivationResult as J, FormValueChangedEvent as K, FormResyncedEvent as L, FormKind$1 as M, FormPlainValue as N, FormImportDrop$1 as O, FormRepairOptions$1 as P, FormToken as Q, FormSetValueResult as R, FormFieldUpdatedEvent as S, FormFocusChangedEvent as T, FormUiEffect as U, FormSnapshot$1 as V, FormValidation as W, WidgetAnnotation$1 as X, WidgetAddress as Y, toFieldRef$1 as Z, FormFieldPatch$1 as _, FormCommitResult as a, FormFieldSetting as b, FormDuplicateOptions as c, FormField$1 as d, Box as et, FormFieldCreatedEvent as f, FormFieldKind$1 as g, FormFieldFlagSetting as h, FormCapability as i, WidgetHit as it, FormImportResult as j, FormImportDropReason as k, FormDuplicateResult as l, FormFieldDraft$1 as m, FillableFields as n, FormWidgetLook as nt, FormCommitStatus as o, FormFieldDeletedEvent as p, FormWidgetAddResult as q, FormBundle$1 as r, ShownWidget as rt, FormConfig as s, FORM_DEFAULTS as t, FormModel as tt, FormExportSelection as u, FormFieldRef$1 as v, FormFilter as w, FormFieldSettings as x, FormFieldResult as y, FormSetValueStatus as z };
|
|
664
|
+
//# sourceMappingURL=contract-DJLVUeAe.d.ts.map
|
|
@@ -17,6 +17,8 @@ const FormToken = (0, _embedpdf_core.createCapabilityToken)("form", {
|
|
|
17
17
|
refresh: true,
|
|
18
18
|
create: true,
|
|
19
19
|
addWidget: true,
|
|
20
|
+
duplicate: true,
|
|
21
|
+
duplicateWidgets: true,
|
|
20
22
|
update: true,
|
|
21
23
|
delete: true,
|
|
22
24
|
removeWidget: true,
|
|
@@ -53,4 +55,4 @@ Object.defineProperty(exports, "FormToken", {
|
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
|
|
56
|
-
//# sourceMappingURL=contract-
|
|
58
|
+
//# sourceMappingURL=contract-DO7k0ua0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-DO7k0ua0.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 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 { WidgetHit } from './model';\nimport type { FormWidgetItem } from './read/fill-items';\n\nexport { FormToken } from './token';\nexport { toFieldRef } from '@embedpdf/engine-core/runtime';\nexport { FormTransfer } from '@embedpdf/engine-core/public';\nexport type { FormWidgetItem, FormWidgetLook } from './read/fill-items';\nexport type { Box, WidgetHit } 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`), 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 /**\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/** 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' },\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.\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: '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 `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/** 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 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. The same array while nothing changes; empty for a page\n * 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, 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 /** The field the cursor is in, or `null`. */\n getFocusedField(): FormField | 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 /** 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 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}\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,QAAQ;EACR,cAAc;EACd,cAAc;EACd,cAAc;EACd,qBAAqB;EACrB,QAAQ;CACV;AACF,CAAC;;;;AC+ED,MAAa,gBAA8B;CACzC,YAAY;CACZ,OAAO,EAAE,OAAO,KAAK;CACrB,QAAQ;EAAE,QAAQ;EAAM,YAAY;EAA2B,OAAO;CAAU;CAChF,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-DO7k0ua0.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 { A as
|
|
2
|
-
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, 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 FormWidgetItem, A as FormImportOptions, B as FormSettings, C as FormFieldValue, D as FormFocusOptions, E as FormFocusNextOptions, F as FormRepairResult, G as FormValidationRejectedEvent, H as FormTransfer, I as FormResetResult, J as WidgetActivationResult, K as FormValueChangedEvent, L as FormResyncedEvent, M as FormKind, N as FormPlainValue, O as FormImportDrop, P as FormRepairOptions, Q as FormToken, R as FormSetValueResult, S as FormFieldUpdatedEvent, T as FormFocusChangedEvent, U as FormUiEffect, V as FormSnapshot, W as FormValidation, X as WidgetAnnotation, Y as WidgetAddress, Z as toFieldRef, _ as FormFieldPatch, a as FormCommitResult, b as FormFieldSetting, c as FormDuplicateOptions, d as FormField, et as Box, f as FormFieldCreatedEvent, g as FormFieldKind, h as FormFieldFlagSetting, i as FormCapability, it as WidgetHit, j as FormImportResult, k as FormImportDropReason, l as FormDuplicateResult, m as FormFieldDraft, n as FillableFields, nt as FormWidgetLook, o as FormCommitStatus, p as FormFieldDeletedEvent, q as FormWidgetAddResult, r as FormBundle, s as FormConfig, t as FORM_DEFAULTS, u as FormExportSelection, v as FormFieldRef, w as FormFilter, x as FormFieldSettings, y as FormFieldResult, z as FormSetValueStatus } from "./contract-Bq_ewUE5.cjs";
|
|
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 };
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, 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 FormWidgetItem, A as FormImportOptions, B as FormSettings, C as FormFieldValue, D as FormFocusOptions, E as FormFocusNextOptions, F as FormRepairResult, G as FormValidationRejectedEvent, H as FormTransfer, I as FormResetResult, J as WidgetActivationResult, K as FormValueChangedEvent, L as FormResyncedEvent, M as FormKind, N as FormPlainValue, O as FormImportDrop, P as FormRepairOptions, Q as FormToken, R as FormSetValueResult, S as FormFieldUpdatedEvent, T as FormFocusChangedEvent, U as FormUiEffect, V as FormSnapshot, W as FormValidation, X as WidgetAnnotation, Y as WidgetAddress, Z as toFieldRef, _ as FormFieldPatch, a as FormCommitResult, b as FormFieldSetting, c as FormDuplicateOptions, d as FormField, et as Box, f as FormFieldCreatedEvent, g as FormFieldKind, h as FormFieldFlagSetting, i as FormCapability, it as WidgetHit, j as FormImportResult, k as FormImportDropReason, l as FormDuplicateResult, m as FormFieldDraft, n as FillableFields, nt as FormWidgetLook, o as FormCommitStatus, p as FormFieldDeletedEvent, q as FormWidgetAddResult, r as FormBundle, s as FormConfig, t as FORM_DEFAULTS, u as FormExportSelection, v as FormFieldRef, w as FormFilter, x as FormFieldSettings, y as FormFieldResult, z as FormSetValueStatus } from "./contract-DJLVUeAe.js";
|
|
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 };
|
package/dist/contract.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as FormToken, n as FormTransfer, r as toFieldRef, t as FORM_DEFAULTS } from "./contract-
|
|
1
|
+
import { i as FormToken, n as FormTransfer, r as toFieldRef, t as FORM_DEFAULTS } from "./contract-Bu3RA2jA.js";
|
|
2
2
|
export { FORM_DEFAULTS, FormToken, FormTransfer, toFieldRef };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as FormSetValueResult, a as FormCommitResult, et as Box, i as FormCapability, rt as ShownWidget } from "./contract-DJLVUeAe.js";
|
|
2
2
|
import "@embedpdf/core";
|
|
3
3
|
import { ActionContext, ActionDiagnostic, ActionOrigin, ActionSubmitRequest, PdfAnnotationEventKind, SubmitIntent } from "@embedpdf/plugin-actions/contract";
|
|
4
4
|
import { FontCss } from "@embedpdf/plugin-fonts/contract";
|
|
@@ -116,4 +116,4 @@ interface FormHostCapability extends FormCapability {
|
|
|
116
116
|
declare const FormToken: import("@embedpdf/core").CapabilityToken<FormHostCapability>;
|
|
117
117
|
//#endregion
|
|
118
118
|
export { WidgetPainting as a, TextEditorLayout$1 as i, FormHostCapability as n, FormToken as r, FormFocusTarget as t };
|
|
119
|
-
//# sourceMappingURL=host-contract-
|
|
119
|
+
//# sourceMappingURL=host-contract-D9NExKAu.d.ts.map
|