@embedpdf/plugin-form 3.0.0-next.14 → 3.0.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/host.cjs +29 -2
- package/dist/contract/host.cjs.map +1 -0
- package/dist/contract/host.d.cts +3 -2
- package/dist/contract/host.d.ts +3 -2
- package/dist/contract/host.js +14 -2
- package/dist/contract/host.js.map +1 -0
- package/dist/contract-BwcgtCOD.d.ts +566 -0
- package/dist/contract-CU0jrI_D.cjs +56 -0
- package/dist/contract-CU0jrI_D.cjs.map +1 -0
- package/dist/contract-D-yQxw3H.d.cts +566 -0
- package/dist/contract-DcncvPcF.js +45 -0
- package/dist/contract-DcncvPcF.js.map +1 -0
- package/dist/contract.cjs +17 -6
- package/dist/contract.d.cts +2 -8
- package/dist/contract.d.ts +2 -8
- package/dist/contract.js +2 -7
- package/dist/controller-CS6tV2m1.cjs +514 -0
- package/dist/controller-CS6tV2m1.cjs.map +1 -0
- package/dist/controller-Sr5M_8G8.js +497 -0
- package/dist/controller-Sr5M_8G8.js.map +1 -0
- package/dist/host-contract-1epLfK1S.d.cts +87 -0
- package/dist/host-contract-BRYUbpT_.d.ts +87 -0
- package/dist/index.cjs +2916 -1205
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -17
- package/dist/index.d.ts +46 -17
- package/dist/index.js +2895 -1206
- package/dist/index.js.map +1 -1
- package/dist/scripting.cjs +3 -484
- package/dist/scripting.d.cts +58 -22
- package/dist/scripting.d.ts +58 -22
- package/dist/scripting.js +1 -482
- package/package.json +14 -13
- package/dist/contract.cjs.map +0 -1
- package/dist/contract.js.map +0 -1
- package/dist/internal.cjs +0 -4
- package/dist/internal.d.cts +0 -3
- package/dist/internal.d.ts +0 -3
- package/dist/internal.js +0 -3
- package/dist/scripting.cjs.map +0 -1
- package/dist/scripting.js.map +0 -1
- package/dist/types-Bpc32Qmx.d.cts +0 -309
- package/dist/types-C1uIIYfn.cjs +0 -16
- package/dist/types-C1uIIYfn.cjs.map +0 -1
- package/dist/types-DRirhZKr.d.ts +0 -309
- package/dist/types-DkQmmcTG.js +0 -12
- package/dist/types-DkQmmcTG.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createCapabilityToken } from "@embedpdf/core";
|
|
2
|
+
import { toFieldRef } from "@embedpdf/engine-core/runtime";
|
|
3
|
+
import { FormTransfer } from "@embedpdf/engine-core/public";
|
|
4
|
+
//#region src/token.ts
|
|
5
|
+
/** The package token — created once here; `contract.ts` re-exports it and
|
|
6
|
+
* `host-contract.ts` widens it to the host capability. */
|
|
7
|
+
const FormToken = createCapabilityToken("form", {
|
|
8
|
+
hint: `add formPlugin() from '@embedpdf/plugin-form' to your plugins list`,
|
|
9
|
+
promises: {
|
|
10
|
+
setValue: true,
|
|
11
|
+
setValues: true,
|
|
12
|
+
importValues: true,
|
|
13
|
+
reset: true,
|
|
14
|
+
activateWidget: true,
|
|
15
|
+
export: true,
|
|
16
|
+
import: true,
|
|
17
|
+
refresh: true,
|
|
18
|
+
create: true,
|
|
19
|
+
addWidget: true,
|
|
20
|
+
update: true,
|
|
21
|
+
delete: true,
|
|
22
|
+
removeWidget: true,
|
|
23
|
+
updateWidget: true,
|
|
24
|
+
deleteWidget: true,
|
|
25
|
+
reorderCalculations: true,
|
|
26
|
+
repair: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/contract.ts
|
|
31
|
+
/** What the form settings are when the app registers none. */
|
|
32
|
+
const FORM_DEFAULTS = {
|
|
33
|
+
validation: "scripts",
|
|
34
|
+
focus: { color: null },
|
|
35
|
+
fields: {
|
|
36
|
+
border: null,
|
|
37
|
+
background: "rgb(255 255 255 / 0.92)",
|
|
38
|
+
color: "#1f2a44"
|
|
39
|
+
},
|
|
40
|
+
fillable: true
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FormToken as i, FormTransfer as n, toFieldRef as r, FORM_DEFAULTS as t };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=contract-DcncvPcF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-DcncvPcF.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 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 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 FormFieldDTO,\n FormFieldFamily,\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 FormFieldDTO,\n FormFieldFamily,\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 families (`'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 families. */\nexport type FillableFields = boolean | readonly FormFieldFamily[];\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 family?: FormFieldFamily;\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: FormFieldDTO;\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 FormFieldDTO[];\n}\n\n/** What `reset()` resolves: the fields it changed, as they are now. */\nexport interface FormResetResult {\n readonly fields: readonly FormFieldDTO[];\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: FormFieldDTO;\n}\n\n/** What `addWidget()` resolves: the field as it is now, and its new widget. */\nexport interface FormWidgetAddResult {\n readonly field: FormFieldDTO;\n readonly widget: WidgetAnnotation;\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 FormFieldDTO[];\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 | { kind: 'form'; result: FormCommitResult }\n | { kind: '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 status: FormCommitStatus;\n scripted: boolean;\n uiEffects: FormUiEffect[];\n diagnostics: ScriptDiagnostic[];\n 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// ── 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: FormFieldDTO;\n readonly origin: EventOrigin;\n}\n/** A field was added. */\nexport interface FormFieldCreatedEvent {\n readonly field: FormFieldDTO;\n readonly origin: EventOrigin;\n}\n/** A field's settings or boxes changed. */\nexport interface FormFieldUpdatedEvent {\n readonly field: FormFieldDTO;\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: FormFieldDTO;\n readonly issues: readonly ScriptDiagnostic[];\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 FormFieldDTO[];\n /** One field, or `null` when the form has no such field. */\n get(ref: FormFieldRef): FormFieldDTO | null;\n /** The field a widget belongs to, or `null`. */\n getFieldForWidget(widget: WidgetAddress): FormFieldDTO | 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 /** The field of the selected widget while one widget is selected (in design mode), or `null`. */\n getSelectedField(): FormFieldDTO | 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 * 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 you can undo:\n * their widgets on the same pages (or `options.pages`), their values, and\n * their place in the calculation order. A field whose name is taken is\n * left out, as are scripts, submits and links without `doc.forms.script`.\n * Fires `onFieldCreated` per field. Rejects `permission-denied` without\n * `doc.forms.modify` (and, for the default `attribution: 'restore'`,\n * `doc.forms.import`).\n */\n import(\n bundle: FormBundle,\n options?: FormImportOptions & OperationOptions,\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 /** 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: FormFieldDTO | 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}\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,QAAQ;EACR,QAAQ;EACR,cAAc;EACd,cAAc;EACd,cAAc;EACd,qBAAqB;EACrB,QAAQ;CACV;AACF,CAAC;;;;ACgFD,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,7 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const require_contract = require("./contract-CU0jrI_D.cjs");
|
|
3
|
+
let _embedpdf_engine_core_public = require("@embedpdf/engine-core/public");
|
|
4
|
+
let _embedpdf_engine_core_runtime = require("@embedpdf/engine-core/runtime");
|
|
5
|
+
exports.FORM_DEFAULTS = require_contract.FORM_DEFAULTS;
|
|
6
|
+
exports.FormToken = require_contract.FormToken;
|
|
7
|
+
Object.defineProperty(exports, "FormTransfer", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function() {
|
|
10
|
+
return _embedpdf_engine_core_public.FormTransfer;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "toFieldRef", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return _embedpdf_engine_core_runtime.toFieldRef;
|
|
17
|
+
}
|
|
18
|
+
});
|
package/dist/contract.d.cts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
|
|
3
|
-
import { FormFieldDTO, FormFieldPatch, FormFieldRef, WidgetAppearance } from "@embedpdf/engine-core/runtime";
|
|
4
|
-
//#region src/contract.d.ts
|
|
5
|
-
declare const FormToken: CapabilityToken<FormCapability>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { type Box, type FieldKey, type FillItem, type FormAction, type FormCapability, type FormCommitResult, type FormCommitStatus, type FormFieldDTO, type FormFieldPatch, type FormFieldRef, type FormPluginOptions, type FormState, FormToken, type FormUiEffect, type PlaceFieldInput, type PlacedField, type WidgetActivationResult, type WidgetAppearance, type WidgetHit };
|
|
8
|
-
//# sourceMappingURL=contract.d.cts.map
|
|
1
|
+
import { A as FormRepairResult, B as FormValidationRejectedEvent, C as FormImportDrop, D as FormKind, E as FormImportResult, F as FormSettings, G as WidgetAnnotation, H as FormWidgetAddResult, I as FormSnapshot, J as FormWidgetItem, K as toFieldRef, L as FormTransfer, M as FormResyncedEvent, N as FormSetValueResult, O as FormPlainValue, P as FormSetValueStatus, Q as WidgetHit, R as FormUiEffect, S as FormFilter, T as FormImportOptions, U as WidgetActivationResult, V as FormValueChangedEvent, W as WidgetAddress, X as FormWidgetLook, Y as Box, _ as FormFieldResult, a as FormCommitResult, b as FormFieldUpdatedEvent, c as FormExportSelection, d as FormFieldDeletedEvent, f as FormFieldDraft, g as FormFieldRef, h as FormFieldPatch, i as FormCapability, j as FormResetResult, k as FormRepairOptions, l as FormFieldCreatedEvent, m as FormFieldFlagSetting, n as FillableFields, o as FormCommitStatus, p as FormFieldFamily, q as FormToken, r as FormBundle, s as FormConfig, t as FORM_DEFAULTS, u as FormFieldDTO, v as FormFieldSetting, w as FormImportDropReason, x as FormFieldValue, y as FormFieldSettings, z as FormValidation } from "./contract-D-yQxw3H.cjs";
|
|
2
|
+
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, FormExportSelection, FormFieldCreatedEvent, type FormFieldDTO, FormFieldDeletedEvent, type FormFieldDraft, type FormFieldFamily, FormFieldFlagSetting, type FormFieldPatch, type FormFieldRef, FormFieldResult, FormFieldSetting, FormFieldSettings, FormFieldUpdatedEvent, type FormFieldValue, FormFilter, 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,8 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
|
|
3
|
-
import { FormFieldDTO, FormFieldPatch, FormFieldRef, WidgetAppearance } from "@embedpdf/engine-core/runtime";
|
|
4
|
-
//#region src/contract.d.ts
|
|
5
|
-
declare const FormToken: CapabilityToken<FormCapability>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { type Box, type FieldKey, type FillItem, type FormAction, type FormCapability, type FormCommitResult, type FormCommitStatus, type FormFieldDTO, type FormFieldPatch, type FormFieldRef, type FormPluginOptions, type FormState, FormToken, type FormUiEffect, type PlaceFieldInput, type PlacedField, type WidgetActivationResult, type WidgetAppearance, type WidgetHit };
|
|
8
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
1
|
+
import { A as FormRepairResult, B as FormValidationRejectedEvent, C as FormImportDrop, D as FormKind, E as FormImportResult, F as FormSettings, G as WidgetAnnotation, H as FormWidgetAddResult, I as FormSnapshot, J as FormWidgetItem, K as toFieldRef, L as FormTransfer, M as FormResyncedEvent, N as FormSetValueResult, O as FormPlainValue, P as FormSetValueStatus, Q as WidgetHit, R as FormUiEffect, S as FormFilter, T as FormImportOptions, U as WidgetActivationResult, V as FormValueChangedEvent, W as WidgetAddress, X as FormWidgetLook, Y as Box, _ as FormFieldResult, a as FormCommitResult, b as FormFieldUpdatedEvent, c as FormExportSelection, d as FormFieldDeletedEvent, f as FormFieldDraft, g as FormFieldRef, h as FormFieldPatch, i as FormCapability, j as FormResetResult, k as FormRepairOptions, l as FormFieldCreatedEvent, m as FormFieldFlagSetting, n as FillableFields, o as FormCommitStatus, p as FormFieldFamily, q as FormToken, r as FormBundle, s as FormConfig, t as FORM_DEFAULTS, u as FormFieldDTO, v as FormFieldSetting, w as FormImportDropReason, x as FormFieldValue, y as FormFieldSettings, z as FormValidation } from "./contract-BwcgtCOD.js";
|
|
2
|
+
export { type Box, FORM_DEFAULTS, FillableFields, type FormBundle, FormCapability, FormCommitResult, FormCommitStatus, FormConfig, FormExportSelection, FormFieldCreatedEvent, type FormFieldDTO, FormFieldDeletedEvent, type FormFieldDraft, type FormFieldFamily, FormFieldFlagSetting, type FormFieldPatch, type FormFieldRef, FormFieldResult, FormFieldSetting, FormFieldSettings, FormFieldUpdatedEvent, type FormFieldValue, FormFilter, 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,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const FormToken = FormToken$1;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { FormToken };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=contract.js.map
|
|
1
|
+
import { i as FormToken, n as FormTransfer, r as toFieldRef, t as FORM_DEFAULTS } from "./contract-DcncvPcF.js";
|
|
2
|
+
export { FORM_DEFAULTS, FormToken, FormTransfer, toFieldRef };
|