@embedpdf/plugin-stamp 3.0.0-next.2 → 3.0.0-next.20
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-BQP56Vp4.d.cts +449 -0
- package/dist/contract-D6Hs6iO3.d.ts +449 -0
- package/dist/contract-DHcn38S9.js +87 -0
- package/dist/contract-DHcn38S9.js.map +1 -0
- package/dist/contract-Dj5KiMyW.cjs +157 -0
- package/dist/contract-Dj5KiMyW.cjs.map +1 -0
- package/dist/contract.cjs +5 -0
- package/dist/contract.d.cts +2 -0
- package/dist/contract.d.ts +2 -0
- package/dist/contract.js +2 -0
- package/dist/index.cjs +1403 -474
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -179
- package/dist/index.d.ts +21 -179
- package/dist/index.js +1398 -475
- package/dist/index.js.map +1 -1
- package/package.json +15 -8
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { BatchResult, DeepPartial, EventHook, OperationOptions, SettingsApi } from "@embedpdf/core";
|
|
2
|
+
import { Annotation, AnnotationRef, BinarySource, LocalEngine, PageRef } from "@embedpdf/engine-core/runtime";
|
|
3
|
+
import { StampPlacement, StampPlacement as StampPlacement$1 } from "@embedpdf/plugin-annotation/contract";
|
|
4
|
+
//#region src/token.d.ts
|
|
5
|
+
declare const StampToken: import("@embedpdf/core").CapabilityToken<StampCapability>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/convention.d.ts
|
|
8
|
+
/** The library kind every file has unless it says otherwise. */
|
|
9
|
+
declare const DEFAULT_LIBRARY_KIND = "stamps";
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/persistence.d.ts
|
|
12
|
+
/** The persistence port: bytes by library id. */
|
|
13
|
+
interface StampLibraryStore {
|
|
14
|
+
list(): Promise<Array<{
|
|
15
|
+
id: string;
|
|
16
|
+
bytes: Uint8Array;
|
|
17
|
+
}>>;
|
|
18
|
+
put(id: string, bytes: Uint8Array): Promise<void>;
|
|
19
|
+
delete(id: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** An in-memory store, for tests and SSR. */
|
|
22
|
+
declare function memoryStampStore(): StampLibraryStore;
|
|
23
|
+
/**
|
|
24
|
+
* Bring every stored library back: each PDF is imported as-is (its title,
|
|
25
|
+
* registry, and PieceInfo id come from the file; the store's key is only a
|
|
26
|
+
* hint). Call once at boot, before seeding defaults, so "already has
|
|
27
|
+
* libraries" means the user's own.
|
|
28
|
+
*/
|
|
29
|
+
declare function restoreStampLibraries(stamp: Pick<StampCapability, 'importLibrary'>, store: StampLibraryStore): Promise<string[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Keep the store in sync from now on: every canonical change saves the
|
|
32
|
+
* library's PDF, a removal deletes it. `except` names libraries never to
|
|
33
|
+
* persist (the bundled default set, typically). Returns the unsubscribe;
|
|
34
|
+
* work already asked for still finishes.
|
|
35
|
+
*
|
|
36
|
+
* Each library has one line of store work, so saves never overlap and a
|
|
37
|
+
* delete never lands under a late save. The changes of one burst (one call
|
|
38
|
+
* into the plugin) are one save; the changes made while a save runs are one
|
|
39
|
+
* more after it.
|
|
40
|
+
*/
|
|
41
|
+
declare function persistStampLibraries(stamp: Pick<StampCapability, 'exportLibrary' | 'onLibraryChanged'>, store: StampLibraryStore, options?: {
|
|
42
|
+
except?: readonly string[];
|
|
43
|
+
}): () => void;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/contract.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* The stamp plugin: a workspace-scoped asset substrate.
|
|
48
|
+
*
|
|
49
|
+
* The design law ("documents have a home; assets ride the wire"): imported
|
|
50
|
+
* PDF libraries retain one canonical PDF whose catalog/page `/PieceInfo`
|
|
51
|
+
* carries their metadata. Per-asset PDFs and previews are derived caches used
|
|
52
|
+
* for placement. Standalone PNG/JPEG assets remain loose because the engine
|
|
53
|
+
* intentionally has no raster-to-PDF-page authoring primitive.
|
|
54
|
+
*/
|
|
55
|
+
type StampAssetKind = 'stamp' | 'signature' | 'initials';
|
|
56
|
+
/**
|
|
57
|
+
* What a library file is for: the routing key a surface queries by. Open:
|
|
58
|
+
* the plugin defines `stamps` (the default) and `signatures`; an embedder
|
|
59
|
+
* may define its own (`toolbar`, `legal-seals`). Persisted in the file.
|
|
60
|
+
*/
|
|
61
|
+
type StampLibraryKind = string;
|
|
62
|
+
/**
|
|
63
|
+
* How a mark is authored: drawn strokes (kept as a vector path), typed text
|
|
64
|
+
* in a standard font or one of the `fonts` setting's (embedded by the
|
|
65
|
+
* flatten), a raster image, or a page
|
|
66
|
+
* of a PDF. Ink strokes are in points, from the top-left and y down like
|
|
67
|
+
* every page position, any origin — the asset page is the mark's bounds.
|
|
68
|
+
*/
|
|
69
|
+
type MarkSource = {
|
|
70
|
+
kind: 'ink';
|
|
71
|
+
strokes: ReadonlyArray<ReadonlyArray<{
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
}>>;
|
|
75
|
+
color?: string;
|
|
76
|
+
strokeWidth?: number;
|
|
77
|
+
} | {
|
|
78
|
+
kind: 'text';
|
|
79
|
+
text: string;
|
|
80
|
+
fontFamily: string;
|
|
81
|
+
color?: string;
|
|
82
|
+
fontSize?: number;
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'image';
|
|
85
|
+
source: BinarySource;
|
|
86
|
+
} | {
|
|
87
|
+
kind: 'pdf';
|
|
88
|
+
source: BinarySource;
|
|
89
|
+
pageIndex?: number;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* One asset's serializable descriptor. The bytes and the cached preview are
|
|
93
|
+
* deliberately not here: session state holds serializable data only, and
|
|
94
|
+
* binary lives in the capability and crosses only as call arguments and
|
|
95
|
+
* return values, mirroring the engine's own BinarySource rule.
|
|
96
|
+
*/
|
|
97
|
+
interface StampAsset {
|
|
98
|
+
/** Derived and stable: `${libraryId}:${name}` (never allocated). */
|
|
99
|
+
id: string;
|
|
100
|
+
libraryId: string;
|
|
101
|
+
kind: StampAssetKind;
|
|
102
|
+
/**
|
|
103
|
+
* The stamp's identifier: the text before the first `=` in its library
|
|
104
|
+
* key, and the placed annotation's `/Name`: a standard name (`Approved`)
|
|
105
|
+
* or a custom one (`#LBGiYhk8V_oAfmqAPENiwD`). Not display text.
|
|
106
|
+
*/
|
|
107
|
+
name: string;
|
|
108
|
+
/** What the picker shows and the placed annotation's default `/Subj`:
|
|
109
|
+
* the text after `=` in the library key (`Goedgekeurd`). */
|
|
110
|
+
label: string;
|
|
111
|
+
/** Intrinsic size in PDF points (the source page's crop box / image pixels 1:1). */
|
|
112
|
+
size: {
|
|
113
|
+
width: number;
|
|
114
|
+
height: number;
|
|
115
|
+
};
|
|
116
|
+
/** The library page that is this asset. Every asset is a page: a raster
|
|
117
|
+
* added to a library becomes a page carrying the image. */
|
|
118
|
+
page: PageRef;
|
|
119
|
+
/** An explicit `/Subj` override (PieceInfo); placements use `label` otherwise. */
|
|
120
|
+
subject?: string;
|
|
121
|
+
categories?: string[];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A library is a PDF: its `/Title` is the name, its `/Names /Pages` registry
|
|
125
|
+
* the assets, its pages the artwork, PieceInfo only what has no standard
|
|
126
|
+
* home. One imported PDF becomes one library; `exportLibrary` returns it.
|
|
127
|
+
*/
|
|
128
|
+
interface StampLibrary {
|
|
129
|
+
/** PieceInfo `Id`: stable while the title is editable. */
|
|
130
|
+
id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
/** PieceInfo `Kind`: `'stamps'`, `'signatures'`, or an embedder's own. */
|
|
133
|
+
kind: StampLibraryKind;
|
|
134
|
+
/** PieceInfo `Locale`: the language of the labels, when the library says. */
|
|
135
|
+
locale?: string;
|
|
136
|
+
categories?: string[];
|
|
137
|
+
/** Asset ids in display order. */
|
|
138
|
+
assetIds: string[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The local engine stamp libraries open in, or a function that makes one. A
|
|
142
|
+
* function is called on the first import, not at startup, and its engine is
|
|
143
|
+
* destroyed with the plugin.
|
|
144
|
+
*/
|
|
145
|
+
type StampAssetEngine = LocalEngine | (() => LocalEngine | Promise<LocalEngine>);
|
|
146
|
+
/**
|
|
147
|
+
* A font typed marks can be written in (`mark: { kind: 'text', fontFamily: key }`), beyond the
|
|
148
|
+
* standard 14 and the asset engine's own: registered on the asset engine the first time a mark
|
|
149
|
+
* names it.
|
|
150
|
+
*/
|
|
151
|
+
interface StampFont {
|
|
152
|
+
/** What a typed mark's `fontFamily` names it by. */
|
|
153
|
+
readonly key: string;
|
|
154
|
+
/** Its TrueType or OpenType file, read the first time a mark names it. */
|
|
155
|
+
readonly load: () => Promise<Uint8Array>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The stamp plugin's settings. `stampPlugin(config)` registers them over
|
|
159
|
+
* {@link STAMP_DEFAULTS}, and `updateSettings()` changes them while the app
|
|
160
|
+
* runs.
|
|
161
|
+
*/
|
|
162
|
+
interface StampSettings {
|
|
163
|
+
/**
|
|
164
|
+
* The engine stamp libraries open in. `null` uses the viewer's own engine,
|
|
165
|
+
* which is right when that engine is local. A cloud viewer passes a local
|
|
166
|
+
* engine, or a function that makes one:
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* stampPlugin({
|
|
170
|
+
* assetEngine: () => import('@embedpdf/engine').then((module) => module.createLocalEngine()),
|
|
171
|
+
* })
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
readonly assetEngine: StampAssetEngine | null;
|
|
175
|
+
/**
|
|
176
|
+
* The fonts typed marks can be written in, each registered on the asset engine the first time
|
|
177
|
+
* a mark names it: a mark is written on the asset engine, so the font goes there, whichever
|
|
178
|
+
* engine the viewer draws with.
|
|
179
|
+
*/
|
|
180
|
+
readonly fonts: readonly StampFont[];
|
|
181
|
+
/** The width of a stamp's thumbnail, in device pixels. */
|
|
182
|
+
readonly previewWidth: number;
|
|
183
|
+
/**
|
|
184
|
+
* Fill in a dynamic stamp's form fields when it's armed or placed.
|
|
185
|
+
* Scripting itself is the workspace's one JavaScript switch,
|
|
186
|
+
* `actionsPlugin({ javascript: { enabled } })`: without the actions plugin,
|
|
187
|
+
* or with scripting off, a stamp is placed as it is. `false` keeps every
|
|
188
|
+
* stamp as reviewed, even with scripting on.
|
|
189
|
+
*/
|
|
190
|
+
readonly dynamic: boolean;
|
|
191
|
+
}
|
|
192
|
+
/** What the stamp settings are when the app registers none. */
|
|
193
|
+
declare const STAMP_DEFAULTS: StampSettings;
|
|
194
|
+
/** What `stampPlugin(config)` takes: any of the settings, merged over the defaults. */
|
|
195
|
+
type StampConfig = DeepPartial<StampSettings>;
|
|
196
|
+
/**
|
|
197
|
+
* Which document a placing verb acts on. Left out, it is the document in
|
|
198
|
+
* scope (`useStamp()` inside a `<DocumentScope>`, a document plugin's
|
|
199
|
+
* `ctx.get(StampToken)`), else the active document.
|
|
200
|
+
*/
|
|
201
|
+
interface StampDocumentOptions extends OperationOptions {
|
|
202
|
+
readonly documentId?: string;
|
|
203
|
+
}
|
|
204
|
+
/** `armAsset()`'s options. */
|
|
205
|
+
interface StampArmOptions extends StampDocumentOptions {
|
|
206
|
+
/** Placed width in PDF points; the stamp's own width by default. */
|
|
207
|
+
readonly targetWidth?: number;
|
|
208
|
+
}
|
|
209
|
+
interface CreateLibraryOptions extends OperationOptions {
|
|
210
|
+
/** The library's id; a fresh one when left out or taken. */
|
|
211
|
+
readonly id?: string;
|
|
212
|
+
/** What the library is for. Default `'stamps'`. */
|
|
213
|
+
readonly kind?: StampLibraryKind;
|
|
214
|
+
readonly categories?: string[];
|
|
215
|
+
}
|
|
216
|
+
interface StampLibraryPatch {
|
|
217
|
+
readonly name?: string;
|
|
218
|
+
readonly categories?: string[];
|
|
219
|
+
}
|
|
220
|
+
interface ImportLibraryOptions extends OperationOptions {
|
|
221
|
+
/**
|
|
222
|
+
* Fallback library name, applied only when the PDF carries no `/Title`
|
|
223
|
+
* (an Acrobat-authored or previously exported library names itself).
|
|
224
|
+
* Default `'Stamps'`.
|
|
225
|
+
*/
|
|
226
|
+
name?: string;
|
|
227
|
+
/** Library categories written to catalog `/PieceInfo`. */
|
|
228
|
+
categories?: string[];
|
|
229
|
+
/** Kind stamped onto every imported asset. Default `'stamp'`. */
|
|
230
|
+
kind?: StampAssetKind;
|
|
231
|
+
/** What the file is for; overrides what the file says (an Acrobat-authored set imported for a toolbar). */
|
|
232
|
+
libraryKind?: StampLibraryKind;
|
|
233
|
+
/**
|
|
234
|
+
* Fallback per-page labels for a plain PDF (no `/Names /Pages` registry):
|
|
235
|
+
* every page becomes a stamp named `Stamp<n>` with this label. Ignored
|
|
236
|
+
* when the PDF registers its stamps itself.
|
|
237
|
+
*/
|
|
238
|
+
assetName?: (pageIndex: number) => string;
|
|
239
|
+
}
|
|
240
|
+
interface AddAssetInput {
|
|
241
|
+
/** Target library; omitted, a new single-asset library named after the asset. */
|
|
242
|
+
libraryId?: string;
|
|
243
|
+
/** The identifier (placed `/Name`). Omit to mint an Acrobat-style `#…` one. */
|
|
244
|
+
name?: string;
|
|
245
|
+
/** Picker text and default `/Subj`. Defaults to `name`. */
|
|
246
|
+
label?: string;
|
|
247
|
+
kind?: StampAssetKind;
|
|
248
|
+
subject?: string;
|
|
249
|
+
categories?: string[];
|
|
250
|
+
/**
|
|
251
|
+
* PNG, JPEG, or single-page PDF bytes. Exactly one of `source` / `mark`. A
|
|
252
|
+
* raster becomes a page of the library sized to `size` (default: its
|
|
253
|
+
* pixels as points, 1:1) with the image flattened into it, so every asset
|
|
254
|
+
* is a page and every library a complete PDF.
|
|
255
|
+
*/
|
|
256
|
+
source?: BinarySource;
|
|
257
|
+
/** An authored mark: drawn, typed, an image, or a PDF page. Exactly one of `source` / `mark`. */
|
|
258
|
+
mark?: MarkSource;
|
|
259
|
+
/** Thumbnail override for pickers (PNG/JPEG); rendered from the page otherwise. */
|
|
260
|
+
preview?: BinarySource;
|
|
261
|
+
/** Page size in PDF points for a raster source. Ignored for PDF sources (the page has one). */
|
|
262
|
+
size?: {
|
|
263
|
+
width: number;
|
|
264
|
+
height: number;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
/** What `createAssetFromAnnotations()` takes besides the annotations: where the stamp goes and its name. */
|
|
268
|
+
type AssetFromAnnotationsInput = Omit<AddAssetInput, 'source' | 'mark' | 'size'>;
|
|
269
|
+
interface StampAssetPatch {
|
|
270
|
+
readonly label?: string;
|
|
271
|
+
/** `null` drops the subject override, so placements use the label. */
|
|
272
|
+
readonly subject?: string | null;
|
|
273
|
+
readonly categories?: string[];
|
|
274
|
+
}
|
|
275
|
+
/** A cached, browser-paintable render of an asset (PNG from import; raster assets as-is). */
|
|
276
|
+
interface StampAssetPreview {
|
|
277
|
+
bytes: Uint8Array;
|
|
278
|
+
mimeType: string;
|
|
279
|
+
}
|
|
280
|
+
interface StampLibraryFilter {
|
|
281
|
+
readonly kind?: StampLibraryKind | readonly StampLibraryKind[];
|
|
282
|
+
}
|
|
283
|
+
interface StampAssetFilter {
|
|
284
|
+
readonly libraryId?: string;
|
|
285
|
+
readonly kind?: StampAssetKind;
|
|
286
|
+
readonly category?: string;
|
|
287
|
+
}
|
|
288
|
+
/** A library's bytes changed, and why: the one to save it on. */
|
|
289
|
+
interface StampLibraryChangedEvent {
|
|
290
|
+
readonly libraryId: string;
|
|
291
|
+
readonly reason: 'created' | 'imported' | 'updated' | 'asset-added' | 'asset-updated' | 'asset-removed' | 'removed';
|
|
292
|
+
}
|
|
293
|
+
interface StampLibraryCreatedEvent {
|
|
294
|
+
readonly libraryId: string;
|
|
295
|
+
readonly library: StampLibrary;
|
|
296
|
+
}
|
|
297
|
+
interface StampLibraryUpdatedEvent {
|
|
298
|
+
readonly libraryId: string;
|
|
299
|
+
readonly library: StampLibrary;
|
|
300
|
+
}
|
|
301
|
+
interface StampLibraryDeletedEvent {
|
|
302
|
+
readonly libraryId: string;
|
|
303
|
+
readonly library: null;
|
|
304
|
+
}
|
|
305
|
+
interface StampAssetCreatedEvent {
|
|
306
|
+
readonly assetId: string;
|
|
307
|
+
readonly libraryId: string;
|
|
308
|
+
readonly asset: StampAsset;
|
|
309
|
+
}
|
|
310
|
+
interface StampAssetUpdatedEvent {
|
|
311
|
+
readonly assetId: string;
|
|
312
|
+
readonly libraryId: string;
|
|
313
|
+
readonly asset: StampAsset;
|
|
314
|
+
}
|
|
315
|
+
interface StampAssetDeletedEvent {
|
|
316
|
+
readonly assetId: string;
|
|
317
|
+
readonly libraryId: string;
|
|
318
|
+
readonly asset: null;
|
|
319
|
+
}
|
|
320
|
+
/** A stamp was armed on a document, or disarmed (`asset: null`). */
|
|
321
|
+
interface StampArmChangedEvent {
|
|
322
|
+
readonly documentId: string;
|
|
323
|
+
readonly asset: StampAsset | null;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Stamp libraries and their assets, shared by every document, and placing
|
|
327
|
+
* them on a document. The placing verbs act on the document in scope, else
|
|
328
|
+
* the active one, or the one their options name (`documentId`). A library is
|
|
329
|
+
* a PDF (one page per asset): `exportLibrary` returns the persistence format,
|
|
330
|
+
* `importLibrary` reads it back. Every verb rejects with a `PluginError`, and
|
|
331
|
+
* every async verb takes a `signal`: cancelled, it rejects
|
|
332
|
+
* `operation-cancelled` and changes nothing. The settings belong to the
|
|
333
|
+
* plugin, not to a document.
|
|
334
|
+
*/
|
|
335
|
+
interface StampCapability extends SettingsApi<StampSettings> {
|
|
336
|
+
listLibraries(filter?: StampLibraryFilter): readonly StampLibrary[];
|
|
337
|
+
getLibrary(libraryId: string): StampLibrary | null;
|
|
338
|
+
/** Assets in the order a picker shows them: by library, then within it. */
|
|
339
|
+
listAssets(filter?: StampAssetFilter): readonly StampAsset[];
|
|
340
|
+
getAsset(assetId: string): StampAsset | null;
|
|
341
|
+
/** The cached thumbnail (the `previewWidth` setting), or null. */
|
|
342
|
+
getAssetPreview(assetId: string): StampAssetPreview | null;
|
|
343
|
+
/** A preview at any width, rendered by the asset engine and cached per width. Rejects `not-found`. */
|
|
344
|
+
renderAssetPreview(assetId: string, options: {
|
|
345
|
+
width: number;
|
|
346
|
+
} & OperationOptions): Promise<StampAssetPreview | null>;
|
|
347
|
+
/** A copy of the asset's placement bytes (a one-page PDF), or null. */
|
|
348
|
+
readAssetBytes(assetId: string): Uint8Array | null;
|
|
349
|
+
/** Create an empty library. Fires `onLibraryCreated` and `onLibraryChanged`. */
|
|
350
|
+
createLibrary(name: string, options?: CreateLibraryOptions): Promise<{
|
|
351
|
+
library: StampLibrary;
|
|
352
|
+
}>;
|
|
353
|
+
/** Rename a library or change its categories. Rejects `not-found`. Fires `onLibraryUpdated`. */
|
|
354
|
+
updateLibrary(libraryId: string, changes: StampLibraryPatch, options?: OperationOptions): Promise<{
|
|
355
|
+
library: StampLibrary;
|
|
356
|
+
}>;
|
|
357
|
+
/** Delete a library with its assets. Fires `onLibraryDeleted`. */
|
|
358
|
+
deleteLibrary(libraryId: string, options?: OperationOptions): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* A PDF becomes a library (one asset per page). Rejects `invalid-input` for
|
|
361
|
+
* bytes that aren't a PDF, `unsupported` without a local asset engine.
|
|
362
|
+
* Fires `onLibraryCreated`, then `onAssetCreated` per stamp.
|
|
363
|
+
*/
|
|
364
|
+
importLibrary(source: BinarySource, options?: ImportLibraryOptions): Promise<{
|
|
365
|
+
library: StampLibrary;
|
|
366
|
+
}>;
|
|
367
|
+
/** The library as the PDF it is. Rejects `not-found`. */
|
|
368
|
+
exportLibrary(libraryId: string, options?: OperationOptions): Promise<Uint8Array>;
|
|
369
|
+
/**
|
|
370
|
+
* Add a stamp from bytes or a mark. Rejects `not-found` for an unknown
|
|
371
|
+
* library, `invalid-input` for bytes that aren't a picture or a taken
|
|
372
|
+
* identifier. Fires `onAssetCreated`.
|
|
373
|
+
*/
|
|
374
|
+
createAsset(input: AddAssetInput, options?: OperationOptions): Promise<{
|
|
375
|
+
asset: StampAsset;
|
|
376
|
+
}>;
|
|
377
|
+
/**
|
|
378
|
+
* Annotations on a page of a document become one stamp, exactly as they
|
|
379
|
+
* look. All or nothing: a hidden annotation, one without an appearance, or
|
|
380
|
+
* one on another page fails the call. Rejects `permission-denied` without
|
|
381
|
+
* `doc.download` (see `canCreateFromAnnotations`), `not-found` for a page
|
|
382
|
+
* that isn't in the document.
|
|
383
|
+
*/
|
|
384
|
+
createAssetFromAnnotations(page: PageRef | number, refs: readonly AnnotationRef[], input: AssetFromAnnotationsInput, options?: StampDocumentOptions): Promise<{
|
|
385
|
+
asset: StampAsset;
|
|
386
|
+
}>;
|
|
387
|
+
/** Change a stamp's label, subject or categories; its identifier never changes. Rejects `not-found`. */
|
|
388
|
+
updateAsset(assetId: string, changes: StampAssetPatch, options?: OperationOptions): Promise<{
|
|
389
|
+
asset: StampAsset;
|
|
390
|
+
}>;
|
|
391
|
+
/** Remove a stamp from its library. Fires `onAssetDeleted`. */
|
|
392
|
+
deleteAsset(assetId: string, options?: OperationOptions): Promise<void>;
|
|
393
|
+
/** Move a stamp to another library: a copy there, with a new id, then the original goes. */
|
|
394
|
+
moveAsset(assetId: string, to: {
|
|
395
|
+
libraryId: string;
|
|
396
|
+
}, options?: OperationOptions): Promise<{
|
|
397
|
+
asset: StampAsset;
|
|
398
|
+
}>;
|
|
399
|
+
/** Copy a stamp within its library. */
|
|
400
|
+
duplicateAsset(assetId: string, options?: {
|
|
401
|
+
label?: string;
|
|
402
|
+
} & OperationOptions): Promise<{
|
|
403
|
+
asset: StampAsset;
|
|
404
|
+
}>;
|
|
405
|
+
/**
|
|
406
|
+
* Arm a stamp: the next click on the document places it, with a preview
|
|
407
|
+
* under the pointer. Rejects `not-found` for an unknown asset,
|
|
408
|
+
* `permission-denied` without `annotations:create` (see `canPlace`).
|
|
409
|
+
* Fires `onArmChanged`.
|
|
410
|
+
*/
|
|
411
|
+
armAsset(assetId: string, options?: StampArmOptions): Promise<void>;
|
|
412
|
+
/** Disarm the stamp without placing it. Fires `onArmChanged` when one was armed. */
|
|
413
|
+
disarm(documentId?: string): void;
|
|
414
|
+
/** The stamp the next click on the document places, or null. */
|
|
415
|
+
getArmedAsset(documentId?: string): StampAsset | null;
|
|
416
|
+
/**
|
|
417
|
+
* Place a stamp without the pointer, its middle on `center`, sized by its
|
|
418
|
+
* picture and kept on the page. Resolves `{ annotation }`. Selected only
|
|
419
|
+
* with `select: true`. Rejects `permission-denied` without
|
|
420
|
+
* `annotations:create`, `not-found` for an unknown asset or page.
|
|
421
|
+
*/
|
|
422
|
+
placeAsset(assetId: string, placement: StampPlacement, options?: StampDocumentOptions): Promise<{
|
|
423
|
+
annotation: Annotation;
|
|
424
|
+
}>;
|
|
425
|
+
/**
|
|
426
|
+
* Place one stamp at the same spot on several pages (refs or indexes), or
|
|
427
|
+
* on `'all'`. Resolves the placed stamps, and the pages that failed.
|
|
428
|
+
*/
|
|
429
|
+
placeAssetOnPages(assetId: string, pages: readonly (PageRef | number)[] | 'all', placement: Omit<StampPlacement, 'page'>, options?: StampDocumentOptions): Promise<BatchResult<Annotation, PageRef>>;
|
|
430
|
+
/** Whether a stamp may be armed or placed on the document (`annotations:create`). */
|
|
431
|
+
canPlace(documentId?: string): boolean;
|
|
432
|
+
/** Whether annotations of the document may become a stamp, which copies them out (`doc.download`). */
|
|
433
|
+
canCreateFromAnnotations(documentId?: string): boolean;
|
|
434
|
+
/** Whether libraries can be imported: false once an import found no local engine to open them in. */
|
|
435
|
+
canImport(): boolean;
|
|
436
|
+
readonly onLibraryCreated: EventHook<StampLibraryCreatedEvent>;
|
|
437
|
+
readonly onLibraryUpdated: EventHook<StampLibraryUpdatedEvent>;
|
|
438
|
+
readonly onLibraryDeleted: EventHook<StampLibraryDeletedEvent>;
|
|
439
|
+
readonly onAssetCreated: EventHook<StampAssetCreatedEvent>;
|
|
440
|
+
readonly onAssetUpdated: EventHook<StampAssetUpdatedEvent>;
|
|
441
|
+
readonly onAssetDeleted: EventHook<StampAssetDeletedEvent>;
|
|
442
|
+
/** A stamp was armed or disarmed on a document. */
|
|
443
|
+
readonly onArmChanged: EventHook<StampArmChangedEvent>;
|
|
444
|
+
/** A library's bytes changed (subscribe to persist). */
|
|
445
|
+
readonly onLibraryChanged: EventHook<StampLibraryChangedEvent>;
|
|
446
|
+
}
|
|
447
|
+
//#endregion
|
|
448
|
+
export { StampPlacement$1 as A, StampLibraryChangedEvent as C, StampLibraryKind as D, StampLibraryFilter as E, restoreStampLibraries as F, DEFAULT_LIBRARY_KIND as I, StampToken as L, StampLibraryStore as M, memoryStampStore as N, StampLibraryPatch as O, persistStampLibraries as P, StampLibrary as S, StampLibraryDeletedEvent as T, StampAssetUpdatedEvent as _, MarkSource as a, StampDocumentOptions as b, StampArmOptions as c, StampAssetDeletedEvent as d, StampAssetEngine as f, StampAssetPreview as g, StampAssetPatch as h, ImportLibraryOptions as i, StampSettings as j, StampLibraryUpdatedEvent as k, StampAsset as l, StampAssetKind as m, AssetFromAnnotationsInput as n, STAMP_DEFAULTS as o, StampAssetFilter as p, CreateLibraryOptions as r, StampArmChangedEvent as s, AddAssetInput as t, StampAssetCreatedEvent as u, StampCapability as v, StampLibraryCreatedEvent as w, StampFont as x, StampConfig as y };
|
|
449
|
+
//# sourceMappingURL=contract-BQP56Vp4.d.cts.map
|