@pixerate/editor-react 0.64.0 → 0.65.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-M4WLX3IR.js → chunk-OSBDCFF4.js} +404 -194
- package/dist/chunk-OSBDCFF4.js.map +1 -0
- package/dist/image-editor/index.cjs +441 -232
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +14 -2
- package/dist/image-editor/index.d.ts +14 -2
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +870 -661
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-M4WLX3IR.js.map +0 -1
|
@@ -159,7 +159,7 @@ function useImageEditor(options = {}) {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
// src/image-editor/ImageEditor.tsx
|
|
162
|
-
import
|
|
162
|
+
import React10, { useRef as useRef5, useEffect as useEffect8, useState as useState11, useCallback as useCallback2 } from "react";
|
|
163
163
|
import {
|
|
164
164
|
canvasToImagePoint,
|
|
165
165
|
hitTestCrop,
|
|
@@ -174,7 +174,9 @@ import {
|
|
|
174
174
|
SelectionGesture,
|
|
175
175
|
PaintGesture,
|
|
176
176
|
handlePaintShortcut,
|
|
177
|
-
pointerPressure
|
|
177
|
+
pointerPressure,
|
|
178
|
+
FreeTransformTool,
|
|
179
|
+
getViewportProjection
|
|
178
180
|
} from "@pixerate/editor/image-editor";
|
|
179
181
|
|
|
180
182
|
// src/image-editor/ControlSlider.tsx
|
|
@@ -1125,6 +1127,22 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1125
1127
|
children: layerBadge(layer)
|
|
1126
1128
|
}
|
|
1127
1129
|
),
|
|
1130
|
+
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx6(
|
|
1131
|
+
"button",
|
|
1132
|
+
{
|
|
1133
|
+
type: "button",
|
|
1134
|
+
"aria-label": `${layer.mask.linked === false ? "Link" : "Unlink"} ${row.label} mask`,
|
|
1135
|
+
"aria-pressed": layer.mask.linked !== false,
|
|
1136
|
+
title: layer.mask.linked === false ? "Mask unlinked: it stays put when the layer moves or transforms. Click to link." : "Mask linked: it moves with the layer. Click to unlink.",
|
|
1137
|
+
"data-testid": "layer-mask-link",
|
|
1138
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-slate-600" : "text-slate-300"}`,
|
|
1139
|
+
onClick: (e) => {
|
|
1140
|
+
e.stopPropagation();
|
|
1141
|
+
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
1142
|
+
},
|
|
1143
|
+
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
1144
|
+
}
|
|
1145
|
+
),
|
|
1128
1146
|
layer.mask && /* @__PURE__ */ jsx6(
|
|
1129
1147
|
Thumbnail,
|
|
1130
1148
|
{
|
|
@@ -1646,8 +1664,83 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
1646
1664
|
] });
|
|
1647
1665
|
};
|
|
1648
1666
|
|
|
1667
|
+
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
1668
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1669
|
+
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS } from "@pixerate/editor/image-editor";
|
|
1670
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1671
|
+
var chip2 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
1672
|
+
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
1673
|
+
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
1674
|
+
const [, setTick] = useState10(0);
|
|
1675
|
+
useEffect7(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
1676
|
+
const bar = tool.bar();
|
|
1677
|
+
if (!tool.active || !bar) return null;
|
|
1678
|
+
const apply = (field, raw) => {
|
|
1679
|
+
const v = Number(raw);
|
|
1680
|
+
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
1681
|
+
};
|
|
1682
|
+
return /* @__PURE__ */ jsxs10("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
1683
|
+
/* @__PURE__ */ jsx10("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx10("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip2(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
1684
|
+
/* @__PURE__ */ jsx10("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
|
|
1685
|
+
FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
1686
|
+
/* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: f.label }),
|
|
1687
|
+
/* @__PURE__ */ jsx10(
|
|
1688
|
+
"input",
|
|
1689
|
+
{
|
|
1690
|
+
type: "number",
|
|
1691
|
+
"aria-label": f.title,
|
|
1692
|
+
defaultValue: round(bar[f.id], f.unit),
|
|
1693
|
+
disabled: !bar.affine,
|
|
1694
|
+
step: f.unit === "px" ? 1 : 0.1,
|
|
1695
|
+
className: "w-16 rounded border border-slate-700 bg-slate-900 px-1 py-0.5 text-right disabled:opacity-40",
|
|
1696
|
+
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
1697
|
+
onKeyDown: (e) => {
|
|
1698
|
+
if (e.key === "Enter") {
|
|
1699
|
+
e.preventDefault();
|
|
1700
|
+
e.stopPropagation();
|
|
1701
|
+
apply(f.id, e.currentTarget.value);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
1706
|
+
),
|
|
1707
|
+
/* @__PURE__ */ jsx10("span", { className: "text-slate-500", children: f.unit }),
|
|
1708
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx10(
|
|
1709
|
+
"button",
|
|
1710
|
+
{
|
|
1711
|
+
type: "button",
|
|
1712
|
+
"aria-label": "Keep width and height proportional",
|
|
1713
|
+
"aria-pressed": tool.proportional,
|
|
1714
|
+
className: chip2(tool.proportional),
|
|
1715
|
+
onClick: () => {
|
|
1716
|
+
tool.proportional = !tool.proportional;
|
|
1717
|
+
setTick((n) => n + 1);
|
|
1718
|
+
},
|
|
1719
|
+
children: "\u26D3\uFE0E"
|
|
1720
|
+
}
|
|
1721
|
+
)
|
|
1722
|
+
] }, f.id)),
|
|
1723
|
+
/* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
|
|
1724
|
+
/* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Interpolation" }),
|
|
1725
|
+
/* @__PURE__ */ jsx10(
|
|
1726
|
+
"select",
|
|
1727
|
+
{
|
|
1728
|
+
"aria-label": "Interpolation",
|
|
1729
|
+
value: tool.interpolation,
|
|
1730
|
+
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
1731
|
+
className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
|
|
1732
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx10("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
1733
|
+
}
|
|
1734
|
+
)
|
|
1735
|
+
] }),
|
|
1736
|
+
/* @__PURE__ */ jsx10("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-emerald-600 text-white hover:bg-emerald-500", onClick: () => tool.commit(), children: "Commit" }),
|
|
1737
|
+
/* @__PURE__ */ jsx10("button", { type: "button", title: "Cancel (Esc)", className: chip2(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
1738
|
+
tool.error && /* @__PURE__ */ jsx10("span", { role: "alert", className: "text-rose-400", children: tool.error })
|
|
1739
|
+
] });
|
|
1740
|
+
};
|
|
1741
|
+
|
|
1649
1742
|
// src/image-editor/ImageEditor.tsx
|
|
1650
|
-
import { Fragment as Fragment3, jsx as
|
|
1743
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1651
1744
|
var ImageEditor = ({
|
|
1652
1745
|
editor: externalEditor,
|
|
1653
1746
|
src,
|
|
@@ -1665,9 +1758,9 @@ var ImageEditor = ({
|
|
|
1665
1758
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
1666
1759
|
const canvasRef = useRef5(null);
|
|
1667
1760
|
const containerRef = useRef5(null);
|
|
1668
|
-
const [activeTab, setActiveTab] =
|
|
1669
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
1670
|
-
const [selectionOptions, setSelectionOptions] =
|
|
1761
|
+
const [activeTab, setActiveTab] = useState11("crop");
|
|
1762
|
+
const [activeCropRatio, setActiveCropRatio] = useState11(null);
|
|
1763
|
+
const [selectionOptions, setSelectionOptions] = useState11(DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
1671
1764
|
const selectionOptionsRef = useRef5(selectionOptions);
|
|
1672
1765
|
selectionOptionsRef.current = selectionOptions;
|
|
1673
1766
|
const selectionGestureRef = useRef5(null);
|
|
@@ -1675,7 +1768,7 @@ var ImageEditor = ({
|
|
|
1675
1768
|
selectionGestureRef.current = new SelectionGesture(controller, () => selectionOptionsRef.current);
|
|
1676
1769
|
}
|
|
1677
1770
|
const selectionDraftRef = useRef5(null);
|
|
1678
|
-
const [selectionError, setSelectionError] =
|
|
1771
|
+
const [selectionError, setSelectionError] = useState11(null);
|
|
1679
1772
|
const paintGestureRef = useRef5(null);
|
|
1680
1773
|
const paintControllerRef = useRef5(controller);
|
|
1681
1774
|
if (!paintGestureRef.current || paintControllerRef.current !== controller) {
|
|
@@ -1683,14 +1776,26 @@ var ImageEditor = ({
|
|
|
1683
1776
|
paintControllerRef.current = controller;
|
|
1684
1777
|
}
|
|
1685
1778
|
const brushCursorRef = useRef5(null);
|
|
1686
|
-
const [paintError, setPaintError] =
|
|
1687
|
-
const
|
|
1688
|
-
const
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1779
|
+
const [paintError, setPaintError] = useState11(null);
|
|
1780
|
+
const transformToolRef = useRef5(null);
|
|
1781
|
+
const transformControllerRef = useRef5(controller);
|
|
1782
|
+
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
1783
|
+
transformToolRef.current?.cancel();
|
|
1784
|
+
transformToolRef.current = new FreeTransformTool(controller, {
|
|
1785
|
+
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
1786
|
+
});
|
|
1787
|
+
transformControllerRef.current = controller;
|
|
1788
|
+
}
|
|
1789
|
+
const transformTool = transformToolRef.current;
|
|
1790
|
+
const [, setTransformTick] = useState11(0);
|
|
1791
|
+
const [transformCursor, setTransformCursor] = useState11("default");
|
|
1792
|
+
const [inpaintPrompt, setInpaintPrompt] = useState11("");
|
|
1793
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState11("annotations");
|
|
1794
|
+
const [isRemovingBg, setIsRemovingBg] = useState11(false);
|
|
1795
|
+
const [isInpainting, setIsInpainting] = useState11(false);
|
|
1796
|
+
const [aiError, setAiError] = useState11(null);
|
|
1797
|
+
const [aiSuccess, setAiSuccess] = useState11(null);
|
|
1798
|
+
const [aiTarget, setAiTarget] = useState11("auto");
|
|
1694
1799
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
1695
1800
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
1696
1801
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -1753,10 +1858,10 @@ var ImageEditor = ({
|
|
|
1753
1858
|
setIsInpainting(false);
|
|
1754
1859
|
}
|
|
1755
1860
|
};
|
|
1756
|
-
const [activeColor, setActiveColor] =
|
|
1757
|
-
const [strokeWidth, setStrokeWidth] =
|
|
1758
|
-
const [fontSize, setFontSize] =
|
|
1759
|
-
const [textInput, setTextInput] =
|
|
1861
|
+
const [activeColor, setActiveColor] = useState11("#ef4444");
|
|
1862
|
+
const [strokeWidth, setStrokeWidth] = useState11(3);
|
|
1863
|
+
const [fontSize, setFontSize] = useState11(24);
|
|
1864
|
+
const [textInput, setTextInput] = useState11("");
|
|
1760
1865
|
const draftAnnotationRef = useRef5(null);
|
|
1761
1866
|
const draftCropRef = useRef5(null);
|
|
1762
1867
|
const cropDragInfoRef = useRef5(null);
|
|
@@ -1780,12 +1885,64 @@ var ImageEditor = ({
|
|
|
1780
1885
|
draftAnnotation: draftAnnotation !== void 0 ? draftAnnotation : draftAnnotationRef.current,
|
|
1781
1886
|
draftCrop: draftCrop !== void 0 ? draftCrop : draftCropRef.current,
|
|
1782
1887
|
draftSelectionPath: selectionDraftRef.current,
|
|
1783
|
-
brushCursor: activeTab === "paint" && brushCursorRef.current && controller.getState().activeTool !== "move" ? { ...brushCursorRef.current, diameter: controller.getState().paint.brush.size } : null
|
|
1888
|
+
brushCursor: activeTab === "paint" && brushCursorRef.current && controller.getState().activeTool !== "move" && !transformTool.active ? { ...brushCursorRef.current, diameter: controller.getState().paint.brush.size } : null,
|
|
1889
|
+
freeTransform: transformTool.overlay()
|
|
1784
1890
|
});
|
|
1785
1891
|
},
|
|
1786
|
-
[controller, activeTab]
|
|
1892
|
+
[controller, activeTab, transformTool]
|
|
1787
1893
|
);
|
|
1788
|
-
|
|
1894
|
+
useEffect8(() => transformTool.subscribe(() => {
|
|
1895
|
+
setTransformTick((n) => n + 1);
|
|
1896
|
+
void renderCanvas();
|
|
1897
|
+
}), [transformTool, renderCanvas]);
|
|
1898
|
+
const transformPoint = (e) => {
|
|
1899
|
+
const canvas = canvasRef.current;
|
|
1900
|
+
const rect = canvas.getBoundingClientRect();
|
|
1901
|
+
const sx = rect.width > 0 ? canvas.width / rect.width : 1;
|
|
1902
|
+
const sy = rect.height > 0 ? canvas.height / rect.height : 1;
|
|
1903
|
+
const s = controller.getState();
|
|
1904
|
+
const cropping = activeTab === "crop";
|
|
1905
|
+
const projection = getViewportProjection(s, canvas.width, canvas.height, cropping);
|
|
1906
|
+
const pt = canvasToImagePoint({ x: (e.clientX - rect.left) * sx, y: (e.clientY - rect.top) * sy }, s, canvas.width, canvas.height, cropping);
|
|
1907
|
+
transformTool.setView(projection.scale);
|
|
1908
|
+
return { pt, tolerance: 6 / (projection.scale || 1) };
|
|
1909
|
+
};
|
|
1910
|
+
const handleTransformPointerDown = (e) => {
|
|
1911
|
+
if (!transformTool.active) return false;
|
|
1912
|
+
if (e.button !== 0) return true;
|
|
1913
|
+
e.preventDefault();
|
|
1914
|
+
try {
|
|
1915
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
1916
|
+
} catch {
|
|
1917
|
+
}
|
|
1918
|
+
const { pt, tolerance } = transformPoint(e);
|
|
1919
|
+
transformTool.down(pt, tolerance);
|
|
1920
|
+
return true;
|
|
1921
|
+
};
|
|
1922
|
+
const handleTransformPointerMove = (e) => {
|
|
1923
|
+
if (!transformTool.active) return false;
|
|
1924
|
+
const { pt, tolerance } = transformPoint(e);
|
|
1925
|
+
if (e.buttons & 1) transformTool.move(pt, e);
|
|
1926
|
+
else {
|
|
1927
|
+
const over = transformTool.hit(pt, tolerance);
|
|
1928
|
+
setTransformCursor(transformTool.cursor(over));
|
|
1929
|
+
}
|
|
1930
|
+
return true;
|
|
1931
|
+
};
|
|
1932
|
+
const handleTransformPointerUp = () => {
|
|
1933
|
+
if (!transformTool.active) return false;
|
|
1934
|
+
transformTool.up();
|
|
1935
|
+
return true;
|
|
1936
|
+
};
|
|
1937
|
+
useEffect8(() => {
|
|
1938
|
+
if (typeof window === "undefined") return;
|
|
1939
|
+
const onKey = (e) => {
|
|
1940
|
+
if (transformTool.key(e)) e.preventDefault();
|
|
1941
|
+
};
|
|
1942
|
+
window.addEventListener("keydown", onKey);
|
|
1943
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
1944
|
+
}, [transformTool]);
|
|
1945
|
+
useEffect8(() => {
|
|
1789
1946
|
const raf = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : (cb) => setTimeout(cb, 0);
|
|
1790
1947
|
const caf = typeof cancelAnimationFrame !== "undefined" ? cancelAnimationFrame : (id) => clearTimeout(id);
|
|
1791
1948
|
const animId = raf(() => {
|
|
@@ -1793,12 +1950,12 @@ var ImageEditor = ({
|
|
|
1793
1950
|
});
|
|
1794
1951
|
return () => caf(animId);
|
|
1795
1952
|
}, [renderCanvas, state]);
|
|
1796
|
-
|
|
1953
|
+
useEffect8(() => {
|
|
1797
1954
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
1798
1955
|
editor.setTool("crop");
|
|
1799
1956
|
}
|
|
1800
1957
|
}, [activeTab, editor]);
|
|
1801
|
-
|
|
1958
|
+
useEffect8(() => {
|
|
1802
1959
|
const container = containerRef.current;
|
|
1803
1960
|
if (!container) return;
|
|
1804
1961
|
if (typeof ResizeObserver !== "undefined") {
|
|
@@ -1839,6 +1996,7 @@ var ImageEditor = ({
|
|
|
1839
1996
|
}));
|
|
1840
1997
|
};
|
|
1841
1998
|
const handlePaintPointerDown = (e) => {
|
|
1999
|
+
if (handleTransformPointerDown(e)) return;
|
|
1842
2000
|
if (activeTab !== "paint" || e.button !== 0) return;
|
|
1843
2001
|
e.preventDefault();
|
|
1844
2002
|
try {
|
|
@@ -1849,6 +2007,7 @@ var ImageEditor = ({
|
|
|
1849
2007
|
setPaintError(paintGestureRef.current.down(first));
|
|
1850
2008
|
};
|
|
1851
2009
|
const handlePaintPointerMove = (e) => {
|
|
2010
|
+
if (handleTransformPointerMove(e)) return;
|
|
1852
2011
|
if (activeTab !== "paint") return;
|
|
1853
2012
|
const samples = paintSamples(e);
|
|
1854
2013
|
brushCursorRef.current = samples[samples.length - 1] ?? null;
|
|
@@ -1856,6 +2015,7 @@ var ImageEditor = ({
|
|
|
1856
2015
|
else void renderCanvas();
|
|
1857
2016
|
};
|
|
1858
2017
|
const handlePaintPointerUp = () => {
|
|
2018
|
+
if (handleTransformPointerUp()) return;
|
|
1859
2019
|
if (activeTab !== "paint") return;
|
|
1860
2020
|
const g = paintGestureRef.current;
|
|
1861
2021
|
if (g.active) {
|
|
@@ -1863,7 +2023,7 @@ var ImageEditor = ({
|
|
|
1863
2023
|
if (g.error) setPaintError(g.error);
|
|
1864
2024
|
}
|
|
1865
2025
|
};
|
|
1866
|
-
|
|
2026
|
+
useEffect8(() => {
|
|
1867
2027
|
if (activeTab !== "paint" || typeof window === "undefined") return;
|
|
1868
2028
|
const onKey = (e) => {
|
|
1869
2029
|
if (handlePaintShortcut(controller, e)) e.preventDefault();
|
|
@@ -1873,7 +2033,7 @@ var ImageEditor = ({
|
|
|
1873
2033
|
}, [activeTab, controller]);
|
|
1874
2034
|
const handleMouseDown = (e) => {
|
|
1875
2035
|
const canvas = canvasRef.current;
|
|
1876
|
-
if (!canvas) return;
|
|
2036
|
+
if (!canvas || transformTool.active) return;
|
|
1877
2037
|
const canvasPt = getCanvasEventPoint(e);
|
|
1878
2038
|
if (activeTab === "select") {
|
|
1879
2039
|
const gesture = selectionGestureRef.current;
|
|
@@ -1945,7 +2105,7 @@ var ImageEditor = ({
|
|
|
1945
2105
|
};
|
|
1946
2106
|
const handleMouseMove = (e) => {
|
|
1947
2107
|
const canvas = canvasRef.current;
|
|
1948
|
-
if (!canvas) return;
|
|
2108
|
+
if (!canvas || transformTool.active) return;
|
|
1949
2109
|
const canvasPt = getCanvasEventPoint(e);
|
|
1950
2110
|
if (activeTab === "select") {
|
|
1951
2111
|
const gesture = selectionGestureRef.current;
|
|
@@ -2101,7 +2261,7 @@ var ImageEditor = ({
|
|
|
2101
2261
|
};
|
|
2102
2262
|
const handleMouseUp = (e) => {
|
|
2103
2263
|
const canvas = canvasRef.current;
|
|
2104
|
-
if (!canvas) return;
|
|
2264
|
+
if (!canvas || transformTool.active) return;
|
|
2105
2265
|
const canvasPt = getCanvasEventPoint(e);
|
|
2106
2266
|
if (activeTab === "select") {
|
|
2107
2267
|
const gesture = selectionGestureRef.current;
|
|
@@ -2226,15 +2386,15 @@ var ImageEditor = ({
|
|
|
2226
2386
|
link.click();
|
|
2227
2387
|
}
|
|
2228
2388
|
};
|
|
2229
|
-
return /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ jsxs11(
|
|
2230
2390
|
"div",
|
|
2231
2391
|
{
|
|
2232
2392
|
className: `flex flex-col bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-2xl text-slate-100 ${className}`,
|
|
2233
2393
|
style,
|
|
2234
2394
|
children: [
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2395
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center justify-between px-4 py-3 bg-slate-950/80 border-b border-slate-800 gap-3", children: [
|
|
2396
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 bg-slate-900 p-1 rounded-lg border border-slate-800 text-xs", children: [
|
|
2397
|
+
/* @__PURE__ */ jsx11(
|
|
2238
2398
|
"button",
|
|
2239
2399
|
{
|
|
2240
2400
|
type: "button",
|
|
@@ -2246,7 +2406,7 @@ var ImageEditor = ({
|
|
|
2246
2406
|
children: "Transform & Crop"
|
|
2247
2407
|
}
|
|
2248
2408
|
),
|
|
2249
|
-
/* @__PURE__ */
|
|
2409
|
+
/* @__PURE__ */ jsx11(
|
|
2250
2410
|
"button",
|
|
2251
2411
|
{
|
|
2252
2412
|
type: "button",
|
|
@@ -2258,7 +2418,7 @@ var ImageEditor = ({
|
|
|
2258
2418
|
children: "Adjustments"
|
|
2259
2419
|
}
|
|
2260
2420
|
),
|
|
2261
|
-
/* @__PURE__ */
|
|
2421
|
+
/* @__PURE__ */ jsx11(
|
|
2262
2422
|
"button",
|
|
2263
2423
|
{
|
|
2264
2424
|
type: "button",
|
|
@@ -2270,7 +2430,7 @@ var ImageEditor = ({
|
|
|
2270
2430
|
children: "Layers"
|
|
2271
2431
|
}
|
|
2272
2432
|
),
|
|
2273
|
-
/* @__PURE__ */
|
|
2433
|
+
/* @__PURE__ */ jsx11(
|
|
2274
2434
|
"button",
|
|
2275
2435
|
{
|
|
2276
2436
|
type: "button",
|
|
@@ -2282,7 +2442,7 @@ var ImageEditor = ({
|
|
|
2282
2442
|
children: "Paint"
|
|
2283
2443
|
}
|
|
2284
2444
|
),
|
|
2285
|
-
/* @__PURE__ */
|
|
2445
|
+
/* @__PURE__ */ jsx11(
|
|
2286
2446
|
"button",
|
|
2287
2447
|
{
|
|
2288
2448
|
type: "button",
|
|
@@ -2294,7 +2454,7 @@ var ImageEditor = ({
|
|
|
2294
2454
|
children: "Select & Mask"
|
|
2295
2455
|
}
|
|
2296
2456
|
),
|
|
2297
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ jsx11(
|
|
2298
2458
|
"button",
|
|
2299
2459
|
{
|
|
2300
2460
|
type: "button",
|
|
@@ -2306,7 +2466,7 @@ var ImageEditor = ({
|
|
|
2306
2466
|
children: "Annotations"
|
|
2307
2467
|
}
|
|
2308
2468
|
),
|
|
2309
|
-
/* @__PURE__ */
|
|
2469
|
+
/* @__PURE__ */ jsx11(
|
|
2310
2470
|
"button",
|
|
2311
2471
|
{
|
|
2312
2472
|
type: "button",
|
|
@@ -2318,7 +2478,7 @@ var ImageEditor = ({
|
|
|
2318
2478
|
children: "Depth Mask"
|
|
2319
2479
|
}
|
|
2320
2480
|
),
|
|
2321
|
-
/* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ jsxs11(
|
|
2322
2482
|
"button",
|
|
2323
2483
|
{
|
|
2324
2484
|
type: "button",
|
|
@@ -2328,14 +2488,14 @@ var ImageEditor = ({
|
|
|
2328
2488
|
},
|
|
2329
2489
|
className: `px-3 py-1.5 rounded-md font-medium transition-colors flex items-center gap-1.5 ${activeTab === "ai" ? "bg-indigo-600 text-white shadow" : "text-slate-400 hover:text-slate-200"}`,
|
|
2330
2490
|
children: [
|
|
2331
|
-
/* @__PURE__ */
|
|
2491
|
+
/* @__PURE__ */ jsx11("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx11("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
2332
2492
|
"AI Tools"
|
|
2333
2493
|
]
|
|
2334
2494
|
}
|
|
2335
2495
|
)
|
|
2336
2496
|
] }),
|
|
2337
|
-
/* @__PURE__ */
|
|
2338
|
-
/* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
2498
|
+
/* @__PURE__ */ jsx11(
|
|
2339
2499
|
"button",
|
|
2340
2500
|
{
|
|
2341
2501
|
type: "button",
|
|
@@ -2346,7 +2506,7 @@ var ImageEditor = ({
|
|
|
2346
2506
|
children: "\u21A9"
|
|
2347
2507
|
}
|
|
2348
2508
|
),
|
|
2349
|
-
/* @__PURE__ */
|
|
2509
|
+
/* @__PURE__ */ jsx11(
|
|
2350
2510
|
"button",
|
|
2351
2511
|
{
|
|
2352
2512
|
type: "button",
|
|
@@ -2357,7 +2517,7 @@ var ImageEditor = ({
|
|
|
2357
2517
|
children: "\u21AA"
|
|
2358
2518
|
}
|
|
2359
2519
|
),
|
|
2360
|
-
/* @__PURE__ */
|
|
2520
|
+
/* @__PURE__ */ jsx11(
|
|
2361
2521
|
"button",
|
|
2362
2522
|
{
|
|
2363
2523
|
type: "button",
|
|
@@ -2366,8 +2526,8 @@ var ImageEditor = ({
|
|
|
2366
2526
|
children: "Reset"
|
|
2367
2527
|
}
|
|
2368
2528
|
),
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
|
|
2530
|
+
/* @__PURE__ */ jsx11(
|
|
2371
2531
|
"button",
|
|
2372
2532
|
{
|
|
2373
2533
|
type: "button",
|
|
@@ -2377,11 +2537,11 @@ var ImageEditor = ({
|
|
|
2377
2537
|
children: "-"
|
|
2378
2538
|
}
|
|
2379
2539
|
),
|
|
2380
|
-
/* @__PURE__ */
|
|
2540
|
+
/* @__PURE__ */ jsxs11("span", { className: "font-mono text-slate-400 w-10 text-center", children: [
|
|
2381
2541
|
Math.round(state.zoom * 100),
|
|
2382
2542
|
"%"
|
|
2383
2543
|
] }),
|
|
2384
|
-
/* @__PURE__ */
|
|
2544
|
+
/* @__PURE__ */ jsx11(
|
|
2385
2545
|
"button",
|
|
2386
2546
|
{
|
|
2387
2547
|
type: "button",
|
|
@@ -2391,8 +2551,8 @@ var ImageEditor = ({
|
|
|
2391
2551
|
children: "+"
|
|
2392
2552
|
}
|
|
2393
2553
|
),
|
|
2394
|
-
/* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2554
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
|
|
2555
|
+
/* @__PURE__ */ jsx11(
|
|
2396
2556
|
"button",
|
|
2397
2557
|
{
|
|
2398
2558
|
type: "button",
|
|
@@ -2403,7 +2563,7 @@ var ImageEditor = ({
|
|
|
2403
2563
|
children: "Hold Compare"
|
|
2404
2564
|
}
|
|
2405
2565
|
),
|
|
2406
|
-
/* @__PURE__ */
|
|
2566
|
+
/* @__PURE__ */ jsx11(
|
|
2407
2567
|
"button",
|
|
2408
2568
|
{
|
|
2409
2569
|
type: "button",
|
|
@@ -2414,13 +2574,15 @@ var ImageEditor = ({
|
|
|
2414
2574
|
)
|
|
2415
2575
|
] })
|
|
2416
2576
|
] }),
|
|
2417
|
-
/* @__PURE__ */
|
|
2418
|
-
|
|
2577
|
+
transformTool.active && /* @__PURE__ */ jsx11(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-slate-800 bg-slate-900/95 px-4 py-2" }),
|
|
2578
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx11("div", { role: "alert", className: "border-b border-rose-900 bg-rose-950/80 px-4 py-1.5 text-xs text-rose-200", children: transformTool.error }),
|
|
2579
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
2580
|
+
/* @__PURE__ */ jsx11(
|
|
2419
2581
|
"div",
|
|
2420
2582
|
{
|
|
2421
2583
|
ref: containerRef,
|
|
2422
2584
|
className: "relative flex-1 h-[360px] md:h-full min-h-[320px] bg-slate-950 overflow-hidden select-none",
|
|
2423
|
-
children: /* @__PURE__ */
|
|
2585
|
+
children: /* @__PURE__ */ jsx11(
|
|
2424
2586
|
"canvas",
|
|
2425
2587
|
{
|
|
2426
2588
|
ref: canvasRef,
|
|
@@ -2433,16 +2595,17 @@ var ImageEditor = ({
|
|
|
2433
2595
|
onPointerUp: handlePaintPointerUp,
|
|
2434
2596
|
onPointerCancel: () => paintGestureRef.current?.cancel(),
|
|
2435
2597
|
"data-testid": "image-editor-canvas",
|
|
2436
|
-
|
|
2598
|
+
style: transformTool.active ? { cursor: transformCursor } : void 0,
|
|
2599
|
+
className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : activeTab === "paint" ? "touch-none cursor-crosshair" : ""}`
|
|
2437
2600
|
}
|
|
2438
2601
|
)
|
|
2439
2602
|
}
|
|
2440
2603
|
),
|
|
2441
|
-
/* @__PURE__ */
|
|
2442
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2445
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsxs11("div", { className: "w-full md:w-80 bg-slate-900/90 border-t md:border-t-0 md:border-l border-slate-800 p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]", children: [
|
|
2605
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
2606
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Aspect Ratio Presets" }),
|
|
2607
|
+
/* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
2608
|
+
/* @__PURE__ */ jsx11(
|
|
2446
2609
|
"button",
|
|
2447
2610
|
{
|
|
2448
2611
|
type: "button",
|
|
@@ -2454,7 +2617,7 @@ var ImageEditor = ({
|
|
|
2454
2617
|
children: "Freeform"
|
|
2455
2618
|
}
|
|
2456
2619
|
),
|
|
2457
|
-
/* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ jsx11(
|
|
2458
2621
|
"button",
|
|
2459
2622
|
{
|
|
2460
2623
|
type: "button",
|
|
@@ -2466,7 +2629,7 @@ var ImageEditor = ({
|
|
|
2466
2629
|
children: "1:1 Square"
|
|
2467
2630
|
}
|
|
2468
2631
|
),
|
|
2469
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsx11(
|
|
2470
2633
|
"button",
|
|
2471
2634
|
{
|
|
2472
2635
|
type: "button",
|
|
@@ -2478,7 +2641,7 @@ var ImageEditor = ({
|
|
|
2478
2641
|
children: "4:3 Standard"
|
|
2479
2642
|
}
|
|
2480
2643
|
),
|
|
2481
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsx11(
|
|
2482
2645
|
"button",
|
|
2483
2646
|
{
|
|
2484
2647
|
type: "button",
|
|
@@ -2490,7 +2653,7 @@ var ImageEditor = ({
|
|
|
2490
2653
|
children: "16:9 Wide"
|
|
2491
2654
|
}
|
|
2492
2655
|
),
|
|
2493
|
-
/* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ jsx11(
|
|
2494
2657
|
"button",
|
|
2495
2658
|
{
|
|
2496
2659
|
type: "button",
|
|
@@ -2502,7 +2665,7 @@ var ImageEditor = ({
|
|
|
2502
2665
|
children: "3:2 Photo"
|
|
2503
2666
|
}
|
|
2504
2667
|
),
|
|
2505
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx11(
|
|
2506
2669
|
"button",
|
|
2507
2670
|
{
|
|
2508
2671
|
type: "button",
|
|
@@ -2515,10 +2678,10 @@ var ImageEditor = ({
|
|
|
2515
2678
|
}
|
|
2516
2679
|
)
|
|
2517
2680
|
] }),
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ jsx11("div", { className: "h-px bg-slate-800 my-1" }),
|
|
2682
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Orientation & Flips" }),
|
|
2683
|
+
/* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2684
|
+
/* @__PURE__ */ jsx11(
|
|
2522
2685
|
"button",
|
|
2523
2686
|
{
|
|
2524
2687
|
type: "button",
|
|
@@ -2527,7 +2690,7 @@ var ImageEditor = ({
|
|
|
2527
2690
|
children: "Rotate -90\xB0"
|
|
2528
2691
|
}
|
|
2529
2692
|
),
|
|
2530
|
-
/* @__PURE__ */
|
|
2693
|
+
/* @__PURE__ */ jsx11(
|
|
2531
2694
|
"button",
|
|
2532
2695
|
{
|
|
2533
2696
|
type: "button",
|
|
@@ -2536,7 +2699,7 @@ var ImageEditor = ({
|
|
|
2536
2699
|
children: "Rotate +90\xB0"
|
|
2537
2700
|
}
|
|
2538
2701
|
),
|
|
2539
|
-
/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ jsx11(
|
|
2540
2703
|
"button",
|
|
2541
2704
|
{
|
|
2542
2705
|
type: "button",
|
|
@@ -2545,7 +2708,7 @@ var ImageEditor = ({
|
|
|
2545
2708
|
children: "Flip Horizontal"
|
|
2546
2709
|
}
|
|
2547
2710
|
),
|
|
2548
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ jsx11(
|
|
2549
2712
|
"button",
|
|
2550
2713
|
{
|
|
2551
2714
|
type: "button",
|
|
@@ -2556,10 +2719,10 @@ var ImageEditor = ({
|
|
|
2556
2719
|
)
|
|
2557
2720
|
] })
|
|
2558
2721
|
] }),
|
|
2559
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2722
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
2723
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
2724
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Color Adjustments" }),
|
|
2725
|
+
/* @__PURE__ */ jsx11(
|
|
2563
2726
|
"button",
|
|
2564
2727
|
{
|
|
2565
2728
|
type: "button",
|
|
@@ -2569,9 +2732,9 @@ var ImageEditor = ({
|
|
|
2569
2732
|
}
|
|
2570
2733
|
)
|
|
2571
2734
|
] }),
|
|
2572
|
-
/* @__PURE__ */
|
|
2573
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2574
|
-
/* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ jsx11(Histogram, { histogram: editor.histogram }),
|
|
2736
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs11(React10.Fragment, { children: [
|
|
2737
|
+
/* @__PURE__ */ jsx11(
|
|
2575
2738
|
ControlSlider,
|
|
2576
2739
|
{
|
|
2577
2740
|
spec,
|
|
@@ -2580,14 +2743,14 @@ var ImageEditor = ({
|
|
|
2580
2743
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
2581
2744
|
}
|
|
2582
2745
|
),
|
|
2583
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
2746
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs11(
|
|
2584
2747
|
"div",
|
|
2585
2748
|
{
|
|
2586
2749
|
className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-200",
|
|
2587
2750
|
"data-testid": "image-editor-process-notice",
|
|
2588
2751
|
children: [
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ jsx11("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
2753
|
+
/* @__PURE__ */ jsx11(
|
|
2591
2754
|
"button",
|
|
2592
2755
|
{
|
|
2593
2756
|
type: "button",
|
|
@@ -2600,7 +2763,7 @@ var ImageEditor = ({
|
|
|
2600
2763
|
}
|
|
2601
2764
|
)
|
|
2602
2765
|
] }, spec.id)),
|
|
2603
|
-
/* @__PURE__ */
|
|
2766
|
+
/* @__PURE__ */ jsx11("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ jsx11(
|
|
2604
2767
|
AdjustmentLayersPanel,
|
|
2605
2768
|
{
|
|
2606
2769
|
controller,
|
|
@@ -2609,19 +2772,41 @@ var ImageEditor = ({
|
|
|
2609
2772
|
}
|
|
2610
2773
|
) })
|
|
2611
2774
|
] }),
|
|
2612
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
/* @__PURE__ */
|
|
2775
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
2776
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Layers" }),
|
|
2777
|
+
/* @__PURE__ */ jsx11(
|
|
2778
|
+
"button",
|
|
2779
|
+
{
|
|
2780
|
+
type: "button",
|
|
2781
|
+
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
2782
|
+
className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white self-start disabled:opacity-40",
|
|
2783
|
+
disabled: transformTool.active,
|
|
2784
|
+
onClick: () => transformTool.begin(),
|
|
2785
|
+
children: "Free Transform"
|
|
2786
|
+
}
|
|
2787
|
+
),
|
|
2788
|
+
/* @__PURE__ */ jsx11(LayersPanel, { controller })
|
|
2615
2789
|
] }),
|
|
2616
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
|
|
2620
|
-
|
|
2790
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
2791
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Paint" }),
|
|
2792
|
+
/* @__PURE__ */ jsx11(BrushOptionsBar, { controller }),
|
|
2793
|
+
/* @__PURE__ */ jsx11(
|
|
2794
|
+
"button",
|
|
2795
|
+
{
|
|
2796
|
+
type: "button",
|
|
2797
|
+
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
2798
|
+
className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white self-start",
|
|
2799
|
+
disabled: transformTool.active,
|
|
2800
|
+
onClick: () => transformTool.begin(),
|
|
2801
|
+
children: "Free Transform"
|
|
2802
|
+
}
|
|
2803
|
+
),
|
|
2804
|
+
paintError && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-rose-400", "data-testid": "paint-error", children: paintError }),
|
|
2805
|
+
/* @__PURE__ */ jsx11("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ jsx11(LayersPanel, { controller }) })
|
|
2621
2806
|
] }),
|
|
2622
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
2623
|
-
/* @__PURE__ */
|
|
2624
|
-
/* @__PURE__ */
|
|
2807
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
2808
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Draw & Annotate" }),
|
|
2809
|
+
/* @__PURE__ */ jsx11("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx11(
|
|
2625
2810
|
"button",
|
|
2626
2811
|
{
|
|
2627
2812
|
type: "button",
|
|
@@ -2631,9 +2816,9 @@ var ImageEditor = ({
|
|
|
2631
2816
|
},
|
|
2632
2817
|
t
|
|
2633
2818
|
)) }),
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2819
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
2820
|
+
/* @__PURE__ */ jsx11("label", { className: "text-slate-400", children: "Color:" }),
|
|
2821
|
+
/* @__PURE__ */ jsx11(
|
|
2637
2822
|
"input",
|
|
2638
2823
|
{
|
|
2639
2824
|
type: "color",
|
|
@@ -2642,15 +2827,15 @@ var ImageEditor = ({
|
|
|
2642
2827
|
className: "w-8 h-8 rounded border border-slate-700 cursor-pointer bg-transparent"
|
|
2643
2828
|
}
|
|
2644
2829
|
),
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2830
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 ml-2", children: [
|
|
2831
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between text-slate-400 mb-0.5", children: [
|
|
2832
|
+
/* @__PURE__ */ jsx11("span", { children: "Width:" }),
|
|
2833
|
+
/* @__PURE__ */ jsxs11("span", { className: "font-mono", children: [
|
|
2649
2834
|
strokeWidth,
|
|
2650
2835
|
"px"
|
|
2651
2836
|
] })
|
|
2652
2837
|
] }),
|
|
2653
|
-
/* @__PURE__ */
|
|
2838
|
+
/* @__PURE__ */ jsx11(
|
|
2654
2839
|
"input",
|
|
2655
2840
|
{
|
|
2656
2841
|
type: "range",
|
|
@@ -2663,10 +2848,10 @@ var ImageEditor = ({
|
|
|
2663
2848
|
)
|
|
2664
2849
|
] })
|
|
2665
2850
|
] }),
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */
|
|
2851
|
+
/* @__PURE__ */ jsx11("div", { className: "h-px bg-slate-800 my-1" }),
|
|
2852
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Add Text" }),
|
|
2853
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
|
|
2854
|
+
/* @__PURE__ */ jsx11(
|
|
2670
2855
|
"input",
|
|
2671
2856
|
{
|
|
2672
2857
|
type: "text",
|
|
@@ -2677,7 +2862,7 @@ var ImageEditor = ({
|
|
|
2677
2862
|
className: "flex-1 bg-slate-950 border border-slate-700 rounded-lg px-2.5 py-1.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500"
|
|
2678
2863
|
}
|
|
2679
2864
|
),
|
|
2680
|
-
/* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ jsx11(
|
|
2681
2866
|
"button",
|
|
2682
2867
|
{
|
|
2683
2868
|
type: "button",
|
|
@@ -2687,14 +2872,14 @@ var ImageEditor = ({
|
|
|
2687
2872
|
}
|
|
2688
2873
|
)
|
|
2689
2874
|
] }),
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between text-slate-400", children: [
|
|
2876
|
+
/* @__PURE__ */ jsx11("span", { children: "Font Size:" }),
|
|
2877
|
+
/* @__PURE__ */ jsxs11("span", { className: "font-mono", children: [
|
|
2693
2878
|
fontSize,
|
|
2694
2879
|
"px"
|
|
2695
2880
|
] })
|
|
2696
2881
|
] }),
|
|
2697
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsx11(
|
|
2698
2883
|
"input",
|
|
2699
2884
|
{
|
|
2700
2885
|
type: "range",
|
|
@@ -2705,14 +2890,14 @@ var ImageEditor = ({
|
|
|
2705
2890
|
className: "w-full accent-indigo-500"
|
|
2706
2891
|
}
|
|
2707
2892
|
),
|
|
2708
|
-
/* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ jsx11("div", { className: "h-px bg-slate-800 my-1" }),
|
|
2894
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
2895
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-slate-400", children: [
|
|
2711
2896
|
"Layers (",
|
|
2712
2897
|
state.annotations.length,
|
|
2713
2898
|
")"
|
|
2714
2899
|
] }),
|
|
2715
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
2900
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx11(
|
|
2716
2901
|
"button",
|
|
2717
2902
|
{
|
|
2718
2903
|
type: "button",
|
|
@@ -2721,7 +2906,7 @@ var ImageEditor = ({
|
|
|
2721
2906
|
children: "Delete Selected"
|
|
2722
2907
|
}
|
|
2723
2908
|
),
|
|
2724
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
2909
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx11(
|
|
2725
2910
|
"button",
|
|
2726
2911
|
{
|
|
2727
2912
|
type: "button",
|
|
@@ -2732,10 +2917,10 @@ var ImageEditor = ({
|
|
|
2732
2917
|
)
|
|
2733
2918
|
] })
|
|
2734
2919
|
] }),
|
|
2735
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2920
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
2921
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
2922
|
+
/* @__PURE__ */ jsx11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Depth Masking" }),
|
|
2923
|
+
/* @__PURE__ */ jsx11(
|
|
2739
2924
|
"button",
|
|
2740
2925
|
{
|
|
2741
2926
|
type: "button",
|
|
@@ -2745,8 +2930,8 @@ var ImageEditor = ({
|
|
|
2745
2930
|
}
|
|
2746
2931
|
)
|
|
2747
2932
|
] }),
|
|
2748
|
-
/* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2933
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300", children: [
|
|
2934
|
+
/* @__PURE__ */ jsx11(
|
|
2750
2935
|
"input",
|
|
2751
2936
|
{
|
|
2752
2937
|
type: "checkbox",
|
|
@@ -2755,12 +2940,12 @@ var ImageEditor = ({
|
|
|
2755
2940
|
className: "rounded accent-indigo-500"
|
|
2756
2941
|
}
|
|
2757
2942
|
),
|
|
2758
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsx11("span", { children: "Enable Depth / Alpha Mask" })
|
|
2759
2944
|
] }),
|
|
2760
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
2761
|
-
/* @__PURE__ */
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
/* @__PURE__ */
|
|
2945
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
2946
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2947
|
+
/* @__PURE__ */ jsx11("label", { className: "text-slate-400 block mb-1", children: "Mask Image URL:" }),
|
|
2948
|
+
/* @__PURE__ */ jsx11(
|
|
2764
2949
|
"input",
|
|
2765
2950
|
{
|
|
2766
2951
|
type: "text",
|
|
@@ -2771,8 +2956,8 @@ var ImageEditor = ({
|
|
|
2771
2956
|
}
|
|
2772
2957
|
)
|
|
2773
2958
|
] }),
|
|
2774
|
-
/* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2959
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
|
|
2960
|
+
/* @__PURE__ */ jsx11(
|
|
2776
2961
|
"button",
|
|
2777
2962
|
{
|
|
2778
2963
|
type: "button",
|
|
@@ -2781,7 +2966,7 @@ var ImageEditor = ({
|
|
|
2781
2966
|
children: "Threshold Mode"
|
|
2782
2967
|
}
|
|
2783
2968
|
),
|
|
2784
|
-
/* @__PURE__ */
|
|
2969
|
+
/* @__PURE__ */ jsx11(
|
|
2785
2970
|
"button",
|
|
2786
2971
|
{
|
|
2787
2972
|
type: "button",
|
|
@@ -2791,12 +2976,12 @@ var ImageEditor = ({
|
|
|
2791
2976
|
}
|
|
2792
2977
|
)
|
|
2793
2978
|
] }),
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2980
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
2981
|
+
/* @__PURE__ */ jsx11("span", { children: "Depth Start (Lower):" }),
|
|
2982
|
+
/* @__PURE__ */ jsx11("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
2798
2983
|
] }),
|
|
2799
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx11(
|
|
2800
2985
|
"input",
|
|
2801
2986
|
{
|
|
2802
2987
|
type: "range",
|
|
@@ -2810,12 +2995,12 @@ var ImageEditor = ({
|
|
|
2810
2995
|
}
|
|
2811
2996
|
)
|
|
2812
2997
|
] }),
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2999
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
3000
|
+
/* @__PURE__ */ jsx11("span", { children: "Depth Stop (Upper):" }),
|
|
3001
|
+
/* @__PURE__ */ jsx11("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
2817
3002
|
] }),
|
|
2818
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx11(
|
|
2819
3004
|
"input",
|
|
2820
3005
|
{
|
|
2821
3006
|
type: "range",
|
|
@@ -2829,12 +3014,12 @@ var ImageEditor = ({
|
|
|
2829
3014
|
}
|
|
2830
3015
|
)
|
|
2831
3016
|
] }),
|
|
2832
|
-
/* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
3017
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3018
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between text-slate-400 mb-1", children: [
|
|
3019
|
+
/* @__PURE__ */ jsx11("span", { children: "Softness:" }),
|
|
3020
|
+
/* @__PURE__ */ jsx11("span", { className: "font-mono", children: state.depthMask.softness })
|
|
2836
3021
|
] }),
|
|
2837
|
-
/* @__PURE__ */
|
|
3022
|
+
/* @__PURE__ */ jsx11(
|
|
2838
3023
|
"input",
|
|
2839
3024
|
{
|
|
2840
3025
|
type: "range",
|
|
@@ -2846,8 +3031,8 @@ var ImageEditor = ({
|
|
|
2846
3031
|
}
|
|
2847
3032
|
)
|
|
2848
3033
|
] }),
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
3034
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300 mt-1", children: [
|
|
3035
|
+
/* @__PURE__ */ jsx11(
|
|
2851
3036
|
"input",
|
|
2852
3037
|
{
|
|
2853
3038
|
type: "checkbox",
|
|
@@ -2856,12 +3041,12 @@ var ImageEditor = ({
|
|
|
2856
3041
|
className: "rounded accent-indigo-500"
|
|
2857
3042
|
}
|
|
2858
3043
|
),
|
|
2859
|
-
/* @__PURE__ */
|
|
3044
|
+
/* @__PURE__ */ jsx11("span", { children: "Invert Mask" })
|
|
2860
3045
|
] })
|
|
2861
3046
|
] })
|
|
2862
3047
|
] }),
|
|
2863
|
-
activeTab === "select" && /* @__PURE__ */
|
|
2864
|
-
/* @__PURE__ */
|
|
3048
|
+
activeTab === "select" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3049
|
+
/* @__PURE__ */ jsx11(
|
|
2865
3050
|
SelectionOptionsBar,
|
|
2866
3051
|
{
|
|
2867
3052
|
controller,
|
|
@@ -2871,13 +3056,37 @@ var ImageEditor = ({
|
|
|
2871
3056
|
quickMask: Boolean(state.quickMask)
|
|
2872
3057
|
}
|
|
2873
3058
|
),
|
|
2874
|
-
selectionError && /* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
3059
|
+
selectionError && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-rose-400", children: selectionError }),
|
|
3060
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1", children: [
|
|
3061
|
+
/* @__PURE__ */ jsx11(
|
|
3062
|
+
"button",
|
|
3063
|
+
{
|
|
3064
|
+
type: "button",
|
|
3065
|
+
title: "Select \u203A Transform Selection: the outline only",
|
|
3066
|
+
className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white self-start disabled:opacity-40",
|
|
3067
|
+
disabled: transformTool.active,
|
|
3068
|
+
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
3069
|
+
children: "Transform Selection"
|
|
3070
|
+
}
|
|
3071
|
+
),
|
|
3072
|
+
/* @__PURE__ */ jsx11(
|
|
3073
|
+
"button",
|
|
3074
|
+
{
|
|
3075
|
+
type: "button",
|
|
3076
|
+
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
3077
|
+
className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white self-start disabled:opacity-40",
|
|
3078
|
+
disabled: transformTool.active,
|
|
3079
|
+
onClick: () => transformTool.begin({ content: "selection" }),
|
|
3080
|
+
children: "Free Transform Pixels"
|
|
3081
|
+
}
|
|
3082
|
+
)
|
|
3083
|
+
] }),
|
|
3084
|
+
/* @__PURE__ */ jsx11(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
2876
3085
|
] }),
|
|
2877
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
2880
|
-
/* @__PURE__ */
|
|
3086
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
3087
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2 text-slate-300", children: [
|
|
3088
|
+
/* @__PURE__ */ jsx11("span", { children: "Results go to" }),
|
|
3089
|
+
/* @__PURE__ */ jsxs11(
|
|
2881
3090
|
"select",
|
|
2882
3091
|
{
|
|
2883
3092
|
"aria-label": "AI result target",
|
|
@@ -2885,54 +3094,54 @@ var ImageEditor = ({
|
|
|
2885
3094
|
onChange: (e) => setAiTarget(e.target.value),
|
|
2886
3095
|
className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
|
|
2887
3096
|
children: [
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
/* @__PURE__ */
|
|
3097
|
+
/* @__PURE__ */ jsx11("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
3098
|
+
/* @__PURE__ */ jsx11("option", { value: "new-layer", children: "New layer / mask" }),
|
|
3099
|
+
/* @__PURE__ */ jsx11("option", { value: "replace", children: "Replace image" })
|
|
2891
3100
|
]
|
|
2892
3101
|
}
|
|
2893
3102
|
)
|
|
2894
3103
|
] }),
|
|
2895
|
-
/* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsxs11("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
|
|
3105
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
3106
|
+
/* @__PURE__ */ jsxs11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
3107
|
+
/* @__PURE__ */ jsx11("svg", { className: "w-3.5 h-3.5 text-indigo-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx11("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
|
|
2899
3108
|
"Background Removal"
|
|
2900
3109
|
] }),
|
|
2901
|
-
isRemovingBg && /* @__PURE__ */
|
|
3110
|
+
isRemovingBg && /* @__PURE__ */ jsx11("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-900/60 text-indigo-300 animate-pulse", children: "Removing..." })
|
|
2902
3111
|
] }),
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
3112
|
+
/* @__PURE__ */ jsx11("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
3113
|
+
/* @__PURE__ */ jsx11(
|
|
2905
3114
|
"button",
|
|
2906
3115
|
{
|
|
2907
3116
|
type: "button",
|
|
2908
3117
|
onClick: handleRemoveBackground,
|
|
2909
3118
|
disabled: isRemovingBg || isInpainting,
|
|
2910
3119
|
className: "mt-1 px-3 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
2911
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
3120
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3121
|
+
/* @__PURE__ */ jsx11("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
|
|
2913
3122
|
"Removing Background..."
|
|
2914
|
-
] }) : /* @__PURE__ */
|
|
2915
|
-
/* @__PURE__ */
|
|
3123
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3124
|
+
/* @__PURE__ */ jsx11("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx11("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
2916
3125
|
"Remove Background"
|
|
2917
3126
|
] })
|
|
2918
3127
|
}
|
|
2919
3128
|
)
|
|
2920
3129
|
] }),
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
/* @__PURE__ */
|
|
2924
|
-
/* @__PURE__ */
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsxs11("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
|
|
3131
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
3132
|
+
/* @__PURE__ */ jsxs11("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
3133
|
+
/* @__PURE__ */ jsxs11("svg", { className: "w-3.5 h-3.5 text-purple-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
3134
|
+
/* @__PURE__ */ jsx11("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
|
|
3135
|
+
/* @__PURE__ */ jsx11("path", { d: "m14 7 3 3" })
|
|
2927
3136
|
] }),
|
|
2928
3137
|
"Generative Inpainting"
|
|
2929
3138
|
] }),
|
|
2930
|
-
isInpainting && /* @__PURE__ */
|
|
3139
|
+
isInpainting && /* @__PURE__ */ jsx11("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-900/60 text-purple-300 animate-pulse", children: "Inpainting..." })
|
|
2931
3140
|
] }),
|
|
2932
|
-
/* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsx11("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
3142
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", children: [
|
|
3143
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-slate-300 text-[11px] font-medium", children: "Prompt" }),
|
|
3144
|
+
/* @__PURE__ */ jsx11(
|
|
2936
3145
|
"textarea",
|
|
2937
3146
|
{
|
|
2938
3147
|
id: "ai-inpaint-prompt-react",
|
|
@@ -2944,10 +3153,10 @@ var ImageEditor = ({
|
|
|
2944
3153
|
}
|
|
2945
3154
|
)
|
|
2946
3155
|
] }),
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
/* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
3156
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", children: [
|
|
3157
|
+
/* @__PURE__ */ jsx11("span", { className: "text-slate-300 text-[11px] font-medium", children: "Target Mask Region" }),
|
|
3158
|
+
/* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
3159
|
+
/* @__PURE__ */ jsxs11(
|
|
2951
3160
|
"button",
|
|
2952
3161
|
{
|
|
2953
3162
|
type: "button",
|
|
@@ -2960,7 +3169,7 @@ var ImageEditor = ({
|
|
|
2960
3169
|
]
|
|
2961
3170
|
}
|
|
2962
3171
|
),
|
|
2963
|
-
/* @__PURE__ */
|
|
3172
|
+
/* @__PURE__ */ jsxs11(
|
|
2964
3173
|
"button",
|
|
2965
3174
|
{
|
|
2966
3175
|
type: "button",
|
|
@@ -2975,25 +3184,25 @@ var ImageEditor = ({
|
|
|
2975
3184
|
)
|
|
2976
3185
|
] })
|
|
2977
3186
|
] }),
|
|
2978
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ jsx11(
|
|
2979
3188
|
"button",
|
|
2980
3189
|
{
|
|
2981
3190
|
type: "button",
|
|
2982
3191
|
onClick: handleInpaint,
|
|
2983
3192
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
2984
3193
|
className: "mt-1 px-3 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
2985
|
-
children: isInpainting ? /* @__PURE__ */
|
|
2986
|
-
/* @__PURE__ */
|
|
3194
|
+
children: isInpainting ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3195
|
+
/* @__PURE__ */ jsx11("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
|
|
2987
3196
|
"Generating Inpaint..."
|
|
2988
|
-
] }) : /* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */
|
|
3197
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3198
|
+
/* @__PURE__ */ jsx11("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx11("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
2990
3199
|
"Apply Inpainting"
|
|
2991
3200
|
] })
|
|
2992
3201
|
}
|
|
2993
3202
|
)
|
|
2994
3203
|
] }),
|
|
2995
|
-
aiError && /* @__PURE__ */
|
|
2996
|
-
aiSuccess && /* @__PURE__ */
|
|
3204
|
+
aiError && /* @__PURE__ */ jsx11("div", { className: "p-2.5 rounded-lg bg-rose-950/60 border border-rose-800 text-rose-300 text-[11px]", children: aiError }),
|
|
3205
|
+
aiSuccess && /* @__PURE__ */ jsx11("div", { className: "p-2.5 rounded-lg bg-emerald-950/60 border border-emerald-800 text-emerald-300 text-[11px]", children: aiSuccess })
|
|
2997
3206
|
] })
|
|
2998
3207
|
] })
|
|
2999
3208
|
] })
|
|
@@ -3014,6 +3223,7 @@ export {
|
|
|
3014
3223
|
BrushOptionsBar,
|
|
3015
3224
|
SelectionOptionsBar,
|
|
3016
3225
|
RefineEdgePanel,
|
|
3226
|
+
FreeTransformOptionsBar,
|
|
3017
3227
|
ImageEditor
|
|
3018
3228
|
};
|
|
3019
|
-
//# sourceMappingURL=chunk-
|
|
3229
|
+
//# sourceMappingURL=chunk-OSBDCFF4.js.map
|