@pixerate/editor-react 0.135.0 → 0.137.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-HHEBQE7D.js → chunk-6GWWDUEF.js} +814 -539
- package/dist/image-editor/SelectAndMaskWorkspace.d.cts +17 -0
- package/dist/image-editor/SelectAndMaskWorkspace.d.ts +17 -0
- package/dist/image-editor/index.cjs +832 -556
- 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 +1357 -1081
- 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,271 @@ 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
|
+
] }),
|
|
4736
|
+
/* @__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)(
|
|
4737
|
+
"canvas",
|
|
4738
|
+
{
|
|
4739
|
+
ref: canvasRef,
|
|
4740
|
+
"data-testid": "select-and-mask-preview",
|
|
4741
|
+
onPointerDown: onDown,
|
|
4742
|
+
onPointerMove: onMove,
|
|
4743
|
+
onPointerUp: onUp,
|
|
4744
|
+
style: {
|
|
4745
|
+
// Fitted to the area at its own aspect ratio; zoom and pan are a transform.
|
|
4746
|
+
maxWidth: "100%",
|
|
4747
|
+
maxHeight: "100%",
|
|
4748
|
+
transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`,
|
|
4749
|
+
imageRendering: zoom > 2 ? "pixelated" : void 0,
|
|
4750
|
+
cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair"
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
) })
|
|
4754
|
+
] }),
|
|
4755
|
+
/* @__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: [
|
|
4756
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4758
|
+
"View",
|
|
4759
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4760
|
+
ImageSelect,
|
|
4761
|
+
{
|
|
4762
|
+
label: "View",
|
|
4763
|
+
value: settings.view,
|
|
4764
|
+
options: import_image_editor14.SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
|
|
4765
|
+
onChange: (v) => set({ view: v })
|
|
4766
|
+
}
|
|
4767
|
+
)
|
|
4768
|
+
] }),
|
|
4769
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4770
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Opacity" }),
|
|
4772
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4773
|
+
Math.round(settings.opacity * 100),
|
|
4774
|
+
"%"
|
|
4775
|
+
] })
|
|
4776
|
+
] }),
|
|
4777
|
+
/* @__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 }) })
|
|
4778
|
+
] }),
|
|
4779
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4780
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
4781
|
+
"Show Edge (J)"
|
|
4782
|
+
] }),
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
4785
|
+
"Show Original (P)"
|
|
4786
|
+
] }),
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
4789
|
+
"Real-Time Refinement"
|
|
4790
|
+
] }),
|
|
4791
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
4793
|
+
"High Quality Preview"
|
|
4794
|
+
] }),
|
|
4795
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
4796
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4797
|
+
"Mode",
|
|
4798
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4799
|
+
ImageSelect,
|
|
4800
|
+
{
|
|
4801
|
+
label: "Refine mode",
|
|
4802
|
+
value: settings.refineMode,
|
|
4803
|
+
options: [
|
|
4804
|
+
{ value: "color", label: "Color Aware" },
|
|
4805
|
+
{ value: "object", label: "Object Aware" }
|
|
4806
|
+
],
|
|
4807
|
+
onChange: (v) => set({ refineMode: v })
|
|
4808
|
+
}
|
|
4809
|
+
)
|
|
4810
|
+
] }),
|
|
4811
|
+
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4812
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4813
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: c.label }),
|
|
4814
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4815
|
+
settings.params[c.id],
|
|
4816
|
+
c.unit
|
|
4817
|
+
] })
|
|
4818
|
+
] }),
|
|
4819
|
+
/* @__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 } }) })
|
|
4820
|
+
] }, c.id)),
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4822
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
4823
|
+
"Smart Radius"
|
|
4824
|
+
] }),
|
|
4825
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
4826
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4828
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
|
|
4829
|
+
"Decontaminate Colors",
|
|
4830
|
+
toLayer ? "" : " (new layer outputs)"
|
|
4831
|
+
] }),
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4833
|
+
settings.decontaminate,
|
|
4834
|
+
"%"
|
|
4835
|
+
] })
|
|
4836
|
+
] }),
|
|
4837
|
+
/* @__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 }) })
|
|
4838
|
+
] }),
|
|
4839
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4840
|
+
"Output To",
|
|
4841
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4842
|
+
ImageSelect,
|
|
4843
|
+
{
|
|
4844
|
+
label: "Output to",
|
|
4845
|
+
value: settings.output,
|
|
4846
|
+
options: import_image_editor14.REFINE_OUTPUTS.map((o) => ({ value: o.id, label: o.label })),
|
|
4847
|
+
onChange: (v) => set({ output: v })
|
|
4848
|
+
}
|
|
4849
|
+
)
|
|
4850
|
+
] }),
|
|
4851
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
4853
|
+
"Remember Settings"
|
|
4854
|
+
] }),
|
|
4855
|
+
(error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
4856
|
+
session.note && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: session.note }),
|
|
4857
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
|
|
4858
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
|
|
4859
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
|
|
4860
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
4861
|
+
] })
|
|
4862
|
+
] })
|
|
4863
|
+
]
|
|
4864
|
+
}
|
|
4865
|
+
);
|
|
4866
|
+
};
|
|
4867
|
+
|
|
4868
|
+
// src/image-editor/SelectionOptionsBar.tsx
|
|
4869
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4607
4870
|
var MODIFY_OPS = [
|
|
4608
4871
|
{ op: "expand", label: "Expand" },
|
|
4609
4872
|
{ op: "contract", label: "Contract" },
|
|
@@ -4627,15 +4890,15 @@ var SelectionOptionsBar = ({
|
|
|
4627
4890
|
selectionDisplay,
|
|
4628
4891
|
className = ""
|
|
4629
4892
|
}) => {
|
|
4630
|
-
const [radius, setRadius] = (0,
|
|
4893
|
+
const [radius, setRadius] = (0, import_react26.useState)(2);
|
|
4631
4894
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
4632
4895
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4633
4896
|
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,
|
|
4897
|
+
const [preset, setPreset] = (0, import_react26.useState)("reds");
|
|
4898
|
+
const [rangeStatus, setRangeStatus] = (0, import_react26.useState)(null);
|
|
4899
|
+
const [colorStatus, setColorStatus] = (0, import_react26.useState)(null);
|
|
4900
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react26.useState)(4);
|
|
4901
|
+
const [strokeLocation, setStrokeLocation] = (0, import_react26.useState)("outside");
|
|
4639
4902
|
const edit = (fn) => {
|
|
4640
4903
|
setColorStatus(null);
|
|
4641
4904
|
try {
|
|
@@ -4668,9 +4931,9 @@ var SelectionOptionsBar = ({
|
|
|
4668
4931
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
4669
4932
|
}
|
|
4670
4933
|
};
|
|
4671
|
-
const [subject, setSubject] = (0,
|
|
4672
|
-
const [segmenting, setSegmenting] = (0,
|
|
4673
|
-
const [subjectStatus, setSubjectStatus] = (0,
|
|
4934
|
+
const [subject, setSubject] = (0, import_react26.useState)("");
|
|
4935
|
+
const [segmenting, setSegmenting] = (0, import_react26.useState)(false);
|
|
4936
|
+
const [subjectStatus, setSubjectStatus] = (0, import_react26.useState)(null);
|
|
4674
4937
|
const selectSubject = async () => {
|
|
4675
4938
|
const target = subject.trim();
|
|
4676
4939
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -4686,8 +4949,9 @@ var SelectionOptionsBar = ({
|
|
|
4686
4949
|
setSegmenting(false);
|
|
4687
4950
|
}
|
|
4688
4951
|
};
|
|
4689
|
-
const [
|
|
4690
|
-
const [
|
|
4952
|
+
const [workspace, setWorkspace] = (0, import_react26.useState)(false);
|
|
4953
|
+
const [skying, setSkying] = (0, import_react26.useState)(false);
|
|
4954
|
+
const [skyStatus, setSkyStatus] = (0, import_react26.useState)(null);
|
|
4691
4955
|
const selectSky = async () => {
|
|
4692
4956
|
if (skying) return;
|
|
4693
4957
|
setSkying(true);
|
|
@@ -4701,8 +4965,8 @@ var SelectionOptionsBar = ({
|
|
|
4701
4965
|
setSkying(false);
|
|
4702
4966
|
}
|
|
4703
4967
|
};
|
|
4704
|
-
const [focusing, setFocusing] = (0,
|
|
4705
|
-
const [focusStatus, setFocusStatus] = (0,
|
|
4968
|
+
const [focusing, setFocusing] = (0, import_react26.useState)(false);
|
|
4969
|
+
const [focusStatus, setFocusStatus] = (0, import_react26.useState)(null);
|
|
4706
4970
|
const selectFocusArea = async () => {
|
|
4707
4971
|
if (focusing) return;
|
|
4708
4972
|
setFocusing(true);
|
|
@@ -4721,24 +4985,24 @@ var SelectionOptionsBar = ({
|
|
|
4721
4985
|
setFocusing(false);
|
|
4722
4986
|
}
|
|
4723
4987
|
};
|
|
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,
|
|
4988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4989
|
+
/* @__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)) }),
|
|
4990
|
+
/* @__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)) }),
|
|
4991
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4992
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4993
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Tolerance" }),
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
4732
4996
|
] }),
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
4734
4998
|
] }),
|
|
4735
|
-
/* @__PURE__ */ (0,
|
|
4736
|
-
/* @__PURE__ */ (0,
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
4737
5001
|
"Contiguous"
|
|
4738
5002
|
] }),
|
|
4739
|
-
/* @__PURE__ */ (0,
|
|
5003
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4740
5004
|
"Distance",
|
|
4741
|
-
/* @__PURE__ */ (0,
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4742
5006
|
ImageSelect,
|
|
4743
5007
|
{
|
|
4744
5008
|
label: "Colour distance",
|
|
@@ -4751,13 +5015,13 @@ var SelectionOptionsBar = ({
|
|
|
4751
5015
|
}
|
|
4752
5016
|
)
|
|
4753
5017
|
] }),
|
|
4754
|
-
/* @__PURE__ */ (0,
|
|
4755
|
-
/* @__PURE__ */ (0,
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5019
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
4756
5020
|
"Sample adjusted image"
|
|
4757
5021
|
] }),
|
|
4758
|
-
/* @__PURE__ */ (0,
|
|
5022
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4759
5023
|
"Sample",
|
|
4760
|
-
/* @__PURE__ */ (0,
|
|
5024
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4761
5025
|
ImageSelect,
|
|
4762
5026
|
{
|
|
4763
5027
|
label: "Sample from",
|
|
@@ -4771,77 +5035,77 @@ var SelectionOptionsBar = ({
|
|
|
4771
5035
|
)
|
|
4772
5036
|
] })
|
|
4773
5037
|
] }),
|
|
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,
|
|
5038
|
+
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." }),
|
|
5039
|
+
options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
5040
|
+
/* @__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." }),
|
|
5041
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5043
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Width" }),
|
|
5044
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4781
5045
|
options.magneticWidth ?? 10,
|
|
4782
5046
|
" px"
|
|
4783
5047
|
] })
|
|
4784
5048
|
] }),
|
|
4785
|
-
/* @__PURE__ */ (0,
|
|
5049
|
+
/* @__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
5050
|
] }),
|
|
4787
|
-
/* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
/* @__PURE__ */ (0,
|
|
4790
|
-
/* @__PURE__ */ (0,
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5052
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Contrast" }),
|
|
5054
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4791
5055
|
options.magneticContrast ?? 10,
|
|
4792
5056
|
"%"
|
|
4793
5057
|
] })
|
|
4794
5058
|
] }),
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
5059
|
+
/* @__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
5060
|
] }),
|
|
4797
|
-
/* @__PURE__ */ (0,
|
|
4798
|
-
/* @__PURE__ */ (0,
|
|
4799
|
-
/* @__PURE__ */ (0,
|
|
4800
|
-
/* @__PURE__ */ (0,
|
|
5061
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5062
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5063
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Frequency" }),
|
|
5064
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
4801
5065
|
] }),
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
5066
|
+
/* @__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
5067
|
] })
|
|
4804
5068
|
] }),
|
|
4805
|
-
options.tool === "quick" && /* @__PURE__ */ (0,
|
|
4806
|
-
/* @__PURE__ */ (0,
|
|
4807
|
-
/* @__PURE__ */ (0,
|
|
4808
|
-
/* @__PURE__ */ (0,
|
|
4809
|
-
/* @__PURE__ */ (0,
|
|
4810
|
-
/* @__PURE__ */ (0,
|
|
5069
|
+
options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
5070
|
+
/* @__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)." }),
|
|
5071
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5072
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5073
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Size" }),
|
|
5074
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4811
5075
|
options.quickSize ?? 30,
|
|
4812
5076
|
" px"
|
|
4813
5077
|
] })
|
|
4814
5078
|
] }),
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
5079
|
+
/* @__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
5080
|
] }),
|
|
4817
|
-
/* @__PURE__ */ (0,
|
|
4818
|
-
/* @__PURE__ */ (0,
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
4819
5083
|
"Sample all layers"
|
|
4820
5084
|
] }),
|
|
4821
|
-
/* @__PURE__ */ (0,
|
|
4822
|
-
/* @__PURE__ */ (0,
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5086
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
4823
5087
|
"Auto-enhance edges"
|
|
4824
5088
|
] })
|
|
4825
5089
|
] }),
|
|
4826
|
-
options.tool === "object" && /* @__PURE__ */ (0,
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
4829
|
-
/* @__PURE__ */ (0,
|
|
5090
|
+
options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
5091
|
+
/* @__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." }),
|
|
5092
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
4830
5094
|
"Sample all layers"
|
|
4831
5095
|
] }),
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
5096
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5097
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
4834
5098
|
"Auto-enhance edges"
|
|
4835
5099
|
] })
|
|
4836
5100
|
] }),
|
|
4837
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0,
|
|
4838
|
-
/* @__PURE__ */ (0,
|
|
5101
|
+
(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: [
|
|
5102
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
4839
5103
|
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
5104
|
" Shift-click adds, Alt-click subtracts."
|
|
4841
5105
|
] }),
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
5106
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4843
5107
|
"Text",
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
5108
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4845
5109
|
"input",
|
|
4846
5110
|
{
|
|
4847
5111
|
type: "text",
|
|
@@ -4852,9 +5116,9 @@ var SelectionOptionsBar = ({
|
|
|
4852
5116
|
}
|
|
4853
5117
|
)
|
|
4854
5118
|
] }),
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4856
5120
|
"Size",
|
|
4857
|
-
/* @__PURE__ */ (0,
|
|
5121
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4858
5122
|
"input",
|
|
4859
5123
|
{
|
|
4860
5124
|
type: "number",
|
|
@@ -4868,9 +5132,9 @@ var SelectionOptionsBar = ({
|
|
|
4868
5132
|
),
|
|
4869
5133
|
"px"
|
|
4870
5134
|
] }),
|
|
4871
|
-
/* @__PURE__ */ (0,
|
|
5135
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4872
5136
|
"Font",
|
|
4873
|
-
/* @__PURE__ */ (0,
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4874
5138
|
"input",
|
|
4875
5139
|
{
|
|
4876
5140
|
type: "text",
|
|
@@ -4882,18 +5146,18 @@ var SelectionOptionsBar = ({
|
|
|
4882
5146
|
)
|
|
4883
5147
|
] })
|
|
4884
5148
|
] }),
|
|
4885
|
-
options.tool === "range" && /* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
4889
|
-
/* @__PURE__ */ (0,
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
5149
|
+
options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
5150
|
+
/* @__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." }),
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5152
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5153
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Fuzziness" }),
|
|
5154
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
4891
5155
|
] }),
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
5156
|
+
/* @__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
5157
|
] }),
|
|
4894
|
-
/* @__PURE__ */ (0,
|
|
5158
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4895
5159
|
"Localized radius",
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4897
5161
|
"input",
|
|
4898
5162
|
{
|
|
4899
5163
|
type: "number",
|
|
@@ -4907,27 +5171,27 @@ var SelectionOptionsBar = ({
|
|
|
4907
5171
|
),
|
|
4908
5172
|
"px"
|
|
4909
5173
|
] }),
|
|
4910
|
-
/* @__PURE__ */ (0,
|
|
4911
|
-
/* @__PURE__ */ (0,
|
|
5174
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5175
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
4912
5176
|
"Invert"
|
|
4913
5177
|
] }),
|
|
4914
|
-
/* @__PURE__ */ (0,
|
|
4915
|
-
/* @__PURE__ */ (0,
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5179
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4916
5180
|
ImageSelect,
|
|
4917
5181
|
{
|
|
4918
5182
|
label: "Color Range preset",
|
|
4919
5183
|
value: preset,
|
|
4920
|
-
options:
|
|
5184
|
+
options: import_image_editor15.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor15.COLOR_RANGE_PRESET_LABELS[p] })),
|
|
4921
5185
|
onChange: (v) => setPreset(v)
|
|
4922
5186
|
}
|
|
4923
5187
|
),
|
|
4924
|
-
/* @__PURE__ */ (0,
|
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
4925
5189
|
] }),
|
|
4926
|
-
rangeStatus && /* @__PURE__ */ (0,
|
|
5190
|
+
rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
4927
5191
|
] }),
|
|
4928
|
-
/* @__PURE__ */ (0,
|
|
5192
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4929
5193
|
"Feather",
|
|
4930
|
-
/* @__PURE__ */ (0,
|
|
5194
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4931
5195
|
"input",
|
|
4932
5196
|
{
|
|
4933
5197
|
type: "number",
|
|
@@ -4942,7 +5206,7 @@ var SelectionOptionsBar = ({
|
|
|
4942
5206
|
),
|
|
4943
5207
|
"px"
|
|
4944
5208
|
] }),
|
|
4945
|
-
/* @__PURE__ */ (0,
|
|
5209
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4946
5210
|
"form",
|
|
4947
5211
|
{
|
|
4948
5212
|
"data-testid": "select-subject",
|
|
@@ -4952,8 +5216,8 @@ var SelectionOptionsBar = ({
|
|
|
4952
5216
|
void selectSubject();
|
|
4953
5217
|
},
|
|
4954
5218
|
children: [
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
4956
|
-
controller.segmentationProvider && /* @__PURE__ */ (0,
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
|
|
5220
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4957
5221
|
"input",
|
|
4958
5222
|
{
|
|
4959
5223
|
type: "text",
|
|
@@ -4965,7 +5229,7 @@ var SelectionOptionsBar = ({
|
|
|
4965
5229
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
4966
5230
|
}
|
|
4967
5231
|
),
|
|
4968
|
-
/* @__PURE__ */ (0,
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4969
5233
|
"button",
|
|
4970
5234
|
{
|
|
4971
5235
|
type: "submit",
|
|
@@ -4977,65 +5241,67 @@ var SelectionOptionsBar = ({
|
|
|
4977
5241
|
}
|
|
4978
5242
|
)
|
|
4979
5243
|
] }),
|
|
4980
|
-
subjectStatus && /* @__PURE__ */ (0,
|
|
5244
|
+
subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
4981
5245
|
]
|
|
4982
5246
|
}
|
|
4983
5247
|
),
|
|
4984
|
-
/* @__PURE__ */ (0,
|
|
4985
|
-
|
|
4986
|
-
|
|
5248
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
5249
|
+
workspace && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
5250
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
5251
|
+
/* @__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" }),
|
|
5252
|
+
skyStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
4987
5253
|
] }),
|
|
4988
|
-
/* @__PURE__ */ (0,
|
|
4989
|
-
/* @__PURE__ */ (0,
|
|
4990
|
-
/* @__PURE__ */ (0,
|
|
4991
|
-
/* @__PURE__ */ (0,
|
|
4992
|
-
/* @__PURE__ */ (0,
|
|
4993
|
-
/* @__PURE__ */ (0,
|
|
4994
|
-
/* @__PURE__ */ (0,
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
5255
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
5256
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5258
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5259
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "In-focus range" }),
|
|
5260
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
4995
5261
|
] }),
|
|
4996
|
-
/* @__PURE__ */ (0,
|
|
5262
|
+
/* @__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
5263
|
] }),
|
|
4998
|
-
/* @__PURE__ */ (0,
|
|
4999
|
-
/* @__PURE__ */ (0,
|
|
5000
|
-
/* @__PURE__ */ (0,
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5266
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Image noise level" }),
|
|
5267
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
5002
5268
|
] }),
|
|
5003
|
-
/* @__PURE__ */ (0,
|
|
5269
|
+
/* @__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
5270
|
] }),
|
|
5005
|
-
/* @__PURE__ */ (0,
|
|
5006
|
-
/* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5271
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5272
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5273
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Soften edge" }),
|
|
5274
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
5009
5275
|
options.focusSoftness ?? 4,
|
|
5010
5276
|
" px"
|
|
5011
5277
|
] })
|
|
5012
5278
|
] }),
|
|
5013
|
-
/* @__PURE__ */ (0,
|
|
5279
|
+
/* @__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
5280
|
] }),
|
|
5015
|
-
/* @__PURE__ */ (0,
|
|
5016
|
-
focusStatus && /* @__PURE__ */ (0,
|
|
5281
|
+
/* @__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" }),
|
|
5282
|
+
focusStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
5017
5283
|
] })
|
|
5018
5284
|
] }),
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5020
|
-
/* @__PURE__ */ (0,
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5286
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
5021
5287
|
"Anti-alias"
|
|
5022
5288
|
] }),
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5024
|
-
/* @__PURE__ */ (0,
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5026
|
-
/* @__PURE__ */ (0,
|
|
5027
|
-
/* @__PURE__ */ (0,
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5290
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
5292
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
5294
|
+
/* @__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" }),
|
|
5295
|
+
/* @__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
5296
|
] }),
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5033
|
-
DISPLAYS.map((d) => /* @__PURE__ */ (0,
|
|
5297
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5298
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
|
|
5299
|
+
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
5300
|
] }),
|
|
5035
|
-
/* @__PURE__ */ (0,
|
|
5036
|
-
/* @__PURE__ */ (0,
|
|
5301
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
5302
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5037
5303
|
"Radius",
|
|
5038
|
-
/* @__PURE__ */ (0,
|
|
5304
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5039
5305
|
"input",
|
|
5040
5306
|
{
|
|
5041
5307
|
type: "number",
|
|
@@ -5049,12 +5315,12 @@ var SelectionOptionsBar = ({
|
|
|
5049
5315
|
}
|
|
5050
5316
|
)
|
|
5051
5317
|
] }),
|
|
5052
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
5318
|
+
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
5319
|
] }),
|
|
5054
|
-
/* @__PURE__ */ (0,
|
|
5055
|
-
/* @__PURE__ */ (0,
|
|
5320
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5321
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5056
5322
|
"Stroke",
|
|
5057
|
-
/* @__PURE__ */ (0,
|
|
5323
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5058
5324
|
"input",
|
|
5059
5325
|
{
|
|
5060
5326
|
type: "number",
|
|
@@ -5069,7 +5335,7 @@ var SelectionOptionsBar = ({
|
|
|
5069
5335
|
),
|
|
5070
5336
|
"px"
|
|
5071
5337
|
] }),
|
|
5072
|
-
/* @__PURE__ */ (0,
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5073
5339
|
ImageSelect,
|
|
5074
5340
|
{
|
|
5075
5341
|
label: "Stroke location",
|
|
@@ -5082,38 +5348,40 @@ var SelectionOptionsBar = ({
|
|
|
5082
5348
|
onChange: (v) => setStrokeLocation(v)
|
|
5083
5349
|
}
|
|
5084
5350
|
),
|
|
5085
|
-
/* @__PURE__ */ (0,
|
|
5086
|
-
/* @__PURE__ */ (0,
|
|
5087
|
-
/* @__PURE__ */ (0,
|
|
5351
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
5353
|
+
/* @__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
5354
|
] }),
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5090
|
-
/* @__PURE__ */ (0,
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5092
|
-
/* @__PURE__ */ (0,
|
|
5093
|
-
/* @__PURE__ */ (0,
|
|
5094
|
-
/* @__PURE__ */ (0,
|
|
5095
|
-
/* @__PURE__ */ (0,
|
|
5096
|
-
/* @__PURE__ */ (0,
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
5097
5363
|
] }),
|
|
5098
|
-
colorStatus && /* @__PURE__ */ (0,
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor15.describeSelection)(sel) })
|
|
5100
5366
|
] });
|
|
5101
5367
|
};
|
|
5102
5368
|
|
|
5103
5369
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5104
|
-
var
|
|
5105
|
-
var
|
|
5106
|
-
var
|
|
5370
|
+
var import_react27 = require("react");
|
|
5371
|
+
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
5372
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5107
5373
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5108
|
-
var
|
|
5374
|
+
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
5375
|
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,
|
|
5376
|
+
const [params, setParams] = (0, import_react27.useState)(DEFAULT_PARAMS);
|
|
5377
|
+
const [busy, setBusy] = (0, import_react27.useState)(false);
|
|
5378
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
5379
|
+
const [layerId, setLayerId] = (0, import_react27.useState)("");
|
|
5380
|
+
const [newKind, setNewKind] = (0, import_react27.useState)("hueSaturation");
|
|
5381
|
+
const [output, setOutput] = (0, import_react27.useState)("selection");
|
|
5382
|
+
const [decontaminate, setDecontaminate] = (0, import_react27.useState)(0);
|
|
5383
|
+
const [objectAware, setObjectAware] = (0, import_react27.useState)(false);
|
|
5384
|
+
const canObject = Boolean(controller.segmentationProvider);
|
|
5117
5385
|
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
5118
5386
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5119
5387
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
@@ -5122,24 +5390,27 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5122
5390
|
setBusy(true);
|
|
5123
5391
|
setError(null);
|
|
5124
5392
|
try {
|
|
5125
|
-
await controller.refineSelectionTo(params, output, {
|
|
5393
|
+
await controller.refineSelectionTo(params, output, {
|
|
5394
|
+
decontaminate: toLayer ? decontaminate : 0,
|
|
5395
|
+
refineMode: canObject && objectAware ? "object" : "color"
|
|
5396
|
+
});
|
|
5126
5397
|
} catch (err) {
|
|
5127
5398
|
setError(err instanceof Error ? err.message : String(err));
|
|
5128
5399
|
} finally {
|
|
5129
5400
|
setBusy(false);
|
|
5130
5401
|
}
|
|
5131
5402
|
};
|
|
5132
|
-
return /* @__PURE__ */ (0,
|
|
5133
|
-
/* @__PURE__ */ (0,
|
|
5134
|
-
|
|
5135
|
-
/* @__PURE__ */ (0,
|
|
5136
|
-
/* @__PURE__ */ (0,
|
|
5137
|
-
/* @__PURE__ */ (0,
|
|
5403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5404
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
5405
|
+
import_image_editor16.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5406
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5407
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: c.label }),
|
|
5408
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5138
5409
|
params[c.id],
|
|
5139
5410
|
c.unit
|
|
5140
5411
|
] })
|
|
5141
5412
|
] }),
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5413
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5143
5414
|
"input",
|
|
5144
5415
|
{
|
|
5145
5416
|
type: "range",
|
|
@@ -5153,35 +5424,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5153
5424
|
}
|
|
5154
5425
|
)
|
|
5155
5426
|
] }, c.id)),
|
|
5156
|
-
/* @__PURE__ */ (0,
|
|
5157
|
-
/* @__PURE__ */ (0,
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5428
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
5158
5429
|
"Smart Radius"
|
|
5159
5430
|
] }),
|
|
5160
|
-
/* @__PURE__ */ (0,
|
|
5431
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5432
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
5433
|
+
"Object aware (segmentation model)"
|
|
5434
|
+
] }),
|
|
5435
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5161
5436
|
"Output to",
|
|
5162
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5163
5438
|
"select",
|
|
5164
5439
|
{
|
|
5165
5440
|
"aria-label": "Refine output",
|
|
5166
5441
|
value: output,
|
|
5167
5442
|
onChange: (e) => setOutput(e.target.value),
|
|
5168
5443
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5169
|
-
children:
|
|
5444
|
+
children: import_image_editor16.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
5170
5445
|
}
|
|
5171
5446
|
)
|
|
5172
5447
|
] }),
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5174
|
-
/* @__PURE__ */ (0,
|
|
5175
|
-
/* @__PURE__ */ (0,
|
|
5448
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
|
|
5176
5451
|
"Decontaminate colors",
|
|
5177
5452
|
toLayer ? "" : " (new layer outputs)"
|
|
5178
5453
|
] }),
|
|
5179
|
-
/* @__PURE__ */ (0,
|
|
5454
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5180
5455
|
decontaminate,
|
|
5181
5456
|
"%"
|
|
5182
5457
|
] })
|
|
5183
5458
|
] }),
|
|
5184
|
-
/* @__PURE__ */ (0,
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5185
5460
|
"input",
|
|
5186
5461
|
{
|
|
5187
5462
|
type: "range",
|
|
@@ -5196,63 +5471,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5196
5471
|
}
|
|
5197
5472
|
)
|
|
5198
5473
|
] }),
|
|
5199
|
-
/* @__PURE__ */ (0,
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5201
|
-
/* @__PURE__ */ (0,
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
5476
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
5202
5477
|
] }),
|
|
5203
|
-
error && /* @__PURE__ */ (0,
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5206
|
-
/* @__PURE__ */ (0,
|
|
5478
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
5479
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
5480
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5207
5482
|
"select",
|
|
5208
5483
|
{
|
|
5209
5484
|
"aria-label": "New masked layer kind",
|
|
5210
5485
|
value: newKind,
|
|
5211
5486
|
onChange: (e) => setNewKind(e.target.value),
|
|
5212
5487
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5213
|
-
children:
|
|
5488
|
+
children: import_image_editor16.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
5214
5489
|
}
|
|
5215
5490
|
),
|
|
5216
|
-
/* @__PURE__ */ (0,
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5217
5492
|
"button",
|
|
5218
5493
|
{
|
|
5219
5494
|
type: "button",
|
|
5220
|
-
className:
|
|
5495
|
+
className: button3,
|
|
5221
5496
|
disabled: !sel,
|
|
5222
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
5497
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor16.layerMaskFromSelection)(sel) })),
|
|
5223
5498
|
children: "New Masked Layer"
|
|
5224
5499
|
}
|
|
5225
5500
|
)
|
|
5226
5501
|
] }),
|
|
5227
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
5228
|
-
/* @__PURE__ */ (0,
|
|
5502
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5229
5504
|
"select",
|
|
5230
5505
|
{
|
|
5231
5506
|
"aria-label": "Mask layer",
|
|
5232
5507
|
value: target.id,
|
|
5233
5508
|
onChange: (e) => setLayerId(e.target.value),
|
|
5234
5509
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5235
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
5236
|
-
l.name || (0,
|
|
5510
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("option", { value: l.id, children: [
|
|
5511
|
+
l.name || (0, import_image_editor16.adjustmentKindLabel)(l.kind),
|
|
5237
5512
|
l.mask ? " (masked)" : ""
|
|
5238
5513
|
] }, l.id))
|
|
5239
5514
|
}
|
|
5240
5515
|
),
|
|
5241
|
-
/* @__PURE__ */ (0,
|
|
5242
|
-
/* @__PURE__ */ (0,
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5244
|
-
/* @__PURE__ */ (0,
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5517
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
5518
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
5519
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
5245
5520
|
] }),
|
|
5246
|
-
target.mask && /* @__PURE__ */ (0,
|
|
5247
|
-
/* @__PURE__ */ (0,
|
|
5248
|
-
/* @__PURE__ */ (0,
|
|
5249
|
-
/* @__PURE__ */ (0,
|
|
5250
|
-
/* @__PURE__ */ (0,
|
|
5521
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5522
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Density" }),
|
|
5525
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5251
5526
|
Math.round((target.mask.density ?? 1) * 100),
|
|
5252
5527
|
"%"
|
|
5253
5528
|
] })
|
|
5254
5529
|
] }),
|
|
5255
|
-
/* @__PURE__ */ (0,
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5256
5531
|
"input",
|
|
5257
5532
|
{
|
|
5258
5533
|
type: "range",
|
|
@@ -5266,15 +5541,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5266
5541
|
}
|
|
5267
5542
|
)
|
|
5268
5543
|
] }),
|
|
5269
|
-
/* @__PURE__ */ (0,
|
|
5270
|
-
/* @__PURE__ */ (0,
|
|
5271
|
-
/* @__PURE__ */ (0,
|
|
5272
|
-
/* @__PURE__ */ (0,
|
|
5544
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5546
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Mask Feather" }),
|
|
5547
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5273
5548
|
target.mask.feather ?? 0,
|
|
5274
5549
|
"px"
|
|
5275
5550
|
] })
|
|
5276
5551
|
] }),
|
|
5277
|
-
/* @__PURE__ */ (0,
|
|
5552
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5278
5553
|
"input",
|
|
5279
5554
|
{
|
|
5280
5555
|
type: "range",
|
|
@@ -5294,32 +5569,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5294
5569
|
};
|
|
5295
5570
|
|
|
5296
5571
|
// src/image-editor/ChannelsPanel.tsx
|
|
5297
|
-
var
|
|
5298
|
-
var
|
|
5299
|
-
var
|
|
5572
|
+
var import_react28 = require("react");
|
|
5573
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5574
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5300
5575
|
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"}`;
|
|
5301
5576
|
var ChannelThumb = ({ channel, size }) => {
|
|
5302
|
-
const ref = (0,
|
|
5303
|
-
(0,
|
|
5577
|
+
const ref = (0, import_react28.useRef)(null);
|
|
5578
|
+
(0, import_react28.useEffect)(() => {
|
|
5304
5579
|
const canvas = ref.current;
|
|
5305
5580
|
const ctx = canvas?.getContext("2d");
|
|
5306
5581
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
5307
|
-
const px = (0,
|
|
5582
|
+
const px = (0, import_image_editor17.channelThumbnail)(channel, 64);
|
|
5308
5583
|
canvas.width = px.width;
|
|
5309
5584
|
canvas.height = px.height;
|
|
5310
5585
|
const img = ctx.createImageData(px.width, px.height);
|
|
5311
5586
|
img.data.set(px.data);
|
|
5312
5587
|
ctx.putImageData(img, 0, 0);
|
|
5313
5588
|
}, [channel.mask]);
|
|
5314
|
-
return /* @__PURE__ */ (0,
|
|
5589
|
+
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" });
|
|
5315
5590
|
};
|
|
5316
5591
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5317
|
-
const [, setTick] = (0,
|
|
5318
|
-
(0,
|
|
5319
|
-
const [activeId, setActiveId] = (0,
|
|
5320
|
-
const [renaming, setRenaming] = (0,
|
|
5321
|
-
const [error, setError] = (0,
|
|
5322
|
-
const fileInput = (0,
|
|
5592
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
5593
|
+
(0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5594
|
+
const [activeId, setActiveId] = (0, import_react28.useState)(null);
|
|
5595
|
+
const [renaming, setRenaming] = (0, import_react28.useState)(null);
|
|
5596
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
5597
|
+
const fileInput = (0, import_react28.useRef)(null);
|
|
5323
5598
|
const channels = controller.getChannels();
|
|
5324
5599
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5325
5600
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -5336,18 +5611,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5336
5611
|
if (!file) return;
|
|
5337
5612
|
setError(null);
|
|
5338
5613
|
try {
|
|
5339
|
-
setActiveId((await (0,
|
|
5614
|
+
setActiveId((await (0, import_image_editor17.openMaskFile)(controller, file)).id);
|
|
5340
5615
|
} catch (err) {
|
|
5341
5616
|
setError(err instanceof Error ? err.message : String(err));
|
|
5342
5617
|
}
|
|
5343
5618
|
};
|
|
5344
|
-
return /* @__PURE__ */ (0,
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
5347
|
-
/* @__PURE__ */ (0,
|
|
5619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5620
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
5622
|
+
/* @__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" })
|
|
5348
5623
|
] }),
|
|
5349
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
5350
|
-
/* @__PURE__ */ (0,
|
|
5624
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
5625
|
+
/* @__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)(
|
|
5351
5626
|
"li",
|
|
5352
5627
|
{
|
|
5353
5628
|
"data-testid": "channel-row",
|
|
@@ -5355,11 +5630,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5355
5630
|
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"}`,
|
|
5356
5631
|
onClick: (e) => {
|
|
5357
5632
|
setActiveId(c.id);
|
|
5358
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
5633
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor17.selectionModeFromModifiers)(e, "replace") }));
|
|
5359
5634
|
},
|
|
5360
5635
|
onDoubleClick: () => setRenaming(c.id),
|
|
5361
5636
|
children: [
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5363
5638
|
"button",
|
|
5364
5639
|
{
|
|
5365
5640
|
type: "button",
|
|
@@ -5373,8 +5648,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5373
5648
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
5374
5649
|
}
|
|
5375
5650
|
),
|
|
5376
|
-
/* @__PURE__ */ (0,
|
|
5377
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
5652
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5378
5653
|
"input",
|
|
5379
5654
|
{
|
|
5380
5655
|
autoFocus: true,
|
|
@@ -5391,16 +5666,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5391
5666
|
if (e.key === "Escape") setRenaming(null);
|
|
5392
5667
|
}
|
|
5393
5668
|
}
|
|
5394
|
-
) : /* @__PURE__ */ (0,
|
|
5669
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
5395
5670
|
]
|
|
5396
5671
|
},
|
|
5397
5672
|
c.id
|
|
5398
5673
|
)) }),
|
|
5399
|
-
/* @__PURE__ */ (0,
|
|
5400
|
-
/* @__PURE__ */ (0,
|
|
5401
|
-
/* @__PURE__ */ (0,
|
|
5402
|
-
/* @__PURE__ */ (0,
|
|
5403
|
-
/* @__PURE__ */ (0,
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5675
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
5676
|
+
/* @__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" }),
|
|
5677
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
5678
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5404
5679
|
"button",
|
|
5405
5680
|
{
|
|
5406
5681
|
type: "button",
|
|
@@ -5413,24 +5688,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5413
5688
|
children: "Delete"
|
|
5414
5689
|
}
|
|
5415
5690
|
),
|
|
5416
|
-
/* @__PURE__ */ (0,
|
|
5417
|
-
/* @__PURE__ */ (0,
|
|
5691
|
+
/* @__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" }),
|
|
5692
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5418
5693
|
"button",
|
|
5419
5694
|
{
|
|
5420
5695
|
type: "button",
|
|
5421
5696
|
className: btn2(),
|
|
5422
5697
|
disabled: !active && !hasSelection,
|
|
5423
5698
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
5424
|
-
onClick: () => attempt(() => (0,
|
|
5699
|
+
onClick: () => attempt(() => (0, import_image_editor17.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
5425
5700
|
children: "Export PNG"
|
|
5426
5701
|
}
|
|
5427
5702
|
),
|
|
5428
|
-
/* @__PURE__ */ (0,
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5429
5704
|
"input",
|
|
5430
5705
|
{
|
|
5431
5706
|
ref: fileInput,
|
|
5432
5707
|
type: "file",
|
|
5433
|
-
accept:
|
|
5708
|
+
accept: import_image_editor17.MASK_FILE_ACCEPT,
|
|
5434
5709
|
hidden: true,
|
|
5435
5710
|
"data-testid": "channel-import-input",
|
|
5436
5711
|
onChange: (e) => {
|
|
@@ -5440,18 +5715,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5440
5715
|
}
|
|
5441
5716
|
)
|
|
5442
5717
|
] }),
|
|
5443
|
-
error && /* @__PURE__ */ (0,
|
|
5718
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5444
5719
|
] });
|
|
5445
5720
|
};
|
|
5446
5721
|
|
|
5447
5722
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
5448
|
-
var
|
|
5449
|
-
var
|
|
5450
|
-
var
|
|
5723
|
+
var import_react29 = require("react");
|
|
5724
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5725
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5451
5726
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
5452
5727
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
5453
|
-
const [, setTick] = (0,
|
|
5454
|
-
(0,
|
|
5728
|
+
const [, setTick] = (0, import_react29.useState)(0);
|
|
5729
|
+
(0, import_react29.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
5455
5730
|
const bar = tool.bar();
|
|
5456
5731
|
if (!tool.active || !bar) return null;
|
|
5457
5732
|
const warp = tool.warpBar();
|
|
@@ -5463,17 +5738,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5463
5738
|
const v = Number(raw);
|
|
5464
5739
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
5465
5740
|
};
|
|
5466
|
-
return /* @__PURE__ */ (0,
|
|
5467
|
-
/* @__PURE__ */ (0,
|
|
5468
|
-
/* @__PURE__ */ (0,
|
|
5469
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
5470
|
-
/* @__PURE__ */ (0,
|
|
5471
|
-
/* @__PURE__ */ (0,
|
|
5472
|
-
/* @__PURE__ */ (0,
|
|
5741
|
+
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: [
|
|
5742
|
+
/* @__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)) }),
|
|
5743
|
+
/* @__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)) }),
|
|
5744
|
+
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: [
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
5747
|
+
/* @__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)) })
|
|
5473
5748
|
] }),
|
|
5474
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
5475
|
-
/* @__PURE__ */ (0,
|
|
5476
|
-
/* @__PURE__ */ (0,
|
|
5749
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5477
5752
|
"input",
|
|
5478
5753
|
{
|
|
5479
5754
|
type: "number",
|
|
@@ -5494,9 +5769,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5494
5769
|
},
|
|
5495
5770
|
`${k}:${warp[k]}`
|
|
5496
5771
|
),
|
|
5497
|
-
/* @__PURE__ */ (0,
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
5498
5773
|
] }, k)),
|
|
5499
|
-
/* @__PURE__ */ (0,
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5500
5775
|
"button",
|
|
5501
5776
|
{
|
|
5502
5777
|
type: "button",
|
|
@@ -5508,26 +5783,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5508
5783
|
children: "Vertical"
|
|
5509
5784
|
}
|
|
5510
5785
|
),
|
|
5511
|
-
/* @__PURE__ */ (0,
|
|
5512
|
-
/* @__PURE__ */ (0,
|
|
5513
|
-
/* @__PURE__ */ (0,
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5514
5789
|
"select",
|
|
5515
5790
|
{
|
|
5516
5791
|
"aria-label": "Warp grid",
|
|
5517
|
-
value:
|
|
5792
|
+
value: import_image_editor18.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
5518
5793
|
onChange: (e) => {
|
|
5519
|
-
const g =
|
|
5794
|
+
const g = import_image_editor18.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
5520
5795
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
5521
5796
|
},
|
|
5522
5797
|
className: imageFieldClass,
|
|
5523
|
-
children:
|
|
5798
|
+
children: import_image_editor18.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
5524
5799
|
}
|
|
5525
5800
|
)
|
|
5526
5801
|
] })
|
|
5527
5802
|
] }),
|
|
5528
|
-
tool.mode !== "warp" &&
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5803
|
+
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: [
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
5805
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5531
5806
|
"input",
|
|
5532
5807
|
{
|
|
5533
5808
|
type: "number",
|
|
@@ -5547,8 +5822,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5547
5822
|
},
|
|
5548
5823
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
5549
5824
|
),
|
|
5550
|
-
/* @__PURE__ */ (0,
|
|
5551
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
5826
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5552
5827
|
"button",
|
|
5553
5828
|
{
|
|
5554
5829
|
type: "button",
|
|
@@ -5563,33 +5838,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5563
5838
|
}
|
|
5564
5839
|
)
|
|
5565
5840
|
] }, f.id)),
|
|
5566
|
-
/* @__PURE__ */ (0,
|
|
5567
|
-
/* @__PURE__ */ (0,
|
|
5568
|
-
/* @__PURE__ */ (0,
|
|
5841
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5842
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
5843
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5569
5844
|
"select",
|
|
5570
5845
|
{
|
|
5571
5846
|
"aria-label": "Interpolation",
|
|
5572
5847
|
value: tool.interpolation,
|
|
5573
5848
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
5574
5849
|
className: imageFieldClass,
|
|
5575
|
-
children:
|
|
5850
|
+
children: import_image_editor18.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
5576
5851
|
}
|
|
5577
5852
|
)
|
|
5578
5853
|
] }),
|
|
5579
|
-
/* @__PURE__ */ (0,
|
|
5580
|
-
/* @__PURE__ */ (0,
|
|
5581
|
-
tool.error && /* @__PURE__ */ (0,
|
|
5854
|
+
/* @__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" }),
|
|
5855
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
5856
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
5582
5857
|
] });
|
|
5583
5858
|
};
|
|
5584
5859
|
|
|
5585
5860
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
5586
|
-
var
|
|
5587
|
-
var
|
|
5588
|
-
var
|
|
5861
|
+
var import_react30 = require("react");
|
|
5862
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5863
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5589
5864
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
5590
|
-
const [, setTick] = (0,
|
|
5591
|
-
(0,
|
|
5592
|
-
const [error, setError] = (0,
|
|
5865
|
+
const [, setTick] = (0, import_react30.useState)(0);
|
|
5866
|
+
(0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5867
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5593
5868
|
const active = controller.getActiveLayer();
|
|
5594
5869
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
5595
5870
|
const set = (change) => {
|
|
@@ -5597,28 +5872,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5597
5872
|
if (!shapeId) return;
|
|
5598
5873
|
try {
|
|
5599
5874
|
setError(null);
|
|
5600
|
-
(0,
|
|
5875
|
+
(0, import_image_editor19.applyShapeOptions)(controller, shapeId, change);
|
|
5601
5876
|
} catch (e) {
|
|
5602
5877
|
setError(e instanceof Error ? e.message : String(e));
|
|
5603
5878
|
}
|
|
5604
5879
|
};
|
|
5605
5880
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
5606
|
-
return /* @__PURE__ */ (0,
|
|
5607
|
-
/* @__PURE__ */ (0,
|
|
5608
|
-
/* @__PURE__ */ (0,
|
|
5609
|
-
/* @__PURE__ */ (0,
|
|
5610
|
-
/* @__PURE__ */ (0,
|
|
5881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
5882
|
+
/* @__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)) }),
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
5611
5886
|
"Fill",
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5887
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
5613
5888
|
] }),
|
|
5614
|
-
/* @__PURE__ */ (0,
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5889
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5890
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
5616
5891
|
"Stroke",
|
|
5617
|
-
/* @__PURE__ */ (0,
|
|
5892
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
5618
5893
|
] }),
|
|
5619
|
-
/* @__PURE__ */ (0,
|
|
5894
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5620
5895
|
"Width",
|
|
5621
|
-
/* @__PURE__ */ (0,
|
|
5896
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5622
5897
|
"input",
|
|
5623
5898
|
{
|
|
5624
5899
|
type: "number",
|
|
@@ -5632,52 +5907,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5632
5907
|
)
|
|
5633
5908
|
] })
|
|
5634
5909
|
] }),
|
|
5635
|
-
/* @__PURE__ */ (0,
|
|
5636
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
5910
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5911
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5637
5912
|
"Radius",
|
|
5638
|
-
/* @__PURE__ */ (0,
|
|
5913
|
+
/* @__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}` })
|
|
5639
5914
|
] }),
|
|
5640
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
5915
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5641
5916
|
"Sides",
|
|
5642
|
-
/* @__PURE__ */ (0,
|
|
5917
|
+
/* @__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}` })
|
|
5643
5918
|
] }),
|
|
5644
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
5645
|
-
/* @__PURE__ */ (0,
|
|
5919
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5920
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5646
5921
|
"Points",
|
|
5647
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
/* @__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}` })
|
|
5648
5923
|
] }),
|
|
5649
|
-
/* @__PURE__ */ (0,
|
|
5924
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5650
5925
|
"Inner",
|
|
5651
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
/* @__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 }) })
|
|
5652
5927
|
] })
|
|
5653
5928
|
] }),
|
|
5654
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
5655
|
-
/* @__PURE__ */ (0,
|
|
5929
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5656
5931
|
"Weight",
|
|
5657
|
-
/* @__PURE__ */ (0,
|
|
5932
|
+
/* @__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}` })
|
|
5658
5933
|
] }),
|
|
5659
|
-
/* @__PURE__ */ (0,
|
|
5660
|
-
/* @__PURE__ */ (0,
|
|
5934
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5935
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
5661
5936
|
"Arrowhead"
|
|
5662
5937
|
] })
|
|
5663
5938
|
] })
|
|
5664
5939
|
] }),
|
|
5665
|
-
/* @__PURE__ */ (0,
|
|
5666
|
-
error && /* @__PURE__ */ (0,
|
|
5940
|
+
/* @__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." }),
|
|
5941
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5667
5942
|
] });
|
|
5668
5943
|
};
|
|
5669
5944
|
|
|
5670
5945
|
// src/image-editor/TypeOptionsBar.tsx
|
|
5671
|
-
var
|
|
5672
|
-
var
|
|
5673
|
-
var
|
|
5946
|
+
var import_react31 = require("react");
|
|
5947
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
5948
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5674
5949
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
5675
5950
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
5676
5951
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
5677
|
-
const [, setTick] = (0,
|
|
5678
|
-
(0,
|
|
5679
|
-
(0,
|
|
5680
|
-
const [error, setError] = (0,
|
|
5952
|
+
const [, setTick] = (0, import_react31.useState)(0);
|
|
5953
|
+
(0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5954
|
+
(0, import_react31.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
5955
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
5681
5956
|
const active = controller.getActiveLayer();
|
|
5682
5957
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
5683
5958
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -5730,11 +6005,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5730
6005
|
setError(e instanceof Error ? e.message : String(e));
|
|
5731
6006
|
}
|
|
5732
6007
|
};
|
|
5733
|
-
return /* @__PURE__ */ (0,
|
|
5734
|
-
/* @__PURE__ */ (0,
|
|
5735
|
-
/* @__PURE__ */ (0,
|
|
6008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6009
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6010
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5736
6011
|
"Font",
|
|
5737
|
-
/* @__PURE__ */ (0,
|
|
6012
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5738
6013
|
"input",
|
|
5739
6014
|
{
|
|
5740
6015
|
list: "pixerate-type-fonts",
|
|
@@ -5744,11 +6019,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5744
6019
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
5745
6020
|
}
|
|
5746
6021
|
),
|
|
5747
|
-
/* @__PURE__ */ (0,
|
|
6022
|
+
/* @__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)) })
|
|
5748
6023
|
] }),
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
6024
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5750
6025
|
"Size",
|
|
5751
|
-
/* @__PURE__ */ (0,
|
|
6026
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5752
6027
|
"input",
|
|
5753
6028
|
{
|
|
5754
6029
|
type: "number",
|
|
@@ -5761,14 +6036,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5761
6036
|
}
|
|
5762
6037
|
)
|
|
5763
6038
|
] }),
|
|
5764
|
-
/* @__PURE__ */ (0,
|
|
5765
|
-
/* @__PURE__ */ (0,
|
|
5766
|
-
/* @__PURE__ */ (0,
|
|
6039
|
+
/* @__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" }),
|
|
6040
|
+
/* @__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" }),
|
|
6041
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
5767
6042
|
] }),
|
|
5768
|
-
/* @__PURE__ */ (0,
|
|
5769
|
-
/* @__PURE__ */ (0,
|
|
5770
|
-
|
|
5771
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6043
|
+
/* @__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)) }),
|
|
6044
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6045
|
+
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)),
|
|
6046
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5772
6047
|
"button",
|
|
5773
6048
|
{
|
|
5774
6049
|
type: "button",
|
|
@@ -5780,19 +6055,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5780
6055
|
}
|
|
5781
6056
|
)
|
|
5782
6057
|
] }),
|
|
5783
|
-
/* @__PURE__ */ (0,
|
|
5784
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6058
|
+
/* @__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." }),
|
|
6059
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
5785
6060
|
"Missing ",
|
|
5786
6061
|
missing.length === 1 ? "font" : "fonts",
|
|
5787
6062
|
": ",
|
|
5788
6063
|
missing.join(", ")
|
|
5789
6064
|
] }),
|
|
5790
|
-
error && /* @__PURE__ */ (0,
|
|
6065
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5791
6066
|
] });
|
|
5792
6067
|
};
|
|
5793
6068
|
|
|
5794
6069
|
// src/image-editor/ImageEditor.tsx
|
|
5795
|
-
var
|
|
6070
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5796
6071
|
var ImageEditor = ({
|
|
5797
6072
|
editor: externalEditor,
|
|
5798
6073
|
src,
|
|
@@ -5816,51 +6091,51 @@ var ImageEditor = ({
|
|
|
5816
6091
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
5817
6092
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
5818
6093
|
});
|
|
5819
|
-
const legacyProcess = (0,
|
|
5820
|
-
const [activeTab, setActiveTab] = (0,
|
|
5821
|
-
const rootRef = (0,
|
|
6094
|
+
const legacyProcess = (0, import_image_editor21.normalizeProcessVersion)(state.adjustments.process) < import_image_editor21.LATEST_PROCESS_VERSION;
|
|
6095
|
+
const [activeTab, setActiveTab] = (0, import_react32.useState)("crop");
|
|
6096
|
+
const rootRef = (0, import_react32.useRef)(null);
|
|
5822
6097
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
5823
|
-
const activeTabRef = (0,
|
|
6098
|
+
const activeTabRef = (0, import_react32.useRef)(activeTab);
|
|
5824
6099
|
activeTabRef.current = activeTab;
|
|
5825
6100
|
const openPanel = async (ref) => {
|
|
5826
6101
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
5827
6102
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
5828
6103
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
5829
6104
|
};
|
|
5830
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
5831
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
5832
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
5833
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
5834
|
-
const [typeSession, setTypeSession] = (0,
|
|
5835
|
-
const [selectionError, setSelectionError] = (0,
|
|
5836
|
-
const [paintError, setPaintError] = (0,
|
|
5837
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
6105
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react32.useState)(null);
|
|
6106
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6107
|
+
const [shapeOptions, setShapeOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6108
|
+
const [typeOptions, setTypeOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6109
|
+
const [typeSession, setTypeSession] = (0, import_react32.useState)(null);
|
|
6110
|
+
const [selectionError, setSelectionError] = (0, import_react32.useState)(null);
|
|
6111
|
+
const [paintError, setPaintError] = (0, import_react32.useState)(null);
|
|
6112
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react32.useState)(null);
|
|
5838
6113
|
const handleCanvasError = (source, message) => {
|
|
5839
6114
|
if (source === "paint") setPaintError(message);
|
|
5840
6115
|
else if (source === "select") setSelectionError(message);
|
|
5841
6116
|
else setShapeTypeError(message);
|
|
5842
6117
|
};
|
|
5843
6118
|
const finishTyping = () => setTypeSession(null);
|
|
5844
|
-
const transformToolRef = (0,
|
|
5845
|
-
const transformControllerRef = (0,
|
|
6119
|
+
const transformToolRef = (0, import_react32.useRef)(null);
|
|
6120
|
+
const transformControllerRef = (0, import_react32.useRef)(controller);
|
|
5846
6121
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
5847
6122
|
transformToolRef.current?.cancel();
|
|
5848
|
-
transformToolRef.current = new
|
|
6123
|
+
transformToolRef.current = new import_image_editor21.FreeTransformTool(controller, {
|
|
5849
6124
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
5850
6125
|
});
|
|
5851
6126
|
transformControllerRef.current = controller;
|
|
5852
6127
|
}
|
|
5853
6128
|
const transformTool = transformToolRef.current;
|
|
5854
|
-
const [, setTransformTick] = (0,
|
|
5855
|
-
(0,
|
|
5856
|
-
(0,
|
|
5857
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
5858
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
5859
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
5860
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
5861
|
-
const [aiError, setAiError] = (0,
|
|
5862
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
5863
|
-
const [aiTarget, setAiTarget] = (0,
|
|
6129
|
+
const [, setTransformTick] = (0, import_react32.useState)(0);
|
|
6130
|
+
(0, import_react32.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
6131
|
+
(0, import_react32.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
6132
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react32.useState)("");
|
|
6133
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react32.useState)("annotations");
|
|
6134
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react32.useState)(false);
|
|
6135
|
+
const [isInpainting, setIsInpainting] = (0, import_react32.useState)(false);
|
|
6136
|
+
const [aiError, setAiError] = (0, import_react32.useState)(null);
|
|
6137
|
+
const [aiSuccess, setAiSuccess] = (0, import_react32.useState)(null);
|
|
6138
|
+
const [aiTarget, setAiTarget] = (0, import_react32.useState)("auto");
|
|
5864
6139
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
5865
6140
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
5866
6141
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5923,11 +6198,11 @@ var ImageEditor = ({
|
|
|
5923
6198
|
setIsInpainting(false);
|
|
5924
6199
|
}
|
|
5925
6200
|
};
|
|
5926
|
-
const [activeColor, setActiveColor] = (0,
|
|
5927
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5928
|
-
const [fontSize, setFontSize] = (0,
|
|
5929
|
-
const [textInput, setTextInput] = (0,
|
|
5930
|
-
(0,
|
|
6201
|
+
const [activeColor, setActiveColor] = (0, import_react32.useState)("#ef4444");
|
|
6202
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react32.useState)(3);
|
|
6203
|
+
const [fontSize, setFontSize] = (0, import_react32.useState)(24);
|
|
6204
|
+
const [textInput, setTextInput] = (0, import_react32.useState)("");
|
|
6205
|
+
(0, import_react32.useEffect)(() => {
|
|
5931
6206
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5932
6207
|
editor.setTool("crop");
|
|
5933
6208
|
}
|
|
@@ -5955,16 +6230,16 @@ var ImageEditor = ({
|
|
|
5955
6230
|
link.click();
|
|
5956
6231
|
}
|
|
5957
6232
|
};
|
|
5958
|
-
return /* @__PURE__ */ (0,
|
|
6233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5959
6234
|
"div",
|
|
5960
6235
|
{
|
|
5961
6236
|
ref: rootRef,
|
|
5962
6237
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5963
6238
|
style,
|
|
5964
6239
|
children: [
|
|
5965
|
-
/* @__PURE__ */ (0,
|
|
5966
|
-
/* @__PURE__ */ (0,
|
|
5967
|
-
/* @__PURE__ */ (0,
|
|
6240
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
6242
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5968
6243
|
"button",
|
|
5969
6244
|
{
|
|
5970
6245
|
type: "button",
|
|
@@ -5979,7 +6254,7 @@ var ImageEditor = ({
|
|
|
5979
6254
|
children: "Transform & Crop"
|
|
5980
6255
|
}
|
|
5981
6256
|
),
|
|
5982
|
-
/* @__PURE__ */ (0,
|
|
6257
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5983
6258
|
"button",
|
|
5984
6259
|
{
|
|
5985
6260
|
type: "button",
|
|
@@ -5994,7 +6269,7 @@ var ImageEditor = ({
|
|
|
5994
6269
|
children: "Adjustments"
|
|
5995
6270
|
}
|
|
5996
6271
|
),
|
|
5997
|
-
/* @__PURE__ */ (0,
|
|
6272
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5998
6273
|
"button",
|
|
5999
6274
|
{
|
|
6000
6275
|
type: "button",
|
|
@@ -6009,7 +6284,7 @@ var ImageEditor = ({
|
|
|
6009
6284
|
children: "Layers"
|
|
6010
6285
|
}
|
|
6011
6286
|
),
|
|
6012
|
-
/* @__PURE__ */ (0,
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6013
6288
|
"button",
|
|
6014
6289
|
{
|
|
6015
6290
|
type: "button",
|
|
@@ -6024,7 +6299,7 @@ var ImageEditor = ({
|
|
|
6024
6299
|
children: "Paint"
|
|
6025
6300
|
}
|
|
6026
6301
|
),
|
|
6027
|
-
/* @__PURE__ */ (0,
|
|
6302
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6028
6303
|
"button",
|
|
6029
6304
|
{
|
|
6030
6305
|
type: "button",
|
|
@@ -6039,7 +6314,7 @@ var ImageEditor = ({
|
|
|
6039
6314
|
children: "Select & Mask"
|
|
6040
6315
|
}
|
|
6041
6316
|
),
|
|
6042
|
-
/* @__PURE__ */ (0,
|
|
6317
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6043
6318
|
"button",
|
|
6044
6319
|
{
|
|
6045
6320
|
type: "button",
|
|
@@ -6054,7 +6329,7 @@ var ImageEditor = ({
|
|
|
6054
6329
|
children: "Annotations"
|
|
6055
6330
|
}
|
|
6056
6331
|
),
|
|
6057
|
-
/* @__PURE__ */ (0,
|
|
6332
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6058
6333
|
"button",
|
|
6059
6334
|
{
|
|
6060
6335
|
type: "button",
|
|
@@ -6069,7 +6344,7 @@ var ImageEditor = ({
|
|
|
6069
6344
|
children: "Depth Mask"
|
|
6070
6345
|
}
|
|
6071
6346
|
),
|
|
6072
|
-
/* @__PURE__ */ (0,
|
|
6347
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6073
6348
|
"button",
|
|
6074
6349
|
{
|
|
6075
6350
|
type: "button",
|
|
@@ -6082,14 +6357,14 @@ var ImageEditor = ({
|
|
|
6082
6357
|
"aria-selected": activeTab === "ai",
|
|
6083
6358
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
6084
6359
|
children: [
|
|
6085
|
-
/* @__PURE__ */ (0,
|
|
6360
|
+
/* @__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" }) }),
|
|
6086
6361
|
"AI Tools"
|
|
6087
6362
|
]
|
|
6088
6363
|
}
|
|
6089
6364
|
)
|
|
6090
6365
|
] }),
|
|
6091
|
-
/* @__PURE__ */ (0,
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
6367
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6093
6368
|
"button",
|
|
6094
6369
|
{
|
|
6095
6370
|
type: "button",
|
|
@@ -6100,7 +6375,7 @@ var ImageEditor = ({
|
|
|
6100
6375
|
children: "\u21A9"
|
|
6101
6376
|
}
|
|
6102
6377
|
),
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6104
6379
|
"button",
|
|
6105
6380
|
{
|
|
6106
6381
|
type: "button",
|
|
@@ -6111,7 +6386,7 @@ var ImageEditor = ({
|
|
|
6111
6386
|
children: "\u21AA"
|
|
6112
6387
|
}
|
|
6113
6388
|
),
|
|
6114
|
-
/* @__PURE__ */ (0,
|
|
6389
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6115
6390
|
"button",
|
|
6116
6391
|
{
|
|
6117
6392
|
type: "button",
|
|
@@ -6120,8 +6395,8 @@ var ImageEditor = ({
|
|
|
6120
6395
|
children: "Reset"
|
|
6121
6396
|
}
|
|
6122
6397
|
),
|
|
6123
|
-
/* @__PURE__ */ (0,
|
|
6124
|
-
/* @__PURE__ */ (0,
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6399
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6125
6400
|
"button",
|
|
6126
6401
|
{
|
|
6127
6402
|
type: "button",
|
|
@@ -6131,11 +6406,11 @@ var ImageEditor = ({
|
|
|
6131
6406
|
children: "-"
|
|
6132
6407
|
}
|
|
6133
6408
|
),
|
|
6134
|
-
/* @__PURE__ */ (0,
|
|
6409
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
6135
6410
|
Math.round(state.zoom * 100),
|
|
6136
6411
|
"%"
|
|
6137
6412
|
] }),
|
|
6138
|
-
/* @__PURE__ */ (0,
|
|
6413
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6139
6414
|
"button",
|
|
6140
6415
|
{
|
|
6141
6416
|
type: "button",
|
|
@@ -6145,8 +6420,8 @@ var ImageEditor = ({
|
|
|
6145
6420
|
children: "+"
|
|
6146
6421
|
}
|
|
6147
6422
|
),
|
|
6148
|
-
/* @__PURE__ */ (0,
|
|
6149
|
-
/* @__PURE__ */ (0,
|
|
6423
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6424
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6150
6425
|
"button",
|
|
6151
6426
|
{
|
|
6152
6427
|
type: "button",
|
|
@@ -6157,7 +6432,7 @@ var ImageEditor = ({
|
|
|
6157
6432
|
children: "Hold Compare"
|
|
6158
6433
|
}
|
|
6159
6434
|
),
|
|
6160
|
-
/* @__PURE__ */ (0,
|
|
6435
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6161
6436
|
"button",
|
|
6162
6437
|
{
|
|
6163
6438
|
type: "button",
|
|
@@ -6168,10 +6443,10 @@ var ImageEditor = ({
|
|
|
6168
6443
|
)
|
|
6169
6444
|
] })
|
|
6170
6445
|
] }),
|
|
6171
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
6172
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
6173
|
-
/* @__PURE__ */ (0,
|
|
6174
|
-
/* @__PURE__ */ (0,
|
|
6446
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
6447
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
6449
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6175
6450
|
ImageEditorCanvas,
|
|
6176
6451
|
{
|
|
6177
6452
|
editor,
|
|
@@ -6195,11 +6470,11 @@ var ImageEditor = ({
|
|
|
6195
6470
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
6196
6471
|
}
|
|
6197
6472
|
),
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6199
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
6200
|
-
/* @__PURE__ */ (0,
|
|
6201
|
-
/* @__PURE__ */ (0,
|
|
6202
|
-
/* @__PURE__ */ (0,
|
|
6473
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: imageSidebarClass, children: [
|
|
6474
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6475
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
6477
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6203
6478
|
"button",
|
|
6204
6479
|
{
|
|
6205
6480
|
type: "button",
|
|
@@ -6211,7 +6486,7 @@ var ImageEditor = ({
|
|
|
6211
6486
|
children: "Freeform"
|
|
6212
6487
|
}
|
|
6213
6488
|
),
|
|
6214
|
-
/* @__PURE__ */ (0,
|
|
6489
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6215
6490
|
"button",
|
|
6216
6491
|
{
|
|
6217
6492
|
type: "button",
|
|
@@ -6223,7 +6498,7 @@ var ImageEditor = ({
|
|
|
6223
6498
|
children: "1:1 Square"
|
|
6224
6499
|
}
|
|
6225
6500
|
),
|
|
6226
|
-
/* @__PURE__ */ (0,
|
|
6501
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6227
6502
|
"button",
|
|
6228
6503
|
{
|
|
6229
6504
|
type: "button",
|
|
@@ -6235,7 +6510,7 @@ var ImageEditor = ({
|
|
|
6235
6510
|
children: "4:3 Standard"
|
|
6236
6511
|
}
|
|
6237
6512
|
),
|
|
6238
|
-
/* @__PURE__ */ (0,
|
|
6513
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6239
6514
|
"button",
|
|
6240
6515
|
{
|
|
6241
6516
|
type: "button",
|
|
@@ -6247,7 +6522,7 @@ var ImageEditor = ({
|
|
|
6247
6522
|
children: "16:9 Wide"
|
|
6248
6523
|
}
|
|
6249
6524
|
),
|
|
6250
|
-
/* @__PURE__ */ (0,
|
|
6525
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6251
6526
|
"button",
|
|
6252
6527
|
{
|
|
6253
6528
|
type: "button",
|
|
@@ -6259,7 +6534,7 @@ var ImageEditor = ({
|
|
|
6259
6534
|
children: "3:2 Photo"
|
|
6260
6535
|
}
|
|
6261
6536
|
),
|
|
6262
|
-
/* @__PURE__ */ (0,
|
|
6537
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6263
6538
|
"button",
|
|
6264
6539
|
{
|
|
6265
6540
|
type: "button",
|
|
@@ -6272,10 +6547,10 @@ var ImageEditor = ({
|
|
|
6272
6547
|
}
|
|
6273
6548
|
)
|
|
6274
6549
|
] }),
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6276
|
-
/* @__PURE__ */ (0,
|
|
6277
|
-
/* @__PURE__ */ (0,
|
|
6278
|
-
/* @__PURE__ */ (0,
|
|
6550
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6551
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
6552
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
6553
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6279
6554
|
"button",
|
|
6280
6555
|
{
|
|
6281
6556
|
type: "button",
|
|
@@ -6284,7 +6559,7 @@ var ImageEditor = ({
|
|
|
6284
6559
|
children: "Rotate -90\xB0"
|
|
6285
6560
|
}
|
|
6286
6561
|
),
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6562
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6288
6563
|
"button",
|
|
6289
6564
|
{
|
|
6290
6565
|
type: "button",
|
|
@@ -6293,7 +6568,7 @@ var ImageEditor = ({
|
|
|
6293
6568
|
children: "Rotate +90\xB0"
|
|
6294
6569
|
}
|
|
6295
6570
|
),
|
|
6296
|
-
/* @__PURE__ */ (0,
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6297
6572
|
"button",
|
|
6298
6573
|
{
|
|
6299
6574
|
type: "button",
|
|
@@ -6302,7 +6577,7 @@ var ImageEditor = ({
|
|
|
6302
6577
|
children: "Flip Horizontal"
|
|
6303
6578
|
}
|
|
6304
6579
|
),
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6306
6581
|
"button",
|
|
6307
6582
|
{
|
|
6308
6583
|
type: "button",
|
|
@@ -6313,10 +6588,10 @@ var ImageEditor = ({
|
|
|
6313
6588
|
)
|
|
6314
6589
|
] })
|
|
6315
6590
|
] }),
|
|
6316
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
6317
|
-
/* @__PURE__ */ (0,
|
|
6318
|
-
/* @__PURE__ */ (0,
|
|
6319
|
-
/* @__PURE__ */ (0,
|
|
6591
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6320
6595
|
"button",
|
|
6321
6596
|
{
|
|
6322
6597
|
type: "button",
|
|
@@ -6326,25 +6601,25 @@ var ImageEditor = ({
|
|
|
6326
6601
|
}
|
|
6327
6602
|
)
|
|
6328
6603
|
] }),
|
|
6329
|
-
/* @__PURE__ */ (0,
|
|
6330
|
-
|
|
6331
|
-
/* @__PURE__ */ (0,
|
|
6604
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Histogram, { histogram: editor.histogram }),
|
|
6605
|
+
import_image_editor21.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react32.default.Fragment, { children: [
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6332
6607
|
ControlSlider,
|
|
6333
6608
|
{
|
|
6334
6609
|
spec,
|
|
6335
|
-
value: (0,
|
|
6610
|
+
value: (0, import_image_editor21.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
6336
6611
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
6337
6612
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
6338
6613
|
}
|
|
6339
6614
|
),
|
|
6340
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6615
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6341
6616
|
"div",
|
|
6342
6617
|
{
|
|
6343
6618
|
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",
|
|
6344
6619
|
"data-testid": "image-editor-process-notice",
|
|
6345
6620
|
children: [
|
|
6346
|
-
/* @__PURE__ */ (0,
|
|
6347
|
-
/* @__PURE__ */ (0,
|
|
6621
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
6622
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6348
6623
|
"button",
|
|
6349
6624
|
{
|
|
6350
6625
|
type: "button",
|
|
@@ -6357,7 +6632,7 @@ var ImageEditor = ({
|
|
|
6357
6632
|
}
|
|
6358
6633
|
)
|
|
6359
6634
|
] }, spec.id)),
|
|
6360
|
-
/* @__PURE__ */ (0,
|
|
6635
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6361
6636
|
AdjustmentLayersPanel,
|
|
6362
6637
|
{
|
|
6363
6638
|
controller,
|
|
@@ -6366,9 +6641,9 @@ var ImageEditor = ({
|
|
|
6366
6641
|
}
|
|
6367
6642
|
) })
|
|
6368
6643
|
] }),
|
|
6369
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
6370
|
-
/* @__PURE__ */ (0,
|
|
6371
|
-
/* @__PURE__ */ (0,
|
|
6644
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
6646
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6372
6647
|
"button",
|
|
6373
6648
|
{
|
|
6374
6649
|
type: "button",
|
|
@@ -6379,15 +6654,15 @@ var ImageEditor = ({
|
|
|
6379
6654
|
children: "Free Transform"
|
|
6380
6655
|
}
|
|
6381
6656
|
),
|
|
6382
|
-
/* @__PURE__ */ (0,
|
|
6383
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
6384
|
-
/* @__PURE__ */ (0,
|
|
6385
|
-
/* @__PURE__ */ (0,
|
|
6657
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersPanel, { controller }),
|
|
6658
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
6659
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
6660
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ColorProfilePanel, { controller })
|
|
6386
6661
|
] }),
|
|
6387
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
6388
|
-
/* @__PURE__ */ (0,
|
|
6389
|
-
/* @__PURE__ */ (0,
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6662
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6663
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
6664
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrushOptionsBar, { controller }),
|
|
6665
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6391
6666
|
"button",
|
|
6392
6667
|
{
|
|
6393
6668
|
type: "button",
|
|
@@ -6398,12 +6673,12 @@ var ImageEditor = ({
|
|
|
6398
6673
|
children: "Free Transform"
|
|
6399
6674
|
}
|
|
6400
6675
|
),
|
|
6401
|
-
paintError && /* @__PURE__ */ (0,
|
|
6402
|
-
/* @__PURE__ */ (0,
|
|
6676
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
6677
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersPanel, { controller }) })
|
|
6403
6678
|
] }),
|
|
6404
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6406
|
-
/* @__PURE__ */ (0,
|
|
6679
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6680
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
6681
|
+
/* @__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)(
|
|
6407
6682
|
"button",
|
|
6408
6683
|
{
|
|
6409
6684
|
type: "button",
|
|
@@ -6414,13 +6689,13 @@ var ImageEditor = ({
|
|
|
6414
6689
|
},
|
|
6415
6690
|
t
|
|
6416
6691
|
)) }),
|
|
6417
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
6418
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
6419
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
6420
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6422
|
-
/* @__PURE__ */ (0,
|
|
6423
|
-
/* @__PURE__ */ (0,
|
|
6692
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
6693
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
6694
|
+
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" }),
|
|
6695
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
6696
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6697
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
6698
|
+
/* @__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)(
|
|
6424
6699
|
"button",
|
|
6425
6700
|
{
|
|
6426
6701
|
type: "button",
|
|
@@ -6430,18 +6705,18 @@ var ImageEditor = ({
|
|
|
6430
6705
|
},
|
|
6431
6706
|
t
|
|
6432
6707
|
)) }),
|
|
6433
|
-
/* @__PURE__ */ (0,
|
|
6434
|
-
/* @__PURE__ */ (0,
|
|
6435
|
-
/* @__PURE__ */ (0,
|
|
6436
|
-
/* @__PURE__ */ (0,
|
|
6437
|
-
/* @__PURE__ */ (0,
|
|
6438
|
-
/* @__PURE__ */ (0,
|
|
6439
|
-
/* @__PURE__ */ (0,
|
|
6708
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
6709
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
6710
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
6711
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
6712
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
6713
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Width:" }),
|
|
6714
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
6440
6715
|
strokeWidth,
|
|
6441
6716
|
"px"
|
|
6442
6717
|
] })
|
|
6443
6718
|
] }),
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6719
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6445
6720
|
"input",
|
|
6446
6721
|
{
|
|
6447
6722
|
type: "range",
|
|
@@ -6454,10 +6729,10 @@ var ImageEditor = ({
|
|
|
6454
6729
|
)
|
|
6455
6730
|
] })
|
|
6456
6731
|
] }),
|
|
6457
|
-
/* @__PURE__ */ (0,
|
|
6458
|
-
/* @__PURE__ */ (0,
|
|
6459
|
-
/* @__PURE__ */ (0,
|
|
6460
|
-
/* @__PURE__ */ (0,
|
|
6732
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6733
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
6734
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
|
|
6735
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6461
6736
|
"input",
|
|
6462
6737
|
{
|
|
6463
6738
|
type: "text",
|
|
@@ -6468,7 +6743,7 @@ var ImageEditor = ({
|
|
|
6468
6743
|
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"
|
|
6469
6744
|
}
|
|
6470
6745
|
),
|
|
6471
|
-
/* @__PURE__ */ (0,
|
|
6746
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6472
6747
|
"button",
|
|
6473
6748
|
{
|
|
6474
6749
|
type: "button",
|
|
@@ -6478,14 +6753,14 @@ var ImageEditor = ({
|
|
|
6478
6753
|
}
|
|
6479
6754
|
)
|
|
6480
6755
|
] }),
|
|
6481
|
-
/* @__PURE__ */ (0,
|
|
6482
|
-
/* @__PURE__ */ (0,
|
|
6483
|
-
/* @__PURE__ */ (0,
|
|
6756
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
6757
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Font Size:" }),
|
|
6758
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
6484
6759
|
fontSize,
|
|
6485
6760
|
"px"
|
|
6486
6761
|
] })
|
|
6487
6762
|
] }),
|
|
6488
|
-
/* @__PURE__ */ (0,
|
|
6763
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6489
6764
|
"input",
|
|
6490
6765
|
{
|
|
6491
6766
|
type: "range",
|
|
@@ -6496,14 +6771,14 @@ var ImageEditor = ({
|
|
|
6496
6771
|
className: imageRangeClass
|
|
6497
6772
|
}
|
|
6498
6773
|
),
|
|
6499
|
-
/* @__PURE__ */ (0,
|
|
6500
|
-
/* @__PURE__ */ (0,
|
|
6501
|
-
/* @__PURE__ */ (0,
|
|
6774
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
|
|
6775
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6776
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
6502
6777
|
"Layers (",
|
|
6503
6778
|
state.annotations.length,
|
|
6504
6779
|
")"
|
|
6505
6780
|
] }),
|
|
6506
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
6781
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6507
6782
|
"button",
|
|
6508
6783
|
{
|
|
6509
6784
|
type: "button",
|
|
@@ -6512,7 +6787,7 @@ var ImageEditor = ({
|
|
|
6512
6787
|
children: "Delete Selected"
|
|
6513
6788
|
}
|
|
6514
6789
|
),
|
|
6515
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
6790
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6516
6791
|
"button",
|
|
6517
6792
|
{
|
|
6518
6793
|
type: "button",
|
|
@@ -6523,10 +6798,10 @@ var ImageEditor = ({
|
|
|
6523
6798
|
)
|
|
6524
6799
|
] })
|
|
6525
6800
|
] }),
|
|
6526
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
6527
|
-
/* @__PURE__ */ (0,
|
|
6528
|
-
/* @__PURE__ */ (0,
|
|
6529
|
-
/* @__PURE__ */ (0,
|
|
6801
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6802
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6530
6805
|
"button",
|
|
6531
6806
|
{
|
|
6532
6807
|
type: "button",
|
|
@@ -6536,8 +6811,8 @@ var ImageEditor = ({
|
|
|
6536
6811
|
}
|
|
6537
6812
|
)
|
|
6538
6813
|
] }),
|
|
6539
|
-
/* @__PURE__ */ (0,
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6814
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
6815
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6541
6816
|
"input",
|
|
6542
6817
|
{
|
|
6543
6818
|
type: "checkbox",
|
|
@@ -6546,12 +6821,12 @@ var ImageEditor = ({
|
|
|
6546
6821
|
className: "rounded accent-primary"
|
|
6547
6822
|
}
|
|
6548
6823
|
),
|
|
6549
|
-
/* @__PURE__ */ (0,
|
|
6824
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
6550
6825
|
] }),
|
|
6551
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
6552
|
-
/* @__PURE__ */ (0,
|
|
6553
|
-
/* @__PURE__ */ (0,
|
|
6554
|
-
/* @__PURE__ */ (0,
|
|
6826
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6827
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6828
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
6829
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6555
6830
|
"input",
|
|
6556
6831
|
{
|
|
6557
6832
|
type: "text",
|
|
@@ -6562,8 +6837,8 @@ var ImageEditor = ({
|
|
|
6562
6837
|
}
|
|
6563
6838
|
)
|
|
6564
6839
|
] }),
|
|
6565
|
-
/* @__PURE__ */ (0,
|
|
6566
|
-
/* @__PURE__ */ (0,
|
|
6840
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
|
|
6841
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6567
6842
|
"button",
|
|
6568
6843
|
{
|
|
6569
6844
|
type: "button",
|
|
@@ -6572,7 +6847,7 @@ var ImageEditor = ({
|
|
|
6572
6847
|
children: "Threshold Mode"
|
|
6573
6848
|
}
|
|
6574
6849
|
),
|
|
6575
|
-
/* @__PURE__ */ (0,
|
|
6850
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6576
6851
|
"button",
|
|
6577
6852
|
{
|
|
6578
6853
|
type: "button",
|
|
@@ -6582,12 +6857,12 @@ var ImageEditor = ({
|
|
|
6582
6857
|
}
|
|
6583
6858
|
)
|
|
6584
6859
|
] }),
|
|
6585
|
-
/* @__PURE__ */ (0,
|
|
6586
|
-
/* @__PURE__ */ (0,
|
|
6587
|
-
/* @__PURE__ */ (0,
|
|
6588
|
-
/* @__PURE__ */ (0,
|
|
6860
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6861
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6862
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
6863
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
6589
6864
|
] }),
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6865
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6591
6866
|
"input",
|
|
6592
6867
|
{
|
|
6593
6868
|
type: "range",
|
|
@@ -6601,12 +6876,12 @@ var ImageEditor = ({
|
|
|
6601
6876
|
}
|
|
6602
6877
|
)
|
|
6603
6878
|
] }),
|
|
6604
|
-
/* @__PURE__ */ (0,
|
|
6605
|
-
/* @__PURE__ */ (0,
|
|
6606
|
-
/* @__PURE__ */ (0,
|
|
6607
|
-
/* @__PURE__ */ (0,
|
|
6879
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6880
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6881
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
6882
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
6608
6883
|
] }),
|
|
6609
|
-
/* @__PURE__ */ (0,
|
|
6884
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6610
6885
|
"input",
|
|
6611
6886
|
{
|
|
6612
6887
|
type: "range",
|
|
@@ -6620,12 +6895,12 @@ var ImageEditor = ({
|
|
|
6620
6895
|
}
|
|
6621
6896
|
)
|
|
6622
6897
|
] }),
|
|
6623
|
-
/* @__PURE__ */ (0,
|
|
6624
|
-
/* @__PURE__ */ (0,
|
|
6625
|
-
/* @__PURE__ */ (0,
|
|
6626
|
-
/* @__PURE__ */ (0,
|
|
6898
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6899
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Softness:" }),
|
|
6901
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
6627
6902
|
] }),
|
|
6628
|
-
/* @__PURE__ */ (0,
|
|
6903
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6629
6904
|
"input",
|
|
6630
6905
|
{
|
|
6631
6906
|
type: "range",
|
|
@@ -6637,8 +6912,8 @@ var ImageEditor = ({
|
|
|
6637
6912
|
}
|
|
6638
6913
|
)
|
|
6639
6914
|
] }),
|
|
6640
|
-
/* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6915
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
6916
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6642
6917
|
"input",
|
|
6643
6918
|
{
|
|
6644
6919
|
type: "checkbox",
|
|
@@ -6647,12 +6922,12 @@ var ImageEditor = ({
|
|
|
6647
6922
|
className: "rounded accent-primary"
|
|
6648
6923
|
}
|
|
6649
6924
|
),
|
|
6650
|
-
/* @__PURE__ */ (0,
|
|
6925
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Invert Mask" })
|
|
6651
6926
|
] })
|
|
6652
6927
|
] })
|
|
6653
6928
|
] }),
|
|
6654
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
6655
|
-
/* @__PURE__ */ (0,
|
|
6929
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6656
6931
|
SelectionOptionsBar,
|
|
6657
6932
|
{
|
|
6658
6933
|
controller,
|
|
@@ -6663,9 +6938,9 @@ var ImageEditor = ({
|
|
|
6663
6938
|
selectionDisplay: state.selectionDisplay
|
|
6664
6939
|
}
|
|
6665
6940
|
),
|
|
6666
|
-
selectionError && /* @__PURE__ */ (0,
|
|
6667
|
-
/* @__PURE__ */ (0,
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
6941
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", children: [
|
|
6943
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6669
6944
|
"button",
|
|
6670
6945
|
{
|
|
6671
6946
|
type: "button",
|
|
@@ -6676,7 +6951,7 @@ var ImageEditor = ({
|
|
|
6676
6951
|
children: "Transform Selection"
|
|
6677
6952
|
}
|
|
6678
6953
|
),
|
|
6679
|
-
/* @__PURE__ */ (0,
|
|
6954
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6680
6955
|
"button",
|
|
6681
6956
|
{
|
|
6682
6957
|
type: "button",
|
|
@@ -6688,13 +6963,13 @@ var ImageEditor = ({
|
|
|
6688
6963
|
}
|
|
6689
6964
|
)
|
|
6690
6965
|
] }),
|
|
6691
|
-
/* @__PURE__ */ (0,
|
|
6692
|
-
/* @__PURE__ */ (0,
|
|
6966
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
6967
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChannelsPanel, { controller })
|
|
6693
6968
|
] }),
|
|
6694
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
6695
|
-
/* @__PURE__ */ (0,
|
|
6696
|
-
/* @__PURE__ */ (0,
|
|
6697
|
-
/* @__PURE__ */ (0,
|
|
6969
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6970
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
6971
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Results go to" }),
|
|
6972
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6698
6973
|
"select",
|
|
6699
6974
|
{
|
|
6700
6975
|
"aria-label": "AI result target",
|
|
@@ -6702,54 +6977,54 @@ var ImageEditor = ({
|
|
|
6702
6977
|
onChange: (e) => setAiTarget(e.target.value),
|
|
6703
6978
|
className: imageSelectClass,
|
|
6704
6979
|
children: [
|
|
6705
|
-
/* @__PURE__ */ (0,
|
|
6706
|
-
/* @__PURE__ */ (0,
|
|
6707
|
-
/* @__PURE__ */ (0,
|
|
6980
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
6981
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
6982
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "replace", children: "Replace image" })
|
|
6708
6983
|
]
|
|
6709
6984
|
}
|
|
6710
6985
|
)
|
|
6711
6986
|
] }),
|
|
6712
|
-
/* @__PURE__ */ (0,
|
|
6713
|
-
/* @__PURE__ */ (0,
|
|
6714
|
-
/* @__PURE__ */ (0,
|
|
6715
|
-
/* @__PURE__ */ (0,
|
|
6987
|
+
/* @__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: [
|
|
6988
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6989
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
6990
|
+
/* @__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" }) }),
|
|
6716
6991
|
"Background Removal"
|
|
6717
6992
|
] }),
|
|
6718
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
6993
|
+
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..." })
|
|
6719
6994
|
] }),
|
|
6720
|
-
/* @__PURE__ */ (0,
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6995
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
6996
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6722
6997
|
"button",
|
|
6723
6998
|
{
|
|
6724
6999
|
type: "button",
|
|
6725
7000
|
onClick: handleRemoveBackground,
|
|
6726
7001
|
disabled: isRemovingBg || isInpainting,
|
|
6727
7002
|
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",
|
|
6728
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
6729
|
-
/* @__PURE__ */ (0,
|
|
7003
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7004
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSpinnerClass }),
|
|
6730
7005
|
"Removing Background..."
|
|
6731
|
-
] }) : /* @__PURE__ */ (0,
|
|
6732
|
-
/* @__PURE__ */ (0,
|
|
7006
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7007
|
+
/* @__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" }) }),
|
|
6733
7008
|
"Remove Background"
|
|
6734
7009
|
] })
|
|
6735
7010
|
}
|
|
6736
7011
|
)
|
|
6737
7012
|
] }),
|
|
6738
|
-
/* @__PURE__ */ (0,
|
|
6739
|
-
/* @__PURE__ */ (0,
|
|
6740
|
-
/* @__PURE__ */ (0,
|
|
6741
|
-
/* @__PURE__ */ (0,
|
|
6742
|
-
/* @__PURE__ */ (0,
|
|
6743
|
-
/* @__PURE__ */ (0,
|
|
7013
|
+
/* @__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: [
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7015
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7016
|
+
/* @__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: [
|
|
7017
|
+
/* @__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" }),
|
|
7018
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "m14 7 3 3" })
|
|
6744
7019
|
] }),
|
|
6745
7020
|
"Generative Inpainting"
|
|
6746
7021
|
] }),
|
|
6747
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7022
|
+
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..." })
|
|
6748
7023
|
] }),
|
|
6749
|
-
/* @__PURE__ */ (0,
|
|
6750
|
-
/* @__PURE__ */ (0,
|
|
6751
|
-
/* @__PURE__ */ (0,
|
|
6752
|
-
/* @__PURE__ */ (0,
|
|
7024
|
+
/* @__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." }),
|
|
7025
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7026
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7027
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6753
7028
|
"textarea",
|
|
6754
7029
|
{
|
|
6755
7030
|
id: "ai-inpaint-prompt-react",
|
|
@@ -6761,10 +7036,10 @@ var ImageEditor = ({
|
|
|
6761
7036
|
}
|
|
6762
7037
|
)
|
|
6763
7038
|
] }),
|
|
6764
|
-
/* @__PURE__ */ (0,
|
|
6765
|
-
/* @__PURE__ */ (0,
|
|
6766
|
-
/* @__PURE__ */ (0,
|
|
6767
|
-
/* @__PURE__ */ (0,
|
|
7039
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7040
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7041
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7042
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6768
7043
|
"button",
|
|
6769
7044
|
{
|
|
6770
7045
|
type: "button",
|
|
@@ -6777,7 +7052,7 @@ var ImageEditor = ({
|
|
|
6777
7052
|
]
|
|
6778
7053
|
}
|
|
6779
7054
|
),
|
|
6780
|
-
/* @__PURE__ */ (0,
|
|
7055
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6781
7056
|
"button",
|
|
6782
7057
|
{
|
|
6783
7058
|
type: "button",
|
|
@@ -6792,25 +7067,25 @@ var ImageEditor = ({
|
|
|
6792
7067
|
)
|
|
6793
7068
|
] })
|
|
6794
7069
|
] }),
|
|
6795
|
-
/* @__PURE__ */ (0,
|
|
7070
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6796
7071
|
"button",
|
|
6797
7072
|
{
|
|
6798
7073
|
type: "button",
|
|
6799
7074
|
onClick: handleInpaint,
|
|
6800
7075
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
6801
7076
|
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",
|
|
6802
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
6803
|
-
/* @__PURE__ */ (0,
|
|
7077
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7078
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSpinnerClass }),
|
|
6804
7079
|
"Generating Inpaint..."
|
|
6805
|
-
] }) : /* @__PURE__ */ (0,
|
|
6806
|
-
/* @__PURE__ */ (0,
|
|
7080
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7081
|
+
/* @__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" }) }),
|
|
6807
7082
|
"Apply Inpainting"
|
|
6808
7083
|
] })
|
|
6809
7084
|
}
|
|
6810
7085
|
)
|
|
6811
7086
|
] }),
|
|
6812
|
-
aiError && /* @__PURE__ */ (0,
|
|
6813
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7087
|
+
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 }),
|
|
7088
|
+
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 })
|
|
6814
7089
|
] })
|
|
6815
7090
|
] })
|
|
6816
7091
|
] })
|
|
@@ -6841,6 +7116,7 @@ var ImageEditor = ({
|
|
|
6841
7116
|
LayersPanel,
|
|
6842
7117
|
PaintGradientEditor,
|
|
6843
7118
|
RefineEdgePanel,
|
|
7119
|
+
SelectAndMaskWorkspace,
|
|
6844
7120
|
SelectionOptionsBar,
|
|
6845
7121
|
ShapeOptionsBar,
|
|
6846
7122
|
TypeOptionsBar,
|