# @embedpdf/plugin-form — ./contract Box [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface Box{ readonly x: number; readonly y: number; readonly width: number; readonly height: number; } FORM_DEFAULTS [VariableDeclaration]: FORM_DEFAULTS: FormSettings ={ validation: 'scripts', focus:{ color: null} , fields:{ border: null, background: 'rgb(255 255 255 / 0.92)', color: '#1f2a44'} , fillable: true, } FillableFields [TypeAliasDeclaration]: export type FillableFields = boolean | readonly FormFieldKind[]; FormBundle [InterfaceDeclaration] (from packages/engine/core/src/transfer/FormBundle.ts): export interface FormBundle{ readonly format: 'embedpdf/form'; readonly version: 1; readonly pages: readonly BundlePage[]; readonly fields: readonly FormBundleField[]; readonly widgets: readonly FormBundleWidget[]; readonly calculationOrder: readonly FormFieldRef[]; readonly resources: Readonly>; } FormCapability [InterfaceDeclaration]: export interface FormCapability extends SettingsApi{ getSnapshot(): FormSnapshot | null; getStatus(): ResourceStatus; getFormKind(): FormKind; list(filter?: FormFilter): readonly FormField[]; get(ref: FormFieldRef): FormField | null; getFieldForWidget(widget: WidgetAddress): FormField | null; getWidget(widget: WidgetAddress): WidgetAnnotation | null; getWidgets(ref: FormFieldRef): readonly WidgetAnnotation[]; getValue(ref: FormFieldRef): FormFieldValue | null; listWidgets(page: PageRef | number): readonly FormWidgetItem[]; getWidgetAt(page: PageRef | number, point:{ x: number; y: number} ): WidgetHit | null; getSelectedField(): FormField | null; getFocusedField(): FormField | null; getFieldSettings(field: FormFieldRef): FormFieldSettings | null; validate(): FormValidation; exportValues(): Readonly>; focus(ref: FormFieldRef, options?: FormFocusOptions): boolean; focusNext(options?: FormFocusNextOptions): boolean; setValue( ref: FormFieldRef, value: FormFieldValue, options?: OperationOptions, ): Promise; setValues( entries: readonly{ readonly ref: FormFieldRef; readonly value: FormFieldValue} [], options?: OperationOptions, ): Promise>; importValues( values: Readonly>, options?: OperationOptions, ): Promise>; reset(refs?: readonly FormFieldRef[], options?: OperationOptions): Promise; activateWidget( widget: AnnotationRef, options?: OperationOptions, ): Promise; export(selection?: FormExportSelection, options?: OperationOptions): Promise; import( bundle: FormBundle, options?: FormImportOptions & OperationOptions & HistoryOptions, ): Promise; refresh(options?: OperationOptions): Promise; create(draft: FormFieldDraft, options?: OperationOptions): Promise; addWidget( ref: FormFieldRef, placement?: Partial, options?: OperationOptions, ): Promise; duplicate( fields: readonly FormFieldRef[], options?: FormDuplicateOptions & OperationOptions, ): Promise; duplicateWidgets( widgets: readonly AnnotationRef[], options?: FormDuplicateOptions & OperationOptions, ): Promise; update( ref: FormFieldRef, patch: FormFieldPatch, options?: OperationOptions, ): Promise; delete(ref: FormFieldRef, options?: OperationOptions): Promise; removeWidget( ref: FormFieldRef, widget: AnnotationRef, options?: OperationOptions, ): Promise; updateWidget( widget: AnnotationRef, patch: WidgetPatch, options?: OperationOptions, ): Promise<{ readonly widget: WidgetAnnotation} >; deleteWidget( widget: AnnotationRef, options?: OperationOptions, ): Promise<{ readonly field: FormField | null} >; reorderCalculations( fields: FormFieldRef[], position: FieldPosition, options?: OperationOptions, ): Promise<{ readonly calculationOrder: readonly FormFieldRef[]} >; repair(options?: FormRepairOptions & OperationOptions): Promise; canRead(): boolean; canFill(field: FormFieldRef): boolean; canDesign(): boolean; canRestoreAttribution(): boolean; canWriteScripts(): boolean; readonly onValueChanged: EventHook; readonly onFieldCreated: EventHook; readonly onFieldUpdated: EventHook; readonly onFieldDeleted: EventHook; readonly onValidationRejected: EventHook; readonly onResynced: EventHook; readonly onFocusChanged: EventHook; } FormCommitResult [InterfaceDeclaration]: export interface FormCommitResult{ readonly status: FormCommitStatus; readonly scripted: boolean; readonly uiEffects: FormUiEffect[]; readonly diagnostics: ScriptDiagnostic[]; readonly error?: ScriptExecutionError; } FormCommitStatus [TypeAliasDeclaration]: export type FormCommitStatus = 'applied' | 'unchanged' | 'rejected' | 'failed'; FormConfig [TypeAliasDeclaration]: export type FormConfig = DeepPartial; FormDuplicateOptions [InterfaceDeclaration]: export interface FormDuplicateOptions{ readonly page?: PageRef | number; readonly offset?:{ readonly x: number; readonly y: number} ; readonly values?: boolean; } FormDuplicateResult [InterfaceDeclaration]: export interface FormDuplicateResult{ readonly fields: readonly FormField[]; readonly widgets: readonly WidgetAnnotation[]; readonly dropped: readonly FormImportDrop[]; } FormExportSelection [InterfaceDeclaration]: export interface FormExportSelection{ readonly fields?: readonly FormFieldRef[]; readonly pages?: readonly (PageRef | number)[]; } FormField [TypeAliasDeclaration] (from packages/engine/core/src/forms/field.ts): export type FormField = | TextField | CheckboxField | RadioField | ComboBoxField | ListBoxField | PushButtonField | SignatureField | UnknownField; FormFieldCreatedEvent [InterfaceDeclaration]: export interface FormFieldCreatedEvent{ readonly field: FormField; readonly origin: EventOrigin; } FormFieldDeletedEvent [InterfaceDeclaration]: export interface FormFieldDeletedEvent{ readonly ref: FormFieldRef; readonly origin: EventOrigin; } FormFieldDraft [TypeAliasDeclaration] (from packages/engine/core/src/forms/draft.ts): export type FormFieldDraft = | TextFieldDraft | CheckboxFieldDraft | RadioFieldDraft | ComboBoxFieldDraft | ListBoxFieldDraft | PushButtonFieldDraft | SignatureFieldDraft; FormFieldFlagSetting [TypeAliasDeclaration]: export type FormFieldFlagSetting = | 'required' | 'readOnly' | 'noExport' | 'multiline' | 'password' | 'comb' | 'radiosInUnison' | 'noToggleToOff' | 'edit' | 'multiSelect'; FormFieldKind [TypeAliasDeclaration] (from packages/engine/core/src/forms/field.ts): export type FormFieldKind = | 'text' | 'checkbox' | 'radio' | 'combobox' | 'listbox' | 'pushbutton' | 'signature' | 'unknown'; FormFieldPatch [TypeAliasDeclaration] (from packages/engine/core/src/forms/patch.ts): export type FormFieldPatch = | TextFieldPatch | CheckboxFieldPatch | RadioFieldPatch | ComboBoxFieldPatch | ListBoxFieldPatch | PushButtonFieldPatch | SignatureFieldPatch; FormFieldRef [TypeAliasDeclaration] (from packages/engine/core/src/identity/FormFieldRef.ts): export type FormFieldRef = |{ kind: 'objectNumber'; objectNumber: number} |{ kind: 'fqn'; name: string} ; FormFieldResult [InterfaceDeclaration]: export interface FormFieldResult{ readonly field: FormField; } FormFieldSetting [TypeAliasDeclaration]: export type FormFieldSetting = |{ readonly key: 'name' | 'alternateName'; readonly control: 'text'; readonly label: string; readonly labelKey: string; } |{ readonly key: FormFieldFlagSetting; readonly control: 'flag'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'maxLength'; readonly control: 'number'; readonly label: string; readonly labelKey: string; readonly min: number; } |{ readonly key: 'defaultValue'; readonly control: 'text'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'defaultValue'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly string[]; readonly free: boolean; } |{ readonly key: 'defaultValue'; readonly control: 'choices'; readonly label: string; readonly labelKey: string; readonly options: readonly string[]; } |{ readonly key: 'options'; readonly control: 'options'; readonly label: string; readonly labelKey: string; } ; FormFieldSettings [InterfaceDeclaration]: export interface FormFieldSettings{ readonly properties: readonly FormFieldSetting[]; readonly values: Readonly>; } FormFieldUpdatedEvent [InterfaceDeclaration]: export interface FormFieldUpdatedEvent{ readonly field: FormField; readonly origin: EventOrigin; } FormFieldValue [TypeAliasDeclaration] (from packages/engine/core/src/forms/value.ts): export type FormFieldValue = |{ value: string | null} |{ checked: boolean} |{ selectedValues: string[]} ; FormFilter [InterfaceDeclaration]: export interface FormFilter{ readonly kind?: FormFieldKind; readonly page?: PageRef | number; readonly name?: string; } FormFocusChangedEvent [InterfaceDeclaration]: export interface FormFocusChangedEvent{ readonly field: FormField | null; readonly widget: AnnotationRef | null; } FormFocusNextOptions [InterfaceDeclaration]: export interface FormFocusNextOptions{ from?: FormFieldRef; backward?: boolean; empty?: boolean; wrap?: boolean; } FormFocusOptions [InterfaceDeclaration]: export interface FormFocusOptions{ widget?: WidgetAddress; select?: boolean; } FormImportDrop [InterfaceDeclaration] (from packages/engine/core/src/transfer/formImport.ts): export interface FormImportDrop{ readonly ref: FormFieldRef | null; readonly widget?: AnnotationRef; readonly field?: string; readonly reason: FormImportDropReason; } FormImportDropReason [TypeAliasDeclaration] (from packages/engine/core/src/transfer/formImport.ts): export type FormImportDropReason = | 'name-conflict' | 'no-field' | 'unsupported-kind' | 'script-not-allowed' | 'unsupported-action'; FormImportOptions [InterfaceDeclaration] (from packages/engine/core/src/transfer/formImport.ts): export interface FormImportOptions extends WriteOptions{ readonly pages?: BundleImportPages; readonly attribution?: 'restore' | 'stamp'; readonly values?: boolean; } FormImportResult [InterfaceDeclaration]: export interface FormImportResult{ readonly fields: readonly FormField[]; readonly refMap: ReadonlyArray<{ readonly from: FormFieldRef; readonly to: FormFieldRef} >; readonly dropped: readonly FormImportDrop[]; } FormKind [TypeAliasDeclaration] (from packages/engine/core/src/forms/snapshot.ts): export type FormKind = 'none' | 'acroform' | 'xfa'; FormPlainValue [TypeAliasDeclaration]: export type FormPlainValue = string | boolean | readonly string[] | null; FormRepairOptions [InterfaceDeclaration] (from packages/engine/core/src/engine/DocumentFormsService.ts): export interface FormRepairOptions extends WriteOptions{ bakeAppearances?: boolean; } FormRepairResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/FormMutationResults.ts): export interface FormRepairResult{ acroformCreated: boolean; fieldsLinked: number; widgetsLinked: number; fieldsUnrepairable: number; appearancesBaked: number; needsAppearancesCleared: boolean; meta: MutationMeta; } FormResetResult [InterfaceDeclaration]: export interface FormResetResult{ readonly fields: readonly FormField[]; } FormResyncedEvent [InterfaceDeclaration]: export interface FormResyncedEvent{ readonly snapshot: FormSnapshot; } FormSetValueResult [InterfaceDeclaration]: export interface FormSetValueResult{ readonly field: FormField; readonly status: FormSetValueStatus; } FormSetValueStatus [TypeAliasDeclaration]: export type FormSetValueStatus = 'applied' | 'unchanged' | 'rejected'; FormSettings [InterfaceDeclaration]: export interface FormSettings{ readonly validation: 'scripts' | 'none'; readonly focus:{ readonly color: string | null; } ; readonly fields:{ readonly border: string | null; readonly background: string; readonly color: string; } ; readonly fillable: FillableFields; } FormSnapshot [InterfaceDeclaration] (from packages/engine/core/src/forms/snapshot.ts): export interface FormSnapshot{ formKind: FormKind; needsAppearances: boolean; fields: FormField[]; widgets: WidgetAnnotation[]; calculationOrder: Array; } FormToken [VariableDeclaration] (from packages/plugin/form/src/token.ts): FormToken = createCapabilityToken('form', { hint: `add formPlugin() from '@embedpdf/plugin-form' to your plugins list`, promises:{ setValue: true, setValues: true, importValues: true, reset: true, activateWidget: true, export: true, import: true, refresh: true, create: true, addWidget: true, duplicate: true, duplicateWidgets: true, update: true, delete: true, removeWidget: true, updateWidget: true, deleteWidget: true, reorderCalculations: true, repair: true, } , } ) FormTransfer [VariableDeclaration] (from packages/engine/core/src/transfer/FormTransfer.ts): FormTransfer = bundleCodec({ kind: 'form', keys: FORM_BUNDLE_KEYS, assertManifest: assertFormBundleManifest, } ) FormUiEffect [TypeAliasDeclaration]: export type FormUiEffect = ScriptUiEffect &{ phase: 'boot' | 'user'; origin?: ActionOrigin; } ; FormValidation [InterfaceDeclaration]: export interface FormValidation{ readonly valid: boolean; readonly missing: readonly FormField[]; } FormValidationRejectedEvent [InterfaceDeclaration]: export interface FormValidationRejectedEvent{ readonly field: FormField; readonly issues: readonly ScriptDiagnostic[]; } FormValueChangedEvent [InterfaceDeclaration]: export interface FormValueChangedEvent{ readonly field: FormField; readonly origin: EventOrigin; } FormWidgetAddResult [InterfaceDeclaration]: export interface FormWidgetAddResult{ readonly field: FormField; readonly widget: WidgetAnnotation; } FormWidgetItem [TypeAliasDeclaration] (from packages/plugin/form/src/read/fill-items.ts): export type FormWidgetItem = FormWidgetItemBase & ( |{ control: 'text'; value: string; multiline: boolean; password: boolean; maxLength: number | null; comb: boolean; } |{ control: 'toggle'; kind: 'checkbox'; checked: boolean; exportValue: string; } |{ control: 'toggle'; kind: 'radio'; checked: boolean; exportValue: string; inGroup: GroupPosition | null; } |{ control: 'choice'; kind: 'combo' | 'list'; edit: boolean; multi: boolean; options: FormFieldOption[]; selected: string[]; } |{ control: 'button'} |{ control: 'signature'; signed: boolean} ); FormWidgetLook [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface FormWidgetLook{ readonly border: string | null; readonly borderWidth: number; readonly borderStyle: 'solid' | 'dashed' | 'beveled' | 'inset' | 'underline'; readonly background: string | null; readonly color: string | null; readonly fontFamily: string | null; readonly fontSize: number | null; readonly textAlign: 'left' | 'center' | 'right'; } GroupPosition [InterfaceDeclaration] (from packages/plugin/form/src/read/fill-items.ts): export interface GroupPosition{ readonly position: number; readonly size: number; } WidgetActivationResult [TypeAliasDeclaration]: export type WidgetActivationResult = |{ status: 'form'; result: FormCommitResult} |{ status: 'dispatched'; result: ActionTriggerResult} ; WidgetAddress [TypeAliasDeclaration]: export type WidgetAddress = AnnotationRef | FormWidget; WidgetAnnotation [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/widget/index.ts): export type WidgetAnnotation = ReadOf< typeof WidgetDeclaration, C >; WidgetHit [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface WidgetHit extends WidgetPlace{ readonly annotObjectNumber: number; readonly field: FormField; } WidgetPlace [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface WidgetPlace{ readonly box: Box; readonly rotation: 0 | 90 | 180 | 270; readonly rect: Box; } toFieldRef [FunctionDeclaration] (from packages/engine/core/src/identity/FormFieldRef.ts): export function toFieldRef(name: string): FormFieldRef{ return{ kind: 'fqn', name} ; }