@embededitor/free 1.1.1 → 3.0.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/CHANGELOG.md +171 -0
- package/ai-prompts.json +20 -0
- package/{heic2any-Cs98z6G5.js → heic2any-B35oRQBs.js} +4 -4
- package/i18n/en-us.json +148 -0
- package/i18n/es-es.json +148 -0
- package/i18n/pt-br.json +148 -0
- package/package.json +3 -1
- package/react-B78SF8r_.js +23858 -0
- package/react.d.ts +941 -89
- package/react.js +2 -3
- package/{rolldown-runtime-BW7eDwDX.js → rolldown-runtime-0qSvQf2_.js} +2 -2
- package/standalone-Bg2pdnRj.js +32885 -0
- package/standalone.d.ts +941 -89
- package/standalone.js +2 -3
- package/react-BGWJgOK5.js +0 -19956
- package/standalone-CnqpvUnu.js +0 -29011
package/standalone.d.ts
CHANGED
|
@@ -1,6 +1,129 @@
|
|
|
1
|
-
/*! Embed Editor Free
|
|
1
|
+
/*! Embed Editor Free 3.0.0 | © 2026 Rohde Softwares | Free license, commercial use included, on one condition: the Embed Editor badge stays visible and unaltered. Removing, hiding or covering it infringes the license, see https://embededitor.com/license */
|
|
2
|
+
/**
|
|
3
|
+
* Where the AI works on the photo, by its `kind`: `'ALL'`, the whole photo; `'BACKGROUND'`, what Remove Background took away
|
|
4
|
+
* (once it did); `'MARK'`, the mark on screen (the brush, `retouch.mark`); `'POLYGON'`, a closed outline of 3
|
|
5
|
+
* `points` or more; `'RECT'`. Points and rects are in the photo's px, the state's.
|
|
6
|
+
*/
|
|
7
|
+
export declare type AiArea = {
|
|
8
|
+
kind: 'ALL';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'BACKGROUND';
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'MARK';
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'POLYGON';
|
|
15
|
+
points: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}[];
|
|
19
|
+
} | {
|
|
20
|
+
height: number;
|
|
21
|
+
kind: 'RECT';
|
|
22
|
+
width: number;
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** The widths in px of the borders an Expand adds on each side of the photo (`onAiEditImage`'s `GENERATE_BORDERS`). */
|
|
28
|
+
export declare type AiBorders = {
|
|
29
|
+
bottom: number;
|
|
30
|
+
left: number;
|
|
31
|
+
right: number;
|
|
32
|
+
top: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* One thing `onAiDetectObjects` found: `box`, its rectangle as fractions from 0 to 1 of the image (`left` and `right` along
|
|
37
|
+
* its width, `top` and `bottom` along its height); `confidence`, from 0 to 1, when the model gives one; `text`, which of
|
|
38
|
+
* the `texts` asked for this find answers.
|
|
39
|
+
*/
|
|
40
|
+
export declare type AiDetected = {
|
|
41
|
+
box: {
|
|
42
|
+
bottom: number;
|
|
43
|
+
left: number;
|
|
44
|
+
right: number;
|
|
45
|
+
top: number;
|
|
46
|
+
};
|
|
47
|
+
confidence?: number;
|
|
48
|
+
text: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* What `onAiEditImage` is called with: the fill the person asked for, by its `operation`, each with its own fields alone.
|
|
53
|
+
* Every one gets `image`, the piece of the photo around the area, a PNG of at most 2048 px on its longer side, and a
|
|
54
|
+
* `signal` that aborts when the person stops or the editor closes; every one but `'EDIT_PHOTO'` gets `mask`, a PNG of the
|
|
55
|
+
* same size, white where to fill and black elsewhere. `'EDIT_PHOTO'`, the whole photo edited by words with nothing marked
|
|
56
|
+
* (`retouch.run` over `'ALL'`): `image` is the whole photo, no mask, `prompt` the edit in words and `referenceImage` an
|
|
57
|
+
* image for it, or `null`; the image back is the whole photo with the request done, what the words don't name as it was.
|
|
58
|
+
* `'ERASE_AREA'`, Remove Object's Remove: take away what is marked and fill it with what surrounds it.
|
|
59
|
+
* `'GENERATE_AREA'`, Generate on a mark: `prompt`, what to put there in words (`''` where the person gave only an image),
|
|
60
|
+
* and `referenceImage`, the image the person added to say what to put there, a PNG of at most 2048 px on its longer side,
|
|
61
|
+
* or `null`. `'GENERATE_BACKGROUND'`, the new background's Generate after Remove Background: `image` is the whole photo,
|
|
62
|
+
* transparent where the cut took the background away, `mask` white there, `prompt` the new background in words and
|
|
63
|
+
* `referenceImage` an image for it, or `null`, so a server can send a model made to put a subject on a new background.
|
|
64
|
+
* `'GENERATE_BORDERS'`, an Expand and its Generate Again: `image` is the bigger photo, its borders transparent, `mask`
|
|
65
|
+
* white on them, `borders` the widths in px of `image` of the borders it adds on each side, so a server can send a model
|
|
66
|
+
* that takes the photo and the borders, not a mask, and `prompt` the editor's own words, asking to continue the scene
|
|
67
|
+
* into the borders (the host's `aiPrompts.expandBorders` in their place).
|
|
68
|
+
*/
|
|
69
|
+
export declare type AiEditImageInput = {
|
|
70
|
+
image: Blob;
|
|
71
|
+
operation: 'EDIT_PHOTO';
|
|
72
|
+
prompt: string;
|
|
73
|
+
referenceImage: Blob | null;
|
|
74
|
+
signal: AbortSignal;
|
|
75
|
+
} | {
|
|
76
|
+
image: Blob;
|
|
77
|
+
mask: Blob;
|
|
78
|
+
operation: 'ERASE_AREA';
|
|
79
|
+
signal: AbortSignal;
|
|
80
|
+
} | {
|
|
81
|
+
image: Blob;
|
|
82
|
+
mask: Blob;
|
|
83
|
+
operation: 'GENERATE_AREA';
|
|
84
|
+
prompt: string;
|
|
85
|
+
referenceImage: Blob | null;
|
|
86
|
+
signal: AbortSignal;
|
|
87
|
+
} | {
|
|
88
|
+
image: Blob;
|
|
89
|
+
mask: Blob;
|
|
90
|
+
operation: 'GENERATE_BACKGROUND';
|
|
91
|
+
prompt: string;
|
|
92
|
+
referenceImage: Blob | null;
|
|
93
|
+
signal: AbortSignal;
|
|
94
|
+
} | {
|
|
95
|
+
borders: AiBorders;
|
|
96
|
+
image: Blob;
|
|
97
|
+
mask: Blob;
|
|
98
|
+
operation: 'GENERATE_BORDERS';
|
|
99
|
+
prompt: string;
|
|
100
|
+
signal: AbortSignal;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A prompt the editor sends a model, by its key: what `aiPrompts` can bring. The package's `ai-prompts.json` has each with
|
|
105
|
+
* the editor's own text. The guide, the system message of `onAiChooseCommands`'s conversation: `guideEditorAi`, the lines
|
|
106
|
+
* of the editor's own AI alone; `guideBase`, the rules every model meets; `guideArtDirector`, the art director's level,
|
|
107
|
+
* while Annotate's commands are offered; `guidePersonMark`, the person's mark, which only an agent linked from outside is
|
|
108
|
+
* told; `guideLanguage`, the editor's language, last. The lines a request adds to the person's words: `requestAnnotate`,
|
|
109
|
+
* before an Annotate-mode request's; `requestRecreate`, a composition asked again; `requestArea` and `requestAreas`, one
|
|
110
|
+
* area marked or several; `requestWholePhoto` and `requestBackground`, a request about the whole photo or the new
|
|
111
|
+
* background. The rules those lines and the person's mark end with: `ruleMark`, the person's mark; `ruleHostArea`, an
|
|
112
|
+
* area `ask.send` names. What the host's other functions get: `expandBorders`, `onAiEditImage`'s `prompt` for an Expand;
|
|
113
|
+
* `detectFace`, `detectLicensePlate`, `detectDocument` and `detectScreen`, `onAiDetectObjects`'s `texts`. Written out here
|
|
114
|
+
* (the d.ts carries no JSON), and held equal to the file's keys by src/types.spec.ts.
|
|
115
|
+
*/
|
|
116
|
+
export declare type AiPromptKey = 'detectDocument' | 'detectFace' | 'detectLicensePlate' | 'detectScreen' | 'expandBorders' | 'guideArtDirector' | 'guideBase' | 'guideEditorAi' | 'guideLanguage' | 'guidePersonMark' | 'requestAnnotate' | 'requestArea' | 'requestAreas' | 'requestBackground' | 'requestRecreate' | 'requestWholePhoto' | 'ruleHostArea' | 'ruleMark';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The prompts a host brings (`aiPrompts`): any subset of the editor's prompts, by key, each one a string that replaces that
|
|
120
|
+
* prompt whole. A prompt with `{ name }` placeholders keeps exactly the placeholders of the editor's own, which it fills
|
|
121
|
+
* in. The package's `ai-prompts.json` lists every key with the editor's own text.
|
|
122
|
+
*/
|
|
123
|
+
export declare type AiPrompts = Partial<Record<AiPromptKey, string>>;
|
|
124
|
+
|
|
2
125
|
/** An annotation of `EditState`'s `annotations` as `annotate.add` takes it: no `id` (the editor gives it the next), its `color` optional. */
|
|
3
|
-
declare type AnnotatePiece = Unsaved<Extract<SavedAnnotation, {
|
|
126
|
+
export declare type AnnotatePiece = Unsaved<Extract<SavedAnnotation, {
|
|
4
127
|
type: 'LENS';
|
|
5
128
|
}>> | Unsaved<Extract<SavedAnnotation, {
|
|
6
129
|
type: 'LINE';
|
|
@@ -18,7 +141,7 @@ declare type AnnotatePiece = Unsaved<Extract<SavedAnnotation, {
|
|
|
18
141
|
* `look`, `mark`, `padding` and `size`; a shape's `fill` and `kind`; a magnifier's `line`, `shape` and `zoom`; and the
|
|
19
142
|
* color, a hex.
|
|
20
143
|
*/
|
|
21
|
-
declare type AnnotateStyle = {
|
|
144
|
+
export declare type AnnotateStyle = {
|
|
22
145
|
color?: string;
|
|
23
146
|
corners?: 'ROUND' | 'SOFT' | 'SQUARE';
|
|
24
147
|
end?: AnnotationCap;
|
|
@@ -39,7 +162,7 @@ declare type AnnotateStyle = {
|
|
|
39
162
|
};
|
|
40
163
|
|
|
41
164
|
/** Annotate's tools: what a tap or a drag on the photo makes. */
|
|
42
|
-
declare type AnnotateTool = 'ARROW' | 'DRAW' | 'LENS' | 'NUMBER' | 'RULER' | 'SHAPE' | 'TEXT';
|
|
165
|
+
export declare type AnnotateTool = 'ARROW' | 'DRAW' | 'LENS' | 'NUMBER' | 'RULER' | 'SHAPE' | 'TEXT';
|
|
43
166
|
|
|
44
167
|
/**
|
|
45
168
|
* An arrow added to a text or to the Numbers' list, leaving its owner's box (a text's box, a Number's badge, the list's
|
|
@@ -86,6 +209,23 @@ declare type AnnotationAngle = number;
|
|
|
86
209
|
*/
|
|
87
210
|
declare type AnnotationBend = number | null;
|
|
88
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Where an annotation stands once laid out, in image px, as `read.screenshot` and the export draw it (whole px; the box
|
|
214
|
+
* round what turns): what the Annotate commands that place or move annotations resolve with, in `boxes`, one for the
|
|
215
|
+
* annotation each names and one for every other it moved. `id` is its id, `'LIST'` for the Numbers' list; `box` a text's
|
|
216
|
+
* card (its letters with the `PLAIN` and `CAPTION` looks), a Number's pill with its badge and words, a ruler's label, the
|
|
217
|
+
* list's block or a magnifier's rim; `badge` a Number's badge; `row` a Number's row in the list; `leader` a magnifier's
|
|
218
|
+
* line from its rim to its spot, a curve's start, middle and end or an elbow's corners. Each is `null` where it has none
|
|
219
|
+
* (a ruler with no label, a Number in the list with no pill, a magnifier on its own spot or with no line).
|
|
220
|
+
*/
|
|
221
|
+
export declare type AnnotationBox = {
|
|
222
|
+
badge: Rect | null;
|
|
223
|
+
box: Rect | null;
|
|
224
|
+
id: string;
|
|
225
|
+
leader: AnnotationPoint[] | null;
|
|
226
|
+
row: Rect | null;
|
|
227
|
+
};
|
|
228
|
+
|
|
89
229
|
/** How a line ends: nothing, an open head, a filled head, a dot or a bar. */
|
|
90
230
|
declare type AnnotationCap = 'ARROW' | 'BAR' | 'DOT' | 'NONE' | 'TRIANGLE';
|
|
91
231
|
|
|
@@ -133,7 +273,10 @@ declare type AnnotationShare = {
|
|
|
133
273
|
/** A side of an annotation's box, in its own frame. `null`: none. */
|
|
134
274
|
declare type AnnotationSide = 'BOTTOM' | 'LEFT' | 'RIGHT' | 'TOP' | null;
|
|
135
275
|
|
|
136
|
-
/**
|
|
276
|
+
/**
|
|
277
|
+
* A text's or the list's size: a share of the image's shorter side (the one `expandedFrom` holds, once `crop.expand` grew
|
|
278
|
+
* the image), 0.02…0.065 (small 0.028, medium 0.036, large 0.05).
|
|
279
|
+
*/
|
|
137
280
|
declare type AnnotationSize = number;
|
|
138
281
|
|
|
139
282
|
/** A line's stroke: solid, dashed, dotted, hand-drawn or a highlighter's. */
|
|
@@ -149,15 +292,55 @@ declare type AnnotationStrokePoint = {
|
|
|
149
292
|
/** What sits behind a label: light, dark, or the annotation's color. */
|
|
150
293
|
declare type AnnotationTheme = 'ACCENT' | 'DARK' | 'LIGHT';
|
|
151
294
|
|
|
152
|
-
/**
|
|
295
|
+
/**
|
|
296
|
+
* A line's weight, seven steps from extra thin to extra thick: 0.45, 0.57, 0.7 (medium thin, the default), 0.9, 1.15, 1.45
|
|
297
|
+
* and 1.85% of the photo's shorter side (the one `expandedFrom` holds, once `crop.expand` grew the photo).
|
|
298
|
+
*/
|
|
153
299
|
declare type AnnotationWeight = 'EXTRA_THICK' | 'EXTRA_THIN' | 'MEDIUM' | 'MEDIUM_THICK' | 'MEDIUM_THIN' | 'THICK' | 'THIN';
|
|
154
300
|
|
|
301
|
+
export declare type ChatContentPart = {
|
|
302
|
+
text: string;
|
|
303
|
+
type: 'text';
|
|
304
|
+
} | {
|
|
305
|
+
image_url: {
|
|
306
|
+
url: string;
|
|
307
|
+
};
|
|
308
|
+
type: 'image_url';
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export declare type ChatMessage = {
|
|
312
|
+
[key: string]: unknown;
|
|
313
|
+
content: string | ChatContentPart[] | null;
|
|
314
|
+
role: 'assistant' | 'system' | 'tool' | 'user';
|
|
315
|
+
tool_call_id?: string;
|
|
316
|
+
tool_calls?: ChatToolCall[];
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export declare type ChatTool = {
|
|
320
|
+
function: {
|
|
321
|
+
description: string;
|
|
322
|
+
name: string;
|
|
323
|
+
parameters: Record<string, unknown>;
|
|
324
|
+
};
|
|
325
|
+
type: 'function';
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export declare type ChatToolCall = {
|
|
329
|
+
function: {
|
|
330
|
+
arguments: string;
|
|
331
|
+
name: string;
|
|
332
|
+
};
|
|
333
|
+
id: string;
|
|
334
|
+
type: 'function';
|
|
335
|
+
};
|
|
336
|
+
|
|
155
337
|
/**
|
|
156
338
|
* The edits a host keeps (the `state` prop, and `onProcess`'s `state`), version 3, in the units the screen shows. The
|
|
157
339
|
* editor writes every field, its default included (no turn is 0, no flip `false`, an adjustment at 0 is 0, Auto, the
|
|
158
|
-
* filter, the frame and the list are `null` while off, no areas or annotations are `[]`,
|
|
159
|
-
* `null`, `size` is `null` while none is set,
|
|
160
|
-
* person's crop), so a later default never changes a
|
|
340
|
+
* filter, the frame and the list are `null` while off, no areas or annotations are `[]`, `expandedFrom` is `null` while
|
|
341
|
+
* the image is its own, a free crop's `aspectRatio` is `null`, `size` is `null` while none is set,
|
|
342
|
+
* `crop.scale` is 100 at the photo's largest window, `crop.intent` the person's crop), so a later default never changes a
|
|
343
|
+
* kept state. A state you write may leave any field out: absent reads
|
|
161
344
|
* as its default. Its image px are those of the size the editor works the image at (`onLoad`'s `size`).
|
|
162
345
|
*/
|
|
163
346
|
export declare type EditState = {
|
|
@@ -177,9 +360,10 @@ export declare type EditState = {
|
|
|
177
360
|
warmth?: number;
|
|
178
361
|
};
|
|
179
362
|
/**
|
|
180
|
-
* The Numbers' list, one block: its center, the color of its badges, its letter, size and theme, its title, a
|
|
181
|
-
*
|
|
182
|
-
* annotations, the last in their list, draw above it (absent: none, the list over
|
|
363
|
+
* The Numbers' list, one block: its center, the color of its badges, its letter, size and theme, its title, a width set
|
|
364
|
+
* by hand (a fraction of the image's shorter side, `expandedFrom`'s once an Expand grew it; `null`: as wide as its
|
|
365
|
+
* longest row), and how many of the annotations, the last in their list, draw above it (absent: none, the list over
|
|
366
|
+
* them all). `null`: no list.
|
|
183
367
|
*/
|
|
184
368
|
annotationList?: {
|
|
185
369
|
above?: number;
|
|
@@ -251,7 +435,10 @@ export declare type EditState = {
|
|
|
251
435
|
from: AnnotationPoint;
|
|
252
436
|
id: string;
|
|
253
437
|
label?: string;
|
|
254
|
-
/**
|
|
438
|
+
/**
|
|
439
|
+
* Its label's size, a share of the image's shorter side (`expandedFrom`'s once an Expand grew it), 0.02…0.065 (its
|
|
440
|
+
* line keeps its weight). Default 0.028, small.
|
|
441
|
+
*/
|
|
255
442
|
size?: number;
|
|
256
443
|
stroke?: AnnotationStroke;
|
|
257
444
|
theme?: AnnotationTheme;
|
|
@@ -319,7 +506,7 @@ export declare type EditState = {
|
|
|
319
506
|
theme?: AnnotationTheme;
|
|
320
507
|
title?: string;
|
|
321
508
|
type: 'TEXT';
|
|
322
|
-
/** Its largest width, set by hand: a fraction of the image's shorter side. `null`: automatic. */
|
|
509
|
+
/** Its largest width, set by hand: a fraction of the image's shorter side (`expandedFrom`'s once an Expand grew it). `null`: automatic. */
|
|
323
510
|
width?: number | null;
|
|
324
511
|
} | {
|
|
325
512
|
angle?: AnnotationAngle;
|
|
@@ -399,6 +586,14 @@ export declare type EditState = {
|
|
|
399
586
|
x: number;
|
|
400
587
|
y: number;
|
|
401
588
|
};
|
|
589
|
+
/**
|
|
590
|
+
* The image `crop.expand` grew: where it sits in the bigger one, in image px. Every length the edit takes from the image
|
|
591
|
+
* is measured on it, so the edit keeps its look on the bigger image, and a session opened again with `src` and the
|
|
592
|
+
* state draws the same: the annotations' sizes and strokes are shares of its shorter side; Obfuscate's blur and blocks
|
|
593
|
+
* (from its corner), the Sharpness and the local adjustments (Brilliance, Highlights, Shadows) reach as far as they did
|
|
594
|
+
* on it. `null`: the image is its own, no Expand's borders around it.
|
|
595
|
+
*/
|
|
596
|
+
expandedFrom?: Rect | null;
|
|
402
597
|
/** The filter and its intensity, 0…100. `null`: none. */
|
|
403
598
|
filter?: {
|
|
404
599
|
id: 'DRAMATIC' | 'DRAMATIC_COOL' | 'DRAMATIC_WARM' | 'MONO' | 'NOIR' | 'SILVERTONE' | 'VIVID' | 'VIVID_COOL' | 'VIVID_WARM';
|
|
@@ -510,15 +705,18 @@ export declare type EmbedEditorCommand = {
|
|
|
510
705
|
|
|
511
706
|
/**
|
|
512
707
|
* What a command of `EmbedEditorHandle` rejects with, besides the editor's own codes (`EmbedEditorErrorCode`: Save's
|
|
513
|
-
* `EXPORT_FAILED` and `MARK_FAILED`): `
|
|
514
|
-
* doesn't
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
708
|
+
* `EXPORT_FAILED` and `MARK_FAILED`): `AI_FAILED` (a host function the AI called rejected, its error the `cause`, or
|
|
709
|
+
* answered what its contract doesn't take), `INVALID_COMMAND`, `NOT_AVAILABLE` (a tool the props turned off or the
|
|
710
|
+
* edition doesn't have, or the editor was destroyed or closed; each command names its own cases) or `NOT_FOUND` (no area
|
|
711
|
+
* at that index, no annotation with that id, nothing found by the host's `onAiDetectObjects` or `onAiRemoveBackground`, an edit the
|
|
712
|
+
* photo on screen doesn't hold, no composition for `annotate.recreate` to redo, an area the mark commands name that the
|
|
713
|
+
* photo's window doesn't show). `INVALID_COMMAND` is of two kinds, its `props` naming each path from the
|
|
714
|
+
* input (`input.item`) either way: an input off its schema, or a command the handle doesn't have (`props`
|
|
715
|
+
* `['command']`), rejects at once, its `cause` the schema's own error (none for an unknown name); an input the command
|
|
716
|
+
* can't take where the editor stands (an area no drag would draw, a key the annotation's kind doesn't take, a size off
|
|
717
|
+
* the watermark's layout) rejects on the command's turn, with no `cause`. A rejected command changes nothing.
|
|
520
718
|
*/
|
|
521
|
-
export declare type EmbedEditorCommandErrorCode = 'INVALID_COMMAND' | 'NOT_AVAILABLE' | 'NOT_FOUND';
|
|
719
|
+
export declare type EmbedEditorCommandErrorCode = 'AI_FAILED' | 'INVALID_COMMAND' | 'NOT_AVAILABLE' | 'NOT_FOUND';
|
|
522
720
|
|
|
523
721
|
/**
|
|
524
722
|
* What `onLoadError` and `onProcessError` receive, and `processImage` and a command reject with: its `message` is its
|
|
@@ -570,9 +768,13 @@ export declare type EmbedEditorEvents = {
|
|
|
570
768
|
file: File | null;
|
|
571
769
|
size: Size;
|
|
572
770
|
};
|
|
573
|
-
/**
|
|
771
|
+
/**
|
|
772
|
+
* A Save that went through (its button's or `output.save`), what `onProcess` gets. `src` is `null` while the photo is
|
|
773
|
+
* still the one you passed (no AI edit, a session reopened on an earlier `src` included): keep the `src` you have.
|
|
774
|
+
*/
|
|
574
775
|
save: {
|
|
575
776
|
dest: File;
|
|
777
|
+
src: File | null;
|
|
576
778
|
state: EditState;
|
|
577
779
|
};
|
|
578
780
|
/** What is selected, once it changes (`EmbedEditorSelection`). */
|
|
@@ -589,7 +791,9 @@ export declare type EmbedEditorEvents = {
|
|
|
589
791
|
* `EmbedEditorError` (`EmbedEditorCommandErrorCode`, or Save's own codes) and then changes nothing. Once the editor
|
|
590
792
|
* leaves the page (unmounted, its `<Activity>` hidden, `destroy`, `close`), every command waiting and every one called
|
|
591
793
|
* after rejects `NOT_AVAILABLE`, until it is back; a command running as it leaves rejects too, though what it already
|
|
592
|
-
* changed stays, and changes nothing more, the editor back or not. Before the editor first mounts, a command waits for it
|
|
794
|
+
* changed stays, and changes nothing more, the editor back or not. Before the editor first mounts, a command waits for it,
|
|
795
|
+
* except `ask.stop`, `ask.end`, `menu.closeCard`, `menu.foldCard` and `menu.unfoldCard`: they never queue, and reject `NOT_AVAILABLE` before
|
|
796
|
+
* the mount.
|
|
593
797
|
*/
|
|
594
798
|
export declare type EmbedEditorHandle = {
|
|
595
799
|
/**
|
|
@@ -610,21 +814,23 @@ export declare type EmbedEditorHandle = {
|
|
|
610
814
|
};
|
|
611
815
|
/**
|
|
612
816
|
* Annotate (the Full's and the Trial's; elsewhere each command rejects `NOT_AVAILABLE`), as its controls do, in
|
|
613
|
-
* `EditState`'s names and image px. An edit never opens Annotate, and selects what it made only while Annotate is open
|
|
614
|
-
* a verb of the action bar rejects `NOT_AVAILABLE` where the bar
|
|
615
|
-
* lists what it offers), and an `id` the state lacks rejects
|
|
616
|
-
* the host turned Annotate off (`enableAnnotate: false`).
|
|
817
|
+
* `EditState`'s names and image px. An edit never opens Annotate, and selects what it made only while Annotate is open
|
|
818
|
+
* and no AI request or linked agent's call works; a verb of the action bar rejects `NOT_AVAILABLE` where the bar
|
|
819
|
+
* doesn't offer it for that annotation (`read.options` lists what it offers), and an `id` the state lacks rejects
|
|
820
|
+
* `NOT_FOUND`. Every command rejects `NOT_AVAILABLE` while the host turned Annotate off (`enableAnnotate: false`).
|
|
617
821
|
*/
|
|
618
822
|
annotate: {
|
|
619
823
|
/**
|
|
620
824
|
* An annotation, as a tap or a drag of its tool makes one: a `LINE` (with `points` a drawing, with `role: 'SHAPE'` a
|
|
621
825
|
* Shape's Line), a `RULER`, a `TEXT` (with `role: 'NUMBER'` a Number), a `SHAPE` or a `LENS`; what it leaves out
|
|
622
|
-
* takes its tool's last style (`setStyle`),
|
|
623
|
-
* One undo step; resolves to its `id
|
|
826
|
+
* takes its tool's last style (`setStyle`), an arrow in a text's `arrows` an added arrow's default, and a text's
|
|
827
|
+
* `title` and `body` (a ruler's `label`) are typed into it. One undo step; resolves to its `id` and where it stands
|
|
828
|
+
* once laid out (`boxes`, AnnotationBox). `NOT_AVAILABLE` once the photo holds the most annotations it takes.
|
|
624
829
|
*/
|
|
625
830
|
add: (input: {
|
|
626
831
|
piece: AnnotatePiece;
|
|
627
832
|
}) => Promise<{
|
|
833
|
+
boxes: AnnotationBox[];
|
|
628
834
|
id: string;
|
|
629
835
|
}>;
|
|
630
836
|
/**
|
|
@@ -642,27 +848,50 @@ export declare type EmbedEditorHandle = {
|
|
|
642
848
|
arrow: number;
|
|
643
849
|
id: string;
|
|
644
850
|
}>;
|
|
645
|
-
/** The action bar's + Leader on a magnifier on its own spot: it moves to the free spot a tap's takes, its line showing. One undo step. */
|
|
851
|
+
/** The action bar's + Leader on a magnifier on its own spot: it moves to the free spot a tap's takes, its line showing. One undo step; resolves to where it stands (`boxes`). */
|
|
646
852
|
addLeader: (input: {
|
|
647
853
|
id: string;
|
|
648
|
-
}) => Promise<
|
|
854
|
+
}) => Promise<{
|
|
855
|
+
boxes: AnnotationBox[];
|
|
856
|
+
}>;
|
|
649
857
|
/**
|
|
650
858
|
* The action bar's + Text on an arrow, a line, a drawing, a shape or a magnifier: a text born touching it in the Text
|
|
651
|
-
* tool's last style, `title` and `body` typed into it. One undo step; resolves to the text's `id
|
|
859
|
+
* tool's last style, `title` and `body` typed into it. One undo step; resolves to the text's `id` and where it
|
|
860
|
+
* stands (`boxes`).
|
|
652
861
|
*/
|
|
653
862
|
addText: (input: {
|
|
654
863
|
body?: string;
|
|
655
864
|
id: string;
|
|
656
865
|
title?: string;
|
|
657
866
|
}) => Promise<{
|
|
867
|
+
boxes: AnnotationBox[];
|
|
658
868
|
id: string;
|
|
659
869
|
}>;
|
|
660
870
|
/** The action bar's Bring to Front: the annotation, or the Numbers' list (`id: 'LIST'`), over the ones covering it. One undo step. */
|
|
661
871
|
bringToFront: (input: {
|
|
662
872
|
id: string;
|
|
663
873
|
}) => Promise<null>;
|
|
664
|
-
/** Annotate closed, as its button: what was selected lets go. */
|
|
874
|
+
/** Annotate closed, as its button: what was selected lets go, and the AI's Annotate mode with it (`ask.close`). */
|
|
665
875
|
close: () => Promise<null>;
|
|
876
|
+
/**
|
|
877
|
+
* The AI's Annotate mode (with the host's `onAiChooseCommands`; without it each rejects `NOT_AVAILABLE`, as `ask.send`): the person
|
|
878
|
+
* gives the content in words and the AI composes the annotations, deciding the story, the style, where each piece goes
|
|
879
|
+
* and what each text says. The same request as `ask.send`, in the same conversation, Annotate opened first where it is
|
|
880
|
+
* closed (as `select` opens it, the photo's AI closing as `ask.close`) and the AI open in it on Annotate's mode, in its
|
|
881
|
+
* words, except that the model gets the person's words after the line "Annotate the photo for this request, as the art
|
|
882
|
+
* director:" (the host's `aiPrompts.requestAnnotate` in its place), takes no `area`, and is given none of the work of
|
|
883
|
+
* the host's other AI functions (Annotate changes no pixels). Resolves once the AI is done to the `ids` of the
|
|
884
|
+
* composition's annotations on the photo (the ones the conversation's Annotate-mode requests made and the edits of
|
|
885
|
+
* them, never one the person drew or copied: what `recreate` redoes) and its last words (`reply`); `ask.stop`, Stop or
|
|
886
|
+
* Escape resolve it at once with what it did so far. Everything it did is one undo step. Rejects as `ask.send` does,
|
|
887
|
+
* Annotate open or not (`NOT_AVAILABLE` where its screens fail to load).
|
|
888
|
+
*/
|
|
889
|
+
create: (input: {
|
|
890
|
+
text: string;
|
|
891
|
+
}) => Promise<{
|
|
892
|
+
ids: string[];
|
|
893
|
+
reply: string;
|
|
894
|
+
}>;
|
|
666
895
|
/**
|
|
667
896
|
* The action bar's Detach: a line's glued ends, or the glued tip of the arrow `arrow` of a text or of the Numbers' list
|
|
668
897
|
* (`id: 'LIST'`), let go where they are. One undo step.
|
|
@@ -671,19 +900,34 @@ export declare type EmbedEditorHandle = {
|
|
|
671
900
|
arrow?: number;
|
|
672
901
|
id: string;
|
|
673
902
|
}) => Promise<null>;
|
|
674
|
-
/** The action bar's Duplicate: a copy a step down and right on the screen, whatever the photo's turn or mirror, with its text. One undo step; resolves to the copy's `id
|
|
903
|
+
/** The action bar's Duplicate: a copy a step down and right on the screen, whatever the photo's turn or mirror, with its text. One undo step; resolves to the copy's `id` and where it stands (`boxes`). */
|
|
675
904
|
duplicate: (input: {
|
|
676
905
|
id: string;
|
|
677
906
|
}) => Promise<{
|
|
907
|
+
boxes: AnnotationBox[];
|
|
678
908
|
id: string;
|
|
679
909
|
}>;
|
|
680
|
-
/** In a List: the Numbers' words in a list placed off the photo's subject (the one `unlist` took away, if any). One undo step. */
|
|
681
|
-
list: () => Promise<
|
|
910
|
+
/** In a List: the Numbers' words in a list placed off the photo's subject (the one `unlist` took away, if any). One undo step; resolves to where the list and the Numbers stand (`boxes`). */
|
|
911
|
+
list: () => Promise<{
|
|
912
|
+
boxes: AnnotationBox[];
|
|
913
|
+
}>;
|
|
682
914
|
/**
|
|
683
|
-
* Annotate opened, as its button: on the tool chosen last, nothing selected
|
|
684
|
-
* moves to its room). `NOT_AVAILABLE` where its screens fail
|
|
915
|
+
* Annotate opened, as its button: on the tool chosen last, nothing selected, the AI closed first if open
|
|
916
|
+
* (`ask.close`). Resolves once it is open (the view then moves to its room). `NOT_AVAILABLE` where its screens fail
|
|
917
|
+
* to load.
|
|
685
918
|
*/
|
|
686
919
|
open: () => Promise<null>;
|
|
920
|
+
/**
|
|
921
|
+
* The Annotate mode's Generate with the words of its last request: the composition's annotations go, with what they own (the ones on
|
|
922
|
+
* the photo now, the composition `history.undo` brought back too; never one the person drew or copied), and the AI
|
|
923
|
+
* composes again for the same request, in a different style, in the same conversation, Annotate opened first as for
|
|
924
|
+
* `create`. All of it is one undo step, so one `history.undo` brings the composition before back. Resolves as `create` does. `NOT_FOUND` with no composition to redo (no `create`
|
|
925
|
+
* in the conversation, or one `ask.end` ended), and rejects as `create` otherwise.
|
|
926
|
+
*/
|
|
927
|
+
recreate: () => Promise<{
|
|
928
|
+
ids: string[];
|
|
929
|
+
reply: string;
|
|
930
|
+
}>;
|
|
687
931
|
/**
|
|
688
932
|
* The action bar's Delete: the annotation with what it owns, the Numbers' list (`id: 'LIST'`, its Numbers staying), or
|
|
689
933
|
* only the arrow `arrow` of a text or of the list. One undo step.
|
|
@@ -694,16 +938,19 @@ export declare type EmbedEditorHandle = {
|
|
|
694
938
|
}) => Promise<null>;
|
|
695
939
|
/**
|
|
696
940
|
* Annotate opened with an annotation selected, the Numbers' list (`id: 'LIST'`), or the arrow `arrow` of a text or of
|
|
697
|
-
* the list, as a tap on it; `id: null` lets the selection go, and opens nothing.
|
|
941
|
+
* the list, as a tap on it; `id: null` lets the selection go, and opens nothing. Opening Annotate closes the AI first
|
|
942
|
+
* (as `ask.close`), as `open` does.
|
|
698
943
|
*/
|
|
699
944
|
select: (input: {
|
|
700
945
|
arrow?: number;
|
|
701
946
|
id: string | null;
|
|
702
947
|
}) => Promise<null>;
|
|
703
|
-
/** The Numbers' list's title, as its own field writes it (trimmed). One undo step. `NOT_FOUND` with no list. */
|
|
948
|
+
/** The Numbers' list's title, as its own field writes it (trimmed). One undo step; resolves to where the list stands (`boxes`). `NOT_FOUND` with no list. */
|
|
704
949
|
setListTitle: (input: {
|
|
705
950
|
title: string;
|
|
706
|
-
}) => Promise<
|
|
951
|
+
}) => Promise<{
|
|
952
|
+
boxes: AnnotationBox[];
|
|
953
|
+
}>;
|
|
707
954
|
/**
|
|
708
955
|
* The style the next annotation of `tool` (left out: the one open on Annotate's carousel) is born in, as the rows
|
|
709
956
|
* with nothing selected; `kind: 'LINE'` makes the Shape's next one a Line. `INVALID_COMMAND` for an option that
|
|
@@ -717,18 +964,30 @@ export declare type EmbedEditorHandle = {
|
|
|
717
964
|
setTheme: (input: {
|
|
718
965
|
theme: AnnotationTheme;
|
|
719
966
|
}) => Promise<null>;
|
|
720
|
-
/**
|
|
967
|
+
/**
|
|
968
|
+
* The tool a tap or a drag on the photo makes, as Annotate's carousel: what was selected lets go. Annotate opens on it
|
|
969
|
+
* if it is closed, as `open` opens it; resolves once it is open. `NOT_AVAILABLE` as `open`. Rejected, it changes nothing: the tool stays the one chosen before.
|
|
970
|
+
*/
|
|
721
971
|
setTool: (input: {
|
|
722
972
|
tool: AnnotateTool;
|
|
723
973
|
}) => Promise<null>;
|
|
724
|
-
/** Beside: the Numbers' list taken away, each Number's words back by its badge; `list` brings it back. One undo step. */
|
|
725
|
-
unlist: () => Promise<
|
|
974
|
+
/** Beside: the Numbers' list taken away, each Number's words back by its badge; `list` brings it back. One undo step; resolves to where the Numbers stand (`boxes`). */
|
|
975
|
+
unlist: () => Promise<{
|
|
976
|
+
boxes: AnnotationBox[];
|
|
977
|
+
}>;
|
|
726
978
|
/**
|
|
727
979
|
* An annotation changed (or, with `arrow`, the arrow of a text or of the Numbers' list), as its style row, color row
|
|
728
980
|
* and typing do: its style, a `theme`, its words (a text's `title` and `body`, a ruler's `label`) and its geometry
|
|
729
|
-
* (`from`, `to`, `at`, `box`, `origin`, `radius`, `angle`, `bend`, `width`, written as given).
|
|
730
|
-
*
|
|
731
|
-
*
|
|
981
|
+
* (`from`, `to`, `at`, `box`, `origin`, `radius`, `angle`, `bend`, `width`, written as given). Where it moves an
|
|
982
|
+
* annotation whole, it moves it as a drag of it does, the texts pinned to it and the tips glued to either with it: a
|
|
983
|
+
* text's, a Number's or a magnifier's `at` (one on its spot taking its `origin` along), a shape's `box` at its size,
|
|
984
|
+
* a line's or a ruler's `from` and `to` by as far (a line letting go of what its ends were glued to, an Elbow keeping
|
|
985
|
+
* its route as drawn). A Number's `at` takes its badge's point with it: in the list its badge goes onto `at`, standing
|
|
986
|
+
* alone its pill stands on `at`. The list (`id: 'LIST'`) and a Number in it set the
|
|
987
|
+
* list's color, theme, font and size with every Number's; the list takes its `at`, moved as a drag of it moves it, the
|
|
988
|
+
* tips glued to it with it, and its `angle` and `width`, written as a text's are (a turn leaves those tips where they
|
|
989
|
+
* are). An arrow takes its owner's color and no theme. One undo step; resolves to where what it moved stands
|
|
990
|
+
* (`boxes`). `INVALID_COMMAND` for what that annotation has none of.
|
|
732
991
|
*/
|
|
733
992
|
update: (input: Flat<AnnotateStyle & {
|
|
734
993
|
angle?: AnnotationAngle;
|
|
@@ -747,7 +1006,130 @@ export declare type EmbedEditorHandle = {
|
|
|
747
1006
|
title?: string;
|
|
748
1007
|
to?: AnnotationPoint;
|
|
749
1008
|
width?: number | null;
|
|
750
|
-
}>) => Promise<
|
|
1009
|
+
}>) => Promise<{
|
|
1010
|
+
boxes: AnnotationBox[];
|
|
1011
|
+
}>;
|
|
1012
|
+
};
|
|
1013
|
+
/**
|
|
1014
|
+
* The conversation with the AI, as its circle, its field and its Stop: the host's `onAiChooseCommands` answers, and each tool the model
|
|
1015
|
+
* calls runs as one of these commands. The Full's and the Trial's; elsewhere every one rejects `NOT_AVAILABLE`. There, `send`
|
|
1016
|
+
* rejects it without `onAiChooseCommands`, `open` and `setText` without `onAiChooseCommands`, `onAiEditImage` or `onAiRemoveBackground`
|
|
1017
|
+
* (`onAiDetectObjects` alone opens none), `setAction` for an action the host's functions can't run, `setReferenceImage`
|
|
1018
|
+
* outside Generate or without `onAiEditImage`, and `close`, `stop` and `end` with none of the host's AI functions.
|
|
1019
|
+
*/
|
|
1020
|
+
ask: {
|
|
1021
|
+
/**
|
|
1022
|
+
* Closes the AI, as a tap on its lit ✦, losing nothing: it opens again (`open`, `send`) with the conversation going on,
|
|
1023
|
+
* its field's words and the areas marked (unseen while it is closed) as they were; its last reply or
|
|
1024
|
+
* failure leaves its card. The menu comes back where it was as the AI opened, whichever of its modes were chosen
|
|
1025
|
+
* meanwhile: Annotate where the AI was opened in it (open again where a photo's action closed it), else Annotate closed
|
|
1026
|
+
* where it opened only for `setAction`'s `'ANNOTATE'`, the tool and its section as they were; what the AI made stays. It never
|
|
1027
|
+
* fails: where Annotate can't open again as the AI closes (`enableAnnotate` off, a gesture or a Save under way), the AI
|
|
1028
|
+
* closes and the menu lands on the tools, as a close from them does.
|
|
1029
|
+
* `menu.select`, `menu.openSection`, `menu.toggle`, `annotate.open`, `annotate.select` and `annotate.setTool` opening
|
|
1030
|
+
* Annotate, `annotate.close`, and `annotate.setTool` with Annotate's mode open close it first, losing nothing, and go on
|
|
1031
|
+
* where they go (the tools row and Annotate's button hide while it is open). Resolves to `null`; with the AI closed it
|
|
1032
|
+
* changes nothing. `NOT_AVAILABLE` without any of the host's AI functions.
|
|
1033
|
+
*/
|
|
1034
|
+
close: () => Promise<null>;
|
|
1035
|
+
/**
|
|
1036
|
+
* Ends the conversation, the host's own (the person closes the AI with `close`'s ✦, losing nothing): a request or any
|
|
1037
|
+
* other work of the AI's under way stops first (as `stop`), the AI closes with the mark and the AI's card, and the next
|
|
1038
|
+
* `send` starts a new conversation (every image a fill landed stays on the photo, a step of the history).
|
|
1039
|
+
* Resolves to `null` at once while the AI works, even while a request holds the queue; with none under way, once a
|
|
1040
|
+
* gesture the person holds has ended.
|
|
1041
|
+
*/
|
|
1042
|
+
end: () => Promise<null>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Opens the AI, as a tap on its ✦: on the photo's action chosen out of Annotate, on Annotate's mode in it, as `close`
|
|
1045
|
+
* left them, its rows in the menu in place of the tools row and Annotate's button, which hide while it is open, the lit
|
|
1046
|
+
* ✦ at the right end of its selector's row. Resolves to `null` once it is open;
|
|
1047
|
+
* already open, it stays as it is. Rejects `NOT_AVAILABLE` without `onAiChooseCommands`, `onAiEditImage` or
|
|
1048
|
+
* `onAiRemoveBackground`, and in Annotate without `onAiChooseCommands`.
|
|
1049
|
+
*/
|
|
1050
|
+
open: () => Promise<null>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Asks the AI for something in words, as the person writes it and sends it: the AI's field opens if it is
|
|
1053
|
+
* closed, each tool the model calls runs in turn (selecting nothing it makes), and the editor takes no input
|
|
1054
|
+
* meanwhile but Close, Escape, which stops the work, and the AI's card (its Stop and its pill). The AI works the photo with the editor's tools (it adjusts, filters, crops,
|
|
1055
|
+
* hides, removes and generates in an area) and never annotates: it is offered none of Annotate's commands, and
|
|
1056
|
+
* `annotate.create` is the one way to annotate with it. With `area`, the request is about that place of the photo
|
|
1057
|
+
* (`'MARK'`: the mark there): it shows while the request's fill of it works, written into none of the person's
|
|
1058
|
+
* areas, and the model is told how many areas it is and their boxes in the photo's px, as `read.mark` gives them,
|
|
1059
|
+
* and to use `retouch_remove` or `retouch_run` with `{ kind: 'MARK' }`, which changes exactly the marked px, never
|
|
1060
|
+
* their boxes. `'ALL'` and `'BACKGROUND'`, which no Remove takes, are told by their own kind, never as a mark: the
|
|
1061
|
+
* whole photo or the background, its box, and `retouch_run` with `{ kind: 'ALL' }` or `{ kind: 'BACKGROUND' }`. An
|
|
1062
|
+
* area other than `'MARK'` is filled once in the request: once its fill lands, `read_mark` gives `[]` and another
|
|
1063
|
+
* fill of it there (`{ kind: 'MARK' }`, or the whole photo's or the background's own kind) rejects `INVALID_COMMAND`
|
|
1064
|
+
* (`input.area`), the person's areas never read by it. Resolves once the AI is done,
|
|
1065
|
+
* to its last words (`reply`), which the AI's card shows; `stop`, Stop or Escape resolve it at once with what it did
|
|
1066
|
+
* so far.
|
|
1067
|
+
* Everything it did is one undo step, and the next request goes on in the same conversation until `end`. Rejects
|
|
1068
|
+
* `NOT_AVAILABLE` for `'BACKGROUND'` with no background removed, while Annotate is open (the photo's AI is not on screen
|
|
1069
|
+
* then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first, or `setAction`), and when the editor leaves the page, is
|
|
1070
|
+
* destroyed or opens another image meanwhile; `INVALID_COMMAND` for a text with no words and for an area with
|
|
1071
|
+
* nothing of the photo in it (`'MARK'` with nothing marked); and `AI_FAILED` when `onAiChooseCommands` rejects (its error
|
|
1072
|
+
* the `cause`; what the AI did so far stays, one undo step).
|
|
1073
|
+
*/
|
|
1074
|
+
send: (input: {
|
|
1075
|
+
area?: AiArea;
|
|
1076
|
+
text: string;
|
|
1077
|
+
}) => Promise<{
|
|
1078
|
+
reply: string;
|
|
1079
|
+
}>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Chooses what the AI does, as a tap on its selector over the menu (Edit, Remove Object, Remove Background, Annotate):
|
|
1082
|
+
* `'GENERATE'` (Edit: the field and its Generate: words over the areas marked, or over the whole photo with nothing
|
|
1083
|
+
* marked, through `onAiChooseCommands` where given, else by `retouch.run` of `'ALL'`; a reference image over the areas
|
|
1084
|
+
* marked, or over the whole photo with nothing marked), `'REMOVE_OBJECT'` (the brush and Remove, which
|
|
1085
|
+
* removes what the areas cover) or `'REMOVE_BACKGROUND'` (Remove; the field of what to keep with
|
|
1086
|
+
* `enableAiRemoveBackgroundPrompt`; once the background is cut, the field of the new background with `onAiEditImage`) or
|
|
1087
|
+
* `'ANNOTATE'` (Annotate's mode: the field whose Generate composes Annotate's pieces, as `annotate.create`, Annotate
|
|
1088
|
+
* opening under it where it is closed, and closing with the AI where it opened only for it, the pieces it made staying;
|
|
1089
|
+
* a photo's action chosen from it closes Annotate first), each where the host gave what it runs: `onAiChooseCommands` or `onAiEditImage`, `onAiEditImage`,
|
|
1090
|
+
* `onAiRemoveBackground`, and `onAiChooseCommands` with Annotate on. The AI opens on it if it is closed, as `open` opens it; the
|
|
1091
|
+
* areas marked stay (unseen in Remove Background and Annotate's mode; shown while Remove Object is chosen, the ones a
|
|
1092
|
+
* Generate hid too) and so do each mode's words, and the photo's action chosen lasts while the editor is open. Resolves
|
|
1093
|
+
* to `null` once it shows. Rejects `NOT_AVAILABLE` for a choice the host's functions can't run.
|
|
1094
|
+
*/
|
|
1095
|
+
setAction: (input: {
|
|
1096
|
+
action: 'ANNOTATE' | 'GENERATE' | 'REMOVE_BACKGROUND' | 'REMOVE_OBJECT';
|
|
1097
|
+
}) => Promise<null>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Puts the reference image in the AI's Generate field, as Add Image does, or takes it away, as the X on its
|
|
1100
|
+
* thumbnail does: `referenceImage` is the image's URL (`http(s):`, `data:` or `blob:`, as `retouch.run` takes it), or
|
|
1101
|
+
* `null` for none. The AI opens on Generate if it is closed, as `open` opens it, and while the AI works it waits its turn
|
|
1102
|
+
* behind the work, as `setAction` does, and lands once it ends. The image fills the whole marked
|
|
1103
|
+
* area, and Generate sends it with the words, or alone. Resolves to `null` once the field shows it. Rejects
|
|
1104
|
+
* `NOT_AVAILABLE` outside Generate (another action chosen, or Annotate), and without `onAiEditImage`;
|
|
1105
|
+
* `INVALID_COMMAND` (`input.referenceImage`) for an image the editor can't read.
|
|
1106
|
+
*/
|
|
1107
|
+
setReferenceImage: (input: {
|
|
1108
|
+
referenceImage: string | null;
|
|
1109
|
+
}) => Promise<null>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Puts words in the AI's field, as a choice of its Examples does: `text` takes the place of what the field holds (`''`
|
|
1112
|
+
* empties it). It sends nothing and gives the field no focus, so a phone's keyboard stays down; the field's button
|
|
1113
|
+
* sends the words as the person's tap would. The AI of where the person is opens if it is closed, as `open` opens it
|
|
1114
|
+
* (on the photo's action out of Annotate, on Annotate's mode in it), and while the AI works it waits its turn behind the work, as
|
|
1115
|
+
* `setAction` does. Resolves to `null` once the field shows the words. Rejects `NOT_AVAILABLE` where there is no
|
|
1116
|
+
* field to fill: without `onAiChooseCommands`, `onAiEditImage` or `onAiRemoveBackground` (without `onAiChooseCommands` in Annotate), and
|
|
1117
|
+
* in Remove Object or a Remove Background with no field (its lone Remove); `INVALID_COMMAND` (`input.text`)
|
|
1118
|
+
* for words with a line break, as the field holds one line.
|
|
1119
|
+
*/
|
|
1120
|
+
setText: (input: {
|
|
1121
|
+
text: string;
|
|
1122
|
+
}) => Promise<null>;
|
|
1123
|
+
/**
|
|
1124
|
+
* Stops the request under way, or any other work of the AI's (`retouch.run`, `retouch.remove`, `retouch.more`,
|
|
1125
|
+
* `retouch.removeBackground`, `crop.expand`, `crop.more`, `obfuscate.detect`), as the AI's Stop: what a request did so
|
|
1126
|
+
* far stays (one undo step) and `send` resolves with its words so far; `retouch.run`, `retouch.remove`,
|
|
1127
|
+
* `retouch.more` and `retouch.removeBackground` resolve with `{ id: null }`, `crop.expand` and `crop.more` with
|
|
1128
|
+
* `{ id: null }` and the photo as it was (no undo step) and `obfuscate.detect` with
|
|
1129
|
+
* `{ boxes: [], indexes: [] }`. Resolves to `null` at once, even while the work holds the queue; with none under way it changes
|
|
1130
|
+
* nothing, and resolves once a gesture the person holds has ended.
|
|
1131
|
+
*/
|
|
1132
|
+
stop: () => Promise<null>;
|
|
751
1133
|
};
|
|
752
1134
|
/**
|
|
753
1135
|
* Auto, as its ring, its Auto Enhance button and its ruler. Each is one undo step, none when nothing changes;
|
|
@@ -770,10 +1152,48 @@ export declare type EmbedEditorHandle = {
|
|
|
770
1152
|
commands: () => EmbedEditorCommand[];
|
|
771
1153
|
/** Adjust's crop, as its pill, its sections and its ruler set it. Each is one undo step, none when nothing changes. */
|
|
772
1154
|
crop: {
|
|
1155
|
+
/**
|
|
1156
|
+
* The photo expanded to a ratio by its name, as Expand in the Aspect section: borders on two sides of the photo
|
|
1157
|
+
* as it shows, as wide as each other, which `onAiEditImage` fills with the scene continued (it gets the operation
|
|
1158
|
+
* `GENERATE_BORDERS`: the bigger photo with its borders transparent, 2048 px on its longer side at the most, its
|
|
1159
|
+
* mask, white on them, and the borders' widths). The
|
|
1160
|
+
* state moves with the photo, its edits keeping their look on it (`expandedFrom`), and the crop becomes the
|
|
1161
|
+
* ratio's largest window on its middle. The bigger photo shows with its borders and its edge glowing in the AI
|
|
1162
|
+
* brush's colors meanwhile, no AI field opens for it, the AI's card saying it expands with Stop (Escape and
|
|
1163
|
+
* Close stop it too), and the editor takes no input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill). A ratio the Aspect section still waits
|
|
1164
|
+
* on, chosen before the call, never lands. The host's image lands in the borders as one undo step, and the AI's
|
|
1165
|
+
* card offers Generate Again (`more`) while the Aspect section shows; Expand again swaps the borders. A photo whose
|
|
1166
|
+
* background is cut, with none generated under it, keeps its borders transparent, with no call. Resolves to the
|
|
1167
|
+
* edit's `id`, its borders generated or transparent; `{ id: null }` where the photo already has the ratio (its crop
|
|
1168
|
+
* taking it, any borders going) and after `ask.stop`, the photo as it was. The Full's and the Trial's: `NOT_AVAILABLE` without
|
|
1169
|
+
* `onAiEditImage`, while the host locks the ratio, when the editor leaves the page, is destroyed or opens another
|
|
1170
|
+
* image meanwhile, and in the Free and the Lite; `AI_FAILED` when `onAiEditImage` rejects (its error the
|
|
1171
|
+
* `cause`), answers anything but one image (a list of them too) or one that changed nothing in the borders, the
|
|
1172
|
+
* photo as it was.
|
|
1173
|
+
*/
|
|
1174
|
+
expand: (input: {
|
|
1175
|
+
ratio: '1:1' | '1:2' | '16:9' | '2:1' | '3:4' | '4:3' | '9:16';
|
|
1176
|
+
}) => Promise<{
|
|
1177
|
+
id: string | null;
|
|
1178
|
+
}>;
|
|
773
1179
|
/** The image mirrored across (`'X'`, the pill's Flip) or up and down (`'Y'`), the window staying on the photo. */
|
|
774
1180
|
flip: (input: {
|
|
775
1181
|
axis: 'X' | 'Y';
|
|
776
1182
|
}) => Promise<null>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Asks `onAiEditImage` again for the Expand `id` on the photo (`expand`'s), as Generate Again on the AI's card: the same
|
|
1185
|
+
* bigger photo with its borders transparent, mask, words and borders' widths, in place as `expand` is. The host's
|
|
1186
|
+
* image lands in them as an Expand of its own in the edit's place, as one undo step: an Undo brings the borders
|
|
1187
|
+
* before it back. Resolves to the new edit's `id`; `ask.stop` resolves it with `{ id: null }`, the photo as it
|
|
1188
|
+
* was. `NOT_FOUND` for an edit the photo on screen doesn't hold (an
|
|
1189
|
+
* Undo took it off, an Expand again swapped it), one that is no Expand and an Expand whose borders stay transparent;
|
|
1190
|
+
* `AI_FAILED` as `expand`. The Full's and the Trial's: `NOT_AVAILABLE` in the Free and the Lite.
|
|
1191
|
+
*/
|
|
1192
|
+
more: (input: {
|
|
1193
|
+
id: string;
|
|
1194
|
+
}) => Promise<{
|
|
1195
|
+
id: string | null;
|
|
1196
|
+
}>;
|
|
777
1197
|
/**
|
|
778
1198
|
* The image turned a quarter, `'LEFT'` (the pill's Rotate) or `'RIGHT'`: the whole photo turns with its window, any
|
|
779
1199
|
* other window stays where it is on the screen.
|
|
@@ -808,10 +1228,20 @@ export declare type EmbedEditorHandle = {
|
|
|
808
1228
|
setFocus: (input: {
|
|
809
1229
|
focus: 'CENTER' | 'SUBJECT';
|
|
810
1230
|
}) => Promise<null>;
|
|
1231
|
+
/**
|
|
1232
|
+
* What a ratio of the Aspect section does, as its Crop | Expand control: `'CROP'` crops to it, `'EXPAND'` expands the
|
|
1233
|
+
* photo to it as `expand` does once a ratio is tapped there (Free and Original crop either way), for as long as the
|
|
1234
|
+
* editor is open. It opens nothing; `setRatio` crops and `expand` expands whatever it is. No undo step. The Full's and
|
|
1235
|
+
* the Trial's: `NOT_AVAILABLE` without `onAiEditImage`, while the host locks the ratio, and in the Free and the Lite.
|
|
1236
|
+
*/
|
|
1237
|
+
setMode: (input: {
|
|
1238
|
+
mode: 'CROP' | 'EXPAND';
|
|
1239
|
+
}) => Promise<null>;
|
|
811
1240
|
/**
|
|
812
1241
|
* The ratio, by its name in the Aspect section, as a tap on it there: its largest window, where Focus places it.
|
|
813
1242
|
* `'ORIGINAL'` is the photo's own ratio as it is turned. `null` frees it, the window as it is, as Free there does.
|
|
814
|
-
* The ratio in effect changes nothing.
|
|
1243
|
+
* The ratio in effect changes nothing. A ratio the Aspect section still waits on never lands when it was chosen
|
|
1244
|
+
* before the call; one chosen after it lands after it. `NOT_AVAILABLE` while the host locks the ratio.
|
|
815
1245
|
*/
|
|
816
1246
|
setRatio: (input: {
|
|
817
1247
|
ratio: '1:1' | '1:2' | '16:9' | '2:1' | '3:4' | '4:3' | '9:16' | 'ORIGINAL' | null;
|
|
@@ -863,14 +1293,20 @@ export declare type EmbedEditorHandle = {
|
|
|
863
1293
|
};
|
|
864
1294
|
/** The history, as Undo, Redo and Reset on the toolbar. Each waits its turn; with nothing to take, it changes nothing. */
|
|
865
1295
|
history: {
|
|
866
|
-
/**
|
|
1296
|
+
/**
|
|
1297
|
+
* The step undone last, again. Resolves once its picture is on screen: the AI's images of a step Undo alone reached are
|
|
1298
|
+
* held compressed, and made again first.
|
|
1299
|
+
*/
|
|
867
1300
|
redo: () => Promise<null>;
|
|
868
1301
|
/**
|
|
869
1302
|
* Every edit taken away, as the toolbar's Reset (no confirm asked): a `state` the editor opened with too, the crop
|
|
870
1303
|
* ratio `aspectRatio` sets or `aspectRatioLocked` holds kept. One step undo takes back.
|
|
871
1304
|
*/
|
|
872
1305
|
reset: () => Promise<null>;
|
|
873
|
-
/**
|
|
1306
|
+
/**
|
|
1307
|
+
* The last step taken back: the image and the view as they were before it. Resolves once its picture is on screen: the
|
|
1308
|
+
* AI's images of an earlier step are held compressed, and made again first.
|
|
1309
|
+
*/
|
|
874
1310
|
undo: () => Promise<null>;
|
|
875
1311
|
};
|
|
876
1312
|
/**
|
|
@@ -887,14 +1323,17 @@ export declare type EmbedEditorHandle = {
|
|
|
887
1323
|
/**
|
|
888
1324
|
* The signature at one of its 9 points (`position`), or with its center at a spot of the final image (`x` and `y`,
|
|
889
1325
|
* 0…1): exactly one of them, as a drag on the stage drops it (a spot within 6% of the image's shorter side of a point
|
|
890
|
-
* sticks to it, and the signature stays whole on the image). One undo step.
|
|
1326
|
+
* sticks to it, and the signature stays whole on the image). One undo step. Resolves to where it stands once drawn
|
|
1327
|
+
* (`boxes`, MarkBox).
|
|
891
1328
|
*/
|
|
892
1329
|
place: (input: {
|
|
893
1330
|
position?: 'BOTTOM' | 'BOTTOM_LEFT' | 'BOTTOM_RIGHT' | 'CENTER' | 'LEFT' | 'RIGHT' | 'TOP' | 'TOP_LEFT' | 'TOP_RIGHT';
|
|
894
1331
|
role: 'SIGNATURE';
|
|
895
1332
|
x?: number;
|
|
896
1333
|
y?: number;
|
|
897
|
-
}) => Promise<
|
|
1334
|
+
}) => Promise<{
|
|
1335
|
+
boxes: MarkBox[];
|
|
1336
|
+
}>;
|
|
898
1337
|
/** A free mark hidden by `hide` back on the image and the file. One undo step (none when it shows already). */
|
|
899
1338
|
show: (input: {
|
|
900
1339
|
role: 'SIGNATURE' | 'WATERMARK';
|
|
@@ -905,6 +1344,7 @@ export declare type EmbedEditorHandle = {
|
|
|
905
1344
|
* `angle`; a signature's `size` (2…40) and `margin`; either's `opacity`, `color` (`'AUTO'` or a hex), `font` and `text`
|
|
906
1345
|
* (as its field's Done writes it, trimmed). `INVALID_COMMAND` for a field the other mark takes (`margin` on the
|
|
907
1346
|
* watermark, `angle`, `layout` or `spacing` on the signature), a size off its range, a spacing on a single watermark.
|
|
1347
|
+
* Resolves to where the mark stands once drawn (`boxes`, MarkBox).
|
|
908
1348
|
*/
|
|
909
1349
|
update: (input: {
|
|
910
1350
|
angle?: number;
|
|
@@ -917,24 +1357,52 @@ export declare type EmbedEditorHandle = {
|
|
|
917
1357
|
size?: number;
|
|
918
1358
|
spacing?: number;
|
|
919
1359
|
text?: string;
|
|
920
|
-
}) => Promise<
|
|
1360
|
+
}) => Promise<{
|
|
1361
|
+
boxes: MarkBox[];
|
|
1362
|
+
}>;
|
|
921
1363
|
};
|
|
922
|
-
/** The menu's carousel,
|
|
1364
|
+
/** The menu's carousel, Adjust's sections over it, and the AI's card (`closeCard`, `foldCard`, `unfoldCard`). */
|
|
923
1365
|
menu: {
|
|
924
|
-
/**
|
|
1366
|
+
/**
|
|
1367
|
+
* The AI's card closed for good, as the ✕ in its corner and on its pill: its last reply or failure goes, an Expand's
|
|
1368
|
+
* Generate Again stays away until the next Expand, and the editor's line where an image's mark is a dot until what it
|
|
1369
|
+
* tells of ends and starts again (a new dot marked with the image). The next work, reply or failure opens it unfolded.
|
|
1370
|
+
* It resolves once the card is gone; with no work under way, once a gesture the person holds has ended.
|
|
1371
|
+
* `NOT_AVAILABLE` where nothing is on the AI's card to close, while the AI works on it (Stop is on the card), and
|
|
1372
|
+
* without any of the host's AI functions. The Full's and the Trial's: `NOT_AVAILABLE` in the Free and the Lite.
|
|
1373
|
+
*/
|
|
1374
|
+
closeCard: () => Promise<null>;
|
|
1375
|
+
/**
|
|
1376
|
+
* Adjust's Scale or Aspect section closed, back to the carousel, as its Done; a ratio it still waits on lands first,
|
|
1377
|
+
* an Expand's only starting (its borders fill after the command resolves).
|
|
1378
|
+
*/
|
|
925
1379
|
closeSection: () => Promise<null>;
|
|
1380
|
+
/**
|
|
1381
|
+
* The AI's card folded, as the person folds it: the card the AI shows while it works, with its last reply or failure,
|
|
1382
|
+
* with an Expand's Generate Again over the Aspect section, or with the editor's line where an image's mark is a dot,
|
|
1383
|
+
* folded as by the ⌃ in its corner to a 28 px pill with the request's words (else the work's phrase, the reply,
|
|
1384
|
+
* "Expanded to {ratio}" or the line; a failure's red dot and its title; while the AI works, its words shimmer); only the
|
|
1385
|
+
* person or this command folds it, never a touch outside, and every new work, reply or failure opens unfolded. A card
|
|
1386
|
+
* already folded stays as it is. It resolves at once while the AI works, even while a request holds the queue; with
|
|
1387
|
+
* none under way, once a gesture the person holds has ended. `NOT_AVAILABLE` where the card is not there (nothing on
|
|
1388
|
+
* the AI's card to fold), and without any of the host's AI functions. The Full's and the Trial's: `NOT_AVAILABLE` in
|
|
1389
|
+
* the Free and the Lite.
|
|
1390
|
+
*/
|
|
1391
|
+
foldCard: () => Promise<null>;
|
|
926
1392
|
/**
|
|
927
1393
|
* Adjust's Scale (its zoom slider) or Aspect (its ratios) section opened over the carousel, as the crop pill's buttons,
|
|
928
|
-
* the menu going to Adjust first.
|
|
929
|
-
* locks the ratio, and for both while
|
|
1394
|
+
* the menu going to Adjust first. With the AI open over the carousel, it closes the AI first (`ask.close`). The
|
|
1395
|
+
* section open stays as it is. `NOT_AVAILABLE` for `'ASPECT'` while the host locks the ratio, and for both while
|
|
1396
|
+
* Annotate is open.
|
|
930
1397
|
*/
|
|
931
1398
|
openSection: (input: {
|
|
932
1399
|
section: 'ASPECT' | 'SCALE';
|
|
933
1400
|
}) => Promise<null>;
|
|
934
1401
|
/**
|
|
935
1402
|
* The item the menu shows, as a tap on it in the carousel (no name over the photo): its tool opens on the stage. The
|
|
936
|
-
* item already shown stays as it is.
|
|
937
|
-
* and while Annotate is open (no
|
|
1403
|
+
* item already shown stays as it is. With the AI open over the carousel, it closes the AI first (`ask.close`).
|
|
1404
|
+
* `NOT_AVAILABLE` for an item the props turned off or the edition doesn't have, and while Annotate is open (no
|
|
1405
|
+
* carousel on screen then: `annotate.close` first).
|
|
938
1406
|
*/
|
|
939
1407
|
select: (input: {
|
|
940
1408
|
item: EmbedEditorMenuItem;
|
|
@@ -942,12 +1410,23 @@ export declare type EmbedEditorHandle = {
|
|
|
942
1410
|
/**
|
|
943
1411
|
* An item with a ring turned off and back, as a tap on its ring: a value to zero (the straightening for `'ADJUST'`)
|
|
944
1412
|
* and back to what it was, a filter, a frame or Auto off and back (Auto with nothing to come back to turns on at the
|
|
945
|
-
* image's own amount, once it is read). One undo step.
|
|
946
|
-
*
|
|
1413
|
+
* image's own amount, once it is read). One undo step. With the AI open over the carousel, it closes the AI once the
|
|
1414
|
+
* ring's tap lands (`ask.close`); with Annotate open, whose own carousel shows, the AI's Annotate mode stays open. `NOT_AVAILABLE` as
|
|
1415
|
+
* for `select`, and for `'AUTO'` when the image can't be read or its reading takes too long (nothing changes then,
|
|
1416
|
+
* the AI included).
|
|
947
1417
|
*/
|
|
948
1418
|
toggle: (input: {
|
|
949
1419
|
item: 'ADJUST' | 'AUTO' | 'BLACK_POINT' | 'BRIGHTNESS' | 'BRILLIANCE' | 'CONTRAST' | 'EXPOSURE' | 'FILTER' | 'FRAME' | 'HIGHLIGHTS' | 'SATURATION' | 'SHADOWS' | 'SHARPNESS' | 'VIBRANCE' | 'VIGNETTE' | 'WARMTH';
|
|
950
1420
|
}) => Promise<null>;
|
|
1421
|
+
/**
|
|
1422
|
+
* The AI's card opened from its pill, as a tap on the pill: the card the AI shows while it works, with its last reply
|
|
1423
|
+
* or failure, an Expand's Generate Again or the editor's line. A card already open stays as it is. It resolves at once
|
|
1424
|
+
* while the AI works, even while a request holds the queue; with none under way, once a gesture the person holds has
|
|
1425
|
+
* ended. `NOT_AVAILABLE` where the card is not there (nothing on the AI's card), and without any of the host's AI
|
|
1426
|
+
* functions.
|
|
1427
|
+
* The Full's and the Trial's: `NOT_AVAILABLE` in the Free and the Lite.
|
|
1428
|
+
*/
|
|
1429
|
+
unfoldCard: () => Promise<null>;
|
|
951
1430
|
};
|
|
952
1431
|
/**
|
|
953
1432
|
* Obfuscate's areas (the Full's), each by its index in the state's `obfuscation` (an area has no id), in its units:
|
|
@@ -958,8 +1437,10 @@ export declare type EmbedEditorHandle = {
|
|
|
958
1437
|
/**
|
|
959
1438
|
* A new area, as a drawing on the stage makes one: the look it gives, the rest as the next area's (what Obfuscate's
|
|
960
1439
|
* controls show with no area selected), born level on the screen unless `angle` turns it; selected once added while
|
|
961
|
-
* Obfuscate is open. One undo step. Resolves to its index
|
|
962
|
-
*
|
|
1440
|
+
* Obfuscate is open and no AI request or linked agent's call works. One undo step. Resolves to its index, and where
|
|
1441
|
+
* it stands once drawn (`boxes`, ObfuscationBox).
|
|
1442
|
+
* `NOT_AVAILABLE` with 64 areas already; `INVALID_COMMAND` for one a drawing never makes, a side under 1 px or nothing
|
|
1443
|
+
* of it on the crop (its rect's paths in `props`).
|
|
963
1444
|
*/
|
|
964
1445
|
add: (input: {
|
|
965
1446
|
angle?: number;
|
|
@@ -972,16 +1453,39 @@ export declare type EmbedEditorHandle = {
|
|
|
972
1453
|
x: number;
|
|
973
1454
|
y: number;
|
|
974
1455
|
}) => Promise<{
|
|
1456
|
+
boxes: ObfuscationBox[];
|
|
975
1457
|
index: number;
|
|
976
1458
|
}>;
|
|
977
|
-
/**
|
|
1459
|
+
/**
|
|
1460
|
+
* The faces, license plates, documents and screens of the photo covered with areas, as Detect in Obfuscate's pill (the
|
|
1461
|
+
* Full's and the Trial's AI): your `onAiDetectObjects` is asked for the four in one call, on the original photo with the
|
|
1462
|
+
* AI's edits alone, and each thing it finds becomes an area in the next area's look, level in the photo's frame
|
|
1463
|
+
* (`angle` 0), over its box grown 10 % of its width and of its height on each side. A find under 0.5 of `confidence`
|
|
1464
|
+
* is left out (one with none is kept), and one at least 80 % inside an area already on the photo, or one this Detect
|
|
1465
|
+
* just made, makes none, so a second Detect adds nothing; up to 64 areas in all. It selects nothing, and all its areas
|
|
1466
|
+
* are one undo step. While it searches the editor takes no input but Escape and Close, which stop it as `ask.stop`
|
|
1467
|
+
* does. Resolves to the new areas' indexes, in the order found, and where each stands once drawn (`boxes`,
|
|
1468
|
+
* ObfuscationBox): none where everything found was covered already, and on `ask.stop`. `NOT_AVAILABLE` without `onAiDetectObjects`, with 64 areas already, and when the editor leaves the page,
|
|
1469
|
+
* is destroyed or opens another image meanwhile; `NOT_FOUND` where your function found nothing, or nothing at 0.5 and
|
|
1470
|
+
* up; `AI_FAILED` when it rejects (its error the `cause`) or answers no list, and when the editor fails on the way (that
|
|
1471
|
+
* error the `cause`); `EXPORT_FAILED` when the photo can't be made.
|
|
1472
|
+
*/
|
|
1473
|
+
detect: () => Promise<{
|
|
1474
|
+
boxes: ObfuscationBox[];
|
|
1475
|
+
indexes: number[];
|
|
1476
|
+
}>;
|
|
1477
|
+
/**
|
|
1478
|
+
* The area at `index` removed, as Delete removes the selected one: the areas after it move up, nothing stays selected
|
|
1479
|
+
* (but in an AI request or a linked agent's call, which keeps the person's selected area unless it removed that one).
|
|
1480
|
+
* One undo step. `NOT_FOUND` for no area there.
|
|
1481
|
+
*/
|
|
978
1482
|
remove: (input: {
|
|
979
1483
|
index: number;
|
|
980
1484
|
}) => Promise<null>;
|
|
981
1485
|
/**
|
|
982
|
-
* The area at `index` selected, as a tap on it, Obfuscate opened if it isn't; `null` lets the selection go
|
|
983
|
-
* step. `NOT_FOUND` for no area there; `NOT_AVAILABLE` while Annotate is open
|
|
984
|
-
* then: `annotate.close` first).
|
|
1486
|
+
* The area at `index` selected, as a tap on it, Obfuscate opened if it isn't; `null` lets the selection go, Annotate
|
|
1487
|
+
* open or not. No undo step. `NOT_FOUND` for no area there; `NOT_AVAILABLE` for an `index` while Annotate is open
|
|
1488
|
+
* (Obfuscate's stage is not on screen then: `annotate.close` first).
|
|
985
1489
|
*/
|
|
986
1490
|
select: (input: {
|
|
987
1491
|
index: number | null;
|
|
@@ -1001,8 +1505,9 @@ export declare type EmbedEditorHandle = {
|
|
|
1001
1505
|
/**
|
|
1002
1506
|
* The area at `index` with what `input` gives of its rect, its turn and its look, the rest as it was. It lands where
|
|
1003
1507
|
* its drags would hold it: turned, resized and moved only as far as a handle's worth of it stays on the crop (one the
|
|
1004
|
-
* crop left out goes no further off). Selected once changed while Obfuscate is open
|
|
1005
|
-
* changes).
|
|
1508
|
+
* crop left out goes no further off). Selected once changed while Obfuscate is open and no AI request or linked
|
|
1509
|
+
* agent's call works. One undo step (none when nothing changes). Resolves to where it stands once drawn (`boxes`,
|
|
1510
|
+
* ObfuscationBox). `NOT_FOUND` for no area there.
|
|
1006
1511
|
*/
|
|
1007
1512
|
update: (input: {
|
|
1008
1513
|
angle?: number;
|
|
@@ -1015,7 +1520,9 @@ export declare type EmbedEditorHandle = {
|
|
|
1015
1520
|
width?: number;
|
|
1016
1521
|
x?: number;
|
|
1017
1522
|
y?: number;
|
|
1018
|
-
}) => Promise<
|
|
1523
|
+
}) => Promise<{
|
|
1524
|
+
boxes: ObfuscationBox[];
|
|
1525
|
+
}>;
|
|
1019
1526
|
};
|
|
1020
1527
|
/**
|
|
1021
1528
|
* Calls `handler` with what each `name` event says (`EmbedEditorEvents`), until the function it returns is called. A
|
|
@@ -1039,6 +1546,7 @@ export declare type EmbedEditorHandle = {
|
|
|
1039
1546
|
*/
|
|
1040
1547
|
save: () => Promise<{
|
|
1041
1548
|
dest: File;
|
|
1549
|
+
src: File | null;
|
|
1042
1550
|
state: EditState;
|
|
1043
1551
|
}>;
|
|
1044
1552
|
};
|
|
@@ -1060,14 +1568,29 @@ export declare type EmbedEditorHandle = {
|
|
|
1060
1568
|
read: {
|
|
1061
1569
|
/** The menu item shown. */
|
|
1062
1570
|
item: () => EmbedEditorMenuItem | null;
|
|
1571
|
+
/**
|
|
1572
|
+
* The areas the person marked on the photo with the AI's brush or `retouch.mark`: each area's box, in the photo's px,
|
|
1573
|
+
* in their order, one for each area (the `index` `retouch.mark` resolves to, `retouch.moveMark` and
|
|
1574
|
+
* `retouch.removeMark` take). A box is the whole area's: one a move left partly off the photo runs past its edges
|
|
1575
|
+
* (`x` or `y` negative, or past its size), though only what lies on it is filled. `retouch.run` and `retouch.remove`
|
|
1576
|
+
* of `{ kind: 'MARK' }` work on them all together, and `ask.send` tells the model how many areas it is about and
|
|
1577
|
+
* each box. Areas a Generate hid are listed too. Inside an `ask.send` about an area other than `'MARK'`, the model's
|
|
1578
|
+
* read of it gives that area's box until the request's fill of it lands, and `[]` from then to the request's end.
|
|
1579
|
+
* `[]` with nothing marked (none yet, the Eraser over all of it, a mark of the photo before an Expand) and without
|
|
1580
|
+
* `onAiEditImage` and `onAiChooseCommands` (no brush); `null` in the Free and the Lite.
|
|
1581
|
+
*/
|
|
1582
|
+
mark: () => Rect[] | null;
|
|
1063
1583
|
/**
|
|
1064
1584
|
* What Annotate offers `target`, an annotation (`id`), the Numbers' list (`id: 'LIST'`), the added arrow `arrow` of a text
|
|
1065
1585
|
* or of the list, or a tool's next one (`tool`): the commands its action bar offers it (and `annotate.list` or
|
|
1066
1586
|
* `annotate.unlist` for a Number, `annotate.unlist` for the list), and its style row's and
|
|
1067
1587
|
* color row's options by `annotate.update`'s names (`annotate.setStyle`'s for a tool), each with its value now and
|
|
1068
|
-
* the values it takes, or the `range` a slider takes it in
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1588
|
+
* the values it takes, or the `range` a slider takes it in; and `palettes`, every set of colors the color row's
|
|
1589
|
+
* palette menu offers, each `id` with its `colors` (`#rrggbb`), any of which `color` takes: `'VIBRANT'`, `'PASTEL'`
|
|
1590
|
+
* and `'EARTH'`, the editor's own, and `'PHOTO'`, `'PHOTO_PASTEL'` and `'PHOTO_VIVID'`, the photo's own colors and
|
|
1591
|
+
* its hues softer and brighter, none until read off the photo (a moment after it is on screen). `null` until
|
|
1592
|
+
* Annotate's screens are loaded (a moment after the image is on screen, or `annotate.open`), for an `id` the state
|
|
1593
|
+
* lacks, and where Annotate is off or absent (the Free, the Lite).
|
|
1071
1594
|
*/
|
|
1072
1595
|
options: (input: {
|
|
1073
1596
|
target: {
|
|
@@ -1078,6 +1601,10 @@ export declare type EmbedEditorHandle = {
|
|
|
1078
1601
|
};
|
|
1079
1602
|
}) => {
|
|
1080
1603
|
commands: string[];
|
|
1604
|
+
palettes: {
|
|
1605
|
+
colors: string[];
|
|
1606
|
+
id: 'EARTH' | 'PASTEL' | 'PHOTO' | 'PHOTO_PASTEL' | 'PHOTO_VIVID' | 'VIBRANT';
|
|
1607
|
+
}[];
|
|
1081
1608
|
style: Record<string, {
|
|
1082
1609
|
range: {
|
|
1083
1610
|
max: number;
|
|
@@ -1105,9 +1632,10 @@ export declare type EmbedEditorHandle = {
|
|
|
1105
1632
|
/** The menu's section showing: the carousel (`'MAIN'`), or Adjust's Scale or Aspect. */
|
|
1106
1633
|
section: () => 'ASPECT' | 'MAIN' | 'SCALE' | null;
|
|
1107
1634
|
/**
|
|
1108
|
-
* What is selected now, as the `select` event tells it:
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1635
|
+
* What is selected now, as the `select` event tells it: the AI's area its bar is on (`{ index, kind: 'MARK' }`) while
|
|
1636
|
+
* the AI shows its areas with the Brush, else Annotate's piece, a text's added arrow or the Numbers' list while
|
|
1637
|
+
* Annotate is open, Obfuscate's area by its index otherwise, `null` for nothing. A piece a tap just made is selected:
|
|
1638
|
+
* its `id` is here for the commands that take one.
|
|
1111
1639
|
*/
|
|
1112
1640
|
selection: () => EmbedEditorSelection;
|
|
1113
1641
|
/** The size the editor works the image at, in px: the px of the state's coordinates (`onLoad`'s `size`). */
|
|
@@ -1124,6 +1652,196 @@ export declare type EmbedEditorHandle = {
|
|
|
1124
1652
|
* commands, but `ready` stays rejected.
|
|
1125
1653
|
*/
|
|
1126
1654
|
ready: Promise<void>;
|
|
1655
|
+
/**
|
|
1656
|
+
* The AI's fill of an area of the photo and its cut of the background (the Full's and the Trial's, with the host's
|
|
1657
|
+
* `onAiEditImage` and `onAiRemoveBackground`; in the Lite and the Free each command rejects `NOT_AVAILABLE`), as its
|
|
1658
|
+
* brush, its field's Remove and Generate and Remove Background: the pixels they make are part of the photo, never of the
|
|
1659
|
+
* state a host keeps (`src` on Save holds them). Every image a Generate, a Remove or Remove Background lands is one undo
|
|
1660
|
+
* step, kept while the history holds it.
|
|
1661
|
+
*/
|
|
1662
|
+
retouch: {
|
|
1663
|
+
/**
|
|
1664
|
+
* Takes a `'POLYGON'` or a `'RECT'` off the AI's mark, as the Eraser does: cut from every area it touches, an area it
|
|
1665
|
+
* leaves with nothing marked gone, the areas after it a place up. The photo's AI opens, where the brush shows
|
|
1666
|
+
* (a ratio the Aspect section still waits on landing first, a step of its own), and the areas show. No undo step.
|
|
1667
|
+
* `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands` and while Annotate is open (the photo's AI is not on screen then,
|
|
1668
|
+
* its ✦ there opening the AI on Annotate's mode: `annotate.close` first);
|
|
1669
|
+
* `INVALID_COMMAND` for the other kinds, off its schema (`input.area.kind`), and for an outline that fills less than
|
|
1670
|
+
* half of every photo px, as a canvas fills it (off the photo, or too thin; `input.area`), or with nothing on the
|
|
1671
|
+
* photo's window, the crop as it shows (`input.area`: as an Eraser stroke there erases nothing; one partly on it cuts
|
|
1672
|
+
* all it touches), the mark as it was.
|
|
1673
|
+
*/
|
|
1674
|
+
erase: (input: {
|
|
1675
|
+
area: Extract<AiArea, {
|
|
1676
|
+
kind: 'POLYGON' | 'RECT';
|
|
1677
|
+
}>;
|
|
1678
|
+
}) => Promise<null>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Adds a `'POLYGON'` or a `'RECT'` to the AI's mark, as a Brush outline closed on its start does, the photo's AI open
|
|
1681
|
+
* where the brush shows (a ratio the Aspect section still waits on landing first): an area of its own, or, where it
|
|
1682
|
+
* touches areas (or lies within 5 px of them on the screen, the view at rest in the tool open), joined to them into the first of them, selected,
|
|
1683
|
+
* the areas shown. Resolves to its `index` in `read.mark`'s list. No undo step. `NOT_AVAILABLE` without
|
|
1684
|
+
* `onAiEditImage` or `onAiChooseCommands`, while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode:
|
|
1685
|
+
* `annotate.close` first), and while the editor has no size on the page (inside an element with `display: none`,
|
|
1686
|
+
* or before its first layout); `INVALID_COMMAND` for the other kinds, off its schema (`input.area.kind`), and for an
|
|
1687
|
+
* outline that fills less than half of every photo px, as a canvas fills it (off the photo, or too thin;
|
|
1688
|
+
* `input.area`), or with nothing on the photo's window, the crop as it shows (`input.area`: as a Brush stroke there
|
|
1689
|
+
* marks nothing; one partly on it is taken whole), the editor as it was.
|
|
1690
|
+
*/
|
|
1691
|
+
mark: (input: {
|
|
1692
|
+
area: Extract<AiArea, {
|
|
1693
|
+
kind: 'POLYGON' | 'RECT';
|
|
1694
|
+
}>;
|
|
1695
|
+
}) => Promise<{
|
|
1696
|
+
index: number;
|
|
1697
|
+
}>;
|
|
1698
|
+
/**
|
|
1699
|
+
* Asks `onAiEditImage` again for the Generate `id` on the photo (`run`'s), as Generate over its area: the same piece,
|
|
1700
|
+
* mask and image, with the words `prompt` or its own. The host's image lands on the photo in the edit's place, as one
|
|
1701
|
+
* undo step (an Undo brings the edit before it back). Resolves to the new edit's `id`; `ask.stop` resolves it with
|
|
1702
|
+
* `{ id: null }`.
|
|
1703
|
+
* `NOT_AVAILABLE` while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode:
|
|
1704
|
+
* `annotate.close` first); `NOT_FOUND` for an edit the photo on screen doesn't hold (one the memory limit drew into
|
|
1705
|
+
* the photo among them), an Expand's (`crop.more`'s), a Remove's and one an Expand again cut; `INVALID_COMMAND` where it would ask with neither words nor an image (`input.prompt`); `AI_FAILED` as
|
|
1706
|
+
* `run`.
|
|
1707
|
+
*/
|
|
1708
|
+
more: (input: {
|
|
1709
|
+
id: string;
|
|
1710
|
+
prompt?: string;
|
|
1711
|
+
}) => Promise<{
|
|
1712
|
+
id: string | null;
|
|
1713
|
+
}>;
|
|
1714
|
+
/**
|
|
1715
|
+
* Moves the area `index` of the AI's mark whole, as its Move: its box's top-left corner (`read.mark`'s, the whole
|
|
1716
|
+
* area's, past the photo's edges too) to `x`, `y` in the photo's px, as far as a handle's worth of it (17.5 px on the
|
|
1717
|
+
* screen) stays on the photo's window, as an Annotate piece's drag stops; what of it lies off the photo is never
|
|
1718
|
+
* filled. The photo's AI opens, where the brush shows (a ratio the Aspect section still waits on landing first,
|
|
1719
|
+
* the area landing on the view it leaves), and the areas show. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or
|
|
1720
|
+
* `onAiChooseCommands`, while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode: `annotate.close`
|
|
1721
|
+
* first), and while the editor has no size on the page (inside an
|
|
1722
|
+
* element with `display: none`, or before its first layout); `NOT_FOUND` for an index with no area, and for one with nothing
|
|
1723
|
+
* on the photo's window, the crop as it shows (`read.mark` still lists it).
|
|
1724
|
+
*/
|
|
1725
|
+
moveMark: (input: {
|
|
1726
|
+
index: number;
|
|
1727
|
+
x: number;
|
|
1728
|
+
y: number;
|
|
1729
|
+
}) => Promise<null>;
|
|
1730
|
+
/**
|
|
1731
|
+
* Removes what `area` holds through `onAiEditImage`, as Remove: the host gets the piece of the photo round the area,
|
|
1732
|
+
* its mask, no words (`prompt` `''`) and no image (`null`), and fills the area with what surrounds it. The image it
|
|
1733
|
+
* gives lands in the area alone as one undo step. `area` is `'MARK'` (the
|
|
1734
|
+
* person's areas together, which a Remove that worked takes with it; in an `ask.send` that named another area, that
|
|
1735
|
+
* area, filled once in the request), a `'POLYGON'` or a `'RECT'` (written into no area of the person's, which stay
|
|
1736
|
+
* as they were whether the work lands, fails or is stopped). The AI's card says it removes, and the editor takes no
|
|
1737
|
+
* input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill) meanwhile. Resolves to the edit's `id`; `ask.stop` resolves it with `{ id: null }`.
|
|
1738
|
+
* `NOT_AVAILABLE` without `onAiEditImage`, while Annotate is open (the photo's AI is not on screen then, its ✦ there
|
|
1739
|
+
* opening the AI on Annotate's mode: `annotate.close` first), and when the editor leaves the
|
|
1740
|
+
* page, is destroyed or opens another image meanwhile; `INVALID_COMMAND` for `'ALL'` and `'BACKGROUND'`, off its schema
|
|
1741
|
+
* (`input.area.kind`), and for a `'MARK'` with nothing of the photo in it (nothing marked, or a request's area
|
|
1742
|
+
* already filled) or that a request about the whole photo or the background makes that area (`input.area`), the
|
|
1743
|
+
* editor as it was; `AI_FAILED` when `onAiEditImage` rejects (its error the `cause`), answers anything but one image
|
|
1744
|
+
* (a list of them too) or one that changed nothing in the area (always, for an area too thin to mark a px of the
|
|
1745
|
+
* photo), and when the editor fails on the way (that error the `cause`).
|
|
1746
|
+
*/
|
|
1747
|
+
remove: (input: {
|
|
1748
|
+
area: Extract<AiArea, {
|
|
1749
|
+
kind: 'MARK' | 'POLYGON' | 'RECT';
|
|
1750
|
+
}>;
|
|
1751
|
+
}) => Promise<{
|
|
1752
|
+
id: string | null;
|
|
1753
|
+
}>;
|
|
1754
|
+
/**
|
|
1755
|
+
* Takes the photo's background off through `onAiRemoveBackground`, as Remove Background: the host gets a JPEG of the
|
|
1756
|
+
* photo with the AI's edits alone, 2048 px on its longer side at the most, and `prompt`, what to keep, in words (`''`
|
|
1757
|
+
* with none; one only with `enableAiRemoveBackgroundPrompt`), and the editor keeps only the alpha it answers,
|
|
1758
|
+
* stretched over the photo, as one undo step; the AI's card says it removes the
|
|
1759
|
+
* background meanwhile, and the editor
|
|
1760
|
+
* takes no input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill). The photo shows over a checkerboard where it is transparent, and Save
|
|
1761
|
+
* keeps the transparency in a PNG or a WebP. Resolves to the cut's `id`, as `remove` does; `ask.stop` resolves it
|
|
1762
|
+
* with `{ id: null }`, the photo as it was. `NOT_AVAILABLE`
|
|
1763
|
+
* without `onAiRemoveBackground`, for a `prompt` without `enableAiRemoveBackgroundPrompt`, once the background is cut,
|
|
1764
|
+
* while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first), and
|
|
1765
|
+
* when the editor leaves the page, is destroyed or
|
|
1766
|
+
* opens another image meanwhile; `NOT_FOUND` where the answer separates nothing (under 0.5 % of its px under alpha
|
|
1767
|
+
* 128, or under 0.5 % at 128 or more); `AI_FAILED` when `onAiRemoveBackground` rejects (its error the `cause`) or
|
|
1768
|
+
* answers no image, and when the editor fails on the way (that error the `cause`); `EXPORT_FAILED` when the photo
|
|
1769
|
+
* can't be made.
|
|
1770
|
+
*/
|
|
1771
|
+
removeBackground: (input?: {
|
|
1772
|
+
prompt?: string;
|
|
1773
|
+
}) => Promise<{
|
|
1774
|
+
id: string | null;
|
|
1775
|
+
}>;
|
|
1776
|
+
/**
|
|
1777
|
+
* Deletes the area `index` of the AI's mark, as its Delete, the areas after it a place up. The photo's AI opens,
|
|
1778
|
+
* where the brush shows (a ratio the Aspect section still waits on landing first), and the areas show. No undo
|
|
1779
|
+
* step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands` and while Annotate is open (the photo's AI is not on screen
|
|
1780
|
+
* then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first); `NOT_FOUND` for an index with no area, and for one with
|
|
1781
|
+
* nothing on the photo's window, the crop as it
|
|
1782
|
+
* shows (`read.mark` still lists it).
|
|
1783
|
+
*/
|
|
1784
|
+
removeMark: (input: {
|
|
1785
|
+
index: number;
|
|
1786
|
+
}) => Promise<null>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Fills `area` through `onAiEditImage` with what `prompt` (words) or `referenceImage` (an image's URL) ask for, as
|
|
1789
|
+
* Generate (a Remove, neither, is `remove`'s): the area shows while its work runs, the AI's card says it generates, and
|
|
1790
|
+
* the editor takes no input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill) meanwhile. The host gets the piece of the photo round the area (the
|
|
1791
|
+
* photo with the AI's edits alone), its mask, `prompt` and `referenceImage` (an image's URL, or `null`). The image it
|
|
1792
|
+
* gives lands in the area alone as one undo step, and `more` asks for another in its place. `'ALL'` edits the whole
|
|
1793
|
+
* photo by the words and the image (`onAiEditImage`'s `'EDIT_PHOTO'`): the host gets the whole photo with no mask,
|
|
1794
|
+
* and its image lands over the whole photo, what the words don't name kept as the model kept it. `'MARK'` fills the person's
|
|
1795
|
+
* areas together, which stay, hidden
|
|
1796
|
+
* (shown while Remove Object is chosen) until the person or a command of the mark's shows them (in an `ask.send` that
|
|
1797
|
+
* named another area, `'MARK'` is that area, filled once in the request, and so is `'ALL'` or `'BACKGROUND'` in one
|
|
1798
|
+
* about it); a `'POLYGON'`, a `'RECT'`, `'ALL'` or
|
|
1799
|
+
* `'BACKGROUND'` is written into no area of the person's, so their areas stay as they were whether the work lands,
|
|
1800
|
+
* fails or is stopped. Outside the area the photo stays as it is. Resolves to the edit's `id` (`'r1'`, `'r2'`…);
|
|
1801
|
+
* `ask.stop` resolves it with `{ id: null }`. `NOT_AVAILABLE` without `onAiEditImage`, for `'BACKGROUND'` with no background removed, while Annotate is open (the photo's AI is not on screen
|
|
1802
|
+
* then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first), and when the editor leaves
|
|
1803
|
+
* the page, is destroyed or opens another image meanwhile; `INVALID_COMMAND` for neither `prompt` nor `referenceImage`
|
|
1804
|
+
* (`input.prompt`), an area with nothing of the photo in it (`input.area`: a `'MARK'` with nothing marked, or a request's area already
|
|
1805
|
+
* filled) and a `referenceImage` that is no image, the editor as it was; `AI_FAILED` when `onAiEditImage` rejects (its
|
|
1806
|
+
* error the `cause`), answers anything but one image (a list of them too) or one that changed nothing in the area
|
|
1807
|
+
* (its px there less than 1 in 255 further from the piece's it was sent, on average, than the rest of the piece's;
|
|
1808
|
+
* always, for an area too thin to mark a px of the photo), and when the editor fails on the way (that error the
|
|
1809
|
+
* `cause`).
|
|
1810
|
+
*/
|
|
1811
|
+
run: (input: {
|
|
1812
|
+
area: AiArea;
|
|
1813
|
+
prompt?: string;
|
|
1814
|
+
referenceImage?: string | null;
|
|
1815
|
+
}) => Promise<{
|
|
1816
|
+
id: string | null;
|
|
1817
|
+
}>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Selects the area `index` of the AI's mark, as a still press inside it does with the Brush: its bar (Move and Delete)
|
|
1820
|
+
* shows, its Move, Delete and the arrow keys act on it, and `read.selection` tells it (`{ index, kind: 'MARK' }`). The
|
|
1821
|
+
* photo's AI opens, where the brush shows (a ratio the Aspect section still waits on landing first), and the
|
|
1822
|
+
* areas show; with the Eraser chosen the area stays selected, its bar shown once the Brush is. `null` lets it go and
|
|
1823
|
+
* opens nothing. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands` and, for an index, while Annotate is
|
|
1824
|
+
* open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first); `NOT_FOUND` for an
|
|
1825
|
+
* index with no area, and for one with nothing on the photo's window, the crop as it shows (`read.mark` still lists
|
|
1826
|
+
* it), which a press there never selects.
|
|
1827
|
+
*/
|
|
1828
|
+
selectMark: (input: {
|
|
1829
|
+
index: number | null;
|
|
1830
|
+
}) => Promise<null>;
|
|
1831
|
+
/**
|
|
1832
|
+
* The brush's mode and size, as its Brush | Eraser capsule and its size's ruler: `mode` `'BRUSH'` or `'ERASER'`, and
|
|
1833
|
+
* `size` the diameter both paint at, 5…50 whole CSS px on the screen; what it gives of them, the rest kept, for as
|
|
1834
|
+
* long as the editor is open. It opens nothing; `mark` and `erase` take outlines whatever the brush. An empty input
|
|
1835
|
+
* changes nothing. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands`; `INVALID_COMMAND` for a size
|
|
1836
|
+
* off 5…50 or not whole (`input.size`).
|
|
1837
|
+
*/
|
|
1838
|
+
setBrush: (input: {
|
|
1839
|
+
mode?: 'BRUSH' | 'ERASER';
|
|
1840
|
+
size?: number;
|
|
1841
|
+
}) => Promise<null>;
|
|
1842
|
+
/** Clears the AI's mark, every area of it, as the Eraser over all of it. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands`. */
|
|
1843
|
+
unmark: () => Promise<null>;
|
|
1844
|
+
};
|
|
1127
1845
|
/**
|
|
1128
1846
|
* Any command by its name, `group.verb` as `commands()` lists it, with its input: `run({ command: 'menu.select', input:
|
|
1129
1847
|
* { item: 'FILTER' } })` is `menu.select({ item: 'FILTER' })`. A read (`read.state`) runs in the queue here, after the
|
|
@@ -1201,6 +1919,26 @@ export declare type EmbedEditorMenuItem = 'ADJUST' | 'AUTO' | 'BLACK_POINT' | 'B
|
|
|
1201
1919
|
* `EmbedEditor`, `data-*` and `aria-*` attributes go to its host element.
|
|
1202
1920
|
*/
|
|
1203
1921
|
export declare type EmbedEditorProps = {
|
|
1922
|
+
/**
|
|
1923
|
+
* PROTOTYPE (the agent link isn't in a released edition yet): the origin of the agent link's relay, where
|
|
1924
|
+
* `enableAgent` makes its links. The hosted relay by default, which needs the license's `publicKey`; give the origin of
|
|
1925
|
+
* a relay of your own to run one (`@embededitor/relay`, docs.embededitor.com/agent-link/relay). The panel's How to
|
|
1926
|
+
* Connect shows the person `<agentRelay>/mcp`, the address to add to their agent once. Without `onAgentLink`, the
|
|
1927
|
+
* editor asks the relay for the link itself (`POST /sessions`), so on a relay of your own the page's origin must be one
|
|
1928
|
+
* its `allowedOrigins` names.
|
|
1929
|
+
* Default `'https://agent.embededitor.com'`.
|
|
1930
|
+
*/
|
|
1931
|
+
agentRelay?: string;
|
|
1932
|
+
/**
|
|
1933
|
+
* The prompts the editor sends a model, any of them replaced by the host's own text, by key (`AiPromptKey`): in the
|
|
1934
|
+
* Full and the Trial, the guide `onAiChooseCommands` gets as its system message, the lines a request adds to the
|
|
1935
|
+
* person's words, Expand's words to `onAiEditImage` and Detect's `texts` to `onAiDetectObjects`; in every edition with the
|
|
1936
|
+
* agent link (the Lite, the Full, the Trial), the guide an agent linked from outside is told, the same text. A key left
|
|
1937
|
+
* out keeps the editor's own; a prompt with `{ name }` placeholders keeps exactly the editor's own placeholders. The
|
|
1938
|
+
* package's `ai-prompts.json` lists every key with the editor's own text. The Free, with no AI and no agent link, accepts
|
|
1939
|
+
* it and ignores it. Default `{}`.
|
|
1940
|
+
*/
|
|
1941
|
+
aiPrompts?: AiPrompts;
|
|
1204
1942
|
/**
|
|
1205
1943
|
* The color the annotations start with (Annotate's first color), drawn opaque: a hex, `rgb()`, `hsl()` or a CSS color
|
|
1206
1944
|
* name. Default: the accent the editor paints.
|
|
@@ -1219,16 +1957,25 @@ export declare type EmbedEditorProps = {
|
|
|
1219
1957
|
* Given live, the locked ratio is where undo starts. Default `false`.
|
|
1220
1958
|
*/
|
|
1221
1959
|
aspectRatioLocked?: boolean;
|
|
1222
|
-
/**
|
|
1223
|
-
* Whether Escape closes the editor (the modal, or inline and page with `onClose`). Off, only the Close button and Save
|
|
1224
|
-
* close it; Escape keeps its other jobs (a Resize field's draft, Reset's confirm, Annotate).
|
|
1225
|
-
* Default `true`.
|
|
1226
|
-
*/
|
|
1227
|
-
closeOnEscape?: boolean;
|
|
1228
1960
|
/** One base color per role. Default: yellow on zinc. */
|
|
1229
1961
|
colors?: EmbedEditorColors;
|
|
1230
1962
|
/** Shows the output size over the top right of the image for a moment after it changes. Default `true`. */
|
|
1231
1963
|
displayBadge?: boolean;
|
|
1964
|
+
/**
|
|
1965
|
+
* PROTOTYPE (the agent link isn't in a released edition yet): an Agent button in the toolbar. It makes a link the
|
|
1966
|
+
* person pastes into an AI agent with the relay (`agentRelay`) connected as an MCP server, and the agent edits the
|
|
1967
|
+
* photo through the editor's commands while the person watches; the panel's How to Connect shows each agent's steps.
|
|
1968
|
+
* The photo goes to the person's agent through the relay. In every edition but the Free, which has no agent link: there
|
|
1969
|
+
* it shows nothing. Default `false`.
|
|
1970
|
+
*/
|
|
1971
|
+
enableAgent?: boolean;
|
|
1972
|
+
/**
|
|
1973
|
+
* Full and Trial. Remove Background has a field of its own, "Describe what to keep", and its Remove sends
|
|
1974
|
+
* `onAiRemoveBackground` the words typed there as `prompt`, what to keep (`'the woman and her dog'`), for a background
|
|
1975
|
+
* remover that takes them; the tip on the photo says so, on every device: "Leave it blank to keep the main subject". Off,
|
|
1976
|
+
* Remove Background is its Remove alone and `prompt` is always `''`. Default `false`.
|
|
1977
|
+
*/
|
|
1978
|
+
enableAiRemoveBackgroundPrompt?: boolean;
|
|
1232
1979
|
/**
|
|
1233
1980
|
* The Annotate button and its mode: arrows, texts, numbers, a ruler, shapes, drawing and a lens over the image. Turned
|
|
1234
1981
|
* off, the annotations already in the state stay, are drawn and are saved. Default `true`.
|
|
@@ -1293,6 +2040,69 @@ export declare type EmbedEditorProps = {
|
|
|
1293
2040
|
* both. The ratio is kept and the image is never enlarged. Default none.
|
|
1294
2041
|
*/
|
|
1295
2042
|
maxWidth?: number;
|
|
2043
|
+
/**
|
|
2044
|
+
* PROTOTYPE (the agent link isn't in a released edition yet): makes the agent link through the host's backend, on
|
|
2045
|
+
* a relay of the host's own (`agentRelay`; the hosted one has no secret to share). Called at the person's tap on Agent
|
|
2046
|
+
* in place of the editor's own `POST /sessions` on `agentRelay`, it resolves with the `link` and the `token` the relay
|
|
2047
|
+
* answered the host's backend, which asked it with the relay's secret, `agentSessionSecret` (`Authorization: Bearer`), a secret
|
|
2048
|
+
* that never reaches the page. The relay's whole answer may be passed as it came: the editor reads only those two. Use
|
|
2049
|
+
* it to make links for the host's signed-in users only, or where the relay's `allowedOrigins` doesn't name the host's
|
|
2050
|
+
* page. The editor still opens the link's socket and ends it on `agentRelay`, and shows the Agent button only with
|
|
2051
|
+
* `enableAgent`. A rejection, or an answer without a `link` and a `token`, shows "Couldn’t Create the Link" with Try
|
|
2052
|
+
* Again. Default: none, the editor asks the relay itself.
|
|
2053
|
+
*/
|
|
2054
|
+
onAgentLink?: () => Promise<{
|
|
2055
|
+
link: string;
|
|
2056
|
+
token: string;
|
|
2057
|
+
}>;
|
|
2058
|
+
/**
|
|
2059
|
+
* Full and Trial. The AI's model: called with the conversation so far, the tools the model may call and a signal that
|
|
2060
|
+
* aborts when the person stops or the editor closes. Gives back the model's next message, in OpenAI's Chat Completions
|
|
2061
|
+
* shape (`tool_calls`, `tool_call_id`, `image_url`), kept as returned, extra fields included. The editor never sees a key:
|
|
2062
|
+
* the site's server holds it. No default; without it there is no AI.
|
|
2063
|
+
*/
|
|
2064
|
+
onAiChooseCommands?: (input: {
|
|
2065
|
+
messages: ChatMessage[];
|
|
2066
|
+
signal: AbortSignal;
|
|
2067
|
+
tools: ChatTool[];
|
|
2068
|
+
}) => Promise<ChatMessage>;
|
|
2069
|
+
/**
|
|
2070
|
+
* Full and Trial. Detect's, in Obfuscate: finds every face, license plate, document and screen in the photo, in one
|
|
2071
|
+
* call per Detect. Called with `image`, a JPEG of the original photo with the AI's edits alone (no crop, rotation,
|
|
2072
|
+
* adjustments, filter, frame, annotations, Obfuscate areas or marks), at most 1024 px on its longer side; `texts`, the
|
|
2073
|
+
* kinds to find, in English (`['face', 'license plate', 'document', 'screen']`, each the host's `aiPrompts` in its place
|
|
2074
|
+
* where it gives one: `detectFace`, `detectLicensePlate`, `detectDocument`, `detectScreen`); and a `signal` that aborts
|
|
2075
|
+
* when the person stops or the editor closes. Gives back every one found of every text, an empty list when nothing was
|
|
2076
|
+
* found; the editor covers each with an area. No default; without it Obfuscate has no Detect.
|
|
2077
|
+
*/
|
|
2078
|
+
onAiDetectObjects?: (input: {
|
|
2079
|
+
image: Blob;
|
|
2080
|
+
signal: AbortSignal;
|
|
2081
|
+
texts: string[];
|
|
2082
|
+
}) => Promise<AiDetected[]>;
|
|
2083
|
+
/**
|
|
2084
|
+
* Full and Trial. Fills an area of the photo, or edits it whole: called with what the person asked (`AiEditImageInput`),
|
|
2085
|
+
* its `operation` and that operation's own fields: `'EDIT_PHOTO'`, `'ERASE_AREA'`, `'GENERATE_AREA'`,
|
|
2086
|
+
* `'GENERATE_BACKGROUND'` or `'GENERATE_BORDERS'`. Gives back the image it made, one `Blob` a call (anything else, a list
|
|
2087
|
+
* of them too, fails the work as a rejection does); the editor resizes it to `image` and pastes it where `mask` is white
|
|
2088
|
+
* alone: into the mark, or an Expand's borders, or, for the new background, whole under the cut; an `'EDIT_PHOTO'`'s
|
|
2089
|
+
* whole over the photo. For another image the person presses
|
|
2090
|
+
* Generate again, each image one undo step. No default; without it the AI cannot remove, generate or expand.
|
|
2091
|
+
*/
|
|
2092
|
+
onAiEditImage?: (input: AiEditImageInput) => Promise<Blob>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Full and Trial. Takes the background off the photo: called with `image`, a JPEG of the original photo with the AI's
|
|
2095
|
+
* edits alone (no crop, rotation, adjustments, filter, frame, annotations, Obfuscate areas or marks), at most 2048 px on
|
|
2096
|
+
* its longer side; `prompt`, what to keep, in words (the AI's field's, with
|
|
2097
|
+
* `enableAiRemoveBackgroundPrompt`; `''` with none and without it); and a `signal` that aborts when the person stops or
|
|
2098
|
+
* the editor closes. Gives back the photo as a PNG with the background transparent; the editor uses only its alpha,
|
|
2099
|
+
* resized to the photo. No default; without it the AI cannot remove the background.
|
|
2100
|
+
*/
|
|
2101
|
+
onAiRemoveBackground?: (input: {
|
|
2102
|
+
image: Blob;
|
|
2103
|
+
prompt: string;
|
|
2104
|
+
signal: AbortSignal;
|
|
2105
|
+
}) => Promise<Blob>;
|
|
1296
2106
|
/** Called when the editor closes. On `EmbedEditor` and `mountEditor`, the Close button shows only with it. */
|
|
1297
2107
|
onClose?: () => void;
|
|
1298
2108
|
/**
|
|
@@ -1311,19 +2121,36 @@ export declare type EmbedEditorProps = {
|
|
|
1311
2121
|
*/
|
|
1312
2122
|
onLoadError?: (error: EmbedEditorError) => void;
|
|
1313
2123
|
/**
|
|
1314
|
-
* Called with what Save made and the state it was made with.
|
|
1315
|
-
*
|
|
2124
|
+
* Called with what Save made and the state it was made with. `src` is the photo with the AI's edits, as a file at the
|
|
2125
|
+
* size the editor works it (a JPEG for a JPEG photo with no cut, else a PNG), to open the state again with it. It is
|
|
2126
|
+
* `null` while the photo is still the one you passed: no AI edit, a session reopened on an earlier `src` included. Store
|
|
2127
|
+
* `src` only when it isn't `null`, and keep the one you have otherwise. Without it, Save downloads the file. If it
|
|
2128
|
+
* throws, the error is logged with `console.error`, Save shows it failed and the modal stays open; `onProcessError`
|
|
2129
|
+
* isn't called.
|
|
1316
2130
|
*/
|
|
1317
2131
|
onProcess?: (res: {
|
|
1318
2132
|
dest: File;
|
|
2133
|
+
src: File | null;
|
|
1319
2134
|
state: EditState;
|
|
1320
2135
|
}) => void;
|
|
1321
|
-
/**
|
|
2136
|
+
/**
|
|
2137
|
+
* Called when Save can't make the file (`EXPORT_FAILED`) or can't draw a fixed or required mark (`MARK_FAILED`). The
|
|
2138
|
+
* banner under the toolbar says so too.
|
|
2139
|
+
*/
|
|
1322
2140
|
onProcessError?: (error: EmbedEditorError) => void;
|
|
1323
2141
|
/** The JPEG and WebP quality, 0…100. Default `90`. */
|
|
1324
2142
|
outputQuality?: number;
|
|
1325
2143
|
/** The type Save and Share write. Default: the source's when it is one of these, a PNG otherwise. */
|
|
1326
2144
|
outputType?: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
2145
|
+
/**
|
|
2146
|
+
* PROTOTYPE (the agent link isn't in a released edition yet): the license's public key, `ee_pk_…`, the key for
|
|
2147
|
+
* Embed Editor's cloud services, today the agent link, whose hosted relay asks for it before it makes a link. Your
|
|
2148
|
+
* account at account.embededitor.com shows it on the license's card, under Cloud Services, and the license's e-mail
|
|
2149
|
+
* too. It's public, made for the page, unlike the license key that installs the package and never goes in a page;
|
|
2150
|
+
* restrict it to your domains in your account. Without it, on the hosted relay, the editor shows no Agent and says so
|
|
2151
|
+
* in the console. A relay of your own (`agentRelay`) needs none. Default `null`.
|
|
2152
|
+
*/
|
|
2153
|
+
publicKey?: string | null;
|
|
1327
2154
|
/** The signature over the photo. `null` or absent: none. Default `null`. */
|
|
1328
2155
|
signature?: EmbedEditorSignature | null;
|
|
1329
2156
|
/**
|
|
@@ -1345,7 +2172,8 @@ export declare type EmbedEditorProps = {
|
|
|
1345
2172
|
/**
|
|
1346
2173
|
* What is selected: an Obfuscate area, by its index in the state's `obfuscation`; in Annotate, an annotation
|
|
1347
2174
|
* (`'PIECE'`, by its `id`), an arrow added to a text or to the Numbers' list (`'ARROW'`: its owner's `id`, `'LIST'` for
|
|
1348
|
-
* the list, and the arrow's place in its `arrows`) or the list (`'LIST'`);
|
|
2175
|
+
* the list, and the arrow's place in its `arrows`) or the list (`'LIST'`); an area of the AI's mark (`'MARK'`, by its
|
|
2176
|
+
* `index` in `read.mark`'s list) while the AI shows its areas with the Brush; or nothing (`null`).
|
|
1349
2177
|
*/
|
|
1350
2178
|
export declare type EmbedEditorSelection = number | {
|
|
1351
2179
|
id: string;
|
|
@@ -1356,6 +2184,9 @@ export declare type EmbedEditorSelection = number | {
|
|
|
1356
2184
|
kind: 'PIECE';
|
|
1357
2185
|
} | {
|
|
1358
2186
|
kind: 'LIST';
|
|
2187
|
+
} | {
|
|
2188
|
+
index: number;
|
|
2189
|
+
kind: 'MARK';
|
|
1359
2190
|
} | null;
|
|
1360
2191
|
|
|
1361
2192
|
/**
|
|
@@ -1450,18 +2281,39 @@ export declare type Lang = 'en-us' | 'es-es' | 'pt-br';
|
|
|
1450
2281
|
*/
|
|
1451
2282
|
export declare type LangTexts = Partial<Record<MessageKey, string>>;
|
|
1452
2283
|
|
|
2284
|
+
/**
|
|
2285
|
+
* Where a mark stands once drawn, in image px, as `read.screenshot` and the export draw it (whole px): what `marks.place`
|
|
2286
|
+
* and `marks.update` resolve with, in `boxes`. `role` names the mark; `box` is the box round what it draws on the photo
|
|
2287
|
+
* (round every tile of a grid watermark), `null` where it draws none (hidden, or its image or letter not loaded).
|
|
2288
|
+
*/
|
|
2289
|
+
export declare type MarkBox = {
|
|
2290
|
+
box: Rect | null;
|
|
2291
|
+
role: 'SIGNATURE' | 'WATERMARK';
|
|
2292
|
+
};
|
|
2293
|
+
|
|
1453
2294
|
/**
|
|
1454
2295
|
* A message of the editor, by its key: what `lang.texts` can bring. The package's `i18n/en-us.json` has
|
|
1455
2296
|
* each with its English text. Written out here (the d.ts carries no JSON), and held equal to the dictionary's keys by
|
|
1456
2297
|
* src/types.spec.ts.
|
|
1457
2298
|
*/
|
|
1458
|
-
export declare type MessageKey = 'annotateAddArrow' | 'annotateAddGuide' | 'annotateArrow' | 'annotateAttachText' | 'annotateBeside' | 'annotateBox' | 'annotateBringToFront' | 'annotateCapArrow' | 'annotateCapBar' | 'annotateCapDot' | 'annotateCapNone' | 'annotateCapTriangle' | 'annotateColorDefault' | 'annotateCorners' | 'annotateCornersRound' | 'annotateCornersSoft' | 'annotateCornersSquare' | 'annotateDetach' | 'annotateDraw' | 'annotateDuplicate' | 'annotateEnd' | 'annotateEnds' | 'annotateFieldDescription' | 'annotateFieldTitle' | 'annotateFill' | 'annotateFillMedium' | 'annotateFillOpaque' | 'annotateFillOutline' | 'annotateFillSoft' | 'annotateFont' | 'annotateFormat' | 'annotateInList' | 'annotateLens' | 'annotateLensCircle' | 'annotateLensRounded' | 'annotateLine' | 'annotateLineDashed' | 'annotateLineDotted' | 'annotateLineSketch' | 'annotateLineSolid' | 'annotateLineTransparent' | 'annotateList' | 'annotateListTitle' | 'annotateLook' | 'annotateLookBox' | 'annotateLookCaption' | 'annotateLookPlain' | 'annotateMark' | 'annotateMarkDot' | 'annotateMenuValue' | 'annotateMenuValues' | 'annotateNumber' | 'annotateOpenFailed' | 'annotatePadding' | 'annotatePaddingLoose' | 'annotatePaddingNormal' | 'annotatePaddingTight' | 'annotatePath' | 'annotatePathCurve' | 'annotatePathElbow' | 'annotatePathFree' | 'annotatePathRoundedElbow' | 'annotatePathStraight' | 'annotateRemove' | 'annotateRuler' | 'annotateRulerLabel' | 'annotateRulerPlaceholder' | 'annotateShape' | 'annotateShapeEllipse' | 'annotateShapeLine' | 'annotateShapeRect' | 'annotateShapeRounded' | 'annotateSize' | 'annotateSizeL' | 'annotateSizeM' | 'annotateSizeNameL' | 'annotateSizeNameM' | 'annotateSizeNameS' | 'annotateSizeS' | 'annotateStart' | 'annotateStroke' | 'annotateStrokeDashed' | 'annotateStrokeDotted' | 'annotateStrokeMarker' | 'annotateStrokeSketch' | 'annotateStrokeSolid' | 'annotateText' | 'annotateTextPlaceholder' | 'annotateTheme' | 'annotateThemeAccent' | 'annotateThemeDark' | 'annotateThemeLight' | 'annotateTools' | 'annotateType' | 'annotateTypeArrow' | 'annotateTypeCustom' | 'annotateTypeDashed' | 'annotateTypeDouble' | 'annotateTypeLeader' | 'annotateTypeLine' | 'annotateTypeTrail' | 'annotateWeight' | 'annotateWeightExtraThick' | 'annotateWeightExtraThin' | 'annotateWeightMedium' | 'annotateWeightMediumThick' | 'annotateWeightMediumThin' | 'annotateWeightThick' | 'annotateWeightThin' | 'annotateZoom' | 'annotateZoomValue' | 'aspectFree' | 'aspectOriginal' | 'autoFailed' | 'autoTimedOut' | 'autoTurnOn' | 'browserUnsupported' | 'buttonAnnotate' | 'buttonCancel' | 'buttonChooseAnother' | 'buttonChooseFile' | 'buttonClose' | 'buttonCopy' | 'buttonDone' | 'buttonFlip' | 'buttonFocus' | 'buttonRecenter' | 'buttonRedo' | 'buttonReset' | 'buttonResetConfirm' | 'buttonRotateLeft' | 'buttonSave' | 'buttonSaved' | 'buttonShare' | 'buttonUndo' | 'color' | 'colorBlack' | 'colorBlue' | 'colorCode' | 'colorCream' | 'colorCustom' | 'colorGreen' | 'colorKraft' | 'colorLavender' | 'colorMint' | 'colorMore' | 'colorNavy' | 'colorOchre' | 'colorOlive' | 'colorPaper' | 'colorPhoto' | 'colorPick' | 'colorPickFailed' | 'colorRed' | 'colorRose' | 'colorShades' | 'colorSky' | 'colorViolet' | 'colorWhite' | 'colorYellow' | 'compareOriginal' | 'cropAspectRatio' | 'cropScale' | 'dialogLabel' | 'errorCopyFailed' | 'errorExportFailed' | 'errorInvalidProps' | 'errorInvalidState' | 'errorLoadFailed' | 'errorMarkFailed' | 'errorShareFailed' | 'errorUnsupportedFormat' | 'errorWebglUnavailable' | 'filterDramatic' | 'filterDramaticCool' | 'filterDramaticWarm' | 'filterIntensity' | 'filterMono' | 'filterNoir' | 'filterOriginal' | 'filterSilvertone' | 'filterVivid' | 'filterVividCool' | 'filterVividWarm' | 'finetuneAuto' | 'finetuneBlackPoint' | 'finetuneBrightness' | 'finetuneBrilliance' | 'finetuneContrast' | 'finetuneExposure' | 'finetuneHighlights' | 'finetuneSaturation' | 'finetuneShadows' | 'finetuneSharpness' | 'finetuneVibrance' | 'finetuneVignette' | 'finetuneWarmth' | 'focusCenter' | 'focusFailed' | 'focusSubject' | 'frameCornerHooks' | 'frameEdgeCross' | 'frameEdgeOverlap' | 'frameEdgeSeparate' | 'frameFilm' | 'frameGallery' | 'frameLineMultiple' | 'frameLineSingle' | 'frameMatRound' | 'frameMatSharp' | 'frameNone' | 'framePhotoCorners' | 'framePolaroid' | 'frameRoundCorners' | 'imageCopied' | 'markAdjustment' | 'markAngle' | 'markColor' | 'markColorAuto' | 'markEditText' | 'markFailedSignature' | 'markFailedWatermark' | 'markFont' | 'markFontValue' | 'markGrid' | 'markLayout' | 'markMargin' | 'markOpacity' | 'markRetry' | 'markShow' | 'markSignature' | 'markSingle' | 'markSize' | 'markSkippedSignature' | 'markSkippedWatermark' | 'markSpacing' | 'markText' | 'markWatermark' | 'noticeAreasVisible' | 'noticeClose' | 'noticeDropped' | 'noticeDroppedAnnotations' | 'noticeDroppedAuto' | 'noticeDroppedFilter' | 'noticeDroppedFinetune' | 'noticeDroppedFrame' | 'noticeDroppedHiddenAreas' | 'noticeDroppedSignature' | 'noticeDroppedWatermark' | 'obfuscateDelete' | 'obfuscateHint' | 'obfuscateLimit' | 'obfuscateShape' | 'obfuscateShapeRound' | 'obfuscateShapeRounded' | 'obfuscateShapeSquare' | 'obfuscateStyle' | 'obfuscateStyleBlur' | 'obfuscateStylePixelate' | 'obfuscateStyleSolid' | 'palette' | 'paletteEarth' | 'palettePastel' | 'palettePhoto' | 'palettePhotoPastel' | 'palettePhotoVivid' | 'paletteVibrant' | 'pickerDescription' | 'pickerFormats' | 'pickerTitle' | 'pickerTitleTouch' | 'resetConfirmHint' | 'resizeHeight' | 'resizeWidth' | 'shareReady' | 'statusLoading' | 'toolAdjust' | 'toolFilter' | 'toolFrame' | 'toolObfuscate' | 'toolResize' | 'toolsLabel';
|
|
2299
|
+
export declare type MessageKey = 'agentAddRequest' | 'agentAskEdit' | 'agentBack' | 'agentButton' | 'agentCancel' | 'agentCheckRetry' | 'agentConnect' | 'agentConnectAgain' | 'agentConnected' | 'agentCopied' | 'agentCopy' | 'agentCopyFailed' | 'agentCreating' | 'agentDisconnect' | 'agentEndedCanceled' | 'agentEndedDisconnected' | 'agentEndedExpired' | 'agentEndedTabClosed' | 'agentEnding' | 'agentExamples' | 'agentExamplesCopy' | 'agentExamplesCopyWithLink' | 'agentFailed' | 'agentGuideAddress' | 'agentGuideAgents' | 'agentGuideChatGptConnector' | 'agentGuideChatGptDeveloper' | 'agentGuideClaudeConnector' | 'agentGuideClaudeSettings' | 'agentGuideCopyFailed' | 'agentGuideCursorChat' | 'agentGuideCursorFile' | 'agentGuideNewSession' | 'agentGuideTerminal' | 'agentGuideThen' | 'agentGuideVsCodeChat' | 'agentGuideVsCodeFile' | 'agentHidePanel' | 'agentHowToConnect' | 'agentLinkKept' | 'agentNotSetUp' | 'agentReconnecting' | 'agentRequestArrow' | 'agentRequestBlur' | 'agentRequestCrop' | 'agentRequestPlate' | 'agentRequestWarm' | 'agentRetry' | 'agentShowPanel' | 'agentStepAddress' | 'agentStepLink' | 'agentStepsTitle' | 'agentWaiting' | 'aiAction' | 'aiAnnotate' | 'aiAreaMove' | 'aiAreasByHand' | 'aiAsk' | 'aiBackgroundFailed' | 'aiBackgroundField' | 'aiBrush' | 'aiCardClose' | 'aiCardFold' | 'aiCardUnfold' | 'aiCreateField' | 'aiDetect' | 'aiDetectFailed' | 'aiEdit' | 'aiEraser' | 'aiExampleAreaBench' | 'aiExampleAreaBrick' | 'aiExampleAreaGrass' | 'aiExampleAreaPlant' | 'aiExampleAreaSky' | 'aiExampleAskBlackAndWhite' | 'aiExampleAskBlurFaces' | 'aiExampleAskFrame' | 'aiExampleAskFurnish' | 'aiExampleAskGoldenHour' | 'aiExampleAskRemoveBackground' | 'aiExampleAskRemovePeople' | 'aiExampleAskSleepingCat' | 'aiExampleAskSnowyEvening' | 'aiExampleAskSquare' | 'aiExampleAskWarmer' | 'aiExampleBackgroundBeach' | 'aiExampleBackgroundGradient' | 'aiExampleBackgroundMarble' | 'aiExampleBackgroundStreet' | 'aiExampleBackgroundStudio' | 'aiExampleCreateDetails' | 'aiExampleCreateFinePrint' | 'aiExampleCreateParts' | 'aiExampleCreateSteps' | 'aiExampleCreateTitle' | 'aiExampleKeepCar' | 'aiExampleKeepDog' | 'aiExampleKeepPeople' | 'aiExampleKeepPerson' | 'aiExampleKeepProduct' | 'aiExamples' | 'aiExpanded' | 'aiExpandFailed' | 'aiFailed' | 'aiField' | 'aiFieldMore' | 'aiFillFailed' | 'aiGenerate' | 'aiGenerateAgain' | 'aiKeepField' | 'aiKeepHint' | 'aiMarkByHand' | 'aiMarkedField' | 'aiMarkField' | 'aiNoSubject' | 'aiNothingFound' | 'aiReference' | 'aiReferenceHint' | 'aiReferencePhotoHint' | 'aiReferenceRemove' | 'aiRemove' | 'aiRemoveBackground' | 'aiRemoveBackgroundHint' | 'aiRemoveFailed' | 'aiRemoveObject' | 'aiRemoveObjectHint' | 'aiSlow' | 'aiStop' | 'aiTryAgain' | 'aiUnchanged' | 'aiUnchangedRetry' | 'aiWorkingAdjust' | 'aiWorkingAnnotate' | 'aiWorkingBackground' | 'aiWorkingCrop' | 'aiWorkingDetect' | 'aiWorkingExpand' | 'aiWorkingGenerate' | 'aiWorkingLook' | 'aiWorkingObfuscate' | 'aiWorkingRemove' | 'aiWorkingThink' | 'annotateAddArrow' | 'annotateAddGuide' | 'annotateArrow' | 'annotateAttachText' | 'annotateBeside' | 'annotateBox' | 'annotateBringToFront' | 'annotateCapArrow' | 'annotateCapBar' | 'annotateCapDot' | 'annotateCapNone' | 'annotateCapTriangle' | 'annotateColorDefault' | 'annotateCorners' | 'annotateCornersRound' | 'annotateCornersSoft' | 'annotateCornersSquare' | 'annotateDetach' | 'annotateDraw' | 'annotateDuplicate' | 'annotateEnd' | 'annotateEnds' | 'annotateFieldDescription' | 'annotateFieldTitle' | 'annotateFill' | 'annotateFillMedium' | 'annotateFillOpaque' | 'annotateFillOutline' | 'annotateFillSoft' | 'annotateFont' | 'annotateFormat' | 'annotateInList' | 'annotateLens' | 'annotateLensCircle' | 'annotateLensRounded' | 'annotateLimit' | 'annotateLine' | 'annotateLineDashed' | 'annotateLineDotted' | 'annotateLineSketch' | 'annotateLineSolid' | 'annotateLineTransparent' | 'annotateList' | 'annotateListTitle' | 'annotateLook' | 'annotateLookBox' | 'annotateLookCaption' | 'annotateLookPlain' | 'annotateMark' | 'annotateMarkDot' | 'annotateMenuValue' | 'annotateMenuValues' | 'annotateNumber' | 'annotateOpenFailed' | 'annotatePadding' | 'annotatePaddingLoose' | 'annotatePaddingNormal' | 'annotatePaddingTight' | 'annotatePath' | 'annotatePathCurve' | 'annotatePathElbow' | 'annotatePathFree' | 'annotatePathRoundedElbow' | 'annotatePathStraight' | 'annotateRemove' | 'annotateRuler' | 'annotateRulerLabel' | 'annotateRulerPlaceholder' | 'annotateShape' | 'annotateShapeEllipse' | 'annotateShapeLine' | 'annotateShapeRect' | 'annotateShapeRounded' | 'annotateSize' | 'annotateSizeL' | 'annotateSizeM' | 'annotateSizeNameL' | 'annotateSizeNameM' | 'annotateSizeNameS' | 'annotateSizeS' | 'annotateStart' | 'annotateStroke' | 'annotateStrokeDashed' | 'annotateStrokeDotted' | 'annotateStrokeMarker' | 'annotateStrokeSketch' | 'annotateStrokeSolid' | 'annotateText' | 'annotateTextPlaceholder' | 'annotateTheme' | 'annotateThemeAccent' | 'annotateThemeDark' | 'annotateThemeLight' | 'annotateTools' | 'annotateType' | 'annotateTypeArrow' | 'annotateTypeCustom' | 'annotateTypeDashed' | 'annotateTypeDouble' | 'annotateTypeLeader' | 'annotateTypeLine' | 'annotateTypeTrail' | 'annotateWeight' | 'annotateWeightExtraThick' | 'annotateWeightExtraThin' | 'annotateWeightMedium' | 'annotateWeightMediumThick' | 'annotateWeightMediumThin' | 'annotateWeightThick' | 'annotateWeightThin' | 'annotateZoom' | 'annotateZoomValue' | 'aspectFree' | 'aspectOriginal' | 'autoFailed' | 'autoTimedOut' | 'autoTurnOn' | 'browserUnsupported' | 'buttonAnnotate' | 'buttonCancel' | 'buttonChooseAnother' | 'buttonChooseFile' | 'buttonClose' | 'buttonCopy' | 'buttonDone' | 'buttonFlip' | 'buttonFocus' | 'buttonRecenter' | 'buttonRedo' | 'buttonReset' | 'buttonResetConfirm' | 'buttonRotateLeft' | 'buttonSave' | 'buttonSaved' | 'buttonShare' | 'buttonUndo' | 'color' | 'colorBlack' | 'colorBlue' | 'colorCode' | 'colorCream' | 'colorCustom' | 'colorGreen' | 'colorKraft' | 'colorLavender' | 'colorMint' | 'colorMore' | 'colorNavy' | 'colorOchre' | 'colorOlive' | 'colorPaper' | 'colorPhoto' | 'colorPick' | 'colorPickFailed' | 'colorRed' | 'colorRose' | 'colorShades' | 'colorSky' | 'colorViolet' | 'colorWhite' | 'colorYellow' | 'compareOriginal' | 'cropAspectRatio' | 'cropMode' | 'cropModeCrop' | 'cropModeExpand' | 'cropScale' | 'dialogLabel' | 'errorCopyFailed' | 'errorExportFailed' | 'errorInvalidProps' | 'errorInvalidState' | 'errorLoadFailed' | 'errorMarkFailed' | 'errorPhotoTooLarge' | 'errorShareFailed' | 'errorUnsupportedFormat' | 'errorWebglUnavailable' | 'filterDramatic' | 'filterDramaticCool' | 'filterDramaticWarm' | 'filterIntensity' | 'filterMono' | 'filterNoir' | 'filterOriginal' | 'filterSilvertone' | 'filterVivid' | 'filterVividCool' | 'filterVividWarm' | 'finetuneAuto' | 'finetuneBlackPoint' | 'finetuneBrightness' | 'finetuneBrilliance' | 'finetuneContrast' | 'finetuneExposure' | 'finetuneHighlights' | 'finetuneSaturation' | 'finetuneShadows' | 'finetuneSharpness' | 'finetuneVibrance' | 'finetuneVignette' | 'finetuneWarmth' | 'focusCenter' | 'focusFailed' | 'focusSubject' | 'frameCornerHooks' | 'frameEdgeCross' | 'frameEdgeOverlap' | 'frameEdgeSeparate' | 'frameFilm' | 'frameGallery' | 'frameLineMultiple' | 'frameLineSingle' | 'frameMatRound' | 'frameMatSharp' | 'frameNone' | 'framePhotoCorners' | 'framePolaroid' | 'frameRoundCorners' | 'imageCopied' | 'markAdjustment' | 'markAngle' | 'markColor' | 'markColorAuto' | 'markEditText' | 'markFailedSignature' | 'markFailedWatermark' | 'markFont' | 'markFontValue' | 'markGrid' | 'markLayout' | 'markMargin' | 'markOpacity' | 'markRetry' | 'markShow' | 'markSignature' | 'markSingle' | 'markSize' | 'markSkippedSignature' | 'markSkippedWatermark' | 'markSpacing' | 'markText' | 'markWatermark' | 'noticeAreasVisible' | 'noticeClose' | 'noticeCropReset' | 'noticeDropped' | 'noticeDroppedAnnotations' | 'noticeDroppedAuto' | 'noticeDroppedFilter' | 'noticeDroppedFinetune' | 'noticeDroppedFrame' | 'noticeDroppedHiddenAreas' | 'noticeDroppedSignature' | 'noticeDroppedWatermark' | 'obfuscateDelete' | 'obfuscateHint' | 'obfuscateLimit' | 'obfuscateShape' | 'obfuscateShapeRound' | 'obfuscateShapeRounded' | 'obfuscateShapeSquare' | 'obfuscateStyle' | 'obfuscateStyleBlur' | 'obfuscateStylePixelate' | 'obfuscateStyleSolid' | 'palette' | 'paletteEarth' | 'palettePastel' | 'palettePhoto' | 'palettePhotoPastel' | 'palettePhotoVivid' | 'paletteVibrant' | 'pickerDescription' | 'pickerFormats' | 'pickerTitle' | 'pickerTitleTouch' | 'resetConfirmHint' | 'resizeHeight' | 'resizeWidth' | 'shareReady' | 'statusLoading' | 'toolAdjust' | 'toolFilter' | 'toolFrame' | 'toolObfuscate' | 'toolResize' | 'toolsLabel';
|
|
1459
2300
|
|
|
1460
2301
|
export declare const mountEditor: (element: HTMLElement, options?: EmbedEditorProps) => EmbedEditorHandle & {
|
|
1461
2302
|
destroy: () => void;
|
|
1462
2303
|
update: (options: EmbedEditorProps) => void;
|
|
1463
2304
|
};
|
|
1464
2305
|
|
|
2306
|
+
/**
|
|
2307
|
+
* Where an Obfuscate area stands once drawn, in image px, as `read.screenshot` and the export draw it (whole px): what
|
|
2308
|
+
* `obfuscate.add`, `obfuscate.detect` and `obfuscate.update` resolve with, in `boxes`, one for each area they placed or
|
|
2309
|
+
* moved. `index` is its place in the state's `obfuscation`; `box` the box round its outline as its shape and its turn draw
|
|
2310
|
+
* it, past the photo's edges where it stands there.
|
|
2311
|
+
*/
|
|
2312
|
+
export declare type ObfuscationBox = {
|
|
2313
|
+
box: Rect;
|
|
2314
|
+
index: number;
|
|
2315
|
+
};
|
|
2316
|
+
|
|
1465
2317
|
export declare const openEditor: (options?: Omit< EmbedEditorProps, "layout">) => EmbedEditorHandle & {
|
|
1466
2318
|
close: () => void;
|
|
1467
2319
|
};
|