@hussmartinez/image-sdk 0.0.0-stage → 0.2.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.
@@ -0,0 +1,1152 @@
1
+ /**
2
+ * The `<hm-image-editor>` custom element of the image SDK.
3
+ *
4
+ * @remarks
5
+ * Importing this entry registers nothing: applications call
6
+ * `defineImageEditorElement()` themselves, and importing it on a server does
7
+ * nothing (ADR 0004, ADR 0007). The element renders `<ImageEditor>` into its
8
+ * light DOM, so React and React DOM, the package's optional peer
9
+ * dependencies, are needed here. Hosts import `@hussmartinez/ui/styles.css`
10
+ * once, then this package's `styles.css` (sdk-core ADR 0036).
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+
15
+ import { EditorElementDefine } from '@hussmartinez/sdk-core/element';
16
+ import { FilePolicy } from '@hussmartinez/sdk-core';
17
+ import { FilePolicyOverrides } from '@hussmartinez/sdk-core';
18
+ import type { MessageOverrides } from '@hussmartinez/sdk-core';
19
+ import { SdkCoreErrorCode } from '@hussmartinez/sdk-core';
20
+ import { SdkError } from '@hussmartinez/sdk-core';
21
+
22
+ /**
23
+ * Registers `<hm-image-editor>`, or the tag you name, and returns its class
24
+ * (docs/adr/0007, sdk-core ADR 0040): the attributes `theme`, `locale` and
25
+ * `tools`; the properties `file`, `plan`, `filePolicy`, `assetsUrl`,
26
+ * `messages`, `engine` and `processor`; the methods `open`, `execute`,
27
+ * `export`, `undo` and `redo`; and the events `hm-image-editor-change`,
28
+ * `-event`, `-export` and `-error`. Calling it again returns the same class.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * import { defineImageEditorElement } from "@hussmartinez/image-sdk/element";
33
+ *
34
+ * defineImageEditorElement();
35
+ * const editor = document.querySelector("hm-image-editor");
36
+ * editor.file = file;
37
+ * editor.addEventListener("hm-image-editor-change", (event) => save(event.detail));
38
+ * ```
39
+ *
40
+ * @public
41
+ */
42
+ export declare const defineImageEditorElement: EditorElementDefine<Partial<ImageEditorElementProps>, ImageEditorElementMethods>;
43
+
44
+ /**
45
+ * An EXIF orientation, 1 to 8: how the stored pixels must be turned to be
46
+ * upright. 1 means they already are (ADR 0005).
47
+ *
48
+ * @public
49
+ */
50
+ declare type ExifOrientation = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
51
+
52
+ /**
53
+ * The filter presets (ADR 0006). Names are part of the document format:
54
+ * presets are only ever added.
55
+ *
56
+ * @public
57
+ */
58
+ declare const FILTER_PRESETS: readonly ["vivid", "warm", "cool", "fade", "mono", "noir", "sepia"];
59
+
60
+ /**
61
+ * The image being edited: a source, its crop and orientation, and its
62
+ * develop adjustments and filter.
63
+ *
64
+ * @public
65
+ */
66
+ declare interface ImageBase {
67
+ /** The id of a registered source. */
68
+ readonly source: string;
69
+ /** The crop, or `null` for the whole image. */
70
+ readonly crop: ImageCrop | null;
71
+ readonly orientation: ImageOrientation_2;
72
+ readonly develop: ImageDevelop;
73
+ /** The filter, or `null` for none. */
74
+ readonly filter: ImageFilter | null;
75
+ }
76
+
77
+ /**
78
+ * Options every port call accepts.
79
+ *
80
+ * @public
81
+ */
82
+ declare interface ImageCallOptions {
83
+ /**
84
+ * Cancels the call. It then rejects with an `ImageError` whose code is
85
+ * `ABORTED`, `TIMEOUT`, or the code of an `SdkError` given as the abort
86
+ * reason, such as `PROCESSING_TIME_EXCEEDED`.
87
+ */
88
+ readonly signal?: AbortSignal;
89
+ }
90
+
91
+ /**
92
+ * Every edit to an {@link ImagePlan}: plain, structured-cloneable data
93
+ * (ADR 0003). Feature pull requests add their own commands to this union.
94
+ *
95
+ * @public
96
+ */
97
+ declare type ImageCommand = SetCropCommand | SetOrientationCommand | SetOutputCommand | SetMetadataCommand | SetDevelopCommand | SetFilterCommand;
98
+
99
+ /**
100
+ * A rectangle in whole pixels of the oriented source: `x` and `y` from its
101
+ * top left, `width` and `height` at least 1 (ADR 0003).
102
+ *
103
+ * @public
104
+ */
105
+ declare interface ImageCrop {
106
+ readonly x: number;
107
+ readonly y: number;
108
+ readonly width: number;
109
+ readonly height: number;
110
+ }
111
+
112
+ /**
113
+ * The base's tonal and colour adjustments (ADR 0006). Each is an integer
114
+ * from -100 to 100, where 0 is unchanged, applied in this order.
115
+ *
116
+ * @public
117
+ */
118
+ declare interface ImageDevelop {
119
+ /** Warmer (positive) or cooler (negative). */
120
+ readonly temperature: number;
121
+ /** Toward magenta (positive) or green (negative). */
122
+ readonly tint: number;
123
+ /** In fiftieths of a stop: 100 is two stops brighter. */
124
+ readonly exposure: number;
125
+ readonly highlights: number;
126
+ readonly shadows: number;
127
+ readonly contrast: number;
128
+ readonly saturation: number;
129
+ /** Saturation weighted toward the least saturated colours. */
130
+ readonly vibrance: number;
131
+ }
132
+
133
+ /**
134
+ * The element's events, fired as `hm-image-editor-<name>`. None carries a
135
+ * file name or contents (sdk-core ADR 0012):
136
+ *
137
+ * - `change`: the plan, after each committed edit, open, undo or redo.
138
+ * - `event`: the session's anonymous usage event.
139
+ * - `export`: an {@link ImageExportReport} after the export dialog finishes.
140
+ * - `error`: `{ code, details }` of a failure the editor shows.
141
+ *
142
+ * @public
143
+ */
144
+ export declare type ImageEditorElementEvent = "change" | "event" | "export" | "error";
145
+
146
+ /**
147
+ * The `<hm-image-editor>` element's methods: the React editor's ref handle.
148
+ * They wait for the editor's first render; `export()` returns the file.
149
+ *
150
+ * @public
151
+ */
152
+ export declare type ImageEditorElementMethods = Pick<ImageEditorHandle, "open" | "execute" | "export" | "undo" | "redo">;
153
+
154
+ /**
155
+ * The `<hm-image-editor>` element's props: its attributes, `theme`, `locale`
156
+ * and `tools`, and its properties (docs/adr/0007). They're writable, since a
157
+ * host sets them on the element, such as `editor.file = file`.
158
+ *
159
+ * @public
160
+ */
161
+ export declare interface ImageEditorElementProps {
162
+ /** `light`, `dark` or `system`: ui's colour mode, on the element. Inherited when unset. */
163
+ theme?: string;
164
+ /** The locale for numbers and plurals. Defaults to `"en"`. */
165
+ locale?: string;
166
+ /** Which tools are present, by id, in order: the attribute is space-separated. */
167
+ tools?: readonly string[];
168
+ /** An image to open. Setting another opens it, replacing the current one. */
169
+ file?: Blob;
170
+ /** The plan, applied as one undoable step when it changes. */
171
+ plan?: ImagePlan;
172
+ filePolicy?: ImageFilePolicyOverrides;
173
+ /** Where the application serves the package's `dist/assets/` directory. */
174
+ assetsUrl?: string | URL;
175
+ /** Text overrides, typed against the English catalogue. */
176
+ messages?: MessageOverrides<ImageMessageCatalogue>;
177
+ engine?: ImageEngine;
178
+ processor?: ImageProcessor;
179
+ }
180
+
181
+ /**
182
+ * What a ref to {@link ImageEditor} gives the host.
183
+ *
184
+ * @public
185
+ */
186
+ declare interface ImageEditorHandle {
187
+ /** The editor's session, for state and commands beyond the handle's. */
188
+ readonly session: ImageSession;
189
+ /** Opens an image, replacing the current one once it has opened. */
190
+ open(file: Blob): Promise<void>;
191
+ /** Applies commands as one undoable step. */
192
+ execute(commands: ImageCommand | readonly ImageCommand[]): void;
193
+ /** Renders and encodes the image as it is now. */
194
+ export(format: ImageExportFormat): Promise<ImageSessionExport>;
195
+ /** Undoes the last edit, if there is one. */
196
+ undo(): void;
197
+ /** Redoes the last undone edit, if there is one. */
198
+ redo(): void;
199
+ }
200
+
201
+ /**
202
+ * The port for reading images: probe a file's headers, decode it into a
203
+ * source the engine holds, make thumbnails and release sources (ADR 0001,
204
+ * ADR 0002, ADR 0003, ADR 0008). The SDK's own adapter probes with its own
205
+ * readers and decodes with `createImageBitmap`, both in its render worker;
206
+ * hosts can pass their own to the editor's `engine` prop, and every
207
+ * implementation must pass the engine's contract tests.
208
+ *
209
+ * `register` checks a file's own limits, from `filePolicy`, against the
210
+ * engine's own probe before decoding it, so a host can't decode past them by
211
+ * passing a probe of another file. Session-wide limits, such as
212
+ * `maxSessionSize`, are the session's (ADR 0004).
213
+ *
214
+ * Failures reject with `ImageError`: `INVALID_IMAGE` for a malformed file,
215
+ * one whose headers claim more than its data holds, or one whose decoded
216
+ * size differs from the probe's; `UNSUPPORTED_FORMAT` for one the probe
217
+ * can't bound; `DECODE_FAILED` when the browser can't decode it; and
218
+ * sdk-core's codes for cancellation and worker failures.
219
+ *
220
+ * @public
221
+ */
222
+ declare interface ImageEngine {
223
+ /** Reads a file's headers and metadata, without decoding it. */
224
+ probe(file: Blob, options?: ImageCallOptions): Promise<ImageProbe>;
225
+ /**
226
+ * Decodes a probed file into a source with the given id, upright. The
227
+ * decoded size must equal the probe's oriented size, or the call rejects
228
+ * with `INVALID_IMAGE` and keeps nothing. A file over one of
229
+ * `filePolicy`'s per-file limits rejects with that limit's code, before
230
+ * anything decodes it. An id already in use is a
231
+ * `TypeError`.
232
+ */
233
+ register(id: string, file: Blob, probe: ImageProbe, options?: ImageRegisterOptions): Promise<ImageSourceInfo>;
234
+ /**
235
+ * A rendering of a source that fits inside `maxSize` × `maxSize`, keeping
236
+ * its aspect ratio and never enlarging it. An unknown id is a `TypeError`.
237
+ */
238
+ thumbnail(id: string, maxSize: number, options?: ImageCallOptions): Promise<ImageThumbnail>;
239
+ /** Frees a source's pixels. Releasing an unknown id does nothing. */
240
+ release(id: string): Promise<void>;
241
+ /** Releases the engine, its sources and its worker. Pending calls reject, and later calls throw. */
242
+ destroy(): Promise<void>;
243
+ }
244
+
245
+ /**
246
+ * The error `@hussmartinez/image-sdk` throws and rejects with, with a stable
247
+ * `code`, structured `details` and the underlying error as `cause`. Show
248
+ * users the text for its code from {@link imageMessages}, never its
249
+ * `message`, which is for developers and may contain text from the file.
250
+ *
251
+ * @example
252
+ * ```ts
253
+ * try {
254
+ * await session.open(file);
255
+ * } catch (error) {
256
+ * if (isImageError(error, "DECODE_FAILED")) {
257
+ * suggestConvertingToPng();
258
+ * } else {
259
+ * show(messages.error(error));
260
+ * }
261
+ * }
262
+ * ```
263
+ *
264
+ * @public
265
+ */
266
+ declare class ImageError extends SdkError<ImageErrorCode> {
267
+ /** Always `"ImageError"`, which survives minification and worker boundaries. */
268
+ readonly name = "ImageError";
269
+ }
270
+
271
+ /**
272
+ * Error codes of `@hussmartinez/image-sdk`: sdk-core's own codes, such as
273
+ * `ABORTED`, `WORKER_CRASHED` and `FILE_TOO_LARGE`, plus the image SDK's
274
+ * (ADR 0001, ADR 0004). They never change meaning once released.
275
+ *
276
+ * - `INVALID_IMAGE`: the file is malformed, its headers claim more than its
277
+ * data can carry or less than its decoder would produce, or its decoded
278
+ * size differs from what its headers declare.
279
+ * - `UNSUPPORTED_FORMAT`: the format isn't recognised, its bound can't be
280
+ * read, or the browser can't encode the requested export format.
281
+ * `details.format` names it.
282
+ * - `DECODE_FAILED`: the browser couldn't decode a file the SDK probed,
283
+ * usually because it lacks the format. `details.format` names it.
284
+ * - `INVALID_COMMAND`: an edit command doesn't apply to the plan, such as a
285
+ * crop outside its source. `details.reason` says why, as a stable token
286
+ * (`ImageCommandRejection`).
287
+ * - `INVALID_DOCUMENT`: a plan document, such as a saved project, isn't
288
+ * valid in its format. `details.reason` says why (`ImageDocumentRejection`).
289
+ * A document of another format, or a later version, is `UNSUPPORTED_FORMAT`
290
+ * instead, with `details.reason` `unknown-format` or `unknown-format-version`.
291
+ * - `IMAGE_TOO_LARGE`: an image, a frame, the canvas or the export exceeds
292
+ * the `maxImagePixels` limit.
293
+ * - `IMAGE_DIMENSION_TOO_LARGE`: a width or height exceeds the
294
+ * `maxImageDimension` limit.
295
+ * - `TOO_MANY_FRAMES`: an animation exceeds the `maxFrames` limit.
296
+ * - `SESSION_TOO_LARGE`: the decoded images the session holds exceed the
297
+ * `maxSessionSize` limit.
298
+ * - `TOO_MANY_LAYERS`: the layer plan exceeds the `maxLayers` limit.
299
+ *
300
+ * Limit codes carry `details` with the `limit`, its `maximum`, the `actual`
301
+ * value and the `unit`. Other codes' `details` name the format involved,
302
+ * and a `reason`, never data from the file.
303
+ *
304
+ * @public
305
+ */
306
+ declare type ImageErrorCode = SdkCoreErrorCode | "INVALID_IMAGE" | "UNSUPPORTED_FORMAT" | "DECODE_FAILED" | "INVALID_COMMAND" | "INVALID_DOCUMENT" | "IMAGE_TOO_LARGE" | "IMAGE_DIMENSION_TOO_LARGE" | "TOO_MANY_FRAMES" | "SESSION_TOO_LARGE" | "TOO_MANY_LAYERS";
307
+
308
+ /**
309
+ * The file an export produces (ADR 0001). `quality`, from 0 to 1, applies to
310
+ * the lossy formats; it defaults to 0.92. WebP is encoded only where the
311
+ * browser can, and otherwise rejects with `UNSUPPORTED_FORMAT`.
312
+ *
313
+ * @public
314
+ */
315
+ declare type ImageExportFormat = {
316
+ readonly type: "png";
317
+ } | {
318
+ readonly type: "jpeg";
319
+ readonly quality?: number;
320
+ } | {
321
+ readonly type: "webp";
322
+ readonly quality?: number;
323
+ };
324
+
325
+ /**
326
+ * One export: a plan over sources registered with the same engine, and the
327
+ * output format. The plan's kept metadata goes into the file, and nothing
328
+ * else does (ADR 0005).
329
+ *
330
+ * @public
331
+ */
332
+ declare interface ImageExportJob {
333
+ readonly plan: ImagePlan;
334
+ readonly format: ImageExportFormat;
335
+ }
336
+
337
+ /**
338
+ * Options for exporting.
339
+ *
340
+ * @public
341
+ */
342
+ declare interface ImageExportOptions extends ImageProgressOptions {
343
+ /**
344
+ * The limits the output canvas is checked against before it's allocated:
345
+ * `maxImageDimension` and `maxImagePixels` (ADR 0004). The defaults of
346
+ * `imageLimits` when omitted.
347
+ */
348
+ readonly filePolicy?: ImageFilePolicy;
349
+ }
350
+
351
+ /**
352
+ * What the export dialog reports about a finished export, for the element's
353
+ * `export` event: no pixels and no file, which an event must never carry
354
+ * (sdk-core ADR 0012). The element's `export()` method returns the file.
355
+ *
356
+ * @public
357
+ */
358
+ export declare interface ImageExportReport {
359
+ readonly format: ImageExportFormat["type"];
360
+ readonly width: number;
361
+ readonly height: number;
362
+ /** The file's size in bytes. */
363
+ readonly size: number;
364
+ readonly removed: readonly (keyof ImageMetadataPresence)[];
365
+ readonly kept: readonly (keyof ImageKeepableMetadata)[];
366
+ }
367
+
368
+ /**
369
+ * A resolved file policy for the image SDK. Violations throw
370
+ * {@link ImageError}.
371
+ *
372
+ * @public
373
+ */
374
+ declare type ImageFilePolicy = FilePolicy<ImageLimitDefinitions>;
375
+
376
+ /**
377
+ * A host's `filePolicy`: a new maximum, or `{ maximum, warning }`, for any of
378
+ * the image SDK's limits. `Infinity` disables a maximum, which removes a
379
+ * protection against hostile files, or disables a warning. Unknown limit
380
+ * names throw `TypeError` when the policy is resolved.
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * // Large scans: raise the pixel and decoded sizes together.
385
+ * const filePolicy: ImageFilePolicyOverrides = {
386
+ * maxImagePixels: 100_000_000,
387
+ * maxDecodedSize: { maximum: 2e9, warning: 800e6 },
388
+ * };
389
+ * ```
390
+ *
391
+ * @public
392
+ */
393
+ declare type ImageFilePolicyOverrides = FilePolicyOverrides<ImageLimitDefinitions>;
394
+
395
+ /**
396
+ * A filter preset and its strength, an integer from 0 (no effect) to 100.
397
+ *
398
+ * @public
399
+ */
400
+ declare interface ImageFilter {
401
+ readonly preset: ImageFilterPreset;
402
+ readonly strength: number;
403
+ }
404
+
405
+ /**
406
+ * A filter preset's name.
407
+ *
408
+ * @public
409
+ */
410
+ declare type ImageFilterPreset = (typeof FILTER_PRESETS)[number];
411
+
412
+ /**
413
+ * The formats the probe recognises, by their signature bytes (ADR 0001).
414
+ *
415
+ * @public
416
+ */
417
+ declare type ImageFormat = "png" | "jpeg" | "webp" | "gif" | "avif" | "heif" | "bmp";
418
+
419
+ /**
420
+ * The metadata fields a user may keep on export (ADR 0005). Empty strings
421
+ * mean the field isn't written.
422
+ *
423
+ * @public
424
+ */
425
+ declare interface ImageKeepableMetadata {
426
+ readonly title: string;
427
+ readonly description: string;
428
+ readonly artist: string;
429
+ readonly copyright: string;
430
+ }
431
+
432
+ /**
433
+ * The type of {@link imageLimitDefinitions}.
434
+ *
435
+ * @public
436
+ */
437
+ declare type ImageLimitDefinitions = typeof imageLimitDefinitions;
438
+
439
+ /**
440
+ * The image SDK's limit definitions: sdk-core's core limits with image
441
+ * defaults, plus five for images (ADR 0004).
442
+ *
443
+ * | Limit | Code | Default maximum | Default warning |
444
+ * |---|---|---|---|
445
+ * | `maxFileSize` | `FILE_TOO_LARGE` | 100 MB | 50 MB |
446
+ * | `maxFiles` | `TOO_MANY_FILES` | 20 | none |
447
+ * | `maxDecodedSize` | `DECODED_SIZE_TOO_LARGE` | 1 GB | 400 MB |
448
+ * | `maxProcessingTime` | `PROCESSING_TIME_EXCEEDED` | 120 s | none |
449
+ * | `maxImagePixels` | `IMAGE_TOO_LARGE` | 50 megapixels | 24 megapixels |
450
+ * | `maxImageDimension` | `IMAGE_DIMENSION_TOO_LARGE` | 16,384 pixels | none |
451
+ * | `maxFrames` | `TOO_MANY_FRAMES` | 300 | 100 |
452
+ * | `maxSessionSize` | `SESSION_TOO_LARGE` | 1 GB | 500 MB |
453
+ * | `maxLayers` | `TOO_MANY_LAYERS` | 256 | none |
454
+ *
455
+ * Sizes are decimal: 1 MB is 1,000,000 bytes. Decoded sizes count 4 bytes
456
+ * per pixel. `maxImagePixels` is the same limit, with the same name, code
457
+ * and unit, as `pdf-sdk`'s. `maxImageDimension` is a side length, in pixels.
458
+ *
459
+ * @public
460
+ */
461
+ declare const imageLimitDefinitions: {
462
+ readonly maxDecodedSize: {
463
+ readonly default: 1000000000;
464
+ readonly warning: 400000000;
465
+ readonly code: "DECODED_SIZE_TOO_LARGE";
466
+ readonly unit: "bytes";
467
+ };
468
+ readonly maxImagePixels: {
469
+ readonly code: "IMAGE_TOO_LARGE";
470
+ readonly unit: "pixels";
471
+ readonly default: 50000000;
472
+ readonly warning: 24000000;
473
+ };
474
+ readonly maxImageDimension: {
475
+ readonly code: "IMAGE_DIMENSION_TOO_LARGE";
476
+ readonly unit: "pixels";
477
+ readonly default: 16384;
478
+ };
479
+ readonly maxFrames: {
480
+ readonly code: "TOO_MANY_FRAMES";
481
+ readonly unit: "count";
482
+ readonly default: 300;
483
+ readonly warning: 100;
484
+ };
485
+ readonly maxSessionSize: {
486
+ readonly code: "SESSION_TOO_LARGE";
487
+ readonly unit: "bytes";
488
+ readonly default: 1000000000;
489
+ readonly warning: 500000000;
490
+ };
491
+ readonly maxLayers: {
492
+ readonly code: "TOO_MANY_LAYERS";
493
+ readonly unit: "count";
494
+ readonly default: 256;
495
+ };
496
+ readonly maxFileSize: {
497
+ readonly code: "FILE_TOO_LARGE";
498
+ readonly unit: "bytes";
499
+ readonly default: 100000000;
500
+ readonly warning: 50000000;
501
+ };
502
+ readonly maxFiles: {
503
+ readonly code: "TOO_MANY_FILES";
504
+ readonly unit: "count";
505
+ readonly default: 20;
506
+ };
507
+ readonly maxProcessingTime: {
508
+ readonly code: "PROCESSING_TIME_EXCEEDED";
509
+ readonly unit: "milliseconds";
510
+ readonly default: 120000;
511
+ };
512
+ };
513
+
514
+ /**
515
+ * The names of the image SDK's limits.
516
+ *
517
+ * @public
518
+ */
519
+ declare type ImageLimitName = keyof ImageLimitDefinitions;
520
+
521
+ /**
522
+ * The type of {@link imageMessages}, for typing a host's overrides with
523
+ * `MessageOverrides<ImageMessageCatalogue>`.
524
+ *
525
+ * @public
526
+ */
527
+ declare type ImageMessageCatalogue = typeof imageMessages;
528
+
529
+ /**
530
+ * The image SDK's English message catalogue: sdk-core's and ui's messages, and text
531
+ * for every {@link ImageErrorCode} and every limit's warning. Pass it to
532
+ * `createMessages` from `@hussmartinez/sdk-core`, with the host's locale and
533
+ * overrides. It also has the editor's text: its labels, states,
534
+ * announcements and tool names.
535
+ *
536
+ * Error text is looked up by code, with the error's `details` as
537
+ * parameters, and never taken from `error.message` (ADR 0019).
538
+ *
539
+ * @example
540
+ * ```ts
541
+ * const messages = createMessages(imageMessages, { locale: "en", overrides: props.messages });
542
+ * messages.error(error); // "This animation has 400 frames, which is over the 300-frame limit."
543
+ * messages.t("warnings.maxSessionSize", { actual: 600e6 });
544
+ * ```
545
+ *
546
+ * @public
547
+ */
548
+ declare const imageMessages: {
549
+ readonly "errors.INVALID_IMAGE": "This file isn't a valid image, or it's too damaged to open.";
550
+ readonly "errors.UNSUPPORTED_FORMAT": "This image format isn't supported. Try converting the file to PNG or JPEG, then open it again.";
551
+ readonly "errors.DECODE_FAILED": "This browser can't open this kind of image. Try another browser, or convert the file to PNG or JPEG.";
552
+ readonly "errors.INVALID_COMMAND": "This edit couldn't be made. Please try again.";
553
+ readonly "errors.INVALID_DOCUMENT": "This project is damaged, or it isn't an image project.";
554
+ readonly "errors.IMAGE_TOO_LARGE": "This image has more pixels than the editor can handle. Try a smaller version of it.";
555
+ readonly "errors.IMAGE_DIMENSION_TOO_LARGE": "This image is {actual, number} pixels across, which is over the {maximum, number}-pixel limit.";
556
+ readonly "errors.TOO_MANY_FRAMES": {
557
+ readonly $plural: "maximum";
558
+ } & {
559
+ readonly one: "This animation has {actual, number} frames, which is over the {maximum}-frame limit.";
560
+ readonly other: "This animation has {actual, number} frames, which is over the {maximum, number}-frame limit.";
561
+ };
562
+ readonly "errors.SESSION_TOO_LARGE": "The open images would use {actual, fileSize} of memory, which is over the {maximum, fileSize} limit. Close an image, or clear the undo history, and try again.";
563
+ readonly "errors.TOO_MANY_LAYERS": {
564
+ readonly $plural: "maximum";
565
+ } & {
566
+ readonly one: "An image can have {maximum} layer. Merge or delete layers, and try again.";
567
+ readonly other: "An image can have up to {maximum, number} layers. Merge or delete layers, and try again.";
568
+ };
569
+ readonly "warnings.maxImagePixels": "This image is large, and may be slow to edit on some devices.";
570
+ readonly "warnings.maxImageDimension": "This image is very wide or tall, and may be slow to edit.";
571
+ readonly "warnings.maxFrames": {
572
+ readonly $plural: "actual";
573
+ } & {
574
+ readonly one: "This animation has {actual} frame.";
575
+ readonly other: "This animation has {actual, number} frames, and may be slow to edit and export.";
576
+ };
577
+ readonly "warnings.maxSessionSize": "The open images use {actual, fileSize} of memory. Clearing the undo history frees memory.";
578
+ readonly "warnings.maxLayers": {
579
+ readonly $plural: "actual";
580
+ } & {
581
+ readonly one: "This image has {actual} layer.";
582
+ readonly other: "This image has {actual, number} layers, and may be slow to edit and export.";
583
+ };
584
+ readonly "editor.label": "Image editor";
585
+ readonly "editor.preview": "Edited image preview, {width, number} × {height, number}";
586
+ readonly "editor.empty": "Open an image to start editing. It stays on this device.";
587
+ readonly "editor.choose": "Choose an image";
588
+ readonly "editor.dropHint": "or drop it here";
589
+ readonly "editor.opening": "Opening the image…";
590
+ readonly "editor.cancel": "Cancel";
591
+ readonly "editor.opened": "Image opened, {width, number} × {height, number}.";
592
+ readonly "editor.undid": "Undid {action}.";
593
+ readonly "editor.redid": "Redid {action}.";
594
+ readonly "actions.image.setCrop": "crop";
595
+ readonly "actions.image.setOrientation": "rotate or flip";
596
+ readonly "actions.image.setOutput": "size";
597
+ readonly "actions.image.setMetadata": "metadata";
598
+ readonly "actions.image.setDevelop": "adjustment";
599
+ readonly "actions.image.setFilter": "filter";
600
+ readonly "toolbar.label": "Image tools";
601
+ readonly "toolbar.groups.file": "File";
602
+ readonly "toolbar.groups.history": "History";
603
+ readonly "toolbar.groups.orientation": "Rotate";
604
+ readonly "toolbar.groups.zoom": "Zoom";
605
+ readonly "toolbar.groups.other": "More tools";
606
+ readonly "tools.open": "Open image";
607
+ readonly "tools.undo": "Undo";
608
+ readonly "tools.redo": "Redo";
609
+ readonly "tools.rotate-left": "Rotate left";
610
+ readonly "tools.rotate-right": "Rotate right";
611
+ readonly "tools.zoom-in": "Zoom in";
612
+ readonly "tools.zoom-out": "Zoom out";
613
+ readonly "tools.zoom-fit": "Fit to the stage";
614
+ readonly "tools.crop": "Crop";
615
+ readonly "tools.flip-horizontal": "Flip horizontally";
616
+ readonly "tools.flip-vertical": "Flip vertically";
617
+ readonly "toolbar.groups.crop": "Crop";
618
+ readonly "crop.frame": "Crop area";
619
+ readonly "crop.frameDescription": "{width, number} × {height, number} pixels, from {x, number}, {y, number}. Arrow keys move it; with Alt, they resize it; Enter applies and Escape cancels.";
620
+ readonly "crop.size": "{width, number} × {height, number}, from {x, number}, {y, number}";
621
+ readonly "crop.panel": "Crop";
622
+ readonly "crop.x": "Left";
623
+ readonly "crop.y": "Top";
624
+ readonly "crop.width": "Width";
625
+ readonly "crop.height": "Height";
626
+ readonly "crop.aspect": "Aspect ratio";
627
+ readonly "crop.aspects.free": "Free";
628
+ readonly "crop.aspects.original": "Original";
629
+ readonly "crop.aspects.ratio": "{width}:{height}";
630
+ readonly "crop.apply": "Apply crop";
631
+ readonly "crop.cancel": "Cancel";
632
+ readonly "crop.reset": "Whole image";
633
+ readonly "crop.applied": "Cropped to {width, number} × {height, number}.";
634
+ readonly "inspector.label": "Panels";
635
+ readonly "inspector.adjust": "Adjust";
636
+ readonly "inspector.filters": "Filters";
637
+ readonly "inspector.info": "Info";
638
+ readonly "notices.label": "Notices";
639
+ readonly "notices.dismiss": "Dismiss";
640
+ readonly "notices.colourProfile": "This image has a colour profile. Colours outside sRGB will be clipped in the exported file.";
641
+ readonly "info.panel": "Image info";
642
+ readonly "info.size": "Size";
643
+ readonly "info.sizeValue": "{width, number} × {height, number} pixels";
644
+ readonly "info.format": "Format";
645
+ readonly "info.formats.png": "PNG";
646
+ readonly "info.formats.jpeg": "JPEG";
647
+ readonly "info.formats.webp": "WebP";
648
+ readonly "info.formats.gif": "GIF";
649
+ readonly "info.formats.avif": "AVIF";
650
+ readonly "info.formats.heif": "HEIF";
651
+ readonly "info.formats.bmp": "BMP";
652
+ readonly "info.frames": "Frames";
653
+ readonly "info.fileSize": "File size";
654
+ readonly "info.fileSizeValue": "{size, fileSize}";
655
+ readonly "info.metadata": "Metadata in the file";
656
+ readonly "info.metadataNone": "None";
657
+ readonly "info.kept": "Kept on export";
658
+ readonly "info.keptNone": "Nothing";
659
+ readonly "develop.panel": "Adjust";
660
+ readonly "develop.temperature": "Temperature";
661
+ readonly "develop.tint": "Tint";
662
+ readonly "develop.exposure": "Exposure";
663
+ readonly "develop.highlights": "Highlights";
664
+ readonly "develop.shadows": "Shadows";
665
+ readonly "develop.contrast": "Contrast";
666
+ readonly "develop.saturation": "Saturation";
667
+ readonly "develop.vibrance": "Vibrance";
668
+ readonly "develop.reset": "Reset {name}";
669
+ readonly "develop.resetAll": "Reset all";
670
+ readonly "develop.wasReset": "All adjustments reset.";
671
+ readonly "filters.panel": "Filters";
672
+ readonly "filters.label": "Filter";
673
+ readonly "filters.none": "None";
674
+ readonly "filters.vivid": "Vivid";
675
+ readonly "filters.warm": "Warm";
676
+ readonly "filters.cool": "Cool";
677
+ readonly "filters.fade": "Fade";
678
+ readonly "filters.mono": "Mono";
679
+ readonly "filters.noir": "Noir";
680
+ readonly "filters.sepia": "Sepia";
681
+ readonly "filters.strength": "Strength";
682
+ readonly "toolbar.groups.export": "Export";
683
+ readonly "tools.export": "Export";
684
+ readonly "export.title": "Export image";
685
+ readonly "export.description": "The file is made on this device, and nothing is uploaded.";
686
+ readonly "export.format": "Format";
687
+ readonly "export.formats.png": "PNG";
688
+ readonly "export.formats.jpeg": "JPEG";
689
+ readonly "export.formats.webp": "WebP";
690
+ readonly "export.quality": "Quality";
691
+ readonly "export.qualityValue": "{quality, number}%";
692
+ readonly "export.size": "Size";
693
+ readonly "export.sizes.scale": "Scale";
694
+ readonly "export.sizes.fit": "Fit in a box";
695
+ readonly "export.scale": "Scale, in percent";
696
+ readonly "export.fitWidth": "Largest width";
697
+ readonly "export.fitHeight": "Largest height";
698
+ readonly "export.fields": "Details to include";
699
+ readonly "export.fieldsHint": "Only what you fill in is written to the file.";
700
+ readonly "export.field.title": "Title";
701
+ readonly "export.field.description": "Description";
702
+ readonly "export.field.artist": "Artist";
703
+ readonly "export.field.copyright": "Copyright";
704
+ readonly "export.summary": "Summary";
705
+ readonly "export.output": "{width, number} × {height, number} pixels, {format}";
706
+ readonly "export.removed": "Removed from the file";
707
+ readonly "export.removedNone": "The image had no other details to remove.";
708
+ readonly "export.kind.location": "Location";
709
+ readonly "export.kind.camera": "Camera details";
710
+ readonly "export.kind.timestamps": "Dates and times";
711
+ readonly "export.kind.thumbnail": "Embedded thumbnail";
712
+ readonly "export.kind.colourProfile": "Colour profile: colours outside sRGB are clipped";
713
+ readonly "export.kind.other": "Other metadata";
714
+ readonly "export.kept": "Kept in the file";
715
+ readonly "export.confirm": "Export";
716
+ readonly "export.cancel": "Cancel";
717
+ readonly "export.progress": "Exporting the image";
718
+ readonly "export.stop": "Stop exporting";
719
+ readonly "export.cancelled": "Export stopped.";
720
+ readonly "export.done": "Exported a {format} of {size, fileSize}.";
721
+ readonly "export.ready": "{width, number} × {height, number} pixels, {format}, {size, fileSize}";
722
+ readonly "export.download": "Download";
723
+ readonly "export.close": "Done";
724
+ readonly "dialog.close": "Close";
725
+ readonly "fileDropZone.choose": "Choose a file";
726
+ readonly "fileDropZone.chooseMultiple": "Choose files";
727
+ readonly "fileDropZone.hint": "or drop it here";
728
+ readonly "fileDropZone.hintMultiple": "or drop them here";
729
+ readonly "progress.label": "Progress";
730
+ readonly "spinner.label": "Loading";
731
+ readonly "errors.INVALID_THEME_TOKEN": "The theme setting {token} has a value that can't be used.";
732
+ readonly "errors.INVALID_THEME_SELECTOR": "The theme can't be applied to the selector {selector}.";
733
+ readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
734
+ readonly "errors.ABORTED": "The operation was cancelled.";
735
+ readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
736
+ readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
737
+ readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
738
+ readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
739
+ readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
740
+ readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
741
+ readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
742
+ readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
743
+ readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
744
+ readonly "errors.TOO_MANY_FILES": {
745
+ readonly $plural: "maximum";
746
+ } & {
747
+ readonly one: "You can add {maximum} file at a time.";
748
+ readonly other: "You can add up to {maximum} files at a time.";
749
+ };
750
+ readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
751
+ readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
752
+ readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
753
+ readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
754
+ readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
755
+ readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
756
+ readonly "keys.control": "Ctrl";
757
+ readonly "keys.alt": "Alt";
758
+ readonly "keys.shift": "Shift";
759
+ readonly "keys.meta": "Meta";
760
+ readonly "keys.apple.control": "\u2303";
761
+ readonly "keys.apple.alt": "\u2325";
762
+ readonly "keys.apple.shift": "\u21E7";
763
+ readonly "keys.apple.meta": "\u2318";
764
+ readonly "keys.space": "Space";
765
+ readonly "keys.enter": "Enter";
766
+ readonly "keys.escape": "Esc";
767
+ readonly "keys.tab": "Tab";
768
+ readonly "keys.delete": "Delete";
769
+ readonly "keys.backspace": "Backspace";
770
+ readonly "keys.arrowUp": "\u2191";
771
+ readonly "keys.arrowDown": "\u2193";
772
+ readonly "keys.arrowLeft": "\u2190";
773
+ readonly "keys.arrowRight": "\u2192";
774
+ readonly "keys.home": "Home";
775
+ readonly "keys.end": "End";
776
+ readonly "keys.pageUp": "Page Up";
777
+ readonly "keys.pageDown": "Page Down";
778
+ };
779
+
780
+ /**
781
+ * Which kinds of metadata a file carries, as presence flags, never values,
782
+ * so the editor can say what an export removes (ADR 0005).
783
+ *
784
+ * @public
785
+ */
786
+ declare interface ImageMetadataPresence {
787
+ readonly location: boolean;
788
+ readonly camera: boolean;
789
+ readonly timestamps: boolean;
790
+ readonly thumbnail: boolean;
791
+ readonly colourProfile: boolean;
792
+ /** Any other field, such as maker notes or unknown tags. */
793
+ readonly other: boolean;
794
+ }
795
+
796
+ /**
797
+ * The plan's own rotation and flips, applied after the crop. They're user
798
+ * edits, separate from the file's EXIF orientation, which decoding has
799
+ * already applied (ADR 0005).
800
+ *
801
+ * @public
802
+ */
803
+ declare interface ImageOrientation_2 {
804
+ readonly rotate: ImageRotation;
805
+ /** Mirrors left to right, after the rotation. */
806
+ readonly flipX: boolean;
807
+ /** Mirrors top to bottom, after the rotation. */
808
+ readonly flipY: boolean;
809
+ }
810
+
811
+ /**
812
+ * The export's size: the composition scaled by a factor up to 1, or fitted
813
+ * inside a box without enlarging it.
814
+ *
815
+ * @public
816
+ */
817
+ declare type ImageOutput = {
818
+ readonly kind: "scale";
819
+ readonly scale: number;
820
+ } | {
821
+ readonly kind: "fit";
822
+ readonly width: number;
823
+ readonly height: number;
824
+ };
825
+
826
+ /**
827
+ * The session's document: a description of the edits over an immutable
828
+ * source, rendered to pixels only for display and export (ADR 0003).
829
+ *
830
+ * @public
831
+ */
832
+ declare interface ImagePlan {
833
+ readonly base: ImageBase;
834
+ readonly output: ImageOutput;
835
+ /** The fields the user chose to keep on export. Never a location (ADR 0005). */
836
+ readonly metadata: ImageKeepableMetadata;
837
+ }
838
+
839
+ /**
840
+ * What the probe learned about a file before anything decodes it (ADR 0001,
841
+ * ADR 0004, ADR 0005). Limits are checked against it.
842
+ *
843
+ * @public
844
+ */
845
+ declare interface ImageProbe {
846
+ readonly format: ImageFormat;
847
+ /** The size of the stored pixels, before orientation. */
848
+ readonly stored: ImageSize;
849
+ /** The upright size, after orientation: the size the decoder must return. */
850
+ readonly oriented: ImageSize;
851
+ /** The EXIF or `irot`/`imir` orientation; 1 when there's none. */
852
+ readonly orientation: ExifOrientation;
853
+ /** 1 for a still image, otherwise the number of frames the probe walked. */
854
+ readonly frames: number;
855
+ readonly hasAlpha: boolean;
856
+ /**
857
+ * The most pixels the decoder can produce for the file: frames × the
858
+ * oriented size for most formats, and for AVIF and HEIF the sum over every
859
+ * item decoded with the primary, such as grid tiles and auxiliary planes.
860
+ * A file with an orientation counts one more oriented frame, which the
861
+ * worker needs when it applies the orientation itself (ADR 0005).
862
+ * Never a count declared by one header (ADR 0001).
863
+ */
864
+ readonly decodedPixelBound: number;
865
+ readonly metadata: ImageMetadataPresence;
866
+ /** The keepable fields the file carries, length-limited, shown only as text. */
867
+ readonly keepable: ImageKeepableMetadata;
868
+ }
869
+
870
+ /**
871
+ * The port for exporting: render a plan at its output size and encode it
872
+ * (ADR 0001, ADR 0003, ADR 0008). It renders sources registered with its
873
+ * engine, so the SDK's own adapter shares the engine's render worker; hosts
874
+ * can pass their own to the editor's `processor` prop, and every
875
+ * implementation must pass the processor's contract tests.
876
+ *
877
+ * Failures reject with `ImageError` for cancellation, worker failures and
878
+ * formats the browser can't encode, and `TypeError` for a plan whose source
879
+ * isn't registered.
880
+ *
881
+ * @public
882
+ */
883
+ declare interface ImageProcessor {
884
+ /**
885
+ * Renders and encodes a plan, and returns the file. It writes only the
886
+ * plan's kept metadata, and never a location, a camera's details,
887
+ * timestamps, a thumbnail or an orientation. An output over `filePolicy`'s
888
+ * `maxImageDimension` or `maxImagePixels` rejects with that limit's code
889
+ * before anything is drawn.
890
+ */
891
+ export(job: ImageExportJob, options?: ImageExportOptions): Promise<Blob>;
892
+ /** Releases the processor. Pending calls reject, and later calls throw. */
893
+ destroy(): Promise<void>;
894
+ }
895
+
896
+ /**
897
+ * Options for long calls, which report how far they've got.
898
+ *
899
+ * @public
900
+ */
901
+ declare interface ImageProgressOptions extends ImageCallOptions {
902
+ /**
903
+ * Called with the fraction done, from 0 to 1. It only moves forward, and
904
+ * it's called with 1 before the call resolves.
905
+ */
906
+ readonly onProgress?: (fraction: number) => void;
907
+ }
908
+
909
+ /**
910
+ * Options for registering a source.
911
+ *
912
+ * @public
913
+ */
914
+ declare interface ImageRegisterOptions extends ImageProgressOptions {
915
+ /**
916
+ * The limits checked against the engine's own probe of the file before
917
+ * anything decodes it: `maxFileSize`, `maxImageDimension`,
918
+ * `maxImagePixels`, `maxFrames` and `maxDecodedSize` (ADR 0004). The
919
+ * defaults of `imageLimits` when omitted. The session checks the same
920
+ * policy first, so this is defence in depth for hosts that use the engine
921
+ * directly.
922
+ */
923
+ readonly filePolicy?: ImageFilePolicy;
924
+ }
925
+
926
+ /**
927
+ * A quarter-turn rotation, clockwise, in degrees.
928
+ *
929
+ * @public
930
+ */
931
+ declare type ImageRotation = 0 | 90 | 180 | 270;
932
+
933
+ /**
934
+ * An image editing session (ADR 0003, ADR 0008): one document, its plan
935
+ * over the source it opened, edited by commands with undo and redo, and
936
+ * exported through its processor.
937
+ *
938
+ * @public
939
+ */
940
+ declare interface ImageSession {
941
+ getSnapshot(): ImageSessionSnapshot;
942
+ /** Calls the listener after every change. Returns a function that unsubscribes. */
943
+ subscribe(listener: () => void): () => void;
944
+ /**
945
+ * Probes, checks and decodes a file, and makes it the document, with a new
946
+ * plan and an empty history; the previous source is released (ADR 0003,
947
+ * ADR 0004). The newest open wins: an open that finishes after a later one
948
+ * started applies nothing, releases its source and rejects with
949
+ * `ABORTED`. A failed or cancelled open leaves the current document as it
950
+ * was.
951
+ */
952
+ open(file: Blob, options?: {
953
+ readonly signal?: AbortSignal;
954
+ }): Promise<ImageSessionSource>;
955
+ /**
956
+ * Applies commands as one undoable step. They're checked by the reducer,
957
+ * then the output against `maxImageDimension` and `maxImagePixels`; a
958
+ * failure throws `ImageError` and changes nothing.
959
+ */
960
+ execute(commands: ImageCommand | readonly ImageCommand[]): void;
961
+ /**
962
+ * Makes the document's plan equal to `plan`, as one undoable step of the
963
+ * commands that reach it, checked as `execute` checks them (ADR 0003). A
964
+ * plan equal to the current one changes nothing. A plan over another
965
+ * source is `INVALID_COMMAND`. For editors whose host holds the plan.
966
+ */
967
+ applyPlan(plan: ImagePlan): void;
968
+ /**
969
+ * Runs `fn`, and records every step it executes as one undoable step, for
970
+ * a gesture such as dragging a crop handle (ADR 0003). `fn` must be
971
+ * synchronous.
972
+ */
973
+ group<T>(fn: () => T): T;
974
+ /** Undoes the last step. Returns whether there was one. */
975
+ undo(): boolean;
976
+ /** Redoes the last undone step. Returns whether there was one. */
977
+ redo(): boolean;
978
+ /**
979
+ * Renders and encodes the document (ADR 0003). An export that finishes
980
+ * after another file was opened rejects with `ABORTED`.
981
+ */
982
+ export(format: ImageExportFormat, options?: {
983
+ readonly signal?: AbortSignal;
984
+ readonly onProgress?: (fraction: number) => void;
985
+ }): Promise<ImageSessionExport>;
986
+ /** Releases the source the session holds. Later calls throw. */
987
+ destroy(): Promise<void>;
988
+ }
989
+
990
+ /**
991
+ * What an export produced, and what the summary before a download shows
992
+ * (ADR 0003, ADR 0005).
993
+ *
994
+ * @public
995
+ */
996
+ declare interface ImageSessionExport {
997
+ readonly blob: Blob;
998
+ readonly width: number;
999
+ readonly height: number;
1000
+ /**
1001
+ * The kinds of metadata the source carried that the file doesn't: every
1002
+ * kind, since exports keep only the fields the user chose, which are
1003
+ * never these. Empty when the source carried none.
1004
+ */
1005
+ readonly removed: readonly (keyof ImageMetadataPresence)[];
1006
+ /** The fields the user kept, which the file carries. */
1007
+ readonly kept: readonly (keyof ImageKeepableMetadata)[];
1008
+ }
1009
+
1010
+ /**
1011
+ * The session's state, for `useSyncExternalStore`: a new object on every
1012
+ * change (ADR 0003).
1013
+ *
1014
+ * @public
1015
+ */
1016
+ declare interface ImageSessionSnapshot {
1017
+ /** `empty` until a file opens; `opening` while the first one is; then `ready`. */
1018
+ readonly status: "empty" | "opening" | "ready";
1019
+ /** The document, or `null` before a file is open. */
1020
+ readonly plan: ImagePlan | null;
1021
+ /** The document's source, or `null` before a file is open. */
1022
+ readonly source: ImageSessionSource | null;
1023
+ readonly canUndo: boolean;
1024
+ readonly canRedo: boolean;
1025
+ /** Whether a file is being opened. The current document stays until it's ready. */
1026
+ readonly opening: boolean;
1027
+ /** Whether an export is in progress. */
1028
+ readonly exporting: boolean;
1029
+ /** The limits the last open, edit or export came near: at or above their warnings. */
1030
+ readonly warnings: readonly ImageLimitName[];
1031
+ /** The last failure, until the next successful open, edit or export. */
1032
+ readonly error: ImageError | null;
1033
+ }
1034
+
1035
+ /**
1036
+ * The document's source, as the editor shows it: its size and format, and
1037
+ * what metadata the file carried, which the export summary reports as
1038
+ * removed unless the user kept it (ADR 0005).
1039
+ *
1040
+ * @public
1041
+ */
1042
+ declare interface ImageSessionSource extends ImageSourceInfo {
1043
+ /** The file's size in bytes, as it was opened. Never its name. */
1044
+ readonly fileSize: number;
1045
+ /** Which kinds of metadata the file carried, never their values. */
1046
+ readonly metadata: ImageMetadataPresence;
1047
+ /** The fields the user may choose to keep, as the file had them. */
1048
+ readonly keepable: ImageKeepableMetadata;
1049
+ }
1050
+
1051
+ /**
1052
+ * A width and a height, in whole pixels.
1053
+ *
1054
+ * @public
1055
+ */
1056
+ declare interface ImageSize {
1057
+ readonly width: number;
1058
+ readonly height: number;
1059
+ }
1060
+
1061
+ /**
1062
+ * A source the session holds, without its pixels: what the snapshot shows
1063
+ * (ADR 0003). Its size is the oriented size.
1064
+ *
1065
+ * @public
1066
+ */
1067
+ declare interface ImageSourceInfo {
1068
+ readonly id: string;
1069
+ readonly format: ImageFormat;
1070
+ readonly width: number;
1071
+ readonly height: number;
1072
+ readonly frames: number;
1073
+ readonly hasAlpha: boolean;
1074
+ /** The bytes the decoded source takes in the worker: frames × width × height × 4. */
1075
+ readonly decodedBytes: number;
1076
+ }
1077
+
1078
+ /**
1079
+ * A small rendering of a source for lists and frame strips. An `ImageBitmap`
1080
+ * is one; tests can supply their own. Close it when it's no longer shown.
1081
+ *
1082
+ * @public
1083
+ */
1084
+ declare interface ImageThumbnail {
1085
+ readonly width: number;
1086
+ readonly height: number;
1087
+ close(): void;
1088
+ }
1089
+
1090
+ /**
1091
+ * Sets or removes the base's crop, in whole pixels of the oriented source.
1092
+ *
1093
+ * @public
1094
+ */
1095
+ declare interface SetCropCommand {
1096
+ readonly type: "image.setCrop";
1097
+ readonly crop: ImageCrop | null;
1098
+ }
1099
+
1100
+ /**
1101
+ * Sets some of the base's develop adjustments; the others keep their values
1102
+ * (ADR 0006).
1103
+ *
1104
+ * @public
1105
+ */
1106
+ declare interface SetDevelopCommand {
1107
+ readonly type: "image.setDevelop";
1108
+ readonly values: Partial<ImageDevelop>;
1109
+ }
1110
+
1111
+ /**
1112
+ * Sets the base's filter preset and strength, or removes it with `null`.
1113
+ *
1114
+ * @public
1115
+ */
1116
+ declare interface SetFilterCommand {
1117
+ readonly type: "image.setFilter";
1118
+ readonly filter: ImageFilter | null;
1119
+ }
1120
+
1121
+ /**
1122
+ * Sets one metadata field to keep on export. An empty value keeps nothing.
1123
+ *
1124
+ * @public
1125
+ */
1126
+ declare interface SetMetadataCommand {
1127
+ readonly type: "image.setMetadata";
1128
+ readonly field: keyof ImageKeepableMetadata;
1129
+ readonly value: string;
1130
+ }
1131
+
1132
+ /**
1133
+ * Sets the base's rotation and flips.
1134
+ *
1135
+ * @public
1136
+ */
1137
+ declare interface SetOrientationCommand {
1138
+ readonly type: "image.setOrientation";
1139
+ readonly orientation: ImageOrientation_2;
1140
+ }
1141
+
1142
+ /**
1143
+ * Sets the export's size.
1144
+ *
1145
+ * @public
1146
+ */
1147
+ declare interface SetOutputCommand {
1148
+ readonly type: "image.setOutput";
1149
+ readonly output: ImageOutput;
1150
+ }
1151
+
1152
+ export { }