@pixerate/editor-react 0.206.0 → 0.208.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/canvas/MermaidFamilyScene.d.cts +8 -2
- package/dist/canvas/MermaidFamilyScene.d.ts +8 -2
- package/dist/canvas/index.cjs +68 -7
- package/dist/canvas/index.js +88 -24
- package/dist/canvas/useMermaidDiagram.d.cts +5 -2
- package/dist/canvas/useMermaidDiagram.d.ts +5 -2
- package/dist/{chunk-HOFRSMB6.js → chunk-MK3YNIBU.js} +1500 -1188
- package/dist/image-editor/LayersPanel.d.cts +6 -1
- package/dist/image-editor/LayersPanel.d.ts +6 -1
- package/dist/image-editor/SmartObjectPanel.d.cts +16 -0
- package/dist/image-editor/SmartObjectPanel.d.ts +16 -0
- package/dist/image-editor/index.cjs +1903 -1599
- 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 +2445 -2141
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -222,7 +222,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
// src/image-editor/ImageEditor.tsx
|
|
225
|
-
import
|
|
225
|
+
import React25, { useRef as useRef13, useEffect as useEffect17, useState as useState26 } from "react";
|
|
226
226
|
import {
|
|
227
227
|
normalizeProcessVersion,
|
|
228
228
|
LATEST_PROCESS_VERSION,
|
|
@@ -1477,7 +1477,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1477
1477
|
};
|
|
1478
1478
|
|
|
1479
1479
|
// src/image-editor/LayersPanel.tsx
|
|
1480
|
-
import { useEffect as
|
|
1480
|
+
import React8, { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
|
|
1481
1481
|
|
|
1482
1482
|
// src/image-editor/EdgeColorPanel.tsx
|
|
1483
1483
|
import { useRef as useRef4, useState as useState6 } from "react";
|
|
@@ -1615,6 +1615,197 @@ var VectorMaskEdgesPanel = ({ controller, layer, className = "" }) => {
|
|
|
1615
1615
|
] });
|
|
1616
1616
|
};
|
|
1617
1617
|
|
|
1618
|
+
// src/image-editor/SmartObjectPanel.tsx
|
|
1619
|
+
import { useEffect as useEffect5, useRef as useRef5, useState as useState8 } from "react";
|
|
1620
|
+
import {
|
|
1621
|
+
SMART_CONTENTS_ACCEPT,
|
|
1622
|
+
SMART_FILTER_MENU,
|
|
1623
|
+
downloadSmartObjectContents,
|
|
1624
|
+
replaceSmartObjectContentsFromFile,
|
|
1625
|
+
smartFilterControls,
|
|
1626
|
+
smartObjectPanel
|
|
1627
|
+
} from "@pixerate/editor/image-editor";
|
|
1628
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1629
|
+
var button = imageIconButtonClass;
|
|
1630
|
+
var SmartObjectPanel = ({ controller, layerId, className }) => {
|
|
1631
|
+
const [, setTick] = useState8(0);
|
|
1632
|
+
useEffect5(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1633
|
+
const [open, setOpen] = useState8(null);
|
|
1634
|
+
const [error, setError] = useState8(null);
|
|
1635
|
+
const fileInput = useRef5(null);
|
|
1636
|
+
const commitNext = useRef5(true);
|
|
1637
|
+
const model = smartObjectPanel(controller, layerId);
|
|
1638
|
+
const id = model.layerId;
|
|
1639
|
+
const attempt = (fn) => {
|
|
1640
|
+
try {
|
|
1641
|
+
setError(null);
|
|
1642
|
+
const r = fn();
|
|
1643
|
+
if (r instanceof Promise) r.catch((err) => setError(err instanceof Error ? err.message : String(err)));
|
|
1644
|
+
} catch (err) {
|
|
1645
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
if (!model.available || !id || !model.contents) {
|
|
1649
|
+
return /* @__PURE__ */ jsx8("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "smart-object", children: model.reason });
|
|
1650
|
+
}
|
|
1651
|
+
const readOnly = !model.editable;
|
|
1652
|
+
const state = controller.getState();
|
|
1653
|
+
const change = (filterId, c2, value, drag = false) => attempt(() => {
|
|
1654
|
+
controller.updateSmartFilter(id, filterId, { [c2.key]: value }, drag ? commitNext.current : true);
|
|
1655
|
+
if (drag) commitNext.current = false;
|
|
1656
|
+
});
|
|
1657
|
+
const renderControl = (filterId, c2) => {
|
|
1658
|
+
if (c2.type === "select") {
|
|
1659
|
+
return /* @__PURE__ */ jsxs8("label", { className: "flex flex-col gap-0.5", children: [
|
|
1660
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: c2.label }),
|
|
1661
|
+
/* @__PURE__ */ jsx8(ImageSelect, { label: c2.label, value: c2.value, disabled: readOnly, options: c2.options, onChange: (v) => change(filterId, c2, v) })
|
|
1662
|
+
] }, c2.key);
|
|
1663
|
+
}
|
|
1664
|
+
if (c2.type !== "range") return null;
|
|
1665
|
+
const k = c2.percent ? 100 : 1;
|
|
1666
|
+
const shown = Math.round(c2.value * k * 100) / 100;
|
|
1667
|
+
return /* @__PURE__ */ jsxs8("label", { className: "flex flex-col gap-0.5", children: [
|
|
1668
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-muted-foreground", children: [
|
|
1669
|
+
c2.label,
|
|
1670
|
+
" ",
|
|
1671
|
+
shown,
|
|
1672
|
+
c2.unit
|
|
1673
|
+
] }),
|
|
1674
|
+
/* @__PURE__ */ jsx8(
|
|
1675
|
+
ImageRange,
|
|
1676
|
+
{
|
|
1677
|
+
label: c2.label,
|
|
1678
|
+
min: c2.min * k,
|
|
1679
|
+
max: c2.max * k,
|
|
1680
|
+
step: c2.step * k,
|
|
1681
|
+
value: shown,
|
|
1682
|
+
disabled: readOnly,
|
|
1683
|
+
onStart: () => commitNext.current = true,
|
|
1684
|
+
onEnd: () => commitNext.current = true,
|
|
1685
|
+
onChange: (v) => change(filterId, c2, v / k, true)
|
|
1686
|
+
}
|
|
1687
|
+
)
|
|
1688
|
+
] }, c2.key);
|
|
1689
|
+
};
|
|
1690
|
+
const c = model.contents;
|
|
1691
|
+
return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "smart-object", "aria-label": "Smart object", role: "group", children: [
|
|
1692
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
1693
|
+
/* @__PURE__ */ jsx8("span", { className: "font-semibold text-foreground", children: "Smart Object" }),
|
|
1694
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-muted-foreground", "data-testid": "smart-contents", children: [
|
|
1695
|
+
c.name,
|
|
1696
|
+
" \xB7 ",
|
|
1697
|
+
c.width,
|
|
1698
|
+
" \xD7 ",
|
|
1699
|
+
c.height,
|
|
1700
|
+
" ",
|
|
1701
|
+
c.kind === "document" ? "layers" : "px",
|
|
1702
|
+
c.instances > 1 ? ` \xB7 ${c.instances} linked` : "",
|
|
1703
|
+
c.linkedPath ? ` \xB7 linked file ${c.linkedPath}` : "",
|
|
1704
|
+
c.decoded ? "" : " \xB7 not decoded here"
|
|
1705
|
+
] })
|
|
1706
|
+
] }),
|
|
1707
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Smart object actions", children: [
|
|
1708
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: !c.decoded, onClick: () => attempt(() => controller.editSmartObjectContents(id)), children: "Edit Contents" }),
|
|
1709
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: readOnly, onClick: () => fileInput.current?.click(), children: "Replace Contents\u2026" }),
|
|
1710
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => attempt(() => downloadSmartObjectContents(controller, id)), children: "Export Contents" }),
|
|
1711
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: readOnly, onClick: () => attempt(() => controller.copySmartObject(id, false)), children: "New via Copy" }),
|
|
1712
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: readOnly, onClick: () => attempt(() => controller.rasterizeSmartObject(id)), children: "Rasterize" }),
|
|
1713
|
+
/* @__PURE__ */ jsx8(
|
|
1714
|
+
"input",
|
|
1715
|
+
{
|
|
1716
|
+
ref: fileInput,
|
|
1717
|
+
type: "file",
|
|
1718
|
+
accept: SMART_CONTENTS_ACCEPT,
|
|
1719
|
+
className: "hidden",
|
|
1720
|
+
"data-testid": "smart-contents-input",
|
|
1721
|
+
"aria-label": "Replace contents with a file",
|
|
1722
|
+
onChange: (e) => {
|
|
1723
|
+
const file = e.currentTarget.files?.[0];
|
|
1724
|
+
e.currentTarget.value = "";
|
|
1725
|
+
if (file) attempt(() => replaceSmartObjectContentsFromFile(controller, id, file));
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
)
|
|
1729
|
+
] }),
|
|
1730
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-2 border-t border-border pt-1.5", children: [
|
|
1731
|
+
/* @__PURE__ */ jsx8("span", { className: "font-semibold text-foreground", children: "Smart Filters" }),
|
|
1732
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1733
|
+
/* @__PURE__ */ jsx8(ImageCheckbox, { label: "Smart filters on", checked: model.filtersEnabled, disabled: readOnly || !model.filters.length, onChange: (on) => attempt(() => controller.setSmartFiltersEnabled(id, on)) }),
|
|
1734
|
+
"On"
|
|
1735
|
+
] }),
|
|
1736
|
+
/* @__PURE__ */ jsx8(
|
|
1737
|
+
ImageSelect,
|
|
1738
|
+
{
|
|
1739
|
+
label: "Add smart filter",
|
|
1740
|
+
value: "",
|
|
1741
|
+
placeholder: "Add smart filter\u2026",
|
|
1742
|
+
disabled: readOnly,
|
|
1743
|
+
options: SMART_FILTER_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
1744
|
+
onChange: (kind) => {
|
|
1745
|
+
if (kind) attempt(() => setOpen(controller.addSmartFilter(id, { kind }).id));
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1749
|
+
] }),
|
|
1750
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1.5", role: "group", "aria-label": "Filter mask", "data-testid": "smart-filter-mask", children: [
|
|
1751
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Filter mask" }),
|
|
1752
|
+
model.mask ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1753
|
+
/* @__PURE__ */ jsx8(
|
|
1754
|
+
"button",
|
|
1755
|
+
{
|
|
1756
|
+
type: "button",
|
|
1757
|
+
className: button,
|
|
1758
|
+
"aria-pressed": state.activeLayerId === id && state.activeTarget === "filter-mask",
|
|
1759
|
+
onClick: () => attempt(() => controller.setActiveLayer(id, "filter-mask")),
|
|
1760
|
+
children: "Paint"
|
|
1761
|
+
}
|
|
1762
|
+
),
|
|
1763
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1764
|
+
/* @__PURE__ */ jsx8(ImageCheckbox, { label: "Filter mask on", checked: model.mask.enabled, disabled: readOnly, onChange: (on) => attempt(() => controller.setSmartFilterMask(id, "keep", { enabled: on })) }),
|
|
1765
|
+
"On"
|
|
1766
|
+
] }),
|
|
1767
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1768
|
+
/* @__PURE__ */ jsx8(ImageCheckbox, { label: "Filter mask linked", checked: model.mask.linked, disabled: readOnly, onChange: (on) => attempt(() => controller.setSmartFilterMask(id, "keep", { linked: on })) }),
|
|
1769
|
+
"Linked"
|
|
1770
|
+
] }),
|
|
1771
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: readOnly || !controller.hasSelection, onClick: () => attempt(() => controller.setSmartFilterMask(id, "selection")), children: "From Selection" }),
|
|
1772
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": "Remove filter mask", disabled: readOnly, onClick: () => attempt(() => controller.setSmartFilterMask(id, "none")), children: "\u2715" })
|
|
1773
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1774
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: readOnly, onClick: () => attempt(() => controller.setSmartFilterMask(id, "reveal-all")), children: "Add" }),
|
|
1775
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, disabled: readOnly || !controller.hasSelection, onClick: () => attempt(() => controller.setSmartFilterMask(id, "selection")), children: "From Selection" })
|
|
1776
|
+
] })
|
|
1777
|
+
] }),
|
|
1778
|
+
/* @__PURE__ */ jsx8("ul", { className: "flex flex-col gap-1", "aria-label": "Smart filters", children: model.filters.map((row, i) => {
|
|
1779
|
+
const expanded = open === row.filter.id;
|
|
1780
|
+
const last = model.filters.length - 1;
|
|
1781
|
+
return /* @__PURE__ */ jsxs8("li", { "data-filter-id": row.filter.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1782
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1783
|
+
/* @__PURE__ */ jsx8(ImageCheckbox, { label: `${row.label} on`, checked: row.filter.enabled, disabled: readOnly, onChange: (on) => attempt(() => controller.updateSmartFilter(id, row.filter.id, { enabled: on })) }),
|
|
1784
|
+
/* @__PURE__ */ jsxs8(
|
|
1785
|
+
"button",
|
|
1786
|
+
{
|
|
1787
|
+
type: "button",
|
|
1788
|
+
"aria-expanded": expanded,
|
|
1789
|
+
className: `flex-1 text-left ${row.filter.enabled && model.filtersEnabled ? "" : "text-muted-foreground"}`,
|
|
1790
|
+
title: row.drawn ? void 0 : "A Photoshop filter kept from the file: written back, not drawn here.",
|
|
1791
|
+
onClick: () => setOpen(expanded ? null : row.filter.id),
|
|
1792
|
+
children: [
|
|
1793
|
+
row.label,
|
|
1794
|
+
row.drawn ? "" : " (not drawn)"
|
|
1795
|
+
]
|
|
1796
|
+
}
|
|
1797
|
+
),
|
|
1798
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": `Move ${row.label} up`, disabled: readOnly || i === 0, onClick: () => attempt(() => controller.moveSmartFilter(id, row.filter.id, row.index + 1)), children: "\u2191" }),
|
|
1799
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": `Move ${row.label} down`, disabled: readOnly || i === last, onClick: () => attempt(() => controller.moveSmartFilter(id, row.filter.id, row.index - 1)), children: "\u2193" }),
|
|
1800
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": `Remove ${row.label}`, disabled: readOnly, onClick: () => attempt(() => controller.removeSmartFilter(id, row.filter.id)), children: "\u2715" })
|
|
1801
|
+
] }),
|
|
1802
|
+
expanded && /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "smart-filter-settings", children: smartFilterControls(row.filter).map((ctl) => renderControl(row.filter.id, ctl)) })
|
|
1803
|
+
] }, row.filter.id);
|
|
1804
|
+
}) }),
|
|
1805
|
+
error && /* @__PURE__ */ jsx8("p", { role: "alert", className: "text-destructive", children: error })
|
|
1806
|
+
] });
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1618
1809
|
// src/image-editor/LayersPanel.tsx
|
|
1619
1810
|
import {
|
|
1620
1811
|
BIT_DEPTH_OPTIONS,
|
|
@@ -1631,12 +1822,14 @@ import {
|
|
|
1631
1822
|
layerBadge,
|
|
1632
1823
|
layerHasThumbnail,
|
|
1633
1824
|
layerWarning,
|
|
1825
|
+
smartFilterRows,
|
|
1826
|
+
smartObjectBadge,
|
|
1634
1827
|
layerEffectsBadge,
|
|
1635
1828
|
layerMenu,
|
|
1636
1829
|
layerPanelRows,
|
|
1637
1830
|
runLayerMenuAction
|
|
1638
1831
|
} from "@pixerate/editor/image-editor";
|
|
1639
|
-
import { Fragment as
|
|
1832
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1640
1833
|
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"}`;
|
|
1641
1834
|
var Thumbnail = ({
|
|
1642
1835
|
pixels,
|
|
@@ -1647,8 +1840,8 @@ var Thumbnail = ({
|
|
|
1647
1840
|
selected,
|
|
1648
1841
|
testId
|
|
1649
1842
|
}) => {
|
|
1650
|
-
const ref =
|
|
1651
|
-
|
|
1843
|
+
const ref = useRef6(null);
|
|
1844
|
+
useEffect6(() => {
|
|
1652
1845
|
const canvas = ref.current;
|
|
1653
1846
|
const ctx = canvas?.getContext("2d");
|
|
1654
1847
|
if (!canvas || !ctx || !pixels || typeof ctx.createImageData !== "function") return;
|
|
@@ -1658,7 +1851,7 @@ var Thumbnail = ({
|
|
|
1658
1851
|
img.data.set(pixels.data);
|
|
1659
1852
|
ctx.putImageData(img, 0, 0);
|
|
1660
1853
|
}, [pixels]);
|
|
1661
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ jsx9(
|
|
1662
1855
|
"canvas",
|
|
1663
1856
|
{
|
|
1664
1857
|
ref,
|
|
@@ -1672,15 +1865,15 @@ var Thumbnail = ({
|
|
|
1672
1865
|
}
|
|
1673
1866
|
);
|
|
1674
1867
|
};
|
|
1675
|
-
var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
|
|
1676
|
-
const [, setTick] =
|
|
1677
|
-
|
|
1678
|
-
const [error, setError] =
|
|
1679
|
-
const [renaming, setRenaming] =
|
|
1680
|
-
const [menu, setMenu] =
|
|
1681
|
-
const [drag, setDrag] =
|
|
1682
|
-
const [psdNotes, setPsdNotes] =
|
|
1683
|
-
const fileInput =
|
|
1868
|
+
var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, smartObjects = true, className }) => {
|
|
1869
|
+
const [, setTick] = useState9(0);
|
|
1870
|
+
useEffect6(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
1871
|
+
const [error, setError] = useState9(null);
|
|
1872
|
+
const [renaming, setRenaming] = useState9(null);
|
|
1873
|
+
const [menu, setMenu] = useState9(null);
|
|
1874
|
+
const [drag, setDrag] = useState9(null);
|
|
1875
|
+
const [psdNotes, setPsdNotes] = useState9([]);
|
|
1876
|
+
const fileInput = useRef6(null);
|
|
1684
1877
|
const psdTask = async (fn) => {
|
|
1685
1878
|
try {
|
|
1686
1879
|
setError(null);
|
|
@@ -1689,7 +1882,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1689
1882
|
setError(err instanceof Error ? err.message : String(err));
|
|
1690
1883
|
}
|
|
1691
1884
|
};
|
|
1692
|
-
const commitNext =
|
|
1885
|
+
const commitNext = useRef6(true);
|
|
1693
1886
|
const state = controller.getState();
|
|
1694
1887
|
const maskView = controller.getMaskView();
|
|
1695
1888
|
const rows = layerPanelRows(state.layers, state.activeLayerId);
|
|
@@ -1725,18 +1918,27 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1725
1918
|
const placement = dropPlacement(state.layers, id, row.layer.id, dropZone(fraction, row.layer.type === "group"));
|
|
1726
1919
|
if (placement) attempt(() => controller.moveLayer(id, placement));
|
|
1727
1920
|
};
|
|
1728
|
-
const thumb = (layer) => layerHasThumbnail(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1921
|
+
const thumb = (layer) => layerHasThumbnail(layer) || layer.type === "smart" ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1922
|
+
const editing = state.editingContents ?? [];
|
|
1729
1923
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1730
1924
|
const vectorThumb = (layer) => layer.vectorMask ? vectorMaskThumbnail(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
|
|
1731
1925
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1732
|
-
return /* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
/* @__PURE__ */
|
|
1739
|
-
/* @__PURE__ */
|
|
1926
|
+
return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1927
|
+
editing.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1.5 rounded bg-primary/15 px-2 py-1 text-foreground ring-1 ring-primary/40", role: "status", "data-testid": "smart-editing", children: [
|
|
1928
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex-1 min-w-0 truncate", children: [
|
|
1929
|
+
"Editing contents: ",
|
|
1930
|
+
editing.map((e) => e.name).join(" \u203A ")
|
|
1931
|
+
] }),
|
|
1932
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => attempt(() => controller.closeSmartObjectContents(true)), children: "Save & Close" }),
|
|
1933
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => attempt(() => controller.closeSmartObjectContents(false)), children: "Discard" })
|
|
1934
|
+
] }),
|
|
1935
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1936
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1937
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1938
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1939
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1940
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1941
|
+
/* @__PURE__ */ jsx9(
|
|
1740
1942
|
"button",
|
|
1741
1943
|
{
|
|
1742
1944
|
type: "button",
|
|
@@ -1751,7 +1953,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1751
1953
|
children: "\u22EF"
|
|
1752
1954
|
}
|
|
1753
1955
|
),
|
|
1754
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx9(
|
|
1755
1957
|
"select",
|
|
1756
1958
|
{
|
|
1757
1959
|
"aria-label": "Bits per channel",
|
|
@@ -1759,13 +1961,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1759
1961
|
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1760
1962
|
value: controller.bitDepth,
|
|
1761
1963
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1762
|
-
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */
|
|
1964
|
+
children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx9("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1763
1965
|
}
|
|
1764
1966
|
),
|
|
1765
|
-
psd && /* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1967
|
+
psd && /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1968
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1969
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1970
|
+
/* @__PURE__ */ jsx9(
|
|
1769
1971
|
"input",
|
|
1770
1972
|
{
|
|
1771
1973
|
ref: fileInput,
|
|
@@ -1783,18 +1985,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1783
1985
|
)
|
|
1784
1986
|
] })
|
|
1785
1987
|
] }),
|
|
1786
|
-
psdNotes.length > 0 && /* @__PURE__ */
|
|
1787
|
-
psdNotes.map((n) => /* @__PURE__ */
|
|
1788
|
-
/* @__PURE__ */
|
|
1988
|
+
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: [
|
|
1989
|
+
psdNotes.map((n) => /* @__PURE__ */ jsx9("li", { children: n }, n)),
|
|
1990
|
+
/* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1789
1991
|
] }),
|
|
1790
|
-
active && /* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1992
|
+
active && /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1993
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
|
|
1994
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
1793
1995
|
"Opacity ",
|
|
1794
1996
|
Math.round(active.opacity * 100),
|
|
1795
1997
|
"%"
|
|
1796
1998
|
] }),
|
|
1797
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsx9(
|
|
1798
2000
|
"input",
|
|
1799
2001
|
{
|
|
1800
2002
|
type: "range",
|
|
@@ -1808,28 +2010,28 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1808
2010
|
}
|
|
1809
2011
|
)
|
|
1810
2012
|
] }),
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
|
|
2014
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
1813
2015
|
"Fill ",
|
|
1814
|
-
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
2016
|
+
Math.round(((active.type === "pixel" || active.type === "smart" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1815
2017
|
"%"
|
|
1816
2018
|
] }),
|
|
1817
|
-
/* @__PURE__ */
|
|
2019
|
+
/* @__PURE__ */ jsx9(
|
|
1818
2020
|
"input",
|
|
1819
2021
|
{
|
|
1820
2022
|
type: "range",
|
|
1821
2023
|
min: 0,
|
|
1822
2024
|
max: 100,
|
|
1823
2025
|
"aria-label": "Layer fill",
|
|
1824
|
-
disabled: active.type !== "pixel",
|
|
1825
|
-
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
2026
|
+
disabled: active.type !== "pixel" && active.type !== "smart",
|
|
2027
|
+
value: Math.round(((active.type === "pixel" || active.type === "smart" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1826
2028
|
...sliderEvents,
|
|
1827
2029
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
1828
2030
|
className: "accent-primary disabled:opacity-40"
|
|
1829
2031
|
}
|
|
1830
2032
|
)
|
|
1831
2033
|
] }),
|
|
1832
|
-
/* @__PURE__ */
|
|
2034
|
+
/* @__PURE__ */ jsxs9(
|
|
1833
2035
|
"select",
|
|
1834
2036
|
{
|
|
1835
2037
|
"aria-label": "Layer blend mode",
|
|
@@ -1837,13 +2039,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1837
2039
|
value: active.blend,
|
|
1838
2040
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1839
2041
|
children: [
|
|
1840
|
-
active.type === "group" && /* @__PURE__ */
|
|
1841
|
-
BLEND_MODES2.map((m) => /* @__PURE__ */
|
|
2042
|
+
active.type === "group" && /* @__PURE__ */ jsx9("option", { value: "pass-through", children: "Pass Through" }),
|
|
2043
|
+
BLEND_MODES2.map((m) => /* @__PURE__ */ jsx9("option", { value: m.id, children: m.label }, m.id))
|
|
1842
2044
|
]
|
|
1843
2045
|
}
|
|
1844
2046
|
),
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
2048
|
+
/* @__PURE__ */ jsx9(
|
|
1847
2049
|
"input",
|
|
1848
2050
|
{
|
|
1849
2051
|
type: "checkbox",
|
|
@@ -1855,8 +2057,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1855
2057
|
),
|
|
1856
2058
|
"Clip to below"
|
|
1857
2059
|
] }),
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
/* @__PURE__ */
|
|
2060
|
+
/* @__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: [
|
|
2061
|
+
/* @__PURE__ */ jsx9(
|
|
1860
2062
|
"input",
|
|
1861
2063
|
{
|
|
1862
2064
|
type: "checkbox",
|
|
@@ -1869,200 +2071,309 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1869
2071
|
k
|
|
1870
2072
|
] }, k)) })
|
|
1871
2073
|
] }),
|
|
1872
|
-
active && (active.type === "pixel" || active.type === "shape" || active.type === "type" || active.type === "smart") && /* @__PURE__ */
|
|
1873
|
-
active?.vectorMask && /* @__PURE__ */
|
|
1874
|
-
|
|
1875
|
-
/* @__PURE__ */
|
|
2074
|
+
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),
|
|
2075
|
+
active?.vectorMask && /* @__PURE__ */ jsx9(VectorMaskEdgesPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }),
|
|
2076
|
+
smartObjects && active?.type === "smart" && /* @__PURE__ */ jsx9(SmartObjectPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
2077
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx9(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
2078
|
+
/* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1876
2079
|
const { layer } = row;
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
"
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
e.preventDefault();
|
|
1901
|
-
controller.setActiveLayer(layer.id, state.activeLayerId === layer.id ? state.activeTarget : "pixels");
|
|
1902
|
-
setMenu({ x: e.clientX, y: e.clientY });
|
|
1903
|
-
},
|
|
1904
|
-
className: rowClass(row.active),
|
|
1905
|
-
style: { paddingLeft: 6 + row.depth * 14 },
|
|
1906
|
-
children: [
|
|
1907
|
-
/* @__PURE__ */ jsx8(
|
|
1908
|
-
"button",
|
|
1909
|
-
{
|
|
1910
|
-
type: "button",
|
|
1911
|
-
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
1912
|
-
"aria-pressed": layer.visible,
|
|
1913
|
-
className: "w-4 text-center text-foreground",
|
|
1914
|
-
onClick: (e) => {
|
|
1915
|
-
e.stopPropagation();
|
|
1916
|
-
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
1917
|
-
},
|
|
1918
|
-
children: layer.visible ? "\u25CF" : "\u25CB"
|
|
1919
|
-
}
|
|
1920
|
-
),
|
|
1921
|
-
layer.type === "group" && /* @__PURE__ */ jsx8(
|
|
1922
|
-
"button",
|
|
1923
|
-
{
|
|
1924
|
-
type: "button",
|
|
1925
|
-
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
1926
|
-
className: "w-3 text-muted-foreground",
|
|
1927
|
-
onClick: (e) => {
|
|
1928
|
-
e.stopPropagation();
|
|
1929
|
-
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
1930
|
-
},
|
|
1931
|
-
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
2080
|
+
const badge = smartObjectBadge(state.layers, layer);
|
|
2081
|
+
const filterRows = smartFilterRows(layer);
|
|
2082
|
+
return /* @__PURE__ */ jsxs9(React8.Fragment, { children: [
|
|
2083
|
+
/* @__PURE__ */ jsxs9(
|
|
2084
|
+
"li",
|
|
2085
|
+
{
|
|
2086
|
+
role: "treeitem",
|
|
2087
|
+
"aria-selected": row.active,
|
|
2088
|
+
"aria-level": row.depth + 1,
|
|
2089
|
+
"data-layer-id": layer.id,
|
|
2090
|
+
draggable: !layer.locks?.all,
|
|
2091
|
+
onDragStart: (e) => {
|
|
2092
|
+
e.dataTransfer.setData("text/x-pixerate-layer", layer.id);
|
|
2093
|
+
setDrag(layer.id);
|
|
2094
|
+
},
|
|
2095
|
+
onDragOver: (e) => e.preventDefault(),
|
|
2096
|
+
onDrop: (e) => onDrop(e, row),
|
|
2097
|
+
tabIndex: 0,
|
|
2098
|
+
onClick: () => attempt(() => controller.setActiveLayer(layer.id, "pixels")),
|
|
2099
|
+
onKeyDown: (e) => {
|
|
2100
|
+
if (e.target === e.currentTarget && (e.key === "Enter" || e.key === " ")) {
|
|
2101
|
+
e.preventDefault();
|
|
2102
|
+
attempt(() => controller.setActiveLayer(layer.id, "pixels"));
|
|
1932
2103
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
2104
|
+
},
|
|
2105
|
+
onContextMenu: (e) => {
|
|
2106
|
+
e.preventDefault();
|
|
2107
|
+
controller.setActiveLayer(layer.id, state.activeLayerId === layer.id ? state.activeTarget : "pixels");
|
|
2108
|
+
setMenu({ x: e.clientX, y: e.clientY });
|
|
2109
|
+
},
|
|
2110
|
+
className: rowClass(row.active),
|
|
2111
|
+
style: { paddingLeft: 6 + row.depth * 14 },
|
|
2112
|
+
children: [
|
|
2113
|
+
/* @__PURE__ */ jsx9(
|
|
2114
|
+
"button",
|
|
2115
|
+
{
|
|
2116
|
+
type: "button",
|
|
2117
|
+
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
2118
|
+
"aria-pressed": layer.visible,
|
|
2119
|
+
className: "w-4 text-center text-foreground",
|
|
2120
|
+
onClick: (e) => {
|
|
2121
|
+
e.stopPropagation();
|
|
2122
|
+
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
2123
|
+
},
|
|
2124
|
+
children: layer.visible ? "\u25CF" : "\u25CB"
|
|
2125
|
+
}
|
|
2126
|
+
),
|
|
2127
|
+
layer.type === "group" && /* @__PURE__ */ jsx9(
|
|
2128
|
+
"button",
|
|
2129
|
+
{
|
|
2130
|
+
type: "button",
|
|
2131
|
+
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
2132
|
+
className: "w-3 text-muted-foreground",
|
|
2133
|
+
onClick: (e) => {
|
|
2134
|
+
e.stopPropagation();
|
|
2135
|
+
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
2136
|
+
},
|
|
2137
|
+
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
2138
|
+
}
|
|
2139
|
+
),
|
|
2140
|
+
row.clipped && /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
2141
|
+
layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs9("span", { className: "relative shrink-0", children: [
|
|
2142
|
+
/* @__PURE__ */ jsx9(
|
|
2143
|
+
Thumbnail,
|
|
2144
|
+
{
|
|
2145
|
+
pixels: thumb(layer),
|
|
2146
|
+
size: thumbnailSize,
|
|
2147
|
+
label: `${row.label} pixels`,
|
|
2148
|
+
testId: "layer-thumbnail",
|
|
2149
|
+
selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask),
|
|
2150
|
+
onClick: (e) => {
|
|
2151
|
+
if (e.ctrlKey || e.metaKey) {
|
|
2152
|
+
e.stopPropagation();
|
|
2153
|
+
attempt(() => layerThumbnailClick(controller, layer, e));
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
),
|
|
2158
|
+
layer.type !== "pixel" && /* @__PURE__ */ jsx9(
|
|
2159
|
+
"span",
|
|
2160
|
+
{
|
|
2161
|
+
"data-testid": "layer-kind-badge",
|
|
2162
|
+
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
2163
|
+
children: layerBadge(layer)
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
] }) : badge ? /* @__PURE__ */ jsxs9(
|
|
2167
|
+
"span",
|
|
2168
|
+
{
|
|
2169
|
+
className: "relative shrink-0",
|
|
2170
|
+
title: `${badge.label}. Double-click to edit its contents.`,
|
|
2171
|
+
onDoubleClick: (e) => {
|
|
2172
|
+
e.stopPropagation();
|
|
2173
|
+
attempt(() => controller.editSmartObjectContents(layer.id));
|
|
2174
|
+
},
|
|
2175
|
+
children: [
|
|
2176
|
+
/* @__PURE__ */ jsx9(
|
|
2177
|
+
Thumbnail,
|
|
2178
|
+
{
|
|
2179
|
+
pixels: thumb(layer),
|
|
2180
|
+
size: thumbnailSize,
|
|
2181
|
+
label: `${row.label} pixels`,
|
|
2182
|
+
testId: "layer-thumbnail",
|
|
2183
|
+
selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask),
|
|
2184
|
+
onClick: (e) => {
|
|
2185
|
+
if (e.ctrlKey || e.metaKey) {
|
|
2186
|
+
e.stopPropagation();
|
|
2187
|
+
attempt(() => layerThumbnailClick(controller, layer, e));
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
),
|
|
2192
|
+
/* @__PURE__ */ jsx9(
|
|
2193
|
+
"span",
|
|
2194
|
+
{
|
|
2195
|
+
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
2196
|
+
role: "img",
|
|
2197
|
+
"aria-label": badge.label,
|
|
2198
|
+
"data-testid": "smart-object-badge",
|
|
2199
|
+
children: badge.instances > 1 ? "\u29C9" : "\u25A3"
|
|
2200
|
+
}
|
|
2201
|
+
)
|
|
2202
|
+
]
|
|
2203
|
+
}
|
|
2204
|
+
) : /* @__PURE__ */ jsx9(
|
|
2205
|
+
"span",
|
|
2206
|
+
{
|
|
2207
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
2208
|
+
style: { width: thumbnailSize, height: thumbnailSize },
|
|
2209
|
+
children: layerBadge(layer)
|
|
2210
|
+
}
|
|
2211
|
+
),
|
|
2212
|
+
layer.mask && !layer.mask.source && (layer.type === "pixel" || layer.type === "smart") && /* @__PURE__ */ jsx9(
|
|
2213
|
+
"button",
|
|
2214
|
+
{
|
|
2215
|
+
type: "button",
|
|
2216
|
+
"aria-label": `${layer.mask.linked === false ? "Link" : "Unlink"} ${row.label} mask`,
|
|
2217
|
+
"aria-pressed": layer.mask.linked !== false,
|
|
2218
|
+
title: layer.mask.linked === false ? "Mask unlinked: it stays put when the layer moves or transforms. Click to link." : "Mask linked: it moves with the layer. Click to unlink.",
|
|
2219
|
+
"data-testid": "layer-mask-link",
|
|
2220
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
2221
|
+
onClick: (e) => {
|
|
2222
|
+
e.stopPropagation();
|
|
2223
|
+
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
2224
|
+
},
|
|
2225
|
+
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
2226
|
+
}
|
|
2227
|
+
),
|
|
2228
|
+
layer.mask && /* @__PURE__ */ jsx9(
|
|
1937
2229
|
Thumbnail,
|
|
1938
2230
|
{
|
|
1939
|
-
pixels:
|
|
2231
|
+
pixels: maskThumb(layer),
|
|
1940
2232
|
size: thumbnailSize,
|
|
1941
|
-
label: `${row.label}
|
|
1942
|
-
|
|
1943
|
-
|
|
2233
|
+
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
2234
|
+
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
2235
|
+
testId: "layer-mask-thumbnail",
|
|
2236
|
+
selected: row.active && state.activeTarget === "mask",
|
|
1944
2237
|
onClick: (e) => {
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
attempt(() => layerThumbnailClick(controller, layer, e));
|
|
1948
|
-
}
|
|
2238
|
+
e.stopPropagation();
|
|
2239
|
+
attempt(() => maskThumbnailClick(controller, layer, e));
|
|
1949
2240
|
}
|
|
1950
2241
|
}
|
|
1951
2242
|
),
|
|
1952
|
-
layer.
|
|
2243
|
+
layer.vectorMask && /* @__PURE__ */ jsx9(
|
|
2244
|
+
Thumbnail,
|
|
2245
|
+
{
|
|
2246
|
+
pixels: vectorThumb(layer),
|
|
2247
|
+
size: thumbnailSize,
|
|
2248
|
+
label: `${row.label} vector mask${layer.vectorMask.enabled === false ? " (disabled)" : ""}`,
|
|
2249
|
+
title: "Ctrl/\u2318-click: load the path as the selection \xB7 Shift-click: turn it off or on",
|
|
2250
|
+
testId: "layer-vector-mask-thumbnail",
|
|
2251
|
+
onClick: (e) => {
|
|
2252
|
+
e.stopPropagation();
|
|
2253
|
+
attempt(() => vectorMaskThumbnailClick(controller, layer, e));
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
),
|
|
2257
|
+
renaming === layer.id ? /* @__PURE__ */ jsx9(
|
|
2258
|
+
"input",
|
|
2259
|
+
{
|
|
2260
|
+
autoFocus: true,
|
|
2261
|
+
"aria-label": "Layer name",
|
|
2262
|
+
defaultValue: layer.name || row.label,
|
|
2263
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
2264
|
+
onClick: (e) => e.stopPropagation(),
|
|
2265
|
+
onBlur: (e) => {
|
|
2266
|
+
setRenaming(null);
|
|
2267
|
+
if (e.target.value.trim() && e.target.value !== layer.name) attempt(() => controller.setLayerProperties(layer.id, { name: e.target.value }));
|
|
2268
|
+
},
|
|
2269
|
+
onKeyDown: (e) => {
|
|
2270
|
+
if (e.key === "Enter") e.target.blur();
|
|
2271
|
+
if (e.key === "Escape") setRenaming(null);
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
) : /* @__PURE__ */ jsx9(
|
|
1953
2275
|
"span",
|
|
1954
2276
|
{
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
2277
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
2278
|
+
onDoubleClick: (e) => {
|
|
2279
|
+
e.stopPropagation();
|
|
2280
|
+
setRenaming(layer.id);
|
|
2281
|
+
},
|
|
2282
|
+
children: row.label
|
|
1958
2283
|
}
|
|
1959
|
-
)
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
title: layer.mask.linked === false ? "Mask unlinked: it stays put when the layer moves or transforms. Click to link." : "Mask linked: it moves with the layer. Click to unlink.",
|
|
1975
|
-
"data-testid": "layer-mask-link",
|
|
1976
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
1977
|
-
onClick: (e) => {
|
|
1978
|
-
e.stopPropagation();
|
|
1979
|
-
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
1980
|
-
},
|
|
1981
|
-
children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
|
|
1982
|
-
}
|
|
1983
|
-
),
|
|
1984
|
-
layer.mask && /* @__PURE__ */ jsx8(
|
|
1985
|
-
Thumbnail,
|
|
1986
|
-
{
|
|
1987
|
-
pixels: maskThumb(layer),
|
|
1988
|
-
size: thumbnailSize,
|
|
1989
|
-
label: `${row.label} mask${layer.mask.enabled === false ? " (disabled)" : ""}${maskView?.layerId === layer.id ? " (shown)" : ""}`,
|
|
1990
|
-
title: "Alt-click: show the mask alone \xB7 Alt+Shift-click: as an overlay",
|
|
1991
|
-
testId: "layer-mask-thumbnail",
|
|
1992
|
-
selected: row.active && state.activeTarget === "mask",
|
|
1993
|
-
onClick: (e) => {
|
|
1994
|
-
e.stopPropagation();
|
|
1995
|
-
attempt(() => maskThumbnailClick(controller, layer, e));
|
|
2284
|
+
),
|
|
2285
|
+
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" }),
|
|
2286
|
+
layerEffectsBadge(layer) && /* @__PURE__ */ jsx9(
|
|
2287
|
+
"button",
|
|
2288
|
+
{
|
|
2289
|
+
type: "button",
|
|
2290
|
+
"data-testid": "layer-fx-badge",
|
|
2291
|
+
"aria-label": layerEffectsBadge(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
2292
|
+
"aria-pressed": layerEffectsBadge(layer) === "on",
|
|
2293
|
+
className: `text-[9px] italic font-semibold ${layerEffectsBadge(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
2294
|
+
onClick: (e) => {
|
|
2295
|
+
e.stopPropagation();
|
|
2296
|
+
attempt(() => controller.setLayerEffectsEnabled(layer.id, layerEffectsBadge(layer) !== "on"));
|
|
2297
|
+
},
|
|
2298
|
+
children: "fx"
|
|
1996
2299
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2300
|
+
),
|
|
2301
|
+
locked(layer) && /* @__PURE__ */ jsx9("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2302
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx9("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
2303
|
+
]
|
|
2304
|
+
}
|
|
2305
|
+
),
|
|
2306
|
+
layer.type === "smart" && (filterRows.length > 0 || layer.smartFilters?.mask) && /* @__PURE__ */ jsxs9(
|
|
2307
|
+
"li",
|
|
2308
|
+
{
|
|
2309
|
+
role: "treeitem",
|
|
2310
|
+
"aria-level": row.depth + 2,
|
|
2311
|
+
"aria-selected": false,
|
|
2312
|
+
className: "flex items-center gap-1.5 px-1.5 py-0.5 text-muted-foreground",
|
|
2313
|
+
style: { paddingLeft: 26 + row.depth * 14 },
|
|
2314
|
+
"data-testid": "smart-filters-row",
|
|
2315
|
+
children: [
|
|
2316
|
+
/* @__PURE__ */ jsx9(
|
|
2317
|
+
"button",
|
|
2318
|
+
{
|
|
2319
|
+
type: "button",
|
|
2320
|
+
"aria-label": layer.smartFilters?.enabled === false ? `Show smart filters of ${row.label}` : `Hide smart filters of ${row.label}`,
|
|
2321
|
+
"aria-pressed": layer.smartFilters?.enabled !== false,
|
|
2322
|
+
className: "w-4 text-center",
|
|
2323
|
+
onClick: () => attempt(() => controller.setSmartFiltersEnabled(layer.id, layer.smartFilters?.enabled === false)),
|
|
2324
|
+
children: layer.smartFilters?.enabled === false ? "\u25CB" : "\u25CF"
|
|
2010
2325
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
onKeyDown: (e) => {
|
|
2026
|
-
if (e.key === "Enter") e.target.blur();
|
|
2027
|
-
if (e.key === "Escape") setRenaming(null);
|
|
2326
|
+
),
|
|
2327
|
+
layer.smartFilters?.mask && /* @__PURE__ */ jsx9(
|
|
2328
|
+
Thumbnail,
|
|
2329
|
+
{
|
|
2330
|
+
pixels: controller.getLayerThumbnail(layer.id, { maxSide: 64, filterMask: true }),
|
|
2331
|
+
size: Math.round(thumbnailSize * 0.75),
|
|
2332
|
+
label: `${row.label} filter mask${layer.smartFilters.mask.enabled === false ? " (disabled)" : ""}`,
|
|
2333
|
+
testId: "smart-filter-mask-thumbnail",
|
|
2334
|
+
selected: row.active && state.activeTarget === "filter-mask",
|
|
2335
|
+
onClick: (e) => {
|
|
2336
|
+
e.stopPropagation();
|
|
2337
|
+
if (e.shiftKey) attempt(() => controller.setSmartFilterMask(layer.id, "keep", { enabled: layer.smartFilters.mask.enabled === false }));
|
|
2338
|
+
else attempt(() => controller.setActiveLayer(layer.id, "filter-mask"));
|
|
2339
|
+
}
|
|
2028
2340
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
);
|
|
2341
|
+
),
|
|
2342
|
+
/* @__PURE__ */ jsx9("span", { children: "Smart Filters" })
|
|
2343
|
+
]
|
|
2344
|
+
}
|
|
2345
|
+
),
|
|
2346
|
+
filterRows.map((f) => /* @__PURE__ */ jsxs9(
|
|
2347
|
+
"li",
|
|
2348
|
+
{
|
|
2349
|
+
role: "treeitem",
|
|
2350
|
+
"aria-level": row.depth + 2,
|
|
2351
|
+
"aria-selected": false,
|
|
2352
|
+
className: `flex items-center gap-1.5 px-1.5 py-0.5 ${f.filter.enabled && layer.type === "smart" && layer.smartFilters?.enabled !== false ? "text-foreground" : "text-muted-foreground"}`,
|
|
2353
|
+
style: { paddingLeft: 40 + row.depth * 14 },
|
|
2354
|
+
"data-filter-id": f.filter.id,
|
|
2355
|
+
children: [
|
|
2356
|
+
/* @__PURE__ */ jsx9(
|
|
2357
|
+
"button",
|
|
2358
|
+
{
|
|
2359
|
+
type: "button",
|
|
2360
|
+
"aria-label": f.filter.enabled ? `Hide ${f.label}` : `Show ${f.label}`,
|
|
2361
|
+
"aria-pressed": f.filter.enabled,
|
|
2362
|
+
className: "w-4 text-center",
|
|
2363
|
+
onClick: () => attempt(() => controller.updateSmartFilter(layer.id, f.filter.id, { enabled: !f.filter.enabled })),
|
|
2364
|
+
children: f.filter.enabled ? "\u25CF" : "\u25CB"
|
|
2365
|
+
}
|
|
2366
|
+
),
|
|
2367
|
+
/* @__PURE__ */ jsx9("span", { className: "flex-1 min-w-0 truncate", children: f.label }),
|
|
2368
|
+
f.filter.blend !== "normal" && /* @__PURE__ */ jsx9("span", { className: "text-[9px] text-muted-foreground", children: f.filter.blend })
|
|
2369
|
+
]
|
|
2370
|
+
},
|
|
2371
|
+
f.filter.id
|
|
2372
|
+
))
|
|
2373
|
+
] }, layer.id);
|
|
2063
2374
|
}) }),
|
|
2064
|
-
error && /* @__PURE__ */
|
|
2065
|
-
menu && /* @__PURE__ */
|
|
2375
|
+
error && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2376
|
+
menu && /* @__PURE__ */ jsx9(
|
|
2066
2377
|
"div",
|
|
2067
2378
|
{
|
|
2068
2379
|
role: "menu",
|
|
@@ -2071,7 +2382,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2071
2382
|
style: { left: menu.x, top: menu.y },
|
|
2072
2383
|
onClick: (e) => e.stopPropagation(),
|
|
2073
2384
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
2074
|
-
children: layerMenu(controller).map((item) => /* @__PURE__ */
|
|
2385
|
+
children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx9(
|
|
2075
2386
|
"button",
|
|
2076
2387
|
{
|
|
2077
2388
|
type: "button",
|
|
@@ -2089,14 +2400,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2089
2400
|
};
|
|
2090
2401
|
|
|
2091
2402
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2092
|
-
import { useEffect as
|
|
2403
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState10 } from "react";
|
|
2093
2404
|
import { EFFECT_LAYER_USES, effectLayerTiming, findLayer } from "@pixerate/editor/image-editor";
|
|
2094
2405
|
|
|
2095
2406
|
// src/image-editor/controls/parameterControls.tsx
|
|
2096
2407
|
import { matchParameterOptionValue } from "@pixerate/editor/parameters";
|
|
2097
|
-
import { jsx as
|
|
2408
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2098
2409
|
function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
2099
|
-
return /* @__PURE__ */
|
|
2410
|
+
return /* @__PURE__ */ jsx10(
|
|
2100
2411
|
ImageRange,
|
|
2101
2412
|
{
|
|
2102
2413
|
value,
|
|
@@ -2113,7 +2424,7 @@ function ImageParameterSlider({ value, min, max, step, label, disabled, classNam
|
|
|
2113
2424
|
);
|
|
2114
2425
|
}
|
|
2115
2426
|
function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
|
|
2116
|
-
return /* @__PURE__ */
|
|
2427
|
+
return /* @__PURE__ */ jsx10(
|
|
2117
2428
|
ImageSelect,
|
|
2118
2429
|
{
|
|
2119
2430
|
value: String(value),
|
|
@@ -2126,7 +2437,7 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
|
|
|
2126
2437
|
);
|
|
2127
2438
|
}
|
|
2128
2439
|
function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
2129
|
-
return /* @__PURE__ */
|
|
2440
|
+
return /* @__PURE__ */ jsx10(
|
|
2130
2441
|
ImageColor,
|
|
2131
2442
|
{
|
|
2132
2443
|
value,
|
|
@@ -2149,34 +2460,34 @@ function imageEditorParameterComponents(controls) {
|
|
|
2149
2460
|
}
|
|
2150
2461
|
|
|
2151
2462
|
// src/image-editor/ImageEffectControls.tsx
|
|
2152
|
-
import { jsx as
|
|
2463
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2153
2464
|
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
|
|
2154
2465
|
const { description, error } = useEffectDescription(provider, effect);
|
|
2155
2466
|
const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
|
|
2156
2467
|
const effectiveComponents = resolveParameterComponents(components, fallback);
|
|
2157
2468
|
let body;
|
|
2158
|
-
if (!provider) body = /* @__PURE__ */
|
|
2469
|
+
if (!provider) body = /* @__PURE__ */ jsxs10("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2159
2470
|
'No effects provider: "',
|
|
2160
2471
|
name ?? effect,
|
|
2161
2472
|
'" is kept but not drawn.'
|
|
2162
2473
|
] });
|
|
2163
|
-
else if (error) body = /* @__PURE__ */
|
|
2164
|
-
else if (!description) body = /* @__PURE__ */
|
|
2165
|
-
else body = /* @__PURE__ */
|
|
2166
|
-
return /* @__PURE__ */
|
|
2474
|
+
else if (error) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-600", children: error });
|
|
2475
|
+
else if (!description) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
2476
|
+
else body = /* @__PURE__ */ jsx11(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
|
|
2477
|
+
return /* @__PURE__ */ jsx11("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
2167
2478
|
}
|
|
2168
2479
|
|
|
2169
2480
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2170
|
-
import { jsx as
|
|
2481
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2171
2482
|
var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
|
|
2172
2483
|
function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
2173
|
-
const [, setTick] =
|
|
2174
|
-
|
|
2175
|
-
const [browse, setBrowse] =
|
|
2176
|
-
const [clip, setClip] =
|
|
2177
|
-
const [message, setMessage] =
|
|
2178
|
-
const [open, setOpen] =
|
|
2179
|
-
const [scrubbed, setScrubbed] =
|
|
2484
|
+
const [, setTick] = useState10(0);
|
|
2485
|
+
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2486
|
+
const [browse, setBrowse] = useState10(null);
|
|
2487
|
+
const [clip, setClip] = useState10(false);
|
|
2488
|
+
const [message, setMessage] = useState10(null);
|
|
2489
|
+
const [open, setOpen] = useState10(null);
|
|
2490
|
+
const [scrubbed, setScrubbed] = useState10(null);
|
|
2180
2491
|
const provider = controller.effectsProvider;
|
|
2181
2492
|
const state = controller.getState();
|
|
2182
2493
|
const layer = state.activeLayerId ? findLayer(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
@@ -2184,7 +2495,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2184
2495
|
setMessage(null);
|
|
2185
2496
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
2186
2497
|
};
|
|
2187
|
-
const drags =
|
|
2498
|
+
const drags = useRef7(/* @__PURE__ */ new Set());
|
|
2188
2499
|
const commit = (gesture) => {
|
|
2189
2500
|
if (gesture) {
|
|
2190
2501
|
if (!drags.current.has(gesture)) {
|
|
@@ -2200,7 +2511,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2200
2511
|
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2201
2512
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
2202
2513
|
const timing = generator ? effectLayerTiming(generator, description) : null;
|
|
2203
|
-
const scrub =
|
|
2514
|
+
const scrub = useRef7({ next: null, busy: false, gesture: null });
|
|
2204
2515
|
const scrubTo = (layerId, time) => {
|
|
2205
2516
|
const s = scrub.current;
|
|
2206
2517
|
setScrubbed(time);
|
|
@@ -2219,18 +2530,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2219
2530
|
});
|
|
2220
2531
|
};
|
|
2221
2532
|
const shown = scrubbed ?? timing?.time ?? 0;
|
|
2222
|
-
return /* @__PURE__ */
|
|
2223
|
-
!provider && /* @__PURE__ */
|
|
2224
|
-
generator && layer && /* @__PURE__ */
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
/* @__PURE__ */
|
|
2533
|
+
return /* @__PURE__ */ jsxs11("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
|
|
2534
|
+
!provider && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
2535
|
+
generator && layer && /* @__PURE__ */ jsxs11("div", { className: "space-y-2", "data-effect-part": "generator", children: [
|
|
2536
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2537
|
+
/* @__PURE__ */ jsx12("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
|
|
2538
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
|
|
2539
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
2229
2540
|
] }),
|
|
2230
|
-
browse === "change" && /* @__PURE__ */
|
|
2231
|
-
timing && /* @__PURE__ */
|
|
2232
|
-
/* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */
|
|
2541
|
+
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 }))) }),
|
|
2542
|
+
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: [
|
|
2543
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
|
|
2544
|
+
/* @__PURE__ */ jsx12(
|
|
2234
2545
|
"button",
|
|
2235
2546
|
{
|
|
2236
2547
|
type: "button",
|
|
@@ -2241,7 +2552,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2241
2552
|
children: "Still frame"
|
|
2242
2553
|
}
|
|
2243
2554
|
),
|
|
2244
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ jsx12(
|
|
2245
2556
|
"button",
|
|
2246
2557
|
{
|
|
2247
2558
|
type: "button",
|
|
@@ -2253,9 +2564,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2253
2564
|
}
|
|
2254
2565
|
)
|
|
2255
2566
|
] }),
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
/* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2567
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2568
|
+
/* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
|
|
2569
|
+
/* @__PURE__ */ jsx12(
|
|
2259
2570
|
ImageRange,
|
|
2260
2571
|
{
|
|
2261
2572
|
min: 0,
|
|
@@ -2269,11 +2580,11 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2269
2580
|
onChange: (t) => scrubTo(layer.id, t)
|
|
2270
2581
|
}
|
|
2271
2582
|
),
|
|
2272
|
-
/* @__PURE__ */
|
|
2583
|
+
/* @__PURE__ */ jsx12("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
|
|
2273
2584
|
] }),
|
|
2274
|
-
timing.mode === "animate" && /* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
2585
|
+
timing.mode === "animate" && /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
|
|
2586
|
+
/* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
|
|
2587
|
+
/* @__PURE__ */ jsx12(
|
|
2277
2588
|
"input",
|
|
2278
2589
|
{
|
|
2279
2590
|
type: "number",
|
|
@@ -2290,13 +2601,13 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2290
2601
|
},
|
|
2291
2602
|
timing.duration
|
|
2292
2603
|
),
|
|
2293
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
|
|
2294
2605
|
"s",
|
|
2295
2606
|
timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
|
|
2296
2607
|
] })
|
|
2297
2608
|
] })
|
|
2298
2609
|
] }),
|
|
2299
|
-
/* @__PURE__ */
|
|
2610
|
+
/* @__PURE__ */ jsx12(
|
|
2300
2611
|
ImageEffectControls,
|
|
2301
2612
|
{
|
|
2302
2613
|
provider,
|
|
@@ -2309,19 +2620,19 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2309
2620
|
}
|
|
2310
2621
|
)
|
|
2311
2622
|
] }),
|
|
2312
|
-
layer && canFilter && /* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2623
|
+
layer && canFilter && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
|
|
2624
|
+
/* @__PURE__ */ jsx12("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
2625
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
2315
2626
|
] }),
|
|
2316
|
-
browse === "filter" && layer && /* @__PURE__ */
|
|
2317
|
-
filters.length > 0 && layer && /* @__PURE__ */
|
|
2627
|
+
browse === "filter" && layer && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true, preserveTransparency: true }))) }),
|
|
2628
|
+
filters.length > 0 && layer && /* @__PURE__ */ jsx12("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
2318
2629
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
2319
2630
|
const all = layer.smartFilters.filters;
|
|
2320
2631
|
const index = all.indexOf(f);
|
|
2321
2632
|
if (f.kind !== "effect") return null;
|
|
2322
|
-
return /* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
/* @__PURE__ */
|
|
2633
|
+
return /* @__PURE__ */ jsxs11("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
2634
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2635
|
+
/* @__PURE__ */ jsx12(
|
|
2325
2636
|
ImageCheckbox,
|
|
2326
2637
|
{
|
|
2327
2638
|
checked: f.enabled,
|
|
@@ -2329,13 +2640,13 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2329
2640
|
onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
|
|
2330
2641
|
}
|
|
2331
2642
|
),
|
|
2332
|
-
/* @__PURE__ */
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__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 }),
|
|
2644
|
+
/* @__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" }),
|
|
2645
|
+
/* @__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" }),
|
|
2646
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2336
2647
|
] }),
|
|
2337
|
-
/* @__PURE__ */
|
|
2338
|
-
/* @__PURE__ */
|
|
2648
|
+
/* @__PURE__ */ jsxs11("label", { className: "mt-0.5 flex items-center gap-1 pl-0.5 text-[11px] text-muted-foreground", title: "Draw the filter only over the layer's own pixels; clear it to let the effect fill transparent areas", children: [
|
|
2649
|
+
/* @__PURE__ */ jsx12(
|
|
2339
2650
|
ImageCheckbox,
|
|
2340
2651
|
{
|
|
2341
2652
|
checked: f.preserveTransparency === true,
|
|
@@ -2345,10 +2656,10 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2345
2656
|
),
|
|
2346
2657
|
"Keep transparency"
|
|
2347
2658
|
] }),
|
|
2348
|
-
open === f.id && /* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2659
|
+
open === f.id && /* @__PURE__ */ jsxs11("div", { className: "mt-1 space-y-2", children: [
|
|
2660
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
|
|
2661
|
+
/* @__PURE__ */ jsx12("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
2662
|
+
/* @__PURE__ */ jsx12(
|
|
2352
2663
|
ImageRange,
|
|
2353
2664
|
{
|
|
2354
2665
|
min: 0,
|
|
@@ -2361,7 +2672,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2361
2672
|
}
|
|
2362
2673
|
)
|
|
2363
2674
|
] }),
|
|
2364
|
-
/* @__PURE__ */
|
|
2675
|
+
/* @__PURE__ */ jsx12(
|
|
2365
2676
|
ImageEffectControls,
|
|
2366
2677
|
{
|
|
2367
2678
|
provider,
|
|
@@ -2376,25 +2687,25 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2376
2687
|
] })
|
|
2377
2688
|
] }, f.id);
|
|
2378
2689
|
}) }),
|
|
2379
|
-
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */
|
|
2380
|
-
provider && /* @__PURE__ */
|
|
2381
|
-
/* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2690
|
+
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." }),
|
|
2691
|
+
provider && /* @__PURE__ */ jsxs11("div", { className: "space-y-1", "data-effect-part": "add-layer", children: [
|
|
2692
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
2693
|
+
/* @__PURE__ */ jsx12("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effect layers" }),
|
|
2694
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Add effect layer\u2026" })
|
|
2384
2695
|
] }),
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2696
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", title: "Show the new effect layer only over the pixels of the layer below it (a clipping mask)", children: [
|
|
2697
|
+
/* @__PURE__ */ jsx12(ImageCheckbox, { checked: clip, label: "Clip to layer below", onChange: setClip }),
|
|
2387
2698
|
"Clip to layer below"
|
|
2388
2699
|
] }),
|
|
2389
|
-
browse === "layer" && /* @__PURE__ */
|
|
2700
|
+
browse === "layer" && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Add an effect layer", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id, { clipped: clip }))) })
|
|
2390
2701
|
] }),
|
|
2391
|
-
!layer && /* @__PURE__ */
|
|
2392
|
-
message && /* @__PURE__ */
|
|
2702
|
+
!layer && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2703
|
+
message && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2393
2704
|
] });
|
|
2394
2705
|
}
|
|
2395
2706
|
|
|
2396
2707
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2397
|
-
import { useEffect as
|
|
2708
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
2398
2709
|
import {
|
|
2399
2710
|
BRUSH_OPTION_CONTROLS,
|
|
2400
2711
|
MIXER_MIXING_OPTIONS,
|
|
@@ -2415,21 +2726,21 @@ import { DEFAULT_PAINT_GRADIENT, userErrorMessage } from "@pixerate/editor/image
|
|
|
2415
2726
|
|
|
2416
2727
|
// src/image-editor/PaintGradientEditor.tsx
|
|
2417
2728
|
import { PAINT_GRADIENT_KIT } from "@pixerate/editor/image-editor";
|
|
2418
|
-
import { jsx as
|
|
2419
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */
|
|
2729
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2730
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ jsx13(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
|
|
2420
2731
|
|
|
2421
2732
|
// src/image-editor/BrushOptionsBar.tsx
|
|
2422
2733
|
import { IMAGE_PROFILE } from "@pixerate/editor/brushes";
|
|
2423
|
-
import { jsx as
|
|
2734
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2424
2735
|
var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, className }) => {
|
|
2425
|
-
const [, setTick] =
|
|
2426
|
-
|
|
2427
|
-
const [error, setError] =
|
|
2736
|
+
const [, setTick] = useState11(0);
|
|
2737
|
+
useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2738
|
+
const [error, setError] = useState11(null);
|
|
2428
2739
|
const state = controller.getState();
|
|
2429
2740
|
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
|
|
2430
2741
|
const tool = state.activeTool;
|
|
2431
|
-
const [presetsOpen, setPresetsOpen] =
|
|
2432
|
-
const [editing, setEditing] =
|
|
2742
|
+
const [presetsOpen, setPresetsOpen] = useState11(false);
|
|
2743
|
+
const [editing, setEditing] = useState11(false);
|
|
2433
2744
|
const presets = useBrushLibrary(presetsOpen ? controller.brushLibrary : null, { profile: IMAGE_PROFILE });
|
|
2434
2745
|
const presetName = presets.find((e) => e.brush.id === state.paint.brushPreset)?.brush.name ?? state.paint.brushPreset;
|
|
2435
2746
|
const attempt = (fn) => {
|
|
@@ -2440,8 +2751,8 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2440
2751
|
setError(userErrorMessage(err));
|
|
2441
2752
|
}
|
|
2442
2753
|
};
|
|
2443
|
-
return /* @__PURE__ */
|
|
2444
|
-
showTools && /* @__PURE__ */
|
|
2754
|
+
return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
2755
|
+
showTools && /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx14(
|
|
2445
2756
|
"button",
|
|
2446
2757
|
{
|
|
2447
2758
|
type: "button",
|
|
@@ -2453,15 +2764,15 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2453
2764
|
},
|
|
2454
2765
|
t.id
|
|
2455
2766
|
)) }),
|
|
2456
|
-
(tool === "brush" || tool === "mixer" || tool === "eraser") && /* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2767
|
+
(tool === "brush" || tool === "mixer" || tool === "eraser") && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", "data-testid": "brush-presets", children: [
|
|
2768
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
|
|
2769
|
+
/* @__PURE__ */ jsxs12("button", { type: "button", "aria-expanded": presetsOpen, className: imageChipClass(presetsOpen), onClick: () => setPresetsOpen((o) => !o), title: "Paint with a brush from the brush library", children: [
|
|
2459
2770
|
"Brush presets",
|
|
2460
2771
|
presetName ? `: ${presetName}` : ""
|
|
2461
2772
|
] }),
|
|
2462
|
-
/* @__PURE__ */
|
|
2773
|
+
/* @__PURE__ */ jsx14("button", { type: "button", "aria-expanded": editing, className: imageChipClass(editing), onClick: () => setEditing((o) => !o), title: "Edit this brush, or make a new one, in the shared brush library", children: "Edit brush\u2026" })
|
|
2463
2774
|
] }),
|
|
2464
|
-
editing && /* @__PURE__ */
|
|
2775
|
+
editing && /* @__PURE__ */ jsx14(
|
|
2465
2776
|
BrushLibraryEditor,
|
|
2466
2777
|
{
|
|
2467
2778
|
library: controller.brushLibrary,
|
|
@@ -2476,7 +2787,7 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2476
2787
|
onClose: () => setEditing(false)
|
|
2477
2788
|
}
|
|
2478
2789
|
),
|
|
2479
|
-
presetsOpen && /* @__PURE__ */
|
|
2790
|
+
presetsOpen && /* @__PURE__ */ jsx14(
|
|
2480
2791
|
BrushLibraryBrowser,
|
|
2481
2792
|
{
|
|
2482
2793
|
entries: presets,
|
|
@@ -2489,18 +2800,18 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2489
2800
|
}
|
|
2490
2801
|
)
|
|
2491
2802
|
] }),
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
2804
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2805
|
+
/* @__PURE__ */ jsx14(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
|
|
2806
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "FG" })
|
|
2496
2807
|
] }),
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2809
|
+
/* @__PURE__ */ jsx14(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
|
|
2810
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "BG" })
|
|
2500
2811
|
] }),
|
|
2501
|
-
/* @__PURE__ */
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
state.activeTool === "brush" && /* @__PURE__ */
|
|
2812
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
2813
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
2814
|
+
state.activeTool === "brush" && /* @__PURE__ */ jsx14(
|
|
2504
2815
|
"button",
|
|
2505
2816
|
{
|
|
2506
2817
|
type: "button",
|
|
@@ -2512,8 +2823,8 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2512
2823
|
}
|
|
2513
2824
|
)
|
|
2514
2825
|
] }),
|
|
2515
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */
|
|
2516
|
-
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2826
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx14(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
2827
|
+
BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(
|
|
2517
2828
|
ControlSlider,
|
|
2518
2829
|
{
|
|
2519
2830
|
spec,
|
|
@@ -2522,9 +2833,9 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2522
2833
|
},
|
|
2523
2834
|
spec.id
|
|
2524
2835
|
)),
|
|
2525
|
-
state.activeTool === "mixer" && /* @__PURE__ */
|
|
2526
|
-
/* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2836
|
+
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: [
|
|
2837
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2838
|
+
/* @__PURE__ */ jsx14(
|
|
2528
2839
|
"span",
|
|
2529
2840
|
{
|
|
2530
2841
|
"aria-label": "Brush load",
|
|
@@ -2533,10 +2844,10 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2533
2844
|
style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
|
|
2534
2845
|
}
|
|
2535
2846
|
),
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2847
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
2848
|
+
/* @__PURE__ */ jsx14("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
2538
2849
|
] }),
|
|
2539
|
-
/* @__PURE__ */
|
|
2850
|
+
/* @__PURE__ */ jsx14("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx14(
|
|
2540
2851
|
"button",
|
|
2541
2852
|
{
|
|
2542
2853
|
type: "button",
|
|
@@ -2548,34 +2859,34 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2548
2859
|
},
|
|
2549
2860
|
m.id
|
|
2550
2861
|
)) }),
|
|
2551
|
-
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2552
|
-
/* @__PURE__ */
|
|
2553
|
-
/* @__PURE__ */
|
|
2554
|
-
/* @__PURE__ */
|
|
2862
|
+
MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
2863
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
2864
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2865
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
2555
2866
|
"Load each stroke"
|
|
2556
2867
|
] }),
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2869
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
2559
2870
|
"Clean each stroke"
|
|
2560
2871
|
] })
|
|
2561
2872
|
] })
|
|
2562
2873
|
] }),
|
|
2563
|
-
isRetouchPaintTool(tool) && /* @__PURE__ */
|
|
2564
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
cloneSource && /* @__PURE__ */
|
|
2874
|
+
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: [
|
|
2875
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2876
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
|
|
2877
|
+
cloneSource && /* @__PURE__ */ jsx14("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
2567
2878
|
] }),
|
|
2568
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */
|
|
2569
|
-
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2572
|
-
/* @__PURE__ */
|
|
2573
|
-
!cloneTransformView(controller).identity && /* @__PURE__ */
|
|
2879
|
+
(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: [
|
|
2880
|
+
CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
|
|
2881
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2882
|
+
/* @__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" }),
|
|
2883
|
+
/* @__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" }),
|
|
2884
|
+
!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" })
|
|
2574
2885
|
] })
|
|
2575
2886
|
] }),
|
|
2576
|
-
RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */
|
|
2577
|
-
/* @__PURE__ */
|
|
2578
|
-
choice.options.map((o) => /* @__PURE__ */
|
|
2887
|
+
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: [
|
|
2888
|
+
/* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: choice.label }),
|
|
2889
|
+
choice.options.map((o) => /* @__PURE__ */ jsx14(
|
|
2579
2890
|
"button",
|
|
2580
2891
|
{
|
|
2581
2892
|
type: "button",
|
|
@@ -2588,43 +2899,43 @@ var BrushOptionsBar = ({ controller, showTools = true, renderBrushPreview, class
|
|
|
2588
2899
|
o.id
|
|
2589
2900
|
))
|
|
2590
2901
|
] }, choice.id)),
|
|
2591
|
-
RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */
|
|
2592
|
-
/* @__PURE__ */
|
|
2593
|
-
/* @__PURE__ */
|
|
2902
|
+
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)),
|
|
2903
|
+
/* @__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: [
|
|
2904
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
2594
2905
|
t.label
|
|
2595
2906
|
] }, t.id)) })
|
|
2596
2907
|
] }),
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
2599
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
2909
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2910
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
2600
2911
|
"Pressure size"
|
|
2601
2912
|
] }),
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
|
|
2914
|
+
/* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
2604
2915
|
"Pressure opacity"
|
|
2605
2916
|
] })
|
|
2606
2917
|
] }),
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex gap-1", children: [
|
|
2919
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
2920
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
2610
2921
|
] }),
|
|
2611
|
-
error && /* @__PURE__ */
|
|
2922
|
+
error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error })
|
|
2612
2923
|
] });
|
|
2613
2924
|
};
|
|
2614
2925
|
|
|
2615
2926
|
// src/image-editor/ColorProfilePanel.tsx
|
|
2616
|
-
import { useEffect as
|
|
2927
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
2617
2928
|
import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
|
|
2618
|
-
import { Fragment as
|
|
2929
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2619
2930
|
var chip = imageChipClass(false);
|
|
2620
2931
|
var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
2621
2932
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
2622
|
-
const [, setTick] =
|
|
2623
|
-
|
|
2624
|
-
const [target, setTarget] =
|
|
2625
|
-
const [intent, setIntent] =
|
|
2626
|
-
const [bpc, setBpc] =
|
|
2627
|
-
const [error, setError] =
|
|
2933
|
+
const [, setTick] = useState12(0);
|
|
2934
|
+
useEffect9(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2935
|
+
const [target, setTarget] = useState12("display-p3");
|
|
2936
|
+
const [intent, setIntent] = useState12("relative");
|
|
2937
|
+
const [bpc, setBpc] = useState12(true);
|
|
2938
|
+
const [error, setError] = useState12(null);
|
|
2628
2939
|
const view = colorPanelView(controller);
|
|
2629
2940
|
const attempt = (fn) => {
|
|
2630
2941
|
try {
|
|
@@ -2646,29 +2957,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2646
2957
|
})
|
|
2647
2958
|
);
|
|
2648
2959
|
};
|
|
2649
|
-
return /* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2960
|
+
return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
2961
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
2962
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
2963
|
+
/* @__PURE__ */ jsx15("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
2653
2964
|
] }),
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2657
|
-
view.cmykProfileName && /* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
2966
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
2967
|
+
/* @__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)) }),
|
|
2968
|
+
view.cmykProfileName && /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
2658
2969
|
] }),
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
2971
|
+
/* @__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)) }),
|
|
2972
|
+
/* @__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)) }),
|
|
2973
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
2974
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
2664
2975
|
"BPC"
|
|
2665
2976
|
] }),
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
2978
|
+
/* @__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" })
|
|
2668
2979
|
] }),
|
|
2669
|
-
/* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2980
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
2981
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
2982
|
+
/* @__PURE__ */ jsxs13(
|
|
2672
2983
|
"select",
|
|
2673
2984
|
{
|
|
2674
2985
|
"aria-label": "Proof profile",
|
|
@@ -2676,67 +2987,67 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2676
2987
|
value: view.proof?.id ?? "",
|
|
2677
2988
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
2678
2989
|
children: [
|
|
2679
|
-
/* @__PURE__ */
|
|
2680
|
-
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */
|
|
2990
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: "Off" }),
|
|
2991
|
+
PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id))
|
|
2681
2992
|
]
|
|
2682
2993
|
}
|
|
2683
2994
|
),
|
|
2684
|
-
view.proof && /* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
2995
|
+
view.proof && /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2996
|
+
/* @__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)) }),
|
|
2997
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
2998
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
2688
2999
|
"Paper"
|
|
2689
3000
|
] }),
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
3002
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
2692
3003
|
"Gamut warning"
|
|
2693
3004
|
] })
|
|
2694
3005
|
] })
|
|
2695
3006
|
] }),
|
|
2696
|
-
error && /* @__PURE__ */
|
|
3007
|
+
error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error })
|
|
2697
3008
|
] });
|
|
2698
3009
|
};
|
|
2699
3010
|
|
|
2700
3011
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
2701
|
-
import { useRef as
|
|
3012
|
+
import { useRef as useRef10, useState as useState16 } from "react";
|
|
2702
3013
|
|
|
2703
3014
|
// src/image-editor/SelectionRecipePanel.tsx
|
|
2704
|
-
import { useState as
|
|
3015
|
+
import { useState as useState13 } from "react";
|
|
2705
3016
|
import { describeRecipeStep, recipeStepSetting } from "@pixerate/editor/image-editor";
|
|
2706
|
-
import { jsx as
|
|
3017
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2707
3018
|
var MODES2 = ["replace", "add", "subtract", "intersect"];
|
|
2708
|
-
var
|
|
3019
|
+
var button2 = "px-1.5 py-0.5 rounded border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
2709
3020
|
var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
2710
|
-
const [error, setError] =
|
|
3021
|
+
const [error, setError] = useState13(null);
|
|
2711
3022
|
const recipe = controller.getSelectionRecipe();
|
|
2712
3023
|
if (!recipe.live) return null;
|
|
2713
3024
|
const run = (p) => {
|
|
2714
3025
|
setError(null);
|
|
2715
3026
|
Promise.resolve(p).catch((err) => setError(err instanceof Error ? err.message : String(err)));
|
|
2716
3027
|
};
|
|
2717
|
-
return /* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ jsxs14("div", { "data-testid": "selection-recipe", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
3029
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
|
|
3030
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Selection steps" }),
|
|
3031
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button2, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
|
|
2721
3032
|
] }),
|
|
2722
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__PURE__ */ jsx16("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
|
|
2723
3034
|
const setting = recipeStepSetting(step);
|
|
2724
3035
|
const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
|
|
2725
|
-
return /* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
2727
|
-
shape && step.index > 0 && /* @__PURE__ */
|
|
3036
|
+
return /* @__PURE__ */ jsxs14("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
|
|
3037
|
+
/* @__PURE__ */ jsx16("span", { className: "flex-1 min-w-0 truncate text-foreground", children: describeRecipeStep(step) }),
|
|
3038
|
+
shape && step.index > 0 && /* @__PURE__ */ jsx16(
|
|
2728
3039
|
"select",
|
|
2729
3040
|
{
|
|
2730
3041
|
"aria-label": `Step ${step.index + 1} mode`,
|
|
2731
3042
|
value: step.mode ?? "replace",
|
|
2732
3043
|
onChange: (e) => run(controller.editSelectionStep(step.index, { mode: e.target.value })),
|
|
2733
3044
|
className: "bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
2734
|
-
children: MODES2.map((m) => /* @__PURE__ */
|
|
3045
|
+
children: MODES2.map((m) => /* @__PURE__ */ jsx16("option", { value: m, children: m }, m))
|
|
2735
3046
|
}
|
|
2736
3047
|
),
|
|
2737
|
-
setting && /* @__PURE__ */
|
|
3048
|
+
setting && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2738
3049
|
setting.label,
|
|
2739
|
-
/* @__PURE__ */
|
|
3050
|
+
/* @__PURE__ */ jsx16(
|
|
2740
3051
|
"input",
|
|
2741
3052
|
{
|
|
2742
3053
|
type: "number",
|
|
@@ -2750,10 +3061,10 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
2750
3061
|
}
|
|
2751
3062
|
)
|
|
2752
3063
|
] }),
|
|
2753
|
-
/* @__PURE__ */
|
|
3064
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button2, "aria-label": `Remove step ${step.index + 1}`, disabled: recipe.steps.length === 1, onClick: () => run(controller.removeSelectionStep(step.index)), children: "\xD7" })
|
|
2754
3065
|
] }, `${step.index}:${JSON.stringify(step)}`);
|
|
2755
3066
|
}) }),
|
|
2756
|
-
error && /* @__PURE__ */
|
|
3067
|
+
error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error })
|
|
2757
3068
|
] });
|
|
2758
3069
|
};
|
|
2759
3070
|
|
|
@@ -2768,30 +3079,30 @@ import {
|
|
|
2768
3079
|
} from "@pixerate/editor/image-editor";
|
|
2769
3080
|
|
|
2770
3081
|
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
2771
|
-
import { useEffect as
|
|
3082
|
+
import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState14 } from "react";
|
|
2772
3083
|
import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
|
|
2773
|
-
import { jsx as
|
|
2774
|
-
var
|
|
2775
|
-
var toggle = (on) => `${
|
|
3084
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3085
|
+
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";
|
|
3086
|
+
var toggle = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
2776
3087
|
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
2777
3088
|
const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
|
|
2778
|
-
const [, setRevision] =
|
|
2779
|
-
const [zoom, setZoom] =
|
|
2780
|
-
const [pan, setPan] =
|
|
2781
|
-
const [busy, setBusy] =
|
|
2782
|
-
const [error, setError] =
|
|
2783
|
-
const canvasRef =
|
|
2784
|
-
const panFrom =
|
|
3089
|
+
const [, setRevision] = useState14(0);
|
|
3090
|
+
const [zoom, setZoom] = useState14(1);
|
|
3091
|
+
const [pan, setPan] = useState14({ x: 0, y: 0 });
|
|
3092
|
+
const [busy, setBusy] = useState14(false);
|
|
3093
|
+
const [error, setError] = useState14(null);
|
|
3094
|
+
const canvasRef = useRef8(null);
|
|
3095
|
+
const panFrom = useRef8(null);
|
|
2785
3096
|
const settings = session.settings;
|
|
2786
3097
|
const size = session.previewSize;
|
|
2787
|
-
|
|
3098
|
+
useEffect10(() => {
|
|
2788
3099
|
const off = session.subscribe(() => setRevision(session.revision));
|
|
2789
3100
|
void session.open();
|
|
2790
3101
|
return () => {
|
|
2791
3102
|
off();
|
|
2792
3103
|
};
|
|
2793
3104
|
}, [session]);
|
|
2794
|
-
|
|
3105
|
+
useEffect10(() => {
|
|
2795
3106
|
const canvas = canvasRef.current;
|
|
2796
3107
|
const ctx = canvas?.getContext?.("2d");
|
|
2797
3108
|
if (!canvas || !ctx || !size.width || typeof ImageData === "undefined") return;
|
|
@@ -2810,7 +3121,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2810
3121
|
setBusy(false);
|
|
2811
3122
|
}
|
|
2812
3123
|
};
|
|
2813
|
-
|
|
3124
|
+
useEffect10(() => {
|
|
2814
3125
|
const onKey = (e) => {
|
|
2815
3126
|
const t = e.target;
|
|
2816
3127
|
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
@@ -2855,7 +3166,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2855
3166
|
};
|
|
2856
3167
|
const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
|
|
2857
3168
|
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
2858
|
-
return /* @__PURE__ */
|
|
3169
|
+
return /* @__PURE__ */ jsxs15(
|
|
2859
3170
|
"div",
|
|
2860
3171
|
{
|
|
2861
3172
|
"data-testid": "select-and-mask-workspace",
|
|
@@ -2863,12 +3174,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2863
3174
|
"aria-label": "Select and Mask",
|
|
2864
3175
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
2865
3176
|
children: [
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
/* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
brushTool && /* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ jsx17("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__ */ jsx17("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)) }),
|
|
3178
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
3179
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
3180
|
+
brushTool && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2870
3181
|
"Size",
|
|
2871
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsx17(
|
|
2872
3183
|
"input",
|
|
2873
3184
|
{
|
|
2874
3185
|
type: "number",
|
|
@@ -2881,22 +3192,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2881
3192
|
),
|
|
2882
3193
|
"px"
|
|
2883
3194
|
] }),
|
|
2884
|
-
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
/* @__PURE__ */
|
|
3195
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
3196
|
+
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
3197
|
+
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
2887
3198
|
] }),
|
|
2888
|
-
/* @__PURE__ */
|
|
3199
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-muted-foreground", children: [
|
|
2889
3200
|
session.edits.length,
|
|
2890
3201
|
" strokes"
|
|
2891
3202
|
] }),
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button3, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
3204
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono text-muted-foreground", children: [
|
|
2894
3205
|
Math.round(zoom * 100),
|
|
2895
3206
|
"%"
|
|
2896
3207
|
] }),
|
|
2897
|
-
session.computing && /* @__PURE__ */
|
|
3208
|
+
session.computing && /* @__PURE__ */ jsx17("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
2898
3209
|
] }),
|
|
2899
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17(
|
|
2900
3211
|
"canvas",
|
|
2901
3212
|
{
|
|
2902
3213
|
ref: canvasRef,
|
|
@@ -2915,11 +3226,11 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2915
3226
|
}
|
|
2916
3227
|
) })
|
|
2917
3228
|
] }),
|
|
2918
|
-
/* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
3229
|
+
/* @__PURE__ */ jsxs15("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
3230
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
3231
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
2921
3232
|
"View",
|
|
2922
|
-
/* @__PURE__ */
|
|
3233
|
+
/* @__PURE__ */ jsx17(
|
|
2923
3234
|
ImageSelect,
|
|
2924
3235
|
{
|
|
2925
3236
|
label: "View",
|
|
@@ -2929,36 +3240,36 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2929
3240
|
}
|
|
2930
3241
|
)
|
|
2931
3242
|
] }),
|
|
2932
|
-
/* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
3243
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3244
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3245
|
+
/* @__PURE__ */ jsx17("span", { children: "Opacity" }),
|
|
3246
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
2936
3247
|
Math.round(settings.opacity * 100),
|
|
2937
3248
|
"%"
|
|
2938
3249
|
] })
|
|
2939
3250
|
] }),
|
|
2940
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
2941
3252
|
] }),
|
|
2942
|
-
/* @__PURE__ */
|
|
2943
|
-
/* @__PURE__ */
|
|
3253
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3254
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
2944
3255
|
"Show Edge (J)"
|
|
2945
3256
|
] }),
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3258
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
2948
3259
|
"Show Original (P)"
|
|
2949
3260
|
] }),
|
|
2950
|
-
/* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
3261
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3262
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
2952
3263
|
"Real-Time Refinement"
|
|
2953
3264
|
] }),
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
3265
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3266
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
2956
3267
|
"High Quality Preview"
|
|
2957
3268
|
] }),
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3269
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
3270
|
+
controller.segmentationProvider && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
2960
3271
|
"Mode",
|
|
2961
|
-
/* @__PURE__ */
|
|
3272
|
+
/* @__PURE__ */ jsx17(
|
|
2962
3273
|
ImageSelect,
|
|
2963
3274
|
{
|
|
2964
3275
|
label: "Refine mode",
|
|
@@ -2971,37 +3282,37 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2971
3282
|
}
|
|
2972
3283
|
)
|
|
2973
3284
|
] }),
|
|
2974
|
-
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
3285
|
+
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3286
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3287
|
+
/* @__PURE__ */ jsx17("span", { children: c.label }),
|
|
3288
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
2978
3289
|
settings.params[c.id],
|
|
2979
3290
|
c.unit
|
|
2980
3291
|
] })
|
|
2981
3292
|
] }),
|
|
2982
|
-
/* @__PURE__ */
|
|
3293
|
+
/* @__PURE__ */ jsx17(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 } }) })
|
|
2983
3294
|
] }, c.id)),
|
|
2984
|
-
/* @__PURE__ */
|
|
2985
|
-
/* @__PURE__ */
|
|
3295
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3296
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
2986
3297
|
"Smart Radius"
|
|
2987
3298
|
] }),
|
|
2988
|
-
/* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */
|
|
2990
|
-
/* @__PURE__ */
|
|
2991
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3300
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3301
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3302
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
2992
3303
|
"Decontaminate Colors",
|
|
2993
3304
|
toLayer ? "" : " (new layer or document outputs)"
|
|
2994
3305
|
] }),
|
|
2995
|
-
/* @__PURE__ */
|
|
3306
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
2996
3307
|
settings.decontaminate,
|
|
2997
3308
|
"%"
|
|
2998
3309
|
] })
|
|
2999
3310
|
] }),
|
|
3000
|
-
/* @__PURE__ */
|
|
3311
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
3001
3312
|
] }),
|
|
3002
|
-
/* @__PURE__ */
|
|
3313
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3003
3314
|
"Output To",
|
|
3004
|
-
/* @__PURE__ */
|
|
3315
|
+
/* @__PURE__ */ jsx17(
|
|
3005
3316
|
ImageSelect,
|
|
3006
3317
|
{
|
|
3007
3318
|
label: "Output to",
|
|
@@ -3011,16 +3322,16 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3011
3322
|
}
|
|
3012
3323
|
)
|
|
3013
3324
|
] }),
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
|
|
3326
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
3016
3327
|
"Remember Settings"
|
|
3017
3328
|
] }),
|
|
3018
|
-
(error ?? session.error) && /* @__PURE__ */
|
|
3019
|
-
session.note && /* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
3021
|
-
/* @__PURE__ */
|
|
3022
|
-
/* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3329
|
+
(error ?? session.error) && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3330
|
+
session.note && /* @__PURE__ */ jsx17("p", { className: "text-muted-foreground", children: session.note }),
|
|
3331
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1 mt-auto", children: [
|
|
3332
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
|
|
3333
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
|
|
3334
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
3024
3335
|
] })
|
|
3025
3336
|
] })
|
|
3026
3337
|
]
|
|
@@ -3029,31 +3340,31 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3029
3340
|
};
|
|
3030
3341
|
|
|
3031
3342
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
3032
|
-
import { useEffect as
|
|
3343
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState15 } from "react";
|
|
3033
3344
|
import { CONTENT_AWARE_FILL_SAMPLING, CONTENT_AWARE_FILL_TOOLS, ContentAwareFillSession } from "@pixerate/editor/image-editor";
|
|
3034
|
-
import { Fragment as
|
|
3035
|
-
var
|
|
3036
|
-
var toggle2 = (on) => `${
|
|
3345
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3346
|
+
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";
|
|
3347
|
+
var toggle2 = (on) => `${button4} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
3037
3348
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
3038
3349
|
const session = useMemo5(() => new ContentAwareFillSession(controller), [controller]);
|
|
3039
|
-
const [, setRevision] =
|
|
3040
|
-
const [zoom, setZoom] =
|
|
3041
|
-
const [pan, setPan] =
|
|
3042
|
-
const [busy, setBusy] =
|
|
3043
|
-
const [error, setError] =
|
|
3044
|
-
const sourceRef =
|
|
3045
|
-
const previewRef =
|
|
3046
|
-
const panFrom =
|
|
3350
|
+
const [, setRevision] = useState15(0);
|
|
3351
|
+
const [zoom, setZoom] = useState15(1);
|
|
3352
|
+
const [pan, setPan] = useState15({ x: 0, y: 0 });
|
|
3353
|
+
const [busy, setBusy] = useState15(false);
|
|
3354
|
+
const [error, setError] = useState15(null);
|
|
3355
|
+
const sourceRef = useRef9(null);
|
|
3356
|
+
const previewRef = useRef9(null);
|
|
3357
|
+
const panFrom = useRef9(null);
|
|
3047
3358
|
const settings = session.settings;
|
|
3048
3359
|
const win = session.window;
|
|
3049
|
-
|
|
3360
|
+
useEffect11(() => {
|
|
3050
3361
|
const off = session.subscribe(() => setRevision(session.revision));
|
|
3051
3362
|
void session.open();
|
|
3052
3363
|
return () => {
|
|
3053
3364
|
off();
|
|
3054
3365
|
};
|
|
3055
3366
|
}, [session]);
|
|
3056
|
-
|
|
3367
|
+
useEffect11(() => {
|
|
3057
3368
|
if (!win || typeof ImageData === "undefined") return;
|
|
3058
3369
|
for (const [canvas, rgba] of [
|
|
3059
3370
|
[sourceRef.current, session.renderSource()],
|
|
@@ -3077,7 +3388,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3077
3388
|
setBusy(false);
|
|
3078
3389
|
}
|
|
3079
3390
|
};
|
|
3080
|
-
|
|
3391
|
+
useEffect11(() => {
|
|
3081
3392
|
const onKey = (e) => {
|
|
3082
3393
|
const t = e.target;
|
|
3083
3394
|
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
@@ -3119,14 +3430,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3119
3430
|
session.end();
|
|
3120
3431
|
};
|
|
3121
3432
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
3122
|
-
return /* @__PURE__ */
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
3126
|
-
settings.tool === "sampling-brush" && /* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ jsxs16("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: [
|
|
3434
|
+
/* @__PURE__ */ jsx18("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__ */ jsx18("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)) }),
|
|
3435
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
3436
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
3437
|
+
settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
3438
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3128
3439
|
"Size",
|
|
3129
|
-
/* @__PURE__ */
|
|
3440
|
+
/* @__PURE__ */ jsx18(
|
|
3130
3441
|
"input",
|
|
3131
3442
|
{
|
|
3132
3443
|
type: "number",
|
|
@@ -3139,22 +3450,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3139
3450
|
),
|
|
3140
3451
|
"px"
|
|
3141
3452
|
] }),
|
|
3142
|
-
/* @__PURE__ */
|
|
3143
|
-
/* @__PURE__ */
|
|
3144
|
-
/* @__PURE__ */
|
|
3453
|
+
/* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
|
|
3454
|
+
/* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
3455
|
+
/* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
3145
3456
|
] })
|
|
3146
3457
|
] }),
|
|
3147
|
-
/* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono text-muted-foreground", children: [
|
|
3148
3459
|
Math.round(zoom * 100),
|
|
3149
3460
|
"%"
|
|
3150
3461
|
] }),
|
|
3151
|
-
!session.showsWholeImage && /* @__PURE__ */
|
|
3152
|
-
session.computing && /* @__PURE__ */
|
|
3462
|
+
!session.showsWholeImage && /* @__PURE__ */ jsx18("button", { type: "button", className: button4, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
|
|
3463
|
+
session.computing && /* @__PURE__ */ jsx18("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
3153
3464
|
] }),
|
|
3154
|
-
/* @__PURE__ */
|
|
3155
|
-
/* @__PURE__ */
|
|
3156
|
-
/* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3465
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
3466
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col min-h-0", children: [
|
|
3467
|
+
/* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
|
|
3468
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx18(
|
|
3158
3469
|
"canvas",
|
|
3159
3470
|
{
|
|
3160
3471
|
ref: sourceRef,
|
|
@@ -3166,33 +3477,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3166
3477
|
}
|
|
3167
3478
|
) })
|
|
3168
3479
|
] }),
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3480
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col min-h-0", children: [
|
|
3481
|
+
/* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Preview" }),
|
|
3482
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx18("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
|
|
3172
3483
|
] })
|
|
3173
3484
|
] })
|
|
3174
3485
|
] }),
|
|
3175
|
-
/* @__PURE__ */
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3486
|
+
/* @__PURE__ */ jsxs16("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
3487
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
3488
|
+
/* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx18("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)) }),
|
|
3489
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3490
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
3180
3491
|
"Show Sampling Area"
|
|
3181
3492
|
] }),
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3184
|
-
/* @__PURE__ */
|
|
3185
|
-
/* @__PURE__ */
|
|
3493
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3494
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3495
|
+
/* @__PURE__ */ jsx18("span", { children: "Opacity" }),
|
|
3496
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3186
3497
|
Math.round(settings.opacity * 100),
|
|
3187
3498
|
"%"
|
|
3188
3499
|
] })
|
|
3189
3500
|
] }),
|
|
3190
|
-
/* @__PURE__ */
|
|
3501
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
3191
3502
|
] }),
|
|
3192
|
-
/* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
|
|
3504
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3194
3505
|
"Seed",
|
|
3195
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ jsx18(
|
|
3196
3507
|
"input",
|
|
3197
3508
|
{
|
|
3198
3509
|
type: "number",
|
|
@@ -3203,17 +3514,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3203
3514
|
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
3204
3515
|
}
|
|
3205
3516
|
),
|
|
3206
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button4, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
|
|
3207
3518
|
] }),
|
|
3208
|
-
/* @__PURE__ */
|
|
3209
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3520
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
|
|
3210
3521
|
"Live Preview"
|
|
3211
3522
|
] }),
|
|
3212
|
-
!settings.livePreview && /* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3214
|
-
/* @__PURE__ */
|
|
3523
|
+
!settings.livePreview && /* @__PURE__ */ jsx18("button", { type: "button", className: button4, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
|
|
3524
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3525
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3215
3526
|
"Output To",
|
|
3216
|
-
/* @__PURE__ */
|
|
3527
|
+
/* @__PURE__ */ jsx18(
|
|
3217
3528
|
ImageSelect,
|
|
3218
3529
|
{
|
|
3219
3530
|
label: "Fill output",
|
|
@@ -3227,18 +3538,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3227
3538
|
}
|
|
3228
3539
|
)
|
|
3229
3540
|
] }),
|
|
3230
|
-
(error ?? session.error) && /* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3541
|
+
(error ?? session.error) && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3542
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1 mt-auto", children: [
|
|
3543
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button4, onClick: () => session.reset(), children: "Reset" }),
|
|
3544
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button4, onClick: () => onClose(null), children: "Cancel" }),
|
|
3545
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
3235
3546
|
] })
|
|
3236
3547
|
] })
|
|
3237
3548
|
] });
|
|
3238
3549
|
};
|
|
3239
3550
|
|
|
3240
3551
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
3241
|
-
import { jsx as
|
|
3552
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3242
3553
|
var MODIFY_OPS = [
|
|
3243
3554
|
{ op: "expand", label: "Expand" },
|
|
3244
3555
|
{ op: "contract", label: "Contract" },
|
|
@@ -3263,15 +3574,15 @@ var SelectionOptionsBar = ({
|
|
|
3263
3574
|
showTools = true,
|
|
3264
3575
|
className = ""
|
|
3265
3576
|
}) => {
|
|
3266
|
-
const [radius, setRadius] =
|
|
3577
|
+
const [radius, setRadius] = useState16(2);
|
|
3267
3578
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
3268
3579
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3269
3580
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
3270
|
-
const [preset, setPreset] =
|
|
3271
|
-
const [rangeStatus, setRangeStatus] =
|
|
3272
|
-
const [colorStatus, setColorStatus] =
|
|
3273
|
-
const [strokeWidth, setStrokeWidth] =
|
|
3274
|
-
const [strokeLocation, setStrokeLocation] =
|
|
3581
|
+
const [preset, setPreset] = useState16("reds");
|
|
3582
|
+
const [rangeStatus, setRangeStatus] = useState16(null);
|
|
3583
|
+
const [colorStatus, setColorStatus] = useState16(null);
|
|
3584
|
+
const [strokeWidth, setStrokeWidth] = useState16(4);
|
|
3585
|
+
const [strokeLocation, setStrokeLocation] = useState16("outside");
|
|
3275
3586
|
const edit = (fn) => {
|
|
3276
3587
|
setColorStatus(null);
|
|
3277
3588
|
try {
|
|
@@ -3304,8 +3615,8 @@ var SelectionOptionsBar = ({
|
|
|
3304
3615
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
3305
3616
|
}
|
|
3306
3617
|
};
|
|
3307
|
-
const [task, setTask] =
|
|
3308
|
-
const taskAbort =
|
|
3618
|
+
const [task, setTask] = useState16(null);
|
|
3619
|
+
const taskAbort = useRef10(null);
|
|
3309
3620
|
const tracked = () => {
|
|
3310
3621
|
const abort = new AbortController();
|
|
3311
3622
|
taskAbort.current = abort;
|
|
@@ -3317,9 +3628,9 @@ var SelectionOptionsBar = ({
|
|
|
3317
3628
|
setTask(null);
|
|
3318
3629
|
};
|
|
3319
3630
|
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
3320
|
-
const [subject, setSubject] =
|
|
3321
|
-
const [segmenting, setSegmenting] =
|
|
3322
|
-
const [subjectStatus, setSubjectStatus] =
|
|
3631
|
+
const [subject, setSubject] = useState16("");
|
|
3632
|
+
const [segmenting, setSegmenting] = useState16(false);
|
|
3633
|
+
const [subjectStatus, setSubjectStatus] = useState16(null);
|
|
3323
3634
|
const selectSubject = async () => {
|
|
3324
3635
|
const target = subject.trim();
|
|
3325
3636
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -3336,10 +3647,10 @@ var SelectionOptionsBar = ({
|
|
|
3336
3647
|
setSegmenting(false);
|
|
3337
3648
|
}
|
|
3338
3649
|
};
|
|
3339
|
-
const [workspace, setWorkspace] =
|
|
3340
|
-
const [fillWorkspace, setFillWorkspace] =
|
|
3341
|
-
const [skying, setSkying] =
|
|
3342
|
-
const [skyStatus, setSkyStatus] =
|
|
3650
|
+
const [workspace, setWorkspace] = useState16(false);
|
|
3651
|
+
const [fillWorkspace, setFillWorkspace] = useState16(false);
|
|
3652
|
+
const [skying, setSkying] = useState16(false);
|
|
3653
|
+
const [skyStatus, setSkyStatus] = useState16(null);
|
|
3343
3654
|
const selectSky = async () => {
|
|
3344
3655
|
if (skying) return;
|
|
3345
3656
|
setSkying(true);
|
|
@@ -3354,8 +3665,8 @@ var SelectionOptionsBar = ({
|
|
|
3354
3665
|
setSkying(false);
|
|
3355
3666
|
}
|
|
3356
3667
|
};
|
|
3357
|
-
const [focusing, setFocusing] =
|
|
3358
|
-
const [focusStatus, setFocusStatus] =
|
|
3668
|
+
const [focusing, setFocusing] = useState16(false);
|
|
3669
|
+
const [focusStatus, setFocusStatus] = useState16(null);
|
|
3359
3670
|
const selectFocusArea = async () => {
|
|
3360
3671
|
if (focusing) return;
|
|
3361
3672
|
setFocusing(true);
|
|
@@ -3376,24 +3687,24 @@ var SelectionOptionsBar = ({
|
|
|
3376
3687
|
setFocusing(false);
|
|
3377
3688
|
}
|
|
3378
3689
|
};
|
|
3379
|
-
return /* @__PURE__ */
|
|
3380
|
-
showTools && /* @__PURE__ */
|
|
3381
|
-
/* @__PURE__ */
|
|
3382
|
-
options.tool === "wand" && /* @__PURE__ */
|
|
3383
|
-
/* @__PURE__ */
|
|
3384
|
-
/* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3386
|
-
/* @__PURE__ */
|
|
3690
|
+
return /* @__PURE__ */ jsxs17("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3691
|
+
showTools && /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx19("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)) }),
|
|
3692
|
+
/* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
3693
|
+
options.tool === "wand" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
|
|
3694
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3695
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3696
|
+
/* @__PURE__ */ jsx19("span", { children: "Tolerance" }),
|
|
3697
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.tolerance })
|
|
3387
3698
|
] }),
|
|
3388
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
3389
3700
|
] }),
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3701
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3702
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
3392
3703
|
"Contiguous"
|
|
3393
3704
|
] }),
|
|
3394
|
-
/* @__PURE__ */
|
|
3705
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3395
3706
|
"Distance",
|
|
3396
|
-
/* @__PURE__ */
|
|
3707
|
+
/* @__PURE__ */ jsx19(
|
|
3397
3708
|
ImageSelect,
|
|
3398
3709
|
{
|
|
3399
3710
|
label: "Colour distance",
|
|
@@ -3406,13 +3717,13 @@ var SelectionOptionsBar = ({
|
|
|
3406
3717
|
}
|
|
3407
3718
|
)
|
|
3408
3719
|
] }),
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
3720
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3721
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
3411
3722
|
"Sample adjusted image"
|
|
3412
3723
|
] }),
|
|
3413
|
-
/* @__PURE__ */
|
|
3724
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3414
3725
|
"Sample",
|
|
3415
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ jsx19(
|
|
3416
3727
|
ImageSelect,
|
|
3417
3728
|
{
|
|
3418
3729
|
label: "Sample from",
|
|
@@ -3426,77 +3737,77 @@ var SelectionOptionsBar = ({
|
|
|
3426
3737
|
)
|
|
3427
3738
|
] })
|
|
3428
3739
|
] }),
|
|
3429
|
-
options.tool === "polygon" && /* @__PURE__ */
|
|
3430
|
-
options.tool === "magnetic" && /* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
/* @__PURE__ */
|
|
3740
|
+
options.tool === "polygon" && /* @__PURE__ */ jsx19("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." }),
|
|
3741
|
+
options.tool === "magnetic" && /* @__PURE__ */ jsxs17("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
3742
|
+
/* @__PURE__ */ jsx19("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." }),
|
|
3743
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3744
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3745
|
+
/* @__PURE__ */ jsx19("span", { children: "Width" }),
|
|
3746
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3436
3747
|
options.magneticWidth ?? 10,
|
|
3437
3748
|
" px"
|
|
3438
3749
|
] })
|
|
3439
3750
|
] }),
|
|
3440
|
-
/* @__PURE__ */
|
|
3751
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
3441
3752
|
] }),
|
|
3442
|
-
/* @__PURE__ */
|
|
3443
|
-
/* @__PURE__ */
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
/* @__PURE__ */
|
|
3753
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3754
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3755
|
+
/* @__PURE__ */ jsx19("span", { children: "Contrast" }),
|
|
3756
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3446
3757
|
options.magneticContrast ?? 10,
|
|
3447
3758
|
"%"
|
|
3448
3759
|
] })
|
|
3449
3760
|
] }),
|
|
3450
|
-
/* @__PURE__ */
|
|
3761
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
3451
3762
|
] }),
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
3454
|
-
/* @__PURE__ */
|
|
3455
|
-
/* @__PURE__ */
|
|
3763
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3764
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3765
|
+
/* @__PURE__ */ jsx19("span", { children: "Frequency" }),
|
|
3766
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
3456
3767
|
] }),
|
|
3457
|
-
/* @__PURE__ */
|
|
3768
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
3458
3769
|
] })
|
|
3459
3770
|
] }),
|
|
3460
|
-
options.tool === "quick" && /* @__PURE__ */
|
|
3461
|
-
/* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
/* @__PURE__ */
|
|
3771
|
+
options.tool === "quick" && /* @__PURE__ */ jsxs17("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
3772
|
+
/* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
3773
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3774
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3775
|
+
/* @__PURE__ */ jsx19("span", { children: "Size" }),
|
|
3776
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3466
3777
|
options.quickSize ?? 30,
|
|
3467
3778
|
" px"
|
|
3468
3779
|
] })
|
|
3469
3780
|
] }),
|
|
3470
|
-
/* @__PURE__ */
|
|
3781
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
3471
3782
|
] }),
|
|
3472
|
-
/* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3783
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3784
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
3474
3785
|
"Sample all layers"
|
|
3475
3786
|
] }),
|
|
3476
|
-
/* @__PURE__ */
|
|
3477
|
-
/* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3788
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
3478
3789
|
"Auto-enhance edges"
|
|
3479
3790
|
] })
|
|
3480
3791
|
] }),
|
|
3481
|
-
options.tool === "object" && /* @__PURE__ */
|
|
3482
|
-
/* @__PURE__ */
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3792
|
+
options.tool === "object" && /* @__PURE__ */ jsxs17("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
3793
|
+
/* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
3794
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3795
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
3485
3796
|
"Sample all layers"
|
|
3486
3797
|
] }),
|
|
3487
|
-
/* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3798
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3799
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
3489
3800
|
"Auto-enhance edges"
|
|
3490
3801
|
] })
|
|
3491
3802
|
] }),
|
|
3492
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */
|
|
3493
|
-
/* @__PURE__ */
|
|
3803
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs17("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
3804
|
+
/* @__PURE__ */ jsxs17("p", { className: "text-muted-foreground", children: [
|
|
3494
3805
|
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).",
|
|
3495
3806
|
" Shift-click adds, Alt-click subtracts."
|
|
3496
3807
|
] }),
|
|
3497
|
-
/* @__PURE__ */
|
|
3808
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3498
3809
|
"Text",
|
|
3499
|
-
/* @__PURE__ */
|
|
3810
|
+
/* @__PURE__ */ jsx19(
|
|
3500
3811
|
"input",
|
|
3501
3812
|
{
|
|
3502
3813
|
type: "text",
|
|
@@ -3507,9 +3818,9 @@ var SelectionOptionsBar = ({
|
|
|
3507
3818
|
}
|
|
3508
3819
|
)
|
|
3509
3820
|
] }),
|
|
3510
|
-
/* @__PURE__ */
|
|
3821
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3511
3822
|
"Size",
|
|
3512
|
-
/* @__PURE__ */
|
|
3823
|
+
/* @__PURE__ */ jsx19(
|
|
3513
3824
|
"input",
|
|
3514
3825
|
{
|
|
3515
3826
|
type: "number",
|
|
@@ -3523,9 +3834,9 @@ var SelectionOptionsBar = ({
|
|
|
3523
3834
|
),
|
|
3524
3835
|
"px"
|
|
3525
3836
|
] }),
|
|
3526
|
-
/* @__PURE__ */
|
|
3837
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3527
3838
|
"Font",
|
|
3528
|
-
/* @__PURE__ */
|
|
3839
|
+
/* @__PURE__ */ jsx19(
|
|
3529
3840
|
"input",
|
|
3530
3841
|
{
|
|
3531
3842
|
type: "text",
|
|
@@ -3537,18 +3848,18 @@ var SelectionOptionsBar = ({
|
|
|
3537
3848
|
)
|
|
3538
3849
|
] })
|
|
3539
3850
|
] }),
|
|
3540
|
-
options.tool === "range" && /* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
/* @__PURE__ */
|
|
3543
|
-
/* @__PURE__ */
|
|
3544
|
-
/* @__PURE__ */
|
|
3545
|
-
/* @__PURE__ */
|
|
3851
|
+
options.tool === "range" && /* @__PURE__ */ jsxs17("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
3852
|
+
/* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
3853
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3854
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3855
|
+
/* @__PURE__ */ jsx19("span", { children: "Fuzziness" }),
|
|
3856
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
3546
3857
|
] }),
|
|
3547
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
3548
3859
|
] }),
|
|
3549
|
-
/* @__PURE__ */
|
|
3860
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3550
3861
|
"Localized radius",
|
|
3551
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ jsx19(
|
|
3552
3863
|
"input",
|
|
3553
3864
|
{
|
|
3554
3865
|
type: "number",
|
|
@@ -3562,12 +3873,12 @@ var SelectionOptionsBar = ({
|
|
|
3562
3873
|
),
|
|
3563
3874
|
"px"
|
|
3564
3875
|
] }),
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3876
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3877
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
3567
3878
|
"Invert"
|
|
3568
3879
|
] }),
|
|
3569
|
-
/* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3880
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
3881
|
+
/* @__PURE__ */ jsx19(
|
|
3571
3882
|
ImageSelect,
|
|
3572
3883
|
{
|
|
3573
3884
|
label: "Color Range preset",
|
|
@@ -3576,13 +3887,13 @@ var SelectionOptionsBar = ({
|
|
|
3576
3887
|
onChange: (v) => setPreset(v)
|
|
3577
3888
|
}
|
|
3578
3889
|
),
|
|
3579
|
-
/* @__PURE__ */
|
|
3890
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
3580
3891
|
] }),
|
|
3581
|
-
rangeStatus && /* @__PURE__ */
|
|
3892
|
+
rangeStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
3582
3893
|
] }),
|
|
3583
|
-
/* @__PURE__ */
|
|
3894
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3584
3895
|
"Feather",
|
|
3585
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__PURE__ */ jsx19(
|
|
3586
3897
|
"input",
|
|
3587
3898
|
{
|
|
3588
3899
|
type: "number",
|
|
@@ -3597,7 +3908,7 @@ var SelectionOptionsBar = ({
|
|
|
3597
3908
|
),
|
|
3598
3909
|
"px"
|
|
3599
3910
|
] }),
|
|
3600
|
-
/* @__PURE__ */
|
|
3911
|
+
/* @__PURE__ */ jsxs17(
|
|
3601
3912
|
"form",
|
|
3602
3913
|
{
|
|
3603
3914
|
"data-testid": "select-subject",
|
|
@@ -3607,8 +3918,8 @@ var SelectionOptionsBar = ({
|
|
|
3607
3918
|
void selectSubject();
|
|
3608
3919
|
},
|
|
3609
3920
|
children: [
|
|
3610
|
-
/* @__PURE__ */
|
|
3611
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3921
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1", children: [
|
|
3922
|
+
controller.segmentationProvider && /* @__PURE__ */ jsx19(
|
|
3612
3923
|
"input",
|
|
3613
3924
|
{
|
|
3614
3925
|
type: "text",
|
|
@@ -3620,7 +3931,7 @@ var SelectionOptionsBar = ({
|
|
|
3620
3931
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
3621
3932
|
}
|
|
3622
3933
|
),
|
|
3623
|
-
/* @__PURE__ */
|
|
3934
|
+
/* @__PURE__ */ jsx19(
|
|
3624
3935
|
"button",
|
|
3625
3936
|
{
|
|
3626
3937
|
type: "submit",
|
|
@@ -3632,12 +3943,12 @@ var SelectionOptionsBar = ({
|
|
|
3632
3943
|
}
|
|
3633
3944
|
)
|
|
3634
3945
|
] }),
|
|
3635
|
-
subjectStatus && /* @__PURE__ */
|
|
3946
|
+
subjectStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
3636
3947
|
]
|
|
3637
3948
|
}
|
|
3638
3949
|
),
|
|
3639
|
-
task && /* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
3950
|
+
task && /* @__PURE__ */ jsxs17("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
3951
|
+
/* @__PURE__ */ jsx19(
|
|
3641
3952
|
"div",
|
|
3642
3953
|
{
|
|
3643
3954
|
role: "progressbar",
|
|
@@ -3646,69 +3957,69 @@ var SelectionOptionsBar = ({
|
|
|
3646
3957
|
"aria-valuemax": 100,
|
|
3647
3958
|
"aria-valuenow": Math.round(task.fraction * 100),
|
|
3648
3959
|
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
3649
|
-
children: /* @__PURE__ */
|
|
3960
|
+
children: /* @__PURE__ */ jsx19("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
3650
3961
|
}
|
|
3651
3962
|
),
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3963
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: task.stage }),
|
|
3964
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
3654
3965
|
] }),
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
workspace && /* @__PURE__ */
|
|
3657
|
-
/* @__PURE__ */
|
|
3658
|
-
/* @__PURE__ */
|
|
3659
|
-
skyStatus && /* @__PURE__ */
|
|
3966
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
3967
|
+
workspace && /* @__PURE__ */ jsx19(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
3968
|
+
/* @__PURE__ */ jsxs17("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
3969
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
3970
|
+
skyStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
3660
3971
|
] }),
|
|
3661
|
-
/* @__PURE__ */
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3665
|
-
/* @__PURE__ */
|
|
3666
|
-
/* @__PURE__ */
|
|
3667
|
-
/* @__PURE__ */
|
|
3972
|
+
/* @__PURE__ */ jsxs17("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
3973
|
+
/* @__PURE__ */ jsx19("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
3974
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
3975
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3976
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3977
|
+
/* @__PURE__ */ jsx19("span", { children: "In-focus range" }),
|
|
3978
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
3668
3979
|
] }),
|
|
3669
|
-
/* @__PURE__ */
|
|
3980
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
3670
3981
|
] }),
|
|
3671
|
-
/* @__PURE__ */
|
|
3672
|
-
/* @__PURE__ */
|
|
3673
|
-
/* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
3982
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3983
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3984
|
+
/* @__PURE__ */ jsx19("span", { children: "Image noise level" }),
|
|
3985
|
+
/* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
3675
3986
|
] }),
|
|
3676
|
-
/* @__PURE__ */
|
|
3987
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
3677
3988
|
] }),
|
|
3678
|
-
/* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3680
|
-
/* @__PURE__ */
|
|
3681
|
-
/* @__PURE__ */
|
|
3989
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3990
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3991
|
+
/* @__PURE__ */ jsx19("span", { children: "Soften edge" }),
|
|
3992
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3682
3993
|
options.focusSoftness ?? 4,
|
|
3683
3994
|
" px"
|
|
3684
3995
|
] })
|
|
3685
3996
|
] }),
|
|
3686
|
-
/* @__PURE__ */
|
|
3997
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
3687
3998
|
] }),
|
|
3688
|
-
/* @__PURE__ */
|
|
3689
|
-
focusStatus && /* @__PURE__ */
|
|
3999
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
4000
|
+
focusStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
3690
4001
|
] })
|
|
3691
4002
|
] }),
|
|
3692
|
-
/* @__PURE__ */
|
|
3693
|
-
/* @__PURE__ */
|
|
4003
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4004
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
3694
4005
|
"Anti-alias"
|
|
3695
4006
|
] }),
|
|
3696
|
-
/* @__PURE__ */
|
|
3697
|
-
/* @__PURE__ */
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3702
|
-
/* @__PURE__ */
|
|
4007
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap gap-1", children: [
|
|
4008
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
4009
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
4010
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
4011
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
4012
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
4013
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
3703
4014
|
] }),
|
|
3704
|
-
/* @__PURE__ */
|
|
3705
|
-
/* @__PURE__ */
|
|
3706
|
-
DISPLAYS.map((d) => /* @__PURE__ */
|
|
4015
|
+
/* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
4016
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Show" }),
|
|
4017
|
+
DISPLAYS.map((d) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
3707
4018
|
] }),
|
|
3708
|
-
/* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
4019
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4020
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3710
4021
|
"Radius",
|
|
3711
|
-
/* @__PURE__ */
|
|
4022
|
+
/* @__PURE__ */ jsx19(
|
|
3712
4023
|
"input",
|
|
3713
4024
|
{
|
|
3714
4025
|
type: "number",
|
|
@@ -3722,12 +4033,12 @@ var SelectionOptionsBar = ({
|
|
|
3722
4033
|
}
|
|
3723
4034
|
)
|
|
3724
4035
|
] }),
|
|
3725
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
4036
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
3726
4037
|
] }),
|
|
3727
|
-
/* @__PURE__ */
|
|
3728
|
-
/* @__PURE__ */
|
|
4038
|
+
/* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
4039
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3729
4040
|
"Stroke",
|
|
3730
|
-
/* @__PURE__ */
|
|
4041
|
+
/* @__PURE__ */ jsx19(
|
|
3731
4042
|
"input",
|
|
3732
4043
|
{
|
|
3733
4044
|
type: "number",
|
|
@@ -3742,7 +4053,7 @@ var SelectionOptionsBar = ({
|
|
|
3742
4053
|
),
|
|
3743
4054
|
"px"
|
|
3744
4055
|
] }),
|
|
3745
|
-
/* @__PURE__ */
|
|
4056
|
+
/* @__PURE__ */ jsx19(
|
|
3746
4057
|
ImageSelect,
|
|
3747
4058
|
{
|
|
3748
4059
|
label: "Stroke location",
|
|
@@ -3755,29 +4066,29 @@ var SelectionOptionsBar = ({
|
|
|
3755
4066
|
onChange: (v) => setStrokeLocation(v)
|
|
3756
4067
|
}
|
|
3757
4068
|
),
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3760
|
-
/* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */
|
|
3762
|
-
fillWorkspace && /* @__PURE__ */
|
|
4069
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
4070
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
4071
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
|
|
4072
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
|
|
4073
|
+
fillWorkspace && /* @__PURE__ */ jsx19(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
|
|
3763
4074
|
] }),
|
|
3764
|
-
/* @__PURE__ */
|
|
3765
|
-
/* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
3768
|
-
/* @__PURE__ */
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
/* @__PURE__ */
|
|
3771
|
-
/* @__PURE__ */
|
|
4075
|
+
/* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
4076
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
4077
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
4078
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
4079
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
4080
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
4081
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
4082
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
3772
4083
|
] }),
|
|
3773
|
-
colorStatus && /* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
4084
|
+
colorStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
4085
|
+
/* @__PURE__ */ jsx19("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) }),
|
|
4086
|
+
/* @__PURE__ */ jsx19(SelectionRecipePanel, { controller, selection: sel })
|
|
3776
4087
|
] });
|
|
3777
4088
|
};
|
|
3778
4089
|
|
|
3779
4090
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3780
|
-
import { useState as
|
|
4091
|
+
import { useState as useState20 } from "react";
|
|
3781
4092
|
import {
|
|
3782
4093
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3783
4094
|
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
@@ -3787,14 +4098,14 @@ import {
|
|
|
3787
4098
|
} from "@pixerate/editor/image-editor";
|
|
3788
4099
|
|
|
3789
4100
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
3790
|
-
import
|
|
4101
|
+
import React16, { useState as useState17 } from "react";
|
|
3791
4102
|
import { MASK_EDGE_THRESHOLDS } from "@pixerate/editor/image-editor";
|
|
3792
|
-
import { Fragment as
|
|
3793
|
-
var
|
|
4103
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4104
|
+
var button5 = "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
4105
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
3795
4106
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3796
|
-
const [result, setResult] =
|
|
3797
|
-
const [error, setError] =
|
|
4107
|
+
const [result, setResult] = useState17(null);
|
|
4108
|
+
const [error, setError] = useState17(null);
|
|
3798
4109
|
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
3799
4110
|
const check = () => {
|
|
3800
4111
|
setError(null);
|
|
@@ -3812,35 +4123,35 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
3812
4123
|
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
3813
4124
|
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
3814
4125
|
] : [];
|
|
3815
|
-
return /* @__PURE__ */
|
|
3816
|
-
/* @__PURE__ */
|
|
3817
|
-
report && /* @__PURE__ */
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
rows.map((r) => /* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
/* @__PURE__ */
|
|
4126
|
+
return /* @__PURE__ */ jsxs18("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
4127
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: `${button5} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
4128
|
+
report && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
4129
|
+
/* @__PURE__ */ jsxs18("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
4130
|
+
rows.map((r) => /* @__PURE__ */ jsxs18(React16.Fragment, { children: [
|
|
4131
|
+
/* @__PURE__ */ jsx20("dt", { className: "text-muted-foreground", children: r.label }),
|
|
4132
|
+
/* @__PURE__ */ jsx20("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
3822
4133
|
] }, r.label)),
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
/* @__PURE__ */
|
|
4134
|
+
/* @__PURE__ */ jsx20("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
4135
|
+
/* @__PURE__ */ jsxs18("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
3825
4136
|
report.holes.count,
|
|
3826
4137
|
" / ",
|
|
3827
4138
|
report.islands.count
|
|
3828
4139
|
] })
|
|
3829
4140
|
] }),
|
|
3830
|
-
report.issues.length ? /* @__PURE__ */
|
|
4141
|
+
report.issues.length ? /* @__PURE__ */ jsx20("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx20("li", { children: s }, s)) }) : /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
3831
4142
|
] }),
|
|
3832
|
-
error && /* @__PURE__ */
|
|
4143
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
|
|
3833
4144
|
] });
|
|
3834
4145
|
};
|
|
3835
4146
|
|
|
3836
4147
|
// src/image-editor/SelectionChangeCheck.tsx
|
|
3837
|
-
import { useState as
|
|
3838
|
-
import { Fragment as
|
|
3839
|
-
var
|
|
4148
|
+
import { useState as useState18 } from "react";
|
|
4149
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4150
|
+
var button6 = "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";
|
|
3840
4151
|
var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
3841
4152
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3842
|
-
const [result, setResult] =
|
|
3843
|
-
const [error, setError] =
|
|
4153
|
+
const [result, setResult] = useState18(null);
|
|
4154
|
+
const [error, setError] = useState18(null);
|
|
3844
4155
|
const diff = result && result.for === sel ? result.diff : null;
|
|
3845
4156
|
const show = () => {
|
|
3846
4157
|
setError(null);
|
|
@@ -3851,16 +4162,16 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
3851
4162
|
setError(err instanceof Error ? err.message : String(err));
|
|
3852
4163
|
}
|
|
3853
4164
|
};
|
|
3854
|
-
return /* @__PURE__ */
|
|
3855
|
-
/* @__PURE__ */
|
|
3856
|
-
diff && /* @__PURE__ */
|
|
3857
|
-
/* @__PURE__ */
|
|
4165
|
+
return /* @__PURE__ */ jsxs19("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
4166
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: `${button6} self-start`, onClick: show, children: "Show Last Change" }),
|
|
4167
|
+
diff && /* @__PURE__ */ jsx21("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
4168
|
+
/* @__PURE__ */ jsxs19("span", { className: "text-green-600", children: [
|
|
3858
4169
|
"+",
|
|
3859
4170
|
diff.added.area,
|
|
3860
4171
|
" px"
|
|
3861
4172
|
] }),
|
|
3862
4173
|
" ",
|
|
3863
|
-
/* @__PURE__ */
|
|
4174
|
+
/* @__PURE__ */ jsxs19("span", { className: "text-destructive", children: [
|
|
3864
4175
|
"\u2212",
|
|
3865
4176
|
diff.removed.area,
|
|
3866
4177
|
" px"
|
|
@@ -3869,21 +4180,21 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
3869
4180
|
Math.round(diff.iou * 100),
|
|
3870
4181
|
"%"
|
|
3871
4182
|
] }) }),
|
|
3872
|
-
error && /* @__PURE__ */
|
|
4183
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
3873
4184
|
] });
|
|
3874
4185
|
};
|
|
3875
4186
|
|
|
3876
4187
|
// src/image-editor/SeparateSubjectPanel.tsx
|
|
3877
|
-
import { useRef as
|
|
3878
|
-
import { jsx as
|
|
3879
|
-
var
|
|
4188
|
+
import { useRef as useRef11, useState as useState19 } from "react";
|
|
4189
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4190
|
+
var button7 = "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";
|
|
3880
4191
|
var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
3881
4192
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3882
|
-
const [dilate, setDilate] =
|
|
3883
|
-
const [fill, setFill] =
|
|
3884
|
-
const [progress, setProgress] =
|
|
3885
|
-
const [error, setError] =
|
|
3886
|
-
const abort =
|
|
4193
|
+
const [dilate, setDilate] = useState19(8);
|
|
4194
|
+
const [fill, setFill] = useState19(true);
|
|
4195
|
+
const [progress, setProgress] = useState19(null);
|
|
4196
|
+
const [error, setError] = useState19(null);
|
|
4197
|
+
const abort = useRef11(null);
|
|
3887
4198
|
const run = async () => {
|
|
3888
4199
|
setError(null);
|
|
3889
4200
|
abort.current = new AbortController();
|
|
@@ -3902,13 +4213,13 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
3902
4213
|
setProgress(null);
|
|
3903
4214
|
}
|
|
3904
4215
|
};
|
|
3905
|
-
return /* @__PURE__ */
|
|
3906
|
-
/* @__PURE__ */
|
|
3907
|
-
/* @__PURE__ */
|
|
3908
|
-
/* @__PURE__ */
|
|
3909
|
-
/* @__PURE__ */
|
|
4216
|
+
return /* @__PURE__ */ jsxs20("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
4217
|
+
/* @__PURE__ */ jsx22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
|
|
4218
|
+
/* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
|
|
4219
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4220
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3910
4221
|
"Grow",
|
|
3911
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsx22(
|
|
3912
4223
|
"input",
|
|
3913
4224
|
{
|
|
3914
4225
|
type: "number",
|
|
@@ -3922,34 +4233,34 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
3922
4233
|
),
|
|
3923
4234
|
"px"
|
|
3924
4235
|
] }),
|
|
3925
|
-
/* @__PURE__ */
|
|
3926
|
-
/* @__PURE__ */
|
|
4236
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
4237
|
+
/* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
|
|
3927
4238
|
"Fill the background"
|
|
3928
4239
|
] })
|
|
3929
4240
|
] }),
|
|
3930
|
-
/* @__PURE__ */
|
|
3931
|
-
/* @__PURE__ */
|
|
3932
|
-
progress !== null && /* @__PURE__ */
|
|
4241
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
|
|
4242
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: button7, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
|
|
4243
|
+
progress !== null && /* @__PURE__ */ jsx22("button", { type: "button", className: button7, onClick: () => abort.current?.abort(), children: "Cancel" })
|
|
3933
4244
|
] }),
|
|
3934
|
-
progress !== null && /* @__PURE__ */
|
|
3935
|
-
error && /* @__PURE__ */
|
|
4245
|
+
progress !== null && /* @__PURE__ */ jsx22("p", { role: "status", className: "text-muted-foreground", children: progress }),
|
|
4246
|
+
error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
|
|
3936
4247
|
] });
|
|
3937
4248
|
};
|
|
3938
4249
|
|
|
3939
4250
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3940
|
-
import { Fragment as
|
|
4251
|
+
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3941
4252
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3942
|
-
var
|
|
4253
|
+
var button8 = "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";
|
|
3943
4254
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
3944
|
-
const [params, setParams] =
|
|
3945
|
-
const [busy, setBusy] =
|
|
3946
|
-
const [error, setError] =
|
|
3947
|
-
const [layerId, setLayerId] =
|
|
3948
|
-
const [newKind, setNewKind] =
|
|
3949
|
-
const [output, setOutput] =
|
|
3950
|
-
const [decontaminate, setDecontaminate] =
|
|
3951
|
-
const [objectAware, setObjectAware] =
|
|
3952
|
-
const [onlyUncertain, setOnlyUncertain] =
|
|
4255
|
+
const [params, setParams] = useState20(DEFAULT_PARAMS);
|
|
4256
|
+
const [busy, setBusy] = useState20(false);
|
|
4257
|
+
const [error, setError] = useState20(null);
|
|
4258
|
+
const [layerId, setLayerId] = useState20("");
|
|
4259
|
+
const [newKind, setNewKind] = useState20("hueSaturation");
|
|
4260
|
+
const [output, setOutput] = useState20("selection");
|
|
4261
|
+
const [decontaminate, setDecontaminate] = useState20(0);
|
|
4262
|
+
const [objectAware, setObjectAware] = useState20(false);
|
|
4263
|
+
const [onlyUncertain, setOnlyUncertain] = useState20(false);
|
|
3953
4264
|
const canObject = Boolean(controller.segmentationProvider);
|
|
3954
4265
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
3955
4266
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -3972,17 +4283,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3972
4283
|
setBusy(false);
|
|
3973
4284
|
}
|
|
3974
4285
|
};
|
|
3975
|
-
return /* @__PURE__ */
|
|
3976
|
-
/* @__PURE__ */
|
|
3977
|
-
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */
|
|
3978
|
-
/* @__PURE__ */
|
|
3979
|
-
/* @__PURE__ */
|
|
3980
|
-
/* @__PURE__ */
|
|
4286
|
+
return /* @__PURE__ */ jsxs21("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4287
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
4288
|
+
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
|
|
4289
|
+
/* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4290
|
+
/* @__PURE__ */ jsx23("span", { children: c.label }),
|
|
4291
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
|
|
3981
4292
|
params[c.id],
|
|
3982
4293
|
c.unit
|
|
3983
4294
|
] })
|
|
3984
4295
|
] }),
|
|
3985
|
-
/* @__PURE__ */
|
|
4296
|
+
/* @__PURE__ */ jsx23(
|
|
3986
4297
|
"input",
|
|
3987
4298
|
{
|
|
3988
4299
|
type: "range",
|
|
@@ -3996,43 +4307,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3996
4307
|
}
|
|
3997
4308
|
)
|
|
3998
4309
|
] }, c.id)),
|
|
3999
|
-
/* @__PURE__ */
|
|
4000
|
-
/* @__PURE__ */
|
|
4310
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4311
|
+
/* @__PURE__ */ jsx23("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
4001
4312
|
"Smart Radius"
|
|
4002
4313
|
] }),
|
|
4003
|
-
/* @__PURE__ */
|
|
4004
|
-
/* @__PURE__ */
|
|
4314
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
4315
|
+
/* @__PURE__ */ jsx23("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
4005
4316
|
"Only uncertain areas"
|
|
4006
4317
|
] }),
|
|
4007
|
-
canObject && /* @__PURE__ */
|
|
4008
|
-
/* @__PURE__ */
|
|
4318
|
+
canObject && /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4319
|
+
/* @__PURE__ */ jsx23("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
4009
4320
|
"Object aware (segmentation model)"
|
|
4010
4321
|
] }),
|
|
4011
|
-
/* @__PURE__ */
|
|
4322
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
4012
4323
|
"Output to",
|
|
4013
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsx23(
|
|
4014
4325
|
"select",
|
|
4015
4326
|
{
|
|
4016
4327
|
"aria-label": "Refine output",
|
|
4017
4328
|
value: output,
|
|
4018
4329
|
onChange: (e) => setOutput(e.target.value),
|
|
4019
4330
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4020
|
-
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */
|
|
4331
|
+
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx23("option", { value: o.id, children: o.label }, o.id))
|
|
4021
4332
|
}
|
|
4022
4333
|
)
|
|
4023
4334
|
] }),
|
|
4024
|
-
/* @__PURE__ */
|
|
4025
|
-
/* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
4335
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
|
|
4336
|
+
/* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4337
|
+
/* @__PURE__ */ jsxs21("span", { children: [
|
|
4027
4338
|
"Decontaminate colors",
|
|
4028
4339
|
toLayer ? "" : " (new layer or document outputs)"
|
|
4029
4340
|
] }),
|
|
4030
|
-
/* @__PURE__ */
|
|
4341
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
|
|
4031
4342
|
decontaminate,
|
|
4032
4343
|
"%"
|
|
4033
4344
|
] })
|
|
4034
4345
|
] }),
|
|
4035
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx23(
|
|
4036
4347
|
"input",
|
|
4037
4348
|
{
|
|
4038
4349
|
type: "range",
|
|
@@ -4047,66 +4358,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4047
4358
|
}
|
|
4048
4359
|
)
|
|
4049
4360
|
] }),
|
|
4050
|
-
/* @__PURE__ */
|
|
4051
|
-
/* @__PURE__ */
|
|
4052
|
-
/* @__PURE__ */
|
|
4361
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-1", children: [
|
|
4362
|
+
/* @__PURE__ */ jsx23("button", { type: "button", className: button8, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
4363
|
+
/* @__PURE__ */ jsx23("button", { type: "button", className: button8, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
4053
4364
|
] }),
|
|
4054
|
-
error && /* @__PURE__ */
|
|
4055
|
-
/* @__PURE__ */
|
|
4056
|
-
/* @__PURE__ */
|
|
4057
|
-
/* @__PURE__ */
|
|
4058
|
-
/* @__PURE__ */
|
|
4059
|
-
/* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4365
|
+
error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error }),
|
|
4366
|
+
/* @__PURE__ */ jsx23(MaskEdgeCheck, { controller, selection: sel }),
|
|
4367
|
+
/* @__PURE__ */ jsx23(SelectionChangeCheck, { controller, selection: sel }),
|
|
4368
|
+
/* @__PURE__ */ jsx23(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
|
|
4369
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
4370
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-1 items-center", children: [
|
|
4371
|
+
/* @__PURE__ */ jsx23(
|
|
4061
4372
|
"select",
|
|
4062
4373
|
{
|
|
4063
4374
|
"aria-label": "New masked layer kind",
|
|
4064
4375
|
value: newKind,
|
|
4065
4376
|
onChange: (e) => setNewKind(e.target.value),
|
|
4066
4377
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4067
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
4378
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx23("option", { value: k.kind, children: k.label }, k.kind))
|
|
4068
4379
|
}
|
|
4069
4380
|
),
|
|
4070
|
-
/* @__PURE__ */
|
|
4381
|
+
/* @__PURE__ */ jsx23(
|
|
4071
4382
|
"button",
|
|
4072
4383
|
{
|
|
4073
4384
|
type: "button",
|
|
4074
|
-
className:
|
|
4385
|
+
className: button8,
|
|
4075
4386
|
disabled: !sel,
|
|
4076
4387
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
4077
4388
|
children: "New Masked Layer"
|
|
4078
4389
|
}
|
|
4079
4390
|
)
|
|
4080
4391
|
] }),
|
|
4081
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
4082
|
-
/* @__PURE__ */
|
|
4392
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2", children: [
|
|
4393
|
+
/* @__PURE__ */ jsx23(
|
|
4083
4394
|
"select",
|
|
4084
4395
|
{
|
|
4085
4396
|
"aria-label": "Mask layer",
|
|
4086
4397
|
value: target.id,
|
|
4087
4398
|
onChange: (e) => setLayerId(e.target.value),
|
|
4088
4399
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4089
|
-
children: list.map((l) => /* @__PURE__ */
|
|
4400
|
+
children: list.map((l) => /* @__PURE__ */ jsxs21("option", { value: l.id, children: [
|
|
4090
4401
|
l.name || adjustmentKindLabel2(l.kind),
|
|
4091
4402
|
l.mask ? " (masked)" : ""
|
|
4092
4403
|
] }, l.id))
|
|
4093
4404
|
}
|
|
4094
4405
|
),
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
/* @__PURE__ */
|
|
4097
|
-
/* @__PURE__ */
|
|
4098
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
|
|
4407
|
+
/* @__PURE__ */ jsx23("button", { type: "button", className: button8, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4408
|
+
/* @__PURE__ */ jsx23("button", { type: "button", className: button8, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4409
|
+
/* @__PURE__ */ jsx23("button", { type: "button", className: button8, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
4099
4410
|
] }),
|
|
4100
|
-
target.mask && /* @__PURE__ */
|
|
4101
|
-
/* @__PURE__ */
|
|
4102
|
-
/* @__PURE__ */
|
|
4103
|
-
/* @__PURE__ */
|
|
4104
|
-
/* @__PURE__ */
|
|
4411
|
+
target.mask && /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4412
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
|
|
4413
|
+
/* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4414
|
+
/* @__PURE__ */ jsx23("span", { children: "Density" }),
|
|
4415
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
|
|
4105
4416
|
Math.round((target.mask.density ?? 1) * 100),
|
|
4106
4417
|
"%"
|
|
4107
4418
|
] })
|
|
4108
4419
|
] }),
|
|
4109
|
-
/* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsx23(
|
|
4110
4421
|
"input",
|
|
4111
4422
|
{
|
|
4112
4423
|
type: "range",
|
|
@@ -4120,15 +4431,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4120
4431
|
}
|
|
4121
4432
|
)
|
|
4122
4433
|
] }),
|
|
4123
|
-
/* @__PURE__ */
|
|
4124
|
-
/* @__PURE__ */
|
|
4125
|
-
/* @__PURE__ */
|
|
4126
|
-
/* @__PURE__ */
|
|
4434
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
|
|
4435
|
+
/* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4436
|
+
/* @__PURE__ */ jsx23("span", { children: "Mask Feather" }),
|
|
4437
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
|
|
4127
4438
|
target.mask.feather ?? 0,
|
|
4128
4439
|
"px"
|
|
4129
4440
|
] })
|
|
4130
4441
|
] }),
|
|
4131
|
-
/* @__PURE__ */
|
|
4442
|
+
/* @__PURE__ */ jsx23(
|
|
4132
4443
|
"input",
|
|
4133
4444
|
{
|
|
4134
4445
|
type: "range",
|
|
@@ -4148,13 +4459,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4148
4459
|
};
|
|
4149
4460
|
|
|
4150
4461
|
// src/image-editor/ChannelsPanel.tsx
|
|
4151
|
-
import { useEffect as
|
|
4462
|
+
import { useEffect as useEffect12, useRef as useRef12, useState as useState21 } from "react";
|
|
4152
4463
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
4153
|
-
import { jsx as
|
|
4464
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4154
4465
|
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"}`;
|
|
4155
4466
|
var ChannelThumb = ({ channel, size }) => {
|
|
4156
|
-
const ref =
|
|
4157
|
-
|
|
4467
|
+
const ref = useRef12(null);
|
|
4468
|
+
useEffect12(() => {
|
|
4158
4469
|
const canvas = ref.current;
|
|
4159
4470
|
const ctx = canvas?.getContext("2d");
|
|
4160
4471
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -4165,15 +4476,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
4165
4476
|
img.data.set(px.data);
|
|
4166
4477
|
ctx.putImageData(img, 0, 0);
|
|
4167
4478
|
}, [channel.mask]);
|
|
4168
|
-
return /* @__PURE__ */
|
|
4479
|
+
return /* @__PURE__ */ jsx24("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
4169
4480
|
};
|
|
4170
4481
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4171
|
-
const [, setTick] =
|
|
4172
|
-
|
|
4173
|
-
const [activeId, setActiveId] =
|
|
4174
|
-
const [renaming, setRenaming] =
|
|
4175
|
-
const [error, setError] =
|
|
4176
|
-
const fileInput =
|
|
4482
|
+
const [, setTick] = useState21(0);
|
|
4483
|
+
useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4484
|
+
const [activeId, setActiveId] = useState21(null);
|
|
4485
|
+
const [renaming, setRenaming] = useState21(null);
|
|
4486
|
+
const [error, setError] = useState21(null);
|
|
4487
|
+
const fileInput = useRef12(null);
|
|
4177
4488
|
const channels = controller.getChannels();
|
|
4178
4489
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
4179
4490
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -4195,13 +4506,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4195
4506
|
setError(err instanceof Error ? err.message : String(err));
|
|
4196
4507
|
}
|
|
4197
4508
|
};
|
|
4198
|
-
return /* @__PURE__ */
|
|
4199
|
-
/* @__PURE__ */
|
|
4200
|
-
/* @__PURE__ */
|
|
4201
|
-
/* @__PURE__ */
|
|
4509
|
+
return /* @__PURE__ */ jsxs22("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
4510
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
4511
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
4512
|
+
/* @__PURE__ */ jsx24("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" })
|
|
4202
4513
|
] }),
|
|
4203
|
-
channels.length === 0 && /* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4514
|
+
channels.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
4515
|
+
/* @__PURE__ */ jsx24("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs22(
|
|
4205
4516
|
"li",
|
|
4206
4517
|
{
|
|
4207
4518
|
"data-testid": "channel-row",
|
|
@@ -4213,7 +4524,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4213
4524
|
},
|
|
4214
4525
|
onDoubleClick: () => setRenaming(c.id),
|
|
4215
4526
|
children: [
|
|
4216
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ jsx24(
|
|
4217
4528
|
"button",
|
|
4218
4529
|
{
|
|
4219
4530
|
type: "button",
|
|
@@ -4227,8 +4538,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4227
4538
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
4228
4539
|
}
|
|
4229
4540
|
),
|
|
4230
|
-
/* @__PURE__ */
|
|
4231
|
-
renaming === c.id ? /* @__PURE__ */
|
|
4541
|
+
/* @__PURE__ */ jsx24(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
4542
|
+
renaming === c.id ? /* @__PURE__ */ jsx24(
|
|
4232
4543
|
"input",
|
|
4233
4544
|
{
|
|
4234
4545
|
autoFocus: true,
|
|
@@ -4245,16 +4556,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4245
4556
|
if (e.key === "Escape") setRenaming(null);
|
|
4246
4557
|
}
|
|
4247
4558
|
}
|
|
4248
|
-
) : /* @__PURE__ */
|
|
4559
|
+
) : /* @__PURE__ */ jsx24("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
4249
4560
|
]
|
|
4250
4561
|
},
|
|
4251
4562
|
c.id
|
|
4252
4563
|
)) }),
|
|
4253
|
-
/* @__PURE__ */
|
|
4254
|
-
/* @__PURE__ */
|
|
4255
|
-
/* @__PURE__ */
|
|
4256
|
-
/* @__PURE__ */
|
|
4257
|
-
/* @__PURE__ */
|
|
4564
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
|
|
4565
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
4566
|
+
/* @__PURE__ */ jsx24("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" }),
|
|
4567
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
4568
|
+
/* @__PURE__ */ jsx24(
|
|
4258
4569
|
"button",
|
|
4259
4570
|
{
|
|
4260
4571
|
type: "button",
|
|
@@ -4267,8 +4578,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4267
4578
|
children: "Delete"
|
|
4268
4579
|
}
|
|
4269
4580
|
),
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4581
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
4582
|
+
/* @__PURE__ */ jsx24(
|
|
4272
4583
|
"button",
|
|
4273
4584
|
{
|
|
4274
4585
|
type: "button",
|
|
@@ -4279,7 +4590,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4279
4590
|
children: "Export PNG"
|
|
4280
4591
|
}
|
|
4281
4592
|
),
|
|
4282
|
-
/* @__PURE__ */
|
|
4593
|
+
/* @__PURE__ */ jsx24(
|
|
4283
4594
|
"input",
|
|
4284
4595
|
{
|
|
4285
4596
|
ref: fileInput,
|
|
@@ -4294,22 +4605,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4294
4605
|
}
|
|
4295
4606
|
)
|
|
4296
4607
|
] }),
|
|
4297
|
-
error && /* @__PURE__ */
|
|
4608
|
+
error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
|
|
4298
4609
|
] });
|
|
4299
4610
|
};
|
|
4300
4611
|
|
|
4301
4612
|
// src/image-editor/PathsPanel.tsx
|
|
4302
|
-
import { useEffect as
|
|
4613
|
+
import { useEffect as useEffect13, useState as useState22 } from "react";
|
|
4303
4614
|
import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
|
|
4304
|
-
import { jsx as
|
|
4615
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4305
4616
|
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"}`;
|
|
4306
4617
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4307
|
-
const [, setTick] =
|
|
4308
|
-
|
|
4309
|
-
const [renaming, setRenaming] =
|
|
4310
|
-
const [color, setColor] =
|
|
4311
|
-
const [width, setWidth] =
|
|
4312
|
-
const [error, setError] =
|
|
4618
|
+
const [, setTick] = useState22(0);
|
|
4619
|
+
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4620
|
+
const [renaming, setRenaming] = useState22(null);
|
|
4621
|
+
const [color, setColor] = useState22("#000000");
|
|
4622
|
+
const [width, setWidth] = useState22(2);
|
|
4623
|
+
const [error, setError] = useState22(null);
|
|
4313
4624
|
const paths = controller.getPaths();
|
|
4314
4625
|
const activeId = controller.getState().activePathId ?? null;
|
|
4315
4626
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -4325,10 +4636,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4325
4636
|
};
|
|
4326
4637
|
return (
|
|
4327
4638
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
4328
|
-
/* @__PURE__ */
|
|
4329
|
-
/* @__PURE__ */
|
|
4330
|
-
paths.length === 0 && /* @__PURE__ */
|
|
4331
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ jsxs23("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: [
|
|
4640
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
4641
|
+
paths.length === 0 && /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
4642
|
+
/* @__PURE__ */ jsx25("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__ */ jsxs23(
|
|
4332
4643
|
"li",
|
|
4333
4644
|
{
|
|
4334
4645
|
"data-testid": "path-row",
|
|
@@ -4337,8 +4648,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4337
4648
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4338
4649
|
onDoubleClick: () => setRenaming(p.id),
|
|
4339
4650
|
children: [
|
|
4340
|
-
/* @__PURE__ */
|
|
4341
|
-
renaming === p.id ? /* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsx25("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__ */ jsx25("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
4652
|
+
renaming === p.id ? /* @__PURE__ */ jsx25(
|
|
4342
4653
|
"input",
|
|
4343
4654
|
{
|
|
4344
4655
|
autoFocus: true,
|
|
@@ -4357,13 +4668,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4357
4668
|
if (e.key === "Escape") setRenaming(null);
|
|
4358
4669
|
}
|
|
4359
4670
|
}
|
|
4360
|
-
) : /* @__PURE__ */
|
|
4671
|
+
) : /* @__PURE__ */ jsx25("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4361
4672
|
]
|
|
4362
4673
|
},
|
|
4363
4674
|
p.id
|
|
4364
4675
|
)) }),
|
|
4365
|
-
/* @__PURE__ */
|
|
4366
|
-
/* @__PURE__ */
|
|
4676
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
|
|
4677
|
+
/* @__PURE__ */ jsx25(
|
|
4367
4678
|
"button",
|
|
4368
4679
|
{
|
|
4369
4680
|
type: "button",
|
|
@@ -4374,15 +4685,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4374
4685
|
children: "Load as Selection"
|
|
4375
4686
|
}
|
|
4376
4687
|
),
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
active?.work && /* @__PURE__ */
|
|
4379
|
-
/* @__PURE__ */
|
|
4688
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
4689
|
+
active?.work && /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
4690
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
4380
4691
|
] }),
|
|
4381
|
-
/* @__PURE__ */
|
|
4382
|
-
/* @__PURE__ */
|
|
4383
|
-
/* @__PURE__ */
|
|
4384
|
-
/* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4693
|
+
/* @__PURE__ */ jsx25("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" }),
|
|
4694
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
4695
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4696
|
+
/* @__PURE__ */ jsx25(
|
|
4386
4697
|
"input",
|
|
4387
4698
|
{
|
|
4388
4699
|
type: "number",
|
|
@@ -4397,25 +4708,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4397
4708
|
),
|
|
4398
4709
|
"px"
|
|
4399
4710
|
] }),
|
|
4400
|
-
/* @__PURE__ */
|
|
4711
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
4401
4712
|
] }),
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
/* @__PURE__ */
|
|
4404
|
-
/* @__PURE__ */
|
|
4713
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
|
|
4714
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
4715
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
4405
4716
|
] }),
|
|
4406
|
-
error && /* @__PURE__ */
|
|
4717
|
+
error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
|
|
4407
4718
|
] })
|
|
4408
4719
|
);
|
|
4409
4720
|
};
|
|
4410
4721
|
|
|
4411
4722
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4412
|
-
import { useEffect as
|
|
4723
|
+
import { useEffect as useEffect14, useState as useState23 } from "react";
|
|
4413
4724
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
4414
|
-
import { jsx as
|
|
4725
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4415
4726
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4416
4727
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4417
|
-
const [, setTick] =
|
|
4418
|
-
|
|
4728
|
+
const [, setTick] = useState23(0);
|
|
4729
|
+
useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4419
4730
|
const bar = tool.bar();
|
|
4420
4731
|
if (!tool.active || !bar) return null;
|
|
4421
4732
|
const warp = tool.warpBar();
|
|
@@ -4427,17 +4738,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4427
4738
|
const v = Number(raw);
|
|
4428
4739
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4429
4740
|
};
|
|
4430
|
-
return /* @__PURE__ */
|
|
4431
|
-
/* @__PURE__ */
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
4434
|
-
/* @__PURE__ */
|
|
4435
|
-
/* @__PURE__ */
|
|
4436
|
-
/* @__PURE__ */
|
|
4741
|
+
return /* @__PURE__ */ jsxs24("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: [
|
|
4742
|
+
/* @__PURE__ */ jsx26("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx26("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)) }),
|
|
4743
|
+
/* @__PURE__ */ jsx26("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx26("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)) }),
|
|
4744
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4745
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
|
|
4746
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4747
|
+
/* @__PURE__ */ jsx26("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__ */ jsx26("option", { value: o.id, children: o.label }, o.id)) })
|
|
4437
4748
|
] }),
|
|
4438
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
4439
|
-
/* @__PURE__ */
|
|
4440
|
-
/* @__PURE__ */
|
|
4749
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
|
|
4750
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4751
|
+
/* @__PURE__ */ jsx26(
|
|
4441
4752
|
"input",
|
|
4442
4753
|
{
|
|
4443
4754
|
type: "number",
|
|
@@ -4458,9 +4769,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4458
4769
|
},
|
|
4459
4770
|
`${k}:${warp[k]}`
|
|
4460
4771
|
),
|
|
4461
|
-
/* @__PURE__ */
|
|
4772
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "%" })
|
|
4462
4773
|
] }, k)),
|
|
4463
|
-
/* @__PURE__ */
|
|
4774
|
+
/* @__PURE__ */ jsx26(
|
|
4464
4775
|
"button",
|
|
4465
4776
|
{
|
|
4466
4777
|
type: "button",
|
|
@@ -4472,9 +4783,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4472
4783
|
children: "Vertical"
|
|
4473
4784
|
}
|
|
4474
4785
|
),
|
|
4475
|
-
/* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
4786
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
|
|
4787
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4788
|
+
/* @__PURE__ */ jsx26(
|
|
4478
4789
|
"select",
|
|
4479
4790
|
{
|
|
4480
4791
|
"aria-label": "Warp grid",
|
|
@@ -4484,14 +4795,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4484
4795
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4485
4796
|
},
|
|
4486
4797
|
className: imageFieldClass,
|
|
4487
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
4798
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx26("option", { value: g.id, children: g.label }, g.id))
|
|
4488
4799
|
}
|
|
4489
4800
|
)
|
|
4490
4801
|
] })
|
|
4491
4802
|
] }),
|
|
4492
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
4493
|
-
/* @__PURE__ */
|
|
4494
|
-
/* @__PURE__ */
|
|
4803
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4804
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: f.label }),
|
|
4805
|
+
/* @__PURE__ */ jsx26(
|
|
4495
4806
|
"input",
|
|
4496
4807
|
{
|
|
4497
4808
|
type: "number",
|
|
@@ -4511,8 +4822,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4511
4822
|
},
|
|
4512
4823
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4513
4824
|
),
|
|
4514
|
-
/* @__PURE__ */
|
|
4515
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4825
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4826
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx26(
|
|
4516
4827
|
"button",
|
|
4517
4828
|
{
|
|
4518
4829
|
type: "button",
|
|
@@ -4527,33 +4838,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4527
4838
|
}
|
|
4528
4839
|
)
|
|
4529
4840
|
] }, f.id)),
|
|
4530
|
-
/* @__PURE__ */
|
|
4531
|
-
/* @__PURE__ */
|
|
4532
|
-
/* @__PURE__ */
|
|
4841
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
|
|
4842
|
+
/* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4843
|
+
/* @__PURE__ */ jsx26(
|
|
4533
4844
|
"select",
|
|
4534
4845
|
{
|
|
4535
4846
|
"aria-label": "Interpolation",
|
|
4536
4847
|
value: tool.interpolation,
|
|
4537
4848
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4538
4849
|
className: imageFieldClass,
|
|
4539
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4850
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx26("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4540
4851
|
}
|
|
4541
4852
|
)
|
|
4542
4853
|
] }),
|
|
4543
|
-
/* @__PURE__ */
|
|
4544
|
-
/* @__PURE__ */
|
|
4545
|
-
tool.error && /* @__PURE__ */
|
|
4854
|
+
/* @__PURE__ */ jsx26("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" }),
|
|
4855
|
+
/* @__PURE__ */ jsx26("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4856
|
+
tool.error && /* @__PURE__ */ jsx26("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4546
4857
|
] });
|
|
4547
4858
|
};
|
|
4548
4859
|
|
|
4549
4860
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4550
|
-
import { useEffect as
|
|
4861
|
+
import { useEffect as useEffect15, useState as useState24 } from "react";
|
|
4551
4862
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
4552
|
-
import { Fragment as
|
|
4863
|
+
import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4553
4864
|
var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
|
|
4554
|
-
const [, setTick] =
|
|
4555
|
-
|
|
4556
|
-
const [error, setError] =
|
|
4865
|
+
const [, setTick] = useState24(0);
|
|
4866
|
+
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4867
|
+
const [error, setError] = useState24(null);
|
|
4557
4868
|
const active = controller.getActiveLayer();
|
|
4558
4869
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4559
4870
|
const set = (change) => {
|
|
@@ -4567,22 +4878,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
4567
4878
|
}
|
|
4568
4879
|
};
|
|
4569
4880
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4570
|
-
return /* @__PURE__ */
|
|
4571
|
-
showTools && /* @__PURE__ */
|
|
4572
|
-
/* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
/* @__PURE__ */
|
|
4881
|
+
return /* @__PURE__ */ jsxs25("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4882
|
+
showTools && /* @__PURE__ */ jsx27("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4883
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4884
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4885
|
+
/* @__PURE__ */ jsx27(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
4575
4886
|
"Fill",
|
|
4576
|
-
/* @__PURE__ */
|
|
4887
|
+
/* @__PURE__ */ jsx27(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
4577
4888
|
] }),
|
|
4578
|
-
/* @__PURE__ */
|
|
4579
|
-
/* @__PURE__ */
|
|
4889
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4890
|
+
/* @__PURE__ */ jsx27(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
4580
4891
|
"Stroke",
|
|
4581
|
-
/* @__PURE__ */
|
|
4892
|
+
/* @__PURE__ */ jsx27(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4582
4893
|
] }),
|
|
4583
|
-
/* @__PURE__ */
|
|
4894
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4584
4895
|
"Width",
|
|
4585
|
-
/* @__PURE__ */
|
|
4896
|
+
/* @__PURE__ */ jsx27(
|
|
4586
4897
|
"input",
|
|
4587
4898
|
{
|
|
4588
4899
|
type: "number",
|
|
@@ -4596,52 +4907,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
4596
4907
|
)
|
|
4597
4908
|
] })
|
|
4598
4909
|
] }),
|
|
4599
|
-
/* @__PURE__ */
|
|
4600
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
4910
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4911
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4601
4912
|
"Radius",
|
|
4602
|
-
/* @__PURE__ */
|
|
4913
|
+
/* @__PURE__ */ jsx27("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}` })
|
|
4603
4914
|
] }),
|
|
4604
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4915
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4605
4916
|
"Sides",
|
|
4606
|
-
/* @__PURE__ */
|
|
4917
|
+
/* @__PURE__ */ jsx27("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}` })
|
|
4607
4918
|
] }),
|
|
4608
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4609
|
-
/* @__PURE__ */
|
|
4919
|
+
options.kind === "star" && /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
4920
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4610
4921
|
"Points",
|
|
4611
|
-
/* @__PURE__ */
|
|
4922
|
+
/* @__PURE__ */ jsx27("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}` })
|
|
4612
4923
|
] }),
|
|
4613
|
-
/* @__PURE__ */
|
|
4924
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4614
4925
|
"Inner",
|
|
4615
|
-
/* @__PURE__ */
|
|
4926
|
+
/* @__PURE__ */ jsx27(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4616
4927
|
] })
|
|
4617
4928
|
] }),
|
|
4618
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4619
|
-
/* @__PURE__ */
|
|
4929
|
+
options.kind === "line" && /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
4930
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4620
4931
|
"Weight",
|
|
4621
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsx27("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}` })
|
|
4622
4933
|
] }),
|
|
4623
|
-
/* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4934
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4935
|
+
/* @__PURE__ */ jsx27(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4625
4936
|
"Arrowhead"
|
|
4626
4937
|
] })
|
|
4627
4938
|
] })
|
|
4628
4939
|
] }),
|
|
4629
|
-
/* @__PURE__ */
|
|
4630
|
-
error && /* @__PURE__ */
|
|
4940
|
+
/* @__PURE__ */ jsx27("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." }),
|
|
4941
|
+
error && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: error })
|
|
4631
4942
|
] });
|
|
4632
4943
|
};
|
|
4633
4944
|
|
|
4634
4945
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4635
|
-
import { useEffect as
|
|
4946
|
+
import { useEffect as useEffect16, useState as useState25 } from "react";
|
|
4636
4947
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4637
|
-
import { jsx as
|
|
4948
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4638
4949
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4639
4950
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4640
4951
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4641
|
-
const [, setTick] =
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
const [error, setError] =
|
|
4952
|
+
const [, setTick] = useState25(0);
|
|
4953
|
+
useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4954
|
+
useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4955
|
+
const [error, setError] = useState25(null);
|
|
4645
4956
|
const active = controller.getActiveLayer();
|
|
4646
4957
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4647
4958
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4694,11 +5005,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4694
5005
|
setError(e instanceof Error ? e.message : String(e));
|
|
4695
5006
|
}
|
|
4696
5007
|
};
|
|
4697
|
-
return /* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
5008
|
+
return /* @__PURE__ */ jsxs26("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
5009
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5010
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4700
5011
|
"Font",
|
|
4701
|
-
/* @__PURE__ */
|
|
5012
|
+
/* @__PURE__ */ jsx28(
|
|
4702
5013
|
"input",
|
|
4703
5014
|
{
|
|
4704
5015
|
list: "pixerate-type-fonts",
|
|
@@ -4708,11 +5019,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4708
5019
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4709
5020
|
}
|
|
4710
5021
|
),
|
|
4711
|
-
/* @__PURE__ */
|
|
5022
|
+
/* @__PURE__ */ jsx28("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx28("option", { value: f }, f)) })
|
|
4712
5023
|
] }),
|
|
4713
|
-
/* @__PURE__ */
|
|
5024
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4714
5025
|
"Size",
|
|
4715
|
-
/* @__PURE__ */
|
|
5026
|
+
/* @__PURE__ */ jsx28(
|
|
4716
5027
|
"input",
|
|
4717
5028
|
{
|
|
4718
5029
|
type: "number",
|
|
@@ -4725,14 +5036,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4725
5036
|
}
|
|
4726
5037
|
)
|
|
4727
5038
|
] }),
|
|
4728
|
-
/* @__PURE__ */
|
|
4729
|
-
/* @__PURE__ */
|
|
4730
|
-
/* @__PURE__ */
|
|
5039
|
+
/* @__PURE__ */ jsx28("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" }),
|
|
5040
|
+
/* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
5041
|
+
/* @__PURE__ */ jsx28(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
4731
5042
|
] }),
|
|
4732
|
-
/* @__PURE__ */
|
|
4733
|
-
/* @__PURE__ */
|
|
4734
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4735
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
5043
|
+
/* @__PURE__ */ jsx28("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
5044
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
5045
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
5046
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx28(
|
|
4736
5047
|
"button",
|
|
4737
5048
|
{
|
|
4738
5049
|
type: "button",
|
|
@@ -4744,19 +5055,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4744
5055
|
}
|
|
4745
5056
|
)
|
|
4746
5057
|
] }),
|
|
4747
|
-
/* @__PURE__ */
|
|
4748
|
-
missing.length > 0 && /* @__PURE__ */
|
|
5058
|
+
/* @__PURE__ */ jsx28("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." }),
|
|
5059
|
+
missing.length > 0 && /* @__PURE__ */ jsxs26("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4749
5060
|
"Missing ",
|
|
4750
5061
|
missing.length === 1 ? "font" : "fonts",
|
|
4751
5062
|
": ",
|
|
4752
5063
|
missing.join(", ")
|
|
4753
5064
|
] }),
|
|
4754
|
-
error && /* @__PURE__ */
|
|
5065
|
+
error && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: error })
|
|
4755
5066
|
] });
|
|
4756
5067
|
};
|
|
4757
5068
|
|
|
4758
5069
|
// src/image-editor/ImageEditor.tsx
|
|
4759
|
-
import { Fragment as
|
|
5070
|
+
import { Fragment as Fragment10, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4760
5071
|
var ImageEditor = ({
|
|
4761
5072
|
editor: externalEditor,
|
|
4762
5073
|
src,
|
|
@@ -4781,32 +5092,32 @@ var ImageEditor = ({
|
|
|
4781
5092
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4782
5093
|
});
|
|
4783
5094
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4784
|
-
const [activeTab, setActiveTab] =
|
|
4785
|
-
const rootRef =
|
|
5095
|
+
const [activeTab, setActiveTab] = useState26("crop");
|
|
5096
|
+
const rootRef = useRef13(null);
|
|
4786
5097
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4787
|
-
const activeTabRef =
|
|
5098
|
+
const activeTabRef = useRef13(activeTab);
|
|
4788
5099
|
activeTabRef.current = activeTab;
|
|
4789
5100
|
const openPanel = async (ref) => {
|
|
4790
5101
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
4791
5102
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4792
5103
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4793
5104
|
};
|
|
4794
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
4795
|
-
const [selectionOptions, setSelectionOptions] =
|
|
4796
|
-
const [shapeOptions, setShapeOptions] =
|
|
4797
|
-
const [typeOptions, setTypeOptions] =
|
|
4798
|
-
const [typeSession, setTypeSession] =
|
|
4799
|
-
const [selectionError, setSelectionError] =
|
|
4800
|
-
const [paintError, setPaintError] =
|
|
4801
|
-
const [shapeTypeError, setShapeTypeError] =
|
|
5105
|
+
const [activeCropRatio, setActiveCropRatio] = useState26(null);
|
|
5106
|
+
const [selectionOptions, setSelectionOptions] = useState26(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
5107
|
+
const [shapeOptions, setShapeOptions] = useState26(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
5108
|
+
const [typeOptions, setTypeOptions] = useState26(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
5109
|
+
const [typeSession, setTypeSession] = useState26(null);
|
|
5110
|
+
const [selectionError, setSelectionError] = useState26(null);
|
|
5111
|
+
const [paintError, setPaintError] = useState26(null);
|
|
5112
|
+
const [shapeTypeError, setShapeTypeError] = useState26(null);
|
|
4802
5113
|
const handleCanvasError = (source, message) => {
|
|
4803
5114
|
if (source === "paint") setPaintError(message);
|
|
4804
5115
|
else if (source === "select") setSelectionError(message);
|
|
4805
5116
|
else setShapeTypeError(message);
|
|
4806
5117
|
};
|
|
4807
5118
|
const finishTyping = () => setTypeSession(null);
|
|
4808
|
-
const transformToolRef =
|
|
4809
|
-
const transformControllerRef =
|
|
5119
|
+
const transformToolRef = useRef13(null);
|
|
5120
|
+
const transformControllerRef = useRef13(controller);
|
|
4810
5121
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
4811
5122
|
transformToolRef.current?.cancel();
|
|
4812
5123
|
transformToolRef.current = new FreeTransformTool2(controller, {
|
|
@@ -4815,16 +5126,16 @@ var ImageEditor = ({
|
|
|
4815
5126
|
transformControllerRef.current = controller;
|
|
4816
5127
|
}
|
|
4817
5128
|
const transformTool = transformToolRef.current;
|
|
4818
|
-
const [, setTransformTick] =
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
4822
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
4823
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
4824
|
-
const [isInpainting, setIsInpainting] =
|
|
4825
|
-
const [aiError, setAiError] =
|
|
4826
|
-
const [aiSuccess, setAiSuccess] =
|
|
4827
|
-
const [aiTarget, setAiTarget] =
|
|
5129
|
+
const [, setTransformTick] = useState26(0);
|
|
5130
|
+
useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
5131
|
+
useEffect17(() => () => transformToolRef.current?.cancel(), []);
|
|
5132
|
+
const [inpaintPrompt, setInpaintPrompt] = useState26("");
|
|
5133
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState26("annotations");
|
|
5134
|
+
const [isRemovingBg, setIsRemovingBg] = useState26(false);
|
|
5135
|
+
const [isInpainting, setIsInpainting] = useState26(false);
|
|
5136
|
+
const [aiError, setAiError] = useState26(null);
|
|
5137
|
+
const [aiSuccess, setAiSuccess] = useState26(null);
|
|
5138
|
+
const [aiTarget, setAiTarget] = useState26("auto");
|
|
4828
5139
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4829
5140
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4830
5141
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4887,11 +5198,11 @@ var ImageEditor = ({
|
|
|
4887
5198
|
setIsInpainting(false);
|
|
4888
5199
|
}
|
|
4889
5200
|
};
|
|
4890
|
-
const [activeColor, setActiveColor] =
|
|
4891
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4892
|
-
const [fontSize, setFontSize] =
|
|
4893
|
-
const [textInput, setTextInput] =
|
|
4894
|
-
|
|
5201
|
+
const [activeColor, setActiveColor] = useState26("#ef4444");
|
|
5202
|
+
const [strokeWidth, setStrokeWidth] = useState26(3);
|
|
5203
|
+
const [fontSize, setFontSize] = useState26(24);
|
|
5204
|
+
const [textInput, setTextInput] = useState26("");
|
|
5205
|
+
useEffect17(() => {
|
|
4895
5206
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4896
5207
|
editor.setTool("crop");
|
|
4897
5208
|
}
|
|
@@ -4919,16 +5230,16 @@ var ImageEditor = ({
|
|
|
4919
5230
|
link.click();
|
|
4920
5231
|
}
|
|
4921
5232
|
};
|
|
4922
|
-
return /* @__PURE__ */
|
|
5233
|
+
return /* @__PURE__ */ jsxs27(
|
|
4923
5234
|
"div",
|
|
4924
5235
|
{
|
|
4925
5236
|
ref: rootRef,
|
|
4926
5237
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4927
5238
|
style,
|
|
4928
5239
|
children: [
|
|
4929
|
-
/* @__PURE__ */
|
|
4930
|
-
/* @__PURE__ */
|
|
4931
|
-
/* @__PURE__ */
|
|
5240
|
+
/* @__PURE__ */ jsxs27("div", { className: imageEditorHeaderClass, children: [
|
|
5241
|
+
/* @__PURE__ */ jsxs27("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5242
|
+
/* @__PURE__ */ jsx29(
|
|
4932
5243
|
"button",
|
|
4933
5244
|
{
|
|
4934
5245
|
type: "button",
|
|
@@ -4943,7 +5254,7 @@ var ImageEditor = ({
|
|
|
4943
5254
|
children: "Transform & Crop"
|
|
4944
5255
|
}
|
|
4945
5256
|
),
|
|
4946
|
-
/* @__PURE__ */
|
|
5257
|
+
/* @__PURE__ */ jsx29(
|
|
4947
5258
|
"button",
|
|
4948
5259
|
{
|
|
4949
5260
|
type: "button",
|
|
@@ -4958,7 +5269,7 @@ var ImageEditor = ({
|
|
|
4958
5269
|
children: "Adjustments"
|
|
4959
5270
|
}
|
|
4960
5271
|
),
|
|
4961
|
-
/* @__PURE__ */
|
|
5272
|
+
/* @__PURE__ */ jsx29(
|
|
4962
5273
|
"button",
|
|
4963
5274
|
{
|
|
4964
5275
|
type: "button",
|
|
@@ -4973,7 +5284,7 @@ var ImageEditor = ({
|
|
|
4973
5284
|
children: "Layers"
|
|
4974
5285
|
}
|
|
4975
5286
|
),
|
|
4976
|
-
/* @__PURE__ */
|
|
5287
|
+
/* @__PURE__ */ jsx29(
|
|
4977
5288
|
"button",
|
|
4978
5289
|
{
|
|
4979
5290
|
type: "button",
|
|
@@ -4988,7 +5299,7 @@ var ImageEditor = ({
|
|
|
4988
5299
|
children: "Paint"
|
|
4989
5300
|
}
|
|
4990
5301
|
),
|
|
4991
|
-
/* @__PURE__ */
|
|
5302
|
+
/* @__PURE__ */ jsx29(
|
|
4992
5303
|
"button",
|
|
4993
5304
|
{
|
|
4994
5305
|
type: "button",
|
|
@@ -5003,7 +5314,7 @@ var ImageEditor = ({
|
|
|
5003
5314
|
children: "Select & Mask"
|
|
5004
5315
|
}
|
|
5005
5316
|
),
|
|
5006
|
-
/* @__PURE__ */
|
|
5317
|
+
/* @__PURE__ */ jsx29(
|
|
5007
5318
|
"button",
|
|
5008
5319
|
{
|
|
5009
5320
|
type: "button",
|
|
@@ -5018,7 +5329,7 @@ var ImageEditor = ({
|
|
|
5018
5329
|
children: "Annotations"
|
|
5019
5330
|
}
|
|
5020
5331
|
),
|
|
5021
|
-
/* @__PURE__ */
|
|
5332
|
+
/* @__PURE__ */ jsx29(
|
|
5022
5333
|
"button",
|
|
5023
5334
|
{
|
|
5024
5335
|
type: "button",
|
|
@@ -5033,7 +5344,7 @@ var ImageEditor = ({
|
|
|
5033
5344
|
children: "Depth Mask"
|
|
5034
5345
|
}
|
|
5035
5346
|
),
|
|
5036
|
-
/* @__PURE__ */
|
|
5347
|
+
/* @__PURE__ */ jsxs27(
|
|
5037
5348
|
"button",
|
|
5038
5349
|
{
|
|
5039
5350
|
type: "button",
|
|
@@ -5046,14 +5357,14 @@ var ImageEditor = ({
|
|
|
5046
5357
|
"aria-selected": activeTab === "ai",
|
|
5047
5358
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5048
5359
|
children: [
|
|
5049
|
-
/* @__PURE__ */
|
|
5360
|
+
/* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
|
|
5050
5361
|
"AI Tools"
|
|
5051
5362
|
]
|
|
5052
5363
|
}
|
|
5053
5364
|
)
|
|
5054
5365
|
] }),
|
|
5055
|
-
/* @__PURE__ */
|
|
5056
|
-
/* @__PURE__ */
|
|
5366
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
5367
|
+
/* @__PURE__ */ jsx29(
|
|
5057
5368
|
"button",
|
|
5058
5369
|
{
|
|
5059
5370
|
type: "button",
|
|
@@ -5064,7 +5375,7 @@ var ImageEditor = ({
|
|
|
5064
5375
|
children: "\u21A9"
|
|
5065
5376
|
}
|
|
5066
5377
|
),
|
|
5067
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsx29(
|
|
5068
5379
|
"button",
|
|
5069
5380
|
{
|
|
5070
5381
|
type: "button",
|
|
@@ -5075,7 +5386,7 @@ var ImageEditor = ({
|
|
|
5075
5386
|
children: "\u21AA"
|
|
5076
5387
|
}
|
|
5077
5388
|
),
|
|
5078
|
-
/* @__PURE__ */
|
|
5389
|
+
/* @__PURE__ */ jsx29(
|
|
5079
5390
|
"button",
|
|
5080
5391
|
{
|
|
5081
5392
|
type: "button",
|
|
@@ -5084,8 +5395,8 @@ var ImageEditor = ({
|
|
|
5084
5395
|
children: "Reset"
|
|
5085
5396
|
}
|
|
5086
5397
|
),
|
|
5087
|
-
/* @__PURE__ */
|
|
5088
|
-
/* @__PURE__ */
|
|
5398
|
+
/* @__PURE__ */ jsx29("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5399
|
+
/* @__PURE__ */ jsx29(
|
|
5089
5400
|
"button",
|
|
5090
5401
|
{
|
|
5091
5402
|
type: "button",
|
|
@@ -5095,11 +5406,11 @@ var ImageEditor = ({
|
|
|
5095
5406
|
children: "-"
|
|
5096
5407
|
}
|
|
5097
5408
|
),
|
|
5098
|
-
/* @__PURE__ */
|
|
5409
|
+
/* @__PURE__ */ jsxs27("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5099
5410
|
Math.round(state.zoom * 100),
|
|
5100
5411
|
"%"
|
|
5101
5412
|
] }),
|
|
5102
|
-
/* @__PURE__ */
|
|
5413
|
+
/* @__PURE__ */ jsx29(
|
|
5103
5414
|
"button",
|
|
5104
5415
|
{
|
|
5105
5416
|
type: "button",
|
|
@@ -5109,8 +5420,8 @@ var ImageEditor = ({
|
|
|
5109
5420
|
children: "+"
|
|
5110
5421
|
}
|
|
5111
5422
|
),
|
|
5112
|
-
/* @__PURE__ */
|
|
5113
|
-
/* @__PURE__ */
|
|
5423
|
+
/* @__PURE__ */ jsx29("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5424
|
+
/* @__PURE__ */ jsx29(
|
|
5114
5425
|
"button",
|
|
5115
5426
|
{
|
|
5116
5427
|
type: "button",
|
|
@@ -5121,7 +5432,7 @@ var ImageEditor = ({
|
|
|
5121
5432
|
children: "Hold Compare"
|
|
5122
5433
|
}
|
|
5123
5434
|
),
|
|
5124
|
-
/* @__PURE__ */
|
|
5435
|
+
/* @__PURE__ */ jsx29(
|
|
5125
5436
|
"button",
|
|
5126
5437
|
{
|
|
5127
5438
|
type: "button",
|
|
@@ -5132,10 +5443,10 @@ var ImageEditor = ({
|
|
|
5132
5443
|
)
|
|
5133
5444
|
] })
|
|
5134
5445
|
] }),
|
|
5135
|
-
transformTool.active && /* @__PURE__ */
|
|
5136
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
5137
|
-
/* @__PURE__ */
|
|
5138
|
-
/* @__PURE__ */
|
|
5446
|
+
transformTool.active && /* @__PURE__ */ jsx29(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5447
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx29("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5448
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5449
|
+
/* @__PURE__ */ jsx29(
|
|
5139
5450
|
ImageEditorCanvas,
|
|
5140
5451
|
{
|
|
5141
5452
|
editor,
|
|
@@ -5159,11 +5470,11 @@ var ImageEditor = ({
|
|
|
5159
5470
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5160
5471
|
}
|
|
5161
5472
|
),
|
|
5162
|
-
/* @__PURE__ */
|
|
5163
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
5164
|
-
/* @__PURE__ */
|
|
5165
|
-
/* @__PURE__ */
|
|
5166
|
-
/* @__PURE__ */
|
|
5473
|
+
/* @__PURE__ */ jsxs27("div", { className: imageSidebarClass, children: [
|
|
5474
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5475
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5476
|
+
/* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5477
|
+
/* @__PURE__ */ jsx29(
|
|
5167
5478
|
"button",
|
|
5168
5479
|
{
|
|
5169
5480
|
type: "button",
|
|
@@ -5175,7 +5486,7 @@ var ImageEditor = ({
|
|
|
5175
5486
|
children: "Freeform"
|
|
5176
5487
|
}
|
|
5177
5488
|
),
|
|
5178
|
-
/* @__PURE__ */
|
|
5489
|
+
/* @__PURE__ */ jsx29(
|
|
5179
5490
|
"button",
|
|
5180
5491
|
{
|
|
5181
5492
|
type: "button",
|
|
@@ -5187,7 +5498,7 @@ var ImageEditor = ({
|
|
|
5187
5498
|
children: "1:1 Square"
|
|
5188
5499
|
}
|
|
5189
5500
|
),
|
|
5190
|
-
/* @__PURE__ */
|
|
5501
|
+
/* @__PURE__ */ jsx29(
|
|
5191
5502
|
"button",
|
|
5192
5503
|
{
|
|
5193
5504
|
type: "button",
|
|
@@ -5199,7 +5510,7 @@ var ImageEditor = ({
|
|
|
5199
5510
|
children: "4:3 Standard"
|
|
5200
5511
|
}
|
|
5201
5512
|
),
|
|
5202
|
-
/* @__PURE__ */
|
|
5513
|
+
/* @__PURE__ */ jsx29(
|
|
5203
5514
|
"button",
|
|
5204
5515
|
{
|
|
5205
5516
|
type: "button",
|
|
@@ -5211,7 +5522,7 @@ var ImageEditor = ({
|
|
|
5211
5522
|
children: "16:9 Wide"
|
|
5212
5523
|
}
|
|
5213
5524
|
),
|
|
5214
|
-
/* @__PURE__ */
|
|
5525
|
+
/* @__PURE__ */ jsx29(
|
|
5215
5526
|
"button",
|
|
5216
5527
|
{
|
|
5217
5528
|
type: "button",
|
|
@@ -5223,7 +5534,7 @@ var ImageEditor = ({
|
|
|
5223
5534
|
children: "3:2 Photo"
|
|
5224
5535
|
}
|
|
5225
5536
|
),
|
|
5226
|
-
/* @__PURE__ */
|
|
5537
|
+
/* @__PURE__ */ jsx29(
|
|
5227
5538
|
"button",
|
|
5228
5539
|
{
|
|
5229
5540
|
type: "button",
|
|
@@ -5236,10 +5547,10 @@ var ImageEditor = ({
|
|
|
5236
5547
|
}
|
|
5237
5548
|
)
|
|
5238
5549
|
] }),
|
|
5239
|
-
/* @__PURE__ */
|
|
5240
|
-
/* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5242
|
-
/* @__PURE__ */
|
|
5550
|
+
/* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
|
|
5551
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5552
|
+
/* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5553
|
+
/* @__PURE__ */ jsx29(
|
|
5243
5554
|
"button",
|
|
5244
5555
|
{
|
|
5245
5556
|
type: "button",
|
|
@@ -5248,7 +5559,7 @@ var ImageEditor = ({
|
|
|
5248
5559
|
children: "Rotate -90\xB0"
|
|
5249
5560
|
}
|
|
5250
5561
|
),
|
|
5251
|
-
/* @__PURE__ */
|
|
5562
|
+
/* @__PURE__ */ jsx29(
|
|
5252
5563
|
"button",
|
|
5253
5564
|
{
|
|
5254
5565
|
type: "button",
|
|
@@ -5257,7 +5568,7 @@ var ImageEditor = ({
|
|
|
5257
5568
|
children: "Rotate +90\xB0"
|
|
5258
5569
|
}
|
|
5259
5570
|
),
|
|
5260
|
-
/* @__PURE__ */
|
|
5571
|
+
/* @__PURE__ */ jsx29(
|
|
5261
5572
|
"button",
|
|
5262
5573
|
{
|
|
5263
5574
|
type: "button",
|
|
@@ -5266,7 +5577,7 @@ var ImageEditor = ({
|
|
|
5266
5577
|
children: "Flip Horizontal"
|
|
5267
5578
|
}
|
|
5268
5579
|
),
|
|
5269
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsx29(
|
|
5270
5581
|
"button",
|
|
5271
5582
|
{
|
|
5272
5583
|
type: "button",
|
|
@@ -5277,10 +5588,10 @@ var ImageEditor = ({
|
|
|
5277
5588
|
)
|
|
5278
5589
|
] })
|
|
5279
5590
|
] }),
|
|
5280
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
5281
|
-
/* @__PURE__ */
|
|
5282
|
-
/* @__PURE__ */
|
|
5283
|
-
/* @__PURE__ */
|
|
5591
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5592
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
5593
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5594
|
+
/* @__PURE__ */ jsx29(
|
|
5284
5595
|
"button",
|
|
5285
5596
|
{
|
|
5286
5597
|
type: "button",
|
|
@@ -5290,9 +5601,9 @@ var ImageEditor = ({
|
|
|
5290
5601
|
}
|
|
5291
5602
|
)
|
|
5292
5603
|
] }),
|
|
5293
|
-
/* @__PURE__ */
|
|
5294
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
5295
|
-
/* @__PURE__ */
|
|
5604
|
+
/* @__PURE__ */ jsx29(Histogram, { histogram: editor.histogram }),
|
|
5605
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs27(React25.Fragment, { children: [
|
|
5606
|
+
/* @__PURE__ */ jsx29(
|
|
5296
5607
|
ControlSlider,
|
|
5297
5608
|
{
|
|
5298
5609
|
spec,
|
|
@@ -5301,14 +5612,14 @@ var ImageEditor = ({
|
|
|
5301
5612
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5302
5613
|
}
|
|
5303
5614
|
),
|
|
5304
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
5615
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs27(
|
|
5305
5616
|
"div",
|
|
5306
5617
|
{
|
|
5307
5618
|
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",
|
|
5308
5619
|
"data-testid": "image-editor-process-notice",
|
|
5309
5620
|
children: [
|
|
5310
|
-
/* @__PURE__ */
|
|
5311
|
-
/* @__PURE__ */
|
|
5621
|
+
/* @__PURE__ */ jsx29("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5622
|
+
/* @__PURE__ */ jsx29(
|
|
5312
5623
|
"button",
|
|
5313
5624
|
{
|
|
5314
5625
|
type: "button",
|
|
@@ -5321,7 +5632,7 @@ var ImageEditor = ({
|
|
|
5321
5632
|
}
|
|
5322
5633
|
)
|
|
5323
5634
|
] }, spec.id)),
|
|
5324
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx29("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx29(
|
|
5325
5636
|
AdjustmentLayersPanel,
|
|
5326
5637
|
{
|
|
5327
5638
|
controller,
|
|
@@ -5330,9 +5641,9 @@ var ImageEditor = ({
|
|
|
5330
5641
|
}
|
|
5331
5642
|
) })
|
|
5332
5643
|
] }),
|
|
5333
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
5334
|
-
/* @__PURE__ */
|
|
5335
|
-
/* @__PURE__ */
|
|
5644
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5645
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5646
|
+
/* @__PURE__ */ jsx29(
|
|
5336
5647
|
"button",
|
|
5337
5648
|
{
|
|
5338
5649
|
type: "button",
|
|
@@ -5343,15 +5654,15 @@ var ImageEditor = ({
|
|
|
5343
5654
|
children: "Free Transform"
|
|
5344
5655
|
}
|
|
5345
5656
|
),
|
|
5346
|
-
/* @__PURE__ */
|
|
5347
|
-
effectsShown && /* @__PURE__ */
|
|
5348
|
-
/* @__PURE__ */
|
|
5349
|
-
/* @__PURE__ */
|
|
5657
|
+
/* @__PURE__ */ jsx29(LayersPanel, { controller }),
|
|
5658
|
+
effectsShown && /* @__PURE__ */ jsx29(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5659
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5660
|
+
/* @__PURE__ */ jsx29(ColorProfilePanel, { controller })
|
|
5350
5661
|
] }),
|
|
5351
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
5352
|
-
/* @__PURE__ */
|
|
5353
|
-
/* @__PURE__ */
|
|
5354
|
-
/* @__PURE__ */
|
|
5662
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5663
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5664
|
+
/* @__PURE__ */ jsx29(BrushOptionsBar, { controller }),
|
|
5665
|
+
/* @__PURE__ */ jsx29(
|
|
5355
5666
|
"button",
|
|
5356
5667
|
{
|
|
5357
5668
|
type: "button",
|
|
@@ -5362,12 +5673,12 @@ var ImageEditor = ({
|
|
|
5362
5673
|
children: "Free Transform"
|
|
5363
5674
|
}
|
|
5364
5675
|
),
|
|
5365
|
-
paintError && /* @__PURE__ */
|
|
5366
|
-
/* @__PURE__ */
|
|
5676
|
+
paintError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5677
|
+
/* @__PURE__ */ jsx29("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx29(LayersPanel, { controller }) })
|
|
5367
5678
|
] }),
|
|
5368
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5370
|
-
/* @__PURE__ */
|
|
5679
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5680
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
5681
|
+
/* @__PURE__ */ jsx29("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx29(
|
|
5371
5682
|
"button",
|
|
5372
5683
|
{
|
|
5373
5684
|
type: "button",
|
|
@@ -5378,13 +5689,13 @@ var ImageEditor = ({
|
|
|
5378
5689
|
},
|
|
5379
5690
|
t
|
|
5380
5691
|
)) }),
|
|
5381
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
5382
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
5383
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
5384
|
-
shapeTypeError && /* @__PURE__ */
|
|
5385
|
-
/* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5387
|
-
/* @__PURE__ */
|
|
5692
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx29(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5693
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx29(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5694
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx29("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" }),
|
|
5695
|
+
shapeTypeError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5696
|
+
/* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
|
|
5697
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5698
|
+
/* @__PURE__ */ jsx29("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx29(
|
|
5388
5699
|
"button",
|
|
5389
5700
|
{
|
|
5390
5701
|
type: "button",
|
|
@@ -5394,18 +5705,18 @@ var ImageEditor = ({
|
|
|
5394
5705
|
},
|
|
5395
5706
|
t
|
|
5396
5707
|
)) }),
|
|
5397
|
-
/* @__PURE__ */
|
|
5398
|
-
/* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5400
|
-
/* @__PURE__ */
|
|
5401
|
-
/* @__PURE__ */
|
|
5402
|
-
/* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5708
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5709
|
+
/* @__PURE__ */ jsx29("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5710
|
+
/* @__PURE__ */ jsx29(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
5711
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex-1 ml-2", children: [
|
|
5712
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5713
|
+
/* @__PURE__ */ jsx29("span", { children: "Width:" }),
|
|
5714
|
+
/* @__PURE__ */ jsxs27("span", { className: "font-mono", children: [
|
|
5404
5715
|
strokeWidth,
|
|
5405
5716
|
"px"
|
|
5406
5717
|
] })
|
|
5407
5718
|
] }),
|
|
5408
|
-
/* @__PURE__ */
|
|
5719
|
+
/* @__PURE__ */ jsx29(
|
|
5409
5720
|
"input",
|
|
5410
5721
|
{
|
|
5411
5722
|
type: "range",
|
|
@@ -5418,10 +5729,10 @@ var ImageEditor = ({
|
|
|
5418
5729
|
)
|
|
5419
5730
|
] })
|
|
5420
5731
|
] }),
|
|
5421
|
-
/* @__PURE__ */
|
|
5422
|
-
/* @__PURE__ */
|
|
5423
|
-
/* @__PURE__ */
|
|
5424
|
-
/* @__PURE__ */
|
|
5732
|
+
/* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
|
|
5733
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5734
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
|
|
5735
|
+
/* @__PURE__ */ jsx29(
|
|
5425
5736
|
"input",
|
|
5426
5737
|
{
|
|
5427
5738
|
type: "text",
|
|
@@ -5432,7 +5743,7 @@ var ImageEditor = ({
|
|
|
5432
5743
|
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"
|
|
5433
5744
|
}
|
|
5434
5745
|
),
|
|
5435
|
-
/* @__PURE__ */
|
|
5746
|
+
/* @__PURE__ */ jsx29(
|
|
5436
5747
|
"button",
|
|
5437
5748
|
{
|
|
5438
5749
|
type: "button",
|
|
@@ -5442,14 +5753,14 @@ var ImageEditor = ({
|
|
|
5442
5753
|
}
|
|
5443
5754
|
)
|
|
5444
5755
|
] }),
|
|
5445
|
-
/* @__PURE__ */
|
|
5446
|
-
/* @__PURE__ */
|
|
5447
|
-
/* @__PURE__ */
|
|
5756
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5757
|
+
/* @__PURE__ */ jsx29("span", { children: "Font Size:" }),
|
|
5758
|
+
/* @__PURE__ */ jsxs27("span", { className: "font-mono", children: [
|
|
5448
5759
|
fontSize,
|
|
5449
5760
|
"px"
|
|
5450
5761
|
] })
|
|
5451
5762
|
] }),
|
|
5452
|
-
/* @__PURE__ */
|
|
5763
|
+
/* @__PURE__ */ jsx29(
|
|
5453
5764
|
"input",
|
|
5454
5765
|
{
|
|
5455
5766
|
type: "range",
|
|
@@ -5460,14 +5771,14 @@ var ImageEditor = ({
|
|
|
5460
5771
|
className: imageRangeClass
|
|
5461
5772
|
}
|
|
5462
5773
|
),
|
|
5463
|
-
/* @__PURE__ */
|
|
5464
|
-
/* @__PURE__ */
|
|
5465
|
-
/* @__PURE__ */
|
|
5774
|
+
/* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
|
|
5775
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
5776
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-muted-foreground", children: [
|
|
5466
5777
|
"Layers (",
|
|
5467
5778
|
state.annotations.length,
|
|
5468
5779
|
")"
|
|
5469
5780
|
] }),
|
|
5470
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5781
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx29(
|
|
5471
5782
|
"button",
|
|
5472
5783
|
{
|
|
5473
5784
|
type: "button",
|
|
@@ -5476,7 +5787,7 @@ var ImageEditor = ({
|
|
|
5476
5787
|
children: "Delete Selected"
|
|
5477
5788
|
}
|
|
5478
5789
|
),
|
|
5479
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5790
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx29(
|
|
5480
5791
|
"button",
|
|
5481
5792
|
{
|
|
5482
5793
|
type: "button",
|
|
@@ -5487,10 +5798,10 @@ var ImageEditor = ({
|
|
|
5487
5798
|
)
|
|
5488
5799
|
] })
|
|
5489
5800
|
] }),
|
|
5490
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
5491
|
-
/* @__PURE__ */
|
|
5492
|
-
/* @__PURE__ */
|
|
5493
|
-
/* @__PURE__ */
|
|
5801
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5802
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
5803
|
+
/* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5804
|
+
/* @__PURE__ */ jsx29(
|
|
5494
5805
|
"button",
|
|
5495
5806
|
{
|
|
5496
5807
|
type: "button",
|
|
@@ -5500,8 +5811,8 @@ var ImageEditor = ({
|
|
|
5500
5811
|
}
|
|
5501
5812
|
)
|
|
5502
5813
|
] }),
|
|
5503
|
-
/* @__PURE__ */
|
|
5504
|
-
/* @__PURE__ */
|
|
5814
|
+
/* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5815
|
+
/* @__PURE__ */ jsx29(
|
|
5505
5816
|
"input",
|
|
5506
5817
|
{
|
|
5507
5818
|
type: "checkbox",
|
|
@@ -5510,12 +5821,12 @@ var ImageEditor = ({
|
|
|
5510
5821
|
className: "rounded accent-primary"
|
|
5511
5822
|
}
|
|
5512
5823
|
),
|
|
5513
|
-
/* @__PURE__ */
|
|
5824
|
+
/* @__PURE__ */ jsx29("span", { children: "Enable Depth / Alpha Mask" })
|
|
5514
5825
|
] }),
|
|
5515
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
5516
|
-
/* @__PURE__ */
|
|
5517
|
-
/* @__PURE__ */
|
|
5518
|
-
/* @__PURE__ */
|
|
5826
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
5827
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5828
|
+
/* @__PURE__ */ jsx29("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5829
|
+
/* @__PURE__ */ jsx29(
|
|
5519
5830
|
"input",
|
|
5520
5831
|
{
|
|
5521
5832
|
type: "text",
|
|
@@ -5526,8 +5837,8 @@ var ImageEditor = ({
|
|
|
5526
5837
|
}
|
|
5527
5838
|
)
|
|
5528
5839
|
] }),
|
|
5529
|
-
/* @__PURE__ */
|
|
5530
|
-
/* @__PURE__ */
|
|
5840
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
|
|
5841
|
+
/* @__PURE__ */ jsx29(
|
|
5531
5842
|
"button",
|
|
5532
5843
|
{
|
|
5533
5844
|
type: "button",
|
|
@@ -5536,7 +5847,7 @@ var ImageEditor = ({
|
|
|
5536
5847
|
children: "Threshold Mode"
|
|
5537
5848
|
}
|
|
5538
5849
|
),
|
|
5539
|
-
/* @__PURE__ */
|
|
5850
|
+
/* @__PURE__ */ jsx29(
|
|
5540
5851
|
"button",
|
|
5541
5852
|
{
|
|
5542
5853
|
type: "button",
|
|
@@ -5546,12 +5857,12 @@ var ImageEditor = ({
|
|
|
5546
5857
|
}
|
|
5547
5858
|
)
|
|
5548
5859
|
] }),
|
|
5549
|
-
/* @__PURE__ */
|
|
5550
|
-
/* @__PURE__ */
|
|
5551
|
-
/* @__PURE__ */
|
|
5552
|
-
/* @__PURE__ */
|
|
5860
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5861
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5862
|
+
/* @__PURE__ */ jsx29("span", { children: "Depth Start (Lower):" }),
|
|
5863
|
+
/* @__PURE__ */ jsx29("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5553
5864
|
] }),
|
|
5554
|
-
/* @__PURE__ */
|
|
5865
|
+
/* @__PURE__ */ jsx29(
|
|
5555
5866
|
"input",
|
|
5556
5867
|
{
|
|
5557
5868
|
type: "range",
|
|
@@ -5565,12 +5876,12 @@ var ImageEditor = ({
|
|
|
5565
5876
|
}
|
|
5566
5877
|
)
|
|
5567
5878
|
] }),
|
|
5568
|
-
/* @__PURE__ */
|
|
5569
|
-
/* @__PURE__ */
|
|
5570
|
-
/* @__PURE__ */
|
|
5571
|
-
/* @__PURE__ */
|
|
5879
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5880
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5881
|
+
/* @__PURE__ */ jsx29("span", { children: "Depth Stop (Upper):" }),
|
|
5882
|
+
/* @__PURE__ */ jsx29("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5572
5883
|
] }),
|
|
5573
|
-
/* @__PURE__ */
|
|
5884
|
+
/* @__PURE__ */ jsx29(
|
|
5574
5885
|
"input",
|
|
5575
5886
|
{
|
|
5576
5887
|
type: "range",
|
|
@@ -5584,12 +5895,12 @@ var ImageEditor = ({
|
|
|
5584
5895
|
}
|
|
5585
5896
|
)
|
|
5586
5897
|
] }),
|
|
5587
|
-
/* @__PURE__ */
|
|
5588
|
-
/* @__PURE__ */
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5898
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
5899
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5900
|
+
/* @__PURE__ */ jsx29("span", { children: "Softness:" }),
|
|
5901
|
+
/* @__PURE__ */ jsx29("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5591
5902
|
] }),
|
|
5592
|
-
/* @__PURE__ */
|
|
5903
|
+
/* @__PURE__ */ jsx29(
|
|
5593
5904
|
"input",
|
|
5594
5905
|
{
|
|
5595
5906
|
type: "range",
|
|
@@ -5601,8 +5912,8 @@ var ImageEditor = ({
|
|
|
5601
5912
|
}
|
|
5602
5913
|
)
|
|
5603
5914
|
] }),
|
|
5604
|
-
/* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5915
|
+
/* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5916
|
+
/* @__PURE__ */ jsx29(
|
|
5606
5917
|
"input",
|
|
5607
5918
|
{
|
|
5608
5919
|
type: "checkbox",
|
|
@@ -5611,12 +5922,12 @@ var ImageEditor = ({
|
|
|
5611
5922
|
className: "rounded accent-primary"
|
|
5612
5923
|
}
|
|
5613
5924
|
),
|
|
5614
|
-
/* @__PURE__ */
|
|
5925
|
+
/* @__PURE__ */ jsx29("span", { children: "Invert Mask" })
|
|
5615
5926
|
] })
|
|
5616
5927
|
] })
|
|
5617
5928
|
] }),
|
|
5618
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5619
|
-
/* @__PURE__ */
|
|
5929
|
+
activeTab === "select" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5930
|
+
/* @__PURE__ */ jsx29(
|
|
5620
5931
|
SelectionOptionsBar,
|
|
5621
5932
|
{
|
|
5622
5933
|
controller,
|
|
@@ -5627,9 +5938,9 @@ var ImageEditor = ({
|
|
|
5627
5938
|
selectionDisplay: state.selectionDisplay
|
|
5628
5939
|
}
|
|
5629
5940
|
),
|
|
5630
|
-
selectionError && /* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5632
|
-
/* @__PURE__ */
|
|
5941
|
+
selectionError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5942
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex gap-1", children: [
|
|
5943
|
+
/* @__PURE__ */ jsx29(
|
|
5633
5944
|
"button",
|
|
5634
5945
|
{
|
|
5635
5946
|
type: "button",
|
|
@@ -5640,7 +5951,7 @@ var ImageEditor = ({
|
|
|
5640
5951
|
children: "Transform Selection"
|
|
5641
5952
|
}
|
|
5642
5953
|
),
|
|
5643
|
-
/* @__PURE__ */
|
|
5954
|
+
/* @__PURE__ */ jsx29(
|
|
5644
5955
|
"button",
|
|
5645
5956
|
{
|
|
5646
5957
|
type: "button",
|
|
@@ -5652,14 +5963,14 @@ var ImageEditor = ({
|
|
|
5652
5963
|
}
|
|
5653
5964
|
)
|
|
5654
5965
|
] }),
|
|
5655
|
-
/* @__PURE__ */
|
|
5656
|
-
/* @__PURE__ */
|
|
5657
|
-
/* @__PURE__ */
|
|
5966
|
+
/* @__PURE__ */ jsx29(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5967
|
+
/* @__PURE__ */ jsx29(ChannelsPanel, { controller }),
|
|
5968
|
+
/* @__PURE__ */ jsx29(PathsPanel, { controller })
|
|
5658
5969
|
] }),
|
|
5659
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5970
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5971
|
+
/* @__PURE__ */ jsxs27("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5972
|
+
/* @__PURE__ */ jsx29("span", { children: "Results go to" }),
|
|
5973
|
+
/* @__PURE__ */ jsxs27(
|
|
5663
5974
|
"select",
|
|
5664
5975
|
{
|
|
5665
5976
|
"aria-label": "AI result target",
|
|
@@ -5667,54 +5978,54 @@ var ImageEditor = ({
|
|
|
5667
5978
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5668
5979
|
className: imageSelectClass,
|
|
5669
5980
|
children: [
|
|
5670
|
-
/* @__PURE__ */
|
|
5671
|
-
/* @__PURE__ */
|
|
5672
|
-
/* @__PURE__ */
|
|
5981
|
+
/* @__PURE__ */ jsx29("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5982
|
+
/* @__PURE__ */ jsx29("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5983
|
+
/* @__PURE__ */ jsx29("option", { value: "replace", children: "Replace image" })
|
|
5673
5984
|
]
|
|
5674
5985
|
}
|
|
5675
5986
|
)
|
|
5676
5987
|
] }),
|
|
5677
|
-
/* @__PURE__ */
|
|
5678
|
-
/* @__PURE__ */
|
|
5679
|
-
/* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5988
|
+
/* @__PURE__ */ jsxs27("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5989
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
5990
|
+
/* @__PURE__ */ jsxs27("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5991
|
+
/* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
|
|
5681
5992
|
"Background Removal"
|
|
5682
5993
|
] }),
|
|
5683
|
-
isRemovingBg && /* @__PURE__ */
|
|
5994
|
+
isRemovingBg && /* @__PURE__ */ jsx29("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..." })
|
|
5684
5995
|
] }),
|
|
5685
|
-
/* @__PURE__ */
|
|
5686
|
-
/* @__PURE__ */
|
|
5996
|
+
/* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5997
|
+
/* @__PURE__ */ jsx29(
|
|
5687
5998
|
"button",
|
|
5688
5999
|
{
|
|
5689
6000
|
type: "button",
|
|
5690
6001
|
onClick: handleRemoveBackground,
|
|
5691
6002
|
disabled: isRemovingBg || isInpainting,
|
|
5692
6003
|
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",
|
|
5693
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
5694
|
-
/* @__PURE__ */
|
|
6004
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
6005
|
+
/* @__PURE__ */ jsx29("div", { className: imageSpinnerClass }),
|
|
5695
6006
|
"Removing Background..."
|
|
5696
|
-
] }) : /* @__PURE__ */
|
|
5697
|
-
/* @__PURE__ */
|
|
6007
|
+
] }) : /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
6008
|
+
/* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
|
|
5698
6009
|
"Remove Background"
|
|
5699
6010
|
] })
|
|
5700
6011
|
}
|
|
5701
6012
|
)
|
|
5702
6013
|
] }),
|
|
5703
|
-
/* @__PURE__ */
|
|
5704
|
-
/* @__PURE__ */
|
|
5705
|
-
/* @__PURE__ */
|
|
5706
|
-
/* @__PURE__ */
|
|
5707
|
-
/* @__PURE__ */
|
|
5708
|
-
/* @__PURE__ */
|
|
6014
|
+
/* @__PURE__ */ jsxs27("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
6015
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
6016
|
+
/* @__PURE__ */ jsxs27("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
6017
|
+
/* @__PURE__ */ jsxs27("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
6018
|
+
/* @__PURE__ */ jsx29("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" }),
|
|
6019
|
+
/* @__PURE__ */ jsx29("path", { d: "m14 7 3 3" })
|
|
5709
6020
|
] }),
|
|
5710
6021
|
"Generative Inpainting"
|
|
5711
6022
|
] }),
|
|
5712
|
-
isInpainting && /* @__PURE__ */
|
|
6023
|
+
isInpainting && /* @__PURE__ */ jsx29("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..." })
|
|
5713
6024
|
] }),
|
|
5714
|
-
/* @__PURE__ */
|
|
5715
|
-
/* @__PURE__ */
|
|
5716
|
-
/* @__PURE__ */
|
|
5717
|
-
/* @__PURE__ */
|
|
6025
|
+
/* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
6026
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", children: [
|
|
6027
|
+
/* @__PURE__ */ jsx29("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
6028
|
+
/* @__PURE__ */ jsx29(
|
|
5718
6029
|
"textarea",
|
|
5719
6030
|
{
|
|
5720
6031
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5726,10 +6037,10 @@ var ImageEditor = ({
|
|
|
5726
6037
|
}
|
|
5727
6038
|
)
|
|
5728
6039
|
] }),
|
|
5729
|
-
/* @__PURE__ */
|
|
5730
|
-
/* @__PURE__ */
|
|
5731
|
-
/* @__PURE__ */
|
|
5732
|
-
/* @__PURE__ */
|
|
6040
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", children: [
|
|
6041
|
+
/* @__PURE__ */ jsx29("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
6042
|
+
/* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
6043
|
+
/* @__PURE__ */ jsxs27(
|
|
5733
6044
|
"button",
|
|
5734
6045
|
{
|
|
5735
6046
|
type: "button",
|
|
@@ -5742,7 +6053,7 @@ var ImageEditor = ({
|
|
|
5742
6053
|
]
|
|
5743
6054
|
}
|
|
5744
6055
|
),
|
|
5745
|
-
/* @__PURE__ */
|
|
6056
|
+
/* @__PURE__ */ jsxs27(
|
|
5746
6057
|
"button",
|
|
5747
6058
|
{
|
|
5748
6059
|
type: "button",
|
|
@@ -5757,25 +6068,25 @@ var ImageEditor = ({
|
|
|
5757
6068
|
)
|
|
5758
6069
|
] })
|
|
5759
6070
|
] }),
|
|
5760
|
-
/* @__PURE__ */
|
|
6071
|
+
/* @__PURE__ */ jsx29(
|
|
5761
6072
|
"button",
|
|
5762
6073
|
{
|
|
5763
6074
|
type: "button",
|
|
5764
6075
|
onClick: handleInpaint,
|
|
5765
6076
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5766
6077
|
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",
|
|
5767
|
-
children: isInpainting ? /* @__PURE__ */
|
|
5768
|
-
/* @__PURE__ */
|
|
6078
|
+
children: isInpainting ? /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
6079
|
+
/* @__PURE__ */ jsx29("div", { className: imageSpinnerClass }),
|
|
5769
6080
|
"Generating Inpaint..."
|
|
5770
|
-
] }) : /* @__PURE__ */
|
|
5771
|
-
/* @__PURE__ */
|
|
6081
|
+
] }) : /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
6082
|
+
/* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
|
|
5772
6083
|
"Apply Inpainting"
|
|
5773
6084
|
] })
|
|
5774
6085
|
}
|
|
5775
6086
|
)
|
|
5776
6087
|
] }),
|
|
5777
|
-
aiError && /* @__PURE__ */
|
|
5778
|
-
aiSuccess && /* @__PURE__ */
|
|
6088
|
+
aiError && /* @__PURE__ */ jsx29("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
6089
|
+
aiSuccess && /* @__PURE__ */ jsx29("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5779
6090
|
] })
|
|
5780
6091
|
] })
|
|
5781
6092
|
] })
|
|
@@ -5795,6 +6106,7 @@ export {
|
|
|
5795
6106
|
AdjustmentLayersPanel,
|
|
5796
6107
|
EdgeColorPanel,
|
|
5797
6108
|
VectorMaskEdgesPanel,
|
|
6109
|
+
SmartObjectPanel,
|
|
5798
6110
|
LayersPanel,
|
|
5799
6111
|
ImageEffectControls,
|
|
5800
6112
|
ImageProviderEffectsPanel,
|