@embedpdf/plugin-form 2.15.0 → 3.0.0-next.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/LICENSE +192 -21
- package/dist/index.cjs +1416 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +277 -0
- package/dist/index.d.ts +277 -1
- package/dist/index.js +1398 -1779
- package/dist/index.js.map +1 -1
- package/package.json +24 -61
- package/dist/lib/actions.d.ts +0 -33
- package/dist/lib/form-plugin.d.ts +0 -59
- package/dist/lib/handlers/checkbox.handler.d.ts +0 -3
- package/dist/lib/handlers/combobox.handler.d.ts +0 -3
- package/dist/lib/handlers/index.d.ts +0 -5
- package/dist/lib/handlers/listbox.handler.d.ts +0 -3
- package/dist/lib/handlers/radio-button.handler.d.ts +0 -3
- package/dist/lib/handlers/text-field.handler.d.ts +0 -3
- package/dist/lib/index.d.ts +0 -10
- package/dist/lib/manifest.d.ts +0 -4
- package/dist/lib/reducer.d.ts +0 -6
- package/dist/lib/tools.d.ts +0 -457
- package/dist/lib/types.d.ts +0 -98
- package/dist/preact/adapter.d.ts +0 -13
- package/dist/preact/annotation.d.ts +0 -1
- package/dist/preact/core.d.ts +0 -1
- package/dist/preact/index.cjs +0 -2
- package/dist/preact/index.cjs.map +0 -1
- package/dist/preact/index.d.ts +0 -1
- package/dist/preact/index.js +0 -1359
- package/dist/preact/index.js.map +0 -1
- package/dist/react/adapter.d.ts +0 -6
- package/dist/react/annotation.d.ts +0 -1
- package/dist/react/core.d.ts +0 -1
- package/dist/react/index.cjs +0 -2
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -1358
- package/dist/react/index.js.map +0 -1
- package/dist/shared/components/annotations/form-checkbox.d.ts +0 -12
- package/dist/shared/components/annotations/form-combobox.d.ts +0 -12
- package/dist/shared/components/annotations/form-listbox.d.ts +0 -12
- package/dist/shared/components/annotations/form-radio-button.d.ts +0 -12
- package/dist/shared/components/annotations/form-text-field.d.ts +0 -12
- package/dist/shared/components/fields/checkbox.d.ts +0 -2
- package/dist/shared/components/fields/combobox.d.ts +0 -2
- package/dist/shared/components/fields/listbox.d.ts +0 -2
- package/dist/shared/components/fields/push-button.d.ts +0 -2
- package/dist/shared/components/fields/radio-button.d.ts +0 -2
- package/dist/shared/components/fields/style.d.ts +0 -6
- package/dist/shared/components/fields/text.d.ts +0 -2
- package/dist/shared/components/fill-mode/combobox-fill-mode.d.ts +0 -3
- package/dist/shared/components/fill-mode/listbox-fill-mode.d.ts +0 -3
- package/dist/shared/components/fill-mode/push-button-fill-mode.d.ts +0 -3
- package/dist/shared/components/fill-mode/radio-button-fill-mode.d.ts +0 -3
- package/dist/shared/components/fill-mode/text-fill-mode.d.ts +0 -3
- package/dist/shared/components/fill-mode/toggle-fill-mode.d.ts +0 -3
- package/dist/shared/components/form-renderer-registration.d.ts +0 -5
- package/dist/shared/components/form-renderers.d.ts +0 -9
- package/dist/shared/components/index.d.ts +0 -2
- package/dist/shared/components/render-widget.d.ts +0 -12
- package/dist/shared/components/types.d.ts +0 -42
- package/dist/shared/hooks/index.d.ts +0 -1
- package/dist/shared/hooks/use-form-widget-state.d.ts +0 -12
- package/dist/shared/hooks/use-form.d.ts +0 -16
- package/dist/shared/index.d.ts +0 -4
- package/dist/shared-preact/components/annotations/form-checkbox.d.ts +0 -12
- package/dist/shared-preact/components/annotations/form-combobox.d.ts +0 -12
- package/dist/shared-preact/components/annotations/form-listbox.d.ts +0 -12
- package/dist/shared-preact/components/annotations/form-radio-button.d.ts +0 -12
- package/dist/shared-preact/components/annotations/form-text-field.d.ts +0 -12
- package/dist/shared-preact/components/fields/checkbox.d.ts +0 -2
- package/dist/shared-preact/components/fields/combobox.d.ts +0 -2
- package/dist/shared-preact/components/fields/listbox.d.ts +0 -2
- package/dist/shared-preact/components/fields/push-button.d.ts +0 -2
- package/dist/shared-preact/components/fields/radio-button.d.ts +0 -2
- package/dist/shared-preact/components/fields/style.d.ts +0 -6
- package/dist/shared-preact/components/fields/text.d.ts +0 -2
- package/dist/shared-preact/components/fill-mode/combobox-fill-mode.d.ts +0 -3
- package/dist/shared-preact/components/fill-mode/listbox-fill-mode.d.ts +0 -3
- package/dist/shared-preact/components/fill-mode/push-button-fill-mode.d.ts +0 -3
- package/dist/shared-preact/components/fill-mode/radio-button-fill-mode.d.ts +0 -3
- package/dist/shared-preact/components/fill-mode/text-fill-mode.d.ts +0 -3
- package/dist/shared-preact/components/fill-mode/toggle-fill-mode.d.ts +0 -3
- package/dist/shared-preact/components/form-renderer-registration.d.ts +0 -5
- package/dist/shared-preact/components/form-renderers.d.ts +0 -9
- package/dist/shared-preact/components/index.d.ts +0 -2
- package/dist/shared-preact/components/render-widget.d.ts +0 -12
- package/dist/shared-preact/components/types.d.ts +0 -42
- package/dist/shared-preact/hooks/index.d.ts +0 -1
- package/dist/shared-preact/hooks/use-form-widget-state.d.ts +0 -12
- package/dist/shared-preact/hooks/use-form.d.ts +0 -16
- package/dist/shared-preact/index.d.ts +0 -4
- package/dist/shared-react/components/annotations/form-checkbox.d.ts +0 -12
- package/dist/shared-react/components/annotations/form-combobox.d.ts +0 -12
- package/dist/shared-react/components/annotations/form-listbox.d.ts +0 -12
- package/dist/shared-react/components/annotations/form-radio-button.d.ts +0 -12
- package/dist/shared-react/components/annotations/form-text-field.d.ts +0 -12
- package/dist/shared-react/components/fields/checkbox.d.ts +0 -2
- package/dist/shared-react/components/fields/combobox.d.ts +0 -2
- package/dist/shared-react/components/fields/listbox.d.ts +0 -2
- package/dist/shared-react/components/fields/push-button.d.ts +0 -2
- package/dist/shared-react/components/fields/radio-button.d.ts +0 -2
- package/dist/shared-react/components/fields/style.d.ts +0 -6
- package/dist/shared-react/components/fields/text.d.ts +0 -2
- package/dist/shared-react/components/fill-mode/combobox-fill-mode.d.ts +0 -3
- package/dist/shared-react/components/fill-mode/listbox-fill-mode.d.ts +0 -3
- package/dist/shared-react/components/fill-mode/push-button-fill-mode.d.ts +0 -3
- package/dist/shared-react/components/fill-mode/radio-button-fill-mode.d.ts +0 -3
- package/dist/shared-react/components/fill-mode/text-fill-mode.d.ts +0 -3
- package/dist/shared-react/components/fill-mode/toggle-fill-mode.d.ts +0 -3
- package/dist/shared-react/components/form-renderer-registration.d.ts +0 -5
- package/dist/shared-react/components/form-renderers.d.ts +0 -9
- package/dist/shared-react/components/index.d.ts +0 -2
- package/dist/shared-react/components/render-widget.d.ts +0 -12
- package/dist/shared-react/components/types.d.ts +0 -42
- package/dist/shared-react/hooks/index.d.ts +0 -1
- package/dist/shared-react/hooks/use-form-widget-state.d.ts +0 -12
- package/dist/shared-react/hooks/use-form.d.ts +0 -16
- package/dist/shared-react/index.d.ts +0 -4
- package/dist/svelte/components/FormRendererRegistration.svelte.d.ts +0 -18
- package/dist/svelte/components/RenderWidget.svelte.d.ts +0 -11
- package/dist/svelte/components/annotations/FormCheckbox.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/FormCombobox.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/FormListbox.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/FormRadioButton.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/FormTextField.svelte.d.ts +0 -5
- package/dist/svelte/components/fields/ComboboxField.svelte.d.ts +0 -4
- package/dist/svelte/components/fields/ListboxField.svelte.d.ts +0 -4
- package/dist/svelte/components/fields/TextField.svelte.d.ts +0 -4
- package/dist/svelte/components/fill-mode/ComboboxFillMode.svelte.d.ts +0 -5
- package/dist/svelte/components/fill-mode/ListboxFillMode.svelte.d.ts +0 -5
- package/dist/svelte/components/fill-mode/RadioButtonFillMode.svelte.d.ts +0 -5
- package/dist/svelte/components/fill-mode/TextFillMode.svelte.d.ts +0 -5
- package/dist/svelte/components/fill-mode/ToggleFillMode.svelte.d.ts +0 -5
- package/dist/svelte/components/form-renderers.d.ts +0 -9
- package/dist/svelte/components/previews/CheckboxPreview.svelte.d.ts +0 -9
- package/dist/svelte/components/previews/ListboxPreview.svelte.d.ts +0 -9
- package/dist/svelte/components/previews/RadioButtonPreview.svelte.d.ts +0 -9
- package/dist/svelte/components/previews/TextFieldPreview.svelte.d.ts +0 -9
- package/dist/svelte/hooks/index.d.ts +0 -2
- package/dist/svelte/hooks/use-form-widget-state.svelte.d.ts +0 -12
- package/dist/svelte/hooks/use-form.svelte.d.ts +0 -14
- package/dist/svelte/index.cjs +0 -2
- package/dist/svelte/index.cjs.map +0 -1
- package/dist/svelte/index.d.ts +0 -3
- package/dist/svelte/index.js +0 -1592
- package/dist/svelte/index.js.map +0 -1
- package/dist/vue/components/annotations/form-checkbox.vue.d.ts +0 -6
- package/dist/vue/components/annotations/form-combobox.vue.d.ts +0 -6
- package/dist/vue/components/annotations/form-listbox.vue.d.ts +0 -6
- package/dist/vue/components/annotations/form-radio-button.vue.d.ts +0 -6
- package/dist/vue/components/annotations/form-text-field.vue.d.ts +0 -6
- package/dist/vue/components/fields/combobox-field.vue.d.ts +0 -4
- package/dist/vue/components/fields/listbox-field.vue.d.ts +0 -4
- package/dist/vue/components/fields/style.d.ts +0 -6
- package/dist/vue/components/fields/text-field.vue.d.ts +0 -4
- package/dist/vue/components/fill-mode/combobox-fill-mode.vue.d.ts +0 -6
- package/dist/vue/components/fill-mode/listbox-fill-mode.vue.d.ts +0 -6
- package/dist/vue/components/fill-mode/radio-button-fill-mode.vue.d.ts +0 -6
- package/dist/vue/components/fill-mode/text-fill-mode.vue.d.ts +0 -6
- package/dist/vue/components/fill-mode/toggle-fill-mode.vue.d.ts +0 -6
- package/dist/vue/components/form-renderer-registration.vue.d.ts +0 -13
- package/dist/vue/components/form-renderers.d.ts +0 -3
- package/dist/vue/components/previews/checkbox-preview.vue.d.ts +0 -10
- package/dist/vue/components/previews/listbox-preview.vue.d.ts +0 -10
- package/dist/vue/components/previews/radio-button-preview.vue.d.ts +0 -10
- package/dist/vue/components/previews/text-field-preview.vue.d.ts +0 -10
- package/dist/vue/components/render-widget.vue.d.ts +0 -15
- package/dist/vue/hooks/index.d.ts +0 -2
- package/dist/vue/hooks/use-form-widget-state.d.ts +0 -12
- package/dist/vue/hooks/use-form.d.ts +0 -12
- package/dist/vue/index.cjs +0 -2
- package/dist/vue/index.cjs.map +0 -1
- package/dist/vue/index.d.ts +0 -3
- package/dist/vue/index.js +0 -1643
- package/dist/vue/index.js.map +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { AnnotationRef, DocumentHandle, FormDataExport, FormDataFormat, FormEffectsResult, FormFieldDTO, FormFieldDTO as FormFieldDTO$1, FormFieldFamily, FormFieldOption, FormFieldPatch, FormFieldPatch as FormFieldPatch$1, FormFieldRef, FormFieldValue, FormImportResult, FormRepairOptions, FormRepairResult, FormSetValueResult, FormSnapshot, PdfActionTree, WidgetAppearance, WidgetAppearance as WidgetAppearance$1 } from "@embedpdf/engine-core/runtime";
|
|
2
|
+
import { ScriptBudget, ScriptDiagnostic, ScriptExecutionError, ScriptIdentity, ScriptUiEffect } from "@embedpdf/core-acrojs";
|
|
3
|
+
import { ScriptSandboxFactory } from "@embedpdf/core-js-sandbox";
|
|
4
|
+
import { DocumentMeta } from "@embedpdf/core";
|
|
5
|
+
import { AnnotationPropsPatch, ClickCreate } from "@embedpdf/plugin-annotation";
|
|
6
|
+
//#region src/core/model.d.ts
|
|
7
|
+
/** A content-space box (top-left origin, y-down, PDF points). */
|
|
8
|
+
interface Box {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
/** Stable client key for a field: object number when durable, else FQN. */
|
|
15
|
+
type FieldKey = string;
|
|
16
|
+
declare const fieldKeyOf: (field: {
|
|
17
|
+
fieldObjectNumber: number;
|
|
18
|
+
name: string;
|
|
19
|
+
}) => FieldKey;
|
|
20
|
+
interface Model {
|
|
21
|
+
/** Engine truth; replaced wholesale on refresh, patched on write-backs. */
|
|
22
|
+
snapshot: FormSnapshot | null;
|
|
23
|
+
/** fieldKey → index into snapshot.fields. */
|
|
24
|
+
byKey: Record<FieldKey, number>;
|
|
25
|
+
/** annotObjectNumber → index into snapshot.fields (widget → field join). */
|
|
26
|
+
byWidget: Record<number, number>;
|
|
27
|
+
/** Fields with an in-flight engine write (disables their controls). */
|
|
28
|
+
writing: Record<FieldKey, true>;
|
|
29
|
+
/**
|
|
30
|
+
* Widget geometry per page: annotObjectNumber → content-space box. Fed by
|
|
31
|
+
* the shell from the WIDGET plane (one annotations read per page); value
|
|
32
|
+
* writes never move widgets, so this survives snapshot refreshes and is
|
|
33
|
+
* only cleared on structural form events.
|
|
34
|
+
*/
|
|
35
|
+
geom: Record<number, Record<number, Box> | undefined>;
|
|
36
|
+
/** Bumped on every change — cheap equality for memoized projections. */
|
|
37
|
+
seq: number;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/core/fill-items.d.ts
|
|
41
|
+
interface FillItemBase {
|
|
42
|
+
key: FieldKey;
|
|
43
|
+
/** Widget identity — joins to the annotation plane. */
|
|
44
|
+
annotObjectNumber: number;
|
|
45
|
+
box: Box;
|
|
46
|
+
/** Read-only field or write in flight: render, don't accept input. */
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
/** Accessible name: /TU when present, else the fully qualified name. */
|
|
49
|
+
label: string;
|
|
50
|
+
}
|
|
51
|
+
type FillItem = FillItemBase & ({
|
|
52
|
+
control: 'text';
|
|
53
|
+
value: string;
|
|
54
|
+
multiline: boolean;
|
|
55
|
+
password: boolean;
|
|
56
|
+
maxLength: number | null;
|
|
57
|
+
comb: boolean;
|
|
58
|
+
} | {
|
|
59
|
+
control: 'toggle';
|
|
60
|
+
kind: 'checkbox' | 'radio';
|
|
61
|
+
checked: boolean;
|
|
62
|
+
onState: string;
|
|
63
|
+
} | {
|
|
64
|
+
control: 'choice';
|
|
65
|
+
kind: 'combo' | 'list';
|
|
66
|
+
edit: boolean;
|
|
67
|
+
multi: boolean;
|
|
68
|
+
options: FormFieldOption[];
|
|
69
|
+
selected: string[];
|
|
70
|
+
} | {
|
|
71
|
+
control: 'button';
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/types.d.ts
|
|
75
|
+
interface FormState {
|
|
76
|
+
model: Model;
|
|
77
|
+
}
|
|
78
|
+
interface FormScriptingOptions {
|
|
79
|
+
/** Explicit opt-in. PDF JavaScript remains inert when false/omitted. */
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
/** Override the lazy QuickJS factory (tests or another isolated VM). */
|
|
82
|
+
sandboxFactory?: ScriptSandboxFactory;
|
|
83
|
+
/** Optional embedder identity fields layered over engine/JWT identity. */
|
|
84
|
+
identity?: Partial<ScriptIdentity> | (() => Partial<ScriptIdentity>);
|
|
85
|
+
/** Target document filename exposed as `this.documentFileName`. */
|
|
86
|
+
fileName?: () => string;
|
|
87
|
+
/** Injected deterministic transaction environment. */
|
|
88
|
+
now?: () => number;
|
|
89
|
+
utcOffsetMinutes?: () => number;
|
|
90
|
+
randomSeed?: () => number;
|
|
91
|
+
budget?: ScriptBudget;
|
|
92
|
+
/** Framework/application port for app.alert, print, and page navigation. */
|
|
93
|
+
onUiEffect?: (effect: ScriptUiEffect) => void;
|
|
94
|
+
onDiagnostic?: (diagnostic: ScriptDiagnostic) => void;
|
|
95
|
+
onError?: (error: ScriptExecutionError) => void;
|
|
96
|
+
}
|
|
97
|
+
interface FormPluginOptions {
|
|
98
|
+
scripting?: FormScriptingOptions;
|
|
99
|
+
}
|
|
100
|
+
type FormCommitStatus = 'applied' | 'unchanged' | 'rejected' | 'failed';
|
|
101
|
+
interface FormCommitResult {
|
|
102
|
+
status: FormCommitStatus;
|
|
103
|
+
scripted: boolean;
|
|
104
|
+
effectsResult: FormEffectsResult | null;
|
|
105
|
+
uiEffects: FormUiEffect[];
|
|
106
|
+
diagnostics: ScriptDiagnostic[];
|
|
107
|
+
error?: ScriptExecutionError;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One DOM-free UI request produced by the curated Acrobat scripting surface.
|
|
111
|
+
* `phase` says WHO asked: `'boot'` = a document-open script (Adobe's
|
|
112
|
+
* version-check boilerplate lives here — embedders typically suppress these
|
|
113
|
+
* nags), `'user'` = a script triggered by the user's own interaction (a
|
|
114
|
+
* validation alert — show it).
|
|
115
|
+
*/
|
|
116
|
+
type FormUiEffect = ScriptUiEffect & {
|
|
117
|
+
phase: 'boot' | 'user';
|
|
118
|
+
};
|
|
119
|
+
/** Runtime adapter for alerts, print requests, and zero-based page navigation. */
|
|
120
|
+
type FormUiEffectProvider = (effect: FormUiEffect) => void;
|
|
121
|
+
/** Input for {@link FormCapability.placeField}. */
|
|
122
|
+
interface PlaceFieldInput {
|
|
123
|
+
family: Exclude<FormFieldFamily, 'pushbutton' | 'signature' | 'unknown'>;
|
|
124
|
+
pageObjectNumber: number;
|
|
125
|
+
/** Content-space LOGICAL field box (no visual padding semantics). */
|
|
126
|
+
box: Box;
|
|
127
|
+
/** Widget styling in the engine vocabulary (`WidgetAppearance`). Convert a
|
|
128
|
+
* tool's flat CSS defaults with `widgetAppearanceFromProps` from
|
|
129
|
+
* `@embedpdf/plugin-annotation`. Omitted → the engine's bare defaults. */
|
|
130
|
+
appearance?: WidgetAppearance$1;
|
|
131
|
+
}
|
|
132
|
+
/** What {@link FormCapability.placeField} created. */
|
|
133
|
+
interface PlacedField {
|
|
134
|
+
field: FormFieldDTO$1;
|
|
135
|
+
/** The widget placed on the requested page (join key to the annotation
|
|
136
|
+
* plane for auto-selection), or null when the engine reported none. */
|
|
137
|
+
widget: FormFieldDTO$1['widgets'][number] | null;
|
|
138
|
+
}
|
|
139
|
+
type FormAction = {
|
|
140
|
+
type: 'SET_MODEL';
|
|
141
|
+
model: Model;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The form plugin's public capability: the FIELD plane. Widgets stay
|
|
145
|
+
* annotations (geometry/appearance live there); this surface owns values,
|
|
146
|
+
* interchange, and the fill-mode projection.
|
|
147
|
+
*/
|
|
148
|
+
interface FormCapability {
|
|
149
|
+
/** The current reconciled form state (null until the first load lands). */
|
|
150
|
+
snapshot(): FormSnapshot | null;
|
|
151
|
+
/** Re-read the form from the engine (imports/repair/remote bursts). */
|
|
152
|
+
refresh(): Promise<void>;
|
|
153
|
+
/** Fill controls for one page — content-space, framework-agnostic. */
|
|
154
|
+
fillItems(pageObjectNumber: number): FillItem[];
|
|
155
|
+
/**
|
|
156
|
+
* The fill control for ONE widget, by annotation object number — the join
|
|
157
|
+
* the annotation-plane render layer uses (its RenderItem carries the live
|
|
158
|
+
* box, so this item's `box` is advisory). Reference-stable per model change.
|
|
159
|
+
* Null until the snapshot lands, or for families with no fill control.
|
|
160
|
+
*/
|
|
161
|
+
fillItem(annotObjectNumber: number): FillItem | null;
|
|
162
|
+
/** Make sure a page's widget geometry is loaded (idempotent, lazy). */
|
|
163
|
+
ensureGeom(pageObjectNumber: number): void;
|
|
164
|
+
field(key: FieldKey): FormFieldDTO$1 | null;
|
|
165
|
+
fieldForWidget(annotObjectNumber: number): FormFieldDTO$1 | null;
|
|
166
|
+
/** Commit a text value (call on blur/Enter — keystrokes stay local). */
|
|
167
|
+
setText(key: FieldKey, value: string): Promise<void>;
|
|
168
|
+
/** Toggle a checkbox/radio widget by its on-state; null clears the group. */
|
|
169
|
+
toggle(key: FieldKey, onState: string | null): Promise<void>;
|
|
170
|
+
/** Select choice options by export value. */
|
|
171
|
+
choose(key: FieldKey, values: string[]): Promise<void>;
|
|
172
|
+
/** Commit one originating-client value transaction, including K/V/C/F scripts when enabled. */
|
|
173
|
+
commitValue(ref: FormFieldRef, value: FormFieldValue): Promise<FormCommitResult>;
|
|
174
|
+
/** Execute one widget's `/A` activation action (and `/Next`) when scripting is enabled. */
|
|
175
|
+
activateWidget(key: FieldKey, annotationRef: AnnotationRef): Promise<FormCommitResult>;
|
|
176
|
+
/** Install the framework/application adapter for script-produced UI requests. */
|
|
177
|
+
setUiEffectProvider(provider: FormUiEffectProvider | null): void;
|
|
178
|
+
/** Restore a field to its /DV default. */
|
|
179
|
+
reset(key: FieldKey): Promise<void>;
|
|
180
|
+
/** Raw engine passthrough for anything the sugar above doesn't cover. */
|
|
181
|
+
setValue(ref: FormFieldRef, value: FormFieldValue): Promise<FormSetValueResult>;
|
|
182
|
+
exportData(format?: FormDataFormat): Promise<FormDataExport>;
|
|
183
|
+
importData(data: Uint8Array | ArrayBuffer, format?: FormDataFormat): Promise<FormImportResult>;
|
|
184
|
+
repair(options?: FormRepairOptions): Promise<FormRepairResult>;
|
|
185
|
+
/**
|
|
186
|
+
* Create a field of `family` with one styled widget at a content-space box
|
|
187
|
+
* — the palette tools' commit, and the programmatic authoring entry (works
|
|
188
|
+
* with NO annotation plugin: a pure `doc.forms` call). The box is clamped
|
|
189
|
+
* to the page; sizing policy (click default vs drag rect) is the caller's.
|
|
190
|
+
* The field gets a deterministic auto-name (`text_1`, …; rename in the
|
|
191
|
+
* field panel). Resolves AFTER the annotation plane (when present) has
|
|
192
|
+
* re-read the page, so the returned widget is immediately selectable.
|
|
193
|
+
*/
|
|
194
|
+
placeField(input: PlaceFieldInput): Promise<PlacedField>;
|
|
195
|
+
/** The page's content box (`{0,0,w,h}`) — page-bound placement math. */
|
|
196
|
+
pageBox(pageObjectNumber: number): Box | null;
|
|
197
|
+
/** Field-plane properties: name, required, options, default value. */
|
|
198
|
+
updateField(key: FieldKey, patch: FormFieldPatch$1): Promise<void>;
|
|
199
|
+
/** Delete the field and every widget of it (cascades on the page). */
|
|
200
|
+
deleteField(key: FieldKey): Promise<void>;
|
|
201
|
+
/** Unlink one widget: it stays as an inert annotation, the field survives. */
|
|
202
|
+
detachWidget(key: FieldKey, annotObjectNumber: number): Promise<void>;
|
|
203
|
+
/** UI mirror of the engine gates (`doc.forms.fill` / `doc.forms.modify`). */
|
|
204
|
+
canFill(): boolean;
|
|
205
|
+
canModify(): boolean;
|
|
206
|
+
}
|
|
207
|
+
declare const FormToken: import("@embedpdf/core").CapabilityToken<FormCapability>;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/form.plugin.d.ts
|
|
210
|
+
/**
|
|
211
|
+
* The form plugin: the FIELD plane. Document-scoped; requires the
|
|
212
|
+
* interaction hub. Fill mode works with no annotation plugin at all —
|
|
213
|
+
* geometry is read from the engine's widget DTOs. When the annotation
|
|
214
|
+
* plugin IS present, a Behavior keeps widgets geometry-inert while the
|
|
215
|
+
* active tool carries 'form-fill' (the built-in pointer/pan tools do, so
|
|
216
|
+
* filling is the resting state) and stands the fill controls down under
|
|
217
|
+
* every other tool — the single-active-tool hub IS the mode switch.
|
|
218
|
+
* Design mode = the 'form-edit' / palette tools: no 'form-fill' tag, so
|
|
219
|
+
* widgets become ordinary editable annotations.
|
|
220
|
+
*/
|
|
221
|
+
declare const formPlugin: (options?: FormPluginOptions) => import("@embedpdf/core").PluginDef<FormState, FormAction, FormCapability>;
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/scripting.d.ts
|
|
224
|
+
interface FormScriptingControllerOptions {
|
|
225
|
+
doc: DocumentHandle;
|
|
226
|
+
document(): DocumentMeta | null;
|
|
227
|
+
config: FormScriptingOptions;
|
|
228
|
+
sandboxFactory: ScriptSandboxFactory;
|
|
229
|
+
}
|
|
230
|
+
declare class FormScriptingController {
|
|
231
|
+
private readonly options;
|
|
232
|
+
private sandboxPromise;
|
|
233
|
+
private booted;
|
|
234
|
+
private disposed;
|
|
235
|
+
private sequence;
|
|
236
|
+
constructor(options: FormScriptingControllerOptions);
|
|
237
|
+
dispose(): void;
|
|
238
|
+
commit(snapshot: FormSnapshot, ref: FormFieldRef, proposed: FormFieldValue): Promise<FormCommitResult>;
|
|
239
|
+
/** Execute one originating widget's activation action (`/A`, including `/Next`). */
|
|
240
|
+
activate(snapshot: FormSnapshot, ref: FormFieldRef, action: PdfActionTree): Promise<FormCommitResult>;
|
|
241
|
+
/** Run lazy document boot plus the `/CO` chain without a user field change. */
|
|
242
|
+
recalculate(snapshot: FormSnapshot): Promise<FormCommitResult>;
|
|
243
|
+
private transact;
|
|
244
|
+
private sandbox;
|
|
245
|
+
private failed;
|
|
246
|
+
private finishRejected;
|
|
247
|
+
}
|
|
248
|
+
declare function createFormScriptingController(options: FormScriptingControllerOptions): FormScriptingController;
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/mutationQueue.d.ts
|
|
251
|
+
/** Small promise-tail queue: failures never poison later mutations. */
|
|
252
|
+
declare function createSerialMutationQueue(): <T>(operation: () => Promise<T>) => Promise<T>;
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/tools.d.ts
|
|
255
|
+
/** The families the palette can author (no pushbutton/signature tools). */
|
|
256
|
+
type AuthorableFormFamily = Exclude<FormFieldFamily, 'pushbutton' | 'signature' | 'unknown'>;
|
|
257
|
+
interface FormToolDef {
|
|
258
|
+
id: string;
|
|
259
|
+
/** The field family `placeField` commits (the FORM plane's vocabulary). */
|
|
260
|
+
family: AuthorableFormFamily;
|
|
261
|
+
/** The client kind the ANNOTATION registry routes on (props panel).
|
|
262
|
+
* Not a PDF subtype — every widget is PDF `widget`; this is the view. */
|
|
263
|
+
visualKind: 'widget-text' | 'widget-choice' | 'widget-toggle';
|
|
264
|
+
/** What a bare click places (box policies only — fields are boxes). */
|
|
265
|
+
clickCreate: Extract<ClickCreate, {
|
|
266
|
+
width: number;
|
|
267
|
+
}>;
|
|
268
|
+
/** Seed drawing defaults: a placed field is VISIBLE (white box, gray
|
|
269
|
+
* border) and restylable per tool through the shared style panel. */
|
|
270
|
+
defaults: AnnotationPropsPatch;
|
|
271
|
+
cursor: string;
|
|
272
|
+
}
|
|
273
|
+
declare const FORM_TOOLS: readonly FormToolDef[];
|
|
274
|
+
declare const FORM_TOOL_BY_ID: ReadonlyMap<string, FormToolDef>;
|
|
275
|
+
//#endregion
|
|
276
|
+
export { type AuthorableFormFamily, type Box, FORM_TOOLS, FORM_TOOL_BY_ID, type FieldKey, type FillItem, type FormAction, type FormCapability, type FormCommitResult, type FormCommitStatus, type FormFieldDTO, type FormFieldPatch, type FormPluginOptions, FormScriptingController, type FormScriptingOptions, type FormState, FormToken, type FormToolDef, type FormUiEffect, type FormUiEffectProvider, type PlaceFieldInput, type PlacedField, type WidgetAppearance, createFormScriptingController, createSerialMutationQueue, fieldKeyOf, formPlugin };
|
|
277
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,277 @@
|
|
|
1
|
-
|
|
1
|
+
import { DocumentMeta } from "@embedpdf/core";
|
|
2
|
+
import { AnnotationPropsPatch, ClickCreate } from "@embedpdf/plugin-annotation";
|
|
3
|
+
import { ScriptBudget, ScriptDiagnostic, ScriptExecutionError, ScriptIdentity, ScriptUiEffect } from "@embedpdf/core-acrojs";
|
|
4
|
+
import { AnnotationRef, DocumentHandle, FormDataExport, FormDataFormat, FormEffectsResult, FormFieldDTO, FormFieldDTO as FormFieldDTO$1, FormFieldFamily, FormFieldOption, FormFieldPatch, FormFieldPatch as FormFieldPatch$1, FormFieldRef, FormFieldValue, FormImportResult, FormRepairOptions, FormRepairResult, FormSetValueResult, FormSnapshot, PdfActionTree, WidgetAppearance, WidgetAppearance as WidgetAppearance$1 } from "@embedpdf/engine-core/runtime";
|
|
5
|
+
import { ScriptSandboxFactory } from "@embedpdf/core-js-sandbox";
|
|
6
|
+
//#region src/core/model.d.ts
|
|
7
|
+
/** A content-space box (top-left origin, y-down, PDF points). */
|
|
8
|
+
interface Box {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
/** Stable client key for a field: object number when durable, else FQN. */
|
|
15
|
+
type FieldKey = string;
|
|
16
|
+
declare const fieldKeyOf: (field: {
|
|
17
|
+
fieldObjectNumber: number;
|
|
18
|
+
name: string;
|
|
19
|
+
}) => FieldKey;
|
|
20
|
+
interface Model {
|
|
21
|
+
/** Engine truth; replaced wholesale on refresh, patched on write-backs. */
|
|
22
|
+
snapshot: FormSnapshot | null;
|
|
23
|
+
/** fieldKey → index into snapshot.fields. */
|
|
24
|
+
byKey: Record<FieldKey, number>;
|
|
25
|
+
/** annotObjectNumber → index into snapshot.fields (widget → field join). */
|
|
26
|
+
byWidget: Record<number, number>;
|
|
27
|
+
/** Fields with an in-flight engine write (disables their controls). */
|
|
28
|
+
writing: Record<FieldKey, true>;
|
|
29
|
+
/**
|
|
30
|
+
* Widget geometry per page: annotObjectNumber → content-space box. Fed by
|
|
31
|
+
* the shell from the WIDGET plane (one annotations read per page); value
|
|
32
|
+
* writes never move widgets, so this survives snapshot refreshes and is
|
|
33
|
+
* only cleared on structural form events.
|
|
34
|
+
*/
|
|
35
|
+
geom: Record<number, Record<number, Box> | undefined>;
|
|
36
|
+
/** Bumped on every change — cheap equality for memoized projections. */
|
|
37
|
+
seq: number;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/core/fill-items.d.ts
|
|
41
|
+
interface FillItemBase {
|
|
42
|
+
key: FieldKey;
|
|
43
|
+
/** Widget identity — joins to the annotation plane. */
|
|
44
|
+
annotObjectNumber: number;
|
|
45
|
+
box: Box;
|
|
46
|
+
/** Read-only field or write in flight: render, don't accept input. */
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
/** Accessible name: /TU when present, else the fully qualified name. */
|
|
49
|
+
label: string;
|
|
50
|
+
}
|
|
51
|
+
type FillItem = FillItemBase & ({
|
|
52
|
+
control: 'text';
|
|
53
|
+
value: string;
|
|
54
|
+
multiline: boolean;
|
|
55
|
+
password: boolean;
|
|
56
|
+
maxLength: number | null;
|
|
57
|
+
comb: boolean;
|
|
58
|
+
} | {
|
|
59
|
+
control: 'toggle';
|
|
60
|
+
kind: 'checkbox' | 'radio';
|
|
61
|
+
checked: boolean;
|
|
62
|
+
onState: string;
|
|
63
|
+
} | {
|
|
64
|
+
control: 'choice';
|
|
65
|
+
kind: 'combo' | 'list';
|
|
66
|
+
edit: boolean;
|
|
67
|
+
multi: boolean;
|
|
68
|
+
options: FormFieldOption[];
|
|
69
|
+
selected: string[];
|
|
70
|
+
} | {
|
|
71
|
+
control: 'button';
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/types.d.ts
|
|
75
|
+
interface FormState {
|
|
76
|
+
model: Model;
|
|
77
|
+
}
|
|
78
|
+
interface FormScriptingOptions {
|
|
79
|
+
/** Explicit opt-in. PDF JavaScript remains inert when false/omitted. */
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
/** Override the lazy QuickJS factory (tests or another isolated VM). */
|
|
82
|
+
sandboxFactory?: ScriptSandboxFactory;
|
|
83
|
+
/** Optional embedder identity fields layered over engine/JWT identity. */
|
|
84
|
+
identity?: Partial<ScriptIdentity> | (() => Partial<ScriptIdentity>);
|
|
85
|
+
/** Target document filename exposed as `this.documentFileName`. */
|
|
86
|
+
fileName?: () => string;
|
|
87
|
+
/** Injected deterministic transaction environment. */
|
|
88
|
+
now?: () => number;
|
|
89
|
+
utcOffsetMinutes?: () => number;
|
|
90
|
+
randomSeed?: () => number;
|
|
91
|
+
budget?: ScriptBudget;
|
|
92
|
+
/** Framework/application port for app.alert, print, and page navigation. */
|
|
93
|
+
onUiEffect?: (effect: ScriptUiEffect) => void;
|
|
94
|
+
onDiagnostic?: (diagnostic: ScriptDiagnostic) => void;
|
|
95
|
+
onError?: (error: ScriptExecutionError) => void;
|
|
96
|
+
}
|
|
97
|
+
interface FormPluginOptions {
|
|
98
|
+
scripting?: FormScriptingOptions;
|
|
99
|
+
}
|
|
100
|
+
type FormCommitStatus = 'applied' | 'unchanged' | 'rejected' | 'failed';
|
|
101
|
+
interface FormCommitResult {
|
|
102
|
+
status: FormCommitStatus;
|
|
103
|
+
scripted: boolean;
|
|
104
|
+
effectsResult: FormEffectsResult | null;
|
|
105
|
+
uiEffects: FormUiEffect[];
|
|
106
|
+
diagnostics: ScriptDiagnostic[];
|
|
107
|
+
error?: ScriptExecutionError;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One DOM-free UI request produced by the curated Acrobat scripting surface.
|
|
111
|
+
* `phase` says WHO asked: `'boot'` = a document-open script (Adobe's
|
|
112
|
+
* version-check boilerplate lives here — embedders typically suppress these
|
|
113
|
+
* nags), `'user'` = a script triggered by the user's own interaction (a
|
|
114
|
+
* validation alert — show it).
|
|
115
|
+
*/
|
|
116
|
+
type FormUiEffect = ScriptUiEffect & {
|
|
117
|
+
phase: 'boot' | 'user';
|
|
118
|
+
};
|
|
119
|
+
/** Runtime adapter for alerts, print requests, and zero-based page navigation. */
|
|
120
|
+
type FormUiEffectProvider = (effect: FormUiEffect) => void;
|
|
121
|
+
/** Input for {@link FormCapability.placeField}. */
|
|
122
|
+
interface PlaceFieldInput {
|
|
123
|
+
family: Exclude<FormFieldFamily, 'pushbutton' | 'signature' | 'unknown'>;
|
|
124
|
+
pageObjectNumber: number;
|
|
125
|
+
/** Content-space LOGICAL field box (no visual padding semantics). */
|
|
126
|
+
box: Box;
|
|
127
|
+
/** Widget styling in the engine vocabulary (`WidgetAppearance`). Convert a
|
|
128
|
+
* tool's flat CSS defaults with `widgetAppearanceFromProps` from
|
|
129
|
+
* `@embedpdf/plugin-annotation`. Omitted → the engine's bare defaults. */
|
|
130
|
+
appearance?: WidgetAppearance$1;
|
|
131
|
+
}
|
|
132
|
+
/** What {@link FormCapability.placeField} created. */
|
|
133
|
+
interface PlacedField {
|
|
134
|
+
field: FormFieldDTO$1;
|
|
135
|
+
/** The widget placed on the requested page (join key to the annotation
|
|
136
|
+
* plane for auto-selection), or null when the engine reported none. */
|
|
137
|
+
widget: FormFieldDTO$1['widgets'][number] | null;
|
|
138
|
+
}
|
|
139
|
+
type FormAction = {
|
|
140
|
+
type: 'SET_MODEL';
|
|
141
|
+
model: Model;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The form plugin's public capability: the FIELD plane. Widgets stay
|
|
145
|
+
* annotations (geometry/appearance live there); this surface owns values,
|
|
146
|
+
* interchange, and the fill-mode projection.
|
|
147
|
+
*/
|
|
148
|
+
interface FormCapability {
|
|
149
|
+
/** The current reconciled form state (null until the first load lands). */
|
|
150
|
+
snapshot(): FormSnapshot | null;
|
|
151
|
+
/** Re-read the form from the engine (imports/repair/remote bursts). */
|
|
152
|
+
refresh(): Promise<void>;
|
|
153
|
+
/** Fill controls for one page — content-space, framework-agnostic. */
|
|
154
|
+
fillItems(pageObjectNumber: number): FillItem[];
|
|
155
|
+
/**
|
|
156
|
+
* The fill control for ONE widget, by annotation object number — the join
|
|
157
|
+
* the annotation-plane render layer uses (its RenderItem carries the live
|
|
158
|
+
* box, so this item's `box` is advisory). Reference-stable per model change.
|
|
159
|
+
* Null until the snapshot lands, or for families with no fill control.
|
|
160
|
+
*/
|
|
161
|
+
fillItem(annotObjectNumber: number): FillItem | null;
|
|
162
|
+
/** Make sure a page's widget geometry is loaded (idempotent, lazy). */
|
|
163
|
+
ensureGeom(pageObjectNumber: number): void;
|
|
164
|
+
field(key: FieldKey): FormFieldDTO$1 | null;
|
|
165
|
+
fieldForWidget(annotObjectNumber: number): FormFieldDTO$1 | null;
|
|
166
|
+
/** Commit a text value (call on blur/Enter — keystrokes stay local). */
|
|
167
|
+
setText(key: FieldKey, value: string): Promise<void>;
|
|
168
|
+
/** Toggle a checkbox/radio widget by its on-state; null clears the group. */
|
|
169
|
+
toggle(key: FieldKey, onState: string | null): Promise<void>;
|
|
170
|
+
/** Select choice options by export value. */
|
|
171
|
+
choose(key: FieldKey, values: string[]): Promise<void>;
|
|
172
|
+
/** Commit one originating-client value transaction, including K/V/C/F scripts when enabled. */
|
|
173
|
+
commitValue(ref: FormFieldRef, value: FormFieldValue): Promise<FormCommitResult>;
|
|
174
|
+
/** Execute one widget's `/A` activation action (and `/Next`) when scripting is enabled. */
|
|
175
|
+
activateWidget(key: FieldKey, annotationRef: AnnotationRef): Promise<FormCommitResult>;
|
|
176
|
+
/** Install the framework/application adapter for script-produced UI requests. */
|
|
177
|
+
setUiEffectProvider(provider: FormUiEffectProvider | null): void;
|
|
178
|
+
/** Restore a field to its /DV default. */
|
|
179
|
+
reset(key: FieldKey): Promise<void>;
|
|
180
|
+
/** Raw engine passthrough for anything the sugar above doesn't cover. */
|
|
181
|
+
setValue(ref: FormFieldRef, value: FormFieldValue): Promise<FormSetValueResult>;
|
|
182
|
+
exportData(format?: FormDataFormat): Promise<FormDataExport>;
|
|
183
|
+
importData(data: Uint8Array | ArrayBuffer, format?: FormDataFormat): Promise<FormImportResult>;
|
|
184
|
+
repair(options?: FormRepairOptions): Promise<FormRepairResult>;
|
|
185
|
+
/**
|
|
186
|
+
* Create a field of `family` with one styled widget at a content-space box
|
|
187
|
+
* — the palette tools' commit, and the programmatic authoring entry (works
|
|
188
|
+
* with NO annotation plugin: a pure `doc.forms` call). The box is clamped
|
|
189
|
+
* to the page; sizing policy (click default vs drag rect) is the caller's.
|
|
190
|
+
* The field gets a deterministic auto-name (`text_1`, …; rename in the
|
|
191
|
+
* field panel). Resolves AFTER the annotation plane (when present) has
|
|
192
|
+
* re-read the page, so the returned widget is immediately selectable.
|
|
193
|
+
*/
|
|
194
|
+
placeField(input: PlaceFieldInput): Promise<PlacedField>;
|
|
195
|
+
/** The page's content box (`{0,0,w,h}`) — page-bound placement math. */
|
|
196
|
+
pageBox(pageObjectNumber: number): Box | null;
|
|
197
|
+
/** Field-plane properties: name, required, options, default value. */
|
|
198
|
+
updateField(key: FieldKey, patch: FormFieldPatch$1): Promise<void>;
|
|
199
|
+
/** Delete the field and every widget of it (cascades on the page). */
|
|
200
|
+
deleteField(key: FieldKey): Promise<void>;
|
|
201
|
+
/** Unlink one widget: it stays as an inert annotation, the field survives. */
|
|
202
|
+
detachWidget(key: FieldKey, annotObjectNumber: number): Promise<void>;
|
|
203
|
+
/** UI mirror of the engine gates (`doc.forms.fill` / `doc.forms.modify`). */
|
|
204
|
+
canFill(): boolean;
|
|
205
|
+
canModify(): boolean;
|
|
206
|
+
}
|
|
207
|
+
declare const FormToken: import("@embedpdf/core").CapabilityToken<FormCapability>;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/form.plugin.d.ts
|
|
210
|
+
/**
|
|
211
|
+
* The form plugin: the FIELD plane. Document-scoped; requires the
|
|
212
|
+
* interaction hub. Fill mode works with no annotation plugin at all —
|
|
213
|
+
* geometry is read from the engine's widget DTOs. When the annotation
|
|
214
|
+
* plugin IS present, a Behavior keeps widgets geometry-inert while the
|
|
215
|
+
* active tool carries 'form-fill' (the built-in pointer/pan tools do, so
|
|
216
|
+
* filling is the resting state) and stands the fill controls down under
|
|
217
|
+
* every other tool — the single-active-tool hub IS the mode switch.
|
|
218
|
+
* Design mode = the 'form-edit' / palette tools: no 'form-fill' tag, so
|
|
219
|
+
* widgets become ordinary editable annotations.
|
|
220
|
+
*/
|
|
221
|
+
declare const formPlugin: (options?: FormPluginOptions) => import("@embedpdf/core").PluginDef<FormState, FormAction, FormCapability>;
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/scripting.d.ts
|
|
224
|
+
interface FormScriptingControllerOptions {
|
|
225
|
+
doc: DocumentHandle;
|
|
226
|
+
document(): DocumentMeta | null;
|
|
227
|
+
config: FormScriptingOptions;
|
|
228
|
+
sandboxFactory: ScriptSandboxFactory;
|
|
229
|
+
}
|
|
230
|
+
declare class FormScriptingController {
|
|
231
|
+
private readonly options;
|
|
232
|
+
private sandboxPromise;
|
|
233
|
+
private booted;
|
|
234
|
+
private disposed;
|
|
235
|
+
private sequence;
|
|
236
|
+
constructor(options: FormScriptingControllerOptions);
|
|
237
|
+
dispose(): void;
|
|
238
|
+
commit(snapshot: FormSnapshot, ref: FormFieldRef, proposed: FormFieldValue): Promise<FormCommitResult>;
|
|
239
|
+
/** Execute one originating widget's activation action (`/A`, including `/Next`). */
|
|
240
|
+
activate(snapshot: FormSnapshot, ref: FormFieldRef, action: PdfActionTree): Promise<FormCommitResult>;
|
|
241
|
+
/** Run lazy document boot plus the `/CO` chain without a user field change. */
|
|
242
|
+
recalculate(snapshot: FormSnapshot): Promise<FormCommitResult>;
|
|
243
|
+
private transact;
|
|
244
|
+
private sandbox;
|
|
245
|
+
private failed;
|
|
246
|
+
private finishRejected;
|
|
247
|
+
}
|
|
248
|
+
declare function createFormScriptingController(options: FormScriptingControllerOptions): FormScriptingController;
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/mutationQueue.d.ts
|
|
251
|
+
/** Small promise-tail queue: failures never poison later mutations. */
|
|
252
|
+
declare function createSerialMutationQueue(): <T>(operation: () => Promise<T>) => Promise<T>;
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/tools.d.ts
|
|
255
|
+
/** The families the palette can author (no pushbutton/signature tools). */
|
|
256
|
+
type AuthorableFormFamily = Exclude<FormFieldFamily, 'pushbutton' | 'signature' | 'unknown'>;
|
|
257
|
+
interface FormToolDef {
|
|
258
|
+
id: string;
|
|
259
|
+
/** The field family `placeField` commits (the FORM plane's vocabulary). */
|
|
260
|
+
family: AuthorableFormFamily;
|
|
261
|
+
/** The client kind the ANNOTATION registry routes on (props panel).
|
|
262
|
+
* Not a PDF subtype — every widget is PDF `widget`; this is the view. */
|
|
263
|
+
visualKind: 'widget-text' | 'widget-choice' | 'widget-toggle';
|
|
264
|
+
/** What a bare click places (box policies only — fields are boxes). */
|
|
265
|
+
clickCreate: Extract<ClickCreate, {
|
|
266
|
+
width: number;
|
|
267
|
+
}>;
|
|
268
|
+
/** Seed drawing defaults: a placed field is VISIBLE (white box, gray
|
|
269
|
+
* border) and restylable per tool through the shared style panel. */
|
|
270
|
+
defaults: AnnotationPropsPatch;
|
|
271
|
+
cursor: string;
|
|
272
|
+
}
|
|
273
|
+
declare const FORM_TOOLS: readonly FormToolDef[];
|
|
274
|
+
declare const FORM_TOOL_BY_ID: ReadonlyMap<string, FormToolDef>;
|
|
275
|
+
//#endregion
|
|
276
|
+
export { type AuthorableFormFamily, type Box, FORM_TOOLS, FORM_TOOL_BY_ID, type FieldKey, type FillItem, type FormAction, type FormCapability, type FormCommitResult, type FormCommitStatus, type FormFieldDTO, type FormFieldPatch, type FormPluginOptions, FormScriptingController, type FormScriptingOptions, type FormState, FormToken, type FormToolDef, type FormUiEffect, type FormUiEffectProvider, type PlaceFieldInput, type PlacedField, type WidgetAppearance, createFormScriptingController, createSerialMutationQueue, fieldKeyOf, formPlugin };
|
|
277
|
+
//# sourceMappingURL=index.d.ts.map
|