@panneau/media 5.0.0-alpha.6 → 5.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/ImageItem.js.map +1 -1
- package/dist/MediaField.d.ts.map +1 -1
- package/dist/MediaField.js +603 -237
- package/dist/MediaField.js.map +1 -1
- package/dist/editor/ImageEditor.js +376 -145
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/draw.js +49 -12
- package/dist/editor/draw.js.map +1 -1
- package/dist/editor/geometry.js.map +1 -1
- package/dist/editor/tools.js.map +1 -1
- package/dist/picker/MediaDetails.js.map +1 -1
- package/dist/picker/MediaGrid.js +57 -15
- package/dist/picker/MediaGrid.js.map +1 -1
- package/dist/picker/MediaPicker.css +0 -45
- package/dist/picker/MediaPicker.d.ts.map +1 -1
- package/dist/picker/MediaPicker.js +859 -342
- package/dist/picker/MediaPicker.js.map +1 -1
- package/dist/picker/MediaPicker.module.js +1 -11
- package/dist/picker/MediaPicker.module.js.map +1 -1
- package/dist/picker/PickerToolbar.js.map +1 -1
- package/dist/picker/UploadPanel.js.map +1 -1
- package/dist/picker/format.js.map +1 -1
- package/dist/picker/useMediaBrowser.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/resourceSource.js.map +1 -1
- package/package.json +7 -7
|
@@ -172,7 +172,19 @@ function OpenImageEditorDialog(t0) {
|
|
|
172
172
|
return t5;
|
|
173
173
|
}
|
|
174
174
|
/** The parts of the editor, which `ImageEditor` and `ImageEditorDialog` lay out. */
|
|
175
|
-
function useImageEditor(
|
|
175
|
+
function useImageEditor(t0) {
|
|
176
|
+
const $ = c(93);
|
|
177
|
+
const { image, value, base: newBase, canChooseBase: t1, tools: givenTools, ratios: t2, enforceRatios: t3, cropRequired: t4, applyLabel, onBack, onApply, onCancel } = t0;
|
|
178
|
+
const canChooseBase = t1 === void 0 ? false : t1;
|
|
179
|
+
let t5;
|
|
180
|
+
if ($[0] !== t2) {
|
|
181
|
+
t5 = t2 === void 0 ? [] : t2;
|
|
182
|
+
$[0] = t2;
|
|
183
|
+
$[1] = t5;
|
|
184
|
+
} else t5 = $[1];
|
|
185
|
+
const ratios = t5;
|
|
186
|
+
const enforceRatios = t3 === void 0 ? false : t3;
|
|
187
|
+
const cropRequired = t4 === void 0 ? false : t4;
|
|
176
188
|
const intl = usePanneauIntl();
|
|
177
189
|
const hintId = useId();
|
|
178
190
|
const problemId = useId();
|
|
@@ -183,52 +195,89 @@ function useImageEditor({ image, value, base: newBase, canChooseBase = false, to
|
|
|
183
195
|
defaults.rotate,
|
|
184
196
|
defaults.focalPoint
|
|
185
197
|
];
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
198
|
+
let t6;
|
|
199
|
+
if ($[2] !== image) {
|
|
200
|
+
t6 = ownTransform(image);
|
|
201
|
+
$[2] = image;
|
|
202
|
+
$[3] = t6;
|
|
203
|
+
} else t6 = $[3];
|
|
204
|
+
const own = t6;
|
|
205
|
+
let t7;
|
|
206
|
+
if ($[4] !== image) {
|
|
207
|
+
t7 = (base) => drawBase(image, base).size;
|
|
208
|
+
$[4] = image;
|
|
209
|
+
$[5] = t7;
|
|
210
|
+
} else t7 = $[5];
|
|
211
|
+
const sizeOf = t7;
|
|
212
|
+
let t8;
|
|
213
|
+
if ($[6] !== cropRequired || $[7] !== enforceRatios || $[8] !== newBase || $[9] !== own || $[10] !== ratios[0] || $[11] !== sizeOf || $[12] !== value) {
|
|
214
|
+
t8 = () => {
|
|
215
|
+
const base_0 = value !== null ? value.base === "media" ? "media" : "original" : own !== null ? newBase ?? "media" : "original";
|
|
216
|
+
const { base: _base, baseTransform, ...rest } = value ?? {};
|
|
217
|
+
const size = sizeOf(base_0);
|
|
218
|
+
let edits = rest;
|
|
219
|
+
if (edits.crop !== void 0) {
|
|
220
|
+
const { crop: _crop, ...withoutCrop } = edits;
|
|
221
|
+
const clamped = clampCrop(edits.crop, size);
|
|
222
|
+
edits = clamped !== null ? {
|
|
223
|
+
...withoutCrop,
|
|
224
|
+
crop: clamped
|
|
225
|
+
} : withoutCrop;
|
|
226
|
+
}
|
|
227
|
+
const first = parseRatio(ratios[0] ?? "");
|
|
228
|
+
if (cropRequired && enforceRatios && first !== null && edits.crop === void 0) {
|
|
229
|
+
const view = viewSize(size, edits.rotate);
|
|
230
|
+
const proposed = cropAround({
|
|
231
|
+
x: 0,
|
|
232
|
+
y: 0,
|
|
233
|
+
...view
|
|
234
|
+
}, first, focalInView(size, edits));
|
|
235
|
+
edits = {
|
|
236
|
+
...edits,
|
|
237
|
+
crop: rectFromView(proposed, size, edits)
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
base: base_0,
|
|
242
|
+
edits,
|
|
243
|
+
proposed: edits.crop !== void 0 && value?.crop === void 0,
|
|
244
|
+
changed: base_0 === "media" && baseTransform !== void 0 && !sameEdits(baseTransform, own ?? {})
|
|
212
245
|
};
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
base: base_0,
|
|
216
|
-
edits,
|
|
217
|
-
proposed: edits.crop !== void 0 && value?.crop === void 0,
|
|
218
|
-
changed: base_0 === "media" && baseTransform !== void 0 && !sameEdits(baseTransform, own ?? {})
|
|
219
246
|
};
|
|
220
|
-
|
|
247
|
+
$[6] = cropRequired;
|
|
248
|
+
$[7] = enforceRatios;
|
|
249
|
+
$[8] = newBase;
|
|
250
|
+
$[9] = own;
|
|
251
|
+
$[10] = ratios[0];
|
|
252
|
+
$[11] = sizeOf;
|
|
253
|
+
$[12] = value;
|
|
254
|
+
$[13] = t8;
|
|
255
|
+
} else t8 = $[13];
|
|
256
|
+
const [start] = useState(t8);
|
|
221
257
|
const [base_1, setBase] = useState(start.base);
|
|
222
258
|
const [transform, setTransform] = useState(start.edits);
|
|
223
259
|
const [toolId, setToolId] = useState(tools[0]?.id ?? "");
|
|
224
|
-
|
|
260
|
+
let t9;
|
|
261
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
262
|
+
t9 = {};
|
|
263
|
+
$[14] = t9;
|
|
264
|
+
} else t9 = $[14];
|
|
265
|
+
const [toolStates, setToolStates] = useState(t9);
|
|
225
266
|
const size_0 = sizeOf(base_1);
|
|
226
267
|
const view_0 = viewSize(size_0, transform.rotate);
|
|
227
268
|
const crop = cropInView(size_0, transform);
|
|
228
269
|
const tool = tools.find((candidate) => candidate.id === toolId) ?? tools[0];
|
|
270
|
+
const t10 = svgTransform(size_0, transform);
|
|
271
|
+
let t11;
|
|
272
|
+
if ($[15] !== base_1 || $[16] !== image) {
|
|
273
|
+
t11 = drawBase(image, base_1);
|
|
274
|
+
$[15] = base_1;
|
|
275
|
+
$[16] = image;
|
|
276
|
+
$[17] = t11;
|
|
277
|
+
} else t11 = $[17];
|
|
229
278
|
const drawing = /* @__PURE__ */ jsx("g", {
|
|
230
|
-
transform:
|
|
231
|
-
children:
|
|
279
|
+
transform: t10,
|
|
280
|
+
children: t11.drawing
|
|
232
281
|
});
|
|
233
282
|
const [stage, setStage] = useState(null);
|
|
234
283
|
const [unit, setUnit] = useState(Math.max(view_0.width, view_0.height) / 800);
|
|
@@ -246,50 +295,76 @@ function useImageEditor({ image, value, base: newBase, canChooseBase = false, to
|
|
|
246
295
|
view_0.width,
|
|
247
296
|
view_0.height
|
|
248
297
|
]);
|
|
298
|
+
let t12;
|
|
299
|
+
if ($[18] !== setTransform) {
|
|
300
|
+
t12 = (update) => setTransform((current) => update(current));
|
|
301
|
+
$[18] = setTransform;
|
|
302
|
+
$[19] = t12;
|
|
303
|
+
} else t12 = $[19];
|
|
304
|
+
let t13;
|
|
305
|
+
if ($[20] !== stage) {
|
|
306
|
+
t13 = (event) => {
|
|
307
|
+
const matrix = stage?.getScreenCTM()?.inverse();
|
|
308
|
+
const point = new DOMPoint(event.clientX, event.clientY);
|
|
309
|
+
const found = matrix !== void 0 ? point.matrixTransform(matrix) : point;
|
|
310
|
+
return {
|
|
311
|
+
x: found.x,
|
|
312
|
+
y: found.y
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
$[20] = stage;
|
|
316
|
+
$[21] = t13;
|
|
317
|
+
} else t13 = $[21];
|
|
318
|
+
let t14;
|
|
319
|
+
if ($[22] !== toolId) {
|
|
320
|
+
t14 = (state) => setToolStates((current_0) => ({
|
|
321
|
+
...current_0,
|
|
322
|
+
[toolId]: state
|
|
323
|
+
}));
|
|
324
|
+
$[22] = toolId;
|
|
325
|
+
$[23] = t14;
|
|
326
|
+
} else t14 = $[23];
|
|
249
327
|
const context = {
|
|
250
328
|
image,
|
|
251
329
|
transform,
|
|
252
|
-
setTransform:
|
|
330
|
+
setTransform: t12,
|
|
253
331
|
size: size_0,
|
|
254
332
|
view: view_0,
|
|
255
333
|
crop,
|
|
256
334
|
unit,
|
|
257
335
|
drawing,
|
|
258
|
-
pointToView:
|
|
259
|
-
const matrix = stage?.getScreenCTM()?.inverse();
|
|
260
|
-
const point = new DOMPoint(event.clientX, event.clientY);
|
|
261
|
-
const found = matrix !== void 0 ? point.matrixTransform(matrix) : point;
|
|
262
|
-
return {
|
|
263
|
-
x: found.x,
|
|
264
|
-
y: found.y
|
|
265
|
-
};
|
|
266
|
-
},
|
|
336
|
+
pointToView: t13,
|
|
267
337
|
ratios,
|
|
268
338
|
enforceRatios,
|
|
269
339
|
state: toolStates[toolId],
|
|
270
|
-
setState:
|
|
271
|
-
...current_0,
|
|
272
|
-
[toolId]: state
|
|
273
|
-
})),
|
|
340
|
+
setState: t14,
|
|
274
341
|
hintId
|
|
275
342
|
};
|
|
276
343
|
const ratioList = intl.formatList(ratios, { type: "disjunction" });
|
|
277
344
|
let problem = null;
|
|
278
345
|
if (cropRequired && transform.crop === void 0) problem = ratios.length > 0 ? intl.formatMessage(mediaMessages.editorCropRequiredRatios, { ratios: ratioList }) : intl.formatMessage(mediaMessages.editorCropRequired);
|
|
279
346
|
else if (enforceRatios && ratios.length > 0 && transform.crop !== void 0 && !ratios.some((ratio) => matchesRatio(crop.width, crop.height, ratio))) problem = intl.formatMessage(mediaMessages.editorCropRatios, { ratios: ratioList });
|
|
280
|
-
for (const candidate_0 of tools) problem
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
347
|
+
for (const candidate_0 of tools) if (problem === null) problem = candidate_0.validate?.(transform) ?? null;
|
|
348
|
+
let t15;
|
|
349
|
+
if ($[24] !== base_1 || $[25] !== own || $[26] !== transform) {
|
|
350
|
+
t15 = () => {
|
|
351
|
+
const edits_0 = cleanEdits(transform);
|
|
352
|
+
if (Object.keys(edits_0).length === 0) return null;
|
|
353
|
+
return base_1 === "media" && own !== null ? {
|
|
354
|
+
base: "media",
|
|
355
|
+
baseTransform: own,
|
|
356
|
+
...edits_0
|
|
357
|
+
} : edits_0;
|
|
358
|
+
};
|
|
359
|
+
$[24] = base_1;
|
|
360
|
+
$[25] = own;
|
|
361
|
+
$[26] = transform;
|
|
362
|
+
$[27] = t15;
|
|
363
|
+
} else t15 = $[27];
|
|
364
|
+
const result = t15;
|
|
365
|
+
let t16;
|
|
366
|
+
if ($[28] !== baseLabelId || $[29] !== base_1 || $[30] !== canChooseBase || $[31] !== intl || $[32] !== own || $[33] !== setTransform) {
|
|
367
|
+
t16 = canChooseBase && own !== null ? /* @__PURE__ */ jsxs("div", {
|
|
293
368
|
className: ImageEditor_module_default.baseChoice,
|
|
294
369
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
295
370
|
as: "span",
|
|
@@ -313,17 +388,235 @@ function useImageEditor({ image, value, base: newBase, canChooseBase = false, to
|
|
|
313
388
|
label: intl.formatMessage(mediaMessages.editorBaseOriginal)
|
|
314
389
|
}]
|
|
315
390
|
})]
|
|
316
|
-
}) : null
|
|
391
|
+
}) : null;
|
|
392
|
+
$[28] = baseLabelId;
|
|
393
|
+
$[29] = base_1;
|
|
394
|
+
$[30] = canChooseBase;
|
|
395
|
+
$[31] = intl;
|
|
396
|
+
$[32] = own;
|
|
397
|
+
$[33] = setTransform;
|
|
398
|
+
$[34] = t16;
|
|
399
|
+
} else t16 = $[34];
|
|
400
|
+
let t17;
|
|
401
|
+
if ($[35] !== intl || $[36] !== start.changed) {
|
|
402
|
+
t17 = start.changed ? /* @__PURE__ */ jsx(Alert, {
|
|
403
|
+
tone: "warning",
|
|
404
|
+
title: intl.formatMessage(mediaMessages.editorMediaChangedTitle),
|
|
405
|
+
children: intl.formatMessage(mediaMessages.editorMediaChanged)
|
|
406
|
+
}) : null;
|
|
407
|
+
$[35] = intl;
|
|
408
|
+
$[36] = start.changed;
|
|
409
|
+
$[37] = t17;
|
|
410
|
+
} else t17 = $[37];
|
|
411
|
+
let t18;
|
|
412
|
+
if ($[38] !== image.label || $[39] !== intl) {
|
|
413
|
+
t18 = intl.formatMessage(mediaMessages.editorCanvas, { name: image.label });
|
|
414
|
+
$[38] = image.label;
|
|
415
|
+
$[39] = intl;
|
|
416
|
+
$[40] = t18;
|
|
417
|
+
} else t18 = $[40];
|
|
418
|
+
const t19 = `M0 0 H${String(view_0.width)} V${String(view_0.height)} H0 Z M${String(crop.x)} ${String(crop.y)} V${String(crop.y + crop.height)} H${String(crop.x + crop.width)} V${String(crop.y)} Z`;
|
|
419
|
+
let t20;
|
|
420
|
+
if ($[41] !== t19) {
|
|
421
|
+
t20 = /* @__PURE__ */ jsx("path", {
|
|
422
|
+
d: t19,
|
|
423
|
+
className: ImageEditor_module_default.dim,
|
|
424
|
+
fillRule: "evenodd"
|
|
425
|
+
});
|
|
426
|
+
$[41] = t19;
|
|
427
|
+
$[42] = t20;
|
|
428
|
+
} else t20 = $[42];
|
|
429
|
+
let t21;
|
|
430
|
+
if ($[43] !== base_1 || $[44] !== intl || $[45] !== own) {
|
|
431
|
+
t21 = own !== null ? /* @__PURE__ */ jsx(Alert, {
|
|
432
|
+
tone: "info",
|
|
433
|
+
className: ImageEditor_module_default.baseNote,
|
|
434
|
+
children: intl.formatMessage(base_1 === "media" ? mediaMessages.editorBaseMediaNote : mediaMessages.editorBaseOriginalNote)
|
|
435
|
+
}) : null;
|
|
436
|
+
$[43] = base_1;
|
|
437
|
+
$[44] = intl;
|
|
438
|
+
$[45] = own;
|
|
439
|
+
$[46] = t21;
|
|
440
|
+
} else t21 = $[46];
|
|
441
|
+
const t22 = ImageEditor_module_default;
|
|
442
|
+
let t23;
|
|
443
|
+
if ($[47] !== intl) {
|
|
444
|
+
t23 = intl.formatMessage(mediaMessages.editorResult);
|
|
445
|
+
$[47] = intl;
|
|
446
|
+
$[48] = t23;
|
|
447
|
+
} else t23 = $[48];
|
|
448
|
+
let t24;
|
|
449
|
+
if ($[49] !== t23) {
|
|
450
|
+
t24 = /* @__PURE__ */ jsx(Text, {
|
|
451
|
+
size: "sm",
|
|
452
|
+
weight: "medium",
|
|
453
|
+
children: t23
|
|
454
|
+
});
|
|
455
|
+
$[49] = t23;
|
|
456
|
+
$[50] = t24;
|
|
457
|
+
} else t24 = $[50];
|
|
458
|
+
const T0 = Text;
|
|
459
|
+
const t25 = "sm";
|
|
460
|
+
const t26 = true;
|
|
461
|
+
const t27 = true;
|
|
462
|
+
const t28 = intl.formatMessage(mediaMessages.editorResultSize, {
|
|
463
|
+
width: Math.round(crop.width),
|
|
464
|
+
height: Math.round(crop.height),
|
|
465
|
+
ratio: ratioLabel(crop.width, crop.height)
|
|
466
|
+
});
|
|
467
|
+
let t29;
|
|
468
|
+
if ($[51] !== T0 || $[52] !== t28) {
|
|
469
|
+
t29 = /* @__PURE__ */ jsx(T0, {
|
|
470
|
+
size: t25,
|
|
471
|
+
muted: t26,
|
|
472
|
+
numeric: t27,
|
|
473
|
+
children: t28
|
|
474
|
+
});
|
|
475
|
+
$[51] = T0;
|
|
476
|
+
$[52] = t28;
|
|
477
|
+
$[53] = t29;
|
|
478
|
+
} else t29 = $[53];
|
|
479
|
+
let t30;
|
|
480
|
+
if ($[54] !== t22.resultText || $[55] !== t24 || $[56] !== t29) {
|
|
481
|
+
t30 = /* @__PURE__ */ jsxs("div", {
|
|
482
|
+
className: t22.resultText,
|
|
483
|
+
children: [t24, t29]
|
|
484
|
+
});
|
|
485
|
+
$[54] = t22.resultText;
|
|
486
|
+
$[55] = t24;
|
|
487
|
+
$[56] = t29;
|
|
488
|
+
$[57] = t30;
|
|
489
|
+
} else t30 = $[57];
|
|
490
|
+
let t31;
|
|
491
|
+
if ($[58] !== intl || $[59] !== onBack) {
|
|
492
|
+
t31 = onBack !== void 0 ? /* @__PURE__ */ jsx(Button, {
|
|
493
|
+
variant: "ghost",
|
|
494
|
+
icon: ArrowLeft,
|
|
495
|
+
onPress: onBack,
|
|
496
|
+
children: intl.formatMessage(mediaMessages.editorBack)
|
|
497
|
+
}) : null;
|
|
498
|
+
$[58] = intl;
|
|
499
|
+
$[59] = onBack;
|
|
500
|
+
$[60] = t31;
|
|
501
|
+
} else t31 = $[60];
|
|
502
|
+
let t32;
|
|
503
|
+
if ($[61] !== setTransform) {
|
|
504
|
+
t32 = () => setTransform({});
|
|
505
|
+
$[61] = setTransform;
|
|
506
|
+
$[62] = t32;
|
|
507
|
+
} else t32 = $[62];
|
|
508
|
+
let t33;
|
|
509
|
+
if ($[63] !== intl) {
|
|
510
|
+
t33 = intl.formatMessage(mediaMessages.editorReset);
|
|
511
|
+
$[63] = intl;
|
|
512
|
+
$[64] = t33;
|
|
513
|
+
} else t33 = $[64];
|
|
514
|
+
let t34;
|
|
515
|
+
if ($[65] !== t32 || $[66] !== t33) {
|
|
516
|
+
t34 = /* @__PURE__ */ jsx(Button, {
|
|
517
|
+
variant: "ghost",
|
|
518
|
+
icon: Undo2,
|
|
519
|
+
className: ImageEditor_module_default.reset,
|
|
520
|
+
onPress: t32,
|
|
521
|
+
children: t33
|
|
522
|
+
});
|
|
523
|
+
$[65] = t32;
|
|
524
|
+
$[66] = t33;
|
|
525
|
+
$[67] = t34;
|
|
526
|
+
} else t34 = $[67];
|
|
527
|
+
let t35;
|
|
528
|
+
if ($[68] !== problem || $[69] !== problemId) {
|
|
529
|
+
t35 = problem !== null ? /* @__PURE__ */ jsx(Text, {
|
|
530
|
+
as: "span",
|
|
531
|
+
size: "sm",
|
|
532
|
+
tone: "danger",
|
|
533
|
+
id: problemId,
|
|
534
|
+
children: problem
|
|
535
|
+
}) : null;
|
|
536
|
+
$[68] = problem;
|
|
537
|
+
$[69] = problemId;
|
|
538
|
+
$[70] = t35;
|
|
539
|
+
} else t35 = $[70];
|
|
540
|
+
let t36;
|
|
541
|
+
if ($[71] !== intl || $[72] !== onCancel) {
|
|
542
|
+
t36 = onCancel !== void 0 ? /* @__PURE__ */ jsx(Button, {
|
|
543
|
+
onPress: onCancel,
|
|
544
|
+
className: ImageEditor_module_default.cancel,
|
|
545
|
+
children: intl.formatMessage(mediaMessages.editorCancel)
|
|
546
|
+
}) : null;
|
|
547
|
+
$[71] = intl;
|
|
548
|
+
$[72] = onCancel;
|
|
549
|
+
$[73] = t36;
|
|
550
|
+
} else t36 = $[73];
|
|
551
|
+
const t37 = problem !== null;
|
|
552
|
+
const t38 = problem !== null ? problemId : void 0;
|
|
553
|
+
let t39;
|
|
554
|
+
if ($[74] !== onApply || $[75] !== result) {
|
|
555
|
+
t39 = () => onApply(result());
|
|
556
|
+
$[74] = onApply;
|
|
557
|
+
$[75] = result;
|
|
558
|
+
$[76] = t39;
|
|
559
|
+
} else t39 = $[76];
|
|
560
|
+
let t40;
|
|
561
|
+
if ($[77] !== applyLabel || $[78] !== intl) {
|
|
562
|
+
t40 = applyLabel ?? intl.formatMessage(mediaMessages.editorApply);
|
|
563
|
+
$[77] = applyLabel;
|
|
564
|
+
$[78] = intl;
|
|
565
|
+
$[79] = t40;
|
|
566
|
+
} else t40 = $[79];
|
|
567
|
+
let t41;
|
|
568
|
+
if ($[80] !== t37 || $[81] !== t38 || $[82] !== t39 || $[83] !== t40) {
|
|
569
|
+
t41 = /* @__PURE__ */ jsx(Button, {
|
|
570
|
+
variant: "primary",
|
|
571
|
+
isDisabled: t37,
|
|
572
|
+
"aria-describedby": t38,
|
|
573
|
+
onPress: t39,
|
|
574
|
+
children: t40
|
|
575
|
+
});
|
|
576
|
+
$[80] = t37;
|
|
577
|
+
$[81] = t38;
|
|
578
|
+
$[82] = t39;
|
|
579
|
+
$[83] = t40;
|
|
580
|
+
$[84] = t41;
|
|
581
|
+
} else t41 = $[84];
|
|
582
|
+
let t42;
|
|
583
|
+
if ($[85] !== t35 || $[86] !== t36 || $[87] !== t41) {
|
|
584
|
+
t42 = /* @__PURE__ */ jsxs("span", {
|
|
585
|
+
className: ImageEditor_module_default.footerEnd,
|
|
586
|
+
children: [
|
|
587
|
+
t35,
|
|
588
|
+
t36,
|
|
589
|
+
t41
|
|
590
|
+
]
|
|
591
|
+
});
|
|
592
|
+
$[85] = t35;
|
|
593
|
+
$[86] = t36;
|
|
594
|
+
$[87] = t41;
|
|
595
|
+
$[88] = t42;
|
|
596
|
+
} else t42 = $[88];
|
|
597
|
+
let t43;
|
|
598
|
+
if ($[89] !== t31 || $[90] !== t34 || $[91] !== t42) {
|
|
599
|
+
t43 = /* @__PURE__ */ jsxs("div", {
|
|
600
|
+
className: ImageEditor_module_default.footer,
|
|
601
|
+
children: [
|
|
602
|
+
t31,
|
|
603
|
+
t34,
|
|
604
|
+
t42
|
|
605
|
+
]
|
|
606
|
+
});
|
|
607
|
+
$[89] = t31;
|
|
608
|
+
$[90] = t34;
|
|
609
|
+
$[91] = t42;
|
|
610
|
+
$[92] = t43;
|
|
611
|
+
} else t43 = $[92];
|
|
612
|
+
return {
|
|
613
|
+
baseChoice: t16,
|
|
317
614
|
content: /* @__PURE__ */ jsxs("div", {
|
|
318
615
|
className: ImageEditor_module_default.layout,
|
|
319
616
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
320
617
|
className: ImageEditor_module_default.stageColumn,
|
|
321
618
|
children: [
|
|
322
|
-
|
|
323
|
-
tone: "warning",
|
|
324
|
-
title: intl.formatMessage(mediaMessages.editorMediaChangedTitle),
|
|
325
|
-
children: intl.formatMessage(mediaMessages.editorMediaChanged)
|
|
326
|
-
}) : null,
|
|
619
|
+
t17,
|
|
327
620
|
/* @__PURE__ */ jsx("div", {
|
|
328
621
|
className: ImageEditor_module_default.stage,
|
|
329
622
|
children: /* @__PURE__ */ jsxs("svg", {
|
|
@@ -331,14 +624,10 @@ function useImageEditor({ image, value, base: newBase, canChooseBase = false, to
|
|
|
331
624
|
className: ImageEditor_module_default.canvas,
|
|
332
625
|
viewBox: `0 0 ${String(view_0.width)} ${String(view_0.height)}`,
|
|
333
626
|
role: "group",
|
|
334
|
-
"aria-label":
|
|
627
|
+
"aria-label": t18,
|
|
335
628
|
children: [
|
|
336
629
|
drawing,
|
|
337
|
-
|
|
338
|
-
d: `M0 0 H${String(view_0.width)} V${String(view_0.height)} H0 Z M${String(crop.x)} ${String(crop.y)} V${String(crop.y + crop.height)} H${String(crop.x + crop.width)} V${String(crop.y)} Z`,
|
|
339
|
-
className: ImageEditor_module_default.dim,
|
|
340
|
-
fillRule: "evenodd"
|
|
341
|
-
}),
|
|
630
|
+
t20,
|
|
342
631
|
tool?.id !== "crop" ? /* @__PURE__ */ jsx("rect", {
|
|
343
632
|
x: crop.x,
|
|
344
633
|
y: crop.y,
|
|
@@ -366,17 +655,9 @@ function useImageEditor({ image, value, base: newBase, canChooseBase = false, to
|
|
|
366
655
|
fullWidth: true,
|
|
367
656
|
value: tool?.id,
|
|
368
657
|
onChange: setToolId,
|
|
369
|
-
options: tools.map(
|
|
370
|
-
value: candidate_1.id,
|
|
371
|
-
label: candidate_1.label,
|
|
372
|
-
icon: candidate_1.icon
|
|
373
|
-
}))
|
|
374
|
-
}) : null,
|
|
375
|
-
own !== null ? /* @__PURE__ */ jsx(Alert, {
|
|
376
|
-
tone: "info",
|
|
377
|
-
className: ImageEditor_module_default.baseNote,
|
|
378
|
-
children: intl.formatMessage(base_1 === "media" ? mediaMessages.editorBaseMediaNote : mediaMessages.editorBaseOriginalNote)
|
|
658
|
+
options: tools.map(_temp)
|
|
379
659
|
}) : null,
|
|
660
|
+
t21,
|
|
380
661
|
start.proposed && tool?.id === "crop" ? /* @__PURE__ */ jsx(Text, {
|
|
381
662
|
size: "sm",
|
|
382
663
|
children: intl.formatMessage(mediaMessages.editorCropProposed)
|
|
@@ -390,69 +671,19 @@ function useImageEditor({ image, value, base: newBase, canChooseBase = false, to
|
|
|
390
671
|
viewBox: viewBox(crop),
|
|
391
672
|
className: ImageEditor_module_default.resultImage,
|
|
392
673
|
children: drawing
|
|
393
|
-
}),
|
|
394
|
-
className: ImageEditor_module_default.resultText,
|
|
395
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
396
|
-
size: "sm",
|
|
397
|
-
weight: "medium",
|
|
398
|
-
children: intl.formatMessage(mediaMessages.editorResult)
|
|
399
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
400
|
-
size: "sm",
|
|
401
|
-
muted: true,
|
|
402
|
-
numeric: true,
|
|
403
|
-
children: intl.formatMessage(mediaMessages.editorResultSize, {
|
|
404
|
-
width: Math.round(crop.width),
|
|
405
|
-
height: Math.round(crop.height),
|
|
406
|
-
ratio: ratioLabel(crop.width, crop.height)
|
|
407
|
-
})
|
|
408
|
-
})]
|
|
409
|
-
})]
|
|
674
|
+
}), t30]
|
|
410
675
|
})
|
|
411
676
|
]
|
|
412
677
|
})]
|
|
413
678
|
}),
|
|
414
|
-
actions:
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}) : null,
|
|
423
|
-
/* @__PURE__ */ jsx(Button, {
|
|
424
|
-
variant: "ghost",
|
|
425
|
-
icon: Undo2,
|
|
426
|
-
className: ImageEditor_module_default.reset,
|
|
427
|
-
onPress: () => setTransform({}),
|
|
428
|
-
children: intl.formatMessage(mediaMessages.editorReset)
|
|
429
|
-
}),
|
|
430
|
-
/* @__PURE__ */ jsxs("span", {
|
|
431
|
-
className: ImageEditor_module_default.footerEnd,
|
|
432
|
-
children: [
|
|
433
|
-
problem !== null ? /* @__PURE__ */ jsx(Text, {
|
|
434
|
-
as: "span",
|
|
435
|
-
size: "sm",
|
|
436
|
-
tone: "danger",
|
|
437
|
-
id: problemId,
|
|
438
|
-
children: problem
|
|
439
|
-
}) : null,
|
|
440
|
-
onCancel !== void 0 ? /* @__PURE__ */ jsx(Button, {
|
|
441
|
-
onPress: onCancel,
|
|
442
|
-
className: ImageEditor_module_default.cancel,
|
|
443
|
-
children: intl.formatMessage(mediaMessages.editorCancel)
|
|
444
|
-
}) : null,
|
|
445
|
-
/* @__PURE__ */ jsx(Button, {
|
|
446
|
-
variant: "primary",
|
|
447
|
-
isDisabled: problem !== null,
|
|
448
|
-
"aria-describedby": problem !== null ? problemId : void 0,
|
|
449
|
-
onPress: () => onApply(result()),
|
|
450
|
-
children: applyLabel ?? intl.formatMessage(mediaMessages.editorApply)
|
|
451
|
-
})
|
|
452
|
-
]
|
|
453
|
-
})
|
|
454
|
-
]
|
|
455
|
-
})
|
|
679
|
+
actions: t43
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function _temp(candidate_1) {
|
|
683
|
+
return {
|
|
684
|
+
value: candidate_1.id,
|
|
685
|
+
label: candidate_1.label,
|
|
686
|
+
icon: candidate_1.icon
|
|
456
687
|
};
|
|
457
688
|
}
|
|
458
689
|
//#endregion
|