@pixerate/editor-react 0.144.0 → 0.145.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-3CB4WG24.js → chunk-3VQ34CNX.js} +1013 -925
- package/dist/image-editor/EdgeColorPanel.d.cts +14 -0
- package/dist/image-editor/EdgeColorPanel.d.ts +14 -0
- package/dist/image-editor/index.cjs +1277 -1188
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +1797 -1708
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
// src/image-editor/ImageEditor.tsx
|
|
193
|
-
import
|
|
193
|
+
import React21, { useRef as useRef12, useEffect as useEffect17, useState as useState22 } from "react";
|
|
194
194
|
import {
|
|
195
195
|
normalizeProcessVersion,
|
|
196
196
|
LATEST_PROCESS_VERSION,
|
|
@@ -1538,7 +1538,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1538
1538
|
};
|
|
1539
1539
|
|
|
1540
1540
|
// src/image-editor/LayersPanel.tsx
|
|
1541
|
-
import { useEffect as useEffect6, useRef as
|
|
1541
|
+
import { useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
|
|
1542
1542
|
|
|
1543
1543
|
// src/image-editor/LayerEffectsPanel.tsx
|
|
1544
1544
|
import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
|
|
@@ -1696,6 +1696,92 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1696
1696
|
] });
|
|
1697
1697
|
};
|
|
1698
1698
|
|
|
1699
|
+
// src/image-editor/EdgeColorPanel.tsx
|
|
1700
|
+
import { useRef as useRef5, useState as useState7 } from "react";
|
|
1701
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1702
|
+
var SLIDERS = [
|
|
1703
|
+
{ key: "decontaminate", label: "Decontaminate", hint: "Unmix the old background from a soft-edged mask" },
|
|
1704
|
+
{ key: "despill", label: "Despill", hint: "Take out the old background's hue at the edge" },
|
|
1705
|
+
{ key: "ambient", label: "Cast", hint: "Tint the edge with what is behind the layer, live" }
|
|
1706
|
+
];
|
|
1707
|
+
var EdgeColorPanel = ({ controller, layer, className = "" }) => {
|
|
1708
|
+
const [error, setError] = useState7(null);
|
|
1709
|
+
const commitNext = useRef5(true);
|
|
1710
|
+
const info = controller.getEdgeColor(layer.id);
|
|
1711
|
+
const fixed = info.ambientSource !== "auto";
|
|
1712
|
+
const set = (change) => {
|
|
1713
|
+
setError(null);
|
|
1714
|
+
try {
|
|
1715
|
+
controller.setEdgeColor(layer.id, change, commitNext.current);
|
|
1716
|
+
commitNext.current = false;
|
|
1717
|
+
} catch (err) {
|
|
1718
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
const sliderEvents = {
|
|
1722
|
+
onPointerDown: () => commitNext.current = true,
|
|
1723
|
+
onPointerUp: () => commitNext.current = true,
|
|
1724
|
+
onKeyDown: () => commitNext.current = true
|
|
1725
|
+
};
|
|
1726
|
+
return /* @__PURE__ */ jsxs8("details", { className: `text-xs ${className}`, "data-testid": "edge-color-panel", open: Boolean(info.decontaminate || info.despill || info.ambient) || void 0, children: [
|
|
1727
|
+
/* @__PURE__ */ jsx8("summary", { className: "cursor-pointer text-muted-foreground", children: "Edge Colour" }),
|
|
1728
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5 pt-1", children: [
|
|
1729
|
+
SLIDERS.map((s) => /* @__PURE__ */ jsxs8("label", { className: "flex flex-col gap-0.5", title: s.hint, children: [
|
|
1730
|
+
/* @__PURE__ */ jsxs8("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
1731
|
+
/* @__PURE__ */ jsx8("span", { children: s.label }),
|
|
1732
|
+
/* @__PURE__ */ jsxs8("span", { className: "font-mono", children: [
|
|
1733
|
+
info[s.key],
|
|
1734
|
+
"%"
|
|
1735
|
+
] })
|
|
1736
|
+
] }),
|
|
1737
|
+
/* @__PURE__ */ jsx8(
|
|
1738
|
+
"input",
|
|
1739
|
+
{
|
|
1740
|
+
type: "range",
|
|
1741
|
+
min: 0,
|
|
1742
|
+
max: 100,
|
|
1743
|
+
"aria-label": `Edge ${s.label.toLowerCase()}`,
|
|
1744
|
+
value: info[s.key],
|
|
1745
|
+
...sliderEvents,
|
|
1746
|
+
onChange: (e) => set({ [s.key]: Number(e.target.value) }),
|
|
1747
|
+
className: "accent-primary"
|
|
1748
|
+
}
|
|
1749
|
+
)
|
|
1750
|
+
] }, s.key)),
|
|
1751
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1752
|
+
/* @__PURE__ */ jsx8(
|
|
1753
|
+
"input",
|
|
1754
|
+
{
|
|
1755
|
+
type: "checkbox",
|
|
1756
|
+
"aria-label": "Fixed cast colour",
|
|
1757
|
+
checked: fixed,
|
|
1758
|
+
onChange: (e) => {
|
|
1759
|
+
commitNext.current = true;
|
|
1760
|
+
set({ ambientColor: e.target.checked ? "#808080" : "auto" });
|
|
1761
|
+
},
|
|
1762
|
+
className: "accent-primary"
|
|
1763
|
+
}
|
|
1764
|
+
),
|
|
1765
|
+
"Fixed cast colour",
|
|
1766
|
+
fixed && /* @__PURE__ */ jsx8(
|
|
1767
|
+
"input",
|
|
1768
|
+
{
|
|
1769
|
+
type: "color",
|
|
1770
|
+
"aria-label": "Cast colour",
|
|
1771
|
+
value: info.ambientSource,
|
|
1772
|
+
onChange: (e) => {
|
|
1773
|
+
commitNext.current = true;
|
|
1774
|
+
set({ ambientColor: e.target.value });
|
|
1775
|
+
},
|
|
1776
|
+
className: "h-5 w-8 bg-background border border-border rounded"
|
|
1777
|
+
}
|
|
1778
|
+
)
|
|
1779
|
+
] }),
|
|
1780
|
+
error && /* @__PURE__ */ jsx8("p", { role: "alert", className: "text-destructive", children: error })
|
|
1781
|
+
] })
|
|
1782
|
+
] });
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1699
1785
|
// src/image-editor/LayersPanel.tsx
|
|
1700
1786
|
import {
|
|
1701
1787
|
BIT_DEPTH_OPTIONS,
|
|
@@ -1717,7 +1803,7 @@ import {
|
|
|
1717
1803
|
layerPanelRows,
|
|
1718
1804
|
runLayerMenuAction
|
|
1719
1805
|
} from "@pixerate/editor/image-editor";
|
|
1720
|
-
import { Fragment, jsx as
|
|
1806
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1721
1807
|
var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
|
|
1722
1808
|
var Thumbnail = ({
|
|
1723
1809
|
pixels,
|
|
@@ -1728,7 +1814,7 @@ var Thumbnail = ({
|
|
|
1728
1814
|
selected,
|
|
1729
1815
|
testId
|
|
1730
1816
|
}) => {
|
|
1731
|
-
const ref =
|
|
1817
|
+
const ref = useRef6(null);
|
|
1732
1818
|
useEffect6(() => {
|
|
1733
1819
|
const canvas = ref.current;
|
|
1734
1820
|
const ctx = canvas?.getContext("2d");
|
|
@@ -1739,7 +1825,7 @@ var Thumbnail = ({
|
|
|
1739
1825
|
img.data.set(pixels.data);
|
|
1740
1826
|
ctx.putImageData(img, 0, 0);
|
|
1741
1827
|
}, [pixels]);
|
|
1742
|
-
return /* @__PURE__ */
|
|
1828
|
+
return /* @__PURE__ */ jsx9(
|
|
1743
1829
|
"canvas",
|
|
1744
1830
|
{
|
|
1745
1831
|
ref,
|
|
@@ -1754,14 +1840,14 @@ var Thumbnail = ({
|
|
|
1754
1840
|
);
|
|
1755
1841
|
};
|
|
1756
1842
|
var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
|
|
1757
|
-
const [, setTick] =
|
|
1843
|
+
const [, setTick] = useState8(0);
|
|
1758
1844
|
useEffect6(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1759
|
-
const [error, setError] =
|
|
1760
|
-
const [renaming, setRenaming] =
|
|
1761
|
-
const [menu, setMenu] =
|
|
1762
|
-
const [drag, setDrag] =
|
|
1763
|
-
const [psdNotes, setPsdNotes] =
|
|
1764
|
-
const fileInput =
|
|
1845
|
+
const [error, setError] = useState8(null);
|
|
1846
|
+
const [renaming, setRenaming] = useState8(null);
|
|
1847
|
+
const [menu, setMenu] = useState8(null);
|
|
1848
|
+
const [drag, setDrag] = useState8(null);
|
|
1849
|
+
const [psdNotes, setPsdNotes] = useState8([]);
|
|
1850
|
+
const fileInput = useRef6(null);
|
|
1765
1851
|
const psdTask = async (fn) => {
|
|
1766
1852
|
try {
|
|
1767
1853
|
setError(null);
|
|
@@ -1770,7 +1856,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1770
1856
|
setError(err instanceof Error ? err.message : String(err));
|
|
1771
1857
|
}
|
|
1772
1858
|
};
|
|
1773
|
-
const commitNext =
|
|
1859
|
+
const commitNext = useRef6(true);
|
|
1774
1860
|
const state = controller.getState();
|
|
1775
1861
|
const maskView = controller.getMaskView();
|
|
1776
1862
|
const rows = layerPanelRows(state.layers, state.activeLayerId);
|
|
@@ -1810,14 +1896,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1810
1896
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1811
1897
|
const vectorThumb = (layer) => layer.vectorMask ? vectorMaskThumbnail(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
1812
1898
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1813
|
-
return /* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
/* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1899
|
+
return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1900
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1901
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1902
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1903
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1904
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1905
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1906
|
+
/* @__PURE__ */ jsx9(
|
|
1821
1907
|
"button",
|
|
1822
1908
|
{
|
|
1823
1909
|
type: "button",
|
|
@@ -1832,7 +1918,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1832
1918
|
children: "\u22EF"
|
|
1833
1919
|
}
|
|
1834
1920
|
),
|
|
1835
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ jsx9(
|
|
1836
1922
|
"select",
|
|
1837
1923
|
{
|
|
1838
1924
|
"aria-label": "Bits per channel",
|
|
@@ -1840,13 +1926,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1840
1926
|
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1841
1927
|
value: controller.bitDepth,
|
|
1842
1928
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1843
|
-
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */
|
|
1929
|
+
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx9("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1844
1930
|
}
|
|
1845
1931
|
),
|
|
1846
|
-
psd && /* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1932
|
+
psd && /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
1933
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1934
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1935
|
+
/* @__PURE__ */ jsx9(
|
|
1850
1936
|
"input",
|
|
1851
1937
|
{
|
|
1852
1938
|
ref: fileInput,
|
|
@@ -1864,18 +1950,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1864
1950
|
)
|
|
1865
1951
|
] })
|
|
1866
1952
|
] }),
|
|
1867
|
-
psdNotes.length > 0 && /* @__PURE__ */
|
|
1868
|
-
psdNotes.map((n) => /* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1953
|
+
psdNotes.length > 0 && /* @__PURE__ */ jsxs9("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
|
|
1954
|
+
psdNotes.map((n) => /* @__PURE__ */ jsx9("li", { children: n }, n)),
|
|
1955
|
+
/* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1870
1956
|
] }),
|
|
1871
|
-
active && /* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1957
|
+
active && /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1958
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
|
|
1959
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
1874
1960
|
"Opacity ",
|
|
1875
1961
|
Math.round(active.opacity * 100),
|
|
1876
1962
|
"%"
|
|
1877
1963
|
] }),
|
|
1878
|
-
/* @__PURE__ */
|
|
1964
|
+
/* @__PURE__ */ jsx9(
|
|
1879
1965
|
"input",
|
|
1880
1966
|
{
|
|
1881
1967
|
type: "range",
|
|
@@ -1889,13 +1975,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1889
1975
|
}
|
|
1890
1976
|
)
|
|
1891
1977
|
] }),
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1978
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
|
|
1979
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
1894
1980
|
"Fill ",
|
|
1895
1981
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1896
1982
|
"%"
|
|
1897
1983
|
] }),
|
|
1898
|
-
/* @__PURE__ */
|
|
1984
|
+
/* @__PURE__ */ jsx9(
|
|
1899
1985
|
"input",
|
|
1900
1986
|
{
|
|
1901
1987
|
type: "range",
|
|
@@ -1910,7 +1996,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1910
1996
|
}
|
|
1911
1997
|
)
|
|
1912
1998
|
] }),
|
|
1913
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsxs9(
|
|
1914
2000
|
"select",
|
|
1915
2001
|
{
|
|
1916
2002
|
"aria-label": "Layer blend mode",
|
|
@@ -1918,13 +2004,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1918
2004
|
value: active.blend,
|
|
1919
2005
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1920
2006
|
children: [
|
|
1921
|
-
active.type === "group" && /* @__PURE__ */
|
|
1922
|
-
BLEND_MODES2.map((m) => /* @__PURE__ */
|
|
2007
|
+
active.type === "group" && /* @__PURE__ */ jsx9("option", { value: "pass-through", children: "Pass Through" }),
|
|
2008
|
+
BLEND_MODES2.map((m) => /* @__PURE__ */ jsx9("option", { value: m.id, children: m.label }, m.id))
|
|
1923
2009
|
]
|
|
1924
2010
|
}
|
|
1925
2011
|
),
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
2013
|
+
/* @__PURE__ */ jsx9(
|
|
1928
2014
|
"input",
|
|
1929
2015
|
{
|
|
1930
2016
|
type: "checkbox",
|
|
@@ -1936,8 +2022,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1936
2022
|
),
|
|
1937
2023
|
"Clip to below"
|
|
1938
2024
|
] }),
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
2025
|
+
/* @__PURE__ */ jsx9("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
|
|
2026
|
+
/* @__PURE__ */ jsx9(
|
|
1941
2027
|
"input",
|
|
1942
2028
|
{
|
|
1943
2029
|
type: "checkbox",
|
|
@@ -1950,10 +2036,11 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1950
2036
|
k
|
|
1951
2037
|
] }, k)) })
|
|
1952
2038
|
] }),
|
|
1953
|
-
|
|
1954
|
-
/* @__PURE__ */
|
|
2039
|
+
active && (active.type === "pixel" || active.type === "shape" || active.type === "type" || active.type === "smart") && /* @__PURE__ */ jsx9(EdgeColorPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }, active.id),
|
|
2040
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx9(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
2041
|
+
/* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1955
2042
|
const { layer } = row;
|
|
1956
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ jsxs9(
|
|
1957
2044
|
"li",
|
|
1958
2045
|
{
|
|
1959
2046
|
role: "treeitem",
|
|
@@ -1983,7 +2070,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1983
2070
|
className: rowClass(row.active),
|
|
1984
2071
|
style: { paddingLeft: 6 + row.depth * 14 },
|
|
1985
2072
|
children: [
|
|
1986
|
-
/* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ jsx9(
|
|
1987
2074
|
"button",
|
|
1988
2075
|
{
|
|
1989
2076
|
type: "button",
|
|
@@ -1997,7 +2084,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1997
2084
|
children: layer.visible ? "\u25CF" : "\u25CB"
|
|
1998
2085
|
}
|
|
1999
2086
|
),
|
|
2000
|
-
layer.type === "group" && /* @__PURE__ */
|
|
2087
|
+
layer.type === "group" && /* @__PURE__ */ jsx9(
|
|
2001
2088
|
"button",
|
|
2002
2089
|
{
|
|
2003
2090
|
type: "button",
|
|
@@ -2010,9 +2097,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2010
2097
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
2011
2098
|
}
|
|
2012
2099
|
),
|
|
2013
|
-
row.clipped && /* @__PURE__ */
|
|
2014
|
-
layerHasThumbnail(layer) ? /* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2100
|
+
row.clipped && /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
2101
|
+
layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs9("span", { className: "relative shrink-0", children: [
|
|
2102
|
+
/* @__PURE__ */ jsx9(
|
|
2016
2103
|
Thumbnail,
|
|
2017
2104
|
{
|
|
2018
2105
|
pixels: thumb(layer),
|
|
@@ -2028,7 +2115,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2028
2115
|
}
|
|
2029
2116
|
}
|
|
2030
2117
|
),
|
|
2031
|
-
layer.type !== "pixel" && /* @__PURE__ */
|
|
2118
|
+
layer.type !== "pixel" && /* @__PURE__ */ jsx9(
|
|
2032
2119
|
"span",
|
|
2033
2120
|
{
|
|
2034
2121
|
"data-testid": "layer-kind-badge",
|
|
@@ -2036,7 +2123,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2036
2123
|
children: layerBadge(layer)
|
|
2037
2124
|
}
|
|
2038
2125
|
)
|
|
2039
|
-
] }) : /* @__PURE__ */
|
|
2126
|
+
] }) : /* @__PURE__ */ jsx9(
|
|
2040
2127
|
"span",
|
|
2041
2128
|
{
|
|
2042
2129
|
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
@@ -2044,7 +2131,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2044
2131
|
children: layerBadge(layer)
|
|
2045
2132
|
}
|
|
2046
2133
|
),
|
|
2047
|
-
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */
|
|
2134
|
+
layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx9(
|
|
2048
2135
|
"button",
|
|
2049
2136
|
{
|
|
2050
2137
|
type: "button",
|
|
@@ -2060,7 +2147,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2060
2147
|
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
2061
2148
|
}
|
|
2062
2149
|
),
|
|
2063
|
-
layer.mask && /* @__PURE__ */
|
|
2150
|
+
layer.mask && /* @__PURE__ */ jsx9(
|
|
2064
2151
|
Thumbnail,
|
|
2065
2152
|
{
|
|
2066
2153
|
pixels: maskThumb(layer),
|
|
@@ -2075,7 +2162,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2075
2162
|
}
|
|
2076
2163
|
}
|
|
2077
2164
|
),
|
|
2078
|
-
layer.vectorMask && /* @__PURE__ */
|
|
2165
|
+
layer.vectorMask && /* @__PURE__ */ jsx9(
|
|
2079
2166
|
Thumbnail,
|
|
2080
2167
|
{
|
|
2081
2168
|
pixels: vectorThumb(layer),
|
|
@@ -2089,7 +2176,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2089
2176
|
}
|
|
2090
2177
|
}
|
|
2091
2178
|
),
|
|
2092
|
-
renaming === layer.id ? /* @__PURE__ */
|
|
2179
|
+
renaming === layer.id ? /* @__PURE__ */ jsx9(
|
|
2093
2180
|
"input",
|
|
2094
2181
|
{
|
|
2095
2182
|
autoFocus: true,
|
|
@@ -2106,7 +2193,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2106
2193
|
if (e.key === "Escape") setRenaming(null);
|
|
2107
2194
|
}
|
|
2108
2195
|
}
|
|
2109
|
-
) : /* @__PURE__ */
|
|
2196
|
+
) : /* @__PURE__ */ jsx9(
|
|
2110
2197
|
"span",
|
|
2111
2198
|
{
|
|
2112
2199
|
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
@@ -2117,8 +2204,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2117
2204
|
children: row.label
|
|
2118
2205
|
}
|
|
2119
2206
|
),
|
|
2120
|
-
layerWarning(layer) && /* @__PURE__ */
|
|
2121
|
-
layerEffectsBadge(layer) && /* @__PURE__ */
|
|
2207
|
+
layerWarning(layer) && /* @__PURE__ */ jsx9("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
2208
|
+
layerEffectsBadge(layer) && /* @__PURE__ */ jsx9(
|
|
2122
2209
|
"button",
|
|
2123
2210
|
{
|
|
2124
2211
|
type: "button",
|
|
@@ -2133,15 +2220,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2133
2220
|
children: "fx"
|
|
2134
2221
|
}
|
|
2135
2222
|
),
|
|
2136
|
-
locked(layer) && /* @__PURE__ */
|
|
2137
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */
|
|
2223
|
+
locked(layer) && /* @__PURE__ */ jsx9("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2224
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx9("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
2138
2225
|
]
|
|
2139
2226
|
},
|
|
2140
2227
|
layer.id
|
|
2141
2228
|
);
|
|
2142
2229
|
}) }),
|
|
2143
|
-
error && /* @__PURE__ */
|
|
2144
|
-
menu && /* @__PURE__ */
|
|
2230
|
+
error && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2231
|
+
menu && /* @__PURE__ */ jsx9(
|
|
2145
2232
|
"div",
|
|
2146
2233
|
{
|
|
2147
2234
|
role: "menu",
|
|
@@ -2150,7 +2237,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2150
2237
|
style: { left: menu.x, top: menu.y },
|
|
2151
2238
|
onClick: (e) => e.stopPropagation(),
|
|
2152
2239
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
2153
|
-
children: layerMenu(controller).map((item) => /* @__PURE__ */
|
|
2240
|
+
children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx9(
|
|
2154
2241
|
"button",
|
|
2155
2242
|
{
|
|
2156
2243
|
type: "button",
|
|
@@ -2168,14 +2255,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2168
2255
|
};
|
|
2169
2256
|
|
|
2170
2257
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2171
|
-
import { useEffect as useEffect7, useRef as
|
|
2258
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
|
|
2172
2259
|
import { EFFECT_LAYER_USES, effectLayerTiming, findLayer } from "@pixerate/editor/image-editor";
|
|
2173
2260
|
|
|
2174
2261
|
// src/image-editor/controls/parameterControls.tsx
|
|
2175
2262
|
import { matchParameterOptionValue } from "@pixerate/editor/parameters";
|
|
2176
|
-
import { jsx as
|
|
2263
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2177
2264
|
function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
2178
|
-
return /* @__PURE__ */
|
|
2265
|
+
return /* @__PURE__ */ jsx10(
|
|
2179
2266
|
ImageRange,
|
|
2180
2267
|
{
|
|
2181
2268
|
value,
|
|
@@ -2192,7 +2279,7 @@ function ImageParameterSlider({ value, min, max, step, label, disabled, classNam
|
|
|
2192
2279
|
);
|
|
2193
2280
|
}
|
|
2194
2281
|
function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
|
|
2195
|
-
return /* @__PURE__ */
|
|
2282
|
+
return /* @__PURE__ */ jsx10(
|
|
2196
2283
|
ImageSelect,
|
|
2197
2284
|
{
|
|
2198
2285
|
value: String(value),
|
|
@@ -2205,7 +2292,7 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
|
|
|
2205
2292
|
);
|
|
2206
2293
|
}
|
|
2207
2294
|
function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
2208
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx10(
|
|
2209
2296
|
ImageColor,
|
|
2210
2297
|
{
|
|
2211
2298
|
value,
|
|
@@ -2228,33 +2315,33 @@ function imageEditorParameterComponents(controls) {
|
|
|
2228
2315
|
}
|
|
2229
2316
|
|
|
2230
2317
|
// src/image-editor/ImageEffectControls.tsx
|
|
2231
|
-
import { jsx as
|
|
2318
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2232
2319
|
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
|
|
2233
2320
|
const { description, error } = useEffectDescription(provider, effect);
|
|
2234
2321
|
const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
|
|
2235
2322
|
const effectiveComponents = resolveParameterComponents(components, fallback);
|
|
2236
2323
|
let body;
|
|
2237
|
-
if (!provider) body = /* @__PURE__ */
|
|
2324
|
+
if (!provider) body = /* @__PURE__ */ jsxs10("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2238
2325
|
'No effects provider: "',
|
|
2239
2326
|
name ?? effect,
|
|
2240
2327
|
'" is kept but not drawn.'
|
|
2241
2328
|
] });
|
|
2242
|
-
else if (error) body = /* @__PURE__ */
|
|
2243
|
-
else if (!description) body = /* @__PURE__ */
|
|
2244
|
-
else body = /* @__PURE__ */
|
|
2245
|
-
return /* @__PURE__ */
|
|
2329
|
+
else if (error) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-600", children: error });
|
|
2330
|
+
else if (!description) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
2331
|
+
else body = /* @__PURE__ */ jsx11(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
|
|
2332
|
+
return /* @__PURE__ */ jsx11("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
2246
2333
|
}
|
|
2247
2334
|
|
|
2248
2335
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2249
|
-
import { jsx as
|
|
2336
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2250
2337
|
var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
|
|
2251
2338
|
function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
2252
|
-
const [, setTick] =
|
|
2339
|
+
const [, setTick] = useState9(0);
|
|
2253
2340
|
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2254
|
-
const [browse, setBrowse] =
|
|
2255
|
-
const [message, setMessage] =
|
|
2256
|
-
const [open, setOpen] =
|
|
2257
|
-
const [scrubbed, setScrubbed] =
|
|
2341
|
+
const [browse, setBrowse] = useState9(null);
|
|
2342
|
+
const [message, setMessage] = useState9(null);
|
|
2343
|
+
const [open, setOpen] = useState9(null);
|
|
2344
|
+
const [scrubbed, setScrubbed] = useState9(null);
|
|
2258
2345
|
const provider = controller.effectsProvider;
|
|
2259
2346
|
const state = controller.getState();
|
|
2260
2347
|
const layer = state.activeLayerId ? findLayer(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
@@ -2262,7 +2349,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2262
2349
|
setMessage(null);
|
|
2263
2350
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
2264
2351
|
};
|
|
2265
|
-
const drags =
|
|
2352
|
+
const drags = useRef7(/* @__PURE__ */ new Set());
|
|
2266
2353
|
const commit = (gesture) => {
|
|
2267
2354
|
if (gesture) {
|
|
2268
2355
|
if (!drags.current.has(gesture)) {
|
|
@@ -2278,7 +2365,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2278
2365
|
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2279
2366
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
2280
2367
|
const timing = generator ? effectLayerTiming(generator, description) : null;
|
|
2281
|
-
const scrub =
|
|
2368
|
+
const scrub = useRef7({ next: null, busy: false, gesture: null });
|
|
2282
2369
|
const scrubTo = (layerId, time) => {
|
|
2283
2370
|
const s = scrub.current;
|
|
2284
2371
|
setScrubbed(time);
|
|
@@ -2297,18 +2384,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2297
2384
|
});
|
|
2298
2385
|
};
|
|
2299
2386
|
const shown = scrubbed ?? timing?.time ?? 0;
|
|
2300
|
-
return /* @__PURE__ */
|
|
2301
|
-
!provider && /* @__PURE__ */
|
|
2302
|
-
generator && layer && /* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2305
|
-
/* @__PURE__ */
|
|
2306
|
-
/* @__PURE__ */
|
|
2387
|
+
return /* @__PURE__ */ jsxs11("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
|
|
2388
|
+
!provider && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
2389
|
+
generator && layer && /* @__PURE__ */ jsxs11("div", { className: "space-y-2", "data-effect-part": "generator", children: [
|
|
2390
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2391
|
+
/* @__PURE__ */ jsx12("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
|
|
2392
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
|
|
2393
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
2307
2394
|
] }),
|
|
2308
|
-
browse === "change" && /* @__PURE__ */
|
|
2309
|
-
timing && /* @__PURE__ */
|
|
2310
|
-
/* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2395
|
+
browse === "change" && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
|
|
2396
|
+
timing && /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
|
|
2397
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
|
|
2398
|
+
/* @__PURE__ */ jsx12(
|
|
2312
2399
|
"button",
|
|
2313
2400
|
{
|
|
2314
2401
|
type: "button",
|
|
@@ -2319,7 +2406,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2319
2406
|
children: "Still frame"
|
|
2320
2407
|
}
|
|
2321
2408
|
),
|
|
2322
|
-
/* @__PURE__ */
|
|
2409
|
+
/* @__PURE__ */ jsx12(
|
|
2323
2410
|
"button",
|
|
2324
2411
|
{
|
|
2325
2412
|
type: "button",
|
|
@@ -2331,9 +2418,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2331
2418
|
}
|
|
2332
2419
|
)
|
|
2333
2420
|
] }),
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2421
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2422
|
+
/* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
|
|
2423
|
+
/* @__PURE__ */ jsx12(
|
|
2337
2424
|
ImageRange,
|
|
2338
2425
|
{
|
|
2339
2426
|
min: 0,
|
|
@@ -2347,11 +2434,11 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2347
2434
|
onChange: (t) => scrubTo(layer.id, t)
|
|
2348
2435
|
}
|
|
2349
2436
|
),
|
|
2350
|
-
/* @__PURE__ */
|
|
2437
|
+
/* @__PURE__ */ jsx12("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
|
|
2351
2438
|
] }),
|
|
2352
|
-
timing.mode === "animate" && /* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2439
|
+
timing.mode === "animate" && /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2440
|
+
/* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
|
|
2441
|
+
/* @__PURE__ */ jsx12(
|
|
2355
2442
|
"input",
|
|
2356
2443
|
{
|
|
2357
2444
|
type: "number",
|
|
@@ -2368,13 +2455,13 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2368
2455
|
},
|
|
2369
2456
|
timing.duration
|
|
2370
2457
|
),
|
|
2371
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
|
|
2372
2459
|
"s",
|
|
2373
2460
|
timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
|
|
2374
2461
|
] })
|
|
2375
2462
|
] })
|
|
2376
2463
|
] }),
|
|
2377
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsx12(
|
|
2378
2465
|
ImageEffectControls,
|
|
2379
2466
|
{
|
|
2380
2467
|
provider,
|
|
@@ -2387,19 +2474,19 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2387
2474
|
}
|
|
2388
2475
|
)
|
|
2389
2476
|
] }),
|
|
2390
|
-
layer && canFilter && /* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2477
|
+
layer && canFilter && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
|
|
2478
|
+
/* @__PURE__ */ jsx12("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
2479
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
2393
2480
|
] }),
|
|
2394
|
-
browse === "filter" && layer && /* @__PURE__ */
|
|
2395
|
-
filters.length > 0 && layer && /* @__PURE__ */
|
|
2481
|
+
browse === "filter" && layer && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
|
|
2482
|
+
filters.length > 0 && layer && /* @__PURE__ */ jsx12("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
2396
2483
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
2397
2484
|
const all = layer.smartFilters.filters;
|
|
2398
2485
|
const index = all.indexOf(f);
|
|
2399
2486
|
if (f.kind !== "effect") return null;
|
|
2400
|
-
return /* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2402
|
-
/* @__PURE__ */
|
|
2487
|
+
return /* @__PURE__ */ jsxs11("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
2488
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2489
|
+
/* @__PURE__ */ jsx12(
|
|
2403
2490
|
ImageCheckbox,
|
|
2404
2491
|
{
|
|
2405
2492
|
checked: f.enabled,
|
|
@@ -2407,15 +2494,15 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2407
2494
|
onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
|
|
2408
2495
|
}
|
|
2409
2496
|
),
|
|
2410
|
-
/* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
|
|
2498
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
|
|
2499
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
2500
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2414
2501
|
] }),
|
|
2415
|
-
open === f.id && /* @__PURE__ */
|
|
2416
|
-
/* @__PURE__ */
|
|
2417
|
-
/* @__PURE__ */
|
|
2418
|
-
/* @__PURE__ */
|
|
2502
|
+
open === f.id && /* @__PURE__ */ jsxs11("div", { className: "mt-1 space-y-2", children: [
|
|
2503
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2504
|
+
/* @__PURE__ */ jsx12("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
2505
|
+
/* @__PURE__ */ jsx12(
|
|
2419
2506
|
ImageRange,
|
|
2420
2507
|
{
|
|
2421
2508
|
min: 0,
|
|
@@ -2428,7 +2515,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2428
2515
|
}
|
|
2429
2516
|
)
|
|
2430
2517
|
] }),
|
|
2431
|
-
/* @__PURE__ */
|
|
2518
|
+
/* @__PURE__ */ jsx12(
|
|
2432
2519
|
ImageEffectControls,
|
|
2433
2520
|
{
|
|
2434
2521
|
provider,
|
|
@@ -2443,14 +2530,14 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2443
2530
|
] })
|
|
2444
2531
|
] }, f.id);
|
|
2445
2532
|
}) }),
|
|
2446
|
-
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */
|
|
2447
|
-
!layer && /* @__PURE__ */
|
|
2448
|
-
message && /* @__PURE__ */
|
|
2533
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties; new effect layers are added from the layers panel." }),
|
|
2534
|
+
!layer && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2535
|
+
message && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2449
2536
|
] });
|
|
2450
2537
|
}
|
|
2451
2538
|
|
|
2452
2539
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2453
|
-
import { useEffect as useEffect8, useState as
|
|
2540
|
+
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
2454
2541
|
import {
|
|
2455
2542
|
BRUSH_OPTION_CONTROLS,
|
|
2456
2543
|
MIXER_MIXING_OPTIONS,
|
|
@@ -2471,15 +2558,15 @@ import { DEFAULT_PAINT_GRADIENT, userErrorMessage } from "@pixerate/editor/image
|
|
|
2471
2558
|
|
|
2472
2559
|
// src/image-editor/PaintGradientEditor.tsx
|
|
2473
2560
|
import { PAINT_GRADIENT_KIT } from "@pixerate/editor/image-editor";
|
|
2474
|
-
import { jsx as
|
|
2475
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */
|
|
2561
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2562
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ jsx13(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
|
|
2476
2563
|
|
|
2477
2564
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2478
|
-
import { jsx as
|
|
2565
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2479
2566
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
2480
|
-
const [, setTick] =
|
|
2567
|
+
const [, setTick] = useState10(0);
|
|
2481
2568
|
useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2482
|
-
const [error, setError] =
|
|
2569
|
+
const [error, setError] = useState10(null);
|
|
2483
2570
|
const state = controller.getState();
|
|
2484
2571
|
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
|
|
2485
2572
|
const tool = state.activeTool;
|
|
@@ -2491,8 +2578,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2491
2578
|
setError(userErrorMessage(err));
|
|
2492
2579
|
}
|
|
2493
2580
|
};
|
|
2494
|
-
return /* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2582
|
+
/* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx14(
|
|
2496
2583
|
"button",
|
|
2497
2584
|
{
|
|
2498
2585
|
type: "button",
|
|
@@ -2504,18 +2591,18 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2504
2591
|
},
|
|
2505
2592
|
t.id
|
|
2506
2593
|
)) }),
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
/* @__PURE__ */
|
|
2594
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
2595
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2596
|
+
/* @__PURE__ */ jsx14(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
|
|
2597
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "FG" })
|
|
2511
2598
|
] }),
|
|
2512
|
-
/* @__PURE__ */
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2599
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2600
|
+
/* @__PURE__ */ jsx14(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
|
|
2601
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "BG" })
|
|
2515
2602
|
] }),
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2518
|
-
state.activeTool === "brush" && /* @__PURE__ */
|
|
2603
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2604
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2605
|
+
state.activeTool === "brush" && /* @__PURE__ */ jsx14(
|
|
2519
2606
|
"button",
|
|
2520
2607
|
{
|
|
2521
2608
|
type: "button",
|
|
@@ -2527,8 +2614,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2527
2614
|
}
|
|
2528
2615
|
)
|
|
2529
2616
|
] }),
|
|
2530
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */
|
|
2531
|
-
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2617
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx14(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
2618
|
+
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(
|
|
2532
2619
|
ControlSlider,
|
|
2533
2620
|
{
|
|
2534
2621
|
spec,
|
|
@@ -2537,9 +2624,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2537
2624
|
},
|
|
2538
2625
|
spec.id
|
|
2539
2626
|
)),
|
|
2540
|
-
state.activeTool === "mixer" && /* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2627
|
+
state.activeTool === "mixer" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
2628
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2629
|
+
/* @__PURE__ */ jsx14(
|
|
2543
2630
|
"span",
|
|
2544
2631
|
{
|
|
2545
2632
|
"aria-label": "Brush load",
|
|
@@ -2548,10 +2635,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2548
2635
|
style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
|
|
2549
2636
|
}
|
|
2550
2637
|
),
|
|
2551
|
-
/* @__PURE__ */
|
|
2552
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2639
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2553
2640
|
] }),
|
|
2554
|
-
/* @__PURE__ */
|
|
2641
|
+
/* @__PURE__ */ jsx14("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx14(
|
|
2555
2642
|
"button",
|
|
2556
2643
|
{
|
|
2557
2644
|
type: "button",
|
|
@@ -2563,34 +2650,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2563
2650
|
},
|
|
2564
2651
|
m.id
|
|
2565
2652
|
)) }),
|
|
2566
|
-
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2653
|
+
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
2654
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
2655
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2656
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
2570
2657
|
"Load each stroke"
|
|
2571
2658
|
] }),
|
|
2572
|
-
/* @__PURE__ */
|
|
2573
|
-
/* @__PURE__ */
|
|
2659
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2660
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
2574
2661
|
"Clean each stroke"
|
|
2575
2662
|
] })
|
|
2576
2663
|
] })
|
|
2577
2664
|
] }),
|
|
2578
|
-
isRetouchPaintTool(tool) && /* @__PURE__ */
|
|
2579
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2581
|
-
cloneSource && /* @__PURE__ */
|
|
2665
|
+
isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
2666
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2667
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
|
|
2668
|
+
cloneSource && /* @__PURE__ */ jsx14("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2582
2669
|
] }),
|
|
2583
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */
|
|
2584
|
-
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2585
|
-
/* @__PURE__ */
|
|
2586
|
-
/* @__PURE__ */
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
!cloneTransformView(controller).identity && /* @__PURE__ */
|
|
2670
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
2671
|
+
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
|
|
2672
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2673
|
+
/* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
|
|
2674
|
+
/* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
|
|
2675
|
+
!cloneTransformView(controller).identity && /* @__PURE__ */ jsx14("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
2589
2676
|
] })
|
|
2590
2677
|
] }),
|
|
2591
|
-
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */
|
|
2592
|
-
/* @__PURE__ */
|
|
2593
|
-
choice.options.map((o) => /* @__PURE__ */
|
|
2678
|
+
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
2679
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: choice.label }),
|
|
2680
|
+
choice.options.map((o) => /* @__PURE__ */ jsx14(
|
|
2594
2681
|
"button",
|
|
2595
2682
|
{
|
|
2596
2683
|
type: "button",
|
|
@@ -2603,43 +2690,43 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
2603
2690
|
o.id
|
|
2604
2691
|
))
|
|
2605
2692
|
] }, choice.id)),
|
|
2606
|
-
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2693
|
+
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
2694
|
+
/* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2695
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
2609
2696
|
t.label
|
|
2610
2697
|
] }, t.id)) })
|
|
2611
2698
|
] }),
|
|
2612
|
-
/* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
/* @__PURE__ */
|
|
2699
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
2700
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2701
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
2615
2702
|
"Pressure size"
|
|
2616
2703
|
] }),
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2705
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
2619
2706
|
"Pressure opacity"
|
|
2620
2707
|
] })
|
|
2621
2708
|
] }),
|
|
2622
|
-
/* @__PURE__ */
|
|
2623
|
-
/* @__PURE__ */
|
|
2624
|
-
/* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex gap-1", children: [
|
|
2710
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2711
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2625
2712
|
] }),
|
|
2626
|
-
error && /* @__PURE__ */
|
|
2713
|
+
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error })
|
|
2627
2714
|
] });
|
|
2628
2715
|
};
|
|
2629
2716
|
|
|
2630
2717
|
// src/image-editor/ColorProfilePanel.tsx
|
|
2631
|
-
import { useEffect as useEffect9, useState as
|
|
2718
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
2632
2719
|
import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
|
|
2633
|
-
import { Fragment as Fragment2, jsx as
|
|
2720
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2634
2721
|
var chip = imageChipClass(false);
|
|
2635
2722
|
var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
2636
2723
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
2637
|
-
const [, setTick] =
|
|
2724
|
+
const [, setTick] = useState11(0);
|
|
2638
2725
|
useEffect9(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2639
|
-
const [target, setTarget] =
|
|
2640
|
-
const [intent, setIntent] =
|
|
2641
|
-
const [bpc, setBpc] =
|
|
2642
|
-
const [error, setError] =
|
|
2726
|
+
const [target, setTarget] = useState11("display-p3");
|
|
2727
|
+
const [intent, setIntent] = useState11("relative");
|
|
2728
|
+
const [bpc, setBpc] = useState11(true);
|
|
2729
|
+
const [error, setError] = useState11(null);
|
|
2643
2730
|
const view = colorPanelView(controller);
|
|
2644
2731
|
const attempt = (fn) => {
|
|
2645
2732
|
try {
|
|
@@ -2661,29 +2748,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2661
2748
|
})
|
|
2662
2749
|
);
|
|
2663
2750
|
};
|
|
2664
|
-
return /* @__PURE__ */
|
|
2665
|
-
/* @__PURE__ */
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */
|
|
2751
|
+
return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2752
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
2753
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
2754
|
+
/* @__PURE__ */ jsx15("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2668
2755
|
] }),
|
|
2669
|
-
/* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
view.cmykProfileName && /* @__PURE__ */
|
|
2756
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2757
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
2758
|
+
/* @__PURE__ */ jsx15("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2759
|
+
view.cmykProfileName && /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
2673
2760
|
] }),
|
|
2674
|
-
/* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2761
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2762
|
+
/* @__PURE__ */ jsx15("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2763
|
+
/* @__PURE__ */ jsx15("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
2764
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
2765
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
2679
2766
|
"BPC"
|
|
2680
2767
|
] }),
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2769
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
2683
2770
|
] }),
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2771
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2772
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
2773
|
+
/* @__PURE__ */ jsxs13(
|
|
2687
2774
|
"select",
|
|
2688
2775
|
{
|
|
2689
2776
|
"aria-label": "Proof profile",
|
|
@@ -2691,29 +2778,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2691
2778
|
value: view.proof?.id ?? "",
|
|
2692
2779
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
2693
2780
|
children: [
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */
|
|
2781
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: "Off" }),
|
|
2782
|
+
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id))
|
|
2696
2783
|
]
|
|
2697
2784
|
}
|
|
2698
2785
|
),
|
|
2699
|
-
view.proof && /* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2786
|
+
view.proof && /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
2787
|
+
/* @__PURE__ */ jsx15("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) }),
|
|
2788
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
2789
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
2703
2790
|
"Paper"
|
|
2704
2791
|
] }),
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
2793
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
2707
2794
|
"Gamut warning"
|
|
2708
2795
|
] })
|
|
2709
2796
|
] })
|
|
2710
2797
|
] }),
|
|
2711
|
-
error && /* @__PURE__ */
|
|
2798
|
+
error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error })
|
|
2712
2799
|
] });
|
|
2713
2800
|
};
|
|
2714
2801
|
|
|
2715
2802
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
2716
|
-
import { useRef as
|
|
2803
|
+
import { useRef as useRef10, useState as useState14 } from "react";
|
|
2717
2804
|
import {
|
|
2718
2805
|
COLOR_RANGE_PRESETS,
|
|
2719
2806
|
COLOR_RANGE_PRESET_LABELS,
|
|
@@ -2724,20 +2811,20 @@ import {
|
|
|
2724
2811
|
} from "@pixerate/editor/image-editor";
|
|
2725
2812
|
|
|
2726
2813
|
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
2727
|
-
import { useEffect as useEffect10, useMemo as useMemo4, useRef as
|
|
2814
|
+
import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState12 } from "react";
|
|
2728
2815
|
import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
|
|
2729
|
-
import { jsx as
|
|
2816
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2730
2817
|
var button = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
2731
2818
|
var toggle = (on) => `${button} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
2732
2819
|
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
2733
2820
|
const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
|
|
2734
|
-
const [, setRevision] =
|
|
2735
|
-
const [zoom, setZoom] =
|
|
2736
|
-
const [pan, setPan] =
|
|
2737
|
-
const [busy, setBusy] =
|
|
2738
|
-
const [error, setError] =
|
|
2739
|
-
const canvasRef =
|
|
2740
|
-
const panFrom =
|
|
2821
|
+
const [, setRevision] = useState12(0);
|
|
2822
|
+
const [zoom, setZoom] = useState12(1);
|
|
2823
|
+
const [pan, setPan] = useState12({ x: 0, y: 0 });
|
|
2824
|
+
const [busy, setBusy] = useState12(false);
|
|
2825
|
+
const [error, setError] = useState12(null);
|
|
2826
|
+
const canvasRef = useRef8(null);
|
|
2827
|
+
const panFrom = useRef8(null);
|
|
2741
2828
|
const settings = session.settings;
|
|
2742
2829
|
const size = session.previewSize;
|
|
2743
2830
|
useEffect10(() => {
|
|
@@ -2811,7 +2898,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2811
2898
|
};
|
|
2812
2899
|
const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
|
|
2813
2900
|
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
2814
|
-
return /* @__PURE__ */
|
|
2901
|
+
return /* @__PURE__ */ jsxs14(
|
|
2815
2902
|
"div",
|
|
2816
2903
|
{
|
|
2817
2904
|
"data-testid": "select-and-mask-workspace",
|
|
@@ -2819,12 +2906,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2819
2906
|
"aria-label": "Select and Mask",
|
|
2820
2907
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
2821
2908
|
children: [
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
brushTool && /* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx16("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
2910
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
2911
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
2912
|
+
brushTool && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2826
2913
|
"Size",
|
|
2827
|
-
/* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ jsx16(
|
|
2828
2915
|
"input",
|
|
2829
2916
|
{
|
|
2830
2917
|
type: "number",
|
|
@@ -2837,22 +2924,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2837
2924
|
),
|
|
2838
2925
|
"px"
|
|
2839
2926
|
] }),
|
|
2840
|
-
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2927
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
2928
|
+
/* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
2929
|
+
/* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
2843
2930
|
] }),
|
|
2844
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground", children: [
|
|
2845
2932
|
session.edits.length,
|
|
2846
2933
|
" strokes"
|
|
2847
2934
|
] }),
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2935
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
2936
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono text-muted-foreground", children: [
|
|
2850
2937
|
Math.round(zoom * 100),
|
|
2851
2938
|
"%"
|
|
2852
2939
|
] }),
|
|
2853
|
-
session.computing && /* @__PURE__ */
|
|
2940
|
+
session.computing && /* @__PURE__ */ jsx16("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
2854
2941
|
] }),
|
|
2855
|
-
/* @__PURE__ */
|
|
2942
|
+
/* @__PURE__ */ jsx16("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx16(
|
|
2856
2943
|
"canvas",
|
|
2857
2944
|
{
|
|
2858
2945
|
ref: canvasRef,
|
|
@@ -2871,11 +2958,11 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2871
2958
|
}
|
|
2872
2959
|
) })
|
|
2873
2960
|
] }),
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsxs14("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
2962
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
2963
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2877
2964
|
"View",
|
|
2878
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx16(
|
|
2879
2966
|
ImageSelect,
|
|
2880
2967
|
{
|
|
2881
2968
|
label: "View",
|
|
@@ -2885,36 +2972,36 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2885
2972
|
}
|
|
2886
2973
|
)
|
|
2887
2974
|
] }),
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
2976
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2977
|
+
/* @__PURE__ */ jsx16("span", { children: "Opacity" }),
|
|
2978
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2892
2979
|
Math.round(settings.opacity * 100),
|
|
2893
2980
|
"%"
|
|
2894
2981
|
] })
|
|
2895
2982
|
] }),
|
|
2896
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
2897
2984
|
] }),
|
|
2898
|
-
/* @__PURE__ */
|
|
2899
|
-
/* @__PURE__ */
|
|
2985
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2986
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
2900
2987
|
"Show Edge (J)"
|
|
2901
2988
|
] }),
|
|
2902
|
-
/* @__PURE__ */
|
|
2903
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2990
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
2904
2991
|
"Show Original (P)"
|
|
2905
2992
|
] }),
|
|
2906
|
-
/* @__PURE__ */
|
|
2907
|
-
/* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2994
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
2908
2995
|
"Real-Time Refinement"
|
|
2909
2996
|
] }),
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
2997
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2998
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
2912
2999
|
"High Quality Preview"
|
|
2913
3000
|
] }),
|
|
2914
|
-
/* @__PURE__ */
|
|
2915
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
3002
|
+
controller.segmentationProvider && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2916
3003
|
"Mode",
|
|
2917
|
-
/* @__PURE__ */
|
|
3004
|
+
/* @__PURE__ */ jsx16(
|
|
2918
3005
|
ImageSelect,
|
|
2919
3006
|
{
|
|
2920
3007
|
label: "Refine mode",
|
|
@@ -2927,37 +3014,37 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2927
3014
|
}
|
|
2928
3015
|
)
|
|
2929
3016
|
] }),
|
|
2930
|
-
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
2932
|
-
/* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
3017
|
+
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3018
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3019
|
+
/* @__PURE__ */ jsx16("span", { children: c.label }),
|
|
3020
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2934
3021
|
settings.params[c.id],
|
|
2935
3022
|
c.unit
|
|
2936
3023
|
] })
|
|
2937
3024
|
] }),
|
|
2938
|
-
/* @__PURE__ */
|
|
3025
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: `Workspace ${c.label}`, min: c.min, max: c.max, step: c.step, value: settings.params[c.id], onChange: (v) => set({ params: { ...settings.params, [c.id]: v } }) })
|
|
2939
3026
|
] }, c.id)),
|
|
2940
|
-
/* @__PURE__ */
|
|
2941
|
-
/* @__PURE__ */
|
|
3027
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
3028
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
2942
3029
|
"Smart Radius"
|
|
2943
3030
|
] }),
|
|
2944
|
-
/* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
3031
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3032
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3033
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3034
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
2948
3035
|
"Decontaminate Colors",
|
|
2949
3036
|
toLayer ? "" : " (new layer or document outputs)"
|
|
2950
3037
|
] }),
|
|
2951
|
-
/* @__PURE__ */
|
|
3038
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2952
3039
|
settings.decontaminate,
|
|
2953
3040
|
"%"
|
|
2954
3041
|
] })
|
|
2955
3042
|
] }),
|
|
2956
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
2957
3044
|
] }),
|
|
2958
|
-
/* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
2959
3046
|
"Output To",
|
|
2960
|
-
/* @__PURE__ */
|
|
3047
|
+
/* @__PURE__ */ jsx16(
|
|
2961
3048
|
ImageSelect,
|
|
2962
3049
|
{
|
|
2963
3050
|
label: "Output to",
|
|
@@ -2967,16 +3054,16 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2967
3054
|
}
|
|
2968
3055
|
)
|
|
2969
3056
|
] }),
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
3058
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
2972
3059
|
"Remember Settings"
|
|
2973
3060
|
] }),
|
|
2974
|
-
(error ?? session.error) && /* @__PURE__ */
|
|
2975
|
-
session.note && /* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
3061
|
+
(error ?? session.error) && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3062
|
+
session.note && /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: session.note }),
|
|
3063
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1 mt-auto", children: [
|
|
3064
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => session.reset(), children: "Reset" }),
|
|
3065
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => onClose(null), children: "Cancel" }),
|
|
3066
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
2980
3067
|
] })
|
|
2981
3068
|
] })
|
|
2982
3069
|
]
|
|
@@ -2985,21 +3072,21 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2985
3072
|
};
|
|
2986
3073
|
|
|
2987
3074
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
2988
|
-
import { useEffect as useEffect11, useMemo as useMemo5, useRef as
|
|
3075
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState13 } from "react";
|
|
2989
3076
|
import { CONTENT_AWARE_FILL_SAMPLING, CONTENT_AWARE_FILL_TOOLS, ContentAwareFillSession } from "@pixerate/editor/image-editor";
|
|
2990
|
-
import { Fragment as Fragment3, jsx as
|
|
3077
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2991
3078
|
var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
2992
3079
|
var toggle2 = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
2993
3080
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
2994
3081
|
const session = useMemo5(() => new ContentAwareFillSession(controller), [controller]);
|
|
2995
|
-
const [, setRevision] =
|
|
2996
|
-
const [zoom, setZoom] =
|
|
2997
|
-
const [pan, setPan] =
|
|
2998
|
-
const [busy, setBusy] =
|
|
2999
|
-
const [error, setError] =
|
|
3000
|
-
const sourceRef =
|
|
3001
|
-
const previewRef =
|
|
3002
|
-
const panFrom =
|
|
3082
|
+
const [, setRevision] = useState13(0);
|
|
3083
|
+
const [zoom, setZoom] = useState13(1);
|
|
3084
|
+
const [pan, setPan] = useState13({ x: 0, y: 0 });
|
|
3085
|
+
const [busy, setBusy] = useState13(false);
|
|
3086
|
+
const [error, setError] = useState13(null);
|
|
3087
|
+
const sourceRef = useRef9(null);
|
|
3088
|
+
const previewRef = useRef9(null);
|
|
3089
|
+
const panFrom = useRef9(null);
|
|
3003
3090
|
const settings = session.settings;
|
|
3004
3091
|
const win = session.window;
|
|
3005
3092
|
useEffect11(() => {
|
|
@@ -3075,14 +3162,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3075
3162
|
session.end();
|
|
3076
3163
|
};
|
|
3077
3164
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
3078
|
-
return /* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3082
|
-
settings.tool === "sampling-brush" && /* @__PURE__ */
|
|
3083
|
-
/* @__PURE__ */
|
|
3165
|
+
return /* @__PURE__ */ jsxs15("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
|
|
3166
|
+
/* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx17("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
3167
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
3168
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
3169
|
+
settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
3170
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3084
3171
|
"Size",
|
|
3085
|
-
/* @__PURE__ */
|
|
3172
|
+
/* @__PURE__ */ jsx17(
|
|
3086
3173
|
"input",
|
|
3087
3174
|
{
|
|
3088
3175
|
type: "number",
|
|
@@ -3095,22 +3182,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3095
3182
|
),
|
|
3096
3183
|
"px"
|
|
3097
3184
|
] }),
|
|
3098
|
-
/* @__PURE__ */
|
|
3099
|
-
/* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3185
|
+
/* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
|
|
3186
|
+
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
3187
|
+
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
3101
3188
|
] })
|
|
3102
3189
|
] }),
|
|
3103
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono text-muted-foreground", children: [
|
|
3104
3191
|
Math.round(zoom * 100),
|
|
3105
3192
|
"%"
|
|
3106
3193
|
] }),
|
|
3107
|
-
!session.showsWholeImage && /* @__PURE__ */
|
|
3108
|
-
session.computing && /* @__PURE__ */
|
|
3194
|
+
!session.showsWholeImage && /* @__PURE__ */ jsx17("button", { type: "button", className: button2, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
|
|
3195
|
+
session.computing && /* @__PURE__ */ jsx17("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
3109
3196
|
] }),
|
|
3110
|
-
/* @__PURE__ */
|
|
3111
|
-
/* @__PURE__ */
|
|
3112
|
-
/* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-h-0", children: [
|
|
3199
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
|
|
3200
|
+
/* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17(
|
|
3114
3201
|
"canvas",
|
|
3115
3202
|
{
|
|
3116
3203
|
ref: sourceRef,
|
|
@@ -3122,33 +3209,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3122
3209
|
}
|
|
3123
3210
|
) })
|
|
3124
3211
|
] }),
|
|
3125
|
-
/* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-h-0", children: [
|
|
3213
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Preview" }),
|
|
3214
|
+
/* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
|
|
3128
3215
|
] })
|
|
3129
3216
|
] })
|
|
3130
3217
|
] }),
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */
|
|
3218
|
+
/* @__PURE__ */ jsxs15("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
3219
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
3220
|
+
/* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
|
|
3221
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3222
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
3136
3223
|
"Show Sampling Area"
|
|
3137
3224
|
] }),
|
|
3138
|
-
/* @__PURE__ */
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3226
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3227
|
+
/* @__PURE__ */ jsx17("span", { children: "Opacity" }),
|
|
3228
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3142
3229
|
Math.round(settings.opacity * 100),
|
|
3143
3230
|
"%"
|
|
3144
3231
|
] })
|
|
3145
3232
|
] }),
|
|
3146
|
-
/* @__PURE__ */
|
|
3233
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
3147
3234
|
] }),
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3235
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
|
|
3236
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3150
3237
|
"Seed",
|
|
3151
|
-
/* @__PURE__ */
|
|
3238
|
+
/* @__PURE__ */ jsx17(
|
|
3152
3239
|
"input",
|
|
3153
3240
|
{
|
|
3154
3241
|
type: "number",
|
|
@@ -3159,17 +3246,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3159
3246
|
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
3160
3247
|
}
|
|
3161
3248
|
),
|
|
3162
|
-
/* @__PURE__ */
|
|
3249
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
|
|
3163
3250
|
] }),
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3252
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
|
|
3166
3253
|
"Live Preview"
|
|
3167
3254
|
] }),
|
|
3168
|
-
!settings.livePreview && /* @__PURE__ */
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3255
|
+
!settings.livePreview && /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
|
|
3256
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3257
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3171
3258
|
"Output To",
|
|
3172
|
-
/* @__PURE__ */
|
|
3259
|
+
/* @__PURE__ */ jsx17(
|
|
3173
3260
|
ImageSelect,
|
|
3174
3261
|
{
|
|
3175
3262
|
label: "Fill output",
|
|
@@ -3183,18 +3270,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3183
3270
|
}
|
|
3184
3271
|
)
|
|
3185
3272
|
] }),
|
|
3186
|
-
(error ?? session.error) && /* @__PURE__ */
|
|
3187
|
-
/* @__PURE__ */
|
|
3188
|
-
/* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3273
|
+
(error ?? session.error) && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3274
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1 mt-auto", children: [
|
|
3275
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
|
|
3276
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
|
|
3277
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
3191
3278
|
] })
|
|
3192
3279
|
] })
|
|
3193
3280
|
] });
|
|
3194
3281
|
};
|
|
3195
3282
|
|
|
3196
3283
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
3197
|
-
import { jsx as
|
|
3284
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3198
3285
|
var MODIFY_OPS = [
|
|
3199
3286
|
{ op: "expand", label: "Expand" },
|
|
3200
3287
|
{ op: "contract", label: "Contract" },
|
|
@@ -3218,15 +3305,15 @@ var SelectionOptionsBar = ({
|
|
|
3218
3305
|
selectionDisplay,
|
|
3219
3306
|
className = ""
|
|
3220
3307
|
}) => {
|
|
3221
|
-
const [radius, setRadius] =
|
|
3308
|
+
const [radius, setRadius] = useState14(2);
|
|
3222
3309
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
3223
3310
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3224
3311
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
3225
|
-
const [preset, setPreset] =
|
|
3226
|
-
const [rangeStatus, setRangeStatus] =
|
|
3227
|
-
const [colorStatus, setColorStatus] =
|
|
3228
|
-
const [strokeWidth, setStrokeWidth] =
|
|
3229
|
-
const [strokeLocation, setStrokeLocation] =
|
|
3312
|
+
const [preset, setPreset] = useState14("reds");
|
|
3313
|
+
const [rangeStatus, setRangeStatus] = useState14(null);
|
|
3314
|
+
const [colorStatus, setColorStatus] = useState14(null);
|
|
3315
|
+
const [strokeWidth, setStrokeWidth] = useState14(4);
|
|
3316
|
+
const [strokeLocation, setStrokeLocation] = useState14("outside");
|
|
3230
3317
|
const edit = (fn) => {
|
|
3231
3318
|
setColorStatus(null);
|
|
3232
3319
|
try {
|
|
@@ -3259,8 +3346,8 @@ var SelectionOptionsBar = ({
|
|
|
3259
3346
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
3260
3347
|
}
|
|
3261
3348
|
};
|
|
3262
|
-
const [task, setTask] =
|
|
3263
|
-
const taskAbort =
|
|
3349
|
+
const [task, setTask] = useState14(null);
|
|
3350
|
+
const taskAbort = useRef10(null);
|
|
3264
3351
|
const tracked = () => {
|
|
3265
3352
|
const abort = new AbortController();
|
|
3266
3353
|
taskAbort.current = abort;
|
|
@@ -3272,9 +3359,9 @@ var SelectionOptionsBar = ({
|
|
|
3272
3359
|
setTask(null);
|
|
3273
3360
|
};
|
|
3274
3361
|
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
3275
|
-
const [subject, setSubject] =
|
|
3276
|
-
const [segmenting, setSegmenting] =
|
|
3277
|
-
const [subjectStatus, setSubjectStatus] =
|
|
3362
|
+
const [subject, setSubject] = useState14("");
|
|
3363
|
+
const [segmenting, setSegmenting] = useState14(false);
|
|
3364
|
+
const [subjectStatus, setSubjectStatus] = useState14(null);
|
|
3278
3365
|
const selectSubject = async () => {
|
|
3279
3366
|
const target = subject.trim();
|
|
3280
3367
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -3291,10 +3378,10 @@ var SelectionOptionsBar = ({
|
|
|
3291
3378
|
setSegmenting(false);
|
|
3292
3379
|
}
|
|
3293
3380
|
};
|
|
3294
|
-
const [workspace, setWorkspace] =
|
|
3295
|
-
const [fillWorkspace, setFillWorkspace] =
|
|
3296
|
-
const [skying, setSkying] =
|
|
3297
|
-
const [skyStatus, setSkyStatus] =
|
|
3381
|
+
const [workspace, setWorkspace] = useState14(false);
|
|
3382
|
+
const [fillWorkspace, setFillWorkspace] = useState14(false);
|
|
3383
|
+
const [skying, setSkying] = useState14(false);
|
|
3384
|
+
const [skyStatus, setSkyStatus] = useState14(null);
|
|
3298
3385
|
const selectSky = async () => {
|
|
3299
3386
|
if (skying) return;
|
|
3300
3387
|
setSkying(true);
|
|
@@ -3309,8 +3396,8 @@ var SelectionOptionsBar = ({
|
|
|
3309
3396
|
setSkying(false);
|
|
3310
3397
|
}
|
|
3311
3398
|
};
|
|
3312
|
-
const [focusing, setFocusing] =
|
|
3313
|
-
const [focusStatus, setFocusStatus] =
|
|
3399
|
+
const [focusing, setFocusing] = useState14(false);
|
|
3400
|
+
const [focusStatus, setFocusStatus] = useState14(null);
|
|
3314
3401
|
const selectFocusArea = async () => {
|
|
3315
3402
|
if (focusing) return;
|
|
3316
3403
|
setFocusing(true);
|
|
@@ -3331,24 +3418,24 @@ var SelectionOptionsBar = ({
|
|
|
3331
3418
|
setFocusing(false);
|
|
3332
3419
|
}
|
|
3333
3420
|
};
|
|
3334
|
-
return /* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3337
|
-
options.tool === "wand" && /* @__PURE__ */
|
|
3338
|
-
/* @__PURE__ */
|
|
3339
|
-
/* @__PURE__ */
|
|
3340
|
-
/* @__PURE__ */
|
|
3341
|
-
/* @__PURE__ */
|
|
3421
|
+
return /* @__PURE__ */ jsxs16("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3422
|
+
/* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
3423
|
+
/* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
3424
|
+
options.tool === "wand" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
|
|
3425
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3426
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3427
|
+
/* @__PURE__ */ jsx18("span", { children: "Tolerance" }),
|
|
3428
|
+
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.tolerance })
|
|
3342
3429
|
] }),
|
|
3343
|
-
/* @__PURE__ */
|
|
3430
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
3344
3431
|
] }),
|
|
3345
|
-
/* @__PURE__ */
|
|
3346
|
-
/* @__PURE__ */
|
|
3432
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3433
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
3347
3434
|
"Contiguous"
|
|
3348
3435
|
] }),
|
|
3349
|
-
/* @__PURE__ */
|
|
3436
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3350
3437
|
"Distance",
|
|
3351
|
-
/* @__PURE__ */
|
|
3438
|
+
/* @__PURE__ */ jsx18(
|
|
3352
3439
|
ImageSelect,
|
|
3353
3440
|
{
|
|
3354
3441
|
label: "Colour distance",
|
|
@@ -3361,13 +3448,13 @@ var SelectionOptionsBar = ({
|
|
|
3361
3448
|
}
|
|
3362
3449
|
)
|
|
3363
3450
|
] }),
|
|
3364
|
-
/* @__PURE__ */
|
|
3365
|
-
/* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3452
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
3366
3453
|
"Sample adjusted image"
|
|
3367
3454
|
] }),
|
|
3368
|
-
/* @__PURE__ */
|
|
3455
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3369
3456
|
"Sample",
|
|
3370
|
-
/* @__PURE__ */
|
|
3457
|
+
/* @__PURE__ */ jsx18(
|
|
3371
3458
|
ImageSelect,
|
|
3372
3459
|
{
|
|
3373
3460
|
label: "Sample from",
|
|
@@ -3381,77 +3468,77 @@ var SelectionOptionsBar = ({
|
|
|
3381
3468
|
)
|
|
3382
3469
|
] })
|
|
3383
3470
|
] }),
|
|
3384
|
-
options.tool === "polygon" && /* @__PURE__ */
|
|
3385
|
-
options.tool === "magnetic" && /* @__PURE__ */
|
|
3386
|
-
/* @__PURE__ */
|
|
3387
|
-
/* @__PURE__ */
|
|
3388
|
-
/* @__PURE__ */
|
|
3389
|
-
/* @__PURE__ */
|
|
3390
|
-
/* @__PURE__ */
|
|
3471
|
+
options.tool === "polygon" && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
|
|
3472
|
+
options.tool === "magnetic" && /* @__PURE__ */ jsxs16("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
3473
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
|
|
3474
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3475
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3476
|
+
/* @__PURE__ */ jsx18("span", { children: "Width" }),
|
|
3477
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3391
3478
|
options.magneticWidth ?? 10,
|
|
3392
3479
|
" px"
|
|
3393
3480
|
] })
|
|
3394
3481
|
] }),
|
|
3395
|
-
/* @__PURE__ */
|
|
3482
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
3396
3483
|
] }),
|
|
3397
|
-
/* @__PURE__ */
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3484
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3485
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3486
|
+
/* @__PURE__ */ jsx18("span", { children: "Contrast" }),
|
|
3487
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3401
3488
|
options.magneticContrast ?? 10,
|
|
3402
3489
|
"%"
|
|
3403
3490
|
] })
|
|
3404
3491
|
] }),
|
|
3405
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
3406
3493
|
] }),
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
/* @__PURE__ */
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3495
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3496
|
+
/* @__PURE__ */ jsx18("span", { children: "Frequency" }),
|
|
3497
|
+
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
3411
3498
|
] }),
|
|
3412
|
-
/* @__PURE__ */
|
|
3499
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
3413
3500
|
] })
|
|
3414
3501
|
] }),
|
|
3415
|
-
options.tool === "quick" && /* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3417
|
-
/* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
3420
|
-
/* @__PURE__ */
|
|
3502
|
+
options.tool === "quick" && /* @__PURE__ */ jsxs16("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
3503
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
3504
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3505
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3506
|
+
/* @__PURE__ */ jsx18("span", { children: "Size" }),
|
|
3507
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3421
3508
|
options.quickSize ?? 30,
|
|
3422
3509
|
" px"
|
|
3423
3510
|
] })
|
|
3424
3511
|
] }),
|
|
3425
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
3426
3513
|
] }),
|
|
3427
|
-
/* @__PURE__ */
|
|
3428
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3515
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
3429
3516
|
"Sample all layers"
|
|
3430
3517
|
] }),
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3518
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3519
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
3433
3520
|
"Auto-enhance edges"
|
|
3434
3521
|
] })
|
|
3435
3522
|
] }),
|
|
3436
|
-
options.tool === "object" && /* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
3438
|
-
/* @__PURE__ */
|
|
3439
|
-
/* @__PURE__ */
|
|
3523
|
+
options.tool === "object" && /* @__PURE__ */ jsxs16("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
3524
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
3525
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3526
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
3440
3527
|
"Sample all layers"
|
|
3441
3528
|
] }),
|
|
3442
|
-
/* @__PURE__ */
|
|
3443
|
-
/* @__PURE__ */
|
|
3529
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3530
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
3444
3531
|
"Auto-enhance edges"
|
|
3445
3532
|
] })
|
|
3446
3533
|
] }),
|
|
3447
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */
|
|
3448
|
-
/* @__PURE__ */
|
|
3534
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs16("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
3535
|
+
/* @__PURE__ */ jsxs16("p", { className: "text-muted-foreground", children: [
|
|
3449
3536
|
options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
|
|
3450
3537
|
" Shift-click adds, Alt-click subtracts."
|
|
3451
3538
|
] }),
|
|
3452
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3453
3540
|
"Text",
|
|
3454
|
-
/* @__PURE__ */
|
|
3541
|
+
/* @__PURE__ */ jsx18(
|
|
3455
3542
|
"input",
|
|
3456
3543
|
{
|
|
3457
3544
|
type: "text",
|
|
@@ -3462,9 +3549,9 @@ var SelectionOptionsBar = ({
|
|
|
3462
3549
|
}
|
|
3463
3550
|
)
|
|
3464
3551
|
] }),
|
|
3465
|
-
/* @__PURE__ */
|
|
3552
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3466
3553
|
"Size",
|
|
3467
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsx18(
|
|
3468
3555
|
"input",
|
|
3469
3556
|
{
|
|
3470
3557
|
type: "number",
|
|
@@ -3478,9 +3565,9 @@ var SelectionOptionsBar = ({
|
|
|
3478
3565
|
),
|
|
3479
3566
|
"px"
|
|
3480
3567
|
] }),
|
|
3481
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3482
3569
|
"Font",
|
|
3483
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsx18(
|
|
3484
3571
|
"input",
|
|
3485
3572
|
{
|
|
3486
3573
|
type: "text",
|
|
@@ -3492,18 +3579,18 @@ var SelectionOptionsBar = ({
|
|
|
3492
3579
|
)
|
|
3493
3580
|
] })
|
|
3494
3581
|
] }),
|
|
3495
|
-
options.tool === "range" && /* @__PURE__ */
|
|
3496
|
-
/* @__PURE__ */
|
|
3497
|
-
/* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */
|
|
3499
|
-
/* @__PURE__ */
|
|
3500
|
-
/* @__PURE__ */
|
|
3582
|
+
options.tool === "range" && /* @__PURE__ */ jsxs16("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
3583
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
3584
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3585
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3586
|
+
/* @__PURE__ */ jsx18("span", { children: "Fuzziness" }),
|
|
3587
|
+
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
3501
3588
|
] }),
|
|
3502
|
-
/* @__PURE__ */
|
|
3589
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
3503
3590
|
] }),
|
|
3504
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3505
3592
|
"Localized radius",
|
|
3506
|
-
/* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ jsx18(
|
|
3507
3594
|
"input",
|
|
3508
3595
|
{
|
|
3509
3596
|
type: "number",
|
|
@@ -3517,12 +3604,12 @@ var SelectionOptionsBar = ({
|
|
|
3517
3604
|
),
|
|
3518
3605
|
"px"
|
|
3519
3606
|
] }),
|
|
3520
|
-
/* @__PURE__ */
|
|
3521
|
-
/* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3608
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
3522
3609
|
"Invert"
|
|
3523
3610
|
] }),
|
|
3524
|
-
/* @__PURE__ */
|
|
3525
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
3612
|
+
/* @__PURE__ */ jsx18(
|
|
3526
3613
|
ImageSelect,
|
|
3527
3614
|
{
|
|
3528
3615
|
label: "Color Range preset",
|
|
@@ -3531,13 +3618,13 @@ var SelectionOptionsBar = ({
|
|
|
3531
3618
|
onChange: (v) => setPreset(v)
|
|
3532
3619
|
}
|
|
3533
3620
|
),
|
|
3534
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
3535
3622
|
] }),
|
|
3536
|
-
rangeStatus && /* @__PURE__ */
|
|
3623
|
+
rangeStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
3537
3624
|
] }),
|
|
3538
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3539
3626
|
"Feather",
|
|
3540
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsx18(
|
|
3541
3628
|
"input",
|
|
3542
3629
|
{
|
|
3543
3630
|
type: "number",
|
|
@@ -3552,7 +3639,7 @@ var SelectionOptionsBar = ({
|
|
|
3552
3639
|
),
|
|
3553
3640
|
"px"
|
|
3554
3641
|
] }),
|
|
3555
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsxs16(
|
|
3556
3643
|
"form",
|
|
3557
3644
|
{
|
|
3558
3645
|
"data-testid": "select-subject",
|
|
@@ -3562,8 +3649,8 @@ var SelectionOptionsBar = ({
|
|
|
3562
3649
|
void selectSubject();
|
|
3563
3650
|
},
|
|
3564
3651
|
children: [
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3652
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1", children: [
|
|
3653
|
+
controller.segmentationProvider && /* @__PURE__ */ jsx18(
|
|
3567
3654
|
"input",
|
|
3568
3655
|
{
|
|
3569
3656
|
type: "text",
|
|
@@ -3575,7 +3662,7 @@ var SelectionOptionsBar = ({
|
|
|
3575
3662
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
3576
3663
|
}
|
|
3577
3664
|
),
|
|
3578
|
-
/* @__PURE__ */
|
|
3665
|
+
/* @__PURE__ */ jsx18(
|
|
3579
3666
|
"button",
|
|
3580
3667
|
{
|
|
3581
3668
|
type: "submit",
|
|
@@ -3587,12 +3674,12 @@ var SelectionOptionsBar = ({
|
|
|
3587
3674
|
}
|
|
3588
3675
|
)
|
|
3589
3676
|
] }),
|
|
3590
|
-
subjectStatus && /* @__PURE__ */
|
|
3677
|
+
subjectStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
3591
3678
|
]
|
|
3592
3679
|
}
|
|
3593
3680
|
),
|
|
3594
|
-
task && /* @__PURE__ */
|
|
3595
|
-
/* @__PURE__ */
|
|
3681
|
+
task && /* @__PURE__ */ jsxs16("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
3682
|
+
/* @__PURE__ */ jsx18(
|
|
3596
3683
|
"div",
|
|
3597
3684
|
{
|
|
3598
3685
|
role: "progressbar",
|
|
@@ -3601,69 +3688,69 @@ var SelectionOptionsBar = ({
|
|
|
3601
3688
|
"aria-valuemax": 100,
|
|
3602
3689
|
"aria-valuenow": Math.round(task.fraction * 100),
|
|
3603
3690
|
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
3604
|
-
children: /* @__PURE__ */
|
|
3691
|
+
children: /* @__PURE__ */ jsx18("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
3605
3692
|
}
|
|
3606
3693
|
),
|
|
3607
|
-
/* @__PURE__ */
|
|
3608
|
-
/* @__PURE__ */
|
|
3694
|
+
/* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: task.stage }),
|
|
3695
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
3609
3696
|
] }),
|
|
3610
|
-
/* @__PURE__ */
|
|
3611
|
-
workspace && /* @__PURE__ */
|
|
3612
|
-
/* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
skyStatus && /* @__PURE__ */
|
|
3697
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
3698
|
+
workspace && /* @__PURE__ */ jsx18(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
3699
|
+
/* @__PURE__ */ jsxs16("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
3700
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
3701
|
+
skyStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
3615
3702
|
] }),
|
|
3616
|
-
/* @__PURE__ */
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
/* @__PURE__ */
|
|
3619
|
-
/* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3703
|
+
/* @__PURE__ */ jsxs16("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
3704
|
+
/* @__PURE__ */ jsx18("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
3705
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
3706
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3707
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3708
|
+
/* @__PURE__ */ jsx18("span", { children: "In-focus range" }),
|
|
3709
|
+
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
3623
3710
|
] }),
|
|
3624
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
3625
3712
|
] }),
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3629
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3714
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3715
|
+
/* @__PURE__ */ jsx18("span", { children: "Image noise level" }),
|
|
3716
|
+
/* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
3630
3717
|
] }),
|
|
3631
|
-
/* @__PURE__ */
|
|
3718
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
3632
3719
|
] }),
|
|
3633
|
-
/* @__PURE__ */
|
|
3634
|
-
/* @__PURE__ */
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
3720
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3721
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3722
|
+
/* @__PURE__ */ jsx18("span", { children: "Soften edge" }),
|
|
3723
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3637
3724
|
options.focusSoftness ?? 4,
|
|
3638
3725
|
" px"
|
|
3639
3726
|
] })
|
|
3640
3727
|
] }),
|
|
3641
|
-
/* @__PURE__ */
|
|
3728
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
3642
3729
|
] }),
|
|
3643
|
-
/* @__PURE__ */
|
|
3644
|
-
focusStatus && /* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
3731
|
+
focusStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
3645
3732
|
] })
|
|
3646
3733
|
] }),
|
|
3647
|
-
/* @__PURE__ */
|
|
3648
|
-
/* @__PURE__ */
|
|
3734
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3735
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
3649
3736
|
"Anti-alias"
|
|
3650
3737
|
] }),
|
|
3651
|
-
/* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3657
|
-
/* @__PURE__ */
|
|
3738
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-1", children: [
|
|
3739
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
3740
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
3741
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
3742
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
3743
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
3744
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
3658
3745
|
] }),
|
|
3659
|
-
/* @__PURE__ */
|
|
3660
|
-
/* @__PURE__ */
|
|
3661
|
-
DISPLAYS.map((d) => /* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3747
|
+
/* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Show" }),
|
|
3748
|
+
DISPLAYS.map((d) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
3662
3749
|
] }),
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3750
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3751
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3665
3752
|
"Radius",
|
|
3666
|
-
/* @__PURE__ */
|
|
3753
|
+
/* @__PURE__ */ jsx18(
|
|
3667
3754
|
"input",
|
|
3668
3755
|
{
|
|
3669
3756
|
type: "number",
|
|
@@ -3677,12 +3764,12 @@ var SelectionOptionsBar = ({
|
|
|
3677
3764
|
}
|
|
3678
3765
|
)
|
|
3679
3766
|
] }),
|
|
3680
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
3767
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
3681
3768
|
] }),
|
|
3682
|
-
/* @__PURE__ */
|
|
3683
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3770
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3684
3771
|
"Stroke",
|
|
3685
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsx18(
|
|
3686
3773
|
"input",
|
|
3687
3774
|
{
|
|
3688
3775
|
type: "number",
|
|
@@ -3697,7 +3784,7 @@ var SelectionOptionsBar = ({
|
|
|
3697
3784
|
),
|
|
3698
3785
|
"px"
|
|
3699
3786
|
] }),
|
|
3700
|
-
/* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ jsx18(
|
|
3701
3788
|
ImageSelect,
|
|
3702
3789
|
{
|
|
3703
3790
|
label: "Stroke location",
|
|
@@ -3710,28 +3797,28 @@ var SelectionOptionsBar = ({
|
|
|
3710
3797
|
onChange: (v) => setStrokeLocation(v)
|
|
3711
3798
|
}
|
|
3712
3799
|
),
|
|
3713
|
-
/* @__PURE__ */
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3717
|
-
fillWorkspace && /* @__PURE__ */
|
|
3800
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
3801
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
3802
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
|
|
3803
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
|
|
3804
|
+
fillWorkspace && /* @__PURE__ */ jsx18(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
|
|
3718
3805
|
] }),
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
3722
|
-
/* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
3726
|
-
/* @__PURE__ */
|
|
3806
|
+
/* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
3807
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
3808
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
3809
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
3810
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
3811
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
3812
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
3813
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
3727
3814
|
] }),
|
|
3728
|
-
colorStatus && /* @__PURE__ */
|
|
3729
|
-
/* @__PURE__ */
|
|
3815
|
+
colorStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
3816
|
+
/* @__PURE__ */ jsx18("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
3730
3817
|
] });
|
|
3731
3818
|
};
|
|
3732
3819
|
|
|
3733
3820
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3734
|
-
import { useState as
|
|
3821
|
+
import { useState as useState16 } from "react";
|
|
3735
3822
|
import {
|
|
3736
3823
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3737
3824
|
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
@@ -3741,14 +3828,14 @@ import {
|
|
|
3741
3828
|
} from "@pixerate/editor/image-editor";
|
|
3742
3829
|
|
|
3743
3830
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
3744
|
-
import
|
|
3831
|
+
import React14, { useState as useState15 } from "react";
|
|
3745
3832
|
import { MASK_EDGE_THRESHOLDS } from "@pixerate/editor/image-editor";
|
|
3746
|
-
import { Fragment as Fragment4, jsx as
|
|
3833
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3747
3834
|
var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
3748
3835
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
3749
3836
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3750
|
-
const [result, setResult] =
|
|
3751
|
-
const [error, setError] =
|
|
3837
|
+
const [result, setResult] = useState15(null);
|
|
3838
|
+
const [error, setError] = useState15(null);
|
|
3752
3839
|
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
3753
3840
|
const check = () => {
|
|
3754
3841
|
setError(null);
|
|
@@ -3766,40 +3853,40 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
3766
3853
|
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
3767
3854
|
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
3768
3855
|
] : [];
|
|
3769
|
-
return /* @__PURE__ */
|
|
3770
|
-
/* @__PURE__ */
|
|
3771
|
-
report && /* @__PURE__ */
|
|
3772
|
-
/* @__PURE__ */
|
|
3773
|
-
rows.map((r) => /* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
3856
|
+
return /* @__PURE__ */ jsxs17("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
3857
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: `${button3} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
3858
|
+
report && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
3859
|
+
/* @__PURE__ */ jsxs17("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
3860
|
+
rows.map((r) => /* @__PURE__ */ jsxs17(React14.Fragment, { children: [
|
|
3861
|
+
/* @__PURE__ */ jsx19("dt", { className: "text-muted-foreground", children: r.label }),
|
|
3862
|
+
/* @__PURE__ */ jsx19("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
3776
3863
|
] }, r.label)),
|
|
3777
|
-
/* @__PURE__ */
|
|
3778
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsx19("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
3865
|
+
/* @__PURE__ */ jsxs17("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
3779
3866
|
report.holes.count,
|
|
3780
3867
|
" / ",
|
|
3781
3868
|
report.islands.count
|
|
3782
3869
|
] })
|
|
3783
3870
|
] }),
|
|
3784
|
-
report.issues.length ? /* @__PURE__ */
|
|
3871
|
+
report.issues.length ? /* @__PURE__ */ jsx19("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx19("li", { children: s }, s)) }) : /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
3785
3872
|
] }),
|
|
3786
|
-
error && /* @__PURE__ */
|
|
3873
|
+
error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error })
|
|
3787
3874
|
] });
|
|
3788
3875
|
};
|
|
3789
3876
|
|
|
3790
3877
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3791
|
-
import { Fragment as Fragment5, jsx as
|
|
3878
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3792
3879
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3793
3880
|
var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
3794
3881
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
3795
|
-
const [params, setParams] =
|
|
3796
|
-
const [busy, setBusy] =
|
|
3797
|
-
const [error, setError] =
|
|
3798
|
-
const [layerId, setLayerId] =
|
|
3799
|
-
const [newKind, setNewKind] =
|
|
3800
|
-
const [output, setOutput] =
|
|
3801
|
-
const [decontaminate, setDecontaminate] =
|
|
3802
|
-
const [objectAware, setObjectAware] =
|
|
3882
|
+
const [params, setParams] = useState16(DEFAULT_PARAMS);
|
|
3883
|
+
const [busy, setBusy] = useState16(false);
|
|
3884
|
+
const [error, setError] = useState16(null);
|
|
3885
|
+
const [layerId, setLayerId] = useState16("");
|
|
3886
|
+
const [newKind, setNewKind] = useState16("hueSaturation");
|
|
3887
|
+
const [output, setOutput] = useState16("selection");
|
|
3888
|
+
const [decontaminate, setDecontaminate] = useState16(0);
|
|
3889
|
+
const [objectAware, setObjectAware] = useState16(false);
|
|
3803
3890
|
const canObject = Boolean(controller.segmentationProvider);
|
|
3804
3891
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
3805
3892
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -3819,17 +3906,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3819
3906
|
setBusy(false);
|
|
3820
3907
|
}
|
|
3821
3908
|
};
|
|
3822
|
-
return /* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */
|
|
3825
|
-
/* @__PURE__ */
|
|
3826
|
-
/* @__PURE__ */
|
|
3827
|
-
/* @__PURE__ */
|
|
3909
|
+
return /* @__PURE__ */ jsxs18("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3910
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
3911
|
+
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3912
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3913
|
+
/* @__PURE__ */ jsx20("span", { children: c.label }),
|
|
3914
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3828
3915
|
params[c.id],
|
|
3829
3916
|
c.unit
|
|
3830
3917
|
] })
|
|
3831
3918
|
] }),
|
|
3832
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx20(
|
|
3833
3920
|
"input",
|
|
3834
3921
|
{
|
|
3835
3922
|
type: "range",
|
|
@@ -3843,39 +3930,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3843
3930
|
}
|
|
3844
3931
|
)
|
|
3845
3932
|
] }, c.id)),
|
|
3846
|
-
/* @__PURE__ */
|
|
3847
|
-
/* @__PURE__ */
|
|
3933
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3934
|
+
/* @__PURE__ */ jsx20("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
3848
3935
|
"Smart Radius"
|
|
3849
3936
|
] }),
|
|
3850
|
-
canObject && /* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3937
|
+
canObject && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3938
|
+
/* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
3852
3939
|
"Object aware (segmentation model)"
|
|
3853
3940
|
] }),
|
|
3854
|
-
/* @__PURE__ */
|
|
3941
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3855
3942
|
"Output to",
|
|
3856
|
-
/* @__PURE__ */
|
|
3943
|
+
/* @__PURE__ */ jsx20(
|
|
3857
3944
|
"select",
|
|
3858
3945
|
{
|
|
3859
3946
|
"aria-label": "Refine output",
|
|
3860
3947
|
value: output,
|
|
3861
3948
|
onChange: (e) => setOutput(e.target.value),
|
|
3862
3949
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3863
|
-
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */
|
|
3950
|
+
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx20("option", { value: o.id, children: o.label }, o.id))
|
|
3864
3951
|
}
|
|
3865
3952
|
)
|
|
3866
3953
|
] }),
|
|
3867
|
-
/* @__PURE__ */
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3954
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3955
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3956
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3870
3957
|
"Decontaminate colors",
|
|
3871
3958
|
toLayer ? "" : " (new layer or document outputs)"
|
|
3872
3959
|
] }),
|
|
3873
|
-
/* @__PURE__ */
|
|
3960
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3874
3961
|
decontaminate,
|
|
3875
3962
|
"%"
|
|
3876
3963
|
] })
|
|
3877
3964
|
] }),
|
|
3878
|
-
/* @__PURE__ */
|
|
3965
|
+
/* @__PURE__ */ jsx20(
|
|
3879
3966
|
"input",
|
|
3880
3967
|
{
|
|
3881
3968
|
type: "range",
|
|
@@ -3890,25 +3977,25 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3890
3977
|
}
|
|
3891
3978
|
)
|
|
3892
3979
|
] }),
|
|
3893
|
-
/* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3980
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
|
|
3981
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
3982
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
3896
3983
|
] }),
|
|
3897
|
-
error && /* @__PURE__ */
|
|
3898
|
-
/* @__PURE__ */
|
|
3899
|
-
/* @__PURE__ */
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3984
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error }),
|
|
3985
|
+
/* @__PURE__ */ jsx20(MaskEdgeCheck, { controller, selection: sel }),
|
|
3986
|
+
/* @__PURE__ */ jsx20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
3987
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-1 items-center", children: [
|
|
3988
|
+
/* @__PURE__ */ jsx20(
|
|
3902
3989
|
"select",
|
|
3903
3990
|
{
|
|
3904
3991
|
"aria-label": "New masked layer kind",
|
|
3905
3992
|
value: newKind,
|
|
3906
3993
|
onChange: (e) => setNewKind(e.target.value),
|
|
3907
3994
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3908
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
3995
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx20("option", { value: k.kind, children: k.label }, k.kind))
|
|
3909
3996
|
}
|
|
3910
3997
|
),
|
|
3911
|
-
/* @__PURE__ */
|
|
3998
|
+
/* @__PURE__ */ jsx20(
|
|
3912
3999
|
"button",
|
|
3913
4000
|
{
|
|
3914
4001
|
type: "button",
|
|
@@ -3919,35 +4006,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3919
4006
|
}
|
|
3920
4007
|
)
|
|
3921
4008
|
] }),
|
|
3922
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
3923
|
-
/* @__PURE__ */
|
|
4009
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
|
|
4010
|
+
/* @__PURE__ */ jsx20(
|
|
3924
4011
|
"select",
|
|
3925
4012
|
{
|
|
3926
4013
|
"aria-label": "Mask layer",
|
|
3927
4014
|
value: target.id,
|
|
3928
4015
|
onChange: (e) => setLayerId(e.target.value),
|
|
3929
4016
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3930
|
-
children: list.map((l) => /* @__PURE__ */
|
|
4017
|
+
children: list.map((l) => /* @__PURE__ */ jsxs18("option", { value: l.id, children: [
|
|
3931
4018
|
l.name || adjustmentKindLabel2(l.kind),
|
|
3932
4019
|
l.mask ? " (masked)" : ""
|
|
3933
4020
|
] }, l.id))
|
|
3934
4021
|
}
|
|
3935
4022
|
),
|
|
3936
|
-
/* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
3938
|
-
/* @__PURE__ */
|
|
3939
|
-
/* @__PURE__ */
|
|
4023
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
|
|
4024
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4025
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4026
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
3940
4027
|
] }),
|
|
3941
|
-
target.mask && /* @__PURE__ */
|
|
3942
|
-
/* @__PURE__ */
|
|
3943
|
-
/* @__PURE__ */
|
|
3944
|
-
/* @__PURE__ */
|
|
3945
|
-
/* @__PURE__ */
|
|
4028
|
+
target.mask && /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
4029
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
4030
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4031
|
+
/* @__PURE__ */ jsx20("span", { children: "Density" }),
|
|
4032
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3946
4033
|
Math.round((target.mask.density ?? 1) * 100),
|
|
3947
4034
|
"%"
|
|
3948
4035
|
] })
|
|
3949
4036
|
] }),
|
|
3950
|
-
/* @__PURE__ */
|
|
4037
|
+
/* @__PURE__ */ jsx20(
|
|
3951
4038
|
"input",
|
|
3952
4039
|
{
|
|
3953
4040
|
type: "range",
|
|
@@ -3961,15 +4048,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3961
4048
|
}
|
|
3962
4049
|
)
|
|
3963
4050
|
] }),
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
/* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */
|
|
3967
|
-
/* @__PURE__ */
|
|
4051
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
4052
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4053
|
+
/* @__PURE__ */ jsx20("span", { children: "Mask Feather" }),
|
|
4054
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3968
4055
|
target.mask.feather ?? 0,
|
|
3969
4056
|
"px"
|
|
3970
4057
|
] })
|
|
3971
4058
|
] }),
|
|
3972
|
-
/* @__PURE__ */
|
|
4059
|
+
/* @__PURE__ */ jsx20(
|
|
3973
4060
|
"input",
|
|
3974
4061
|
{
|
|
3975
4062
|
type: "range",
|
|
@@ -3989,12 +4076,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3989
4076
|
};
|
|
3990
4077
|
|
|
3991
4078
|
// src/image-editor/ChannelsPanel.tsx
|
|
3992
|
-
import { useEffect as useEffect12, useRef as
|
|
4079
|
+
import { useEffect as useEffect12, useRef as useRef11, useState as useState17 } from "react";
|
|
3993
4080
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3994
|
-
import { jsx as
|
|
4081
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3995
4082
|
var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
3996
4083
|
var ChannelThumb = ({ channel, size }) => {
|
|
3997
|
-
const ref =
|
|
4084
|
+
const ref = useRef11(null);
|
|
3998
4085
|
useEffect12(() => {
|
|
3999
4086
|
const canvas = ref.current;
|
|
4000
4087
|
const ctx = canvas?.getContext("2d");
|
|
@@ -4006,15 +4093,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
4006
4093
|
img.data.set(px.data);
|
|
4007
4094
|
ctx.putImageData(img, 0, 0);
|
|
4008
4095
|
}, [channel.mask]);
|
|
4009
|
-
return /* @__PURE__ */
|
|
4096
|
+
return /* @__PURE__ */ jsx21("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
4010
4097
|
};
|
|
4011
4098
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4012
|
-
const [, setTick] =
|
|
4099
|
+
const [, setTick] = useState17(0);
|
|
4013
4100
|
useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4014
|
-
const [activeId, setActiveId] =
|
|
4015
|
-
const [renaming, setRenaming] =
|
|
4016
|
-
const [error, setError] =
|
|
4017
|
-
const fileInput =
|
|
4101
|
+
const [activeId, setActiveId] = useState17(null);
|
|
4102
|
+
const [renaming, setRenaming] = useState17(null);
|
|
4103
|
+
const [error, setError] = useState17(null);
|
|
4104
|
+
const fileInput = useRef11(null);
|
|
4018
4105
|
const channels = controller.getChannels();
|
|
4019
4106
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
4020
4107
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -4036,13 +4123,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4036
4123
|
setError(err instanceof Error ? err.message : String(err));
|
|
4037
4124
|
}
|
|
4038
4125
|
};
|
|
4039
|
-
return /* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
/* @__PURE__ */
|
|
4126
|
+
return /* @__PURE__ */ jsxs19("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
4127
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
|
|
4128
|
+
/* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
4129
|
+
/* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
|
|
4043
4130
|
] }),
|
|
4044
|
-
channels.length === 0 && /* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4131
|
+
channels.length === 0 && /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
4132
|
+
/* @__PURE__ */ jsx21("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs19(
|
|
4046
4133
|
"li",
|
|
4047
4134
|
{
|
|
4048
4135
|
"data-testid": "channel-row",
|
|
@@ -4054,7 +4141,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4054
4141
|
},
|
|
4055
4142
|
onDoubleClick: () => setRenaming(c.id),
|
|
4056
4143
|
children: [
|
|
4057
|
-
/* @__PURE__ */
|
|
4144
|
+
/* @__PURE__ */ jsx21(
|
|
4058
4145
|
"button",
|
|
4059
4146
|
{
|
|
4060
4147
|
type: "button",
|
|
@@ -4068,8 +4155,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4068
4155
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
4069
4156
|
}
|
|
4070
4157
|
),
|
|
4071
|
-
/* @__PURE__ */
|
|
4072
|
-
renaming === c.id ? /* @__PURE__ */
|
|
4158
|
+
/* @__PURE__ */ jsx21(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
4159
|
+
renaming === c.id ? /* @__PURE__ */ jsx21(
|
|
4073
4160
|
"input",
|
|
4074
4161
|
{
|
|
4075
4162
|
autoFocus: true,
|
|
@@ -4086,16 +4173,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4086
4173
|
if (e.key === "Escape") setRenaming(null);
|
|
4087
4174
|
}
|
|
4088
4175
|
}
|
|
4089
|
-
) : /* @__PURE__ */
|
|
4176
|
+
) : /* @__PURE__ */ jsx21("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
4090
4177
|
]
|
|
4091
4178
|
},
|
|
4092
4179
|
c.id
|
|
4093
4180
|
)) }),
|
|
4094
|
-
/* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
/* @__PURE__ */
|
|
4097
|
-
/* @__PURE__ */
|
|
4098
|
-
/* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
|
|
4182
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
4183
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
|
|
4184
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
4185
|
+
/* @__PURE__ */ jsx21(
|
|
4099
4186
|
"button",
|
|
4100
4187
|
{
|
|
4101
4188
|
type: "button",
|
|
@@ -4108,8 +4195,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4108
4195
|
children: "Delete"
|
|
4109
4196
|
}
|
|
4110
4197
|
),
|
|
4111
|
-
/* @__PURE__ */
|
|
4112
|
-
/* @__PURE__ */
|
|
4198
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
4199
|
+
/* @__PURE__ */ jsx21(
|
|
4113
4200
|
"button",
|
|
4114
4201
|
{
|
|
4115
4202
|
type: "button",
|
|
@@ -4120,7 +4207,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4120
4207
|
children: "Export PNG"
|
|
4121
4208
|
}
|
|
4122
4209
|
),
|
|
4123
|
-
/* @__PURE__ */
|
|
4210
|
+
/* @__PURE__ */ jsx21(
|
|
4124
4211
|
"input",
|
|
4125
4212
|
{
|
|
4126
4213
|
ref: fileInput,
|
|
@@ -4135,22 +4222,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4135
4222
|
}
|
|
4136
4223
|
)
|
|
4137
4224
|
] }),
|
|
4138
|
-
error && /* @__PURE__ */
|
|
4225
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
4139
4226
|
] });
|
|
4140
4227
|
};
|
|
4141
4228
|
|
|
4142
4229
|
// src/image-editor/PathsPanel.tsx
|
|
4143
|
-
import { useEffect as useEffect13, useState as
|
|
4230
|
+
import { useEffect as useEffect13, useState as useState18 } from "react";
|
|
4144
4231
|
import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
|
|
4145
|
-
import { jsx as
|
|
4232
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4146
4233
|
var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
4147
4234
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4148
|
-
const [, setTick] =
|
|
4235
|
+
const [, setTick] = useState18(0);
|
|
4149
4236
|
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4150
|
-
const [renaming, setRenaming] =
|
|
4151
|
-
const [color, setColor] =
|
|
4152
|
-
const [width, setWidth] =
|
|
4153
|
-
const [error, setError] =
|
|
4237
|
+
const [renaming, setRenaming] = useState18(null);
|
|
4238
|
+
const [color, setColor] = useState18("#000000");
|
|
4239
|
+
const [width, setWidth] = useState18(2);
|
|
4240
|
+
const [error, setError] = useState18(null);
|
|
4154
4241
|
const paths = controller.getPaths();
|
|
4155
4242
|
const activeId = controller.getState().activePathId ?? null;
|
|
4156
4243
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -4166,10 +4253,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4166
4253
|
};
|
|
4167
4254
|
return (
|
|
4168
4255
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
/* @__PURE__ */
|
|
4171
|
-
paths.length === 0 && /* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4256
|
+
/* @__PURE__ */ jsxs20("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
|
|
4257
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
4258
|
+
paths.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
4259
|
+
/* @__PURE__ */ jsx22("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs20(
|
|
4173
4260
|
"li",
|
|
4174
4261
|
{
|
|
4175
4262
|
"data-testid": "path-row",
|
|
@@ -4178,8 +4265,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4178
4265
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4179
4266
|
onDoubleClick: () => setRenaming(p.id),
|
|
4180
4267
|
children: [
|
|
4181
|
-
/* @__PURE__ */
|
|
4182
|
-
renaming === p.id ? /* @__PURE__ */
|
|
4268
|
+
/* @__PURE__ */ jsx22("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx22("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
4269
|
+
renaming === p.id ? /* @__PURE__ */ jsx22(
|
|
4183
4270
|
"input",
|
|
4184
4271
|
{
|
|
4185
4272
|
autoFocus: true,
|
|
@@ -4198,13 +4285,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4198
4285
|
if (e.key === "Escape") setRenaming(null);
|
|
4199
4286
|
}
|
|
4200
4287
|
}
|
|
4201
|
-
) : /* @__PURE__ */
|
|
4288
|
+
) : /* @__PURE__ */ jsx22("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4202
4289
|
]
|
|
4203
4290
|
},
|
|
4204
4291
|
p.id
|
|
4205
4292
|
)) }),
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
/* @__PURE__ */
|
|
4293
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
|
|
4294
|
+
/* @__PURE__ */ jsx22(
|
|
4208
4295
|
"button",
|
|
4209
4296
|
{
|
|
4210
4297
|
type: "button",
|
|
@@ -4215,15 +4302,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4215
4302
|
children: "Load as Selection"
|
|
4216
4303
|
}
|
|
4217
4304
|
),
|
|
4218
|
-
/* @__PURE__ */
|
|
4219
|
-
active?.work && /* @__PURE__ */
|
|
4220
|
-
/* @__PURE__ */
|
|
4305
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
4306
|
+
active?.work && /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
4307
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
4221
4308
|
] }),
|
|
4222
|
-
/* @__PURE__ */
|
|
4223
|
-
/* @__PURE__ */
|
|
4224
|
-
/* @__PURE__ */
|
|
4225
|
-
/* @__PURE__ */
|
|
4226
|
-
/* @__PURE__ */
|
|
4309
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4310
|
+
/* @__PURE__ */ jsx22("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
|
|
4311
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
4312
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4313
|
+
/* @__PURE__ */ jsx22(
|
|
4227
4314
|
"input",
|
|
4228
4315
|
{
|
|
4229
4316
|
type: "number",
|
|
@@ -4238,24 +4325,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4238
4325
|
),
|
|
4239
4326
|
"px"
|
|
4240
4327
|
] }),
|
|
4241
|
-
/* @__PURE__ */
|
|
4328
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
4242
4329
|
] }),
|
|
4243
|
-
/* @__PURE__ */
|
|
4244
|
-
/* @__PURE__ */
|
|
4245
|
-
/* @__PURE__ */
|
|
4330
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
|
|
4331
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
4332
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
4246
4333
|
] }),
|
|
4247
|
-
error && /* @__PURE__ */
|
|
4334
|
+
error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
|
|
4248
4335
|
] })
|
|
4249
4336
|
);
|
|
4250
4337
|
};
|
|
4251
4338
|
|
|
4252
4339
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4253
|
-
import { useEffect as useEffect14, useState as
|
|
4340
|
+
import { useEffect as useEffect14, useState as useState19 } from "react";
|
|
4254
4341
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
4255
|
-
import { jsx as
|
|
4342
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4256
4343
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4257
4344
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4258
|
-
const [, setTick] =
|
|
4345
|
+
const [, setTick] = useState19(0);
|
|
4259
4346
|
useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4260
4347
|
const bar = tool.bar();
|
|
4261
4348
|
if (!tool.active || !bar) return null;
|
|
@@ -4268,17 +4355,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4268
4355
|
const v = Number(raw);
|
|
4269
4356
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4270
4357
|
};
|
|
4271
|
-
return /* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
/* @__PURE__ */
|
|
4274
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
4275
|
-
/* @__PURE__ */
|
|
4276
|
-
/* @__PURE__ */
|
|
4277
|
-
/* @__PURE__ */
|
|
4358
|
+
return /* @__PURE__ */ jsxs21("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
4359
|
+
/* @__PURE__ */ jsx23("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx23("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
4360
|
+
/* @__PURE__ */ jsx23("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx23("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
|
|
4361
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4362
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4363
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4364
|
+
/* @__PURE__ */ jsx23("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx23("option", { value: o.id, children: o.label }, o.id)) })
|
|
4278
4365
|
] }),
|
|
4279
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
4280
|
-
/* @__PURE__ */
|
|
4281
|
-
/* @__PURE__ */
|
|
4366
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4367
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4368
|
+
/* @__PURE__ */ jsx23(
|
|
4282
4369
|
"input",
|
|
4283
4370
|
{
|
|
4284
4371
|
type: "number",
|
|
@@ -4299,9 +4386,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4299
4386
|
},
|
|
4300
4387
|
`${k}:${warp[k]}`
|
|
4301
4388
|
),
|
|
4302
|
-
/* @__PURE__ */
|
|
4389
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "%" })
|
|
4303
4390
|
] }, k)),
|
|
4304
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ jsx23(
|
|
4305
4392
|
"button",
|
|
4306
4393
|
{
|
|
4307
4394
|
type: "button",
|
|
@@ -4313,9 +4400,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4313
4400
|
children: "Vertical"
|
|
4314
4401
|
}
|
|
4315
4402
|
),
|
|
4316
|
-
/* @__PURE__ */
|
|
4317
|
-
/* @__PURE__ */
|
|
4318
|
-
/* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4404
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4405
|
+
/* @__PURE__ */ jsx23(
|
|
4319
4406
|
"select",
|
|
4320
4407
|
{
|
|
4321
4408
|
"aria-label": "Warp grid",
|
|
@@ -4325,14 +4412,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4325
4412
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4326
4413
|
},
|
|
4327
4414
|
className: imageFieldClass,
|
|
4328
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
4415
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx23("option", { value: g.id, children: g.label }, g.id))
|
|
4329
4416
|
}
|
|
4330
4417
|
)
|
|
4331
4418
|
] })
|
|
4332
4419
|
] }),
|
|
4333
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4335
|
-
/* @__PURE__ */
|
|
4420
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4421
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.label }),
|
|
4422
|
+
/* @__PURE__ */ jsx23(
|
|
4336
4423
|
"input",
|
|
4337
4424
|
{
|
|
4338
4425
|
type: "number",
|
|
@@ -4352,8 +4439,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4352
4439
|
},
|
|
4353
4440
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4354
4441
|
),
|
|
4355
|
-
/* @__PURE__ */
|
|
4356
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4442
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4443
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx23(
|
|
4357
4444
|
"button",
|
|
4358
4445
|
{
|
|
4359
4446
|
type: "button",
|
|
@@ -4368,33 +4455,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4368
4455
|
}
|
|
4369
4456
|
)
|
|
4370
4457
|
] }, f.id)),
|
|
4371
|
-
/* @__PURE__ */
|
|
4372
|
-
/* @__PURE__ */
|
|
4373
|
-
/* @__PURE__ */
|
|
4458
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4459
|
+
/* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4460
|
+
/* @__PURE__ */ jsx23(
|
|
4374
4461
|
"select",
|
|
4375
4462
|
{
|
|
4376
4463
|
"aria-label": "Interpolation",
|
|
4377
4464
|
value: tool.interpolation,
|
|
4378
4465
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4379
4466
|
className: imageFieldClass,
|
|
4380
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4467
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx23("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4381
4468
|
}
|
|
4382
4469
|
)
|
|
4383
4470
|
] }),
|
|
4384
|
-
/* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
tool.error && /* @__PURE__ */
|
|
4471
|
+
/* @__PURE__ */ jsx23("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
|
|
4472
|
+
/* @__PURE__ */ jsx23("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4473
|
+
tool.error && /* @__PURE__ */ jsx23("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4387
4474
|
] });
|
|
4388
4475
|
};
|
|
4389
4476
|
|
|
4390
4477
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4391
|
-
import { useEffect as useEffect15, useState as
|
|
4478
|
+
import { useEffect as useEffect15, useState as useState20 } from "react";
|
|
4392
4479
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
4393
|
-
import { Fragment as Fragment6, jsx as
|
|
4480
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4394
4481
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4395
|
-
const [, setTick] =
|
|
4482
|
+
const [, setTick] = useState20(0);
|
|
4396
4483
|
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4397
|
-
const [error, setError] =
|
|
4484
|
+
const [error, setError] = useState20(null);
|
|
4398
4485
|
const active = controller.getActiveLayer();
|
|
4399
4486
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4400
4487
|
const set = (change) => {
|
|
@@ -4408,22 +4495,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4408
4495
|
}
|
|
4409
4496
|
};
|
|
4410
4497
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4411
|
-
return /* @__PURE__ */
|
|
4412
|
-
/* @__PURE__ */
|
|
4413
|
-
/* @__PURE__ */
|
|
4414
|
-
/* @__PURE__ */
|
|
4415
|
-
/* @__PURE__ */
|
|
4498
|
+
return /* @__PURE__ */ jsxs22("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4499
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx24("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4500
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4501
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4502
|
+
/* @__PURE__ */ jsx24(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
4416
4503
|
"Fill",
|
|
4417
|
-
/* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsx24(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
4418
4505
|
] }),
|
|
4419
|
-
/* @__PURE__ */
|
|
4420
|
-
/* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4507
|
+
/* @__PURE__ */ jsx24(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
4421
4508
|
"Stroke",
|
|
4422
|
-
/* @__PURE__ */
|
|
4509
|
+
/* @__PURE__ */ jsx24(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4423
4510
|
] }),
|
|
4424
|
-
/* @__PURE__ */
|
|
4511
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4425
4512
|
"Width",
|
|
4426
|
-
/* @__PURE__ */
|
|
4513
|
+
/* @__PURE__ */ jsx24(
|
|
4427
4514
|
"input",
|
|
4428
4515
|
{
|
|
4429
4516
|
type: "number",
|
|
@@ -4437,52 +4524,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4437
4524
|
)
|
|
4438
4525
|
] })
|
|
4439
4526
|
] }),
|
|
4440
|
-
/* @__PURE__ */
|
|
4441
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4528
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4442
4529
|
"Radius",
|
|
4443
|
-
/* @__PURE__ */
|
|
4530
|
+
/* @__PURE__ */ jsx24("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
|
|
4444
4531
|
] }),
|
|
4445
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4532
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4446
4533
|
"Sides",
|
|
4447
|
-
/* @__PURE__ */
|
|
4534
|
+
/* @__PURE__ */ jsx24("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
4448
4535
|
] }),
|
|
4449
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4450
|
-
/* @__PURE__ */
|
|
4536
|
+
options.kind === "star" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4537
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4451
4538
|
"Points",
|
|
4452
|
-
/* @__PURE__ */
|
|
4539
|
+
/* @__PURE__ */ jsx24("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
4453
4540
|
] }),
|
|
4454
|
-
/* @__PURE__ */
|
|
4541
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4455
4542
|
"Inner",
|
|
4456
|
-
/* @__PURE__ */
|
|
4543
|
+
/* @__PURE__ */ jsx24(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4457
4544
|
] })
|
|
4458
4545
|
] }),
|
|
4459
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4460
|
-
/* @__PURE__ */
|
|
4546
|
+
options.kind === "line" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
4547
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4461
4548
|
"Weight",
|
|
4462
|
-
/* @__PURE__ */
|
|
4549
|
+
/* @__PURE__ */ jsx24("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
|
|
4463
4550
|
] }),
|
|
4464
|
-
/* @__PURE__ */
|
|
4465
|
-
/* @__PURE__ */
|
|
4551
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4552
|
+
/* @__PURE__ */ jsx24(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4466
4553
|
"Arrowhead"
|
|
4467
4554
|
] })
|
|
4468
4555
|
] })
|
|
4469
4556
|
] }),
|
|
4470
|
-
/* @__PURE__ */
|
|
4471
|
-
error && /* @__PURE__ */
|
|
4557
|
+
/* @__PURE__ */ jsx24("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
|
|
4558
|
+
error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
|
|
4472
4559
|
] });
|
|
4473
4560
|
};
|
|
4474
4561
|
|
|
4475
4562
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4476
|
-
import { useEffect as useEffect16, useState as
|
|
4563
|
+
import { useEffect as useEffect16, useState as useState21 } from "react";
|
|
4477
4564
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4478
|
-
import { jsx as
|
|
4565
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4479
4566
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4480
4567
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4481
4568
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4482
|
-
const [, setTick] =
|
|
4569
|
+
const [, setTick] = useState21(0);
|
|
4483
4570
|
useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4484
4571
|
useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4485
|
-
const [error, setError] =
|
|
4572
|
+
const [error, setError] = useState21(null);
|
|
4486
4573
|
const active = controller.getActiveLayer();
|
|
4487
4574
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4488
4575
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4535,11 +4622,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4535
4622
|
setError(e instanceof Error ? e.message : String(e));
|
|
4536
4623
|
}
|
|
4537
4624
|
};
|
|
4538
|
-
return /* @__PURE__ */
|
|
4539
|
-
/* @__PURE__ */
|
|
4540
|
-
/* @__PURE__ */
|
|
4625
|
+
return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4626
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4627
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
|
|
4541
4628
|
"Font",
|
|
4542
|
-
/* @__PURE__ */
|
|
4629
|
+
/* @__PURE__ */ jsx25(
|
|
4543
4630
|
"input",
|
|
4544
4631
|
{
|
|
4545
4632
|
list: "pixerate-type-fonts",
|
|
@@ -4549,11 +4636,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4549
4636
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4550
4637
|
}
|
|
4551
4638
|
),
|
|
4552
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ jsx25("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx25("option", { value: f }, f)) })
|
|
4553
4640
|
] }),
|
|
4554
|
-
/* @__PURE__ */
|
|
4641
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
|
|
4555
4642
|
"Size",
|
|
4556
|
-
/* @__PURE__ */
|
|
4643
|
+
/* @__PURE__ */ jsx25(
|
|
4557
4644
|
"input",
|
|
4558
4645
|
{
|
|
4559
4646
|
type: "number",
|
|
@@ -4566,14 +4653,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4566
4653
|
}
|
|
4567
4654
|
)
|
|
4568
4655
|
] }),
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
/* @__PURE__ */
|
|
4571
|
-
/* @__PURE__ */
|
|
4656
|
+
/* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
|
|
4657
|
+
/* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4658
|
+
/* @__PURE__ */ jsx25(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
4572
4659
|
] }),
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
/* @__PURE__ */
|
|
4575
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4576
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
4660
|
+
/* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4661
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
4662
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
4663
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx25(
|
|
4577
4664
|
"button",
|
|
4578
4665
|
{
|
|
4579
4666
|
type: "button",
|
|
@@ -4585,19 +4672,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4585
4672
|
}
|
|
4586
4673
|
)
|
|
4587
4674
|
] }),
|
|
4588
|
-
/* @__PURE__ */
|
|
4589
|
-
missing.length > 0 && /* @__PURE__ */
|
|
4675
|
+
/* @__PURE__ */ jsx25("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
4676
|
+
missing.length > 0 && /* @__PURE__ */ jsxs23("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4590
4677
|
"Missing ",
|
|
4591
4678
|
missing.length === 1 ? "font" : "fonts",
|
|
4592
4679
|
": ",
|
|
4593
4680
|
missing.join(", ")
|
|
4594
4681
|
] }),
|
|
4595
|
-
error && /* @__PURE__ */
|
|
4682
|
+
error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
|
|
4596
4683
|
] });
|
|
4597
4684
|
};
|
|
4598
4685
|
|
|
4599
4686
|
// src/image-editor/ImageEditor.tsx
|
|
4600
|
-
import { Fragment as Fragment7, jsx as
|
|
4687
|
+
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4601
4688
|
var ImageEditor = ({
|
|
4602
4689
|
editor: externalEditor,
|
|
4603
4690
|
src,
|
|
@@ -4622,32 +4709,32 @@ var ImageEditor = ({
|
|
|
4622
4709
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4623
4710
|
});
|
|
4624
4711
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4625
|
-
const [activeTab, setActiveTab] =
|
|
4626
|
-
const rootRef =
|
|
4712
|
+
const [activeTab, setActiveTab] = useState22("crop");
|
|
4713
|
+
const rootRef = useRef12(null);
|
|
4627
4714
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4628
|
-
const activeTabRef =
|
|
4715
|
+
const activeTabRef = useRef12(activeTab);
|
|
4629
4716
|
activeTabRef.current = activeTab;
|
|
4630
4717
|
const openPanel = async (ref) => {
|
|
4631
4718
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
4632
4719
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4633
4720
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4634
4721
|
};
|
|
4635
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
4636
|
-
const [selectionOptions, setSelectionOptions] =
|
|
4637
|
-
const [shapeOptions, setShapeOptions] =
|
|
4638
|
-
const [typeOptions, setTypeOptions] =
|
|
4639
|
-
const [typeSession, setTypeSession] =
|
|
4640
|
-
const [selectionError, setSelectionError] =
|
|
4641
|
-
const [paintError, setPaintError] =
|
|
4642
|
-
const [shapeTypeError, setShapeTypeError] =
|
|
4722
|
+
const [activeCropRatio, setActiveCropRatio] = useState22(null);
|
|
4723
|
+
const [selectionOptions, setSelectionOptions] = useState22(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
4724
|
+
const [shapeOptions, setShapeOptions] = useState22(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
4725
|
+
const [typeOptions, setTypeOptions] = useState22(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
4726
|
+
const [typeSession, setTypeSession] = useState22(null);
|
|
4727
|
+
const [selectionError, setSelectionError] = useState22(null);
|
|
4728
|
+
const [paintError, setPaintError] = useState22(null);
|
|
4729
|
+
const [shapeTypeError, setShapeTypeError] = useState22(null);
|
|
4643
4730
|
const handleCanvasError = (source, message) => {
|
|
4644
4731
|
if (source === "paint") setPaintError(message);
|
|
4645
4732
|
else if (source === "select") setSelectionError(message);
|
|
4646
4733
|
else setShapeTypeError(message);
|
|
4647
4734
|
};
|
|
4648
4735
|
const finishTyping = () => setTypeSession(null);
|
|
4649
|
-
const transformToolRef =
|
|
4650
|
-
const transformControllerRef =
|
|
4736
|
+
const transformToolRef = useRef12(null);
|
|
4737
|
+
const transformControllerRef = useRef12(controller);
|
|
4651
4738
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
4652
4739
|
transformToolRef.current?.cancel();
|
|
4653
4740
|
transformToolRef.current = new FreeTransformTool2(controller, {
|
|
@@ -4656,16 +4743,16 @@ var ImageEditor = ({
|
|
|
4656
4743
|
transformControllerRef.current = controller;
|
|
4657
4744
|
}
|
|
4658
4745
|
const transformTool = transformToolRef.current;
|
|
4659
|
-
const [, setTransformTick] =
|
|
4746
|
+
const [, setTransformTick] = useState22(0);
|
|
4660
4747
|
useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4661
4748
|
useEffect17(() => () => transformToolRef.current?.cancel(), []);
|
|
4662
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
4663
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
4664
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
4665
|
-
const [isInpainting, setIsInpainting] =
|
|
4666
|
-
const [aiError, setAiError] =
|
|
4667
|
-
const [aiSuccess, setAiSuccess] =
|
|
4668
|
-
const [aiTarget, setAiTarget] =
|
|
4749
|
+
const [inpaintPrompt, setInpaintPrompt] = useState22("");
|
|
4750
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState22("annotations");
|
|
4751
|
+
const [isRemovingBg, setIsRemovingBg] = useState22(false);
|
|
4752
|
+
const [isInpainting, setIsInpainting] = useState22(false);
|
|
4753
|
+
const [aiError, setAiError] = useState22(null);
|
|
4754
|
+
const [aiSuccess, setAiSuccess] = useState22(null);
|
|
4755
|
+
const [aiTarget, setAiTarget] = useState22("auto");
|
|
4669
4756
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4670
4757
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4671
4758
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4728,10 +4815,10 @@ var ImageEditor = ({
|
|
|
4728
4815
|
setIsInpainting(false);
|
|
4729
4816
|
}
|
|
4730
4817
|
};
|
|
4731
|
-
const [activeColor, setActiveColor] =
|
|
4732
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4733
|
-
const [fontSize, setFontSize] =
|
|
4734
|
-
const [textInput, setTextInput] =
|
|
4818
|
+
const [activeColor, setActiveColor] = useState22("#ef4444");
|
|
4819
|
+
const [strokeWidth, setStrokeWidth] = useState22(3);
|
|
4820
|
+
const [fontSize, setFontSize] = useState22(24);
|
|
4821
|
+
const [textInput, setTextInput] = useState22("");
|
|
4735
4822
|
useEffect17(() => {
|
|
4736
4823
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4737
4824
|
editor.setTool("crop");
|
|
@@ -4760,16 +4847,16 @@ var ImageEditor = ({
|
|
|
4760
4847
|
link.click();
|
|
4761
4848
|
}
|
|
4762
4849
|
};
|
|
4763
|
-
return /* @__PURE__ */
|
|
4850
|
+
return /* @__PURE__ */ jsxs24(
|
|
4764
4851
|
"div",
|
|
4765
4852
|
{
|
|
4766
4853
|
ref: rootRef,
|
|
4767
4854
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4768
4855
|
style,
|
|
4769
4856
|
children: [
|
|
4770
|
-
/* @__PURE__ */
|
|
4771
|
-
/* @__PURE__ */
|
|
4772
|
-
/* @__PURE__ */
|
|
4857
|
+
/* @__PURE__ */ jsxs24("div", { className: imageEditorHeaderClass, children: [
|
|
4858
|
+
/* @__PURE__ */ jsxs24("div", { role: "tablist", className: imageTabListClass, children: [
|
|
4859
|
+
/* @__PURE__ */ jsx26(
|
|
4773
4860
|
"button",
|
|
4774
4861
|
{
|
|
4775
4862
|
type: "button",
|
|
@@ -4784,7 +4871,7 @@ var ImageEditor = ({
|
|
|
4784
4871
|
children: "Transform & Crop"
|
|
4785
4872
|
}
|
|
4786
4873
|
),
|
|
4787
|
-
/* @__PURE__ */
|
|
4874
|
+
/* @__PURE__ */ jsx26(
|
|
4788
4875
|
"button",
|
|
4789
4876
|
{
|
|
4790
4877
|
type: "button",
|
|
@@ -4799,7 +4886,7 @@ var ImageEditor = ({
|
|
|
4799
4886
|
children: "Adjustments"
|
|
4800
4887
|
}
|
|
4801
4888
|
),
|
|
4802
|
-
/* @__PURE__ */
|
|
4889
|
+
/* @__PURE__ */ jsx26(
|
|
4803
4890
|
"button",
|
|
4804
4891
|
{
|
|
4805
4892
|
type: "button",
|
|
@@ -4814,7 +4901,7 @@ var ImageEditor = ({
|
|
|
4814
4901
|
children: "Layers"
|
|
4815
4902
|
}
|
|
4816
4903
|
),
|
|
4817
|
-
/* @__PURE__ */
|
|
4904
|
+
/* @__PURE__ */ jsx26(
|
|
4818
4905
|
"button",
|
|
4819
4906
|
{
|
|
4820
4907
|
type: "button",
|
|
@@ -4829,7 +4916,7 @@ var ImageEditor = ({
|
|
|
4829
4916
|
children: "Paint"
|
|
4830
4917
|
}
|
|
4831
4918
|
),
|
|
4832
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsx26(
|
|
4833
4920
|
"button",
|
|
4834
4921
|
{
|
|
4835
4922
|
type: "button",
|
|
@@ -4844,7 +4931,7 @@ var ImageEditor = ({
|
|
|
4844
4931
|
children: "Select & Mask"
|
|
4845
4932
|
}
|
|
4846
4933
|
),
|
|
4847
|
-
/* @__PURE__ */
|
|
4934
|
+
/* @__PURE__ */ jsx26(
|
|
4848
4935
|
"button",
|
|
4849
4936
|
{
|
|
4850
4937
|
type: "button",
|
|
@@ -4859,7 +4946,7 @@ var ImageEditor = ({
|
|
|
4859
4946
|
children: "Annotations"
|
|
4860
4947
|
}
|
|
4861
4948
|
),
|
|
4862
|
-
/* @__PURE__ */
|
|
4949
|
+
/* @__PURE__ */ jsx26(
|
|
4863
4950
|
"button",
|
|
4864
4951
|
{
|
|
4865
4952
|
type: "button",
|
|
@@ -4874,7 +4961,7 @@ var ImageEditor = ({
|
|
|
4874
4961
|
children: "Depth Mask"
|
|
4875
4962
|
}
|
|
4876
4963
|
),
|
|
4877
|
-
/* @__PURE__ */
|
|
4964
|
+
/* @__PURE__ */ jsxs24(
|
|
4878
4965
|
"button",
|
|
4879
4966
|
{
|
|
4880
4967
|
type: "button",
|
|
@@ -4887,14 +4974,14 @@ var ImageEditor = ({
|
|
|
4887
4974
|
"aria-selected": activeTab === "ai",
|
|
4888
4975
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
4889
4976
|
children: [
|
|
4890
|
-
/* @__PURE__ */
|
|
4977
|
+
/* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
|
|
4891
4978
|
"AI Tools"
|
|
4892
4979
|
]
|
|
4893
4980
|
}
|
|
4894
4981
|
)
|
|
4895
4982
|
] }),
|
|
4896
|
-
/* @__PURE__ */
|
|
4897
|
-
/* @__PURE__ */
|
|
4983
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4984
|
+
/* @__PURE__ */ jsx26(
|
|
4898
4985
|
"button",
|
|
4899
4986
|
{
|
|
4900
4987
|
type: "button",
|
|
@@ -4905,7 +4992,7 @@ var ImageEditor = ({
|
|
|
4905
4992
|
children: "\u21A9"
|
|
4906
4993
|
}
|
|
4907
4994
|
),
|
|
4908
|
-
/* @__PURE__ */
|
|
4995
|
+
/* @__PURE__ */ jsx26(
|
|
4909
4996
|
"button",
|
|
4910
4997
|
{
|
|
4911
4998
|
type: "button",
|
|
@@ -4916,7 +5003,7 @@ var ImageEditor = ({
|
|
|
4916
5003
|
children: "\u21AA"
|
|
4917
5004
|
}
|
|
4918
5005
|
),
|
|
4919
|
-
/* @__PURE__ */
|
|
5006
|
+
/* @__PURE__ */ jsx26(
|
|
4920
5007
|
"button",
|
|
4921
5008
|
{
|
|
4922
5009
|
type: "button",
|
|
@@ -4925,8 +5012,8 @@ var ImageEditor = ({
|
|
|
4925
5012
|
children: "Reset"
|
|
4926
5013
|
}
|
|
4927
5014
|
),
|
|
4928
|
-
/* @__PURE__ */
|
|
4929
|
-
/* @__PURE__ */
|
|
5015
|
+
/* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5016
|
+
/* @__PURE__ */ jsx26(
|
|
4930
5017
|
"button",
|
|
4931
5018
|
{
|
|
4932
5019
|
type: "button",
|
|
@@ -4936,11 +5023,11 @@ var ImageEditor = ({
|
|
|
4936
5023
|
children: "-"
|
|
4937
5024
|
}
|
|
4938
5025
|
),
|
|
4939
|
-
/* @__PURE__ */
|
|
5026
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
4940
5027
|
Math.round(state.zoom * 100),
|
|
4941
5028
|
"%"
|
|
4942
5029
|
] }),
|
|
4943
|
-
/* @__PURE__ */
|
|
5030
|
+
/* @__PURE__ */ jsx26(
|
|
4944
5031
|
"button",
|
|
4945
5032
|
{
|
|
4946
5033
|
type: "button",
|
|
@@ -4950,8 +5037,8 @@ var ImageEditor = ({
|
|
|
4950
5037
|
children: "+"
|
|
4951
5038
|
}
|
|
4952
5039
|
),
|
|
4953
|
-
/* @__PURE__ */
|
|
4954
|
-
/* @__PURE__ */
|
|
5040
|
+
/* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5041
|
+
/* @__PURE__ */ jsx26(
|
|
4955
5042
|
"button",
|
|
4956
5043
|
{
|
|
4957
5044
|
type: "button",
|
|
@@ -4962,7 +5049,7 @@ var ImageEditor = ({
|
|
|
4962
5049
|
children: "Hold Compare"
|
|
4963
5050
|
}
|
|
4964
5051
|
),
|
|
4965
|
-
/* @__PURE__ */
|
|
5052
|
+
/* @__PURE__ */ jsx26(
|
|
4966
5053
|
"button",
|
|
4967
5054
|
{
|
|
4968
5055
|
type: "button",
|
|
@@ -4973,10 +5060,10 @@ var ImageEditor = ({
|
|
|
4973
5060
|
)
|
|
4974
5061
|
] })
|
|
4975
5062
|
] }),
|
|
4976
|
-
transformTool.active && /* @__PURE__ */
|
|
4977
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
4978
|
-
/* @__PURE__ */
|
|
4979
|
-
/* @__PURE__ */
|
|
5063
|
+
transformTool.active && /* @__PURE__ */ jsx26(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5064
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx26("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5065
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5066
|
+
/* @__PURE__ */ jsx26(
|
|
4980
5067
|
ImageEditorCanvas,
|
|
4981
5068
|
{
|
|
4982
5069
|
editor,
|
|
@@ -5000,11 +5087,11 @@ var ImageEditor = ({
|
|
|
5000
5087
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5001
5088
|
}
|
|
5002
5089
|
),
|
|
5003
|
-
/* @__PURE__ */
|
|
5004
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
5005
|
-
/* @__PURE__ */
|
|
5006
|
-
/* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5090
|
+
/* @__PURE__ */ jsxs24("div", { className: imageSidebarClass, children: [
|
|
5091
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5092
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5093
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5094
|
+
/* @__PURE__ */ jsx26(
|
|
5008
5095
|
"button",
|
|
5009
5096
|
{
|
|
5010
5097
|
type: "button",
|
|
@@ -5016,7 +5103,7 @@ var ImageEditor = ({
|
|
|
5016
5103
|
children: "Freeform"
|
|
5017
5104
|
}
|
|
5018
5105
|
),
|
|
5019
|
-
/* @__PURE__ */
|
|
5106
|
+
/* @__PURE__ */ jsx26(
|
|
5020
5107
|
"button",
|
|
5021
5108
|
{
|
|
5022
5109
|
type: "button",
|
|
@@ -5028,7 +5115,7 @@ var ImageEditor = ({
|
|
|
5028
5115
|
children: "1:1 Square"
|
|
5029
5116
|
}
|
|
5030
5117
|
),
|
|
5031
|
-
/* @__PURE__ */
|
|
5118
|
+
/* @__PURE__ */ jsx26(
|
|
5032
5119
|
"button",
|
|
5033
5120
|
{
|
|
5034
5121
|
type: "button",
|
|
@@ -5040,7 +5127,7 @@ var ImageEditor = ({
|
|
|
5040
5127
|
children: "4:3 Standard"
|
|
5041
5128
|
}
|
|
5042
5129
|
),
|
|
5043
|
-
/* @__PURE__ */
|
|
5130
|
+
/* @__PURE__ */ jsx26(
|
|
5044
5131
|
"button",
|
|
5045
5132
|
{
|
|
5046
5133
|
type: "button",
|
|
@@ -5052,7 +5139,7 @@ var ImageEditor = ({
|
|
|
5052
5139
|
children: "16:9 Wide"
|
|
5053
5140
|
}
|
|
5054
5141
|
),
|
|
5055
|
-
/* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsx26(
|
|
5056
5143
|
"button",
|
|
5057
5144
|
{
|
|
5058
5145
|
type: "button",
|
|
@@ -5064,7 +5151,7 @@ var ImageEditor = ({
|
|
|
5064
5151
|
children: "3:2 Photo"
|
|
5065
5152
|
}
|
|
5066
5153
|
),
|
|
5067
|
-
/* @__PURE__ */
|
|
5154
|
+
/* @__PURE__ */ jsx26(
|
|
5068
5155
|
"button",
|
|
5069
5156
|
{
|
|
5070
5157
|
type: "button",
|
|
@@ -5077,10 +5164,10 @@ var ImageEditor = ({
|
|
|
5077
5164
|
}
|
|
5078
5165
|
)
|
|
5079
5166
|
] }),
|
|
5080
|
-
/* @__PURE__ */
|
|
5081
|
-
/* @__PURE__ */
|
|
5082
|
-
/* @__PURE__ */
|
|
5083
|
-
/* @__PURE__ */
|
|
5167
|
+
/* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
|
|
5168
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5169
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5170
|
+
/* @__PURE__ */ jsx26(
|
|
5084
5171
|
"button",
|
|
5085
5172
|
{
|
|
5086
5173
|
type: "button",
|
|
@@ -5089,7 +5176,7 @@ var ImageEditor = ({
|
|
|
5089
5176
|
children: "Rotate -90\xB0"
|
|
5090
5177
|
}
|
|
5091
5178
|
),
|
|
5092
|
-
/* @__PURE__ */
|
|
5179
|
+
/* @__PURE__ */ jsx26(
|
|
5093
5180
|
"button",
|
|
5094
5181
|
{
|
|
5095
5182
|
type: "button",
|
|
@@ -5098,7 +5185,7 @@ var ImageEditor = ({
|
|
|
5098
5185
|
children: "Rotate +90\xB0"
|
|
5099
5186
|
}
|
|
5100
5187
|
),
|
|
5101
|
-
/* @__PURE__ */
|
|
5188
|
+
/* @__PURE__ */ jsx26(
|
|
5102
5189
|
"button",
|
|
5103
5190
|
{
|
|
5104
5191
|
type: "button",
|
|
@@ -5107,7 +5194,7 @@ var ImageEditor = ({
|
|
|
5107
5194
|
children: "Flip Horizontal"
|
|
5108
5195
|
}
|
|
5109
5196
|
),
|
|
5110
|
-
/* @__PURE__ */
|
|
5197
|
+
/* @__PURE__ */ jsx26(
|
|
5111
5198
|
"button",
|
|
5112
5199
|
{
|
|
5113
5200
|
type: "button",
|
|
@@ -5118,10 +5205,10 @@ var ImageEditor = ({
|
|
|
5118
5205
|
)
|
|
5119
5206
|
] })
|
|
5120
5207
|
] }),
|
|
5121
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
5122
|
-
/* @__PURE__ */
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5208
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5209
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
5210
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5211
|
+
/* @__PURE__ */ jsx26(
|
|
5125
5212
|
"button",
|
|
5126
5213
|
{
|
|
5127
5214
|
type: "button",
|
|
@@ -5131,9 +5218,9 @@ var ImageEditor = ({
|
|
|
5131
5218
|
}
|
|
5132
5219
|
)
|
|
5133
5220
|
] }),
|
|
5134
|
-
/* @__PURE__ */
|
|
5135
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5221
|
+
/* @__PURE__ */ jsx26(Histogram, { histogram: editor.histogram }),
|
|
5222
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs24(React21.Fragment, { children: [
|
|
5223
|
+
/* @__PURE__ */ jsx26(
|
|
5137
5224
|
ControlSlider,
|
|
5138
5225
|
{
|
|
5139
5226
|
spec,
|
|
@@ -5142,14 +5229,14 @@ var ImageEditor = ({
|
|
|
5142
5229
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5143
5230
|
}
|
|
5144
5231
|
),
|
|
5145
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
5232
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs24(
|
|
5146
5233
|
"div",
|
|
5147
5234
|
{
|
|
5148
5235
|
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-600",
|
|
5149
5236
|
"data-testid": "image-editor-process-notice",
|
|
5150
5237
|
children: [
|
|
5151
|
-
/* @__PURE__ */
|
|
5152
|
-
/* @__PURE__ */
|
|
5238
|
+
/* @__PURE__ */ jsx26("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5239
|
+
/* @__PURE__ */ jsx26(
|
|
5153
5240
|
"button",
|
|
5154
5241
|
{
|
|
5155
5242
|
type: "button",
|
|
@@ -5162,7 +5249,7 @@ var ImageEditor = ({
|
|
|
5162
5249
|
}
|
|
5163
5250
|
)
|
|
5164
5251
|
] }, spec.id)),
|
|
5165
|
-
/* @__PURE__ */
|
|
5252
|
+
/* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(
|
|
5166
5253
|
AdjustmentLayersPanel,
|
|
5167
5254
|
{
|
|
5168
5255
|
controller,
|
|
@@ -5171,9 +5258,9 @@ var ImageEditor = ({
|
|
|
5171
5258
|
}
|
|
5172
5259
|
) })
|
|
5173
5260
|
] }),
|
|
5174
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
5175
|
-
/* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5261
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5262
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5263
|
+
/* @__PURE__ */ jsx26(
|
|
5177
5264
|
"button",
|
|
5178
5265
|
{
|
|
5179
5266
|
type: "button",
|
|
@@ -5184,15 +5271,15 @@ var ImageEditor = ({
|
|
|
5184
5271
|
children: "Free Transform"
|
|
5185
5272
|
}
|
|
5186
5273
|
),
|
|
5187
|
-
/* @__PURE__ */
|
|
5188
|
-
effectsShown && /* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5190
|
-
/* @__PURE__ */
|
|
5274
|
+
/* @__PURE__ */ jsx26(LayersPanel, { controller }),
|
|
5275
|
+
effectsShown && /* @__PURE__ */ jsx26(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5276
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5277
|
+
/* @__PURE__ */ jsx26(ColorProfilePanel, { controller })
|
|
5191
5278
|
] }),
|
|
5192
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
5193
|
-
/* @__PURE__ */
|
|
5194
|
-
/* @__PURE__ */
|
|
5195
|
-
/* @__PURE__ */
|
|
5279
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5280
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5281
|
+
/* @__PURE__ */ jsx26(BrushOptionsBar, { controller }),
|
|
5282
|
+
/* @__PURE__ */ jsx26(
|
|
5196
5283
|
"button",
|
|
5197
5284
|
{
|
|
5198
5285
|
type: "button",
|
|
@@ -5203,12 +5290,12 @@ var ImageEditor = ({
|
|
|
5203
5290
|
children: "Free Transform"
|
|
5204
5291
|
}
|
|
5205
5292
|
),
|
|
5206
|
-
paintError && /* @__PURE__ */
|
|
5207
|
-
/* @__PURE__ */
|
|
5293
|
+
paintError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5294
|
+
/* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(LayersPanel, { controller }) })
|
|
5208
5295
|
] }),
|
|
5209
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5211
|
-
/* @__PURE__ */
|
|
5296
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5297
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
5298
|
+
/* @__PURE__ */ jsx26("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx26(
|
|
5212
5299
|
"button",
|
|
5213
5300
|
{
|
|
5214
5301
|
type: "button",
|
|
@@ -5219,13 +5306,13 @@ var ImageEditor = ({
|
|
|
5219
5306
|
},
|
|
5220
5307
|
t
|
|
5221
5308
|
)) }),
|
|
5222
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
5223
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
5224
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
5225
|
-
shapeTypeError && /* @__PURE__ */
|
|
5226
|
-
/* @__PURE__ */
|
|
5227
|
-
/* @__PURE__ */
|
|
5228
|
-
/* @__PURE__ */
|
|
5309
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx26(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5310
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx26(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5311
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx26("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
|
|
5312
|
+
shapeTypeError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5313
|
+
/* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
|
|
5314
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5315
|
+
/* @__PURE__ */ jsx26("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx26(
|
|
5229
5316
|
"button",
|
|
5230
5317
|
{
|
|
5231
5318
|
type: "button",
|
|
@@ -5235,18 +5322,18 @@ var ImageEditor = ({
|
|
|
5235
5322
|
},
|
|
5236
5323
|
t
|
|
5237
5324
|
)) }),
|
|
5238
|
-
/* @__PURE__ */
|
|
5239
|
-
/* @__PURE__ */
|
|
5240
|
-
/* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5242
|
-
/* @__PURE__ */
|
|
5243
|
-
/* @__PURE__ */
|
|
5244
|
-
/* @__PURE__ */
|
|
5325
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5326
|
+
/* @__PURE__ */ jsx26("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5327
|
+
/* @__PURE__ */ jsx26(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
5328
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex-1 ml-2", children: [
|
|
5329
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5330
|
+
/* @__PURE__ */ jsx26("span", { children: "Width:" }),
|
|
5331
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
|
|
5245
5332
|
strokeWidth,
|
|
5246
5333
|
"px"
|
|
5247
5334
|
] })
|
|
5248
5335
|
] }),
|
|
5249
|
-
/* @__PURE__ */
|
|
5336
|
+
/* @__PURE__ */ jsx26(
|
|
5250
5337
|
"input",
|
|
5251
5338
|
{
|
|
5252
5339
|
type: "range",
|
|
@@ -5259,10 +5346,10 @@ var ImageEditor = ({
|
|
|
5259
5346
|
)
|
|
5260
5347
|
] })
|
|
5261
5348
|
] }),
|
|
5262
|
-
/* @__PURE__ */
|
|
5263
|
-
/* @__PURE__ */
|
|
5264
|
-
/* @__PURE__ */
|
|
5265
|
-
/* @__PURE__ */
|
|
5349
|
+
/* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
|
|
5350
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5351
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
|
|
5352
|
+
/* @__PURE__ */ jsx26(
|
|
5266
5353
|
"input",
|
|
5267
5354
|
{
|
|
5268
5355
|
type: "text",
|
|
@@ -5273,7 +5360,7 @@ var ImageEditor = ({
|
|
|
5273
5360
|
className: "flex-1 bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary"
|
|
5274
5361
|
}
|
|
5275
5362
|
),
|
|
5276
|
-
/* @__PURE__ */
|
|
5363
|
+
/* @__PURE__ */ jsx26(
|
|
5277
5364
|
"button",
|
|
5278
5365
|
{
|
|
5279
5366
|
type: "button",
|
|
@@ -5283,14 +5370,14 @@ var ImageEditor = ({
|
|
|
5283
5370
|
}
|
|
5284
5371
|
)
|
|
5285
5372
|
] }),
|
|
5286
|
-
/* @__PURE__ */
|
|
5287
|
-
/* @__PURE__ */
|
|
5288
|
-
/* @__PURE__ */
|
|
5373
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5374
|
+
/* @__PURE__ */ jsx26("span", { children: "Font Size:" }),
|
|
5375
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
|
|
5289
5376
|
fontSize,
|
|
5290
5377
|
"px"
|
|
5291
5378
|
] })
|
|
5292
5379
|
] }),
|
|
5293
|
-
/* @__PURE__ */
|
|
5380
|
+
/* @__PURE__ */ jsx26(
|
|
5294
5381
|
"input",
|
|
5295
5382
|
{
|
|
5296
5383
|
type: "range",
|
|
@@ -5301,14 +5388,14 @@ var ImageEditor = ({
|
|
|
5301
5388
|
className: imageRangeClass
|
|
5302
5389
|
}
|
|
5303
5390
|
),
|
|
5304
|
-
/* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5306
|
-
/* @__PURE__ */
|
|
5391
|
+
/* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
|
|
5392
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
5393
|
+
/* @__PURE__ */ jsxs24("span", { className: "text-muted-foreground", children: [
|
|
5307
5394
|
"Layers (",
|
|
5308
5395
|
state.annotations.length,
|
|
5309
5396
|
")"
|
|
5310
5397
|
] }),
|
|
5311
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5398
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx26(
|
|
5312
5399
|
"button",
|
|
5313
5400
|
{
|
|
5314
5401
|
type: "button",
|
|
@@ -5317,7 +5404,7 @@ var ImageEditor = ({
|
|
|
5317
5404
|
children: "Delete Selected"
|
|
5318
5405
|
}
|
|
5319
5406
|
),
|
|
5320
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5407
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx26(
|
|
5321
5408
|
"button",
|
|
5322
5409
|
{
|
|
5323
5410
|
type: "button",
|
|
@@ -5328,10 +5415,10 @@ var ImageEditor = ({
|
|
|
5328
5415
|
)
|
|
5329
5416
|
] })
|
|
5330
5417
|
] }),
|
|
5331
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
5332
|
-
/* @__PURE__ */
|
|
5333
|
-
/* @__PURE__ */
|
|
5334
|
-
/* @__PURE__ */
|
|
5418
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5419
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
5420
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5421
|
+
/* @__PURE__ */ jsx26(
|
|
5335
5422
|
"button",
|
|
5336
5423
|
{
|
|
5337
5424
|
type: "button",
|
|
@@ -5341,8 +5428,8 @@ var ImageEditor = ({
|
|
|
5341
5428
|
}
|
|
5342
5429
|
)
|
|
5343
5430
|
] }),
|
|
5344
|
-
/* @__PURE__ */
|
|
5345
|
-
/* @__PURE__ */
|
|
5431
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5432
|
+
/* @__PURE__ */ jsx26(
|
|
5346
5433
|
"input",
|
|
5347
5434
|
{
|
|
5348
5435
|
type: "checkbox",
|
|
@@ -5351,12 +5438,12 @@ var ImageEditor = ({
|
|
|
5351
5438
|
className: "rounded accent-primary"
|
|
5352
5439
|
}
|
|
5353
5440
|
),
|
|
5354
|
-
/* @__PURE__ */
|
|
5441
|
+
/* @__PURE__ */ jsx26("span", { children: "Enable Depth / Alpha Mask" })
|
|
5355
5442
|
] }),
|
|
5356
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
5357
|
-
/* @__PURE__ */
|
|
5358
|
-
/* @__PURE__ */
|
|
5359
|
-
/* @__PURE__ */
|
|
5443
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5444
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
5445
|
+
/* @__PURE__ */ jsx26("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5446
|
+
/* @__PURE__ */ jsx26(
|
|
5360
5447
|
"input",
|
|
5361
5448
|
{
|
|
5362
5449
|
type: "text",
|
|
@@ -5367,8 +5454,8 @@ var ImageEditor = ({
|
|
|
5367
5454
|
}
|
|
5368
5455
|
)
|
|
5369
5456
|
] }),
|
|
5370
|
-
/* @__PURE__ */
|
|
5371
|
-
/* @__PURE__ */
|
|
5457
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
|
|
5458
|
+
/* @__PURE__ */ jsx26(
|
|
5372
5459
|
"button",
|
|
5373
5460
|
{
|
|
5374
5461
|
type: "button",
|
|
@@ -5377,7 +5464,7 @@ var ImageEditor = ({
|
|
|
5377
5464
|
children: "Threshold Mode"
|
|
5378
5465
|
}
|
|
5379
5466
|
),
|
|
5380
|
-
/* @__PURE__ */
|
|
5467
|
+
/* @__PURE__ */ jsx26(
|
|
5381
5468
|
"button",
|
|
5382
5469
|
{
|
|
5383
5470
|
type: "button",
|
|
@@ -5387,12 +5474,12 @@ var ImageEditor = ({
|
|
|
5387
5474
|
}
|
|
5388
5475
|
)
|
|
5389
5476
|
] }),
|
|
5390
|
-
/* @__PURE__ */
|
|
5391
|
-
/* @__PURE__ */
|
|
5392
|
-
/* @__PURE__ */
|
|
5393
|
-
/* @__PURE__ */
|
|
5477
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
5478
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5479
|
+
/* @__PURE__ */ jsx26("span", { children: "Depth Start (Lower):" }),
|
|
5480
|
+
/* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5394
5481
|
] }),
|
|
5395
|
-
/* @__PURE__ */
|
|
5482
|
+
/* @__PURE__ */ jsx26(
|
|
5396
5483
|
"input",
|
|
5397
5484
|
{
|
|
5398
5485
|
type: "range",
|
|
@@ -5406,12 +5493,12 @@ var ImageEditor = ({
|
|
|
5406
5493
|
}
|
|
5407
5494
|
)
|
|
5408
5495
|
] }),
|
|
5409
|
-
/* @__PURE__ */
|
|
5410
|
-
/* @__PURE__ */
|
|
5411
|
-
/* @__PURE__ */
|
|
5412
|
-
/* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
5497
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5498
|
+
/* @__PURE__ */ jsx26("span", { children: "Depth Stop (Upper):" }),
|
|
5499
|
+
/* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5413
5500
|
] }),
|
|
5414
|
-
/* @__PURE__ */
|
|
5501
|
+
/* @__PURE__ */ jsx26(
|
|
5415
5502
|
"input",
|
|
5416
5503
|
{
|
|
5417
5504
|
type: "range",
|
|
@@ -5425,12 +5512,12 @@ var ImageEditor = ({
|
|
|
5425
5512
|
}
|
|
5426
5513
|
)
|
|
5427
5514
|
] }),
|
|
5428
|
-
/* @__PURE__ */
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
/* @__PURE__ */
|
|
5431
|
-
/* @__PURE__ */
|
|
5515
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
5516
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5517
|
+
/* @__PURE__ */ jsx26("span", { children: "Softness:" }),
|
|
5518
|
+
/* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5432
5519
|
] }),
|
|
5433
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx26(
|
|
5434
5521
|
"input",
|
|
5435
5522
|
{
|
|
5436
5523
|
type: "range",
|
|
@@ -5442,8 +5529,8 @@ var ImageEditor = ({
|
|
|
5442
5529
|
}
|
|
5443
5530
|
)
|
|
5444
5531
|
] }),
|
|
5445
|
-
/* @__PURE__ */
|
|
5446
|
-
/* @__PURE__ */
|
|
5532
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5533
|
+
/* @__PURE__ */ jsx26(
|
|
5447
5534
|
"input",
|
|
5448
5535
|
{
|
|
5449
5536
|
type: "checkbox",
|
|
@@ -5452,12 +5539,12 @@ var ImageEditor = ({
|
|
|
5452
5539
|
className: "rounded accent-primary"
|
|
5453
5540
|
}
|
|
5454
5541
|
),
|
|
5455
|
-
/* @__PURE__ */
|
|
5542
|
+
/* @__PURE__ */ jsx26("span", { children: "Invert Mask" })
|
|
5456
5543
|
] })
|
|
5457
5544
|
] })
|
|
5458
5545
|
] }),
|
|
5459
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5460
|
-
/* @__PURE__ */
|
|
5546
|
+
activeTab === "select" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5547
|
+
/* @__PURE__ */ jsx26(
|
|
5461
5548
|
SelectionOptionsBar,
|
|
5462
5549
|
{
|
|
5463
5550
|
controller,
|
|
@@ -5468,9 +5555,9 @@ var ImageEditor = ({
|
|
|
5468
5555
|
selectionDisplay: state.selectionDisplay
|
|
5469
5556
|
}
|
|
5470
5557
|
),
|
|
5471
|
-
selectionError && /* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
5558
|
+
selectionError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5559
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
|
|
5560
|
+
/* @__PURE__ */ jsx26(
|
|
5474
5561
|
"button",
|
|
5475
5562
|
{
|
|
5476
5563
|
type: "button",
|
|
@@ -5481,7 +5568,7 @@ var ImageEditor = ({
|
|
|
5481
5568
|
children: "Transform Selection"
|
|
5482
5569
|
}
|
|
5483
5570
|
),
|
|
5484
|
-
/* @__PURE__ */
|
|
5571
|
+
/* @__PURE__ */ jsx26(
|
|
5485
5572
|
"button",
|
|
5486
5573
|
{
|
|
5487
5574
|
type: "button",
|
|
@@ -5493,14 +5580,14 @@ var ImageEditor = ({
|
|
|
5493
5580
|
}
|
|
5494
5581
|
)
|
|
5495
5582
|
] }),
|
|
5496
|
-
/* @__PURE__ */
|
|
5497
|
-
/* @__PURE__ */
|
|
5498
|
-
/* @__PURE__ */
|
|
5583
|
+
/* @__PURE__ */ jsx26(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5584
|
+
/* @__PURE__ */ jsx26(ChannelsPanel, { controller }),
|
|
5585
|
+
/* @__PURE__ */ jsx26(PathsPanel, { controller })
|
|
5499
5586
|
] }),
|
|
5500
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5501
|
-
/* @__PURE__ */
|
|
5502
|
-
/* @__PURE__ */
|
|
5503
|
-
/* @__PURE__ */
|
|
5587
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5588
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5589
|
+
/* @__PURE__ */ jsx26("span", { children: "Results go to" }),
|
|
5590
|
+
/* @__PURE__ */ jsxs24(
|
|
5504
5591
|
"select",
|
|
5505
5592
|
{
|
|
5506
5593
|
"aria-label": "AI result target",
|
|
@@ -5508,54 +5595,54 @@ var ImageEditor = ({
|
|
|
5508
5595
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5509
5596
|
className: imageSelectClass,
|
|
5510
5597
|
children: [
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
/* @__PURE__ */
|
|
5513
|
-
/* @__PURE__ */
|
|
5598
|
+
/* @__PURE__ */ jsx26("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5599
|
+
/* @__PURE__ */ jsx26("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5600
|
+
/* @__PURE__ */ jsx26("option", { value: "replace", children: "Replace image" })
|
|
5514
5601
|
]
|
|
5515
5602
|
}
|
|
5516
5603
|
)
|
|
5517
5604
|
] }),
|
|
5518
|
-
/* @__PURE__ */
|
|
5519
|
-
/* @__PURE__ */
|
|
5520
|
-
/* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5605
|
+
/* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5606
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
5607
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5608
|
+
/* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
|
|
5522
5609
|
"Background Removal"
|
|
5523
5610
|
] }),
|
|
5524
|
-
isRemovingBg && /* @__PURE__ */
|
|
5611
|
+
isRemovingBg && /* @__PURE__ */ jsx26("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
|
|
5525
5612
|
] }),
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5613
|
+
/* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5614
|
+
/* @__PURE__ */ jsx26(
|
|
5528
5615
|
"button",
|
|
5529
5616
|
{
|
|
5530
5617
|
type: "button",
|
|
5531
5618
|
onClick: handleRemoveBackground,
|
|
5532
5619
|
disabled: isRemovingBg || isInpainting,
|
|
5533
5620
|
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
5534
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
5535
|
-
/* @__PURE__ */
|
|
5621
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5622
|
+
/* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
|
|
5536
5623
|
"Removing Background..."
|
|
5537
|
-
] }) : /* @__PURE__ */
|
|
5538
|
-
/* @__PURE__ */
|
|
5624
|
+
] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5625
|
+
/* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
|
|
5539
5626
|
"Remove Background"
|
|
5540
5627
|
] })
|
|
5541
5628
|
}
|
|
5542
5629
|
)
|
|
5543
5630
|
] }),
|
|
5544
|
-
/* @__PURE__ */
|
|
5545
|
-
/* @__PURE__ */
|
|
5546
|
-
/* @__PURE__ */
|
|
5547
|
-
/* @__PURE__ */
|
|
5548
|
-
/* @__PURE__ */
|
|
5549
|
-
/* @__PURE__ */
|
|
5631
|
+
/* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5632
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
5633
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5634
|
+
/* @__PURE__ */ jsxs24("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5635
|
+
/* @__PURE__ */ jsx26("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" }),
|
|
5636
|
+
/* @__PURE__ */ jsx26("path", { d: "m14 7 3 3" })
|
|
5550
5637
|
] }),
|
|
5551
5638
|
"Generative Inpainting"
|
|
5552
5639
|
] }),
|
|
5553
|
-
isInpainting && /* @__PURE__ */
|
|
5640
|
+
isInpainting && /* @__PURE__ */ jsx26("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
|
|
5554
5641
|
] }),
|
|
5555
|
-
/* @__PURE__ */
|
|
5556
|
-
/* @__PURE__ */
|
|
5557
|
-
/* @__PURE__ */
|
|
5558
|
-
/* @__PURE__ */
|
|
5642
|
+
/* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5643
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
|
|
5644
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5645
|
+
/* @__PURE__ */ jsx26(
|
|
5559
5646
|
"textarea",
|
|
5560
5647
|
{
|
|
5561
5648
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5567,10 +5654,10 @@ var ImageEditor = ({
|
|
|
5567
5654
|
}
|
|
5568
5655
|
)
|
|
5569
5656
|
] }),
|
|
5570
|
-
/* @__PURE__ */
|
|
5571
|
-
/* @__PURE__ */
|
|
5572
|
-
/* @__PURE__ */
|
|
5573
|
-
/* @__PURE__ */
|
|
5657
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
|
|
5658
|
+
/* @__PURE__ */ jsx26("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5659
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5660
|
+
/* @__PURE__ */ jsxs24(
|
|
5574
5661
|
"button",
|
|
5575
5662
|
{
|
|
5576
5663
|
type: "button",
|
|
@@ -5583,7 +5670,7 @@ var ImageEditor = ({
|
|
|
5583
5670
|
]
|
|
5584
5671
|
}
|
|
5585
5672
|
),
|
|
5586
|
-
/* @__PURE__ */
|
|
5673
|
+
/* @__PURE__ */ jsxs24(
|
|
5587
5674
|
"button",
|
|
5588
5675
|
{
|
|
5589
5676
|
type: "button",
|
|
@@ -5598,25 +5685,25 @@ var ImageEditor = ({
|
|
|
5598
5685
|
)
|
|
5599
5686
|
] })
|
|
5600
5687
|
] }),
|
|
5601
|
-
/* @__PURE__ */
|
|
5688
|
+
/* @__PURE__ */ jsx26(
|
|
5602
5689
|
"button",
|
|
5603
5690
|
{
|
|
5604
5691
|
type: "button",
|
|
5605
5692
|
onClick: handleInpaint,
|
|
5606
5693
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5607
5694
|
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
5608
|
-
children: isInpainting ? /* @__PURE__ */
|
|
5609
|
-
/* @__PURE__ */
|
|
5695
|
+
children: isInpainting ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5696
|
+
/* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
|
|
5610
5697
|
"Generating Inpaint..."
|
|
5611
|
-
] }) : /* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5698
|
+
] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5699
|
+
/* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
|
|
5613
5700
|
"Apply Inpainting"
|
|
5614
5701
|
] })
|
|
5615
5702
|
}
|
|
5616
5703
|
)
|
|
5617
5704
|
] }),
|
|
5618
|
-
aiError && /* @__PURE__ */
|
|
5619
|
-
aiSuccess && /* @__PURE__ */
|
|
5705
|
+
aiError && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5706
|
+
aiSuccess && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5620
5707
|
] })
|
|
5621
5708
|
] })
|
|
5622
5709
|
] })
|
|
@@ -5641,6 +5728,7 @@ export {
|
|
|
5641
5728
|
CurvesEditor,
|
|
5642
5729
|
AdjustmentLayersPanel,
|
|
5643
5730
|
LayerEffectsPanel,
|
|
5731
|
+
EdgeColorPanel,
|
|
5644
5732
|
LayersPanel,
|
|
5645
5733
|
ImageEffectControls,
|
|
5646
5734
|
ImageProviderEffectsPanel,
|