@pixerate/editor-react 0.136.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-2FWKCKPR.js → chunk-6GWWDUEF.js} +807 -541
- package/dist/image-editor/SelectAndMaskWorkspace.d.cts +17 -0
- package/dist/image-editor/SelectAndMaskWorkspace.d.ts +17 -0
- package/dist/image-editor/index.cjs +825 -558
- 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 +1350 -1083
- 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,39 +5348,39 @@ 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,
|
|
5117
|
-
const [objectAware, setObjectAware] = (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);
|
|
5118
5384
|
const canObject = Boolean(controller.segmentationProvider);
|
|
5119
5385
|
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
5120
5386
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -5134,17 +5400,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5134
5400
|
setBusy(false);
|
|
5135
5401
|
}
|
|
5136
5402
|
};
|
|
5137
|
-
return /* @__PURE__ */ (0,
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5139
|
-
|
|
5140
|
-
/* @__PURE__ */ (0,
|
|
5141
|
-
/* @__PURE__ */ (0,
|
|
5142
|
-
/* @__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: [
|
|
5143
5409
|
params[c.id],
|
|
5144
5410
|
c.unit
|
|
5145
5411
|
] })
|
|
5146
5412
|
] }),
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5413
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5148
5414
|
"input",
|
|
5149
5415
|
{
|
|
5150
5416
|
type: "range",
|
|
@@ -5158,39 +5424,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5158
5424
|
}
|
|
5159
5425
|
)
|
|
5160
5426
|
] }, c.id)),
|
|
5161
|
-
/* @__PURE__ */ (0,
|
|
5162
|
-
/* @__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 }) }),
|
|
5163
5429
|
"Smart Radius"
|
|
5164
5430
|
] }),
|
|
5165
|
-
canObject && /* @__PURE__ */ (0,
|
|
5166
|
-
/* @__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) }),
|
|
5167
5433
|
"Object aware (segmentation model)"
|
|
5168
5434
|
] }),
|
|
5169
|
-
/* @__PURE__ */ (0,
|
|
5435
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5170
5436
|
"Output to",
|
|
5171
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5172
5438
|
"select",
|
|
5173
5439
|
{
|
|
5174
5440
|
"aria-label": "Refine output",
|
|
5175
5441
|
value: output,
|
|
5176
5442
|
onChange: (e) => setOutput(e.target.value),
|
|
5177
5443
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5178
|
-
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))
|
|
5179
5445
|
}
|
|
5180
5446
|
)
|
|
5181
5447
|
] }),
|
|
5182
|
-
/* @__PURE__ */ (0,
|
|
5183
|
-
/* @__PURE__ */ (0,
|
|
5184
|
-
/* @__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: [
|
|
5185
5451
|
"Decontaminate colors",
|
|
5186
5452
|
toLayer ? "" : " (new layer outputs)"
|
|
5187
5453
|
] }),
|
|
5188
|
-
/* @__PURE__ */ (0,
|
|
5454
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5189
5455
|
decontaminate,
|
|
5190
5456
|
"%"
|
|
5191
5457
|
] })
|
|
5192
5458
|
] }),
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5194
5460
|
"input",
|
|
5195
5461
|
{
|
|
5196
5462
|
type: "range",
|
|
@@ -5205,63 +5471,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5205
5471
|
}
|
|
5206
5472
|
)
|
|
5207
5473
|
] }),
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5210
|
-
/* @__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" })
|
|
5211
5477
|
] }),
|
|
5212
|
-
error && /* @__PURE__ */ (0,
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5214
|
-
/* @__PURE__ */ (0,
|
|
5215
|
-
/* @__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)(
|
|
5216
5482
|
"select",
|
|
5217
5483
|
{
|
|
5218
5484
|
"aria-label": "New masked layer kind",
|
|
5219
5485
|
value: newKind,
|
|
5220
5486
|
onChange: (e) => setNewKind(e.target.value),
|
|
5221
5487
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5222
|
-
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))
|
|
5223
5489
|
}
|
|
5224
5490
|
),
|
|
5225
|
-
/* @__PURE__ */ (0,
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5226
5492
|
"button",
|
|
5227
5493
|
{
|
|
5228
5494
|
type: "button",
|
|
5229
|
-
className:
|
|
5495
|
+
className: button3,
|
|
5230
5496
|
disabled: !sel,
|
|
5231
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
5497
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor16.layerMaskFromSelection)(sel) })),
|
|
5232
5498
|
children: "New Masked Layer"
|
|
5233
5499
|
}
|
|
5234
5500
|
)
|
|
5235
5501
|
] }),
|
|
5236
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
5237
|
-
/* @__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)(
|
|
5238
5504
|
"select",
|
|
5239
5505
|
{
|
|
5240
5506
|
"aria-label": "Mask layer",
|
|
5241
5507
|
value: target.id,
|
|
5242
5508
|
onChange: (e) => setLayerId(e.target.value),
|
|
5243
5509
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5244
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
5245
|
-
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),
|
|
5246
5512
|
l.mask ? " (masked)" : ""
|
|
5247
5513
|
] }, l.id))
|
|
5248
5514
|
}
|
|
5249
5515
|
),
|
|
5250
|
-
/* @__PURE__ */ (0,
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5253
|
-
/* @__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" })
|
|
5254
5520
|
] }),
|
|
5255
|
-
target.mask && /* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
/* @__PURE__ */ (0,
|
|
5259
|
-
/* @__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: [
|
|
5260
5526
|
Math.round((target.mask.density ?? 1) * 100),
|
|
5261
5527
|
"%"
|
|
5262
5528
|
] })
|
|
5263
5529
|
] }),
|
|
5264
|
-
/* @__PURE__ */ (0,
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5265
5531
|
"input",
|
|
5266
5532
|
{
|
|
5267
5533
|
type: "range",
|
|
@@ -5275,15 +5541,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5275
5541
|
}
|
|
5276
5542
|
)
|
|
5277
5543
|
] }),
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
5280
|
-
/* @__PURE__ */ (0,
|
|
5281
|
-
/* @__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: [
|
|
5282
5548
|
target.mask.feather ?? 0,
|
|
5283
5549
|
"px"
|
|
5284
5550
|
] })
|
|
5285
5551
|
] }),
|
|
5286
|
-
/* @__PURE__ */ (0,
|
|
5552
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5287
5553
|
"input",
|
|
5288
5554
|
{
|
|
5289
5555
|
type: "range",
|
|
@@ -5303,32 +5569,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5303
5569
|
};
|
|
5304
5570
|
|
|
5305
5571
|
// src/image-editor/ChannelsPanel.tsx
|
|
5306
|
-
var
|
|
5307
|
-
var
|
|
5308
|
-
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");
|
|
5309
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"}`;
|
|
5310
5576
|
var ChannelThumb = ({ channel, size }) => {
|
|
5311
|
-
const ref = (0,
|
|
5312
|
-
(0,
|
|
5577
|
+
const ref = (0, import_react28.useRef)(null);
|
|
5578
|
+
(0, import_react28.useEffect)(() => {
|
|
5313
5579
|
const canvas = ref.current;
|
|
5314
5580
|
const ctx = canvas?.getContext("2d");
|
|
5315
5581
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
5316
|
-
const px = (0,
|
|
5582
|
+
const px = (0, import_image_editor17.channelThumbnail)(channel, 64);
|
|
5317
5583
|
canvas.width = px.width;
|
|
5318
5584
|
canvas.height = px.height;
|
|
5319
5585
|
const img = ctx.createImageData(px.width, px.height);
|
|
5320
5586
|
img.data.set(px.data);
|
|
5321
5587
|
ctx.putImageData(img, 0, 0);
|
|
5322
5588
|
}, [channel.mask]);
|
|
5323
|
-
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" });
|
|
5324
5590
|
};
|
|
5325
5591
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5326
|
-
const [, setTick] = (0,
|
|
5327
|
-
(0,
|
|
5328
|
-
const [activeId, setActiveId] = (0,
|
|
5329
|
-
const [renaming, setRenaming] = (0,
|
|
5330
|
-
const [error, setError] = (0,
|
|
5331
|
-
const fileInput = (0,
|
|
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);
|
|
5332
5598
|
const channels = controller.getChannels();
|
|
5333
5599
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5334
5600
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -5345,18 +5611,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5345
5611
|
if (!file) return;
|
|
5346
5612
|
setError(null);
|
|
5347
5613
|
try {
|
|
5348
|
-
setActiveId((await (0,
|
|
5614
|
+
setActiveId((await (0, import_image_editor17.openMaskFile)(controller, file)).id);
|
|
5349
5615
|
} catch (err) {
|
|
5350
5616
|
setError(err instanceof Error ? err.message : String(err));
|
|
5351
5617
|
}
|
|
5352
5618
|
};
|
|
5353
|
-
return /* @__PURE__ */ (0,
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5356
|
-
/* @__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" })
|
|
5357
5623
|
] }),
|
|
5358
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
5359
|
-
/* @__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)(
|
|
5360
5626
|
"li",
|
|
5361
5627
|
{
|
|
5362
5628
|
"data-testid": "channel-row",
|
|
@@ -5364,11 +5630,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5364
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"}`,
|
|
5365
5631
|
onClick: (e) => {
|
|
5366
5632
|
setActiveId(c.id);
|
|
5367
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
5633
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor17.selectionModeFromModifiers)(e, "replace") }));
|
|
5368
5634
|
},
|
|
5369
5635
|
onDoubleClick: () => setRenaming(c.id),
|
|
5370
5636
|
children: [
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5372
5638
|
"button",
|
|
5373
5639
|
{
|
|
5374
5640
|
type: "button",
|
|
@@ -5382,8 +5648,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5382
5648
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
5383
5649
|
}
|
|
5384
5650
|
),
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
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)(
|
|
5387
5653
|
"input",
|
|
5388
5654
|
{
|
|
5389
5655
|
autoFocus: true,
|
|
@@ -5400,16 +5666,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5400
5666
|
if (e.key === "Escape") setRenaming(null);
|
|
5401
5667
|
}
|
|
5402
5668
|
}
|
|
5403
|
-
) : /* @__PURE__ */ (0,
|
|
5669
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
5404
5670
|
]
|
|
5405
5671
|
},
|
|
5406
5672
|
c.id
|
|
5407
5673
|
)) }),
|
|
5408
|
-
/* @__PURE__ */ (0,
|
|
5409
|
-
/* @__PURE__ */ (0,
|
|
5410
|
-
/* @__PURE__ */ (0,
|
|
5411
|
-
/* @__PURE__ */ (0,
|
|
5412
|
-
/* @__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)(
|
|
5413
5679
|
"button",
|
|
5414
5680
|
{
|
|
5415
5681
|
type: "button",
|
|
@@ -5422,24 +5688,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5422
5688
|
children: "Delete"
|
|
5423
5689
|
}
|
|
5424
5690
|
),
|
|
5425
|
-
/* @__PURE__ */ (0,
|
|
5426
|
-
/* @__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)(
|
|
5427
5693
|
"button",
|
|
5428
5694
|
{
|
|
5429
5695
|
type: "button",
|
|
5430
5696
|
className: btn2(),
|
|
5431
5697
|
disabled: !active && !hasSelection,
|
|
5432
5698
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
5433
|
-
onClick: () => attempt(() => (0,
|
|
5699
|
+
onClick: () => attempt(() => (0, import_image_editor17.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
5434
5700
|
children: "Export PNG"
|
|
5435
5701
|
}
|
|
5436
5702
|
),
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5438
5704
|
"input",
|
|
5439
5705
|
{
|
|
5440
5706
|
ref: fileInput,
|
|
5441
5707
|
type: "file",
|
|
5442
|
-
accept:
|
|
5708
|
+
accept: import_image_editor17.MASK_FILE_ACCEPT,
|
|
5443
5709
|
hidden: true,
|
|
5444
5710
|
"data-testid": "channel-import-input",
|
|
5445
5711
|
onChange: (e) => {
|
|
@@ -5449,18 +5715,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5449
5715
|
}
|
|
5450
5716
|
)
|
|
5451
5717
|
] }),
|
|
5452
|
-
error && /* @__PURE__ */ (0,
|
|
5718
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5453
5719
|
] });
|
|
5454
5720
|
};
|
|
5455
5721
|
|
|
5456
5722
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
5457
|
-
var
|
|
5458
|
-
var
|
|
5459
|
-
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");
|
|
5460
5726
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
5461
5727
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
5462
|
-
const [, setTick] = (0,
|
|
5463
|
-
(0,
|
|
5728
|
+
const [, setTick] = (0, import_react29.useState)(0);
|
|
5729
|
+
(0, import_react29.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
5464
5730
|
const bar = tool.bar();
|
|
5465
5731
|
if (!tool.active || !bar) return null;
|
|
5466
5732
|
const warp = tool.warpBar();
|
|
@@ -5472,17 +5738,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5472
5738
|
const v = Number(raw);
|
|
5473
5739
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
5474
5740
|
};
|
|
5475
|
-
return /* @__PURE__ */ (0,
|
|
5476
|
-
/* @__PURE__ */ (0,
|
|
5477
|
-
/* @__PURE__ */ (0,
|
|
5478
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
5479
|
-
/* @__PURE__ */ (0,
|
|
5480
|
-
/* @__PURE__ */ (0,
|
|
5481
|
-
/* @__PURE__ */ (0,
|
|
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)) })
|
|
5482
5748
|
] }),
|
|
5483
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5485
|
-
/* @__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)(
|
|
5486
5752
|
"input",
|
|
5487
5753
|
{
|
|
5488
5754
|
type: "number",
|
|
@@ -5503,9 +5769,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5503
5769
|
},
|
|
5504
5770
|
`${k}:${warp[k]}`
|
|
5505
5771
|
),
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
5507
5773
|
] }, k)),
|
|
5508
|
-
/* @__PURE__ */ (0,
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5509
5775
|
"button",
|
|
5510
5776
|
{
|
|
5511
5777
|
type: "button",
|
|
@@ -5517,26 +5783,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5517
5783
|
children: "Vertical"
|
|
5518
5784
|
}
|
|
5519
5785
|
),
|
|
5520
|
-
/* @__PURE__ */ (0,
|
|
5521
|
-
/* @__PURE__ */ (0,
|
|
5522
|
-
/* @__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)(
|
|
5523
5789
|
"select",
|
|
5524
5790
|
{
|
|
5525
5791
|
"aria-label": "Warp grid",
|
|
5526
|
-
value:
|
|
5792
|
+
value: import_image_editor18.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
5527
5793
|
onChange: (e) => {
|
|
5528
|
-
const g =
|
|
5794
|
+
const g = import_image_editor18.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
5529
5795
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
5530
5796
|
},
|
|
5531
5797
|
className: imageFieldClass,
|
|
5532
|
-
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))
|
|
5533
5799
|
}
|
|
5534
5800
|
)
|
|
5535
5801
|
] })
|
|
5536
5802
|
] }),
|
|
5537
|
-
tool.mode !== "warp" &&
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5539
|
-
/* @__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)(
|
|
5540
5806
|
"input",
|
|
5541
5807
|
{
|
|
5542
5808
|
type: "number",
|
|
@@ -5556,8 +5822,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5556
5822
|
},
|
|
5557
5823
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
5558
5824
|
),
|
|
5559
|
-
/* @__PURE__ */ (0,
|
|
5560
|
-
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)(
|
|
5561
5827
|
"button",
|
|
5562
5828
|
{
|
|
5563
5829
|
type: "button",
|
|
@@ -5572,33 +5838,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5572
5838
|
}
|
|
5573
5839
|
)
|
|
5574
5840
|
] }, f.id)),
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5577
|
-
/* @__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)(
|
|
5578
5844
|
"select",
|
|
5579
5845
|
{
|
|
5580
5846
|
"aria-label": "Interpolation",
|
|
5581
5847
|
value: tool.interpolation,
|
|
5582
5848
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
5583
5849
|
className: imageFieldClass,
|
|
5584
|
-
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))
|
|
5585
5851
|
}
|
|
5586
5852
|
)
|
|
5587
5853
|
] }),
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
5589
|
-
/* @__PURE__ */ (0,
|
|
5590
|
-
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 })
|
|
5591
5857
|
] });
|
|
5592
5858
|
};
|
|
5593
5859
|
|
|
5594
5860
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
5595
|
-
var
|
|
5596
|
-
var
|
|
5597
|
-
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");
|
|
5598
5864
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
5599
|
-
const [, setTick] = (0,
|
|
5600
|
-
(0,
|
|
5601
|
-
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);
|
|
5602
5868
|
const active = controller.getActiveLayer();
|
|
5603
5869
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
5604
5870
|
const set = (change) => {
|
|
@@ -5606,28 +5872,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5606
5872
|
if (!shapeId) return;
|
|
5607
5873
|
try {
|
|
5608
5874
|
setError(null);
|
|
5609
|
-
(0,
|
|
5875
|
+
(0, import_image_editor19.applyShapeOptions)(controller, shapeId, change);
|
|
5610
5876
|
} catch (e) {
|
|
5611
5877
|
setError(e instanceof Error ? e.message : String(e));
|
|
5612
5878
|
}
|
|
5613
5879
|
};
|
|
5614
5880
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
5615
|
-
return /* @__PURE__ */ (0,
|
|
5616
|
-
/* @__PURE__ */ (0,
|
|
5617
|
-
/* @__PURE__ */ (0,
|
|
5618
|
-
/* @__PURE__ */ (0,
|
|
5619
|
-
/* @__PURE__ */ (0,
|
|
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 }) }),
|
|
5620
5886
|
"Fill",
|
|
5621
|
-
/* @__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 }) })
|
|
5622
5888
|
] }),
|
|
5623
|
-
/* @__PURE__ */ (0,
|
|
5624
|
-
/* @__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 }) }),
|
|
5625
5891
|
"Stroke",
|
|
5626
|
-
/* @__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 }) })
|
|
5627
5893
|
] }),
|
|
5628
|
-
/* @__PURE__ */ (0,
|
|
5894
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5629
5895
|
"Width",
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
5896
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5631
5897
|
"input",
|
|
5632
5898
|
{
|
|
5633
5899
|
type: "number",
|
|
@@ -5641,52 +5907,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5641
5907
|
)
|
|
5642
5908
|
] })
|
|
5643
5909
|
] }),
|
|
5644
|
-
/* @__PURE__ */ (0,
|
|
5645
|
-
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: [
|
|
5646
5912
|
"Radius",
|
|
5647
|
-
/* @__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}` })
|
|
5648
5914
|
] }),
|
|
5649
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
5915
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5650
5916
|
"Sides",
|
|
5651
|
-
/* @__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}` })
|
|
5652
5918
|
] }),
|
|
5653
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
5654
|
-
/* @__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: [
|
|
5655
5921
|
"Points",
|
|
5656
|
-
/* @__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}` })
|
|
5657
5923
|
] }),
|
|
5658
|
-
/* @__PURE__ */ (0,
|
|
5924
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5659
5925
|
"Inner",
|
|
5660
|
-
/* @__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 }) })
|
|
5661
5927
|
] })
|
|
5662
5928
|
] }),
|
|
5663
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
5664
|
-
/* @__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: [
|
|
5665
5931
|
"Weight",
|
|
5666
|
-
/* @__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}` })
|
|
5667
5933
|
] }),
|
|
5668
|
-
/* @__PURE__ */ (0,
|
|
5669
|
-
/* @__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 }) }),
|
|
5670
5936
|
"Arrowhead"
|
|
5671
5937
|
] })
|
|
5672
5938
|
] })
|
|
5673
5939
|
] }),
|
|
5674
|
-
/* @__PURE__ */ (0,
|
|
5675
|
-
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 })
|
|
5676
5942
|
] });
|
|
5677
5943
|
};
|
|
5678
5944
|
|
|
5679
5945
|
// src/image-editor/TypeOptionsBar.tsx
|
|
5680
|
-
var
|
|
5681
|
-
var
|
|
5682
|
-
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");
|
|
5683
5949
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
5684
5950
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
5685
5951
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
5686
|
-
const [, setTick] = (0,
|
|
5687
|
-
(0,
|
|
5688
|
-
(0,
|
|
5689
|
-
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);
|
|
5690
5956
|
const active = controller.getActiveLayer();
|
|
5691
5957
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
5692
5958
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -5739,11 +6005,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5739
6005
|
setError(e instanceof Error ? e.message : String(e));
|
|
5740
6006
|
}
|
|
5741
6007
|
};
|
|
5742
|
-
return /* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5744
|
-
/* @__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: [
|
|
5745
6011
|
"Font",
|
|
5746
|
-
/* @__PURE__ */ (0,
|
|
6012
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5747
6013
|
"input",
|
|
5748
6014
|
{
|
|
5749
6015
|
list: "pixerate-type-fonts",
|
|
@@ -5753,11 +6019,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5753
6019
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
5754
6020
|
}
|
|
5755
6021
|
),
|
|
5756
|
-
/* @__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)) })
|
|
5757
6023
|
] }),
|
|
5758
|
-
/* @__PURE__ */ (0,
|
|
6024
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5759
6025
|
"Size",
|
|
5760
|
-
/* @__PURE__ */ (0,
|
|
6026
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5761
6027
|
"input",
|
|
5762
6028
|
{
|
|
5763
6029
|
type: "number",
|
|
@@ -5770,14 +6036,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5770
6036
|
}
|
|
5771
6037
|
)
|
|
5772
6038
|
] }),
|
|
5773
|
-
/* @__PURE__ */ (0,
|
|
5774
|
-
/* @__PURE__ */ (0,
|
|
5775
|
-
/* @__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 }) })
|
|
5776
6042
|
] }),
|
|
5777
|
-
/* @__PURE__ */ (0,
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5779
|
-
|
|
5780
|
-
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)(
|
|
5781
6047
|
"button",
|
|
5782
6048
|
{
|
|
5783
6049
|
type: "button",
|
|
@@ -5789,19 +6055,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5789
6055
|
}
|
|
5790
6056
|
)
|
|
5791
6057
|
] }),
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5793
|
-
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: [
|
|
5794
6060
|
"Missing ",
|
|
5795
6061
|
missing.length === 1 ? "font" : "fonts",
|
|
5796
6062
|
": ",
|
|
5797
6063
|
missing.join(", ")
|
|
5798
6064
|
] }),
|
|
5799
|
-
error && /* @__PURE__ */ (0,
|
|
6065
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5800
6066
|
] });
|
|
5801
6067
|
};
|
|
5802
6068
|
|
|
5803
6069
|
// src/image-editor/ImageEditor.tsx
|
|
5804
|
-
var
|
|
6070
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5805
6071
|
var ImageEditor = ({
|
|
5806
6072
|
editor: externalEditor,
|
|
5807
6073
|
src,
|
|
@@ -5825,51 +6091,51 @@ var ImageEditor = ({
|
|
|
5825
6091
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
5826
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);
|
|
5827
6093
|
});
|
|
5828
|
-
const legacyProcess = (0,
|
|
5829
|
-
const [activeTab, setActiveTab] = (0,
|
|
5830
|
-
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);
|
|
5831
6097
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
5832
|
-
const activeTabRef = (0,
|
|
6098
|
+
const activeTabRef = (0, import_react32.useRef)(activeTab);
|
|
5833
6099
|
activeTabRef.current = activeTab;
|
|
5834
6100
|
const openPanel = async (ref) => {
|
|
5835
6101
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
5836
6102
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
5837
6103
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
5838
6104
|
};
|
|
5839
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
5840
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
5841
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
5842
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
5843
|
-
const [typeSession, setTypeSession] = (0,
|
|
5844
|
-
const [selectionError, setSelectionError] = (0,
|
|
5845
|
-
const [paintError, setPaintError] = (0,
|
|
5846
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
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);
|
|
5847
6113
|
const handleCanvasError = (source, message) => {
|
|
5848
6114
|
if (source === "paint") setPaintError(message);
|
|
5849
6115
|
else if (source === "select") setSelectionError(message);
|
|
5850
6116
|
else setShapeTypeError(message);
|
|
5851
6117
|
};
|
|
5852
6118
|
const finishTyping = () => setTypeSession(null);
|
|
5853
|
-
const transformToolRef = (0,
|
|
5854
|
-
const transformControllerRef = (0,
|
|
6119
|
+
const transformToolRef = (0, import_react32.useRef)(null);
|
|
6120
|
+
const transformControllerRef = (0, import_react32.useRef)(controller);
|
|
5855
6121
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
5856
6122
|
transformToolRef.current?.cancel();
|
|
5857
|
-
transformToolRef.current = new
|
|
6123
|
+
transformToolRef.current = new import_image_editor21.FreeTransformTool(controller, {
|
|
5858
6124
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
5859
6125
|
});
|
|
5860
6126
|
transformControllerRef.current = controller;
|
|
5861
6127
|
}
|
|
5862
6128
|
const transformTool = transformToolRef.current;
|
|
5863
|
-
const [, setTransformTick] = (0,
|
|
5864
|
-
(0,
|
|
5865
|
-
(0,
|
|
5866
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
5867
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
5868
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
5869
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
5870
|
-
const [aiError, setAiError] = (0,
|
|
5871
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
5872
|
-
const [aiTarget, setAiTarget] = (0,
|
|
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");
|
|
5873
6139
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
5874
6140
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
5875
6141
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5932,11 +6198,11 @@ var ImageEditor = ({
|
|
|
5932
6198
|
setIsInpainting(false);
|
|
5933
6199
|
}
|
|
5934
6200
|
};
|
|
5935
|
-
const [activeColor, setActiveColor] = (0,
|
|
5936
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5937
|
-
const [fontSize, setFontSize] = (0,
|
|
5938
|
-
const [textInput, setTextInput] = (0,
|
|
5939
|
-
(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)(() => {
|
|
5940
6206
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5941
6207
|
editor.setTool("crop");
|
|
5942
6208
|
}
|
|
@@ -5964,16 +6230,16 @@ var ImageEditor = ({
|
|
|
5964
6230
|
link.click();
|
|
5965
6231
|
}
|
|
5966
6232
|
};
|
|
5967
|
-
return /* @__PURE__ */ (0,
|
|
6233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5968
6234
|
"div",
|
|
5969
6235
|
{
|
|
5970
6236
|
ref: rootRef,
|
|
5971
6237
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5972
6238
|
style,
|
|
5973
6239
|
children: [
|
|
5974
|
-
/* @__PURE__ */ (0,
|
|
5975
|
-
/* @__PURE__ */ (0,
|
|
5976
|
-
/* @__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)(
|
|
5977
6243
|
"button",
|
|
5978
6244
|
{
|
|
5979
6245
|
type: "button",
|
|
@@ -5988,7 +6254,7 @@ var ImageEditor = ({
|
|
|
5988
6254
|
children: "Transform & Crop"
|
|
5989
6255
|
}
|
|
5990
6256
|
),
|
|
5991
|
-
/* @__PURE__ */ (0,
|
|
6257
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5992
6258
|
"button",
|
|
5993
6259
|
{
|
|
5994
6260
|
type: "button",
|
|
@@ -6003,7 +6269,7 @@ var ImageEditor = ({
|
|
|
6003
6269
|
children: "Adjustments"
|
|
6004
6270
|
}
|
|
6005
6271
|
),
|
|
6006
|
-
/* @__PURE__ */ (0,
|
|
6272
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6007
6273
|
"button",
|
|
6008
6274
|
{
|
|
6009
6275
|
type: "button",
|
|
@@ -6018,7 +6284,7 @@ var ImageEditor = ({
|
|
|
6018
6284
|
children: "Layers"
|
|
6019
6285
|
}
|
|
6020
6286
|
),
|
|
6021
|
-
/* @__PURE__ */ (0,
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6022
6288
|
"button",
|
|
6023
6289
|
{
|
|
6024
6290
|
type: "button",
|
|
@@ -6033,7 +6299,7 @@ var ImageEditor = ({
|
|
|
6033
6299
|
children: "Paint"
|
|
6034
6300
|
}
|
|
6035
6301
|
),
|
|
6036
|
-
/* @__PURE__ */ (0,
|
|
6302
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6037
6303
|
"button",
|
|
6038
6304
|
{
|
|
6039
6305
|
type: "button",
|
|
@@ -6048,7 +6314,7 @@ var ImageEditor = ({
|
|
|
6048
6314
|
children: "Select & Mask"
|
|
6049
6315
|
}
|
|
6050
6316
|
),
|
|
6051
|
-
/* @__PURE__ */ (0,
|
|
6317
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6052
6318
|
"button",
|
|
6053
6319
|
{
|
|
6054
6320
|
type: "button",
|
|
@@ -6063,7 +6329,7 @@ var ImageEditor = ({
|
|
|
6063
6329
|
children: "Annotations"
|
|
6064
6330
|
}
|
|
6065
6331
|
),
|
|
6066
|
-
/* @__PURE__ */ (0,
|
|
6332
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6067
6333
|
"button",
|
|
6068
6334
|
{
|
|
6069
6335
|
type: "button",
|
|
@@ -6078,7 +6344,7 @@ var ImageEditor = ({
|
|
|
6078
6344
|
children: "Depth Mask"
|
|
6079
6345
|
}
|
|
6080
6346
|
),
|
|
6081
|
-
/* @__PURE__ */ (0,
|
|
6347
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6082
6348
|
"button",
|
|
6083
6349
|
{
|
|
6084
6350
|
type: "button",
|
|
@@ -6091,14 +6357,14 @@ var ImageEditor = ({
|
|
|
6091
6357
|
"aria-selected": activeTab === "ai",
|
|
6092
6358
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
6093
6359
|
children: [
|
|
6094
|
-
/* @__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" }) }),
|
|
6095
6361
|
"AI Tools"
|
|
6096
6362
|
]
|
|
6097
6363
|
}
|
|
6098
6364
|
)
|
|
6099
6365
|
] }),
|
|
6100
|
-
/* @__PURE__ */ (0,
|
|
6101
|
-
/* @__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)(
|
|
6102
6368
|
"button",
|
|
6103
6369
|
{
|
|
6104
6370
|
type: "button",
|
|
@@ -6109,7 +6375,7 @@ var ImageEditor = ({
|
|
|
6109
6375
|
children: "\u21A9"
|
|
6110
6376
|
}
|
|
6111
6377
|
),
|
|
6112
|
-
/* @__PURE__ */ (0,
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6113
6379
|
"button",
|
|
6114
6380
|
{
|
|
6115
6381
|
type: "button",
|
|
@@ -6120,7 +6386,7 @@ var ImageEditor = ({
|
|
|
6120
6386
|
children: "\u21AA"
|
|
6121
6387
|
}
|
|
6122
6388
|
),
|
|
6123
|
-
/* @__PURE__ */ (0,
|
|
6389
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6124
6390
|
"button",
|
|
6125
6391
|
{
|
|
6126
6392
|
type: "button",
|
|
@@ -6129,8 +6395,8 @@ var ImageEditor = ({
|
|
|
6129
6395
|
children: "Reset"
|
|
6130
6396
|
}
|
|
6131
6397
|
),
|
|
6132
|
-
/* @__PURE__ */ (0,
|
|
6133
|
-
/* @__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)(
|
|
6134
6400
|
"button",
|
|
6135
6401
|
{
|
|
6136
6402
|
type: "button",
|
|
@@ -6140,11 +6406,11 @@ var ImageEditor = ({
|
|
|
6140
6406
|
children: "-"
|
|
6141
6407
|
}
|
|
6142
6408
|
),
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6409
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
6144
6410
|
Math.round(state.zoom * 100),
|
|
6145
6411
|
"%"
|
|
6146
6412
|
] }),
|
|
6147
|
-
/* @__PURE__ */ (0,
|
|
6413
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6148
6414
|
"button",
|
|
6149
6415
|
{
|
|
6150
6416
|
type: "button",
|
|
@@ -6154,8 +6420,8 @@ var ImageEditor = ({
|
|
|
6154
6420
|
children: "+"
|
|
6155
6421
|
}
|
|
6156
6422
|
),
|
|
6157
|
-
/* @__PURE__ */ (0,
|
|
6158
|
-
/* @__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)(
|
|
6159
6425
|
"button",
|
|
6160
6426
|
{
|
|
6161
6427
|
type: "button",
|
|
@@ -6166,7 +6432,7 @@ var ImageEditor = ({
|
|
|
6166
6432
|
children: "Hold Compare"
|
|
6167
6433
|
}
|
|
6168
6434
|
),
|
|
6169
|
-
/* @__PURE__ */ (0,
|
|
6435
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6170
6436
|
"button",
|
|
6171
6437
|
{
|
|
6172
6438
|
type: "button",
|
|
@@ -6177,10 +6443,10 @@ var ImageEditor = ({
|
|
|
6177
6443
|
)
|
|
6178
6444
|
] })
|
|
6179
6445
|
] }),
|
|
6180
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
6181
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
6182
|
-
/* @__PURE__ */ (0,
|
|
6183
|
-
/* @__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)(
|
|
6184
6450
|
ImageEditorCanvas,
|
|
6185
6451
|
{
|
|
6186
6452
|
editor,
|
|
@@ -6204,11 +6470,11 @@ var ImageEditor = ({
|
|
|
6204
6470
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
6205
6471
|
}
|
|
6206
6472
|
),
|
|
6207
|
-
/* @__PURE__ */ (0,
|
|
6208
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6211
|
-
/* @__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)(
|
|
6212
6478
|
"button",
|
|
6213
6479
|
{
|
|
6214
6480
|
type: "button",
|
|
@@ -6220,7 +6486,7 @@ var ImageEditor = ({
|
|
|
6220
6486
|
children: "Freeform"
|
|
6221
6487
|
}
|
|
6222
6488
|
),
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6489
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6224
6490
|
"button",
|
|
6225
6491
|
{
|
|
6226
6492
|
type: "button",
|
|
@@ -6232,7 +6498,7 @@ var ImageEditor = ({
|
|
|
6232
6498
|
children: "1:1 Square"
|
|
6233
6499
|
}
|
|
6234
6500
|
),
|
|
6235
|
-
/* @__PURE__ */ (0,
|
|
6501
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6236
6502
|
"button",
|
|
6237
6503
|
{
|
|
6238
6504
|
type: "button",
|
|
@@ -6244,7 +6510,7 @@ var ImageEditor = ({
|
|
|
6244
6510
|
children: "4:3 Standard"
|
|
6245
6511
|
}
|
|
6246
6512
|
),
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6513
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6248
6514
|
"button",
|
|
6249
6515
|
{
|
|
6250
6516
|
type: "button",
|
|
@@ -6256,7 +6522,7 @@ var ImageEditor = ({
|
|
|
6256
6522
|
children: "16:9 Wide"
|
|
6257
6523
|
}
|
|
6258
6524
|
),
|
|
6259
|
-
/* @__PURE__ */ (0,
|
|
6525
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6260
6526
|
"button",
|
|
6261
6527
|
{
|
|
6262
6528
|
type: "button",
|
|
@@ -6268,7 +6534,7 @@ var ImageEditor = ({
|
|
|
6268
6534
|
children: "3:2 Photo"
|
|
6269
6535
|
}
|
|
6270
6536
|
),
|
|
6271
|
-
/* @__PURE__ */ (0,
|
|
6537
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6272
6538
|
"button",
|
|
6273
6539
|
{
|
|
6274
6540
|
type: "button",
|
|
@@ -6281,10 +6547,10 @@ var ImageEditor = ({
|
|
|
6281
6547
|
}
|
|
6282
6548
|
)
|
|
6283
6549
|
] }),
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6285
|
-
/* @__PURE__ */ (0,
|
|
6286
|
-
/* @__PURE__ */ (0,
|
|
6287
|
-
/* @__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)(
|
|
6288
6554
|
"button",
|
|
6289
6555
|
{
|
|
6290
6556
|
type: "button",
|
|
@@ -6293,7 +6559,7 @@ var ImageEditor = ({
|
|
|
6293
6559
|
children: "Rotate -90\xB0"
|
|
6294
6560
|
}
|
|
6295
6561
|
),
|
|
6296
|
-
/* @__PURE__ */ (0,
|
|
6562
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6297
6563
|
"button",
|
|
6298
6564
|
{
|
|
6299
6565
|
type: "button",
|
|
@@ -6302,7 +6568,7 @@ var ImageEditor = ({
|
|
|
6302
6568
|
children: "Rotate +90\xB0"
|
|
6303
6569
|
}
|
|
6304
6570
|
),
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6306
6572
|
"button",
|
|
6307
6573
|
{
|
|
6308
6574
|
type: "button",
|
|
@@ -6311,7 +6577,7 @@ var ImageEditor = ({
|
|
|
6311
6577
|
children: "Flip Horizontal"
|
|
6312
6578
|
}
|
|
6313
6579
|
),
|
|
6314
|
-
/* @__PURE__ */ (0,
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6315
6581
|
"button",
|
|
6316
6582
|
{
|
|
6317
6583
|
type: "button",
|
|
@@ -6322,10 +6588,10 @@ var ImageEditor = ({
|
|
|
6322
6588
|
)
|
|
6323
6589
|
] })
|
|
6324
6590
|
] }),
|
|
6325
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
6326
|
-
/* @__PURE__ */ (0,
|
|
6327
|
-
/* @__PURE__ */ (0,
|
|
6328
|
-
/* @__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)(
|
|
6329
6595
|
"button",
|
|
6330
6596
|
{
|
|
6331
6597
|
type: "button",
|
|
@@ -6335,25 +6601,25 @@ var ImageEditor = ({
|
|
|
6335
6601
|
}
|
|
6336
6602
|
)
|
|
6337
6603
|
] }),
|
|
6338
|
-
/* @__PURE__ */ (0,
|
|
6339
|
-
|
|
6340
|
-
/* @__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)(
|
|
6341
6607
|
ControlSlider,
|
|
6342
6608
|
{
|
|
6343
6609
|
spec,
|
|
6344
|
-
value: (0,
|
|
6610
|
+
value: (0, import_image_editor21.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
6345
6611
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
6346
6612
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
6347
6613
|
}
|
|
6348
6614
|
),
|
|
6349
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6615
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6350
6616
|
"div",
|
|
6351
6617
|
{
|
|
6352
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",
|
|
6353
6619
|
"data-testid": "image-editor-process-notice",
|
|
6354
6620
|
children: [
|
|
6355
|
-
/* @__PURE__ */ (0,
|
|
6356
|
-
/* @__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)(
|
|
6357
6623
|
"button",
|
|
6358
6624
|
{
|
|
6359
6625
|
type: "button",
|
|
@@ -6366,7 +6632,7 @@ var ImageEditor = ({
|
|
|
6366
6632
|
}
|
|
6367
6633
|
)
|
|
6368
6634
|
] }, spec.id)),
|
|
6369
|
-
/* @__PURE__ */ (0,
|
|
6635
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6370
6636
|
AdjustmentLayersPanel,
|
|
6371
6637
|
{
|
|
6372
6638
|
controller,
|
|
@@ -6375,9 +6641,9 @@ var ImageEditor = ({
|
|
|
6375
6641
|
}
|
|
6376
6642
|
) })
|
|
6377
6643
|
] }),
|
|
6378
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
6379
|
-
/* @__PURE__ */ (0,
|
|
6380
|
-
/* @__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)(
|
|
6381
6647
|
"button",
|
|
6382
6648
|
{
|
|
6383
6649
|
type: "button",
|
|
@@ -6388,15 +6654,15 @@ var ImageEditor = ({
|
|
|
6388
6654
|
children: "Free Transform"
|
|
6389
6655
|
}
|
|
6390
6656
|
),
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
6392
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6394
|
-
/* @__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 })
|
|
6395
6661
|
] }),
|
|
6396
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
6397
|
-
/* @__PURE__ */ (0,
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
6399
|
-
/* @__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)(
|
|
6400
6666
|
"button",
|
|
6401
6667
|
{
|
|
6402
6668
|
type: "button",
|
|
@@ -6407,12 +6673,12 @@ var ImageEditor = ({
|
|
|
6407
6673
|
children: "Free Transform"
|
|
6408
6674
|
}
|
|
6409
6675
|
),
|
|
6410
|
-
paintError && /* @__PURE__ */ (0,
|
|
6411
|
-
/* @__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 }) })
|
|
6412
6678
|
] }),
|
|
6413
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
6414
|
-
/* @__PURE__ */ (0,
|
|
6415
|
-
/* @__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)(
|
|
6416
6682
|
"button",
|
|
6417
6683
|
{
|
|
6418
6684
|
type: "button",
|
|
@@ -6423,13 +6689,13 @@ var ImageEditor = ({
|
|
|
6423
6689
|
},
|
|
6424
6690
|
t
|
|
6425
6691
|
)) }),
|
|
6426
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
6427
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
6428
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
6429
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
6430
|
-
/* @__PURE__ */ (0,
|
|
6431
|
-
/* @__PURE__ */ (0,
|
|
6432
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
6433
6699
|
"button",
|
|
6434
6700
|
{
|
|
6435
6701
|
type: "button",
|
|
@@ -6439,18 +6705,18 @@ var ImageEditor = ({
|
|
|
6439
6705
|
},
|
|
6440
6706
|
t
|
|
6441
6707
|
)) }),
|
|
6442
|
-
/* @__PURE__ */ (0,
|
|
6443
|
-
/* @__PURE__ */ (0,
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6446
|
-
/* @__PURE__ */ (0,
|
|
6447
|
-
/* @__PURE__ */ (0,
|
|
6448
|
-
/* @__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: [
|
|
6449
6715
|
strokeWidth,
|
|
6450
6716
|
"px"
|
|
6451
6717
|
] })
|
|
6452
6718
|
] }),
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6719
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6454
6720
|
"input",
|
|
6455
6721
|
{
|
|
6456
6722
|
type: "range",
|
|
@@ -6463,10 +6729,10 @@ var ImageEditor = ({
|
|
|
6463
6729
|
)
|
|
6464
6730
|
] })
|
|
6465
6731
|
] }),
|
|
6466
|
-
/* @__PURE__ */ (0,
|
|
6467
|
-
/* @__PURE__ */ (0,
|
|
6468
|
-
/* @__PURE__ */ (0,
|
|
6469
|
-
/* @__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)(
|
|
6470
6736
|
"input",
|
|
6471
6737
|
{
|
|
6472
6738
|
type: "text",
|
|
@@ -6477,7 +6743,7 @@ var ImageEditor = ({
|
|
|
6477
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"
|
|
6478
6744
|
}
|
|
6479
6745
|
),
|
|
6480
|
-
/* @__PURE__ */ (0,
|
|
6746
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6481
6747
|
"button",
|
|
6482
6748
|
{
|
|
6483
6749
|
type: "button",
|
|
@@ -6487,14 +6753,14 @@ var ImageEditor = ({
|
|
|
6487
6753
|
}
|
|
6488
6754
|
)
|
|
6489
6755
|
] }),
|
|
6490
|
-
/* @__PURE__ */ (0,
|
|
6491
|
-
/* @__PURE__ */ (0,
|
|
6492
|
-
/* @__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: [
|
|
6493
6759
|
fontSize,
|
|
6494
6760
|
"px"
|
|
6495
6761
|
] })
|
|
6496
6762
|
] }),
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6763
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6498
6764
|
"input",
|
|
6499
6765
|
{
|
|
6500
6766
|
type: "range",
|
|
@@ -6505,14 +6771,14 @@ var ImageEditor = ({
|
|
|
6505
6771
|
className: imageRangeClass
|
|
6506
6772
|
}
|
|
6507
6773
|
),
|
|
6508
|
-
/* @__PURE__ */ (0,
|
|
6509
|
-
/* @__PURE__ */ (0,
|
|
6510
|
-
/* @__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: [
|
|
6511
6777
|
"Layers (",
|
|
6512
6778
|
state.annotations.length,
|
|
6513
6779
|
")"
|
|
6514
6780
|
] }),
|
|
6515
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
6781
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6516
6782
|
"button",
|
|
6517
6783
|
{
|
|
6518
6784
|
type: "button",
|
|
@@ -6521,7 +6787,7 @@ var ImageEditor = ({
|
|
|
6521
6787
|
children: "Delete Selected"
|
|
6522
6788
|
}
|
|
6523
6789
|
),
|
|
6524
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
6790
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6525
6791
|
"button",
|
|
6526
6792
|
{
|
|
6527
6793
|
type: "button",
|
|
@@ -6532,10 +6798,10 @@ var ImageEditor = ({
|
|
|
6532
6798
|
)
|
|
6533
6799
|
] })
|
|
6534
6800
|
] }),
|
|
6535
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6537
|
-
/* @__PURE__ */ (0,
|
|
6538
|
-
/* @__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)(
|
|
6539
6805
|
"button",
|
|
6540
6806
|
{
|
|
6541
6807
|
type: "button",
|
|
@@ -6545,8 +6811,8 @@ var ImageEditor = ({
|
|
|
6545
6811
|
}
|
|
6546
6812
|
)
|
|
6547
6813
|
] }),
|
|
6548
|
-
/* @__PURE__ */ (0,
|
|
6549
|
-
/* @__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)(
|
|
6550
6816
|
"input",
|
|
6551
6817
|
{
|
|
6552
6818
|
type: "checkbox",
|
|
@@ -6555,12 +6821,12 @@ var ImageEditor = ({
|
|
|
6555
6821
|
className: "rounded accent-primary"
|
|
6556
6822
|
}
|
|
6557
6823
|
),
|
|
6558
|
-
/* @__PURE__ */ (0,
|
|
6824
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
6559
6825
|
] }),
|
|
6560
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
6561
|
-
/* @__PURE__ */ (0,
|
|
6562
|
-
/* @__PURE__ */ (0,
|
|
6563
|
-
/* @__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)(
|
|
6564
6830
|
"input",
|
|
6565
6831
|
{
|
|
6566
6832
|
type: "text",
|
|
@@ -6571,8 +6837,8 @@ var ImageEditor = ({
|
|
|
6571
6837
|
}
|
|
6572
6838
|
)
|
|
6573
6839
|
] }),
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
6575
|
-
/* @__PURE__ */ (0,
|
|
6840
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
|
|
6841
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6576
6842
|
"button",
|
|
6577
6843
|
{
|
|
6578
6844
|
type: "button",
|
|
@@ -6581,7 +6847,7 @@ var ImageEditor = ({
|
|
|
6581
6847
|
children: "Threshold Mode"
|
|
6582
6848
|
}
|
|
6583
6849
|
),
|
|
6584
|
-
/* @__PURE__ */ (0,
|
|
6850
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6585
6851
|
"button",
|
|
6586
6852
|
{
|
|
6587
6853
|
type: "button",
|
|
@@ -6591,12 +6857,12 @@ var ImageEditor = ({
|
|
|
6591
6857
|
}
|
|
6592
6858
|
)
|
|
6593
6859
|
] }),
|
|
6594
|
-
/* @__PURE__ */ (0,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
/* @__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] })
|
|
6598
6864
|
] }),
|
|
6599
|
-
/* @__PURE__ */ (0,
|
|
6865
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6600
6866
|
"input",
|
|
6601
6867
|
{
|
|
6602
6868
|
type: "range",
|
|
@@ -6610,12 +6876,12 @@ var ImageEditor = ({
|
|
|
6610
6876
|
}
|
|
6611
6877
|
)
|
|
6612
6878
|
] }),
|
|
6613
|
-
/* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6616
|
-
/* @__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] })
|
|
6617
6883
|
] }),
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6884
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6619
6885
|
"input",
|
|
6620
6886
|
{
|
|
6621
6887
|
type: "range",
|
|
@@ -6629,12 +6895,12 @@ var ImageEditor = ({
|
|
|
6629
6895
|
}
|
|
6630
6896
|
)
|
|
6631
6897
|
] }),
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6635
|
-
/* @__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 })
|
|
6636
6902
|
] }),
|
|
6637
|
-
/* @__PURE__ */ (0,
|
|
6903
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6638
6904
|
"input",
|
|
6639
6905
|
{
|
|
6640
6906
|
type: "range",
|
|
@@ -6646,8 +6912,8 @@ var ImageEditor = ({
|
|
|
6646
6912
|
}
|
|
6647
6913
|
)
|
|
6648
6914
|
] }),
|
|
6649
|
-
/* @__PURE__ */ (0,
|
|
6650
|
-
/* @__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)(
|
|
6651
6917
|
"input",
|
|
6652
6918
|
{
|
|
6653
6919
|
type: "checkbox",
|
|
@@ -6656,12 +6922,12 @@ var ImageEditor = ({
|
|
|
6656
6922
|
className: "rounded accent-primary"
|
|
6657
6923
|
}
|
|
6658
6924
|
),
|
|
6659
|
-
/* @__PURE__ */ (0,
|
|
6925
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Invert Mask" })
|
|
6660
6926
|
] })
|
|
6661
6927
|
] })
|
|
6662
6928
|
] }),
|
|
6663
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
6664
|
-
/* @__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)(
|
|
6665
6931
|
SelectionOptionsBar,
|
|
6666
6932
|
{
|
|
6667
6933
|
controller,
|
|
@@ -6672,9 +6938,9 @@ var ImageEditor = ({
|
|
|
6672
6938
|
selectionDisplay: state.selectionDisplay
|
|
6673
6939
|
}
|
|
6674
6940
|
),
|
|
6675
|
-
selectionError && /* @__PURE__ */ (0,
|
|
6676
|
-
/* @__PURE__ */ (0,
|
|
6677
|
-
/* @__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)(
|
|
6678
6944
|
"button",
|
|
6679
6945
|
{
|
|
6680
6946
|
type: "button",
|
|
@@ -6685,7 +6951,7 @@ var ImageEditor = ({
|
|
|
6685
6951
|
children: "Transform Selection"
|
|
6686
6952
|
}
|
|
6687
6953
|
),
|
|
6688
|
-
/* @__PURE__ */ (0,
|
|
6954
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6689
6955
|
"button",
|
|
6690
6956
|
{
|
|
6691
6957
|
type: "button",
|
|
@@ -6697,13 +6963,13 @@ var ImageEditor = ({
|
|
|
6697
6963
|
}
|
|
6698
6964
|
)
|
|
6699
6965
|
] }),
|
|
6700
|
-
/* @__PURE__ */ (0,
|
|
6701
|
-
/* @__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 })
|
|
6702
6968
|
] }),
|
|
6703
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
6705
|
-
/* @__PURE__ */ (0,
|
|
6706
|
-
/* @__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)(
|
|
6707
6973
|
"select",
|
|
6708
6974
|
{
|
|
6709
6975
|
"aria-label": "AI result target",
|
|
@@ -6711,54 +6977,54 @@ var ImageEditor = ({
|
|
|
6711
6977
|
onChange: (e) => setAiTarget(e.target.value),
|
|
6712
6978
|
className: imageSelectClass,
|
|
6713
6979
|
children: [
|
|
6714
|
-
/* @__PURE__ */ (0,
|
|
6715
|
-
/* @__PURE__ */ (0,
|
|
6716
|
-
/* @__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" })
|
|
6717
6983
|
]
|
|
6718
6984
|
}
|
|
6719
6985
|
)
|
|
6720
6986
|
] }),
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
6723
|
-
/* @__PURE__ */ (0,
|
|
6724
|
-
/* @__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" }) }),
|
|
6725
6991
|
"Background Removal"
|
|
6726
6992
|
] }),
|
|
6727
|
-
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..." })
|
|
6728
6994
|
] }),
|
|
6729
|
-
/* @__PURE__ */ (0,
|
|
6730
|
-
/* @__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)(
|
|
6731
6997
|
"button",
|
|
6732
6998
|
{
|
|
6733
6999
|
type: "button",
|
|
6734
7000
|
onClick: handleRemoveBackground,
|
|
6735
7001
|
disabled: isRemovingBg || isInpainting,
|
|
6736
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",
|
|
6737
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
6738
|
-
/* @__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 }),
|
|
6739
7005
|
"Removing Background..."
|
|
6740
|
-
] }) : /* @__PURE__ */ (0,
|
|
6741
|
-
/* @__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" }) }),
|
|
6742
7008
|
"Remove Background"
|
|
6743
7009
|
] })
|
|
6744
7010
|
}
|
|
6745
7011
|
)
|
|
6746
7012
|
] }),
|
|
6747
|
-
/* @__PURE__ */ (0,
|
|
6748
|
-
/* @__PURE__ */ (0,
|
|
6749
|
-
/* @__PURE__ */ (0,
|
|
6750
|
-
/* @__PURE__ */ (0,
|
|
6751
|
-
/* @__PURE__ */ (0,
|
|
6752
|
-
/* @__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" })
|
|
6753
7019
|
] }),
|
|
6754
7020
|
"Generative Inpainting"
|
|
6755
7021
|
] }),
|
|
6756
|
-
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..." })
|
|
6757
7023
|
] }),
|
|
6758
|
-
/* @__PURE__ */ (0,
|
|
6759
|
-
/* @__PURE__ */ (0,
|
|
6760
|
-
/* @__PURE__ */ (0,
|
|
6761
|
-
/* @__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)(
|
|
6762
7028
|
"textarea",
|
|
6763
7029
|
{
|
|
6764
7030
|
id: "ai-inpaint-prompt-react",
|
|
@@ -6770,10 +7036,10 @@ var ImageEditor = ({
|
|
|
6770
7036
|
}
|
|
6771
7037
|
)
|
|
6772
7038
|
] }),
|
|
6773
|
-
/* @__PURE__ */ (0,
|
|
6774
|
-
/* @__PURE__ */ (0,
|
|
6775
|
-
/* @__PURE__ */ (0,
|
|
6776
|
-
/* @__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)(
|
|
6777
7043
|
"button",
|
|
6778
7044
|
{
|
|
6779
7045
|
type: "button",
|
|
@@ -6786,7 +7052,7 @@ var ImageEditor = ({
|
|
|
6786
7052
|
]
|
|
6787
7053
|
}
|
|
6788
7054
|
),
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
7055
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6790
7056
|
"button",
|
|
6791
7057
|
{
|
|
6792
7058
|
type: "button",
|
|
@@ -6801,25 +7067,25 @@ var ImageEditor = ({
|
|
|
6801
7067
|
)
|
|
6802
7068
|
] })
|
|
6803
7069
|
] }),
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
7070
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6805
7071
|
"button",
|
|
6806
7072
|
{
|
|
6807
7073
|
type: "button",
|
|
6808
7074
|
onClick: handleInpaint,
|
|
6809
7075
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
6810
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",
|
|
6811
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
6812
|
-
/* @__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 }),
|
|
6813
7079
|
"Generating Inpaint..."
|
|
6814
|
-
] }) : /* @__PURE__ */ (0,
|
|
6815
|
-
/* @__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" }) }),
|
|
6816
7082
|
"Apply Inpainting"
|
|
6817
7083
|
] })
|
|
6818
7084
|
}
|
|
6819
7085
|
)
|
|
6820
7086
|
] }),
|
|
6821
|
-
aiError && /* @__PURE__ */ (0,
|
|
6822
|
-
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 })
|
|
6823
7089
|
] })
|
|
6824
7090
|
] })
|
|
6825
7091
|
] })
|
|
@@ -6850,6 +7116,7 @@ var ImageEditor = ({
|
|
|
6850
7116
|
LayersPanel,
|
|
6851
7117
|
PaintGradientEditor,
|
|
6852
7118
|
RefineEdgePanel,
|
|
7119
|
+
SelectAndMaskWorkspace,
|
|
6853
7120
|
SelectionOptionsBar,
|
|
6854
7121
|
ShapeOptionsBar,
|
|
6855
7122
|
TypeOptionsBar,
|