@pixerate/editor-react 0.71.0 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-63FQB5BT.js → chunk-YAFNCBDA.js} +54 -6
- package/dist/chunk-YAFNCBDA.js.map +1 -0
- package/dist/image-editor/index.cjs +40 -4
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +3 -0
- package/dist/image-editor/index.d.ts +3 -0
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +40 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-63FQB5BT.js.map +0 -1
|
@@ -1256,7 +1256,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
1256
1256
|
(0, import_react7.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1257
1257
|
const [error, setError] = (0, import_react7.useState)(null);
|
|
1258
1258
|
const state = controller.getState();
|
|
1259
|
-
const { brush, foreground, background, mixer, mixerLoad } = state.paint;
|
|
1259
|
+
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource } = state.paint;
|
|
1260
|
+
const tool = state.activeTool;
|
|
1260
1261
|
const attempt = (fn) => {
|
|
1261
1262
|
try {
|
|
1262
1263
|
setError(null);
|
|
@@ -1266,12 +1267,12 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
1266
1267
|
}
|
|
1267
1268
|
};
|
|
1268
1269
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
1269
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor8.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor8.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1270
1271
|
"button",
|
|
1271
1272
|
{
|
|
1272
1273
|
type: "button",
|
|
1273
1274
|
"aria-pressed": state.activeTool === t.id,
|
|
1274
|
-
title: `${t.label} (${t.shortcut})
|
|
1275
|
+
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
1275
1276
|
className: chip(state.activeTool === t.id),
|
|
1276
1277
|
onClick: () => controller.setTool(t.id),
|
|
1277
1278
|
children: t.label
|
|
@@ -1373,6 +1374,41 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
1373
1374
|
] })
|
|
1374
1375
|
] })
|
|
1375
1376
|
] }),
|
|
1377
|
+
(0, import_image_editor8.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
1378
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", "data-testid": "clone-source", children: (0, import_image_editor8.cloneSourceLabel)(controller) }),
|
|
1380
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", title: "Forget the source point", className: chip(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
1381
|
+
] }),
|
|
1382
|
+
import_image_editor8.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: choice.label }),
|
|
1384
|
+
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1385
|
+
"button",
|
|
1386
|
+
{
|
|
1387
|
+
type: "button",
|
|
1388
|
+
"aria-pressed": retouch[choice.id] === o.id,
|
|
1389
|
+
title: o.title,
|
|
1390
|
+
className: chip(retouch[choice.id] === o.id),
|
|
1391
|
+
onClick: () => (0, import_image_editor8.setRetouchChoice)(controller, choice.id, o.id),
|
|
1392
|
+
children: o.label
|
|
1393
|
+
},
|
|
1394
|
+
o.id
|
|
1395
|
+
))
|
|
1396
|
+
] }, choice.id)),
|
|
1397
|
+
import_image_editor8.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: import_image_editor8.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1400
|
+
"input",
|
|
1401
|
+
{
|
|
1402
|
+
type: "checkbox",
|
|
1403
|
+
"aria-label": t.label,
|
|
1404
|
+
checked: retouch[t.id],
|
|
1405
|
+
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
1406
|
+
className: "accent-indigo-500"
|
|
1407
|
+
}
|
|
1408
|
+
),
|
|
1409
|
+
t.label
|
|
1410
|
+
] }, t.id)) })
|
|
1411
|
+
] }),
|
|
1376
1412
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", role: "group", "aria-label": "Pressure", children: [
|
|
1377
1413
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
1378
1414
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -2331,7 +2367,7 @@ var ImageEditor = ({
|
|
|
2331
2367
|
} catch {
|
|
2332
2368
|
}
|
|
2333
2369
|
const [first] = paintSamples(e);
|
|
2334
|
-
setPaintError(paintGestureRef.current.down(first));
|
|
2370
|
+
setPaintError(paintGestureRef.current.down({ ...first, altKey: e.altKey }));
|
|
2335
2371
|
};
|
|
2336
2372
|
const handlePaintPointerMove = (e) => {
|
|
2337
2373
|
if (handleTransformPointerMove(e)) return;
|