@pixerate/editor-react 0.136.0 → 0.138.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2FWKCKPR.js → chunk-3BL4QCPE.js} +847 -547
- package/dist/image-editor/SelectAndMaskWorkspace.d.cts +17 -0
- package/dist/image-editor/SelectAndMaskWorkspace.d.ts +17 -0
- package/dist/image-editor/index.cjs +865 -564
- 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 +1390 -1089
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -52,6 +52,7 @@ __export(image_editor_exports, {
|
|
|
52
52
|
LayersPanel: () => LayersPanel,
|
|
53
53
|
PaintGradientEditor: () => PaintGradientEditor,
|
|
54
54
|
RefineEdgePanel: () => RefineEdgePanel,
|
|
55
|
+
SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
|
|
55
56
|
SelectionOptionsBar: () => SelectionOptionsBar,
|
|
56
57
|
ShapeOptionsBar: () => ShapeOptionsBar,
|
|
57
58
|
TypeOptionsBar: () => TypeOptionsBar,
|
|
@@ -231,8 +232,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
// src/image-editor/ImageEditor.tsx
|
|
234
|
-
var
|
|
235
|
-
var
|
|
235
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
236
|
+
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
236
237
|
|
|
237
238
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
238
239
|
var import_react5 = require("react");
|
|
@@ -4601,9 +4602,272 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4601
4602
|
};
|
|
4602
4603
|
|
|
4603
4604
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
4605
|
+
var import_react26 = require("react");
|
|
4606
|
+
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
4607
|
+
|
|
4608
|
+
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
4604
4609
|
var import_react25 = require("react");
|
|
4605
4610
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4606
4611
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4612
|
+
var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4613
|
+
var toggle = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
4614
|
+
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
4615
|
+
const session = (0, import_react25.useMemo)(() => new import_image_editor14.SelectAndMaskSession(controller), [controller]);
|
|
4616
|
+
const [, setRevision] = (0, import_react25.useState)(0);
|
|
4617
|
+
const [zoom, setZoom] = (0, import_react25.useState)(1);
|
|
4618
|
+
const [pan, setPan] = (0, import_react25.useState)({ x: 0, y: 0 });
|
|
4619
|
+
const [busy, setBusy] = (0, import_react25.useState)(false);
|
|
4620
|
+
const [error, setError] = (0, import_react25.useState)(null);
|
|
4621
|
+
const canvasRef = (0, import_react25.useRef)(null);
|
|
4622
|
+
const panFrom = (0, import_react25.useRef)(null);
|
|
4623
|
+
const settings = session.settings;
|
|
4624
|
+
const size = session.previewSize;
|
|
4625
|
+
(0, import_react25.useEffect)(() => {
|
|
4626
|
+
const off = session.subscribe(() => setRevision(session.revision));
|
|
4627
|
+
void session.open();
|
|
4628
|
+
return () => {
|
|
4629
|
+
off();
|
|
4630
|
+
};
|
|
4631
|
+
}, [session]);
|
|
4632
|
+
(0, import_react25.useEffect)(() => {
|
|
4633
|
+
const canvas = canvasRef.current;
|
|
4634
|
+
const ctx = canvas?.getContext?.("2d");
|
|
4635
|
+
if (!canvas || !ctx || !size.width || typeof ImageData === "undefined") return;
|
|
4636
|
+
canvas.width = size.width;
|
|
4637
|
+
canvas.height = size.height;
|
|
4638
|
+
ctx.putImageData(new ImageData(session.render(), size.width, size.height), 0, 0);
|
|
4639
|
+
});
|
|
4640
|
+
const set = (changes) => session.update(changes);
|
|
4641
|
+
const ok = async () => {
|
|
4642
|
+
setBusy(true);
|
|
4643
|
+
setError(null);
|
|
4644
|
+
try {
|
|
4645
|
+
onClose(await session.commit());
|
|
4646
|
+
} catch (err) {
|
|
4647
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
4648
|
+
setBusy(false);
|
|
4649
|
+
}
|
|
4650
|
+
};
|
|
4651
|
+
(0, import_react25.useEffect)(() => {
|
|
4652
|
+
const onKey = (e) => {
|
|
4653
|
+
const t = e.target;
|
|
4654
|
+
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
4655
|
+
if (e.key === "Escape") onClose(null);
|
|
4656
|
+
else if (e.key === "Enter") void ok();
|
|
4657
|
+
else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") session.undoEdit();
|
|
4658
|
+
else if (e.ctrlKey || e.metaKey || e.altKey || !session.handleKey(e.key)) return;
|
|
4659
|
+
e.preventDefault();
|
|
4660
|
+
};
|
|
4661
|
+
window.addEventListener("keydown", onKey);
|
|
4662
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
4663
|
+
});
|
|
4664
|
+
const toImage = (e) => {
|
|
4665
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
4666
|
+
const naturalW = size.width / size.scale;
|
|
4667
|
+
const naturalH = size.height / size.scale;
|
|
4668
|
+
return { x: (e.clientX - rect.left) / Math.max(1, rect.width) * naturalW, y: (e.clientY - rect.top) / Math.max(1, rect.height) * naturalH };
|
|
4669
|
+
};
|
|
4670
|
+
const onDown = (e) => {
|
|
4671
|
+
if (settings.tool === "hand") {
|
|
4672
|
+
panFrom.current = { x: e.clientX, y: e.clientY, pan };
|
|
4673
|
+
return;
|
|
4674
|
+
}
|
|
4675
|
+
if (settings.tool === "zoom") {
|
|
4676
|
+
setZoom((z) => Math.min(16, Math.max(0.25, e.altKey ? z / 1.25 : z * 1.25)));
|
|
4677
|
+
return;
|
|
4678
|
+
}
|
|
4679
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
4680
|
+
session.begin(toImage(e), { altKey: e.altKey });
|
|
4681
|
+
};
|
|
4682
|
+
const onMove = (e) => {
|
|
4683
|
+
if (panFrom.current) {
|
|
4684
|
+
const p = panFrom.current;
|
|
4685
|
+
setPan({ x: p.pan.x + e.clientX - p.x, y: p.pan.y + e.clientY - p.y });
|
|
4686
|
+
return;
|
|
4687
|
+
}
|
|
4688
|
+
if (e.buttons) session.move(toImage(e));
|
|
4689
|
+
};
|
|
4690
|
+
const onUp = () => {
|
|
4691
|
+
panFrom.current = null;
|
|
4692
|
+
session.end();
|
|
4693
|
+
};
|
|
4694
|
+
const toLayer = settings.output === "new-layer" || settings.output === "new-layer-with-mask";
|
|
4695
|
+
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
4696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4697
|
+
"div",
|
|
4698
|
+
{
|
|
4699
|
+
"data-testid": "select-and-mask-workspace",
|
|
4700
|
+
role: "dialog",
|
|
4701
|
+
"aria-label": "Select and Mask",
|
|
4702
|
+
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
4703
|
+
children: [
|
|
4704
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: import_image_editor14.SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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)) }),
|
|
4705
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
4706
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
4707
|
+
brushTool && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4708
|
+
"Size",
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4710
|
+
"input",
|
|
4711
|
+
{
|
|
4712
|
+
type: "number",
|
|
4713
|
+
min: 1,
|
|
4714
|
+
"aria-label": "Brush size",
|
|
4715
|
+
value: settings.brushSize,
|
|
4716
|
+
onChange: (e) => set({ brushSize: Math.max(1, Number(e.target.value) || 1) }),
|
|
4717
|
+
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4718
|
+
}
|
|
4719
|
+
),
|
|
4720
|
+
"px"
|
|
4721
|
+
] }),
|
|
4722
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
4725
|
+
] }),
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
4727
|
+
session.edits.length,
|
|
4728
|
+
" strokes"
|
|
4729
|
+
] }),
|
|
4730
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button2, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
|
|
4732
|
+
Math.round(zoom * 100),
|
|
4733
|
+
"%"
|
|
4734
|
+
] }),
|
|
4735
|
+
session.computing && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
4736
|
+
] }),
|
|
4737
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4738
|
+
"canvas",
|
|
4739
|
+
{
|
|
4740
|
+
ref: canvasRef,
|
|
4741
|
+
"data-testid": "select-and-mask-preview",
|
|
4742
|
+
onPointerDown: onDown,
|
|
4743
|
+
onPointerMove: onMove,
|
|
4744
|
+
onPointerUp: onUp,
|
|
4745
|
+
style: {
|
|
4746
|
+
// Fitted to the area at its own aspect ratio; zoom and pan are a transform.
|
|
4747
|
+
maxWidth: "100%",
|
|
4748
|
+
maxHeight: "100%",
|
|
4749
|
+
transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`,
|
|
4750
|
+
imageRendering: zoom > 2 ? "pixelated" : void 0,
|
|
4751
|
+
cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair"
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
) })
|
|
4755
|
+
] }),
|
|
4756
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
4758
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4759
|
+
"View",
|
|
4760
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4761
|
+
ImageSelect,
|
|
4762
|
+
{
|
|
4763
|
+
label: "View",
|
|
4764
|
+
value: settings.view,
|
|
4765
|
+
options: import_image_editor14.SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
|
|
4766
|
+
onChange: (v) => set({ view: v })
|
|
4767
|
+
}
|
|
4768
|
+
)
|
|
4769
|
+
] }),
|
|
4770
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4772
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Opacity" }),
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4774
|
+
Math.round(settings.opacity * 100),
|
|
4775
|
+
"%"
|
|
4776
|
+
] })
|
|
4777
|
+
] }),
|
|
4778
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
4779
|
+
] }),
|
|
4780
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
4782
|
+
"Show Edge (J)"
|
|
4783
|
+
] }),
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4785
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
4786
|
+
"Show Original (P)"
|
|
4787
|
+
] }),
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
4790
|
+
"Real-Time Refinement"
|
|
4791
|
+
] }),
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
4794
|
+
"High Quality Preview"
|
|
4795
|
+
] }),
|
|
4796
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
4797
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4798
|
+
"Mode",
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4800
|
+
ImageSelect,
|
|
4801
|
+
{
|
|
4802
|
+
label: "Refine mode",
|
|
4803
|
+
value: settings.refineMode,
|
|
4804
|
+
options: [
|
|
4805
|
+
{ value: "color", label: "Color Aware" },
|
|
4806
|
+
{ value: "object", label: "Object Aware" }
|
|
4807
|
+
],
|
|
4808
|
+
onChange: (v) => set({ refineMode: v })
|
|
4809
|
+
}
|
|
4810
|
+
)
|
|
4811
|
+
] }),
|
|
4812
|
+
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4813
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4814
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: c.label }),
|
|
4815
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4816
|
+
settings.params[c.id],
|
|
4817
|
+
c.unit
|
|
4818
|
+
] })
|
|
4819
|
+
] }),
|
|
4820
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(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 } }) })
|
|
4821
|
+
] }, c.id)),
|
|
4822
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4823
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
4824
|
+
"Smart Radius"
|
|
4825
|
+
] }),
|
|
4826
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4828
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4829
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
|
|
4830
|
+
"Decontaminate Colors",
|
|
4831
|
+
toLayer ? "" : " (new layer outputs)"
|
|
4832
|
+
] }),
|
|
4833
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4834
|
+
settings.decontaminate,
|
|
4835
|
+
"%"
|
|
4836
|
+
] })
|
|
4837
|
+
] }),
|
|
4838
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
4839
|
+
] }),
|
|
4840
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4841
|
+
"Output To",
|
|
4842
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4843
|
+
ImageSelect,
|
|
4844
|
+
{
|
|
4845
|
+
label: "Output to",
|
|
4846
|
+
value: settings.output,
|
|
4847
|
+
options: import_image_editor14.REFINE_OUTPUTS.map((o) => ({ value: o.id, label: o.label })),
|
|
4848
|
+
onChange: (v) => set({ output: v })
|
|
4849
|
+
}
|
|
4850
|
+
)
|
|
4851
|
+
] }),
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4853
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
4854
|
+
"Remember Settings"
|
|
4855
|
+
] }),
|
|
4856
|
+
(error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
4857
|
+
session.note && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: session.note }),
|
|
4858
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
|
|
4859
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
|
|
4860
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
|
|
4861
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
4862
|
+
] })
|
|
4863
|
+
] })
|
|
4864
|
+
]
|
|
4865
|
+
}
|
|
4866
|
+
);
|
|
4867
|
+
};
|
|
4868
|
+
|
|
4869
|
+
// src/image-editor/SelectionOptionsBar.tsx
|
|
4870
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4607
4871
|
var MODIFY_OPS = [
|
|
4608
4872
|
{ op: "expand", label: "Expand" },
|
|
4609
4873
|
{ op: "contract", label: "Contract" },
|
|
@@ -4627,15 +4891,15 @@ var SelectionOptionsBar = ({
|
|
|
4627
4891
|
selectionDisplay,
|
|
4628
4892
|
className = ""
|
|
4629
4893
|
}) => {
|
|
4630
|
-
const [radius, setRadius] = (0,
|
|
4894
|
+
const [radius, setRadius] = (0, import_react26.useState)(2);
|
|
4631
4895
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
4632
4896
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4633
4897
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
4634
|
-
const [preset, setPreset] = (0,
|
|
4635
|
-
const [rangeStatus, setRangeStatus] = (0,
|
|
4636
|
-
const [colorStatus, setColorStatus] = (0,
|
|
4637
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
4638
|
-
const [strokeLocation, setStrokeLocation] = (0,
|
|
4898
|
+
const [preset, setPreset] = (0, import_react26.useState)("reds");
|
|
4899
|
+
const [rangeStatus, setRangeStatus] = (0, import_react26.useState)(null);
|
|
4900
|
+
const [colorStatus, setColorStatus] = (0, import_react26.useState)(null);
|
|
4901
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react26.useState)(4);
|
|
4902
|
+
const [strokeLocation, setStrokeLocation] = (0, import_react26.useState)("outside");
|
|
4639
4903
|
const edit = (fn) => {
|
|
4640
4904
|
setColorStatus(null);
|
|
4641
4905
|
try {
|
|
@@ -4668,9 +4932,22 @@ var SelectionOptionsBar = ({
|
|
|
4668
4932
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
4669
4933
|
}
|
|
4670
4934
|
};
|
|
4671
|
-
const [
|
|
4672
|
-
const
|
|
4673
|
-
const
|
|
4935
|
+
const [task, setTask] = (0, import_react26.useState)(null);
|
|
4936
|
+
const taskAbort = (0, import_react26.useRef)(null);
|
|
4937
|
+
const tracked = () => {
|
|
4938
|
+
const abort = new AbortController();
|
|
4939
|
+
taskAbort.current = abort;
|
|
4940
|
+
setTask({ stage: "Starting", fraction: 0 });
|
|
4941
|
+
return { signal: abort.signal, onProgress: (fraction, stage) => setTask({ stage, fraction }) };
|
|
4942
|
+
};
|
|
4943
|
+
const untrack = () => {
|
|
4944
|
+
taskAbort.current = null;
|
|
4945
|
+
setTask(null);
|
|
4946
|
+
};
|
|
4947
|
+
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
4948
|
+
const [subject, setSubject] = (0, import_react26.useState)("");
|
|
4949
|
+
const [segmenting, setSegmenting] = (0, import_react26.useState)(false);
|
|
4950
|
+
const [subjectStatus, setSubjectStatus] = (0, import_react26.useState)(null);
|
|
4674
4951
|
const selectSubject = async () => {
|
|
4675
4952
|
const target = subject.trim();
|
|
4676
4953
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -4678,31 +4955,34 @@ var SelectionOptionsBar = ({
|
|
|
4678
4955
|
setSegmenting(true);
|
|
4679
4956
|
setSubjectStatus(null);
|
|
4680
4957
|
try {
|
|
4681
|
-
const { segments, method, note } = await controller.selectSubject(canSegment ? target : "", { mode: options.mode });
|
|
4958
|
+
const { segments, method, note } = await controller.selectSubject(canSegment ? target : "", { mode: options.mode, ...tracked() });
|
|
4682
4959
|
setSubjectStatus(segments.length ? null : method === "saliency" ? note ?? "Nothing stands out from the background." : `Nothing matching \u201C${target}\u201D was found.`);
|
|
4683
4960
|
} catch (err) {
|
|
4684
|
-
setSubjectStatus(
|
|
4961
|
+
setSubjectStatus(failure(err));
|
|
4685
4962
|
} finally {
|
|
4963
|
+
untrack();
|
|
4686
4964
|
setSegmenting(false);
|
|
4687
4965
|
}
|
|
4688
4966
|
};
|
|
4689
|
-
const [
|
|
4690
|
-
const [
|
|
4967
|
+
const [workspace, setWorkspace] = (0, import_react26.useState)(false);
|
|
4968
|
+
const [skying, setSkying] = (0, import_react26.useState)(false);
|
|
4969
|
+
const [skyStatus, setSkyStatus] = (0, import_react26.useState)(null);
|
|
4691
4970
|
const selectSky = async () => {
|
|
4692
4971
|
if (skying) return;
|
|
4693
4972
|
setSkying(true);
|
|
4694
4973
|
setSkyStatus(null);
|
|
4695
4974
|
try {
|
|
4696
|
-
const { note } = await controller.selectSky({ mode: options.mode });
|
|
4975
|
+
const { note } = await controller.selectSky({ mode: options.mode, ...tracked() });
|
|
4697
4976
|
setSkyStatus(note ?? null);
|
|
4698
4977
|
} catch (err) {
|
|
4699
|
-
setSkyStatus(
|
|
4978
|
+
setSkyStatus(failure(err));
|
|
4700
4979
|
} finally {
|
|
4980
|
+
untrack();
|
|
4701
4981
|
setSkying(false);
|
|
4702
4982
|
}
|
|
4703
4983
|
};
|
|
4704
|
-
const [focusing, setFocusing] = (0,
|
|
4705
|
-
const [focusStatus, setFocusStatus] = (0,
|
|
4984
|
+
const [focusing, setFocusing] = (0, import_react26.useState)(false);
|
|
4985
|
+
const [focusStatus, setFocusStatus] = (0, import_react26.useState)(null);
|
|
4706
4986
|
const selectFocusArea = async () => {
|
|
4707
4987
|
if (focusing) return;
|
|
4708
4988
|
setFocusing(true);
|
|
@@ -4712,33 +4992,35 @@ var SelectionOptionsBar = ({
|
|
|
4712
4992
|
range: options.focusRange ?? 50,
|
|
4713
4993
|
noise: options.focusNoise ?? 0,
|
|
4714
4994
|
softness: options.focusSoftness ?? 4,
|
|
4715
|
-
mode: options.mode
|
|
4995
|
+
mode: options.mode,
|
|
4996
|
+
...tracked()
|
|
4716
4997
|
});
|
|
4717
4998
|
setFocusStatus(selection2 ? null : "No part of the image stands out as in focus.");
|
|
4718
4999
|
} catch (err) {
|
|
4719
|
-
setFocusStatus(
|
|
5000
|
+
setFocusStatus(failure(err));
|
|
4720
5001
|
} finally {
|
|
5002
|
+
untrack();
|
|
4721
5003
|
setFocusing(false);
|
|
4722
5004
|
}
|
|
4723
5005
|
};
|
|
4724
|
-
return /* @__PURE__ */ (0,
|
|
4725
|
-
/* @__PURE__ */ (0,
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4727
|
-
options.tool === "wand" && /* @__PURE__ */ (0,
|
|
4728
|
-
/* @__PURE__ */ (0,
|
|
4729
|
-
/* @__PURE__ */ (0,
|
|
4730
|
-
/* @__PURE__ */ (0,
|
|
4731
|
-
/* @__PURE__ */ (0,
|
|
5006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor15.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("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)) }),
|
|
5008
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor15.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor15.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
5009
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5011
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5012
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Tolerance" }),
|
|
5013
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
4732
5014
|
] }),
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
5015
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
4734
5016
|
] }),
|
|
4735
|
-
/* @__PURE__ */ (0,
|
|
4736
|
-
/* @__PURE__ */ (0,
|
|
5017
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
4737
5019
|
"Contiguous"
|
|
4738
5020
|
] }),
|
|
4739
|
-
/* @__PURE__ */ (0,
|
|
5021
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4740
5022
|
"Distance",
|
|
4741
|
-
/* @__PURE__ */ (0,
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4742
5024
|
ImageSelect,
|
|
4743
5025
|
{
|
|
4744
5026
|
label: "Colour distance",
|
|
@@ -4751,13 +5033,13 @@ var SelectionOptionsBar = ({
|
|
|
4751
5033
|
}
|
|
4752
5034
|
)
|
|
4753
5035
|
] }),
|
|
4754
|
-
/* @__PURE__ */ (0,
|
|
4755
|
-
/* @__PURE__ */ (0,
|
|
5036
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5037
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
4756
5038
|
"Sample adjusted image"
|
|
4757
5039
|
] }),
|
|
4758
|
-
/* @__PURE__ */ (0,
|
|
5040
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4759
5041
|
"Sample",
|
|
4760
|
-
/* @__PURE__ */ (0,
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4761
5043
|
ImageSelect,
|
|
4762
5044
|
{
|
|
4763
5045
|
label: "Sample from",
|
|
@@ -4771,77 +5053,77 @@ var SelectionOptionsBar = ({
|
|
|
4771
5053
|
)
|
|
4772
5054
|
] })
|
|
4773
5055
|
] }),
|
|
4774
|
-
options.tool === "polygon" && /* @__PURE__ */ (0,
|
|
4775
|
-
options.tool === "magnetic" && /* @__PURE__ */ (0,
|
|
4776
|
-
/* @__PURE__ */ (0,
|
|
4777
|
-
/* @__PURE__ */ (0,
|
|
4778
|
-
/* @__PURE__ */ (0,
|
|
4779
|
-
/* @__PURE__ */ (0,
|
|
4780
|
-
/* @__PURE__ */ (0,
|
|
5056
|
+
options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("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." }),
|
|
5057
|
+
options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
5058
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("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." }),
|
|
5059
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5061
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Width" }),
|
|
5062
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4781
5063
|
options.magneticWidth ?? 10,
|
|
4782
5064
|
" px"
|
|
4783
5065
|
] })
|
|
4784
5066
|
] }),
|
|
4785
|
-
/* @__PURE__ */ (0,
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
4786
5068
|
] }),
|
|
4787
|
-
/* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
/* @__PURE__ */ (0,
|
|
4790
|
-
/* @__PURE__ */ (0,
|
|
5069
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5070
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5071
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Contrast" }),
|
|
5072
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4791
5073
|
options.magneticContrast ?? 10,
|
|
4792
5074
|
"%"
|
|
4793
5075
|
] })
|
|
4794
5076
|
] }),
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
4796
5078
|
] }),
|
|
4797
|
-
/* @__PURE__ */ (0,
|
|
4798
|
-
/* @__PURE__ */ (0,
|
|
4799
|
-
/* @__PURE__ */ (0,
|
|
4800
|
-
/* @__PURE__ */ (0,
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5080
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Frequency" }),
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
4801
5083
|
] }),
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
5084
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
4803
5085
|
] })
|
|
4804
5086
|
] }),
|
|
4805
|
-
options.tool === "quick" && /* @__PURE__ */ (0,
|
|
4806
|
-
/* @__PURE__ */ (0,
|
|
4807
|
-
/* @__PURE__ */ (0,
|
|
4808
|
-
/* @__PURE__ */ (0,
|
|
4809
|
-
/* @__PURE__ */ (0,
|
|
4810
|
-
/* @__PURE__ */ (0,
|
|
5087
|
+
options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5090
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5091
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Size" }),
|
|
5092
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4811
5093
|
options.quickSize ?? 30,
|
|
4812
5094
|
" px"
|
|
4813
5095
|
] })
|
|
4814
5096
|
] }),
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
5097
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
4816
5098
|
] }),
|
|
4817
|
-
/* @__PURE__ */ (0,
|
|
4818
|
-
/* @__PURE__ */ (0,
|
|
5099
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5100
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
4819
5101
|
"Sample all layers"
|
|
4820
5102
|
] }),
|
|
4821
|
-
/* @__PURE__ */ (0,
|
|
4822
|
-
/* @__PURE__ */ (0,
|
|
5103
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5104
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
4823
5105
|
"Auto-enhance edges"
|
|
4824
5106
|
] })
|
|
4825
5107
|
] }),
|
|
4826
|
-
options.tool === "object" && /* @__PURE__ */ (0,
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
4829
|
-
/* @__PURE__ */ (0,
|
|
5108
|
+
options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
5109
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5111
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
4830
5112
|
"Sample all layers"
|
|
4831
5113
|
] }),
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
5114
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5115
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
4834
5116
|
"Auto-enhance edges"
|
|
4835
5117
|
] })
|
|
4836
5118
|
] }),
|
|
4837
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0,
|
|
4838
|
-
/* @__PURE__ */ (0,
|
|
5119
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
4839
5121
|
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).",
|
|
4840
5122
|
" Shift-click adds, Alt-click subtracts."
|
|
4841
5123
|
] }),
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4843
5125
|
"Text",
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
5126
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4845
5127
|
"input",
|
|
4846
5128
|
{
|
|
4847
5129
|
type: "text",
|
|
@@ -4852,9 +5134,9 @@ var SelectionOptionsBar = ({
|
|
|
4852
5134
|
}
|
|
4853
5135
|
)
|
|
4854
5136
|
] }),
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4856
5138
|
"Size",
|
|
4857
|
-
/* @__PURE__ */ (0,
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4858
5140
|
"input",
|
|
4859
5141
|
{
|
|
4860
5142
|
type: "number",
|
|
@@ -4868,9 +5150,9 @@ var SelectionOptionsBar = ({
|
|
|
4868
5150
|
),
|
|
4869
5151
|
"px"
|
|
4870
5152
|
] }),
|
|
4871
|
-
/* @__PURE__ */ (0,
|
|
5153
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4872
5154
|
"Font",
|
|
4873
|
-
/* @__PURE__ */ (0,
|
|
5155
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4874
5156
|
"input",
|
|
4875
5157
|
{
|
|
4876
5158
|
type: "text",
|
|
@@ -4882,18 +5164,18 @@ var SelectionOptionsBar = ({
|
|
|
4882
5164
|
)
|
|
4883
5165
|
] })
|
|
4884
5166
|
] }),
|
|
4885
|
-
options.tool === "range" && /* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
4889
|
-
/* @__PURE__ */ (0,
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
5167
|
+
options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
5168
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
5169
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5170
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Fuzziness" }),
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
4891
5173
|
] }),
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
5174
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
4893
5175
|
] }),
|
|
4894
|
-
/* @__PURE__ */ (0,
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4895
5177
|
"Localized radius",
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4897
5179
|
"input",
|
|
4898
5180
|
{
|
|
4899
5181
|
type: "number",
|
|
@@ -4907,27 +5189,27 @@ var SelectionOptionsBar = ({
|
|
|
4907
5189
|
),
|
|
4908
5190
|
"px"
|
|
4909
5191
|
] }),
|
|
4910
|
-
/* @__PURE__ */ (0,
|
|
4911
|
-
/* @__PURE__ */ (0,
|
|
5192
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
4912
5194
|
"Invert"
|
|
4913
5195
|
] }),
|
|
4914
|
-
/* @__PURE__ */ (0,
|
|
4915
|
-
/* @__PURE__ */ (0,
|
|
5196
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5197
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4916
5198
|
ImageSelect,
|
|
4917
5199
|
{
|
|
4918
5200
|
label: "Color Range preset",
|
|
4919
5201
|
value: preset,
|
|
4920
|
-
options:
|
|
5202
|
+
options: import_image_editor15.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor15.COLOR_RANGE_PRESET_LABELS[p] })),
|
|
4921
5203
|
onChange: (v) => setPreset(v)
|
|
4922
5204
|
}
|
|
4923
5205
|
),
|
|
4924
|
-
/* @__PURE__ */ (0,
|
|
5206
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
4925
5207
|
] }),
|
|
4926
|
-
rangeStatus && /* @__PURE__ */ (0,
|
|
5208
|
+
rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
4927
5209
|
] }),
|
|
4928
|
-
/* @__PURE__ */ (0,
|
|
5210
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4929
5211
|
"Feather",
|
|
4930
|
-
/* @__PURE__ */ (0,
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4931
5213
|
"input",
|
|
4932
5214
|
{
|
|
4933
5215
|
type: "number",
|
|
@@ -4942,7 +5224,7 @@ var SelectionOptionsBar = ({
|
|
|
4942
5224
|
),
|
|
4943
5225
|
"px"
|
|
4944
5226
|
] }),
|
|
4945
|
-
/* @__PURE__ */ (0,
|
|
5227
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4946
5228
|
"form",
|
|
4947
5229
|
{
|
|
4948
5230
|
"data-testid": "select-subject",
|
|
@@ -4952,8 +5234,8 @@ var SelectionOptionsBar = ({
|
|
|
4952
5234
|
void selectSubject();
|
|
4953
5235
|
},
|
|
4954
5236
|
children: [
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
4956
|
-
controller.segmentationProvider && /* @__PURE__ */ (0,
|
|
5237
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
|
|
5238
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4957
5239
|
"input",
|
|
4958
5240
|
{
|
|
4959
5241
|
type: "text",
|
|
@@ -4965,7 +5247,7 @@ var SelectionOptionsBar = ({
|
|
|
4965
5247
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
4966
5248
|
}
|
|
4967
5249
|
),
|
|
4968
|
-
/* @__PURE__ */ (0,
|
|
5250
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4969
5251
|
"button",
|
|
4970
5252
|
{
|
|
4971
5253
|
type: "submit",
|
|
@@ -4977,65 +5259,83 @@ var SelectionOptionsBar = ({
|
|
|
4977
5259
|
}
|
|
4978
5260
|
)
|
|
4979
5261
|
] }),
|
|
4980
|
-
subjectStatus && /* @__PURE__ */ (0,
|
|
5262
|
+
subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
4981
5263
|
]
|
|
4982
5264
|
}
|
|
4983
5265
|
),
|
|
4984
|
-
/* @__PURE__ */ (0,
|
|
4985
|
-
/* @__PURE__ */ (0,
|
|
4986
|
-
|
|
5266
|
+
task && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
5267
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5268
|
+
"div",
|
|
5269
|
+
{
|
|
5270
|
+
role: "progressbar",
|
|
5271
|
+
"aria-label": task.stage,
|
|
5272
|
+
"aria-valuemin": 0,
|
|
5273
|
+
"aria-valuemax": 100,
|
|
5274
|
+
"aria-valuenow": Math.round(task.fraction * 100),
|
|
5275
|
+
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
5276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
5277
|
+
}
|
|
5278
|
+
),
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: task.stage }),
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
5281
|
+
] }),
|
|
5282
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
5283
|
+
workspace && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
5286
|
+
skyStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
4987
5287
|
] }),
|
|
4988
|
-
/* @__PURE__ */ (0,
|
|
4989
|
-
/* @__PURE__ */ (0,
|
|
4990
|
-
/* @__PURE__ */ (0,
|
|
4991
|
-
/* @__PURE__ */ (0,
|
|
4992
|
-
/* @__PURE__ */ (0,
|
|
4993
|
-
/* @__PURE__ */ (0,
|
|
4994
|
-
/* @__PURE__ */ (0,
|
|
5288
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
5290
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5292
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "In-focus range" }),
|
|
5294
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
4995
5295
|
] }),
|
|
4996
|
-
/* @__PURE__ */ (0,
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
4997
5297
|
] }),
|
|
4998
|
-
/* @__PURE__ */ (0,
|
|
4999
|
-
/* @__PURE__ */ (0,
|
|
5000
|
-
/* @__PURE__ */ (0,
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
5298
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5300
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Image noise level" }),
|
|
5301
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
5002
5302
|
] }),
|
|
5003
|
-
/* @__PURE__ */ (0,
|
|
5303
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
5004
5304
|
] }),
|
|
5005
|
-
/* @__PURE__ */ (0,
|
|
5006
|
-
/* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5305
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5306
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5307
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Soften edge" }),
|
|
5308
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
5009
5309
|
options.focusSoftness ?? 4,
|
|
5010
5310
|
" px"
|
|
5011
5311
|
] })
|
|
5012
5312
|
] }),
|
|
5013
|
-
/* @__PURE__ */ (0,
|
|
5313
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
5014
5314
|
] }),
|
|
5015
|
-
/* @__PURE__ */ (0,
|
|
5016
|
-
focusStatus && /* @__PURE__ */ (0,
|
|
5315
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
5316
|
+
focusStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
5017
5317
|
] })
|
|
5018
5318
|
] }),
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5020
|
-
/* @__PURE__ */ (0,
|
|
5319
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5320
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
5021
5321
|
"Anti-alias"
|
|
5022
5322
|
] }),
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5024
|
-
/* @__PURE__ */ (0,
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5026
|
-
/* @__PURE__ */ (0,
|
|
5027
|
-
/* @__PURE__ */ (0,
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5323
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
5030
5330
|
] }),
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5033
|
-
DISPLAYS.map((d) => /* @__PURE__ */ (0,
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5332
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
|
|
5333
|
+
DISPLAYS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
5034
5334
|
] }),
|
|
5035
|
-
/* @__PURE__ */ (0,
|
|
5036
|
-
/* @__PURE__ */ (0,
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
5336
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5037
5337
|
"Radius",
|
|
5038
|
-
/* @__PURE__ */ (0,
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5039
5339
|
"input",
|
|
5040
5340
|
{
|
|
5041
5341
|
type: "number",
|
|
@@ -5049,12 +5349,12 @@ var SelectionOptionsBar = ({
|
|
|
5049
5349
|
}
|
|
5050
5350
|
)
|
|
5051
5351
|
] }),
|
|
5052
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
5352
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
5053
5353
|
] }),
|
|
5054
|
-
/* @__PURE__ */ (0,
|
|
5055
|
-
/* @__PURE__ */ (0,
|
|
5354
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5056
5356
|
"Stroke",
|
|
5057
|
-
/* @__PURE__ */ (0,
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5058
5358
|
"input",
|
|
5059
5359
|
{
|
|
5060
5360
|
type: "number",
|
|
@@ -5069,7 +5369,7 @@ var SelectionOptionsBar = ({
|
|
|
5069
5369
|
),
|
|
5070
5370
|
"px"
|
|
5071
5371
|
] }),
|
|
5072
|
-
/* @__PURE__ */ (0,
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5073
5373
|
ImageSelect,
|
|
5074
5374
|
{
|
|
5075
5375
|
label: "Stroke location",
|
|
@@ -5082,39 +5382,39 @@ var SelectionOptionsBar = ({
|
|
|
5082
5382
|
onChange: (v) => setStrokeLocation(v)
|
|
5083
5383
|
}
|
|
5084
5384
|
),
|
|
5085
|
-
/* @__PURE__ */ (0,
|
|
5086
|
-
/* @__PURE__ */ (0,
|
|
5087
|
-
/* @__PURE__ */ (0,
|
|
5385
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
5387
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" })
|
|
5088
5388
|
] }),
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5090
|
-
/* @__PURE__ */ (0,
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5092
|
-
/* @__PURE__ */ (0,
|
|
5093
|
-
/* @__PURE__ */ (0,
|
|
5094
|
-
/* @__PURE__ */ (0,
|
|
5095
|
-
/* @__PURE__ */ (0,
|
|
5096
|
-
/* @__PURE__ */ (0,
|
|
5389
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
5390
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
5391
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
5392
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
5393
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
5394
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
5395
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
5396
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
5097
5397
|
] }),
|
|
5098
|
-
colorStatus && /* @__PURE__ */ (0,
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5398
|
+
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
5399
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor15.describeSelection)(sel) })
|
|
5100
5400
|
] });
|
|
5101
5401
|
};
|
|
5102
5402
|
|
|
5103
5403
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5104
|
-
var
|
|
5105
|
-
var
|
|
5106
|
-
var
|
|
5404
|
+
var import_react27 = require("react");
|
|
5405
|
+
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
5406
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5107
5407
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5108
|
-
var
|
|
5408
|
+
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";
|
|
5109
5409
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
5110
|
-
const [params, setParams] = (0,
|
|
5111
|
-
const [busy, setBusy] = (0,
|
|
5112
|
-
const [error, setError] = (0,
|
|
5113
|
-
const [layerId, setLayerId] = (0,
|
|
5114
|
-
const [newKind, setNewKind] = (0,
|
|
5115
|
-
const [output, setOutput] = (0,
|
|
5116
|
-
const [decontaminate, setDecontaminate] = (0,
|
|
5117
|
-
const [objectAware, setObjectAware] = (0,
|
|
5410
|
+
const [params, setParams] = (0, import_react27.useState)(DEFAULT_PARAMS);
|
|
5411
|
+
const [busy, setBusy] = (0, import_react27.useState)(false);
|
|
5412
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
5413
|
+
const [layerId, setLayerId] = (0, import_react27.useState)("");
|
|
5414
|
+
const [newKind, setNewKind] = (0, import_react27.useState)("hueSaturation");
|
|
5415
|
+
const [output, setOutput] = (0, import_react27.useState)("selection");
|
|
5416
|
+
const [decontaminate, setDecontaminate] = (0, import_react27.useState)(0);
|
|
5417
|
+
const [objectAware, setObjectAware] = (0, import_react27.useState)(false);
|
|
5118
5418
|
const canObject = Boolean(controller.segmentationProvider);
|
|
5119
5419
|
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
5120
5420
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -5134,17 +5434,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5134
5434
|
setBusy(false);
|
|
5135
5435
|
}
|
|
5136
5436
|
};
|
|
5137
|
-
return /* @__PURE__ */ (0,
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5139
|
-
|
|
5140
|
-
/* @__PURE__ */ (0,
|
|
5141
|
-
/* @__PURE__ */ (0,
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5438
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
5439
|
+
import_image_editor16.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5440
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: c.label }),
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5143
5443
|
params[c.id],
|
|
5144
5444
|
c.unit
|
|
5145
5445
|
] })
|
|
5146
5446
|
] }),
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5447
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5148
5448
|
"input",
|
|
5149
5449
|
{
|
|
5150
5450
|
type: "range",
|
|
@@ -5158,39 +5458,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5158
5458
|
}
|
|
5159
5459
|
)
|
|
5160
5460
|
] }, c.id)),
|
|
5161
|
-
/* @__PURE__ */ (0,
|
|
5162
|
-
/* @__PURE__ */ (0,
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5462
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
5163
5463
|
"Smart Radius"
|
|
5164
5464
|
] }),
|
|
5165
|
-
canObject && /* @__PURE__ */ (0,
|
|
5166
|
-
/* @__PURE__ */ (0,
|
|
5465
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5466
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
5167
5467
|
"Object aware (segmentation model)"
|
|
5168
5468
|
] }),
|
|
5169
|
-
/* @__PURE__ */ (0,
|
|
5469
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5170
5470
|
"Output to",
|
|
5171
|
-
/* @__PURE__ */ (0,
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5172
5472
|
"select",
|
|
5173
5473
|
{
|
|
5174
5474
|
"aria-label": "Refine output",
|
|
5175
5475
|
value: output,
|
|
5176
5476
|
onChange: (e) => setOutput(e.target.value),
|
|
5177
5477
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5178
|
-
children:
|
|
5478
|
+
children: import_image_editor16.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
5179
5479
|
}
|
|
5180
5480
|
)
|
|
5181
5481
|
] }),
|
|
5182
|
-
/* @__PURE__ */ (0,
|
|
5183
|
-
/* @__PURE__ */ (0,
|
|
5184
|
-
/* @__PURE__ */ (0,
|
|
5482
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
|
|
5185
5485
|
"Decontaminate colors",
|
|
5186
5486
|
toLayer ? "" : " (new layer outputs)"
|
|
5187
5487
|
] }),
|
|
5188
|
-
/* @__PURE__ */ (0,
|
|
5488
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5189
5489
|
decontaminate,
|
|
5190
5490
|
"%"
|
|
5191
5491
|
] })
|
|
5192
5492
|
] }),
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5194
5494
|
"input",
|
|
5195
5495
|
{
|
|
5196
5496
|
type: "range",
|
|
@@ -5205,63 +5505,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5205
5505
|
}
|
|
5206
5506
|
)
|
|
5207
5507
|
] }),
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5210
|
-
/* @__PURE__ */ (0,
|
|
5508
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
|
|
5509
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
5510
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
5211
5511
|
] }),
|
|
5212
|
-
error && /* @__PURE__ */ (0,
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5214
|
-
/* @__PURE__ */ (0,
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
5512
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
5514
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
5515
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5216
5516
|
"select",
|
|
5217
5517
|
{
|
|
5218
5518
|
"aria-label": "New masked layer kind",
|
|
5219
5519
|
value: newKind,
|
|
5220
5520
|
onChange: (e) => setNewKind(e.target.value),
|
|
5221
5521
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5222
|
-
children:
|
|
5522
|
+
children: import_image_editor16.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
5223
5523
|
}
|
|
5224
5524
|
),
|
|
5225
|
-
/* @__PURE__ */ (0,
|
|
5525
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5226
5526
|
"button",
|
|
5227
5527
|
{
|
|
5228
5528
|
type: "button",
|
|
5229
|
-
className:
|
|
5529
|
+
className: button3,
|
|
5230
5530
|
disabled: !sel,
|
|
5231
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
5531
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor16.layerMaskFromSelection)(sel) })),
|
|
5232
5532
|
children: "New Masked Layer"
|
|
5233
5533
|
}
|
|
5234
5534
|
)
|
|
5235
5535
|
] }),
|
|
5236
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
5237
|
-
/* @__PURE__ */ (0,
|
|
5536
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5537
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5238
5538
|
"select",
|
|
5239
5539
|
{
|
|
5240
5540
|
"aria-label": "Mask layer",
|
|
5241
5541
|
value: target.id,
|
|
5242
5542
|
onChange: (e) => setLayerId(e.target.value),
|
|
5243
5543
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5244
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
5245
|
-
l.name || (0,
|
|
5544
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("option", { value: l.id, children: [
|
|
5545
|
+
l.name || (0, import_image_editor16.adjustmentKindLabel)(l.kind),
|
|
5246
5546
|
l.mask ? " (masked)" : ""
|
|
5247
5547
|
] }, l.id))
|
|
5248
5548
|
}
|
|
5249
5549
|
),
|
|
5250
|
-
/* @__PURE__ */ (0,
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5253
|
-
/* @__PURE__ */ (0,
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5551
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
5552
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
5553
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
5254
5554
|
] }),
|
|
5255
|
-
target.mask && /* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
/* @__PURE__ */ (0,
|
|
5259
|
-
/* @__PURE__ */ (0,
|
|
5555
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5556
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5557
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5558
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Density" }),
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5260
5560
|
Math.round((target.mask.density ?? 1) * 100),
|
|
5261
5561
|
"%"
|
|
5262
5562
|
] })
|
|
5263
5563
|
] }),
|
|
5264
|
-
/* @__PURE__ */ (0,
|
|
5564
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5265
5565
|
"input",
|
|
5266
5566
|
{
|
|
5267
5567
|
type: "range",
|
|
@@ -5275,15 +5575,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5275
5575
|
}
|
|
5276
5576
|
)
|
|
5277
5577
|
] }),
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
5280
|
-
/* @__PURE__ */ (0,
|
|
5281
|
-
/* @__PURE__ */ (0,
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5579
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5580
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Mask Feather" }),
|
|
5581
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5282
5582
|
target.mask.feather ?? 0,
|
|
5283
5583
|
"px"
|
|
5284
5584
|
] })
|
|
5285
5585
|
] }),
|
|
5286
|
-
/* @__PURE__ */ (0,
|
|
5586
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5287
5587
|
"input",
|
|
5288
5588
|
{
|
|
5289
5589
|
type: "range",
|
|
@@ -5303,32 +5603,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5303
5603
|
};
|
|
5304
5604
|
|
|
5305
5605
|
// src/image-editor/ChannelsPanel.tsx
|
|
5306
|
-
var
|
|
5307
|
-
var
|
|
5308
|
-
var
|
|
5606
|
+
var import_react28 = require("react");
|
|
5607
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5608
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5309
5609
|
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"}`;
|
|
5310
5610
|
var ChannelThumb = ({ channel, size }) => {
|
|
5311
|
-
const ref = (0,
|
|
5312
|
-
(0,
|
|
5611
|
+
const ref = (0, import_react28.useRef)(null);
|
|
5612
|
+
(0, import_react28.useEffect)(() => {
|
|
5313
5613
|
const canvas = ref.current;
|
|
5314
5614
|
const ctx = canvas?.getContext("2d");
|
|
5315
5615
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
5316
|
-
const px = (0,
|
|
5616
|
+
const px = (0, import_image_editor17.channelThumbnail)(channel, 64);
|
|
5317
5617
|
canvas.width = px.width;
|
|
5318
5618
|
canvas.height = px.height;
|
|
5319
5619
|
const img = ctx.createImageData(px.width, px.height);
|
|
5320
5620
|
img.data.set(px.data);
|
|
5321
5621
|
ctx.putImageData(img, 0, 0);
|
|
5322
5622
|
}, [channel.mask]);
|
|
5323
|
-
return /* @__PURE__ */ (0,
|
|
5623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
5324
5624
|
};
|
|
5325
5625
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5326
|
-
const [, setTick] = (0,
|
|
5327
|
-
(0,
|
|
5328
|
-
const [activeId, setActiveId] = (0,
|
|
5329
|
-
const [renaming, setRenaming] = (0,
|
|
5330
|
-
const [error, setError] = (0,
|
|
5331
|
-
const fileInput = (0,
|
|
5626
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
5627
|
+
(0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5628
|
+
const [activeId, setActiveId] = (0, import_react28.useState)(null);
|
|
5629
|
+
const [renaming, setRenaming] = (0, import_react28.useState)(null);
|
|
5630
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
5631
|
+
const fileInput = (0, import_react28.useRef)(null);
|
|
5332
5632
|
const channels = controller.getChannels();
|
|
5333
5633
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5334
5634
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -5345,18 +5645,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5345
5645
|
if (!file) return;
|
|
5346
5646
|
setError(null);
|
|
5347
5647
|
try {
|
|
5348
|
-
setActiveId((await (0,
|
|
5648
|
+
setActiveId((await (0, import_image_editor17.openMaskFile)(controller, file)).id);
|
|
5349
5649
|
} catch (err) {
|
|
5350
5650
|
setError(err instanceof Error ? err.message : String(err));
|
|
5351
5651
|
}
|
|
5352
5652
|
};
|
|
5353
|
-
return /* @__PURE__ */ (0,
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5356
|
-
/* @__PURE__ */ (0,
|
|
5653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5655
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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" })
|
|
5357
5657
|
] }),
|
|
5358
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
5359
|
-
/* @__PURE__ */ (0,
|
|
5658
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
5659
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5360
5660
|
"li",
|
|
5361
5661
|
{
|
|
5362
5662
|
"data-testid": "channel-row",
|
|
@@ -5364,11 +5664,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5364
5664
|
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
5365
5665
|
onClick: (e) => {
|
|
5366
5666
|
setActiveId(c.id);
|
|
5367
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
5667
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor17.selectionModeFromModifiers)(e, "replace") }));
|
|
5368
5668
|
},
|
|
5369
5669
|
onDoubleClick: () => setRenaming(c.id),
|
|
5370
5670
|
children: [
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5671
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5372
5672
|
"button",
|
|
5373
5673
|
{
|
|
5374
5674
|
type: "button",
|
|
@@ -5382,8 +5682,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5382
5682
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
5383
5683
|
}
|
|
5384
5684
|
),
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
5685
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
5686
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5387
5687
|
"input",
|
|
5388
5688
|
{
|
|
5389
5689
|
autoFocus: true,
|
|
@@ -5400,16 +5700,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5400
5700
|
if (e.key === "Escape") setRenaming(null);
|
|
5401
5701
|
}
|
|
5402
5702
|
}
|
|
5403
|
-
) : /* @__PURE__ */ (0,
|
|
5703
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
5404
5704
|
]
|
|
5405
5705
|
},
|
|
5406
5706
|
c.id
|
|
5407
5707
|
)) }),
|
|
5408
|
-
/* @__PURE__ */ (0,
|
|
5409
|
-
/* @__PURE__ */ (0,
|
|
5410
|
-
/* @__PURE__ */ (0,
|
|
5411
|
-
/* @__PURE__ */ (0,
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5708
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5709
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
5710
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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" }),
|
|
5711
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
5712
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5413
5713
|
"button",
|
|
5414
5714
|
{
|
|
5415
5715
|
type: "button",
|
|
@@ -5422,24 +5722,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5422
5722
|
children: "Delete"
|
|
5423
5723
|
}
|
|
5424
5724
|
),
|
|
5425
|
-
/* @__PURE__ */ (0,
|
|
5426
|
-
/* @__PURE__ */ (0,
|
|
5725
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
5726
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5427
5727
|
"button",
|
|
5428
5728
|
{
|
|
5429
5729
|
type: "button",
|
|
5430
5730
|
className: btn2(),
|
|
5431
5731
|
disabled: !active && !hasSelection,
|
|
5432
5732
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
5433
|
-
onClick: () => attempt(() => (0,
|
|
5733
|
+
onClick: () => attempt(() => (0, import_image_editor17.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
5434
5734
|
children: "Export PNG"
|
|
5435
5735
|
}
|
|
5436
5736
|
),
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5737
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5438
5738
|
"input",
|
|
5439
5739
|
{
|
|
5440
5740
|
ref: fileInput,
|
|
5441
5741
|
type: "file",
|
|
5442
|
-
accept:
|
|
5742
|
+
accept: import_image_editor17.MASK_FILE_ACCEPT,
|
|
5443
5743
|
hidden: true,
|
|
5444
5744
|
"data-testid": "channel-import-input",
|
|
5445
5745
|
onChange: (e) => {
|
|
@@ -5449,18 +5749,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5449
5749
|
}
|
|
5450
5750
|
)
|
|
5451
5751
|
] }),
|
|
5452
|
-
error && /* @__PURE__ */ (0,
|
|
5752
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5453
5753
|
] });
|
|
5454
5754
|
};
|
|
5455
5755
|
|
|
5456
5756
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
5457
|
-
var
|
|
5458
|
-
var
|
|
5459
|
-
var
|
|
5757
|
+
var import_react29 = require("react");
|
|
5758
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5759
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5460
5760
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
5461
5761
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
5462
|
-
const [, setTick] = (0,
|
|
5463
|
-
(0,
|
|
5762
|
+
const [, setTick] = (0, import_react29.useState)(0);
|
|
5763
|
+
(0, import_react29.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
5464
5764
|
const bar = tool.bar();
|
|
5465
5765
|
if (!tool.active || !bar) return null;
|
|
5466
5766
|
const warp = tool.warpBar();
|
|
@@ -5472,17 +5772,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5472
5772
|
const v = Number(raw);
|
|
5473
5773
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
5474
5774
|
};
|
|
5475
|
-
return /* @__PURE__ */ (0,
|
|
5476
|
-
/* @__PURE__ */ (0,
|
|
5477
|
-
/* @__PURE__ */ (0,
|
|
5478
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
5479
|
-
/* @__PURE__ */ (0,
|
|
5480
|
-
/* @__PURE__ */ (0,
|
|
5481
|
-
/* @__PURE__ */ (0,
|
|
5775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("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: [
|
|
5776
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor18.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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)) }),
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor18.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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)) }),
|
|
5778
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
5779
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
5781
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor18.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
5482
5782
|
] }),
|
|
5483
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5485
|
-
/* @__PURE__ */ (0,
|
|
5783
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5784
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5486
5786
|
"input",
|
|
5487
5787
|
{
|
|
5488
5788
|
type: "number",
|
|
@@ -5503,9 +5803,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5503
5803
|
},
|
|
5504
5804
|
`${k}:${warp[k]}`
|
|
5505
5805
|
),
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
5507
5807
|
] }, k)),
|
|
5508
|
-
/* @__PURE__ */ (0,
|
|
5808
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5509
5809
|
"button",
|
|
5510
5810
|
{
|
|
5511
5811
|
type: "button",
|
|
@@ -5517,26 +5817,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5517
5817
|
children: "Vertical"
|
|
5518
5818
|
}
|
|
5519
5819
|
),
|
|
5520
|
-
/* @__PURE__ */ (0,
|
|
5521
|
-
/* @__PURE__ */ (0,
|
|
5522
|
-
/* @__PURE__ */ (0,
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5821
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
5822
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5523
5823
|
"select",
|
|
5524
5824
|
{
|
|
5525
5825
|
"aria-label": "Warp grid",
|
|
5526
|
-
value:
|
|
5826
|
+
value: import_image_editor18.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
5527
5827
|
onChange: (e) => {
|
|
5528
|
-
const g =
|
|
5828
|
+
const g = import_image_editor18.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
5529
5829
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
5530
5830
|
},
|
|
5531
5831
|
className: imageFieldClass,
|
|
5532
|
-
children:
|
|
5832
|
+
children: import_image_editor18.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
5533
5833
|
}
|
|
5534
5834
|
)
|
|
5535
5835
|
] })
|
|
5536
5836
|
] }),
|
|
5537
|
-
tool.mode !== "warp" &&
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5539
|
-
/* @__PURE__ */ (0,
|
|
5837
|
+
tool.mode !== "warp" && import_image_editor18.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
5838
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
5839
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5540
5840
|
"input",
|
|
5541
5841
|
{
|
|
5542
5842
|
type: "number",
|
|
@@ -5556,8 +5856,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5556
5856
|
},
|
|
5557
5857
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
5558
5858
|
),
|
|
5559
|
-
/* @__PURE__ */ (0,
|
|
5560
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
5860
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5561
5861
|
"button",
|
|
5562
5862
|
{
|
|
5563
5863
|
type: "button",
|
|
@@ -5572,33 +5872,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5572
5872
|
}
|
|
5573
5873
|
)
|
|
5574
5874
|
] }, f.id)),
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5875
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5578
5878
|
"select",
|
|
5579
5879
|
{
|
|
5580
5880
|
"aria-label": "Interpolation",
|
|
5581
5881
|
value: tool.interpolation,
|
|
5582
5882
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
5583
5883
|
className: imageFieldClass,
|
|
5584
|
-
children:
|
|
5884
|
+
children: import_image_editor18.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
5585
5885
|
}
|
|
5586
5886
|
)
|
|
5587
5887
|
] }),
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
5589
|
-
/* @__PURE__ */ (0,
|
|
5590
|
-
tool.error && /* @__PURE__ */ (0,
|
|
5888
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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" }),
|
|
5889
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
5890
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
5591
5891
|
] });
|
|
5592
5892
|
};
|
|
5593
5893
|
|
|
5594
5894
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
5595
|
-
var
|
|
5596
|
-
var
|
|
5597
|
-
var
|
|
5895
|
+
var import_react30 = require("react");
|
|
5896
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5897
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5598
5898
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
5599
|
-
const [, setTick] = (0,
|
|
5600
|
-
(0,
|
|
5601
|
-
const [error, setError] = (0,
|
|
5899
|
+
const [, setTick] = (0, import_react30.useState)(0);
|
|
5900
|
+
(0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5901
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5602
5902
|
const active = controller.getActiveLayer();
|
|
5603
5903
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
5604
5904
|
const set = (change) => {
|
|
@@ -5606,28 +5906,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5606
5906
|
if (!shapeId) return;
|
|
5607
5907
|
try {
|
|
5608
5908
|
setError(null);
|
|
5609
|
-
(0,
|
|
5909
|
+
(0, import_image_editor19.applyShapeOptions)(controller, shapeId, change);
|
|
5610
5910
|
} catch (e) {
|
|
5611
5911
|
setError(e instanceof Error ? e.message : String(e));
|
|
5612
5912
|
}
|
|
5613
5913
|
};
|
|
5614
5914
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
5615
|
-
return /* @__PURE__ */ (0,
|
|
5616
|
-
/* @__PURE__ */ (0,
|
|
5617
|
-
/* @__PURE__ */ (0,
|
|
5618
|
-
/* @__PURE__ */ (0,
|
|
5619
|
-
/* @__PURE__ */ (0,
|
|
5915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
5916
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor19.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor19.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
5917
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5919
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
5620
5920
|
"Fill",
|
|
5621
|
-
/* @__PURE__ */ (0,
|
|
5921
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
5622
5922
|
] }),
|
|
5623
|
-
/* @__PURE__ */ (0,
|
|
5624
|
-
/* @__PURE__ */ (0,
|
|
5923
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5924
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
5625
5925
|
"Stroke",
|
|
5626
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
5627
5927
|
] }),
|
|
5628
|
-
/* @__PURE__ */ (0,
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5629
5929
|
"Width",
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5631
5931
|
"input",
|
|
5632
5932
|
{
|
|
5633
5933
|
type: "number",
|
|
@@ -5641,52 +5941,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5641
5941
|
)
|
|
5642
5942
|
] })
|
|
5643
5943
|
] }),
|
|
5644
|
-
/* @__PURE__ */ (0,
|
|
5645
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
5944
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5945
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5646
5946
|
"Radius",
|
|
5647
|
-
/* @__PURE__ */ (0,
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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}` })
|
|
5648
5948
|
] }),
|
|
5649
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
5949
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5650
5950
|
"Sides",
|
|
5651
|
-
/* @__PURE__ */ (0,
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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}` })
|
|
5652
5952
|
] }),
|
|
5653
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
5654
|
-
/* @__PURE__ */ (0,
|
|
5953
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5954
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5655
5955
|
"Points",
|
|
5656
|
-
/* @__PURE__ */ (0,
|
|
5956
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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}` })
|
|
5657
5957
|
] }),
|
|
5658
|
-
/* @__PURE__ */ (0,
|
|
5958
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5659
5959
|
"Inner",
|
|
5660
|
-
/* @__PURE__ */ (0,
|
|
5960
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
5661
5961
|
] })
|
|
5662
5962
|
] }),
|
|
5663
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
5664
|
-
/* @__PURE__ */ (0,
|
|
5963
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5964
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5665
5965
|
"Weight",
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
5966
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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}` })
|
|
5667
5967
|
] }),
|
|
5668
|
-
/* @__PURE__ */ (0,
|
|
5669
|
-
/* @__PURE__ */ (0,
|
|
5968
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5969
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
5670
5970
|
"Arrowhead"
|
|
5671
5971
|
] })
|
|
5672
5972
|
] })
|
|
5673
5973
|
] }),
|
|
5674
|
-
/* @__PURE__ */ (0,
|
|
5675
|
-
error && /* @__PURE__ */ (0,
|
|
5974
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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." }),
|
|
5975
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5676
5976
|
] });
|
|
5677
5977
|
};
|
|
5678
5978
|
|
|
5679
5979
|
// src/image-editor/TypeOptionsBar.tsx
|
|
5680
|
-
var
|
|
5681
|
-
var
|
|
5682
|
-
var
|
|
5980
|
+
var import_react31 = require("react");
|
|
5981
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
5982
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5683
5983
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
5684
5984
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
5685
5985
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
5686
|
-
const [, setTick] = (0,
|
|
5687
|
-
(0,
|
|
5688
|
-
(0,
|
|
5689
|
-
const [error, setError] = (0,
|
|
5986
|
+
const [, setTick] = (0, import_react31.useState)(0);
|
|
5987
|
+
(0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5988
|
+
(0, import_react31.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
5989
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
5690
5990
|
const active = controller.getActiveLayer();
|
|
5691
5991
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
5692
5992
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -5739,11 +6039,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5739
6039
|
setError(e instanceof Error ? e.message : String(e));
|
|
5740
6040
|
}
|
|
5741
6041
|
};
|
|
5742
|
-
return /* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5744
|
-
/* @__PURE__ */ (0,
|
|
6042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6043
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6044
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5745
6045
|
"Font",
|
|
5746
|
-
/* @__PURE__ */ (0,
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5747
6047
|
"input",
|
|
5748
6048
|
{
|
|
5749
6049
|
list: "pixerate-type-fonts",
|
|
@@ -5753,11 +6053,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5753
6053
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
5754
6054
|
}
|
|
5755
6055
|
),
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
6056
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: f }, f)) })
|
|
5757
6057
|
] }),
|
|
5758
|
-
/* @__PURE__ */ (0,
|
|
6058
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5759
6059
|
"Size",
|
|
5760
|
-
/* @__PURE__ */ (0,
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5761
6061
|
"input",
|
|
5762
6062
|
{
|
|
5763
6063
|
type: "number",
|
|
@@ -5770,14 +6070,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5770
6070
|
}
|
|
5771
6071
|
)
|
|
5772
6072
|
] }),
|
|
5773
|
-
/* @__PURE__ */ (0,
|
|
5774
|
-
/* @__PURE__ */ (0,
|
|
5775
|
-
/* @__PURE__ */ (0,
|
|
6073
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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" }),
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6075
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
5776
6076
|
] }),
|
|
5777
|
-
/* @__PURE__ */ (0,
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5779
|
-
|
|
5780
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6077
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor20.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6078
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6079
|
+
import_image_editor20.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6080
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5781
6081
|
"button",
|
|
5782
6082
|
{
|
|
5783
6083
|
type: "button",
|
|
@@ -5789,19 +6089,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5789
6089
|
}
|
|
5790
6090
|
)
|
|
5791
6091
|
] }),
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5793
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6092
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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." }),
|
|
6093
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
5794
6094
|
"Missing ",
|
|
5795
6095
|
missing.length === 1 ? "font" : "fonts",
|
|
5796
6096
|
": ",
|
|
5797
6097
|
missing.join(", ")
|
|
5798
6098
|
] }),
|
|
5799
|
-
error && /* @__PURE__ */ (0,
|
|
6099
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5800
6100
|
] });
|
|
5801
6101
|
};
|
|
5802
6102
|
|
|
5803
6103
|
// src/image-editor/ImageEditor.tsx
|
|
5804
|
-
var
|
|
6104
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5805
6105
|
var ImageEditor = ({
|
|
5806
6106
|
editor: externalEditor,
|
|
5807
6107
|
src,
|
|
@@ -5825,51 +6125,51 @@ var ImageEditor = ({
|
|
|
5825
6125
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
5826
6126
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
5827
6127
|
});
|
|
5828
|
-
const legacyProcess = (0,
|
|
5829
|
-
const [activeTab, setActiveTab] = (0,
|
|
5830
|
-
const rootRef = (0,
|
|
6128
|
+
const legacyProcess = (0, import_image_editor21.normalizeProcessVersion)(state.adjustments.process) < import_image_editor21.LATEST_PROCESS_VERSION;
|
|
6129
|
+
const [activeTab, setActiveTab] = (0, import_react32.useState)("crop");
|
|
6130
|
+
const rootRef = (0, import_react32.useRef)(null);
|
|
5831
6131
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
5832
|
-
const activeTabRef = (0,
|
|
6132
|
+
const activeTabRef = (0, import_react32.useRef)(activeTab);
|
|
5833
6133
|
activeTabRef.current = activeTab;
|
|
5834
6134
|
const openPanel = async (ref) => {
|
|
5835
6135
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
5836
6136
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
5837
6137
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
5838
6138
|
};
|
|
5839
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
5840
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
5841
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
5842
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
5843
|
-
const [typeSession, setTypeSession] = (0,
|
|
5844
|
-
const [selectionError, setSelectionError] = (0,
|
|
5845
|
-
const [paintError, setPaintError] = (0,
|
|
5846
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
6139
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react32.useState)(null);
|
|
6140
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6141
|
+
const [shapeOptions, setShapeOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6142
|
+
const [typeOptions, setTypeOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6143
|
+
const [typeSession, setTypeSession] = (0, import_react32.useState)(null);
|
|
6144
|
+
const [selectionError, setSelectionError] = (0, import_react32.useState)(null);
|
|
6145
|
+
const [paintError, setPaintError] = (0, import_react32.useState)(null);
|
|
6146
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react32.useState)(null);
|
|
5847
6147
|
const handleCanvasError = (source, message) => {
|
|
5848
6148
|
if (source === "paint") setPaintError(message);
|
|
5849
6149
|
else if (source === "select") setSelectionError(message);
|
|
5850
6150
|
else setShapeTypeError(message);
|
|
5851
6151
|
};
|
|
5852
6152
|
const finishTyping = () => setTypeSession(null);
|
|
5853
|
-
const transformToolRef = (0,
|
|
5854
|
-
const transformControllerRef = (0,
|
|
6153
|
+
const transformToolRef = (0, import_react32.useRef)(null);
|
|
6154
|
+
const transformControllerRef = (0, import_react32.useRef)(controller);
|
|
5855
6155
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
5856
6156
|
transformToolRef.current?.cancel();
|
|
5857
|
-
transformToolRef.current = new
|
|
6157
|
+
transformToolRef.current = new import_image_editor21.FreeTransformTool(controller, {
|
|
5858
6158
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
5859
6159
|
});
|
|
5860
6160
|
transformControllerRef.current = controller;
|
|
5861
6161
|
}
|
|
5862
6162
|
const transformTool = transformToolRef.current;
|
|
5863
|
-
const [, setTransformTick] = (0,
|
|
5864
|
-
(0,
|
|
5865
|
-
(0,
|
|
5866
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
5867
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
5868
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
5869
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
5870
|
-
const [aiError, setAiError] = (0,
|
|
5871
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
5872
|
-
const [aiTarget, setAiTarget] = (0,
|
|
6163
|
+
const [, setTransformTick] = (0, import_react32.useState)(0);
|
|
6164
|
+
(0, import_react32.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
6165
|
+
(0, import_react32.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
6166
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react32.useState)("");
|
|
6167
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react32.useState)("annotations");
|
|
6168
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react32.useState)(false);
|
|
6169
|
+
const [isInpainting, setIsInpainting] = (0, import_react32.useState)(false);
|
|
6170
|
+
const [aiError, setAiError] = (0, import_react32.useState)(null);
|
|
6171
|
+
const [aiSuccess, setAiSuccess] = (0, import_react32.useState)(null);
|
|
6172
|
+
const [aiTarget, setAiTarget] = (0, import_react32.useState)("auto");
|
|
5873
6173
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
5874
6174
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
5875
6175
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5932,11 +6232,11 @@ var ImageEditor = ({
|
|
|
5932
6232
|
setIsInpainting(false);
|
|
5933
6233
|
}
|
|
5934
6234
|
};
|
|
5935
|
-
const [activeColor, setActiveColor] = (0,
|
|
5936
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5937
|
-
const [fontSize, setFontSize] = (0,
|
|
5938
|
-
const [textInput, setTextInput] = (0,
|
|
5939
|
-
(0,
|
|
6235
|
+
const [activeColor, setActiveColor] = (0, import_react32.useState)("#ef4444");
|
|
6236
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react32.useState)(3);
|
|
6237
|
+
const [fontSize, setFontSize] = (0, import_react32.useState)(24);
|
|
6238
|
+
const [textInput, setTextInput] = (0, import_react32.useState)("");
|
|
6239
|
+
(0, import_react32.useEffect)(() => {
|
|
5940
6240
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5941
6241
|
editor.setTool("crop");
|
|
5942
6242
|
}
|
|
@@ -5964,16 +6264,16 @@ var ImageEditor = ({
|
|
|
5964
6264
|
link.click();
|
|
5965
6265
|
}
|
|
5966
6266
|
};
|
|
5967
|
-
return /* @__PURE__ */ (0,
|
|
6267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5968
6268
|
"div",
|
|
5969
6269
|
{
|
|
5970
6270
|
ref: rootRef,
|
|
5971
6271
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5972
6272
|
style,
|
|
5973
6273
|
children: [
|
|
5974
|
-
/* @__PURE__ */ (0,
|
|
5975
|
-
/* @__PURE__ */ (0,
|
|
5976
|
-
/* @__PURE__ */ (0,
|
|
6274
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
6275
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
6276
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5977
6277
|
"button",
|
|
5978
6278
|
{
|
|
5979
6279
|
type: "button",
|
|
@@ -5988,7 +6288,7 @@ var ImageEditor = ({
|
|
|
5988
6288
|
children: "Transform & Crop"
|
|
5989
6289
|
}
|
|
5990
6290
|
),
|
|
5991
|
-
/* @__PURE__ */ (0,
|
|
6291
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5992
6292
|
"button",
|
|
5993
6293
|
{
|
|
5994
6294
|
type: "button",
|
|
@@ -6003,7 +6303,7 @@ var ImageEditor = ({
|
|
|
6003
6303
|
children: "Adjustments"
|
|
6004
6304
|
}
|
|
6005
6305
|
),
|
|
6006
|
-
/* @__PURE__ */ (0,
|
|
6306
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6007
6307
|
"button",
|
|
6008
6308
|
{
|
|
6009
6309
|
type: "button",
|
|
@@ -6018,7 +6318,7 @@ var ImageEditor = ({
|
|
|
6018
6318
|
children: "Layers"
|
|
6019
6319
|
}
|
|
6020
6320
|
),
|
|
6021
|
-
/* @__PURE__ */ (0,
|
|
6321
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6022
6322
|
"button",
|
|
6023
6323
|
{
|
|
6024
6324
|
type: "button",
|
|
@@ -6033,7 +6333,7 @@ var ImageEditor = ({
|
|
|
6033
6333
|
children: "Paint"
|
|
6034
6334
|
}
|
|
6035
6335
|
),
|
|
6036
|
-
/* @__PURE__ */ (0,
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6037
6337
|
"button",
|
|
6038
6338
|
{
|
|
6039
6339
|
type: "button",
|
|
@@ -6048,7 +6348,7 @@ var ImageEditor = ({
|
|
|
6048
6348
|
children: "Select & Mask"
|
|
6049
6349
|
}
|
|
6050
6350
|
),
|
|
6051
|
-
/* @__PURE__ */ (0,
|
|
6351
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6052
6352
|
"button",
|
|
6053
6353
|
{
|
|
6054
6354
|
type: "button",
|
|
@@ -6063,7 +6363,7 @@ var ImageEditor = ({
|
|
|
6063
6363
|
children: "Annotations"
|
|
6064
6364
|
}
|
|
6065
6365
|
),
|
|
6066
|
-
/* @__PURE__ */ (0,
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6067
6367
|
"button",
|
|
6068
6368
|
{
|
|
6069
6369
|
type: "button",
|
|
@@ -6078,7 +6378,7 @@ var ImageEditor = ({
|
|
|
6078
6378
|
children: "Depth Mask"
|
|
6079
6379
|
}
|
|
6080
6380
|
),
|
|
6081
|
-
/* @__PURE__ */ (0,
|
|
6381
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6082
6382
|
"button",
|
|
6083
6383
|
{
|
|
6084
6384
|
type: "button",
|
|
@@ -6091,14 +6391,14 @@ var ImageEditor = ({
|
|
|
6091
6391
|
"aria-selected": activeTab === "ai",
|
|
6092
6392
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
6093
6393
|
children: [
|
|
6094
|
-
/* @__PURE__ */ (0,
|
|
6394
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }) }),
|
|
6095
6395
|
"AI Tools"
|
|
6096
6396
|
]
|
|
6097
6397
|
}
|
|
6098
6398
|
)
|
|
6099
6399
|
] }),
|
|
6100
|
-
/* @__PURE__ */ (0,
|
|
6101
|
-
/* @__PURE__ */ (0,
|
|
6400
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
6401
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6102
6402
|
"button",
|
|
6103
6403
|
{
|
|
6104
6404
|
type: "button",
|
|
@@ -6109,7 +6409,7 @@ var ImageEditor = ({
|
|
|
6109
6409
|
children: "\u21A9"
|
|
6110
6410
|
}
|
|
6111
6411
|
),
|
|
6112
|
-
/* @__PURE__ */ (0,
|
|
6412
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6113
6413
|
"button",
|
|
6114
6414
|
{
|
|
6115
6415
|
type: "button",
|
|
@@ -6120,7 +6420,7 @@ var ImageEditor = ({
|
|
|
6120
6420
|
children: "\u21AA"
|
|
6121
6421
|
}
|
|
6122
6422
|
),
|
|
6123
|
-
/* @__PURE__ */ (0,
|
|
6423
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6124
6424
|
"button",
|
|
6125
6425
|
{
|
|
6126
6426
|
type: "button",
|
|
@@ -6129,8 +6429,8 @@ var ImageEditor = ({
|
|
|
6129
6429
|
children: "Reset"
|
|
6130
6430
|
}
|
|
6131
6431
|
),
|
|
6132
|
-
/* @__PURE__ */ (0,
|
|
6133
|
-
/* @__PURE__ */ (0,
|
|
6432
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6433
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6134
6434
|
"button",
|
|
6135
6435
|
{
|
|
6136
6436
|
type: "button",
|
|
@@ -6140,11 +6440,11 @@ var ImageEditor = ({
|
|
|
6140
6440
|
children: "-"
|
|
6141
6441
|
}
|
|
6142
6442
|
),
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6443
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
6144
6444
|
Math.round(state.zoom * 100),
|
|
6145
6445
|
"%"
|
|
6146
6446
|
] }),
|
|
6147
|
-
/* @__PURE__ */ (0,
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6148
6448
|
"button",
|
|
6149
6449
|
{
|
|
6150
6450
|
type: "button",
|
|
@@ -6154,8 +6454,8 @@ var ImageEditor = ({
|
|
|
6154
6454
|
children: "+"
|
|
6155
6455
|
}
|
|
6156
6456
|
),
|
|
6157
|
-
/* @__PURE__ */ (0,
|
|
6158
|
-
/* @__PURE__ */ (0,
|
|
6457
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6458
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6159
6459
|
"button",
|
|
6160
6460
|
{
|
|
6161
6461
|
type: "button",
|
|
@@ -6166,7 +6466,7 @@ var ImageEditor = ({
|
|
|
6166
6466
|
children: "Hold Compare"
|
|
6167
6467
|
}
|
|
6168
6468
|
),
|
|
6169
|
-
/* @__PURE__ */ (0,
|
|
6469
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6170
6470
|
"button",
|
|
6171
6471
|
{
|
|
6172
6472
|
type: "button",
|
|
@@ -6177,10 +6477,10 @@ var ImageEditor = ({
|
|
|
6177
6477
|
)
|
|
6178
6478
|
] })
|
|
6179
6479
|
] }),
|
|
6180
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
6181
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
6182
|
-
/* @__PURE__ */ (0,
|
|
6183
|
-
/* @__PURE__ */ (0,
|
|
6480
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
6481
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
6482
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
6483
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6184
6484
|
ImageEditorCanvas,
|
|
6185
6485
|
{
|
|
6186
6486
|
editor,
|
|
@@ -6204,11 +6504,11 @@ var ImageEditor = ({
|
|
|
6204
6504
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
6205
6505
|
}
|
|
6206
6506
|
),
|
|
6207
|
-
/* @__PURE__ */ (0,
|
|
6208
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6211
|
-
/* @__PURE__ */ (0,
|
|
6507
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: imageSidebarClass, children: [
|
|
6508
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6509
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
6510
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
6511
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6212
6512
|
"button",
|
|
6213
6513
|
{
|
|
6214
6514
|
type: "button",
|
|
@@ -6220,7 +6520,7 @@ var ImageEditor = ({
|
|
|
6220
6520
|
children: "Freeform"
|
|
6221
6521
|
}
|
|
6222
6522
|
),
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6523
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6224
6524
|
"button",
|
|
6225
6525
|
{
|
|
6226
6526
|
type: "button",
|
|
@@ -6232,7 +6532,7 @@ var ImageEditor = ({
|
|
|
6232
6532
|
children: "1:1 Square"
|
|
6233
6533
|
}
|
|
6234
6534
|
),
|
|
6235
|
-
/* @__PURE__ */ (0,
|
|
6535
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6236
6536
|
"button",
|
|
6237
6537
|
{
|
|
6238
6538
|
type: "button",
|
|
@@ -6244,7 +6544,7 @@ var ImageEditor = ({
|
|
|
6244
6544
|
children: "4:3 Standard"
|
|
6245
6545
|
}
|
|
6246
6546
|
),
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6547
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6248
6548
|
"button",
|
|
6249
6549
|
{
|
|
6250
6550
|
type: "button",
|
|
@@ -6256,7 +6556,7 @@ var ImageEditor = ({
|
|
|
6256
6556
|
children: "16:9 Wide"
|
|
6257
6557
|
}
|
|
6258
6558
|
),
|
|
6259
|
-
/* @__PURE__ */ (0,
|
|
6559
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6260
6560
|
"button",
|
|
6261
6561
|
{
|
|
6262
6562
|
type: "button",
|
|
@@ -6268,7 +6568,7 @@ var ImageEditor = ({
|
|
|
6268
6568
|
children: "3:2 Photo"
|
|
6269
6569
|
}
|
|
6270
6570
|
),
|
|
6271
|
-
/* @__PURE__ */ (0,
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6272
6572
|
"button",
|
|
6273
6573
|
{
|
|
6274
6574
|
type: "button",
|
|
@@ -6281,10 +6581,10 @@ var ImageEditor = ({
|
|
|
6281
6581
|
}
|
|
6282
6582
|
)
|
|
6283
6583
|
] }),
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6285
|
-
/* @__PURE__ */ (0,
|
|
6286
|
-
/* @__PURE__ */ (0,
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
6587
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6288
6588
|
"button",
|
|
6289
6589
|
{
|
|
6290
6590
|
type: "button",
|
|
@@ -6293,7 +6593,7 @@ var ImageEditor = ({
|
|
|
6293
6593
|
children: "Rotate -90\xB0"
|
|
6294
6594
|
}
|
|
6295
6595
|
),
|
|
6296
|
-
/* @__PURE__ */ (0,
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6297
6597
|
"button",
|
|
6298
6598
|
{
|
|
6299
6599
|
type: "button",
|
|
@@ -6302,7 +6602,7 @@ var ImageEditor = ({
|
|
|
6302
6602
|
children: "Rotate +90\xB0"
|
|
6303
6603
|
}
|
|
6304
6604
|
),
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6605
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6306
6606
|
"button",
|
|
6307
6607
|
{
|
|
6308
6608
|
type: "button",
|
|
@@ -6311,7 +6611,7 @@ var ImageEditor = ({
|
|
|
6311
6611
|
children: "Flip Horizontal"
|
|
6312
6612
|
}
|
|
6313
6613
|
),
|
|
6314
|
-
/* @__PURE__ */ (0,
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6315
6615
|
"button",
|
|
6316
6616
|
{
|
|
6317
6617
|
type: "button",
|
|
@@ -6322,10 +6622,10 @@ var ImageEditor = ({
|
|
|
6322
6622
|
)
|
|
6323
6623
|
] })
|
|
6324
6624
|
] }),
|
|
6325
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
6326
|
-
/* @__PURE__ */ (0,
|
|
6327
|
-
/* @__PURE__ */ (0,
|
|
6328
|
-
/* @__PURE__ */ (0,
|
|
6625
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
6628
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6329
6629
|
"button",
|
|
6330
6630
|
{
|
|
6331
6631
|
type: "button",
|
|
@@ -6335,25 +6635,25 @@ var ImageEditor = ({
|
|
|
6335
6635
|
}
|
|
6336
6636
|
)
|
|
6337
6637
|
] }),
|
|
6338
|
-
/* @__PURE__ */ (0,
|
|
6339
|
-
|
|
6340
|
-
/* @__PURE__ */ (0,
|
|
6638
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Histogram, { histogram: editor.histogram }),
|
|
6639
|
+
import_image_editor21.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react32.default.Fragment, { children: [
|
|
6640
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6341
6641
|
ControlSlider,
|
|
6342
6642
|
{
|
|
6343
6643
|
spec,
|
|
6344
|
-
value: (0,
|
|
6644
|
+
value: (0, import_image_editor21.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
6345
6645
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
6346
6646
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
6347
6647
|
}
|
|
6348
6648
|
),
|
|
6349
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6649
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6350
6650
|
"div",
|
|
6351
6651
|
{
|
|
6352
6652
|
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",
|
|
6353
6653
|
"data-testid": "image-editor-process-notice",
|
|
6354
6654
|
children: [
|
|
6355
|
-
/* @__PURE__ */ (0,
|
|
6356
|
-
/* @__PURE__ */ (0,
|
|
6655
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
6656
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6357
6657
|
"button",
|
|
6358
6658
|
{
|
|
6359
6659
|
type: "button",
|
|
@@ -6366,7 +6666,7 @@ var ImageEditor = ({
|
|
|
6366
6666
|
}
|
|
6367
6667
|
)
|
|
6368
6668
|
] }, spec.id)),
|
|
6369
|
-
/* @__PURE__ */ (0,
|
|
6669
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6370
6670
|
AdjustmentLayersPanel,
|
|
6371
6671
|
{
|
|
6372
6672
|
controller,
|
|
@@ -6375,9 +6675,9 @@ var ImageEditor = ({
|
|
|
6375
6675
|
}
|
|
6376
6676
|
) })
|
|
6377
6677
|
] }),
|
|
6378
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
6379
|
-
/* @__PURE__ */ (0,
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6678
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6679
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
6680
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6381
6681
|
"button",
|
|
6382
6682
|
{
|
|
6383
6683
|
type: "button",
|
|
@@ -6388,15 +6688,15 @@ var ImageEditor = ({
|
|
|
6388
6688
|
children: "Free Transform"
|
|
6389
6689
|
}
|
|
6390
6690
|
),
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
6392
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
6691
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersPanel, { controller }),
|
|
6692
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
6693
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
6694
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ColorProfilePanel, { controller })
|
|
6395
6695
|
] }),
|
|
6396
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
6397
|
-
/* @__PURE__ */ (0,
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6696
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6697
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrushOptionsBar, { controller }),
|
|
6699
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6400
6700
|
"button",
|
|
6401
6701
|
{
|
|
6402
6702
|
type: "button",
|
|
@@ -6407,12 +6707,12 @@ var ImageEditor = ({
|
|
|
6407
6707
|
children: "Free Transform"
|
|
6408
6708
|
}
|
|
6409
6709
|
),
|
|
6410
|
-
paintError && /* @__PURE__ */ (0,
|
|
6411
|
-
/* @__PURE__ */ (0,
|
|
6710
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
6711
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersPanel, { controller }) })
|
|
6412
6712
|
] }),
|
|
6413
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
6414
|
-
/* @__PURE__ */ (0,
|
|
6415
|
-
/* @__PURE__ */ (0,
|
|
6713
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6714
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
6715
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6416
6716
|
"button",
|
|
6417
6717
|
{
|
|
6418
6718
|
type: "button",
|
|
@@ -6423,13 +6723,13 @@ var ImageEditor = ({
|
|
|
6423
6723
|
},
|
|
6424
6724
|
t
|
|
6425
6725
|
)) }),
|
|
6426
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
6427
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
6428
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
6429
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
6430
|
-
/* @__PURE__ */ (0,
|
|
6431
|
-
/* @__PURE__ */ (0,
|
|
6432
|
-
/* @__PURE__ */ (0,
|
|
6726
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
6727
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
6728
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }),
|
|
6729
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
6730
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6731
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
6732
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6433
6733
|
"button",
|
|
6434
6734
|
{
|
|
6435
6735
|
type: "button",
|
|
@@ -6439,18 +6739,18 @@ var ImageEditor = ({
|
|
|
6439
6739
|
},
|
|
6440
6740
|
t
|
|
6441
6741
|
)) }),
|
|
6442
|
-
/* @__PURE__ */ (0,
|
|
6443
|
-
/* @__PURE__ */ (0,
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6446
|
-
/* @__PURE__ */ (0,
|
|
6447
|
-
/* @__PURE__ */ (0,
|
|
6448
|
-
/* @__PURE__ */ (0,
|
|
6742
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
6743
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
6745
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
6746
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
6747
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Width:" }),
|
|
6748
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
6449
6749
|
strokeWidth,
|
|
6450
6750
|
"px"
|
|
6451
6751
|
] })
|
|
6452
6752
|
] }),
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6753
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6454
6754
|
"input",
|
|
6455
6755
|
{
|
|
6456
6756
|
type: "range",
|
|
@@ -6463,10 +6763,10 @@ var ImageEditor = ({
|
|
|
6463
6763
|
)
|
|
6464
6764
|
] })
|
|
6465
6765
|
] }),
|
|
6466
|
-
/* @__PURE__ */ (0,
|
|
6467
|
-
/* @__PURE__ */ (0,
|
|
6468
|
-
/* @__PURE__ */ (0,
|
|
6469
|
-
/* @__PURE__ */ (0,
|
|
6766
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6767
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
6768
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
|
|
6769
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6470
6770
|
"input",
|
|
6471
6771
|
{
|
|
6472
6772
|
type: "text",
|
|
@@ -6477,7 +6777,7 @@ var ImageEditor = ({
|
|
|
6477
6777
|
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"
|
|
6478
6778
|
}
|
|
6479
6779
|
),
|
|
6480
|
-
/* @__PURE__ */ (0,
|
|
6780
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6481
6781
|
"button",
|
|
6482
6782
|
{
|
|
6483
6783
|
type: "button",
|
|
@@ -6487,14 +6787,14 @@ var ImageEditor = ({
|
|
|
6487
6787
|
}
|
|
6488
6788
|
)
|
|
6489
6789
|
] }),
|
|
6490
|
-
/* @__PURE__ */ (0,
|
|
6491
|
-
/* @__PURE__ */ (0,
|
|
6492
|
-
/* @__PURE__ */ (0,
|
|
6790
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
6791
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Font Size:" }),
|
|
6792
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
6493
6793
|
fontSize,
|
|
6494
6794
|
"px"
|
|
6495
6795
|
] })
|
|
6496
6796
|
] }),
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6797
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6498
6798
|
"input",
|
|
6499
6799
|
{
|
|
6500
6800
|
type: "range",
|
|
@@ -6505,14 +6805,14 @@ var ImageEditor = ({
|
|
|
6505
6805
|
className: imageRangeClass
|
|
6506
6806
|
}
|
|
6507
6807
|
),
|
|
6508
|
-
/* @__PURE__ */ (0,
|
|
6509
|
-
/* @__PURE__ */ (0,
|
|
6510
|
-
/* @__PURE__ */ (0,
|
|
6808
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6809
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6810
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
6511
6811
|
"Layers (",
|
|
6512
6812
|
state.annotations.length,
|
|
6513
6813
|
")"
|
|
6514
6814
|
] }),
|
|
6515
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
6815
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6516
6816
|
"button",
|
|
6517
6817
|
{
|
|
6518
6818
|
type: "button",
|
|
@@ -6521,7 +6821,7 @@ var ImageEditor = ({
|
|
|
6521
6821
|
children: "Delete Selected"
|
|
6522
6822
|
}
|
|
6523
6823
|
),
|
|
6524
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
6824
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6525
6825
|
"button",
|
|
6526
6826
|
{
|
|
6527
6827
|
type: "button",
|
|
@@ -6532,10 +6832,10 @@ var ImageEditor = ({
|
|
|
6532
6832
|
)
|
|
6533
6833
|
] })
|
|
6534
6834
|
] }),
|
|
6535
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6537
|
-
/* @__PURE__ */ (0,
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6835
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6836
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6837
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
6838
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6539
6839
|
"button",
|
|
6540
6840
|
{
|
|
6541
6841
|
type: "button",
|
|
@@ -6545,8 +6845,8 @@ var ImageEditor = ({
|
|
|
6545
6845
|
}
|
|
6546
6846
|
)
|
|
6547
6847
|
] }),
|
|
6548
|
-
/* @__PURE__ */ (0,
|
|
6549
|
-
/* @__PURE__ */ (0,
|
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
6849
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6550
6850
|
"input",
|
|
6551
6851
|
{
|
|
6552
6852
|
type: "checkbox",
|
|
@@ -6555,12 +6855,12 @@ var ImageEditor = ({
|
|
|
6555
6855
|
className: "rounded accent-primary"
|
|
6556
6856
|
}
|
|
6557
6857
|
),
|
|
6558
|
-
/* @__PURE__ */ (0,
|
|
6858
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
6559
6859
|
] }),
|
|
6560
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
6561
|
-
/* @__PURE__ */ (0,
|
|
6562
|
-
/* @__PURE__ */ (0,
|
|
6563
|
-
/* @__PURE__ */ (0,
|
|
6860
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6861
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6862
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
6863
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6564
6864
|
"input",
|
|
6565
6865
|
{
|
|
6566
6866
|
type: "text",
|
|
@@ -6571,8 +6871,8 @@ var ImageEditor = ({
|
|
|
6571
6871
|
}
|
|
6572
6872
|
)
|
|
6573
6873
|
] }),
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
6575
|
-
/* @__PURE__ */ (0,
|
|
6874
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
|
|
6875
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6576
6876
|
"button",
|
|
6577
6877
|
{
|
|
6578
6878
|
type: "button",
|
|
@@ -6581,7 +6881,7 @@ var ImageEditor = ({
|
|
|
6581
6881
|
children: "Threshold Mode"
|
|
6582
6882
|
}
|
|
6583
6883
|
),
|
|
6584
|
-
/* @__PURE__ */ (0,
|
|
6884
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6585
6885
|
"button",
|
|
6586
6886
|
{
|
|
6587
6887
|
type: "button",
|
|
@@ -6591,12 +6891,12 @@ var ImageEditor = ({
|
|
|
6591
6891
|
}
|
|
6592
6892
|
)
|
|
6593
6893
|
] }),
|
|
6594
|
-
/* @__PURE__ */ (0,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
/* @__PURE__ */ (0,
|
|
6894
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6895
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
6897
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
6598
6898
|
] }),
|
|
6599
|
-
/* @__PURE__ */ (0,
|
|
6899
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6600
6900
|
"input",
|
|
6601
6901
|
{
|
|
6602
6902
|
type: "range",
|
|
@@ -6610,12 +6910,12 @@ var ImageEditor = ({
|
|
|
6610
6910
|
}
|
|
6611
6911
|
)
|
|
6612
6912
|
] }),
|
|
6613
|
-
/* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6616
|
-
/* @__PURE__ */ (0,
|
|
6913
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6914
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6915
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
6916
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
6617
6917
|
] }),
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6918
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6619
6919
|
"input",
|
|
6620
6920
|
{
|
|
6621
6921
|
type: "range",
|
|
@@ -6629,12 +6929,12 @@ var ImageEditor = ({
|
|
|
6629
6929
|
}
|
|
6630
6930
|
)
|
|
6631
6931
|
] }),
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6635
|
-
/* @__PURE__ */ (0,
|
|
6932
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6933
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6934
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Softness:" }),
|
|
6935
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
6636
6936
|
] }),
|
|
6637
|
-
/* @__PURE__ */ (0,
|
|
6937
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6638
6938
|
"input",
|
|
6639
6939
|
{
|
|
6640
6940
|
type: "range",
|
|
@@ -6646,8 +6946,8 @@ var ImageEditor = ({
|
|
|
6646
6946
|
}
|
|
6647
6947
|
)
|
|
6648
6948
|
] }),
|
|
6649
|
-
/* @__PURE__ */ (0,
|
|
6650
|
-
/* @__PURE__ */ (0,
|
|
6949
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
6950
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6651
6951
|
"input",
|
|
6652
6952
|
{
|
|
6653
6953
|
type: "checkbox",
|
|
@@ -6656,12 +6956,12 @@ var ImageEditor = ({
|
|
|
6656
6956
|
className: "rounded accent-primary"
|
|
6657
6957
|
}
|
|
6658
6958
|
),
|
|
6659
|
-
/* @__PURE__ */ (0,
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Invert Mask" })
|
|
6660
6960
|
] })
|
|
6661
6961
|
] })
|
|
6662
6962
|
] }),
|
|
6663
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
6664
|
-
/* @__PURE__ */ (0,
|
|
6963
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6964
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6665
6965
|
SelectionOptionsBar,
|
|
6666
6966
|
{
|
|
6667
6967
|
controller,
|
|
@@ -6672,9 +6972,9 @@ var ImageEditor = ({
|
|
|
6672
6972
|
selectionDisplay: state.selectionDisplay
|
|
6673
6973
|
}
|
|
6674
6974
|
),
|
|
6675
|
-
selectionError && /* @__PURE__ */ (0,
|
|
6676
|
-
/* @__PURE__ */ (0,
|
|
6677
|
-
/* @__PURE__ */ (0,
|
|
6975
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
6976
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", children: [
|
|
6977
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6678
6978
|
"button",
|
|
6679
6979
|
{
|
|
6680
6980
|
type: "button",
|
|
@@ -6685,7 +6985,7 @@ var ImageEditor = ({
|
|
|
6685
6985
|
children: "Transform Selection"
|
|
6686
6986
|
}
|
|
6687
6987
|
),
|
|
6688
|
-
/* @__PURE__ */ (0,
|
|
6988
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6689
6989
|
"button",
|
|
6690
6990
|
{
|
|
6691
6991
|
type: "button",
|
|
@@ -6697,13 +6997,13 @@ var ImageEditor = ({
|
|
|
6697
6997
|
}
|
|
6698
6998
|
)
|
|
6699
6999
|
] }),
|
|
6700
|
-
/* @__PURE__ */ (0,
|
|
6701
|
-
/* @__PURE__ */ (0,
|
|
7000
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChannelsPanel, { controller })
|
|
6702
7002
|
] }),
|
|
6703
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
6705
|
-
/* @__PURE__ */ (0,
|
|
6706
|
-
/* @__PURE__ */ (0,
|
|
7003
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7004
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Results go to" }),
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6707
7007
|
"select",
|
|
6708
7008
|
{
|
|
6709
7009
|
"aria-label": "AI result target",
|
|
@@ -6711,54 +7011,54 @@ var ImageEditor = ({
|
|
|
6711
7011
|
onChange: (e) => setAiTarget(e.target.value),
|
|
6712
7012
|
className: imageSelectClass,
|
|
6713
7013
|
children: [
|
|
6714
|
-
/* @__PURE__ */ (0,
|
|
6715
|
-
/* @__PURE__ */ (0,
|
|
6716
|
-
/* @__PURE__ */ (0,
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
7015
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
7016
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "replace", children: "Replace image" })
|
|
6717
7017
|
]
|
|
6718
7018
|
}
|
|
6719
7019
|
)
|
|
6720
7020
|
] }),
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
6723
|
-
/* @__PURE__ */ (0,
|
|
6724
|
-
/* @__PURE__ */ (0,
|
|
7021
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7022
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7023
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7024
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }) }),
|
|
6725
7025
|
"Background Removal"
|
|
6726
7026
|
] }),
|
|
6727
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
7027
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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..." })
|
|
6728
7028
|
] }),
|
|
6729
|
-
/* @__PURE__ */ (0,
|
|
6730
|
-
/* @__PURE__ */ (0,
|
|
7029
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
7030
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6731
7031
|
"button",
|
|
6732
7032
|
{
|
|
6733
7033
|
type: "button",
|
|
6734
7034
|
onClick: handleRemoveBackground,
|
|
6735
7035
|
disabled: isRemovingBg || isInpainting,
|
|
6736
7036
|
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",
|
|
6737
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
6738
|
-
/* @__PURE__ */ (0,
|
|
7037
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7038
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSpinnerClass }),
|
|
6739
7039
|
"Removing Background..."
|
|
6740
|
-
] }) : /* @__PURE__ */ (0,
|
|
6741
|
-
/* @__PURE__ */ (0,
|
|
7040
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7041
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }) }),
|
|
6742
7042
|
"Remove Background"
|
|
6743
7043
|
] })
|
|
6744
7044
|
}
|
|
6745
7045
|
)
|
|
6746
7046
|
] }),
|
|
6747
|
-
/* @__PURE__ */ (0,
|
|
6748
|
-
/* @__PURE__ */ (0,
|
|
6749
|
-
/* @__PURE__ */ (0,
|
|
6750
|
-
/* @__PURE__ */ (0,
|
|
6751
|
-
/* @__PURE__ */ (0,
|
|
6752
|
-
/* @__PURE__ */ (0,
|
|
7047
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7048
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7049
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7050
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
7051
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }),
|
|
7052
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "m14 7 3 3" })
|
|
6753
7053
|
] }),
|
|
6754
7054
|
"Generative Inpainting"
|
|
6755
7055
|
] }),
|
|
6756
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7056
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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..." })
|
|
6757
7057
|
] }),
|
|
6758
|
-
/* @__PURE__ */ (0,
|
|
6759
|
-
/* @__PURE__ */ (0,
|
|
6760
|
-
/* @__PURE__ */ (0,
|
|
6761
|
-
/* @__PURE__ */ (0,
|
|
7058
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
7059
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7060
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7061
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6762
7062
|
"textarea",
|
|
6763
7063
|
{
|
|
6764
7064
|
id: "ai-inpaint-prompt-react",
|
|
@@ -6770,10 +7070,10 @@ var ImageEditor = ({
|
|
|
6770
7070
|
}
|
|
6771
7071
|
)
|
|
6772
7072
|
] }),
|
|
6773
|
-
/* @__PURE__ */ (0,
|
|
6774
|
-
/* @__PURE__ */ (0,
|
|
6775
|
-
/* @__PURE__ */ (0,
|
|
6776
|
-
/* @__PURE__ */ (0,
|
|
7073
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7074
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7075
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7076
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6777
7077
|
"button",
|
|
6778
7078
|
{
|
|
6779
7079
|
type: "button",
|
|
@@ -6786,7 +7086,7 @@ var ImageEditor = ({
|
|
|
6786
7086
|
]
|
|
6787
7087
|
}
|
|
6788
7088
|
),
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6790
7090
|
"button",
|
|
6791
7091
|
{
|
|
6792
7092
|
type: "button",
|
|
@@ -6801,25 +7101,25 @@ var ImageEditor = ({
|
|
|
6801
7101
|
)
|
|
6802
7102
|
] })
|
|
6803
7103
|
] }),
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
7104
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6805
7105
|
"button",
|
|
6806
7106
|
{
|
|
6807
7107
|
type: "button",
|
|
6808
7108
|
onClick: handleInpaint,
|
|
6809
7109
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
6810
7110
|
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",
|
|
6811
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
6812
|
-
/* @__PURE__ */ (0,
|
|
7111
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7112
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSpinnerClass }),
|
|
6813
7113
|
"Generating Inpaint..."
|
|
6814
|
-
] }) : /* @__PURE__ */ (0,
|
|
6815
|
-
/* @__PURE__ */ (0,
|
|
7114
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7115
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }) }),
|
|
6816
7116
|
"Apply Inpainting"
|
|
6817
7117
|
] })
|
|
6818
7118
|
}
|
|
6819
7119
|
)
|
|
6820
7120
|
] }),
|
|
6821
|
-
aiError && /* @__PURE__ */ (0,
|
|
6822
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7121
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
7122
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
6823
7123
|
] })
|
|
6824
7124
|
] })
|
|
6825
7125
|
] })
|
|
@@ -6850,6 +7150,7 @@ var ImageEditor = ({
|
|
|
6850
7150
|
LayersPanel,
|
|
6851
7151
|
PaintGradientEditor,
|
|
6852
7152
|
RefineEdgePanel,
|
|
7153
|
+
SelectAndMaskWorkspace,
|
|
6853
7154
|
SelectionOptionsBar,
|
|
6854
7155
|
ShapeOptionsBar,
|
|
6855
7156
|
TypeOptionsBar,
|