@hussmartinez/image-sdk 0.3.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/README.md +48 -4
- package/dist/assets/image/render.worker.js +2 -1
- package/dist/element.d.ts +873 -338
- package/dist/element.js +5 -3
- package/dist/element.js.map +1 -1
- package/dist/index.d.ts +810 -178
- package/dist/index.js +76 -11
- package/dist/index.js.map +1 -1
- package/dist/lazy/inline-worker-DsBNkr8Q.js +30 -0
- package/dist/lazy/{inline-worker-l_ynDNuS.js.map → inline-worker-DsBNkr8Q.js.map} +1 -1
- package/dist/react.d.ts +970 -339
- package/dist/react.js +1 -1
- package/dist/shared/{core-BWNmXDlB.js → core-BlFeJWak.js} +1159 -159
- package/dist/shared/core-BlFeJWak.js.map +1 -0
- package/dist/shared/editor-Bjv32UmV.js +3817 -0
- package/dist/shared/editor-Bjv32UmV.js.map +1 -0
- package/dist/styles.css +252 -17
- package/formats/hm-image-command/v2.schema.json +266 -0
- package/formats/hm-image-plan/v2.schema.json +877 -0
- package/package.json +3 -3
- package/dist/lazy/inline-worker-l_ynDNuS.js +0 -30
- package/dist/shared/core-BWNmXDlB.js.map +0 -1
- package/dist/shared/editor-CJXEK6MY.js +0 -1804
- package/dist/shared/editor-CJXEK6MY.js.map +0 -1
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
|
|
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<
|
|
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,27 +704,58 @@ 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,
|
|
327
|
-
*
|
|
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
|
-
*
|
|
341
|
-
*
|
|
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
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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
|
+
}
|
|
347
759
|
|
|
348
760
|
/**
|
|
349
761
|
* The editor's colour mode: ui's light or dark theme, or the system's. Unset,
|
|
@@ -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,354 +1100,182 @@ declare interface ImageKeepableMetadata {
|
|
|
647
1100
|
}
|
|
648
1101
|
|
|
649
1102
|
/**
|
|
650
|
-
*
|
|
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
|
|
1109
|
+
declare type ImageLayer = ImageTextLayer | ImageShapeLayer | ImageImageLayer;
|
|
655
1110
|
|
|
656
1111
|
/**
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
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
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
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
|
-
*
|
|
1139
|
+
* What every layer has (ADR 0009).
|
|
733
1140
|
*
|
|
734
1141
|
* @public
|
|
735
1142
|
*/
|
|
736
|
-
declare
|
|
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
|
|
740
|
-
*
|
|
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
|
|
1179
|
+
export declare function ImageLayersPanel(props: ImageLayersPanelProps): ReactNode;
|
|
745
1180
|
|
|
746
1181
|
/**
|
|
747
|
-
*
|
|
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.
|
|
1182
|
+
* Props of {@link ImageLayersPanel}.
|
|
752
1183
|
*
|
|
753
|
-
*
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
*
|
|
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
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
readonly
|
|
793
|
-
readonly
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
readonly
|
|
797
|
-
readonly
|
|
798
|
-
|
|
799
|
-
readonly
|
|
800
|
-
readonly
|
|
801
|
-
};
|
|
802
|
-
readonly
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
readonly
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
readonly
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
readonly
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
readonly
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
readonly
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
readonly
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
readonly "crop.panel": "Crop";
|
|
840
|
-
readonly "crop.x": "Left";
|
|
841
|
-
readonly "crop.y": "Top";
|
|
842
|
-
readonly "crop.width": "Width";
|
|
843
|
-
readonly "crop.height": "Height";
|
|
844
|
-
readonly "crop.aspect": "Aspect ratio";
|
|
845
|
-
readonly "crop.aspects.free": "Free";
|
|
846
|
-
readonly "crop.aspects.original": "Original";
|
|
847
|
-
readonly "crop.aspects.ratio": "{width}:{height}";
|
|
848
|
-
readonly "crop.apply": "Apply crop";
|
|
849
|
-
readonly "crop.cancel": "Cancel";
|
|
850
|
-
readonly "crop.reset": "Whole image";
|
|
851
|
-
readonly "crop.applied": "Cropped to {width, number} × {height, number}.";
|
|
852
|
-
readonly "inspector.label": "Panels";
|
|
853
|
-
readonly "inspector.adjust": "Adjust";
|
|
854
|
-
readonly "inspector.filters": "Filters";
|
|
855
|
-
readonly "inspector.info": "Info";
|
|
856
|
-
readonly "notices.label": "Notices";
|
|
857
|
-
readonly "notices.dismiss": "Dismiss";
|
|
858
|
-
readonly "notices.colourProfile": "This image has a colour profile. Colours outside sRGB will be clipped in the exported file.";
|
|
859
|
-
readonly "info.panel": "Image info";
|
|
860
|
-
readonly "info.size": "Size";
|
|
861
|
-
readonly "info.sizeValue": "{width, number} × {height, number} pixels";
|
|
862
|
-
readonly "info.format": "Format";
|
|
863
|
-
readonly "info.formats.png": "PNG";
|
|
864
|
-
readonly "info.formats.jpeg": "JPEG";
|
|
865
|
-
readonly "info.formats.webp": "WebP";
|
|
866
|
-
readonly "info.formats.gif": "GIF";
|
|
867
|
-
readonly "info.formats.avif": "AVIF";
|
|
868
|
-
readonly "info.formats.heif": "HEIF";
|
|
869
|
-
readonly "info.formats.bmp": "BMP";
|
|
870
|
-
readonly "info.frames": "Frames";
|
|
871
|
-
readonly "info.fileSize": "File size";
|
|
872
|
-
readonly "info.fileSizeValue": "{size, fileSize}";
|
|
873
|
-
readonly "info.metadata": "Metadata in the file";
|
|
874
|
-
readonly "info.metadataNone": "None";
|
|
875
|
-
readonly "info.kept": "Kept on export";
|
|
876
|
-
readonly "info.keptNone": "Nothing";
|
|
877
|
-
readonly "develop.panel": "Adjust";
|
|
878
|
-
readonly "develop.temperature": "Temperature";
|
|
879
|
-
readonly "develop.tint": "Tint";
|
|
880
|
-
readonly "develop.exposure": "Exposure";
|
|
881
|
-
readonly "develop.highlights": "Highlights";
|
|
882
|
-
readonly "develop.shadows": "Shadows";
|
|
883
|
-
readonly "develop.contrast": "Contrast";
|
|
884
|
-
readonly "develop.saturation": "Saturation";
|
|
885
|
-
readonly "develop.vibrance": "Vibrance";
|
|
886
|
-
readonly "develop.reset": "Reset {name}";
|
|
887
|
-
readonly "develop.resetAll": "Reset all";
|
|
888
|
-
readonly "develop.wasReset": "All adjustments reset.";
|
|
889
|
-
readonly "filters.panel": "Filters";
|
|
890
|
-
readonly "filters.label": "Filter";
|
|
891
|
-
readonly "filters.none": "None";
|
|
892
|
-
readonly "filters.vivid": "Vivid";
|
|
893
|
-
readonly "filters.warm": "Warm";
|
|
894
|
-
readonly "filters.cool": "Cool";
|
|
895
|
-
readonly "filters.fade": "Fade";
|
|
896
|
-
readonly "filters.mono": "Mono";
|
|
897
|
-
readonly "filters.noir": "Noir";
|
|
898
|
-
readonly "filters.sepia": "Sepia";
|
|
899
|
-
readonly "filters.strength": "Strength";
|
|
900
|
-
readonly "toolbar.groups.export": "Export";
|
|
901
|
-
readonly "tools.export": "Export";
|
|
902
|
-
readonly "export.title": "Export image";
|
|
903
|
-
readonly "export.description": "The file is made on this device, and nothing is uploaded.";
|
|
904
|
-
readonly "export.format": "Format";
|
|
905
|
-
readonly "export.formats.png": "PNG";
|
|
906
|
-
readonly "export.formats.jpeg": "JPEG";
|
|
907
|
-
readonly "export.formats.webp": "WebP";
|
|
908
|
-
readonly "export.quality": "Quality";
|
|
909
|
-
readonly "export.qualityValue": "{quality, number}%";
|
|
910
|
-
readonly "export.size": "Size";
|
|
911
|
-
readonly "export.sizes.scale": "Scale";
|
|
912
|
-
readonly "export.sizes.fit": "Fit in a box";
|
|
913
|
-
readonly "export.scale": "Scale, in percent";
|
|
914
|
-
readonly "export.fitWidth": "Largest width";
|
|
915
|
-
readonly "export.fitHeight": "Largest height";
|
|
916
|
-
readonly "export.fields": "Details to include";
|
|
917
|
-
readonly "export.fieldsHint": "Only what you fill in is written to the file.";
|
|
918
|
-
readonly "export.field.title": "Title";
|
|
919
|
-
readonly "export.field.description": "Description";
|
|
920
|
-
readonly "export.field.artist": "Artist";
|
|
921
|
-
readonly "export.field.copyright": "Copyright";
|
|
922
|
-
readonly "export.summary": "Summary";
|
|
923
|
-
readonly "export.output": "{width, number} × {height, number} pixels, {format}";
|
|
924
|
-
readonly "export.removed": "Removed from the file";
|
|
925
|
-
readonly "export.removedNone": "The image had no other details to remove.";
|
|
926
|
-
readonly "export.kind.location": "Location";
|
|
927
|
-
readonly "export.kind.camera": "Camera details";
|
|
928
|
-
readonly "export.kind.timestamps": "Dates and times";
|
|
929
|
-
readonly "export.kind.thumbnail": "Embedded thumbnail";
|
|
930
|
-
readonly "export.kind.colourProfile": "Colour profile: colours outside sRGB are clipped";
|
|
931
|
-
readonly "export.kind.other": "Other metadata";
|
|
932
|
-
readonly "export.kept": "Kept in the file";
|
|
933
|
-
readonly "export.confirm": "Export";
|
|
934
|
-
readonly "export.cancel": "Cancel";
|
|
935
|
-
readonly "export.progress": "Exporting the image";
|
|
936
|
-
readonly "export.stop": "Stop exporting";
|
|
937
|
-
readonly "export.cancelled": "Export stopped.";
|
|
938
|
-
readonly "export.done": "Exported a {format} of {size, fileSize}.";
|
|
939
|
-
readonly "export.ready": "{width, number} × {height, number} pixels, {format}, {size, fileSize}";
|
|
940
|
-
readonly "export.download": "Download";
|
|
941
|
-
readonly "export.close": "Done";
|
|
942
|
-
readonly "dialog.close": "Close";
|
|
943
|
-
readonly "fileDropZone.choose": "Choose a file";
|
|
944
|
-
readonly "fileDropZone.chooseMultiple": "Choose files";
|
|
945
|
-
readonly "fileDropZone.hint": "or drop it here";
|
|
946
|
-
readonly "fileDropZone.hintMultiple": "or drop them here";
|
|
947
|
-
readonly "progress.label": "Progress";
|
|
948
|
-
readonly "spinner.label": "Loading";
|
|
949
|
-
readonly "errors.INVALID_THEME_TOKEN": "The theme setting {token} has a value that can't be used.";
|
|
950
|
-
readonly "errors.INVALID_THEME_SELECTOR": "The theme can't be applied to the selector {selector}.";
|
|
951
|
-
readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
|
|
952
|
-
readonly "errors.ABORTED": "The operation was cancelled.";
|
|
953
|
-
readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
|
|
954
|
-
readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
|
|
955
|
-
readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
|
|
956
|
-
readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
|
|
957
|
-
readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
|
|
958
|
-
readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
|
|
959
|
-
readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
|
|
960
|
-
readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
|
|
961
|
-
readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
|
|
962
|
-
readonly "errors.TOO_MANY_FILES": {
|
|
963
|
-
readonly $plural: "maximum";
|
|
964
|
-
} & {
|
|
965
|
-
readonly one: "You can add {maximum} file at a time.";
|
|
966
|
-
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;
|
|
967
1269
|
};
|
|
968
|
-
readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
|
|
969
|
-
readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
|
|
970
|
-
readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
|
|
971
|
-
readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
|
|
972
|
-
readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
|
|
973
|
-
readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
|
|
974
|
-
readonly "keys.control": "Ctrl";
|
|
975
|
-
readonly "keys.alt": "Alt";
|
|
976
|
-
readonly "keys.shift": "Shift";
|
|
977
|
-
readonly "keys.meta": "Meta";
|
|
978
|
-
readonly "keys.apple.control": "\u2303";
|
|
979
|
-
readonly "keys.apple.alt": "\u2325";
|
|
980
|
-
readonly "keys.apple.shift": "\u21E7";
|
|
981
|
-
readonly "keys.apple.meta": "\u2318";
|
|
982
|
-
readonly "keys.space": "Space";
|
|
983
|
-
readonly "keys.enter": "Enter";
|
|
984
|
-
readonly "keys.escape": "Esc";
|
|
985
|
-
readonly "keys.tab": "Tab";
|
|
986
|
-
readonly "keys.delete": "Delete";
|
|
987
|
-
readonly "keys.backspace": "Backspace";
|
|
988
|
-
readonly "keys.arrowUp": "\u2191";
|
|
989
|
-
readonly "keys.arrowDown": "\u2193";
|
|
990
|
-
readonly "keys.arrowLeft": "\u2190";
|
|
991
|
-
readonly "keys.arrowRight": "\u2192";
|
|
992
|
-
readonly "keys.home": "Home";
|
|
993
|
-
readonly "keys.end": "End";
|
|
994
|
-
readonly "keys.pageUp": "Page Up";
|
|
995
|
-
readonly "keys.pageDown": "Page Down";
|
|
996
1270
|
};
|
|
997
1271
|
|
|
1272
|
+
/**
|
|
1273
|
+
* The names of the image SDK's limits.
|
|
1274
|
+
*
|
|
1275
|
+
* @public
|
|
1276
|
+
*/
|
|
1277
|
+
declare type ImageLimitName = keyof ImageLimitDefinitions;
|
|
1278
|
+
|
|
998
1279
|
/**
|
|
999
1280
|
* Which kinds of metadata a file carries, as presence flags, never values,
|
|
1000
1281
|
* so the editor can say what an export removes (ADR 0005).
|
|
@@ -1043,12 +1324,19 @@ declare type ImageOutput = {
|
|
|
1043
1324
|
|
|
1044
1325
|
/**
|
|
1045
1326
|
* The session's document: a description of the edits over an immutable
|
|
1046
|
-
* 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).
|
|
1047
1329
|
*
|
|
1048
1330
|
* @public
|
|
1049
1331
|
*/
|
|
1050
1332
|
declare interface ImagePlan {
|
|
1051
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;
|
|
1052
1340
|
readonly output: ImageOutput;
|
|
1053
1341
|
/** The fields the user chose to keep on export. Never a location (ADR 0005). */
|
|
1054
1342
|
readonly metadata: ImageKeepableMetadata;
|
|
@@ -1124,6 +1412,95 @@ declare interface ImageProgressOptions extends ImageCallOptions {
|
|
|
1124
1412
|
readonly onProgress?: (fraction: number) => void;
|
|
1125
1413
|
}
|
|
1126
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
|
+
|
|
1127
1504
|
/**
|
|
1128
1505
|
* Options for registering a source.
|
|
1129
1506
|
*
|
|
@@ -1171,6 +1548,29 @@ declare interface ImageSession {
|
|
|
1171
1548
|
open(file: Blob, options?: {
|
|
1172
1549
|
readonly signal?: AbortSignal;
|
|
1173
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>;
|
|
1174
1574
|
/**
|
|
1175
1575
|
* Applies commands as one undoable step. They're checked by the reducer,
|
|
1176
1576
|
* then the output against `maxImageDimension` and `maxImagePixels`; a
|
|
@@ -1181,7 +1581,9 @@ declare interface ImageSession {
|
|
|
1181
1581
|
* Makes the document's plan equal to `plan`, as one undoable step of the
|
|
1182
1582
|
* commands that reach it, checked as `execute` checks them (ADR 0003). A
|
|
1183
1583
|
* plan equal to the current one changes nothing. A plan over another
|
|
1184
|
-
* source is `INVALID_COMMAND
|
|
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.
|
|
1185
1587
|
*/
|
|
1186
1588
|
applyPlan(plan: ImagePlan): void;
|
|
1187
1589
|
/**
|
|
@@ -1205,7 +1607,7 @@ declare interface ImageSession {
|
|
|
1205
1607
|
readonly signal?: AbortSignal;
|
|
1206
1608
|
readonly onProgress?: (fraction: number) => void;
|
|
1207
1609
|
}): Promise<ImageSessionExport>;
|
|
1208
|
-
/** Releases
|
|
1610
|
+
/** Releases every source the session holds. Later calls throw. */
|
|
1209
1611
|
destroy(): Promise<void>;
|
|
1210
1612
|
}
|
|
1211
1613
|
|
|
@@ -1216,7 +1618,7 @@ declare interface ImageSession {
|
|
|
1216
1618
|
* @public
|
|
1217
1619
|
*/
|
|
1218
1620
|
declare interface ImageSessionEvent {
|
|
1219
|
-
readonly type: "open" | "execute" | "undo" | "redo" | "export";
|
|
1621
|
+
readonly type: "open" | "insert" | "execute" | "undo" | "redo" | "export";
|
|
1220
1622
|
readonly outcome: "done" | "failed" | "cancelled";
|
|
1221
1623
|
/** The types of the commands applied or undone. */
|
|
1222
1624
|
readonly commands: readonly ImageCommand["type"][];
|
|
@@ -1255,8 +1657,20 @@ declare interface ImageSessionSnapshot {
|
|
|
1255
1657
|
readonly plan: ImagePlan | null;
|
|
1256
1658
|
/** The document's source, or `null` before a file is open. */
|
|
1257
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[];
|
|
1258
1665
|
readonly canUndo: boolean;
|
|
1259
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;
|
|
1260
1674
|
/** Whether a file is being opened. The current document stays until it's ready. */
|
|
1261
1675
|
readonly opening: boolean;
|
|
1262
1676
|
/** Whether an export is in progress. */
|
|
@@ -1283,6 +1697,25 @@ declare interface ImageSessionSource extends ImageSourceInfo {
|
|
|
1283
1697
|
readonly keepable: ImageKeepableMetadata;
|
|
1284
1698
|
}
|
|
1285
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
|
+
|
|
1286
1719
|
/**
|
|
1287
1720
|
* A width and a height, in whole pixels.
|
|
1288
1721
|
*
|
|
@@ -1336,6 +1769,27 @@ export declare interface ImageStageProps {
|
|
|
1336
1769
|
readonly className?: string;
|
|
1337
1770
|
}
|
|
1338
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
|
+
|
|
1339
1793
|
/**
|
|
1340
1794
|
* A small rendering of a source for lists and frame strips. An `ImageBitmap`
|
|
1341
1795
|
* is one; tests can supply their own. Close it when it's no longer shown.
|
|
@@ -1399,6 +1853,8 @@ export declare interface ImageToolContext {
|
|
|
1399
1853
|
readonly editor: Store<ImageEditorState>;
|
|
1400
1854
|
/** Asks the user for an image, as the open tool does. */
|
|
1401
1855
|
readonly chooseFile: () => void;
|
|
1856
|
+
/** Asks the user for an image to add as a layer (docs/adr/0013). */
|
|
1857
|
+
readonly chooseLayerImage: () => void;
|
|
1402
1858
|
}
|
|
1403
1859
|
|
|
1404
1860
|
/**
|
|
@@ -1432,6 +1888,129 @@ export declare interface ImageViewState {
|
|
|
1432
1888
|
};
|
|
1433
1889
|
}
|
|
1434
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
|
+
|
|
1435
2014
|
/**
|
|
1436
2015
|
* Sets or removes the base's crop, in whole pixels of the oriented source.
|
|
1437
2016
|
*
|
|
@@ -1463,6 +2042,18 @@ declare interface SetFilterCommand {
|
|
|
1463
2042
|
readonly filter: ImageFilter | null;
|
|
1464
2043
|
}
|
|
1465
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
|
+
|
|
1466
2057
|
/**
|
|
1467
2058
|
* Sets one metadata field to keep on export. An empty value keeps nothing.
|
|
1468
2059
|
*
|
|
@@ -1494,6 +2085,46 @@ declare interface SetOutputCommand {
|
|
|
1494
2085
|
readonly output: ImageOutput;
|
|
1495
2086
|
}
|
|
1496
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
|
+
|
|
1497
2128
|
/**
|
|
1498
2129
|
* The session's snapshot, re-rendering whenever it changes, through
|
|
1499
2130
|
* `useSyncExternalStore`, so it's safe with concurrent and server rendering.
|
|
@@ -1515,7 +2146,7 @@ export declare function useImageEditorState(): readonly [ImageEditorState, Store
|
|
|
1515
2146
|
*
|
|
1516
2147
|
* @public
|
|
1517
2148
|
*/
|
|
1518
|
-
export declare function useImageMessages(): Messages<
|
|
2149
|
+
export declare function useImageMessages(): Messages<ImageEditorMessageCatalogue>;
|
|
1519
2150
|
|
|
1520
2151
|
/**
|
|
1521
2152
|
* The session of the nearest `ImageEditorProvider`, to open images, run
|