@hussmartinez/image-sdk 0.2.0 → 0.4.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/dist/react.d.ts CHANGED
@@ -107,11 +107,11 @@ declare interface ImageCallOptions {
107
107
 
108
108
  /**
109
109
  * Every edit to an {@link ImagePlan}: plain, structured-cloneable data
110
- * (ADR 0003). Feature pull requests add their own commands to this union.
110
+ * (ADR 0003, ADR 0009).
111
111
  *
112
112
  * @public
113
113
  */
114
- declare type ImageCommand = SetCropCommand | SetOrientationCommand | SetOutputCommand | SetMetadataCommand | SetDevelopCommand | SetFilterCommand;
114
+ declare type ImageCommand = SetCropCommand | SetOrientationCommand | SetOutputCommand | SetMetadataCommand | SetDevelopCommand | SetFilterCommand | InsertLayersCommand | RemoveLayersCommand | MoveLayersCommand | UpdateLayersCommand | InsertRedactionsCommand | RemoveRedactionsCommand | MoveRedactionsCommand | UpdateRedactionsCommand | ImageInverseCommand;
115
115
 
116
116
  /**
117
117
  * A rectangle in whole pixels of the oriented source: `x` and `y` from its
@@ -214,6 +214,12 @@ export declare interface ImageEditorHandle {
214
214
  readonly session: ImageSession;
215
215
  /** Opens an image, replacing the current one once it has opened. */
216
216
  open(file: Blob): Promise<void>;
217
+ /**
218
+ * Adds an image as a layer in the middle of the image as it's shown, as
219
+ * one undoable step, and shows the layers with it selected. A file that
220
+ * can't be added is reported on the stage, as a failed open is.
221
+ */
222
+ insertImage(file: Blob): Promise<void>;
217
223
  /** Applies commands as one undoable step. */
218
224
  execute(commands: ImageCommand | readonly ImageCommand[]): void;
219
225
  /** Renders and encodes the image as it is now. */
@@ -224,6 +230,381 @@ export declare interface ImageEditorHandle {
224
230
  redo(): void;
225
231
  }
226
232
 
233
+ /**
234
+ * The type of {@link imageEditorMessages}, for typing the editor's
235
+ * `messages` overrides with `MessageOverrides<ImageEditorMessageCatalogue>`.
236
+ *
237
+ * @public
238
+ */
239
+ export declare type ImageEditorMessageCatalogue = typeof imageEditorMessages;
240
+
241
+ /**
242
+ * The English message catalogue of the SDK's components: `imageMessages`,
243
+ * with sdk-core's text, errors and warnings; `@hussmartinez/ui`'s, for the
244
+ * ui components the editor renders (sdk-core ADR 0046); and the text of the
245
+ * editor, its stage, toolbar and tools, its panels and the export dialog.
246
+ *
247
+ * `ImageEditor`, `ImageEditorProvider` and `<hm-image-editor>` each build
248
+ * one `Messages` object from it, with the host's locale and overrides, and
249
+ * the editor gives the same object to its own components and to ui's.
250
+ * Override any of its keys through their `messages`, typed with
251
+ * `ImageEditorMessageCatalogue`.
252
+ *
253
+ * It's defined in the React entry, so the server-safe `.` entry and its
254
+ * `imageMessages` carry no interface text (docs/adr/0012).
255
+ *
256
+ * @public
257
+ */
258
+ export declare const imageEditorMessages: {
259
+ readonly "editor.engineUnavailable": "Image processing stopped. Reload this page or reopen the editor, then choose the image again. Unsaved edits will be lost unless your application has saved them.";
260
+ readonly "editor.label": "Image editor";
261
+ readonly "editor.preview": "Edited image preview, {width, number} × {height, number}";
262
+ readonly "editor.empty": "Open an image to start editing. It stays on this device.";
263
+ readonly "editor.choose": "Choose an image";
264
+ readonly "editor.dropHint": "or drop it here";
265
+ readonly "editor.opening": "Opening the image…";
266
+ readonly "editor.cancel": "Cancel";
267
+ readonly "editor.opened": "Image opened, {width, number} × {height, number}.";
268
+ readonly "editor.undid": "Undid {action}.";
269
+ readonly "editor.redid": "Redid {action}.";
270
+ readonly "actions.image.setCrop": "crop";
271
+ readonly "actions.image.setOrientation": "rotate or flip";
272
+ readonly "actions.image.setOutput": "size";
273
+ readonly "actions.image.setMetadata": "metadata";
274
+ readonly "actions.image.setDevelop": "adjustment";
275
+ readonly "actions.image.setFilter": "filter";
276
+ readonly "actions.image.insertLayers": "layer";
277
+ readonly "actions.image.removeLayers": "layer";
278
+ readonly "actions.image.restoreLayers": "layer";
279
+ readonly "actions.image.moveLayers": "layer order";
280
+ readonly "actions.image.setLayerOrder": "layer order";
281
+ readonly "actions.image.updateLayers": "layer change";
282
+ readonly "actions.image.insertRedactions": "redaction";
283
+ readonly "actions.image.removeRedactions": "redaction";
284
+ readonly "actions.image.restoreRedactions": "redaction";
285
+ readonly "actions.image.moveRedactions": "redaction order";
286
+ readonly "actions.image.setRedactionOrder": "redaction order";
287
+ readonly "actions.image.updateRedactions": "redaction change";
288
+ readonly "toolbar.label": "Image tools";
289
+ readonly "toolbar.groups.file": "File";
290
+ readonly "toolbar.groups.history": "History";
291
+ readonly "toolbar.groups.orientation": "Rotate";
292
+ readonly "toolbar.groups.zoom": "Zoom";
293
+ readonly "toolbar.groups.other": "More tools";
294
+ readonly "tools.open": "Open image";
295
+ readonly "tools.undo": "Undo";
296
+ readonly "tools.redo": "Redo";
297
+ readonly "tools.rotate-left": "Rotate left";
298
+ readonly "tools.rotate-right": "Rotate right";
299
+ readonly "tools.zoom-in": "Zoom in";
300
+ readonly "tools.zoom-out": "Zoom out";
301
+ readonly "tools.zoom-fit": "Fit to the stage";
302
+ readonly "tools.crop": "Crop";
303
+ readonly "tools.flip-horizontal": "Flip horizontally";
304
+ readonly "tools.flip-vertical": "Flip vertically";
305
+ readonly "toolbar.groups.crop": "Crop";
306
+ readonly "crop.frame": "Crop area";
307
+ readonly "crop.frameDescription": "{width, number} × {height, number} pixels, from {x, number}, {y, number}. Arrow keys move it; with Shift, they resize it; Enter applies and Escape cancels.";
308
+ readonly "crop.size": "{width, number} × {height, number}, from {x, number}, {y, number}";
309
+ readonly "crop.panel": "Crop";
310
+ readonly "crop.x": "Left";
311
+ readonly "crop.y": "Top";
312
+ readonly "crop.width": "Width";
313
+ readonly "crop.height": "Height";
314
+ readonly "crop.aspect": "Aspect ratio";
315
+ readonly "crop.aspects.free": "Free";
316
+ readonly "crop.aspects.original": "Original";
317
+ readonly "crop.aspects.ratio": "{width}:{height}";
318
+ readonly "crop.apply": "Apply crop";
319
+ readonly "crop.cancel": "Cancel";
320
+ readonly "crop.reset": "Whole image";
321
+ readonly "crop.applied": "Cropped to {width, number} × {height, number}.";
322
+ readonly "tools.redact": "Redact";
323
+ readonly "toolbar.groups.redact": "Redact";
324
+ readonly "redact.panel": "Redact";
325
+ readonly "redact.intro": "Cover parts of the image. Only the exported image is redacted: the original stays in the editor.";
326
+ readonly "redact.add": "Add area";
327
+ readonly "redact.done": "Done";
328
+ readonly "redact.mode": "Cover with";
329
+ readonly "redact.modes.solid": "Solid colour";
330
+ readonly "redact.modes.pixelate": "Pixelation";
331
+ readonly "redact.pixelateHint": "Pixelation may not hide text. For text and numbers, use a solid colour.";
332
+ readonly "redact.colour": "Colour";
333
+ readonly "redact.colours.black": "Black";
334
+ readonly "redact.colours.white": "White";
335
+ readonly "redact.x": "Left";
336
+ readonly "redact.y": "Top";
337
+ readonly "redact.width": "Width";
338
+ readonly "redact.height": "Height";
339
+ readonly "redact.areas": "Redacted areas";
340
+ readonly "redact.none": "No areas yet. Drag across the image, or add one.";
341
+ readonly "redact.area": "Area {index, number}: {mode}, {width, number} × {height, number}";
342
+ readonly "redact.modeNames.solid": "solid colour";
343
+ readonly "redact.modeNames.pixelate": "pixelated";
344
+ readonly "redact.remove": "Remove area {index, number}";
345
+ readonly "redact.frame": "Redacted area {index, number} of {count, number}";
346
+ readonly "redact.frameDescription": "{mode}, {width, number} × {height, number} pixels, from {x, number}, {y, number}. Arrow keys move it; with Shift, they resize it; Delete removes it and Escape ends redacting.";
347
+ readonly "redact.added": {
348
+ readonly $plural: "count";
349
+ } & {
350
+ readonly one: "Area added. {count} area is redacted.";
351
+ readonly other: "Area added. {count, number} areas are redacted.";
352
+ };
353
+ readonly "redact.removedLast": "Area removed. Nothing is redacted.";
354
+ readonly "redact.removed": {
355
+ readonly $plural: "count";
356
+ } & {
357
+ readonly one: "Area removed. {count} area is redacted.";
358
+ readonly other: "Area removed. {count, number} areas are redacted.";
359
+ };
360
+ readonly "tools.add-text": "Add text";
361
+ readonly "tools.add-rectangle": "Add a rectangle";
362
+ readonly "tools.add-ellipse": "Add an ellipse";
363
+ readonly "tools.add-image": "Add an image";
364
+ readonly "toolbar.groups.add": "Add";
365
+ readonly "editor.inserting": "Adding the image…";
366
+ readonly "layers.text": "Text";
367
+ readonly "layers.font": "Font";
368
+ readonly "layers.fonts.sans-serif": "Sans";
369
+ readonly "layers.fonts.serif": "Serif";
370
+ readonly "layers.fonts.monospace": "Mono";
371
+ readonly "layers.align": "Alignment";
372
+ readonly "layers.alignments.start": "Start";
373
+ readonly "layers.alignments.center": "Centre";
374
+ readonly "layers.alignments.end": "End";
375
+ readonly "layers.bold": "Bold";
376
+ readonly "layers.colour": "Colour";
377
+ readonly "layers.fill": "Fill";
378
+ readonly "layers.outline": "Outline";
379
+ readonly "layers.fillColour": "Fill colour";
380
+ readonly "layers.outlineColour": "Outline colour";
381
+ readonly "layers.outlineWidth": "Outline width";
382
+ readonly "layers.colours.black": "Black";
383
+ readonly "layers.colours.white": "White";
384
+ readonly "layers.colours.red": "Red";
385
+ readonly "layers.colours.yellow": "Yellow";
386
+ readonly "layers.colours.green": "Green";
387
+ readonly "layers.colours.blue": "Blue";
388
+ readonly "tools.layers": "Layers";
389
+ readonly "toolbar.groups.layers": "Layers";
390
+ readonly "layers.panel": "Layers";
391
+ readonly "layers.list": "Layers, the top one first";
392
+ readonly "layers.none": "No layers yet. Add text, a shape or an image from the toolbar.";
393
+ readonly "layers.kinds.text": "Text";
394
+ readonly "layers.kinds.rectangle": "Rectangle";
395
+ readonly "layers.kinds.ellipse": "Ellipse";
396
+ readonly "layers.kinds.image": "Image";
397
+ readonly "layers.visible": "Show {name}";
398
+ readonly "layers.selected": "Selected layer";
399
+ readonly "layers.moveUp": "Move up";
400
+ readonly "layers.moveDown": "Move down";
401
+ readonly "layers.mirror": "Mirror";
402
+ readonly "layers.duplicate": "Duplicate";
403
+ readonly "layers.remove": "Delete";
404
+ readonly "layers.name": "Name";
405
+ readonly "layers.x": "Left";
406
+ readonly "layers.y": "Top";
407
+ readonly "layers.width": "Width";
408
+ readonly "layers.height": "Height";
409
+ readonly "layers.rotation": "Turn, in degrees";
410
+ readonly "layers.opacity": "Opacity, in percent";
411
+ readonly "layers.done": "Done";
412
+ readonly "layers.frame": "Layer {index, number} of {count, number}: {name}";
413
+ readonly "layers.frameDescription": "{width, number} × {height, number} pixels, from {x, number}, {y, number}, turned {degrees, number}°. Arrow keys move it; with Shift, they resize it; Delete removes it and Escape closes the layers.";
414
+ readonly "layers.movedUp": "Moved {name} up. It's layer {index, number} of {count, number}.";
415
+ readonly "layers.movedDown": "Moved {name} down. It's layer {index, number} of {count, number}.";
416
+ readonly "layers.duplicated": "Duplicated {name}.";
417
+ readonly "layers.removed": "Deleted {name}.";
418
+ readonly "inspector.label": "Panels";
419
+ readonly "inspector.adjust": "Adjust";
420
+ readonly "inspector.filters": "Filters";
421
+ readonly "inspector.info": "Info";
422
+ readonly "notices.label": "Notices";
423
+ readonly "notices.dismiss": "Dismiss";
424
+ readonly "notices.colourProfile": "This image has a colour profile. Colours outside sRGB will be clipped in the exported file.";
425
+ readonly "info.panel": "Image info";
426
+ readonly "info.size": "Size";
427
+ readonly "info.sizeValue": "{width, number} × {height, number} pixels";
428
+ readonly "info.format": "Format";
429
+ readonly "info.formats.png": "PNG";
430
+ readonly "info.formats.jpeg": "JPEG";
431
+ readonly "info.formats.webp": "WebP";
432
+ readonly "info.formats.gif": "GIF";
433
+ readonly "info.formats.avif": "AVIF";
434
+ readonly "info.formats.heif": "HEIF";
435
+ readonly "info.formats.bmp": "BMP";
436
+ readonly "info.frames": "Frames";
437
+ readonly "info.fileSize": "File size";
438
+ readonly "info.fileSizeValue": "{size, fileSize}";
439
+ readonly "info.metadata": "Metadata in the file";
440
+ readonly "info.metadataNone": "None";
441
+ readonly "info.kept": "Kept on export";
442
+ readonly "info.keptNone": "Nothing";
443
+ readonly "develop.panel": "Adjust";
444
+ readonly "develop.temperature": "Temperature";
445
+ readonly "develop.tint": "Tint";
446
+ readonly "develop.exposure": "Exposure";
447
+ readonly "develop.highlights": "Highlights";
448
+ readonly "develop.shadows": "Shadows";
449
+ readonly "develop.contrast": "Contrast";
450
+ readonly "develop.saturation": "Saturation";
451
+ readonly "develop.vibrance": "Vibrance";
452
+ readonly "develop.reset": "Reset {name}";
453
+ readonly "develop.resetAll": "Reset all";
454
+ readonly "develop.wasReset": "All adjustments reset.";
455
+ readonly "filters.panel": "Filters";
456
+ readonly "filters.label": "Filter";
457
+ readonly "filters.none": "None";
458
+ readonly "filters.vivid": "Vivid";
459
+ readonly "filters.warm": "Warm";
460
+ readonly "filters.cool": "Cool";
461
+ readonly "filters.fade": "Fade";
462
+ readonly "filters.mono": "Mono";
463
+ readonly "filters.noir": "Noir";
464
+ readonly "filters.sepia": "Sepia";
465
+ readonly "filters.strength": "Strength";
466
+ readonly "toolbar.groups.export": "Export";
467
+ readonly "tools.export": "Export";
468
+ readonly "export.title": "Export image";
469
+ readonly "export.description": "The file is made on this device, and nothing is uploaded.";
470
+ readonly "export.format": "Format";
471
+ readonly "export.formats.png": "PNG";
472
+ readonly "export.formats.jpeg": "JPEG";
473
+ readonly "export.formats.webp": "WebP";
474
+ readonly "export.quality": "Quality";
475
+ readonly "export.qualityValue": "{quality, number}%";
476
+ readonly "export.size": "Size";
477
+ readonly "export.sizes.scale": "Scale";
478
+ readonly "export.sizes.fit": "Fit in a box";
479
+ readonly "export.scale": "Scale, in percent";
480
+ readonly "export.fitWidth": "Largest width";
481
+ readonly "export.fitHeight": "Largest height";
482
+ readonly "export.fields": "Details to include";
483
+ readonly "export.fieldsHint": "Only what you fill in is written to the file.";
484
+ readonly "export.field.title": "Title";
485
+ readonly "export.field.description": "Description";
486
+ readonly "export.field.artist": "Artist";
487
+ readonly "export.field.copyright": "Copyright";
488
+ readonly "export.summary": "Summary";
489
+ readonly "export.output": "{width, number} × {height, number} pixels, {format}";
490
+ readonly "export.removed": "Removed from the file";
491
+ readonly "export.removedNone": "The image had no other details to remove.";
492
+ readonly "export.redacted": {
493
+ readonly $plural: "count";
494
+ } & {
495
+ readonly one: "{count} area is redacted.";
496
+ readonly other: "{count, number} areas are redacted.";
497
+ };
498
+ readonly "export.redactedPixelated": "Pixelated areas may not hide text.";
499
+ readonly "export.kind.location": "Location";
500
+ readonly "export.kind.camera": "Camera details";
501
+ readonly "export.kind.timestamps": "Dates and times";
502
+ readonly "export.kind.thumbnail": "Embedded thumbnail";
503
+ readonly "export.kind.colourProfile": "Colour profile: colours outside sRGB are clipped";
504
+ readonly "export.kind.other": "Other metadata";
505
+ readonly "export.kept": "Kept in the file";
506
+ readonly "export.confirm": "Export";
507
+ readonly "export.cancel": "Cancel";
508
+ readonly "export.progress": "Exporting the image";
509
+ readonly "export.stop": "Stop exporting";
510
+ readonly "export.cancelled": "Export stopped.";
511
+ readonly "export.done": "Exported a {format} of {size, fileSize}.";
512
+ readonly "export.ready": "{width, number} × {height, number} pixels, {format}, {size, fileSize}";
513
+ readonly "export.download": "Download";
514
+ readonly "export.close": "Done";
515
+ readonly "colorField.swatches": "swatches";
516
+ readonly "dialog.close": "Close";
517
+ readonly "fileDropZone.choose": "Choose a file";
518
+ readonly "fileDropZone.chooseMultiple": "Choose files";
519
+ readonly "fileDropZone.hint": "or drop it here";
520
+ readonly "fileDropZone.hintMultiple": "or drop them here";
521
+ readonly "progress.label": "Progress";
522
+ readonly "spinner.label": "Loading";
523
+ readonly "errors.INVALID_THEME_TOKEN": "The theme setting {token} has a value that can't be used.";
524
+ readonly "errors.INVALID_THEME_SELECTOR": "The theme can't be applied to the selector {selector}.";
525
+ readonly "errors.INVALID_IMAGE": "This file isn't a valid image, or it's too damaged to open.";
526
+ readonly "errors.UNSUPPORTED_FORMAT": "This image format isn't supported. Try converting the file to PNG or JPEG, then open it again.";
527
+ readonly "errors.DECODE_FAILED": "This browser can't open this kind of image. Try another browser, or convert the file to PNG or JPEG.";
528
+ readonly "errors.INVALID_COMMAND": "This edit couldn't be made. Please try again.";
529
+ readonly "errors.INVALID_DOCUMENT": "This project is damaged, or it isn't an image project.";
530
+ readonly "errors.UNSUPPORTED_PLAN": "This image has edits this version can't show. Update the application and try again.";
531
+ readonly "errors.IMAGE_TOO_LARGE": "This image has more pixels than the editor can handle. Try a smaller version of it.";
532
+ readonly "errors.IMAGE_DIMENSION_TOO_LARGE": "This image is {actual, number} pixels across, which is over the {maximum, number}-pixel limit.";
533
+ readonly "errors.TOO_MANY_FRAMES": {
534
+ readonly $plural: "maximum";
535
+ } & {
536
+ readonly one: "This animation has {actual, number} frames, which is over the {maximum}-frame limit.";
537
+ readonly other: "This animation has {actual, number} frames, which is over the {maximum, number}-frame limit.";
538
+ };
539
+ 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.";
540
+ readonly "errors.TOO_MANY_LAYERS": {
541
+ readonly $plural: "maximum";
542
+ } & {
543
+ readonly one: "An image can have {maximum} layer. Merge or delete layers, and try again.";
544
+ readonly other: "An image can have up to {maximum, number} layers. Merge or delete layers, and try again.";
545
+ };
546
+ readonly "warnings.maxImagePixels": "This image is large, and may be slow to edit on some devices.";
547
+ readonly "warnings.maxImageDimension": "This image is very wide or tall, and may be slow to edit.";
548
+ readonly "warnings.maxFrames": {
549
+ readonly $plural: "actual";
550
+ } & {
551
+ readonly one: "This animation has {actual} frame.";
552
+ readonly other: "This animation has {actual, number} frames, and may be slow to edit and export.";
553
+ };
554
+ readonly "warnings.maxSessionSize": "The open images use {actual, fileSize} of memory. Clearing the undo history frees memory.";
555
+ readonly "warnings.maxLayers": {
556
+ readonly $plural: "actual";
557
+ } & {
558
+ readonly one: "This image has {actual} layer.";
559
+ readonly other: "This image has {actual, number} layers, and may be slow to edit and export.";
560
+ };
561
+ readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
562
+ readonly "errors.ABORTED": "The operation was cancelled.";
563
+ readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
564
+ readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
565
+ readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
566
+ readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
567
+ readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
568
+ readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
569
+ readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
570
+ readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
571
+ readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
572
+ readonly "errors.TOO_MANY_FILES": {
573
+ readonly $plural: "maximum";
574
+ } & {
575
+ readonly one: "You can add {maximum} file at a time.";
576
+ readonly other: "You can add up to {maximum} files at a time.";
577
+ };
578
+ readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
579
+ readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
580
+ readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
581
+ readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
582
+ readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
583
+ readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
584
+ readonly "keys.control": "Ctrl";
585
+ readonly "keys.alt": "Alt";
586
+ readonly "keys.shift": "Shift";
587
+ readonly "keys.meta": "Meta";
588
+ readonly "keys.apple.control": "\u2303";
589
+ readonly "keys.apple.alt": "\u2325";
590
+ readonly "keys.apple.shift": "\u21E7";
591
+ readonly "keys.apple.meta": "\u2318";
592
+ readonly "keys.space": "Space";
593
+ readonly "keys.enter": "Enter";
594
+ readonly "keys.escape": "Esc";
595
+ readonly "keys.tab": "Tab";
596
+ readonly "keys.delete": "Delete";
597
+ readonly "keys.backspace": "Backspace";
598
+ readonly "keys.arrowUp": "\u2191";
599
+ readonly "keys.arrowDown": "\u2193";
600
+ readonly "keys.arrowLeft": "\u2190";
601
+ readonly "keys.arrowRight": "\u2192";
602
+ readonly "keys.home": "Home";
603
+ readonly "keys.end": "End";
604
+ readonly "keys.pageUp": "Page Up";
605
+ readonly "keys.pageDown": "Page Down";
606
+ };
607
+
227
608
  /**
228
609
  * The parts of `ImageEditor` that take extra classes through `classNames`.
229
610
  *
@@ -314,7 +695,7 @@ export declare interface ImageEditorProviderProps {
314
695
  /** Anonymous usage events from a session the provider creates. */
315
696
  readonly onEvent?: (event: ImageSessionEvent) => void;
316
697
  /** Text overrides, typed against the English catalogue (ADR 0019). */
317
- readonly messages?: MessageOverrides<ImageMessageCatalogue>;
698
+ readonly messages?: MessageOverrides<ImageEditorMessageCatalogue>;
318
699
  /** The locale for numbers and plurals. Defaults to `"en"`. */
319
700
  readonly locale?: string;
320
701
  /** The components that use the session, such as `ImageStage`. */
@@ -323,28 +704,59 @@ export declare interface ImageEditorProviderProps {
323
704
 
324
705
  /**
325
706
  * The editor's own state, outside the session and its history
326
- * (docs/adr/0007): the active tool, a crop in progress, and a gesture's
327
- * transient plan, which the stage renders instead of the session's.
707
+ * (docs/adr/0007): the active tool, a crop in progress, the redaction or
708
+ * the layer that's selected, and a gesture's transient plan, which the
709
+ * stage renders instead of the session's.
328
710
  *
329
711
  * @public
330
712
  */
331
713
  export declare interface ImageEditorState {
332
714
  /** The tool that takes over the stage, such as `crop`, or `null`. */
333
- readonly tool: "crop" | null;
715
+ readonly tool: "crop" | "redact" | "layers" | null;
334
716
  /** The crop being made, in whole pixels of the oriented source, and its aspect. */
335
717
  readonly crop: {
336
718
  readonly pending: ImageCrop;
337
719
  readonly aspect: ImageAspect;
338
720
  } | null;
339
721
  /**
340
- * A gesture's plan while it runs: the session's plan with the gesture's
341
- * change, which isn't an edit until the gesture ends.
722
+ * While redacting: the key of the selected redaction, if any, and the mode
723
+ * and colour a new one takes (docs/adr/0010).
342
724
  */
343
- readonly preview: ImagePlan | null;
344
- /** The dialog the editor shows over the stage, such as `export`, or `null`. */
345
- readonly dialog: "export" | null;
346
- }
347
-
725
+ readonly redact: {
726
+ readonly selected: string | null;
727
+ readonly mode: ImageRedactionMode;
728
+ readonly colour: string;
729
+ } | null;
730
+ /**
731
+ * While the layers are shown: the key of the selected layer, if any
732
+ * (docs/adr/0013). Selection is view state, outside the plan and its
733
+ * history.
734
+ */
735
+ readonly layers: {
736
+ readonly selected: string | null;
737
+ /**
738
+ * Where the panel moves focus, once, before it clears this: to the
739
+ * selected layer in the `list`, when the layers tool starts; or to the
740
+ * `text` field of a text layer just added. Unset, focus stays where it
741
+ * is, as when a shape or an image is added.
742
+ */
743
+ readonly focus?: "list" | "text";
744
+ } | null;
745
+ /**
746
+ * What an editor's own action failed with, such as adding a layer over
747
+ * the limit or an image that can't be read. The stage shows its text
748
+ * until the next such action succeeds, or another image opens.
749
+ */
750
+ readonly error: ImageError | null;
751
+ /**
752
+ * A gesture's plan while it runs: the session's plan with the gesture's
753
+ * change, which isn't an edit until the gesture ends.
754
+ */
755
+ readonly preview: ImagePlan | null;
756
+ /** The dialog the editor shows over the stage, such as `export`, or `null`. */
757
+ readonly dialog: "export" | null;
758
+ }
759
+
348
760
  /**
349
761
  * The editor's colour mode: ui's light or dark theme, or the system's. Unset,
350
762
  * it inherits the page's.
@@ -443,6 +855,10 @@ declare class ImageError extends SdkError<ImageErrorCode> {
443
855
  * valid in its format. `details.reason` says why (`ImageDocumentRejection`).
444
856
  * A document of another format, or a later version, is `UNSUPPORTED_FORMAT`
445
857
  * instead, with `details.reason` `unknown-format` or `unknown-format-version`.
858
+ * - `UNSUPPORTED_PLAN`: a plan holds something the renderer or processor
859
+ * can't draw, such as a layer kind from a later release. Nothing is drawn
860
+ * or exported without it (ADR 0009). `details.reason` names the part:
861
+ * `layers`, `redactions` or `animation`.
446
862
  * - `IMAGE_TOO_LARGE`: an image, a frame, the canvas or the export exceeds
447
863
  * the `maxImagePixels` limit.
448
864
  * - `IMAGE_DIMENSION_TOO_LARGE`: a width or height exceeds the
@@ -458,7 +874,7 @@ declare class ImageError extends SdkError<ImageErrorCode> {
458
874
  *
459
875
  * @public
460
876
  */
461
- 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";
877
+ declare type ImageErrorCode = SdkCoreErrorCode | "INVALID_IMAGE" | "UNSUPPORTED_FORMAT" | "DECODE_FAILED" | "INVALID_COMMAND" | "INVALID_DOCUMENT" | "UNSUPPORTED_PLAN" | "IMAGE_TOO_LARGE" | "IMAGE_DIMENSION_TOO_LARGE" | "TOO_MANY_FRAMES" | "SESSION_TOO_LARGE" | "TOO_MANY_LAYERS";
462
878
 
463
879
  /**
464
880
  * The export dialog (docs/adr/0007). Export is irreversible, so it shows a
@@ -613,6 +1029,19 @@ declare type ImageFormat = "png" | "jpeg" | "webp" | "gif" | "avif" | "heif" | "
613
1029
  */
614
1030
  export declare const imageIcons: Readonly<Record<string, IconComponent>>;
615
1031
 
1032
+ /**
1033
+ * Another image, drawn to fill its box (ADR 0009).
1034
+ *
1035
+ * @public
1036
+ */
1037
+ declare interface ImageImageLayer extends ImageLayerCommon, ImageLayerBox {
1038
+ readonly kind: "image";
1039
+ /** The id of a registered source. */
1040
+ readonly source: string;
1041
+ /** The part of that source to draw, in its own pixels, or `null` for all of it. */
1042
+ readonly crop: ImageCrop | null;
1043
+ }
1044
+
616
1045
  /**
617
1046
  * The Info panel (docs/adr/0007): what the editor knows of the open image,
618
1047
  * as a list of terms: its upright size, format, frames and file size, the
@@ -633,6 +1062,30 @@ export declare interface ImageInfoPanelProps {
633
1062
  readonly className?: string;
634
1063
  }
635
1064
 
1065
+ /**
1066
+ * Options for {@link ImageSession.insertImage}.
1067
+ *
1068
+ * @public
1069
+ */
1070
+ declare interface ImageInsertOptions {
1071
+ readonly signal?: AbortSignal;
1072
+ /**
1073
+ * The commands that add the image to the plan, instead of the default
1074
+ * layer: given the new source and the plan as it is.
1075
+ */
1076
+ readonly place?: (source: ImageSessionSource, plan: ImagePlan) => ImageCommand | readonly ImageCommand[];
1077
+ }
1078
+
1079
+ /**
1080
+ * The commands that exist only to undo others. The reducer applies them, and
1081
+ * they're plain data like every command, but the `hm-image-command` format
1082
+ * doesn't include them: an inverse's shape may change between releases
1083
+ * (sdk-core ADR 0045).
1084
+ *
1085
+ * @public
1086
+ */
1087
+ declare type ImageInverseCommand = RestoreLayersCommand | SetLayerOrderCommand | RestoreRedactionsCommand | SetRedactionOrderCommand;
1088
+
636
1089
  /**
637
1090
  * The metadata fields a user may keep on export (ADR 0005). Empty strings
638
1091
  * mean the field isn't written.
@@ -647,353 +1100,182 @@ declare interface ImageKeepableMetadata {
647
1100
  }
648
1101
 
649
1102
  /**
650
- * The type of {@link imageLimitDefinitions}.
1103
+ * A layer over the base: text, a shape or another image (ADR 0009). Layers
1104
+ * are drawn bottom to top, in the plan's order, and redactions over all of
1105
+ * them.
651
1106
  *
652
1107
  * @public
653
1108
  */
654
- declare type ImageLimitDefinitions = typeof imageLimitDefinitions;
1109
+ declare type ImageLayer = ImageTextLayer | ImageShapeLayer | ImageImageLayer;
655
1110
 
656
1111
  /**
657
- * The image SDK's limit definitions: sdk-core's core limits with image
658
- * defaults, plus five for images (ADR 0004).
659
- *
660
- * | Limit | Code | Default maximum | Default warning |
661
- * |---|---|---|---|
662
- * | `maxFileSize` | `FILE_TOO_LARGE` | 100 MB | 50 MB |
663
- * | `maxFiles` | `TOO_MANY_FILES` | 20 | none |
664
- * | `maxDecodedSize` | `DECODED_SIZE_TOO_LARGE` | 1 GB | 400 MB |
665
- * | `maxProcessingTime` | `PROCESSING_TIME_EXCEEDED` | 120 s | none |
666
- * | `maxImagePixels` | `IMAGE_TOO_LARGE` | 50 megapixels | 24 megapixels |
667
- * | `maxImageDimension` | `IMAGE_DIMENSION_TOO_LARGE` | 16,384 pixels | none |
668
- * | `maxFrames` | `TOO_MANY_FRAMES` | 300 | 100 |
669
- * | `maxSessionSize` | `SESSION_TOO_LARGE` | 1 GB | 500 MB |
670
- * | `maxLayers` | `TOO_MANY_LAYERS` | 256 | none |
671
- *
672
- * Sizes are decimal: 1 MB is 1,000,000 bytes. Decoded sizes count 4 bytes
673
- * per pixel. `maxImagePixels` is the same limit, with the same name, code
674
- * and unit, as `pdf-sdk`'s. `maxImageDimension` is a side length, in pixels.
1112
+ * Where a positioned layer is: a box in whole pixels of the scene, the
1113
+ * base's oriented source, mirrored or not, then turned about its centre
1114
+ * (ADR 0009). The box stays
1115
+ * on the pixels it covers when the image is cropped or turned.
675
1116
  *
676
1117
  * @public
677
1118
  */
678
- declare const imageLimitDefinitions: {
679
- readonly maxDecodedSize: {
680
- readonly default: 1000000000;
681
- readonly warning: 400000000;
682
- readonly code: "DECODED_SIZE_TOO_LARGE";
683
- readonly unit: "bytes";
684
- };
685
- readonly maxImagePixels: {
686
- readonly code: "IMAGE_TOO_LARGE";
687
- readonly unit: "pixels";
688
- readonly default: 50000000;
689
- readonly warning: 24000000;
690
- };
691
- readonly maxImageDimension: {
692
- readonly code: "IMAGE_DIMENSION_TOO_LARGE";
693
- readonly unit: "pixels";
694
- readonly default: 16384;
695
- };
696
- readonly maxFrames: {
697
- readonly code: "TOO_MANY_FRAMES";
698
- readonly unit: "count";
699
- readonly default: 300;
700
- readonly warning: 100;
701
- };
702
- readonly maxSessionSize: {
703
- readonly code: "SESSION_TOO_LARGE";
704
- readonly unit: "bytes";
705
- readonly default: 1000000000;
706
- readonly warning: 500000000;
707
- };
708
- readonly maxLayers: {
709
- readonly code: "TOO_MANY_LAYERS";
710
- readonly unit: "count";
711
- readonly default: 256;
712
- };
713
- readonly maxFileSize: {
714
- readonly code: "FILE_TOO_LARGE";
715
- readonly unit: "bytes";
716
- readonly default: 100000000;
717
- readonly warning: 50000000;
718
- };
719
- readonly maxFiles: {
720
- readonly code: "TOO_MANY_FILES";
721
- readonly unit: "count";
722
- readonly default: 20;
723
- };
724
- readonly maxProcessingTime: {
725
- readonly code: "PROCESSING_TIME_EXCEEDED";
726
- readonly unit: "milliseconds";
727
- readonly default: 120000;
728
- };
729
- };
1119
+ declare interface ImageLayerBox {
1120
+ /** The box's left edge, before its rotation. May be negative. */
1121
+ readonly x: number;
1122
+ /** The box's top edge, before its rotation. May be negative. */
1123
+ readonly y: number;
1124
+ /** At least 1. */
1125
+ readonly width: number;
1126
+ /** At least 1. */
1127
+ readonly height: number;
1128
+ /** Tenths of a degree, clockwise about the box's centre: 0 to 3599. */
1129
+ readonly rotation: number;
1130
+ /**
1131
+ * Whether the layer is mirrored left to right, about the box's own
1132
+ * vertical axis, before it's turned. With a half turn, that's a mirror top
1133
+ * to bottom, so one flip is all a box needs.
1134
+ */
1135
+ readonly flipX: boolean;
1136
+ }
730
1137
 
731
1138
  /**
732
- * The names of the image SDK's limits.
1139
+ * What every layer has (ADR 0009).
733
1140
  *
734
1141
  * @public
735
1142
  */
736
- declare type ImageLimitName = keyof ImageLimitDefinitions;
1143
+ declare interface ImageLayerCommon {
1144
+ /**
1145
+ * Its identity: 1 to `MAX_KEY_LENGTH` code points, unique among the plan's
1146
+ * layers and redactions.
1147
+ */
1148
+ readonly key: string;
1149
+ /**
1150
+ * What the layers list calls it: up to `MAX_LAYER_NAME_LENGTH` code
1151
+ * points. Empty means the editor's own label for the kind.
1152
+ */
1153
+ readonly name: string;
1154
+ /** Whether it's drawn. */
1155
+ readonly visible: boolean;
1156
+ /** A whole number from 0, transparent, to 100, opaque. */
1157
+ readonly opacity: number;
1158
+ }
737
1159
 
738
1160
  /**
739
- * The type of {@link imageMessages}, for typing a host's overrides with
740
- * `MessageOverrides<ImageMessageCatalogue>`.
1161
+ * The layers panel (docs/adr/0013), shown while the layers tool is on: the
1162
+ * list of layers, the top one first, each with a button that selects it and
1163
+ * one that shows or hides it; buttons that move the selected layer up and
1164
+ * down the stack, copy it and delete it; and its name, place, size, turn and
1165
+ * opacity as fields. Everything a frame on the stage does with a drag, the
1166
+ * panel does with a button or a field (WCAG 2.5.7).
1167
+ *
1168
+ * While focus is in the list, `Alt` (`Option` on macOS) with the Up and
1169
+ * Down arrows moves the focused layer up and down the stack, and `Delete`
1170
+ * removes it: pdf-sdk's keys for its pages.
1171
+ *
1172
+ * The panel keeps its size, whatever is selected: with no layer selected its
1173
+ * fields are disabled, and keep their place. Where the inspector sits under
1174
+ * the stage, a panel that grew would shrink the stage, and move the image
1175
+ * under the pointer.
741
1176
  *
742
1177
  * @public
743
1178
  */
744
- declare type ImageMessageCatalogue = typeof imageMessages;
1179
+ export declare function ImageLayersPanel(props: ImageLayersPanelProps): ReactNode;
745
1180
 
746
1181
  /**
747
- * The image SDK's English message catalogue: sdk-core's and ui's messages, and text
748
- * for every {@link ImageErrorCode} and every limit's warning. Pass it to
749
- * `createMessages` from `@hussmartinez/sdk-core`, with the host's locale and
750
- * overrides. It also has the editor's text: its labels, states,
751
- * announcements and tool names.
752
- *
753
- * Error text is looked up by code, with the error's `details` as
754
- * parameters, and never taken from `error.message` (ADR 0019).
1182
+ * Props of {@link ImageLayersPanel}.
755
1183
  *
756
- * @example
757
- * ```ts
758
- * const messages = createMessages(imageMessages, { locale: "en", overrides: props.messages });
759
- * messages.error(error); // "This animation has 400 frames, which is over the 300-frame limit."
760
- * messages.t("warnings.maxSessionSize", { actual: 600e6 });
761
- * ```
1184
+ * @public
1185
+ */
1186
+ export declare interface ImageLayersPanelProps {
1187
+ readonly className?: string;
1188
+ }
1189
+
1190
+ /**
1191
+ * The type of {@link imageLimitDefinitions}.
762
1192
  *
763
1193
  * @public
764
1194
  */
765
- declare const imageMessages: {
766
- readonly "errors.INVALID_IMAGE": "This file isn't a valid image, or it's too damaged to open.";
767
- readonly "errors.UNSUPPORTED_FORMAT": "This image format isn't supported. Try converting the file to PNG or JPEG, then open it again.";
768
- readonly "errors.DECODE_FAILED": "This browser can't open this kind of image. Try another browser, or convert the file to PNG or JPEG.";
769
- readonly "errors.INVALID_COMMAND": "This edit couldn't be made. Please try again.";
770
- readonly "errors.INVALID_DOCUMENT": "This project is damaged, or it isn't an image project.";
771
- readonly "errors.IMAGE_TOO_LARGE": "This image has more pixels than the editor can handle. Try a smaller version of it.";
772
- readonly "errors.IMAGE_DIMENSION_TOO_LARGE": "This image is {actual, number} pixels across, which is over the {maximum, number}-pixel limit.";
773
- readonly "errors.TOO_MANY_FRAMES": {
774
- readonly $plural: "maximum";
775
- } & {
776
- readonly one: "This animation has {actual, number} frames, which is over the {maximum}-frame limit.";
777
- readonly other: "This animation has {actual, number} frames, which is over the {maximum, number}-frame limit.";
778
- };
779
- 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.";
780
- readonly "errors.TOO_MANY_LAYERS": {
781
- readonly $plural: "maximum";
782
- } & {
783
- readonly one: "An image can have {maximum} layer. Merge or delete layers, and try again.";
784
- readonly other: "An image can have up to {maximum, number} layers. Merge or delete layers, and try again.";
785
- };
786
- readonly "warnings.maxImagePixels": "This image is large, and may be slow to edit on some devices.";
787
- readonly "warnings.maxImageDimension": "This image is very wide or tall, and may be slow to edit.";
788
- readonly "warnings.maxFrames": {
789
- readonly $plural: "actual";
790
- } & {
791
- readonly one: "This animation has {actual} frame.";
792
- readonly other: "This animation has {actual, number} frames, and may be slow to edit and export.";
793
- };
794
- readonly "warnings.maxSessionSize": "The open images use {actual, fileSize} of memory. Clearing the undo history frees memory.";
795
- readonly "warnings.maxLayers": {
796
- readonly $plural: "actual";
797
- } & {
798
- readonly one: "This image has {actual} layer.";
799
- readonly other: "This image has {actual, number} layers, and may be slow to edit and export.";
800
- };
801
- readonly "editor.label": "Image editor";
802
- readonly "editor.preview": "Edited image preview, {width, number} × {height, number}";
803
- readonly "editor.empty": "Open an image to start editing. It stays on this device.";
804
- readonly "editor.choose": "Choose an image";
805
- readonly "editor.dropHint": "or drop it here";
806
- readonly "editor.opening": "Opening the image…";
807
- readonly "editor.cancel": "Cancel";
808
- readonly "editor.opened": "Image opened, {width, number} × {height, number}.";
809
- readonly "editor.undid": "Undid {action}.";
810
- readonly "editor.redid": "Redid {action}.";
811
- readonly "actions.image.setCrop": "crop";
812
- readonly "actions.image.setOrientation": "rotate or flip";
813
- readonly "actions.image.setOutput": "size";
814
- readonly "actions.image.setMetadata": "metadata";
815
- readonly "actions.image.setDevelop": "adjustment";
816
- readonly "actions.image.setFilter": "filter";
817
- readonly "toolbar.label": "Image tools";
818
- readonly "toolbar.groups.file": "File";
819
- readonly "toolbar.groups.history": "History";
820
- readonly "toolbar.groups.orientation": "Rotate";
821
- readonly "toolbar.groups.zoom": "Zoom";
822
- readonly "toolbar.groups.other": "More tools";
823
- readonly "tools.open": "Open image";
824
- readonly "tools.undo": "Undo";
825
- readonly "tools.redo": "Redo";
826
- readonly "tools.rotate-left": "Rotate left";
827
- readonly "tools.rotate-right": "Rotate right";
828
- readonly "tools.zoom-in": "Zoom in";
829
- readonly "tools.zoom-out": "Zoom out";
830
- readonly "tools.zoom-fit": "Fit to the stage";
831
- readonly "tools.crop": "Crop";
832
- readonly "tools.flip-horizontal": "Flip horizontally";
833
- readonly "tools.flip-vertical": "Flip vertically";
834
- readonly "toolbar.groups.crop": "Crop";
835
- readonly "crop.frame": "Crop area";
836
- 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.";
837
- readonly "crop.size": "{width, number} × {height, number}, from {x, number}, {y, number}";
838
- readonly "crop.panel": "Crop";
839
- readonly "crop.x": "Left";
840
- readonly "crop.y": "Top";
841
- readonly "crop.width": "Width";
842
- readonly "crop.height": "Height";
843
- readonly "crop.aspect": "Aspect ratio";
844
- readonly "crop.aspects.free": "Free";
845
- readonly "crop.aspects.original": "Original";
846
- readonly "crop.aspects.ratio": "{width}:{height}";
847
- readonly "crop.apply": "Apply crop";
848
- readonly "crop.cancel": "Cancel";
849
- readonly "crop.reset": "Whole image";
850
- readonly "crop.applied": "Cropped to {width, number} × {height, number}.";
851
- readonly "inspector.label": "Panels";
852
- readonly "inspector.adjust": "Adjust";
853
- readonly "inspector.filters": "Filters";
854
- readonly "inspector.info": "Info";
855
- readonly "notices.label": "Notices";
856
- readonly "notices.dismiss": "Dismiss";
857
- readonly "notices.colourProfile": "This image has a colour profile. Colours outside sRGB will be clipped in the exported file.";
858
- readonly "info.panel": "Image info";
859
- readonly "info.size": "Size";
860
- readonly "info.sizeValue": "{width, number} × {height, number} pixels";
861
- readonly "info.format": "Format";
862
- readonly "info.formats.png": "PNG";
863
- readonly "info.formats.jpeg": "JPEG";
864
- readonly "info.formats.webp": "WebP";
865
- readonly "info.formats.gif": "GIF";
866
- readonly "info.formats.avif": "AVIF";
867
- readonly "info.formats.heif": "HEIF";
868
- readonly "info.formats.bmp": "BMP";
869
- readonly "info.frames": "Frames";
870
- readonly "info.fileSize": "File size";
871
- readonly "info.fileSizeValue": "{size, fileSize}";
872
- readonly "info.metadata": "Metadata in the file";
873
- readonly "info.metadataNone": "None";
874
- readonly "info.kept": "Kept on export";
875
- readonly "info.keptNone": "Nothing";
876
- readonly "develop.panel": "Adjust";
877
- readonly "develop.temperature": "Temperature";
878
- readonly "develop.tint": "Tint";
879
- readonly "develop.exposure": "Exposure";
880
- readonly "develop.highlights": "Highlights";
881
- readonly "develop.shadows": "Shadows";
882
- readonly "develop.contrast": "Contrast";
883
- readonly "develop.saturation": "Saturation";
884
- readonly "develop.vibrance": "Vibrance";
885
- readonly "develop.reset": "Reset {name}";
886
- readonly "develop.resetAll": "Reset all";
887
- readonly "develop.wasReset": "All adjustments reset.";
888
- readonly "filters.panel": "Filters";
889
- readonly "filters.label": "Filter";
890
- readonly "filters.none": "None";
891
- readonly "filters.vivid": "Vivid";
892
- readonly "filters.warm": "Warm";
893
- readonly "filters.cool": "Cool";
894
- readonly "filters.fade": "Fade";
895
- readonly "filters.mono": "Mono";
896
- readonly "filters.noir": "Noir";
897
- readonly "filters.sepia": "Sepia";
898
- readonly "filters.strength": "Strength";
899
- readonly "toolbar.groups.export": "Export";
900
- readonly "tools.export": "Export";
901
- readonly "export.title": "Export image";
902
- readonly "export.description": "The file is made on this device, and nothing is uploaded.";
903
- readonly "export.format": "Format";
904
- readonly "export.formats.png": "PNG";
905
- readonly "export.formats.jpeg": "JPEG";
906
- readonly "export.formats.webp": "WebP";
907
- readonly "export.quality": "Quality";
908
- readonly "export.qualityValue": "{quality, number}%";
909
- readonly "export.size": "Size";
910
- readonly "export.sizes.scale": "Scale";
911
- readonly "export.sizes.fit": "Fit in a box";
912
- readonly "export.scale": "Scale, in percent";
913
- readonly "export.fitWidth": "Largest width";
914
- readonly "export.fitHeight": "Largest height";
915
- readonly "export.fields": "Details to include";
916
- readonly "export.fieldsHint": "Only what you fill in is written to the file.";
917
- readonly "export.field.title": "Title";
918
- readonly "export.field.description": "Description";
919
- readonly "export.field.artist": "Artist";
920
- readonly "export.field.copyright": "Copyright";
921
- readonly "export.summary": "Summary";
922
- readonly "export.output": "{width, number} × {height, number} pixels, {format}";
923
- readonly "export.removed": "Removed from the file";
924
- readonly "export.removedNone": "The image had no other details to remove.";
925
- readonly "export.kind.location": "Location";
926
- readonly "export.kind.camera": "Camera details";
927
- readonly "export.kind.timestamps": "Dates and times";
928
- readonly "export.kind.thumbnail": "Embedded thumbnail";
929
- readonly "export.kind.colourProfile": "Colour profile: colours outside sRGB are clipped";
930
- readonly "export.kind.other": "Other metadata";
931
- readonly "export.kept": "Kept in the file";
932
- readonly "export.confirm": "Export";
933
- readonly "export.cancel": "Cancel";
934
- readonly "export.progress": "Exporting the image";
935
- readonly "export.stop": "Stop exporting";
936
- readonly "export.cancelled": "Export stopped.";
937
- readonly "export.done": "Exported a {format} of {size, fileSize}.";
938
- readonly "export.ready": "{width, number} × {height, number} pixels, {format}, {size, fileSize}";
939
- readonly "export.download": "Download";
940
- readonly "export.close": "Done";
941
- readonly "dialog.close": "Close";
942
- readonly "fileDropZone.choose": "Choose a file";
943
- readonly "fileDropZone.chooseMultiple": "Choose files";
944
- readonly "fileDropZone.hint": "or drop it here";
945
- readonly "fileDropZone.hintMultiple": "or drop them here";
946
- readonly "progress.label": "Progress";
947
- readonly "spinner.label": "Loading";
948
- readonly "errors.INVALID_THEME_TOKEN": "The theme setting {token} has a value that can't be used.";
949
- readonly "errors.INVALID_THEME_SELECTOR": "The theme can't be applied to the selector {selector}.";
950
- readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
951
- readonly "errors.ABORTED": "The operation was cancelled.";
952
- readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
953
- readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
954
- readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
955
- readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
956
- readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
957
- readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
958
- readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
959
- readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
960
- readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
961
- readonly "errors.TOO_MANY_FILES": {
962
- readonly $plural: "maximum";
963
- } & {
964
- readonly one: "You can add {maximum} file at a time.";
965
- readonly other: "You can add up to {maximum} files at a time.";
1195
+ declare type ImageLimitDefinitions = typeof imageLimitDefinitions;
1196
+
1197
+ /**
1198
+ * The image SDK's limit definitions: sdk-core's core limits with image
1199
+ * defaults, plus five for images (ADR 0004).
1200
+ *
1201
+ * | Limit | Code | Default maximum | Default warning |
1202
+ * |---|---|---|---|
1203
+ * | `maxFileSize` | `FILE_TOO_LARGE` | 100 MB | 50 MB |
1204
+ * | `maxFiles` | `TOO_MANY_FILES` | 20 | none |
1205
+ * | `maxDecodedSize` | `DECODED_SIZE_TOO_LARGE` | 1 GB | 400 MB |
1206
+ * | `maxProcessingTime` | `PROCESSING_TIME_EXCEEDED` | 120 s | none |
1207
+ * | `maxImagePixels` | `IMAGE_TOO_LARGE` | 50 megapixels | 24 megapixels |
1208
+ * | `maxImageDimension` | `IMAGE_DIMENSION_TOO_LARGE` | 16,384 pixels | none |
1209
+ * | `maxFrames` | `TOO_MANY_FRAMES` | 300 | 100 |
1210
+ * | `maxSessionSize` | `SESSION_TOO_LARGE` | 1 GB | 500 MB |
1211
+ * | `maxLayers` | `TOO_MANY_LAYERS` | 256 | none |
1212
+ *
1213
+ * Sizes are decimal: 1 MB is 1,000,000 bytes. Decoded sizes count 4 bytes
1214
+ * per pixel. `maxImagePixels` is the same limit, with the same name, code
1215
+ * and unit, as `pdf-sdk`'s. `maxImageDimension` is a side length, in pixels.
1216
+ *
1217
+ * @public
1218
+ */
1219
+ declare const imageLimitDefinitions: {
1220
+ readonly maxDecodedSize: {
1221
+ readonly default: 1000000000;
1222
+ readonly warning: 400000000;
1223
+ readonly code: "DECODED_SIZE_TOO_LARGE";
1224
+ readonly unit: "bytes";
1225
+ };
1226
+ readonly maxImagePixels: {
1227
+ readonly code: "IMAGE_TOO_LARGE";
1228
+ readonly unit: "pixels";
1229
+ readonly default: 50000000;
1230
+ readonly warning: 24000000;
1231
+ };
1232
+ readonly maxImageDimension: {
1233
+ readonly code: "IMAGE_DIMENSION_TOO_LARGE";
1234
+ readonly unit: "pixels";
1235
+ readonly default: 16384;
1236
+ };
1237
+ readonly maxFrames: {
1238
+ readonly code: "TOO_MANY_FRAMES";
1239
+ readonly unit: "count";
1240
+ readonly default: 300;
1241
+ readonly warning: 100;
1242
+ };
1243
+ readonly maxSessionSize: {
1244
+ readonly code: "SESSION_TOO_LARGE";
1245
+ readonly unit: "bytes";
1246
+ readonly default: 1000000000;
1247
+ readonly warning: 500000000;
1248
+ };
1249
+ readonly maxLayers: {
1250
+ readonly code: "TOO_MANY_LAYERS";
1251
+ readonly unit: "count";
1252
+ readonly default: 256;
1253
+ };
1254
+ readonly maxFileSize: {
1255
+ readonly code: "FILE_TOO_LARGE";
1256
+ readonly unit: "bytes";
1257
+ readonly default: 100000000;
1258
+ readonly warning: 50000000;
1259
+ };
1260
+ readonly maxFiles: {
1261
+ readonly code: "TOO_MANY_FILES";
1262
+ readonly unit: "count";
1263
+ readonly default: 20;
1264
+ };
1265
+ readonly maxProcessingTime: {
1266
+ readonly code: "PROCESSING_TIME_EXCEEDED";
1267
+ readonly unit: "milliseconds";
1268
+ readonly default: 120000;
966
1269
  };
967
- readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
968
- readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
969
- readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
970
- readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
971
- readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
972
- readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
973
- readonly "keys.control": "Ctrl";
974
- readonly "keys.alt": "Alt";
975
- readonly "keys.shift": "Shift";
976
- readonly "keys.meta": "Meta";
977
- readonly "keys.apple.control": "\u2303";
978
- readonly "keys.apple.alt": "\u2325";
979
- readonly "keys.apple.shift": "\u21E7";
980
- readonly "keys.apple.meta": "\u2318";
981
- readonly "keys.space": "Space";
982
- readonly "keys.enter": "Enter";
983
- readonly "keys.escape": "Esc";
984
- readonly "keys.tab": "Tab";
985
- readonly "keys.delete": "Delete";
986
- readonly "keys.backspace": "Backspace";
987
- readonly "keys.arrowUp": "\u2191";
988
- readonly "keys.arrowDown": "\u2193";
989
- readonly "keys.arrowLeft": "\u2190";
990
- readonly "keys.arrowRight": "\u2192";
991
- readonly "keys.home": "Home";
992
- readonly "keys.end": "End";
993
- readonly "keys.pageUp": "Page Up";
994
- readonly "keys.pageDown": "Page Down";
995
1270
  };
996
1271
 
1272
+ /**
1273
+ * The names of the image SDK's limits.
1274
+ *
1275
+ * @public
1276
+ */
1277
+ declare type ImageLimitName = keyof ImageLimitDefinitions;
1278
+
997
1279
  /**
998
1280
  * Which kinds of metadata a file carries, as presence flags, never values,
999
1281
  * so the editor can say what an export removes (ADR 0005).
@@ -1042,12 +1324,19 @@ declare type ImageOutput = {
1042
1324
 
1043
1325
  /**
1044
1326
  * The session's document: a description of the edits over an immutable
1045
- * source, rendered to pixels only for display and export (ADR 0003).
1327
+ * source, rendered to pixels only for display and export (ADR 0003, ADR
1328
+ * 0009).
1046
1329
  *
1047
1330
  * @public
1048
1331
  */
1049
1332
  declare interface ImagePlan {
1050
1333
  readonly base: ImageBase;
1334
+ /** The layers over the base, bottom to top, placed in the scene (ADR 0009). */
1335
+ readonly layers: readonly ImageLayer[];
1336
+ /** The redactions, applied over every layer (ADR 0010). */
1337
+ readonly redactions: readonly ImageRedaction[];
1338
+ /** The animation (ADR 0011). Always `null` until format version 4. */
1339
+ readonly animation: null;
1051
1340
  readonly output: ImageOutput;
1052
1341
  /** The fields the user chose to keep on export. Never a location (ADR 0005). */
1053
1342
  readonly metadata: ImageKeepableMetadata;
@@ -1123,6 +1412,95 @@ declare interface ImageProgressOptions extends ImageCallOptions {
1123
1412
  readonly onProgress?: (fraction: number) => void;
1124
1413
  }
1125
1414
 
1415
+ /**
1416
+ * A region of the image that an export doesn't show (ADR 0010): a rectangle
1417
+ * in whole pixels of the scene, the base's oriented source, so it stays on
1418
+ * the pixels it covers when the image is cropped or turned (ADR 0009).
1419
+ *
1420
+ * A redaction has no opacity, visibility or rotation, and is drawn over
1421
+ * every layer. Only exports are redacted: the plan describes the redaction,
1422
+ * and the source is unchanged.
1423
+ *
1424
+ * @public
1425
+ */
1426
+ declare type ImageRedaction = (ImageRedactionRegion & {
1427
+ readonly mode: "solid";
1428
+ /** The fill, as `#rrggbb` in lower case. */
1429
+ readonly colour: string;
1430
+ }) | (ImageRedactionRegion & {
1431
+ readonly mode: "pixelate";
1432
+ });
1433
+
1434
+ /**
1435
+ * How a redaction replaces what it covers (ADR 0010): `solid` fills the
1436
+ * region with one colour, and `pixelate` with coarse blocks of the average
1437
+ * colour beneath each. Only `solid` destroys what was there.
1438
+ *
1439
+ * @public
1440
+ */
1441
+ declare type ImageRedactionMode = "solid" | "pixelate";
1442
+
1443
+ /**
1444
+ * The fields of a redaction that `image.updateRedactions` may set: any but
1445
+ * its key. Setting `mode` to `pixelate` drops the colour, and setting it to
1446
+ * `solid` needs one in the same update.
1447
+ *
1448
+ * @public
1449
+ */
1450
+ declare interface ImageRedactionProps {
1451
+ readonly mode?: ImageRedaction["mode"];
1452
+ readonly x?: number;
1453
+ readonly y?: number;
1454
+ readonly width?: number;
1455
+ readonly height?: number;
1456
+ readonly colour?: string;
1457
+ }
1458
+
1459
+ /**
1460
+ * What every redaction has, whatever its mode: its identity and its region.
1461
+ *
1462
+ * @public
1463
+ */
1464
+ declare interface ImageRedactionRegion {
1465
+ /**
1466
+ * Its identity: 1 to {@link MAX_KEY_LENGTH} code points, unique among the
1467
+ * plan's layers and redactions.
1468
+ */
1469
+ readonly key: string;
1470
+ /** The region's left edge, in whole pixels of the scene. May be negative. */
1471
+ readonly x: number;
1472
+ /** The region's top edge, in whole pixels of the scene. May be negative. */
1473
+ readonly y: number;
1474
+ /** At least 1. */
1475
+ readonly width: number;
1476
+ /** At least 1. */
1477
+ readonly height: number;
1478
+ }
1479
+
1480
+ /**
1481
+ * The redact panel (docs/adr/0010), shown while redacting: what a new area
1482
+ * is covered with, a button that adds one without dragging (WCAG 2.5.7),
1483
+ * the selected area's position and size in source pixels, and the list of
1484
+ * every area, each with its mode, its size and a button to remove it, so
1485
+ * what's covered can be read without the preview.
1486
+ *
1487
+ * The panel keeps its size while redacting, whatever is selected or chosen.
1488
+ * Where the inspector sits under the stage, a panel that grew would shrink
1489
+ * the stage, and move the image under the pointer.
1490
+ *
1491
+ * @public
1492
+ */
1493
+ export declare function ImageRedactPanel(props: ImageRedactPanelProps): ReactNode;
1494
+
1495
+ /**
1496
+ * Props of {@link ImageRedactPanel}.
1497
+ *
1498
+ * @public
1499
+ */
1500
+ export declare interface ImageRedactPanelProps {
1501
+ readonly className?: string;
1502
+ }
1503
+
1126
1504
  /**
1127
1505
  * Options for registering a source.
1128
1506
  *
@@ -1164,11 +1542,35 @@ declare interface ImageSession {
1164
1542
  * ADR 0004). The newest open wins: an open that finishes after a later one
1165
1543
  * started applies nothing, releases its source and rejects with
1166
1544
  * `ABORTED`. A failed or cancelled open leaves the current document as it
1167
- * was.
1545
+ * was. Probing and registration share the policy's `maxProcessingTime`
1546
+ * deadline, which aborts their signal with `PROCESSING_TIME_EXCEEDED`.
1168
1547
  */
1169
1548
  open(file: Blob, options?: {
1170
1549
  readonly signal?: AbortSignal;
1171
1550
  }): Promise<ImageSessionSource>;
1551
+ /**
1552
+ * Probes, checks and decodes another file, and adds it to the document as
1553
+ * an image layer, as one undoable step (ADR 0003, ADR 0004).
1554
+ *
1555
+ * - **Limits:** the file's own, as for `open`; `maxFiles`, counting every
1556
+ * source the session holds; and `maxSessionSize`, counting their decoded
1557
+ * bytes. When the image doesn't fit, the session first drops the oldest
1558
+ * undo steps that alone keep another image, and marks the history as
1559
+ * trimmed. If that isn't enough, nothing is dropped and it fails with
1560
+ * `SESSION_TOO_LARGE`.
1561
+ * - **Placement:** by default the image is centred on what's shown, at
1562
+ * its own size or half the composition's, whichever is smaller, over
1563
+ * every layer, and turned and mirrored back against the plan's
1564
+ * rotation and flips, so it's seen as the file is. `place` returns other commands; they must refer to the
1565
+ * source, or it's released.
1566
+ * - **Lifetime:** the session holds the source while the plan, an undo
1567
+ * or redo step, or an export in progress refers to it, and releases it
1568
+ * then.
1569
+ *
1570
+ * A failure, a cancellation, or another file opened meanwhile adds
1571
+ * nothing and releases the source.
1572
+ */
1573
+ insertImage(file: Blob, options?: ImageInsertOptions): Promise<ImageSessionSource>;
1172
1574
  /**
1173
1575
  * Applies commands as one undoable step. They're checked by the reducer,
1174
1576
  * then the output against `maxImageDimension` and `maxImagePixels`; a
@@ -1179,7 +1581,9 @@ declare interface ImageSession {
1179
1581
  * Makes the document's plan equal to `plan`, as one undoable step of the
1180
1582
  * commands that reach it, checked as `execute` checks them (ADR 0003). A
1181
1583
  * plan equal to the current one changes nothing. A plan over another
1182
- * source is `INVALID_COMMAND`. For editors whose host holds the plan.
1584
+ * source is `INVALID_COMMAND`, and so is one without `layers`,
1585
+ * `redactions` and `animation`, such as a plan stored before format
1586
+ * version 2. For editors whose host holds the plan.
1183
1587
  */
1184
1588
  applyPlan(plan: ImagePlan): void;
1185
1589
  /**
@@ -1194,13 +1598,16 @@ declare interface ImageSession {
1194
1598
  redo(): boolean;
1195
1599
  /**
1196
1600
  * Renders and encodes the document (ADR 0003). An export that finishes
1197
- * after another file was opened rejects with `ABORTED`.
1601
+ * after another file was opened rejects with `ABORTED`. The policy's
1602
+ * `maxProcessingTime` aborts the processor's signal with
1603
+ * `PROCESSING_TIME_EXCEEDED`. Custom adapters must observe that signal;
1604
+ * a session cannot preempt an arbitrary adapter that ignores it.
1198
1605
  */
1199
1606
  export(format: ImageExportFormat, options?: {
1200
1607
  readonly signal?: AbortSignal;
1201
1608
  readonly onProgress?: (fraction: number) => void;
1202
1609
  }): Promise<ImageSessionExport>;
1203
- /** Releases the source the session holds. Later calls throw. */
1610
+ /** Releases every source the session holds. Later calls throw. */
1204
1611
  destroy(): Promise<void>;
1205
1612
  }
1206
1613
 
@@ -1211,7 +1618,7 @@ declare interface ImageSession {
1211
1618
  * @public
1212
1619
  */
1213
1620
  declare interface ImageSessionEvent {
1214
- readonly type: "open" | "execute" | "undo" | "redo" | "export";
1621
+ readonly type: "open" | "insert" | "execute" | "undo" | "redo" | "export";
1215
1622
  readonly outcome: "done" | "failed" | "cancelled";
1216
1623
  /** The types of the commands applied or undone. */
1217
1624
  readonly commands: readonly ImageCommand["type"][];
@@ -1250,8 +1657,20 @@ declare interface ImageSessionSnapshot {
1250
1657
  readonly plan: ImagePlan | null;
1251
1658
  /** The document's source, or `null` before a file is open. */
1252
1659
  readonly source: ImageSessionSource | null;
1660
+ /**
1661
+ * Every source the session holds: the document's, then those of image
1662
+ * layers, including ones only the history still refers to (ADR 0004).
1663
+ */
1664
+ readonly sources: readonly ImageSessionSource[];
1253
1665
  readonly canUndo: boolean;
1254
1666
  readonly canRedo: boolean;
1667
+ /**
1668
+ * Whether undo steps were dropped to make room for an image, since the
1669
+ * document was opened: they can no longer be undone.
1670
+ */
1671
+ readonly historyTrimmed: boolean;
1672
+ /** Whether an image is being added as a layer. */
1673
+ readonly inserting: boolean;
1255
1674
  /** Whether a file is being opened. The current document stays until it's ready. */
1256
1675
  readonly opening: boolean;
1257
1676
  /** Whether an export is in progress. */
@@ -1278,6 +1697,25 @@ declare interface ImageSessionSource extends ImageSourceInfo {
1278
1697
  readonly keepable: ImageKeepableMetadata;
1279
1698
  }
1280
1699
 
1700
+ /**
1701
+ * A rectangle or an ellipse that fills its box, with a fill, a stroke drawn
1702
+ * inside the box, or both (ADR 0009).
1703
+ *
1704
+ * @public
1705
+ */
1706
+ declare interface ImageShapeLayer extends ImageLayerCommon, ImageLayerBox {
1707
+ readonly kind: "shape";
1708
+ readonly shape: (typeof LAYER_SHAPES)[number];
1709
+ /** The fill, as `#rrggbb` in lower case, or `null` for none. */
1710
+ readonly fill: string | null;
1711
+ /** The stroke, or `null` for none. A shape has a fill or a stroke. */
1712
+ readonly stroke: {
1713
+ readonly colour: string;
1714
+ /** In whole scene pixels, from 1 to `MAX_STROKE_WIDTH`. */
1715
+ readonly width: number;
1716
+ } | null;
1717
+ }
1718
+
1281
1719
  /**
1282
1720
  * A width and a height, in whole pixels.
1283
1721
  *
@@ -1331,6 +1769,27 @@ export declare interface ImageStageProps {
1331
1769
  readonly className?: string;
1332
1770
  }
1333
1771
 
1772
+ /**
1773
+ * Text, drawn as large as fits inside its box, never distorted (ADR 0009).
1774
+ * Lines break only at line feeds. Emoji are text.
1775
+ *
1776
+ * @public
1777
+ */
1778
+ declare interface ImageTextLayer extends ImageLayerCommon, ImageLayerBox {
1779
+ readonly kind: "text";
1780
+ /**
1781
+ * Up to `MAX_LAYER_TEXT_LENGTH` code points. Control characters other
1782
+ * than a line feed, and the bidirectional embedding, override and isolate
1783
+ * controls, are refused.
1784
+ */
1785
+ readonly text: string;
1786
+ readonly font: (typeof LAYER_FONTS)[number];
1787
+ readonly bold: boolean;
1788
+ /** The text's colour, as `#rrggbb` in lower case. */
1789
+ readonly colour: string;
1790
+ readonly align: (typeof LAYER_ALIGNMENTS)[number];
1791
+ }
1792
+
1334
1793
  /**
1335
1794
  * A small rendering of a source for lists and frame strips. An `ImageBitmap`
1336
1795
  * is one; tests can supply their own. Close it when it's no longer shown.
@@ -1394,6 +1853,8 @@ export declare interface ImageToolContext {
1394
1853
  readonly editor: Store<ImageEditorState>;
1395
1854
  /** Asks the user for an image, as the open tool does. */
1396
1855
  readonly chooseFile: () => void;
1856
+ /** Asks the user for an image to add as a layer (docs/adr/0013). */
1857
+ readonly chooseLayerImage: () => void;
1397
1858
  }
1398
1859
 
1399
1860
  /**
@@ -1427,6 +1888,129 @@ export declare interface ImageViewState {
1427
1888
  };
1428
1889
  }
1429
1890
 
1891
+ /**
1892
+ * Inserts layers at an index of the plan's layers, which are drawn bottom
1893
+ * to top (ADR 0009). Each needs a key no layer or redaction of the plan has.
1894
+ *
1895
+ * @public
1896
+ */
1897
+ declare interface InsertLayersCommand {
1898
+ readonly type: "image.insertLayers";
1899
+ /** From 0, under every layer, to the number of layers, over them all. */
1900
+ readonly at: number;
1901
+ readonly layers: readonly ImageLayer[];
1902
+ }
1903
+
1904
+ /**
1905
+ * Inserts redactions at an index of the plan's redactions (ADR 0010). Each
1906
+ * needs a key no layer or redaction of the plan has.
1907
+ *
1908
+ * @public
1909
+ */
1910
+ declare interface InsertRedactionsCommand {
1911
+ readonly type: "image.insertRedactions";
1912
+ /** From 0 to the number of redactions. */
1913
+ readonly at: number;
1914
+ readonly redactions: readonly ImageRedaction[];
1915
+ }
1916
+
1917
+ /**
1918
+ * How a text layer's lines sit in its box, by the text's own direction.
1919
+ *
1920
+ * @public
1921
+ */
1922
+ declare const LAYER_ALIGNMENTS: readonly ["start", "center", "end"];
1923
+
1924
+ /**
1925
+ * The fonts a text layer can use: the generic families, which every device
1926
+ * has, so the SDK ships and fetches none (ADR 0009). Names are part of the
1927
+ * document format.
1928
+ *
1929
+ * @public
1930
+ */
1931
+ declare const LAYER_FONTS: readonly ["sans-serif", "serif", "monospace"];
1932
+
1933
+ /**
1934
+ * The shapes a shape layer can be.
1935
+ *
1936
+ * @public
1937
+ */
1938
+ declare const LAYER_SHAPES: readonly ["rectangle", "ellipse"];
1939
+
1940
+ /**
1941
+ * Moves layers to an index of the list without them, keeping the order they
1942
+ * had: up or down the stack.
1943
+ *
1944
+ * @public
1945
+ */
1946
+ declare interface MoveLayersCommand {
1947
+ readonly type: "image.moveLayers";
1948
+ readonly keys: readonly string[];
1949
+ readonly to: number;
1950
+ }
1951
+
1952
+ /**
1953
+ * Moves redactions to an index of the list without them, keeping the order
1954
+ * they had. The order only decides how overlapping redactions look.
1955
+ *
1956
+ * @public
1957
+ */
1958
+ declare interface MoveRedactionsCommand {
1959
+ readonly type: "image.moveRedactions";
1960
+ readonly keys: readonly string[];
1961
+ readonly to: number;
1962
+ }
1963
+
1964
+ /**
1965
+ * Removes layers, by key.
1966
+ *
1967
+ * @public
1968
+ */
1969
+ declare interface RemoveLayersCommand {
1970
+ readonly type: "image.removeLayers";
1971
+ readonly keys: readonly string[];
1972
+ }
1973
+
1974
+ /**
1975
+ * Removes redactions, by key.
1976
+ *
1977
+ * @public
1978
+ */
1979
+ declare interface RemoveRedactionsCommand {
1980
+ readonly type: "image.removeRedactions";
1981
+ readonly keys: readonly string[];
1982
+ }
1983
+
1984
+ /**
1985
+ * Puts removed layers back, each at its index, by rising index. It's what
1986
+ * undoes {@link RemoveLayersCommand}: the reducer applies it, but it isn't
1987
+ * part of the portable command format (ADR 0009).
1988
+ *
1989
+ * @public
1990
+ */
1991
+ declare interface RestoreLayersCommand {
1992
+ readonly type: "image.restoreLayers";
1993
+ readonly entries: readonly {
1994
+ readonly at: number;
1995
+ readonly layer: ImageLayer;
1996
+ }[];
1997
+ }
1998
+
1999
+ /**
2000
+ * Puts removed redactions back, each at its index, by rising index. It's
2001
+ * what undoes {@link RemoveRedactionsCommand}: the reducer applies it, but
2002
+ * it isn't part of the portable command format (ADR 0009).
2003
+ *
2004
+ * @public
2005
+ */
2006
+ declare interface RestoreRedactionsCommand {
2007
+ readonly type: "image.restoreRedactions";
2008
+ readonly entries: readonly {
2009
+ readonly at: number;
2010
+ readonly redaction: ImageRedaction;
2011
+ }[];
2012
+ }
2013
+
1430
2014
  /**
1431
2015
  * Sets or removes the base's crop, in whole pixels of the oriented source.
1432
2016
  *
@@ -1458,6 +2042,18 @@ declare interface SetFilterCommand {
1458
2042
  readonly filter: ImageFilter | null;
1459
2043
  }
1460
2044
 
2045
+ /**
2046
+ * Sets the whole order of the layers: every key, once. It's what undoes
2047
+ * {@link MoveLayersCommand}: the reducer applies it, but it isn't part of
2048
+ * the portable command format (ADR 0009).
2049
+ *
2050
+ * @public
2051
+ */
2052
+ declare interface SetLayerOrderCommand {
2053
+ readonly type: "image.setLayerOrder";
2054
+ readonly keys: readonly string[];
2055
+ }
2056
+
1461
2057
  /**
1462
2058
  * Sets one metadata field to keep on export. An empty value keeps nothing.
1463
2059
  *
@@ -1489,6 +2085,46 @@ declare interface SetOutputCommand {
1489
2085
  readonly output: ImageOutput;
1490
2086
  }
1491
2087
 
2088
+ /**
2089
+ * Sets the whole order of the redactions: every key, once. It's what undoes
2090
+ * {@link MoveRedactionsCommand}: the reducer applies it, but it isn't part
2091
+ * of the portable command format (ADR 0009).
2092
+ *
2093
+ * @public
2094
+ */
2095
+ declare interface SetRedactionOrderCommand {
2096
+ readonly type: "image.setRedactionOrder";
2097
+ readonly keys: readonly string[];
2098
+ }
2099
+
2100
+ /**
2101
+ * Sets some fields of some layers: their boxes after a move, their opacity,
2102
+ * a text layer's text. `props` may hold any field of the layer's kind except
2103
+ * `key` and `kind`.
2104
+ *
2105
+ * @public
2106
+ */
2107
+ declare interface UpdateLayersCommand {
2108
+ readonly type: "image.updateLayers";
2109
+ readonly updates: readonly {
2110
+ readonly key: string;
2111
+ readonly props: Readonly<Record<string, unknown>>;
2112
+ }[];
2113
+ }
2114
+
2115
+ /**
2116
+ * Sets some fields of some redactions, such as their regions after a move.
2117
+ *
2118
+ * @public
2119
+ */
2120
+ declare interface UpdateRedactionsCommand {
2121
+ readonly type: "image.updateRedactions";
2122
+ readonly updates: readonly {
2123
+ readonly key: string;
2124
+ readonly props: ImageRedactionProps;
2125
+ }[];
2126
+ }
2127
+
1492
2128
  /**
1493
2129
  * The session's snapshot, re-rendering whenever it changes, through
1494
2130
  * `useSyncExternalStore`, so it's safe with concurrent and server rendering.
@@ -1510,7 +2146,7 @@ export declare function useImageEditorState(): readonly [ImageEditorState, Store
1510
2146
  *
1511
2147
  * @public
1512
2148
  */
1513
- export declare function useImageMessages(): Messages<ImageMessageCatalogue>;
2149
+ export declare function useImageMessages(): Messages<ImageEditorMessageCatalogue>;
1514
2150
 
1515
2151
  /**
1516
2152
  * The session of the nearest `ImageEditorProvider`, to open images, run