@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
|
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
// src/image-editor/ImageEditor.tsx
|
|
193
|
-
import
|
|
193
|
+
import React17, { useRef as useRef9, useEffect as useEffect15, useState as useState18 } from "react";
|
|
194
194
|
import {
|
|
195
195
|
normalizeProcessVersion,
|
|
196
196
|
LATEST_PROCESS_VERSION,
|
|
@@ -2663,7 +2663,7 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2663
2663
|
};
|
|
2664
2664
|
|
|
2665
2665
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
2666
|
-
import { useState as
|
|
2666
|
+
import { useState as useState12 } from "react";
|
|
2667
2667
|
import {
|
|
2668
2668
|
COLOR_RANGE_PRESETS,
|
|
2669
2669
|
COLOR_RANGE_PRESET_LABELS,
|
|
@@ -2672,7 +2672,269 @@ import {
|
|
|
2672
2672
|
SELECTION_TOOLS,
|
|
2673
2673
|
describeSelection
|
|
2674
2674
|
} from "@pixerate/editor/image-editor";
|
|
2675
|
+
|
|
2676
|
+
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
2677
|
+
import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef7, useState as useState11 } from "react";
|
|
2678
|
+
import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
|
|
2675
2679
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2680
|
+
var button = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
2681
|
+
var toggle = (on) => `${button} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
2682
|
+
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
2683
|
+
const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
|
|
2684
|
+
const [, setRevision] = useState11(0);
|
|
2685
|
+
const [zoom, setZoom] = useState11(1);
|
|
2686
|
+
const [pan, setPan] = useState11({ x: 0, y: 0 });
|
|
2687
|
+
const [busy, setBusy] = useState11(false);
|
|
2688
|
+
const [error, setError] = useState11(null);
|
|
2689
|
+
const canvasRef = useRef7(null);
|
|
2690
|
+
const panFrom = useRef7(null);
|
|
2691
|
+
const settings = session.settings;
|
|
2692
|
+
const size = session.previewSize;
|
|
2693
|
+
useEffect10(() => {
|
|
2694
|
+
const off = session.subscribe(() => setRevision(session.revision));
|
|
2695
|
+
void session.open();
|
|
2696
|
+
return () => {
|
|
2697
|
+
off();
|
|
2698
|
+
};
|
|
2699
|
+
}, [session]);
|
|
2700
|
+
useEffect10(() => {
|
|
2701
|
+
const canvas = canvasRef.current;
|
|
2702
|
+
const ctx = canvas?.getContext?.("2d");
|
|
2703
|
+
if (!canvas || !ctx || !size.width || typeof ImageData === "undefined") return;
|
|
2704
|
+
canvas.width = size.width;
|
|
2705
|
+
canvas.height = size.height;
|
|
2706
|
+
ctx.putImageData(new ImageData(session.render(), size.width, size.height), 0, 0);
|
|
2707
|
+
});
|
|
2708
|
+
const set = (changes) => session.update(changes);
|
|
2709
|
+
const ok = async () => {
|
|
2710
|
+
setBusy(true);
|
|
2711
|
+
setError(null);
|
|
2712
|
+
try {
|
|
2713
|
+
onClose(await session.commit());
|
|
2714
|
+
} catch (err) {
|
|
2715
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
2716
|
+
setBusy(false);
|
|
2717
|
+
}
|
|
2718
|
+
};
|
|
2719
|
+
useEffect10(() => {
|
|
2720
|
+
const onKey = (e) => {
|
|
2721
|
+
const t = e.target;
|
|
2722
|
+
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
2723
|
+
if (e.key === "Escape") onClose(null);
|
|
2724
|
+
else if (e.key === "Enter") void ok();
|
|
2725
|
+
else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") session.undoEdit();
|
|
2726
|
+
else if (e.ctrlKey || e.metaKey || e.altKey || !session.handleKey(e.key)) return;
|
|
2727
|
+
e.preventDefault();
|
|
2728
|
+
};
|
|
2729
|
+
window.addEventListener("keydown", onKey);
|
|
2730
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
2731
|
+
});
|
|
2732
|
+
const toImage = (e) => {
|
|
2733
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
2734
|
+
const naturalW = size.width / size.scale;
|
|
2735
|
+
const naturalH = size.height / size.scale;
|
|
2736
|
+
return { x: (e.clientX - rect.left) / Math.max(1, rect.width) * naturalW, y: (e.clientY - rect.top) / Math.max(1, rect.height) * naturalH };
|
|
2737
|
+
};
|
|
2738
|
+
const onDown = (e) => {
|
|
2739
|
+
if (settings.tool === "hand") {
|
|
2740
|
+
panFrom.current = { x: e.clientX, y: e.clientY, pan };
|
|
2741
|
+
return;
|
|
2742
|
+
}
|
|
2743
|
+
if (settings.tool === "zoom") {
|
|
2744
|
+
setZoom((z) => Math.min(16, Math.max(0.25, e.altKey ? z / 1.25 : z * 1.25)));
|
|
2745
|
+
return;
|
|
2746
|
+
}
|
|
2747
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
2748
|
+
session.begin(toImage(e), { altKey: e.altKey });
|
|
2749
|
+
};
|
|
2750
|
+
const onMove = (e) => {
|
|
2751
|
+
if (panFrom.current) {
|
|
2752
|
+
const p = panFrom.current;
|
|
2753
|
+
setPan({ x: p.pan.x + e.clientX - p.x, y: p.pan.y + e.clientY - p.y });
|
|
2754
|
+
return;
|
|
2755
|
+
}
|
|
2756
|
+
if (e.buttons) session.move(toImage(e));
|
|
2757
|
+
};
|
|
2758
|
+
const onUp = () => {
|
|
2759
|
+
panFrom.current = null;
|
|
2760
|
+
session.end();
|
|
2761
|
+
};
|
|
2762
|
+
const toLayer = settings.output === "new-layer" || settings.output === "new-layer-with-mask";
|
|
2763
|
+
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
2764
|
+
return /* @__PURE__ */ jsxs13(
|
|
2765
|
+
"div",
|
|
2766
|
+
{
|
|
2767
|
+
"data-testid": "select-and-mask-workspace",
|
|
2768
|
+
role: "dialog",
|
|
2769
|
+
"aria-label": "Select and Mask",
|
|
2770
|
+
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
2771
|
+
children: [
|
|
2772
|
+
/* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx15("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)) }),
|
|
2773
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
2774
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
2775
|
+
brushTool && /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2776
|
+
"Size",
|
|
2777
|
+
/* @__PURE__ */ jsx15(
|
|
2778
|
+
"input",
|
|
2779
|
+
{
|
|
2780
|
+
type: "number",
|
|
2781
|
+
min: 1,
|
|
2782
|
+
"aria-label": "Brush size",
|
|
2783
|
+
value: settings.brushSize,
|
|
2784
|
+
onChange: (e) => set({ brushSize: Math.max(1, Number(e.target.value) || 1) }),
|
|
2785
|
+
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
2786
|
+
}
|
|
2787
|
+
),
|
|
2788
|
+
"px"
|
|
2789
|
+
] }),
|
|
2790
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs13("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
2791
|
+
/* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
2792
|
+
/* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
2793
|
+
] }),
|
|
2794
|
+
/* @__PURE__ */ jsxs13("span", { className: "text-muted-foreground", children: [
|
|
2795
|
+
session.edits.length,
|
|
2796
|
+
" strokes"
|
|
2797
|
+
] }),
|
|
2798
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
2799
|
+
/* @__PURE__ */ jsxs13("span", { className: "font-mono text-muted-foreground", children: [
|
|
2800
|
+
Math.round(zoom * 100),
|
|
2801
|
+
"%"
|
|
2802
|
+
] })
|
|
2803
|
+
] }),
|
|
2804
|
+
/* @__PURE__ */ jsx15("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx15(
|
|
2805
|
+
"canvas",
|
|
2806
|
+
{
|
|
2807
|
+
ref: canvasRef,
|
|
2808
|
+
"data-testid": "select-and-mask-preview",
|
|
2809
|
+
onPointerDown: onDown,
|
|
2810
|
+
onPointerMove: onMove,
|
|
2811
|
+
onPointerUp: onUp,
|
|
2812
|
+
style: {
|
|
2813
|
+
// Fitted to the area at its own aspect ratio; zoom and pan are a transform.
|
|
2814
|
+
maxWidth: "100%",
|
|
2815
|
+
maxHeight: "100%",
|
|
2816
|
+
transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`,
|
|
2817
|
+
imageRendering: zoom > 2 ? "pixelated" : void 0,
|
|
2818
|
+
cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair"
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
) })
|
|
2822
|
+
] }),
|
|
2823
|
+
/* @__PURE__ */ jsxs13("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
2824
|
+
/* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
2825
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2826
|
+
"View",
|
|
2827
|
+
/* @__PURE__ */ jsx15(
|
|
2828
|
+
ImageSelect,
|
|
2829
|
+
{
|
|
2830
|
+
label: "View",
|
|
2831
|
+
value: settings.view,
|
|
2832
|
+
options: SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
|
|
2833
|
+
onChange: (v) => set({ view: v })
|
|
2834
|
+
}
|
|
2835
|
+
)
|
|
2836
|
+
] }),
|
|
2837
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2838
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2839
|
+
/* @__PURE__ */ jsx15("span", { children: "Opacity" }),
|
|
2840
|
+
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2841
|
+
Math.round(settings.opacity * 100),
|
|
2842
|
+
"%"
|
|
2843
|
+
] })
|
|
2844
|
+
] }),
|
|
2845
|
+
/* @__PURE__ */ jsx15(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
2846
|
+
] }),
|
|
2847
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2848
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
2849
|
+
"Show Edge (J)"
|
|
2850
|
+
] }),
|
|
2851
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2852
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
2853
|
+
"Show Original (P)"
|
|
2854
|
+
] }),
|
|
2855
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2856
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
2857
|
+
"Real-Time Refinement"
|
|
2858
|
+
] }),
|
|
2859
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2860
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
2861
|
+
"High Quality Preview"
|
|
2862
|
+
] }),
|
|
2863
|
+
/* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
2864
|
+
controller.segmentationProvider && /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2865
|
+
"Mode",
|
|
2866
|
+
/* @__PURE__ */ jsx15(
|
|
2867
|
+
ImageSelect,
|
|
2868
|
+
{
|
|
2869
|
+
label: "Refine mode",
|
|
2870
|
+
value: settings.refineMode,
|
|
2871
|
+
options: [
|
|
2872
|
+
{ value: "color", label: "Color Aware" },
|
|
2873
|
+
{ value: "object", label: "Object Aware" }
|
|
2874
|
+
],
|
|
2875
|
+
onChange: (v) => set({ refineMode: v })
|
|
2876
|
+
}
|
|
2877
|
+
)
|
|
2878
|
+
] }),
|
|
2879
|
+
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2880
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2881
|
+
/* @__PURE__ */ jsx15("span", { children: c.label }),
|
|
2882
|
+
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2883
|
+
settings.params[c.id],
|
|
2884
|
+
c.unit
|
|
2885
|
+
] })
|
|
2886
|
+
] }),
|
|
2887
|
+
/* @__PURE__ */ jsx15(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 } }) })
|
|
2888
|
+
] }, c.id)),
|
|
2889
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2890
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
2891
|
+
"Smart Radius"
|
|
2892
|
+
] }),
|
|
2893
|
+
/* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
2894
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
2895
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2896
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2897
|
+
"Decontaminate Colors",
|
|
2898
|
+
toLayer ? "" : " (new layer outputs)"
|
|
2899
|
+
] }),
|
|
2900
|
+
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2901
|
+
settings.decontaminate,
|
|
2902
|
+
"%"
|
|
2903
|
+
] })
|
|
2904
|
+
] }),
|
|
2905
|
+
/* @__PURE__ */ jsx15(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
2906
|
+
] }),
|
|
2907
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2908
|
+
"Output To",
|
|
2909
|
+
/* @__PURE__ */ jsx15(
|
|
2910
|
+
ImageSelect,
|
|
2911
|
+
{
|
|
2912
|
+
label: "Output to",
|
|
2913
|
+
value: settings.output,
|
|
2914
|
+
options: REFINE_OUTPUTS.map((o) => ({ value: o.id, label: o.label })),
|
|
2915
|
+
onChange: (v) => set({ output: v })
|
|
2916
|
+
}
|
|
2917
|
+
)
|
|
2918
|
+
] }),
|
|
2919
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
|
|
2920
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
2921
|
+
"Remember Settings"
|
|
2922
|
+
] }),
|
|
2923
|
+
(error ?? session.error) && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
2924
|
+
session.note && /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: session.note }),
|
|
2925
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1 mt-auto", children: [
|
|
2926
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => session.reset(), children: "Reset" }),
|
|
2927
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => onClose(null), children: "Cancel" }),
|
|
2928
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
2929
|
+
] })
|
|
2930
|
+
] })
|
|
2931
|
+
]
|
|
2932
|
+
}
|
|
2933
|
+
);
|
|
2934
|
+
};
|
|
2935
|
+
|
|
2936
|
+
// src/image-editor/SelectionOptionsBar.tsx
|
|
2937
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2676
2938
|
var MODIFY_OPS = [
|
|
2677
2939
|
{ op: "expand", label: "Expand" },
|
|
2678
2940
|
{ op: "contract", label: "Contract" },
|
|
@@ -2696,15 +2958,15 @@ var SelectionOptionsBar = ({
|
|
|
2696
2958
|
selectionDisplay,
|
|
2697
2959
|
className = ""
|
|
2698
2960
|
}) => {
|
|
2699
|
-
const [radius, setRadius] =
|
|
2961
|
+
const [radius, setRadius] = useState12(2);
|
|
2700
2962
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
2701
2963
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2702
2964
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
2703
|
-
const [preset, setPreset] =
|
|
2704
|
-
const [rangeStatus, setRangeStatus] =
|
|
2705
|
-
const [colorStatus, setColorStatus] =
|
|
2706
|
-
const [strokeWidth, setStrokeWidth] =
|
|
2707
|
-
const [strokeLocation, setStrokeLocation] =
|
|
2965
|
+
const [preset, setPreset] = useState12("reds");
|
|
2966
|
+
const [rangeStatus, setRangeStatus] = useState12(null);
|
|
2967
|
+
const [colorStatus, setColorStatus] = useState12(null);
|
|
2968
|
+
const [strokeWidth, setStrokeWidth] = useState12(4);
|
|
2969
|
+
const [strokeLocation, setStrokeLocation] = useState12("outside");
|
|
2708
2970
|
const edit = (fn) => {
|
|
2709
2971
|
setColorStatus(null);
|
|
2710
2972
|
try {
|
|
@@ -2737,9 +2999,9 @@ var SelectionOptionsBar = ({
|
|
|
2737
2999
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
2738
3000
|
}
|
|
2739
3001
|
};
|
|
2740
|
-
const [subject, setSubject] =
|
|
2741
|
-
const [segmenting, setSegmenting] =
|
|
2742
|
-
const [subjectStatus, setSubjectStatus] =
|
|
3002
|
+
const [subject, setSubject] = useState12("");
|
|
3003
|
+
const [segmenting, setSegmenting] = useState12(false);
|
|
3004
|
+
const [subjectStatus, setSubjectStatus] = useState12(null);
|
|
2743
3005
|
const selectSubject = async () => {
|
|
2744
3006
|
const target = subject.trim();
|
|
2745
3007
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -2755,8 +3017,9 @@ var SelectionOptionsBar = ({
|
|
|
2755
3017
|
setSegmenting(false);
|
|
2756
3018
|
}
|
|
2757
3019
|
};
|
|
2758
|
-
const [
|
|
2759
|
-
const [
|
|
3020
|
+
const [workspace, setWorkspace] = useState12(false);
|
|
3021
|
+
const [skying, setSkying] = useState12(false);
|
|
3022
|
+
const [skyStatus, setSkyStatus] = useState12(null);
|
|
2760
3023
|
const selectSky = async () => {
|
|
2761
3024
|
if (skying) return;
|
|
2762
3025
|
setSkying(true);
|
|
@@ -2770,8 +3033,8 @@ var SelectionOptionsBar = ({
|
|
|
2770
3033
|
setSkying(false);
|
|
2771
3034
|
}
|
|
2772
3035
|
};
|
|
2773
|
-
const [focusing, setFocusing] =
|
|
2774
|
-
const [focusStatus, setFocusStatus] =
|
|
3036
|
+
const [focusing, setFocusing] = useState12(false);
|
|
3037
|
+
const [focusStatus, setFocusStatus] = useState12(null);
|
|
2775
3038
|
const selectFocusArea = async () => {
|
|
2776
3039
|
if (focusing) return;
|
|
2777
3040
|
setFocusing(true);
|
|
@@ -2790,24 +3053,24 @@ var SelectionOptionsBar = ({
|
|
|
2790
3053
|
setFocusing(false);
|
|
2791
3054
|
}
|
|
2792
3055
|
};
|
|
2793
|
-
return /* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
options.tool === "wand" && /* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
2800
|
-
/* @__PURE__ */
|
|
3056
|
+
return /* @__PURE__ */ jsxs14("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3057
|
+
/* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx16("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)) }),
|
|
3058
|
+
/* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
3059
|
+
options.tool === "wand" && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
3060
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3061
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3062
|
+
/* @__PURE__ */ jsx16("span", { children: "Tolerance" }),
|
|
3063
|
+
/* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.tolerance })
|
|
2801
3064
|
] }),
|
|
2802
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
2803
3066
|
] }),
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3068
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
2806
3069
|
"Contiguous"
|
|
2807
3070
|
] }),
|
|
2808
|
-
/* @__PURE__ */
|
|
3071
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2809
3072
|
"Distance",
|
|
2810
|
-
/* @__PURE__ */
|
|
3073
|
+
/* @__PURE__ */ jsx16(
|
|
2811
3074
|
ImageSelect,
|
|
2812
3075
|
{
|
|
2813
3076
|
label: "Colour distance",
|
|
@@ -2820,13 +3083,13 @@ var SelectionOptionsBar = ({
|
|
|
2820
3083
|
}
|
|
2821
3084
|
)
|
|
2822
3085
|
] }),
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
3086
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3087
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
2825
3088
|
"Sample adjusted image"
|
|
2826
3089
|
] }),
|
|
2827
|
-
/* @__PURE__ */
|
|
3090
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2828
3091
|
"Sample",
|
|
2829
|
-
/* @__PURE__ */
|
|
3092
|
+
/* @__PURE__ */ jsx16(
|
|
2830
3093
|
ImageSelect,
|
|
2831
3094
|
{
|
|
2832
3095
|
label: "Sample from",
|
|
@@ -2840,77 +3103,77 @@ var SelectionOptionsBar = ({
|
|
|
2840
3103
|
)
|
|
2841
3104
|
] })
|
|
2842
3105
|
] }),
|
|
2843
|
-
options.tool === "polygon" && /* @__PURE__ */
|
|
2844
|
-
options.tool === "magnetic" && /* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
/* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
3106
|
+
options.tool === "polygon" && /* @__PURE__ */ jsx16("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." }),
|
|
3107
|
+
options.tool === "magnetic" && /* @__PURE__ */ jsxs14("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
3108
|
+
/* @__PURE__ */ jsx16("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." }),
|
|
3109
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3110
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3111
|
+
/* @__PURE__ */ jsx16("span", { children: "Width" }),
|
|
3112
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2850
3113
|
options.magneticWidth ?? 10,
|
|
2851
3114
|
" px"
|
|
2852
3115
|
] })
|
|
2853
3116
|
] }),
|
|
2854
|
-
/* @__PURE__ */
|
|
3117
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
2855
3118
|
] }),
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
3119
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3120
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3121
|
+
/* @__PURE__ */ jsx16("span", { children: "Contrast" }),
|
|
3122
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2860
3123
|
options.magneticContrast ?? 10,
|
|
2861
3124
|
"%"
|
|
2862
3125
|
] })
|
|
2863
3126
|
] }),
|
|
2864
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
2865
3128
|
] }),
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
/* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
3129
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3130
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3131
|
+
/* @__PURE__ */ jsx16("span", { children: "Frequency" }),
|
|
3132
|
+
/* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
2870
3133
|
] }),
|
|
2871
|
-
/* @__PURE__ */
|
|
3134
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
2872
3135
|
] })
|
|
2873
3136
|
] }),
|
|
2874
|
-
options.tool === "quick" && /* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
3137
|
+
options.tool === "quick" && /* @__PURE__ */ jsxs14("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
3138
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
3139
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3140
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3141
|
+
/* @__PURE__ */ jsx16("span", { children: "Size" }),
|
|
3142
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
2880
3143
|
options.quickSize ?? 30,
|
|
2881
3144
|
" px"
|
|
2882
3145
|
] })
|
|
2883
3146
|
] }),
|
|
2884
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
2885
3148
|
] }),
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3150
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
2888
3151
|
"Sample all layers"
|
|
2889
3152
|
] }),
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__PURE__ */
|
|
3153
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3154
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
2892
3155
|
"Auto-enhance edges"
|
|
2893
3156
|
] })
|
|
2894
3157
|
] }),
|
|
2895
|
-
options.tool === "object" && /* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
/* @__PURE__ */
|
|
3158
|
+
options.tool === "object" && /* @__PURE__ */ jsxs14("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
3159
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
3160
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3161
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
2899
3162
|
"Sample all layers"
|
|
2900
3163
|
] }),
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
/* @__PURE__ */
|
|
3164
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3165
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
2903
3166
|
"Auto-enhance edges"
|
|
2904
3167
|
] })
|
|
2905
3168
|
] }),
|
|
2906
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */
|
|
2907
|
-
/* @__PURE__ */
|
|
3169
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs14("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
3170
|
+
/* @__PURE__ */ jsxs14("p", { className: "text-muted-foreground", children: [
|
|
2908
3171
|
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).",
|
|
2909
3172
|
" Shift-click adds, Alt-click subtracts."
|
|
2910
3173
|
] }),
|
|
2911
|
-
/* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2912
3175
|
"Text",
|
|
2913
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ jsx16(
|
|
2914
3177
|
"input",
|
|
2915
3178
|
{
|
|
2916
3179
|
type: "text",
|
|
@@ -2921,9 +3184,9 @@ var SelectionOptionsBar = ({
|
|
|
2921
3184
|
}
|
|
2922
3185
|
)
|
|
2923
3186
|
] }),
|
|
2924
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2925
3188
|
"Size",
|
|
2926
|
-
/* @__PURE__ */
|
|
3189
|
+
/* @__PURE__ */ jsx16(
|
|
2927
3190
|
"input",
|
|
2928
3191
|
{
|
|
2929
3192
|
type: "number",
|
|
@@ -2937,9 +3200,9 @@ var SelectionOptionsBar = ({
|
|
|
2937
3200
|
),
|
|
2938
3201
|
"px"
|
|
2939
3202
|
] }),
|
|
2940
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2941
3204
|
"Font",
|
|
2942
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsx16(
|
|
2943
3206
|
"input",
|
|
2944
3207
|
{
|
|
2945
3208
|
type: "text",
|
|
@@ -2951,18 +3214,18 @@ var SelectionOptionsBar = ({
|
|
|
2951
3214
|
)
|
|
2952
3215
|
] })
|
|
2953
3216
|
] }),
|
|
2954
|
-
options.tool === "range" && /* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
3217
|
+
options.tool === "range" && /* @__PURE__ */ jsxs14("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
3218
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
3219
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3220
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3221
|
+
/* @__PURE__ */ jsx16("span", { children: "Fuzziness" }),
|
|
3222
|
+
/* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
2960
3223
|
] }),
|
|
2961
|
-
/* @__PURE__ */
|
|
3224
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
2962
3225
|
] }),
|
|
2963
|
-
/* @__PURE__ */
|
|
3226
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2964
3227
|
"Localized radius",
|
|
2965
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ jsx16(
|
|
2966
3229
|
"input",
|
|
2967
3230
|
{
|
|
2968
3231
|
type: "number",
|
|
@@ -2976,12 +3239,12 @@ var SelectionOptionsBar = ({
|
|
|
2976
3239
|
),
|
|
2977
3240
|
"px"
|
|
2978
3241
|
] }),
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
3242
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3243
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
2981
3244
|
"Invert"
|
|
2982
3245
|
] }),
|
|
2983
|
-
/* @__PURE__ */
|
|
2984
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
|
|
3247
|
+
/* @__PURE__ */ jsx16(
|
|
2985
3248
|
ImageSelect,
|
|
2986
3249
|
{
|
|
2987
3250
|
label: "Color Range preset",
|
|
@@ -2990,13 +3253,13 @@ var SelectionOptionsBar = ({
|
|
|
2990
3253
|
onChange: (v) => setPreset(v)
|
|
2991
3254
|
}
|
|
2992
3255
|
),
|
|
2993
|
-
/* @__PURE__ */
|
|
3256
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
2994
3257
|
] }),
|
|
2995
|
-
rangeStatus && /* @__PURE__ */
|
|
3258
|
+
rangeStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
2996
3259
|
] }),
|
|
2997
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2998
3261
|
"Feather",
|
|
2999
|
-
/* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx16(
|
|
3000
3263
|
"input",
|
|
3001
3264
|
{
|
|
3002
3265
|
type: "number",
|
|
@@ -3011,7 +3274,7 @@ var SelectionOptionsBar = ({
|
|
|
3011
3274
|
),
|
|
3012
3275
|
"px"
|
|
3013
3276
|
] }),
|
|
3014
|
-
/* @__PURE__ */
|
|
3277
|
+
/* @__PURE__ */ jsxs14(
|
|
3015
3278
|
"form",
|
|
3016
3279
|
{
|
|
3017
3280
|
"data-testid": "select-subject",
|
|
@@ -3021,8 +3284,8 @@ var SelectionOptionsBar = ({
|
|
|
3021
3284
|
void selectSubject();
|
|
3022
3285
|
},
|
|
3023
3286
|
children: [
|
|
3024
|
-
/* @__PURE__ */
|
|
3025
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3287
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
|
|
3288
|
+
controller.segmentationProvider && /* @__PURE__ */ jsx16(
|
|
3026
3289
|
"input",
|
|
3027
3290
|
{
|
|
3028
3291
|
type: "text",
|
|
@@ -3034,7 +3297,7 @@ var SelectionOptionsBar = ({
|
|
|
3034
3297
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
3035
3298
|
}
|
|
3036
3299
|
),
|
|
3037
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsx16(
|
|
3038
3301
|
"button",
|
|
3039
3302
|
{
|
|
3040
3303
|
type: "submit",
|
|
@@ -3046,65 +3309,67 @@ var SelectionOptionsBar = ({
|
|
|
3046
3309
|
}
|
|
3047
3310
|
)
|
|
3048
3311
|
] }),
|
|
3049
|
-
subjectStatus && /* @__PURE__ */
|
|
3312
|
+
subjectStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
3050
3313
|
]
|
|
3051
3314
|
}
|
|
3052
3315
|
),
|
|
3053
|
-
/* @__PURE__ */
|
|
3054
|
-
|
|
3055
|
-
|
|
3316
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
3317
|
+
workspace && /* @__PURE__ */ jsx16(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
3318
|
+
/* @__PURE__ */ jsxs14("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
3319
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
3320
|
+
skyStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
3056
3321
|
] }),
|
|
3057
|
-
/* @__PURE__ */
|
|
3058
|
-
/* @__PURE__ */
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
3062
|
-
/* @__PURE__ */
|
|
3063
|
-
/* @__PURE__ */
|
|
3322
|
+
/* @__PURE__ */ jsxs14("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
3323
|
+
/* @__PURE__ */ jsx16("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
3324
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
3325
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3326
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3327
|
+
/* @__PURE__ */ jsx16("span", { children: "In-focus range" }),
|
|
3328
|
+
/* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
3064
3329
|
] }),
|
|
3065
|
-
/* @__PURE__ */
|
|
3330
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
3066
3331
|
] }),
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3332
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3333
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3334
|
+
/* @__PURE__ */ jsx16("span", { children: "Image noise level" }),
|
|
3335
|
+
/* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
3071
3336
|
] }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3337
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
3073
3338
|
] }),
|
|
3074
|
-
/* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3076
|
-
/* @__PURE__ */
|
|
3077
|
-
/* @__PURE__ */
|
|
3339
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3340
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3341
|
+
/* @__PURE__ */ jsx16("span", { children: "Soften edge" }),
|
|
3342
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
3078
3343
|
options.focusSoftness ?? 4,
|
|
3079
3344
|
" px"
|
|
3080
3345
|
] })
|
|
3081
3346
|
] }),
|
|
3082
|
-
/* @__PURE__ */
|
|
3347
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
3083
3348
|
] }),
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
focusStatus && /* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
3350
|
+
focusStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
3086
3351
|
] })
|
|
3087
3352
|
] }),
|
|
3088
|
-
/* @__PURE__ */
|
|
3089
|
-
/* @__PURE__ */
|
|
3353
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3354
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
3090
3355
|
"Anti-alias"
|
|
3091
3356
|
] }),
|
|
3092
|
-
/* @__PURE__ */
|
|
3093
|
-
/* @__PURE__ */
|
|
3094
|
-
/* @__PURE__ */
|
|
3095
|
-
/* @__PURE__ */
|
|
3096
|
-
/* @__PURE__ */
|
|
3097
|
-
/* @__PURE__ */
|
|
3098
|
-
/* @__PURE__ */
|
|
3357
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
|
|
3358
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
3359
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
3360
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
3361
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
3362
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
3363
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
3099
3364
|
] }),
|
|
3100
|
-
/* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
DISPLAYS.map((d) => /* @__PURE__ */
|
|
3365
|
+
/* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3366
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Show" }),
|
|
3367
|
+
DISPLAYS.map((d) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
3103
3368
|
] }),
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
/* @__PURE__ */
|
|
3369
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3370
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3106
3371
|
"Radius",
|
|
3107
|
-
/* @__PURE__ */
|
|
3372
|
+
/* @__PURE__ */ jsx16(
|
|
3108
3373
|
"input",
|
|
3109
3374
|
{
|
|
3110
3375
|
type: "number",
|
|
@@ -3118,12 +3383,12 @@ var SelectionOptionsBar = ({
|
|
|
3118
3383
|
}
|
|
3119
3384
|
)
|
|
3120
3385
|
] }),
|
|
3121
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
3386
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
3122
3387
|
] }),
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3388
|
+
/* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3389
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3125
3390
|
"Stroke",
|
|
3126
|
-
/* @__PURE__ */
|
|
3391
|
+
/* @__PURE__ */ jsx16(
|
|
3127
3392
|
"input",
|
|
3128
3393
|
{
|
|
3129
3394
|
type: "number",
|
|
@@ -3138,7 +3403,7 @@ var SelectionOptionsBar = ({
|
|
|
3138
3403
|
),
|
|
3139
3404
|
"px"
|
|
3140
3405
|
] }),
|
|
3141
|
-
/* @__PURE__ */
|
|
3406
|
+
/* @__PURE__ */ jsx16(
|
|
3142
3407
|
ImageSelect,
|
|
3143
3408
|
{
|
|
3144
3409
|
label: "Stroke location",
|
|
@@ -3151,45 +3416,45 @@ var SelectionOptionsBar = ({
|
|
|
3151
3416
|
onChange: (v) => setStrokeLocation(v)
|
|
3152
3417
|
}
|
|
3153
3418
|
),
|
|
3154
|
-
/* @__PURE__ */
|
|
3155
|
-
/* @__PURE__ */
|
|
3156
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
3420
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
3421
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" })
|
|
3157
3422
|
] }),
|
|
3158
|
-
/* @__PURE__ */
|
|
3159
|
-
/* @__PURE__ */
|
|
3160
|
-
/* @__PURE__ */
|
|
3161
|
-
/* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
3424
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
3425
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
3426
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
3427
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
3428
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
3429
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
3430
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
3166
3431
|
] }),
|
|
3167
|
-
colorStatus && /* @__PURE__ */
|
|
3168
|
-
/* @__PURE__ */
|
|
3432
|
+
colorStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
3433
|
+
/* @__PURE__ */ jsx16("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
3169
3434
|
] });
|
|
3170
3435
|
};
|
|
3171
3436
|
|
|
3172
3437
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3173
|
-
import { useState as
|
|
3438
|
+
import { useState as useState13 } from "react";
|
|
3174
3439
|
import {
|
|
3175
3440
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3176
|
-
REFINE_EDGE_CONTROLS,
|
|
3177
|
-
REFINE_OUTPUTS,
|
|
3441
|
+
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
3442
|
+
REFINE_OUTPUTS as REFINE_OUTPUTS2,
|
|
3178
3443
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
3179
3444
|
layerMaskFromSelection
|
|
3180
3445
|
} from "@pixerate/editor/image-editor";
|
|
3181
|
-
import { Fragment as Fragment3, jsx as
|
|
3446
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3182
3447
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3183
|
-
var
|
|
3448
|
+
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";
|
|
3184
3449
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
3185
|
-
const [params, setParams] =
|
|
3186
|
-
const [busy, setBusy] =
|
|
3187
|
-
const [error, setError] =
|
|
3188
|
-
const [layerId, setLayerId] =
|
|
3189
|
-
const [newKind, setNewKind] =
|
|
3190
|
-
const [output, setOutput] =
|
|
3191
|
-
const [decontaminate, setDecontaminate] =
|
|
3192
|
-
const [objectAware, setObjectAware] =
|
|
3450
|
+
const [params, setParams] = useState13(DEFAULT_PARAMS);
|
|
3451
|
+
const [busy, setBusy] = useState13(false);
|
|
3452
|
+
const [error, setError] = useState13(null);
|
|
3453
|
+
const [layerId, setLayerId] = useState13("");
|
|
3454
|
+
const [newKind, setNewKind] = useState13("hueSaturation");
|
|
3455
|
+
const [output, setOutput] = useState13("selection");
|
|
3456
|
+
const [decontaminate, setDecontaminate] = useState13(0);
|
|
3457
|
+
const [objectAware, setObjectAware] = useState13(false);
|
|
3193
3458
|
const canObject = Boolean(controller.segmentationProvider);
|
|
3194
3459
|
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
3195
3460
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -3209,17 +3474,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3209
3474
|
setBusy(false);
|
|
3210
3475
|
}
|
|
3211
3476
|
};
|
|
3212
|
-
return /* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3214
|
-
|
|
3215
|
-
/* @__PURE__ */
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3477
|
+
return /* @__PURE__ */ jsxs15("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3478
|
+
/* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
3479
|
+
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3480
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3481
|
+
/* @__PURE__ */ jsx17("span", { children: c.label }),
|
|
3482
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3218
3483
|
params[c.id],
|
|
3219
3484
|
c.unit
|
|
3220
3485
|
] })
|
|
3221
3486
|
] }),
|
|
3222
|
-
/* @__PURE__ */
|
|
3487
|
+
/* @__PURE__ */ jsx17(
|
|
3223
3488
|
"input",
|
|
3224
3489
|
{
|
|
3225
3490
|
type: "range",
|
|
@@ -3233,39 +3498,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3233
3498
|
}
|
|
3234
3499
|
)
|
|
3235
3500
|
] }, c.id)),
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
/* @__PURE__ */
|
|
3501
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3502
|
+
/* @__PURE__ */ jsx17("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
3238
3503
|
"Smart Radius"
|
|
3239
3504
|
] }),
|
|
3240
|
-
canObject && /* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3505
|
+
canObject && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3506
|
+
/* @__PURE__ */ jsx17("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
3242
3507
|
"Object aware (segmentation model)"
|
|
3243
3508
|
] }),
|
|
3244
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3245
3510
|
"Output to",
|
|
3246
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ jsx17(
|
|
3247
3512
|
"select",
|
|
3248
3513
|
{
|
|
3249
3514
|
"aria-label": "Refine output",
|
|
3250
3515
|
value: output,
|
|
3251
3516
|
onChange: (e) => setOutput(e.target.value),
|
|
3252
3517
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3253
|
-
children:
|
|
3518
|
+
children: REFINE_OUTPUTS2.map((o) => /* @__PURE__ */ jsx17("option", { value: o.id, children: o.label }, o.id))
|
|
3254
3519
|
}
|
|
3255
3520
|
)
|
|
3256
3521
|
] }),
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
/* @__PURE__ */
|
|
3522
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3523
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3524
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
3260
3525
|
"Decontaminate colors",
|
|
3261
3526
|
toLayer ? "" : " (new layer outputs)"
|
|
3262
3527
|
] }),
|
|
3263
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3264
3529
|
decontaminate,
|
|
3265
3530
|
"%"
|
|
3266
3531
|
] })
|
|
3267
3532
|
] }),
|
|
3268
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsx17(
|
|
3269
3534
|
"input",
|
|
3270
3535
|
{
|
|
3271
3536
|
type: "range",
|
|
@@ -3280,63 +3545,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3280
3545
|
}
|
|
3281
3546
|
)
|
|
3282
3547
|
] }),
|
|
3283
|
-
/* @__PURE__ */
|
|
3284
|
-
/* @__PURE__ */
|
|
3285
|
-
/* @__PURE__ */
|
|
3548
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1", children: [
|
|
3549
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
3550
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
3286
3551
|
] }),
|
|
3287
|
-
error && /* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
/* @__PURE__ */
|
|
3552
|
+
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error }),
|
|
3553
|
+
/* @__PURE__ */ jsx17("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
3554
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1 items-center", children: [
|
|
3555
|
+
/* @__PURE__ */ jsx17(
|
|
3291
3556
|
"select",
|
|
3292
3557
|
{
|
|
3293
3558
|
"aria-label": "New masked layer kind",
|
|
3294
3559
|
value: newKind,
|
|
3295
3560
|
onChange: (e) => setNewKind(e.target.value),
|
|
3296
3561
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3297
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
3562
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx17("option", { value: k.kind, children: k.label }, k.kind))
|
|
3298
3563
|
}
|
|
3299
3564
|
),
|
|
3300
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx17(
|
|
3301
3566
|
"button",
|
|
3302
3567
|
{
|
|
3303
3568
|
type: "button",
|
|
3304
|
-
className:
|
|
3569
|
+
className: button2,
|
|
3305
3570
|
disabled: !sel,
|
|
3306
3571
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
3307
3572
|
children: "New Masked Layer"
|
|
3308
3573
|
}
|
|
3309
3574
|
)
|
|
3310
3575
|
] }),
|
|
3311
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
3312
|
-
/* @__PURE__ */
|
|
3576
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2", children: [
|
|
3577
|
+
/* @__PURE__ */ jsx17(
|
|
3313
3578
|
"select",
|
|
3314
3579
|
{
|
|
3315
3580
|
"aria-label": "Mask layer",
|
|
3316
3581
|
value: target.id,
|
|
3317
3582
|
onChange: (e) => setLayerId(e.target.value),
|
|
3318
3583
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3319
|
-
children: list.map((l) => /* @__PURE__ */
|
|
3584
|
+
children: list.map((l) => /* @__PURE__ */ jsxs15("option", { value: l.id, children: [
|
|
3320
3585
|
l.name || adjustmentKindLabel2(l.kind),
|
|
3321
3586
|
l.mask ? " (masked)" : ""
|
|
3322
3587
|
] }, l.id))
|
|
3323
3588
|
}
|
|
3324
3589
|
),
|
|
3325
|
-
/* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1", children: [
|
|
3591
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
3592
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
3593
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
3329
3594
|
] }),
|
|
3330
|
-
target.mask && /* @__PURE__ */
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3595
|
+
target.mask && /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
3596
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3597
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3598
|
+
/* @__PURE__ */ jsx17("span", { children: "Density" }),
|
|
3599
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3335
3600
|
Math.round((target.mask.density ?? 1) * 100),
|
|
3336
3601
|
"%"
|
|
3337
3602
|
] })
|
|
3338
3603
|
] }),
|
|
3339
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx17(
|
|
3340
3605
|
"input",
|
|
3341
3606
|
{
|
|
3342
3607
|
type: "range",
|
|
@@ -3350,15 +3615,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3350
3615
|
}
|
|
3351
3616
|
)
|
|
3352
3617
|
] }),
|
|
3353
|
-
/* @__PURE__ */
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
/* @__PURE__ */
|
|
3356
|
-
/* @__PURE__ */
|
|
3618
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3619
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3620
|
+
/* @__PURE__ */ jsx17("span", { children: "Mask Feather" }),
|
|
3621
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3357
3622
|
target.mask.feather ?? 0,
|
|
3358
3623
|
"px"
|
|
3359
3624
|
] })
|
|
3360
3625
|
] }),
|
|
3361
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ jsx17(
|
|
3362
3627
|
"input",
|
|
3363
3628
|
{
|
|
3364
3629
|
type: "range",
|
|
@@ -3378,13 +3643,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3378
3643
|
};
|
|
3379
3644
|
|
|
3380
3645
|
// src/image-editor/ChannelsPanel.tsx
|
|
3381
|
-
import { useEffect as
|
|
3646
|
+
import { useEffect as useEffect11, useRef as useRef8, useState as useState14 } from "react";
|
|
3382
3647
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3383
|
-
import { jsx as
|
|
3648
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3384
3649
|
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"}`;
|
|
3385
3650
|
var ChannelThumb = ({ channel, size }) => {
|
|
3386
|
-
const ref =
|
|
3387
|
-
|
|
3651
|
+
const ref = useRef8(null);
|
|
3652
|
+
useEffect11(() => {
|
|
3388
3653
|
const canvas = ref.current;
|
|
3389
3654
|
const ctx = canvas?.getContext("2d");
|
|
3390
3655
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -3395,15 +3660,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
3395
3660
|
img.data.set(px.data);
|
|
3396
3661
|
ctx.putImageData(img, 0, 0);
|
|
3397
3662
|
}, [channel.mask]);
|
|
3398
|
-
return /* @__PURE__ */
|
|
3663
|
+
return /* @__PURE__ */ jsx18("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
3399
3664
|
};
|
|
3400
3665
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
3401
|
-
const [, setTick] =
|
|
3402
|
-
|
|
3403
|
-
const [activeId, setActiveId] =
|
|
3404
|
-
const [renaming, setRenaming] =
|
|
3405
|
-
const [error, setError] =
|
|
3406
|
-
const fileInput =
|
|
3666
|
+
const [, setTick] = useState14(0);
|
|
3667
|
+
useEffect11(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3668
|
+
const [activeId, setActiveId] = useState14(null);
|
|
3669
|
+
const [renaming, setRenaming] = useState14(null);
|
|
3670
|
+
const [error, setError] = useState14(null);
|
|
3671
|
+
const fileInput = useRef8(null);
|
|
3407
3672
|
const channels = controller.getChannels();
|
|
3408
3673
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
3409
3674
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -3425,13 +3690,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3425
3690
|
setError(err instanceof Error ? err.message : String(err));
|
|
3426
3691
|
}
|
|
3427
3692
|
};
|
|
3428
|
-
return /* @__PURE__ */
|
|
3429
|
-
/* @__PURE__ */
|
|
3430
|
-
/* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3693
|
+
return /* @__PURE__ */ jsxs16("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
3694
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
|
|
3695
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
3696
|
+
/* @__PURE__ */ jsx18("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" })
|
|
3432
3697
|
] }),
|
|
3433
|
-
channels.length === 0 && /* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3698
|
+
channels.length === 0 && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
3699
|
+
/* @__PURE__ */ jsx18("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs16(
|
|
3435
3700
|
"li",
|
|
3436
3701
|
{
|
|
3437
3702
|
"data-testid": "channel-row",
|
|
@@ -3443,7 +3708,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3443
3708
|
},
|
|
3444
3709
|
onDoubleClick: () => setRenaming(c.id),
|
|
3445
3710
|
children: [
|
|
3446
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx18(
|
|
3447
3712
|
"button",
|
|
3448
3713
|
{
|
|
3449
3714
|
type: "button",
|
|
@@ -3457,8 +3722,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3457
3722
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
3458
3723
|
}
|
|
3459
3724
|
),
|
|
3460
|
-
/* @__PURE__ */
|
|
3461
|
-
renaming === c.id ? /* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ jsx18(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
3726
|
+
renaming === c.id ? /* @__PURE__ */ jsx18(
|
|
3462
3727
|
"input",
|
|
3463
3728
|
{
|
|
3464
3729
|
autoFocus: true,
|
|
@@ -3475,16 +3740,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3475
3740
|
if (e.key === "Escape") setRenaming(null);
|
|
3476
3741
|
}
|
|
3477
3742
|
}
|
|
3478
|
-
) : /* @__PURE__ */
|
|
3743
|
+
) : /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
3479
3744
|
]
|
|
3480
3745
|
},
|
|
3481
3746
|
c.id
|
|
3482
3747
|
)) }),
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
/* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-1", children: [
|
|
3749
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
3750
|
+
/* @__PURE__ */ jsx18("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" }),
|
|
3751
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
3752
|
+
/* @__PURE__ */ jsx18(
|
|
3488
3753
|
"button",
|
|
3489
3754
|
{
|
|
3490
3755
|
type: "button",
|
|
@@ -3497,8 +3762,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3497
3762
|
children: "Delete"
|
|
3498
3763
|
}
|
|
3499
3764
|
),
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3765
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
3766
|
+
/* @__PURE__ */ jsx18(
|
|
3502
3767
|
"button",
|
|
3503
3768
|
{
|
|
3504
3769
|
type: "button",
|
|
@@ -3509,7 +3774,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3509
3774
|
children: "Export PNG"
|
|
3510
3775
|
}
|
|
3511
3776
|
),
|
|
3512
|
-
/* @__PURE__ */
|
|
3777
|
+
/* @__PURE__ */ jsx18(
|
|
3513
3778
|
"input",
|
|
3514
3779
|
{
|
|
3515
3780
|
ref: fileInput,
|
|
@@ -3524,18 +3789,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3524
3789
|
}
|
|
3525
3790
|
)
|
|
3526
3791
|
] }),
|
|
3527
|
-
error && /* @__PURE__ */
|
|
3792
|
+
error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error })
|
|
3528
3793
|
] });
|
|
3529
3794
|
};
|
|
3530
3795
|
|
|
3531
3796
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
3532
|
-
import { useEffect as
|
|
3797
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
3533
3798
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
3534
|
-
import { jsx as
|
|
3799
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3535
3800
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
3536
3801
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
3537
|
-
const [, setTick] =
|
|
3538
|
-
|
|
3802
|
+
const [, setTick] = useState15(0);
|
|
3803
|
+
useEffect12(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
3539
3804
|
const bar = tool.bar();
|
|
3540
3805
|
if (!tool.active || !bar) return null;
|
|
3541
3806
|
const warp = tool.warpBar();
|
|
@@ -3547,17 +3812,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3547
3812
|
const v = Number(raw);
|
|
3548
3813
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
3549
3814
|
};
|
|
3550
|
-
return /* @__PURE__ */
|
|
3551
|
-
/* @__PURE__ */
|
|
3552
|
-
/* @__PURE__ */
|
|
3553
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3556
|
-
/* @__PURE__ */
|
|
3815
|
+
return /* @__PURE__ */ jsxs17("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: [
|
|
3816
|
+
/* @__PURE__ */ jsx19("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx19("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)) }),
|
|
3817
|
+
/* @__PURE__ */ jsx19("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx19("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)) }),
|
|
3818
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
3819
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3820
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
3821
|
+
/* @__PURE__ */ jsx19("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx19("option", { value: o.id, children: o.label }, o.id)) })
|
|
3557
3822
|
] }),
|
|
3558
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
3559
|
-
/* @__PURE__ */
|
|
3560
|
-
/* @__PURE__ */
|
|
3823
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3824
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
3825
|
+
/* @__PURE__ */ jsx19(
|
|
3561
3826
|
"input",
|
|
3562
3827
|
{
|
|
3563
3828
|
type: "number",
|
|
@@ -3578,9 +3843,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3578
3843
|
},
|
|
3579
3844
|
`${k}:${warp[k]}`
|
|
3580
3845
|
),
|
|
3581
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "%" })
|
|
3582
3847
|
] }, k)),
|
|
3583
|
-
/* @__PURE__ */
|
|
3848
|
+
/* @__PURE__ */ jsx19(
|
|
3584
3849
|
"button",
|
|
3585
3850
|
{
|
|
3586
3851
|
type: "button",
|
|
@@ -3592,9 +3857,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3592
3857
|
children: "Vertical"
|
|
3593
3858
|
}
|
|
3594
3859
|
),
|
|
3595
|
-
/* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
3860
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3861
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
3862
|
+
/* @__PURE__ */ jsx19(
|
|
3598
3863
|
"select",
|
|
3599
3864
|
{
|
|
3600
3865
|
"aria-label": "Warp grid",
|
|
@@ -3604,14 +3869,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3604
3869
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
3605
3870
|
},
|
|
3606
3871
|
className: imageFieldClass,
|
|
3607
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
3872
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx19("option", { value: g.id, children: g.label }, g.id))
|
|
3608
3873
|
}
|
|
3609
3874
|
)
|
|
3610
3875
|
] })
|
|
3611
3876
|
] }),
|
|
3612
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
/* @__PURE__ */
|
|
3877
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
3878
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: f.label }),
|
|
3879
|
+
/* @__PURE__ */ jsx19(
|
|
3615
3880
|
"input",
|
|
3616
3881
|
{
|
|
3617
3882
|
type: "number",
|
|
@@ -3631,8 +3896,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3631
3896
|
},
|
|
3632
3897
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
3633
3898
|
),
|
|
3634
|
-
/* @__PURE__ */
|
|
3635
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: f.unit }),
|
|
3900
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx19(
|
|
3636
3901
|
"button",
|
|
3637
3902
|
{
|
|
3638
3903
|
type: "button",
|
|
@@ -3647,33 +3912,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3647
3912
|
}
|
|
3648
3913
|
)
|
|
3649
3914
|
] }, f.id)),
|
|
3650
|
-
/* @__PURE__ */
|
|
3651
|
-
/* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3915
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
|
|
3916
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
3917
|
+
/* @__PURE__ */ jsx19(
|
|
3653
3918
|
"select",
|
|
3654
3919
|
{
|
|
3655
3920
|
"aria-label": "Interpolation",
|
|
3656
3921
|
value: tool.interpolation,
|
|
3657
3922
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
3658
3923
|
className: imageFieldClass,
|
|
3659
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
3924
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx19("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
3660
3925
|
}
|
|
3661
3926
|
)
|
|
3662
3927
|
] }),
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3665
|
-
tool.error && /* @__PURE__ */
|
|
3928
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
3929
|
+
/* @__PURE__ */ jsx19("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
3930
|
+
tool.error && /* @__PURE__ */ jsx19("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
3666
3931
|
] });
|
|
3667
3932
|
};
|
|
3668
3933
|
|
|
3669
3934
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
3670
|
-
import { useEffect as
|
|
3935
|
+
import { useEffect as useEffect13, useState as useState16 } from "react";
|
|
3671
3936
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
3672
|
-
import { Fragment as Fragment4, jsx as
|
|
3937
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3673
3938
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
3674
|
-
const [, setTick] =
|
|
3675
|
-
|
|
3676
|
-
const [error, setError] =
|
|
3939
|
+
const [, setTick] = useState16(0);
|
|
3940
|
+
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3941
|
+
const [error, setError] = useState16(null);
|
|
3677
3942
|
const active = controller.getActiveLayer();
|
|
3678
3943
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
3679
3944
|
const set = (change) => {
|
|
@@ -3687,22 +3952,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
3687
3952
|
}
|
|
3688
3953
|
};
|
|
3689
3954
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
3690
|
-
return /* @__PURE__ */
|
|
3691
|
-
/* @__PURE__ */
|
|
3692
|
-
/* @__PURE__ */
|
|
3693
|
-
/* @__PURE__ */
|
|
3694
|
-
/* @__PURE__ */
|
|
3955
|
+
return /* @__PURE__ */ jsxs18("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
3956
|
+
/* @__PURE__ */ jsx20("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
3957
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
3958
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3959
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
3695
3960
|
"Fill",
|
|
3696
|
-
/* @__PURE__ */
|
|
3961
|
+
/* @__PURE__ */ jsx20(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
3697
3962
|
] }),
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3963
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3964
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
3700
3965
|
"Stroke",
|
|
3701
|
-
/* @__PURE__ */
|
|
3966
|
+
/* @__PURE__ */ jsx20(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
3702
3967
|
] }),
|
|
3703
|
-
/* @__PURE__ */
|
|
3968
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3704
3969
|
"Width",
|
|
3705
|
-
/* @__PURE__ */
|
|
3970
|
+
/* @__PURE__ */ jsx20(
|
|
3706
3971
|
"input",
|
|
3707
3972
|
{
|
|
3708
3973
|
type: "number",
|
|
@@ -3716,52 +3981,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
3716
3981
|
)
|
|
3717
3982
|
] })
|
|
3718
3983
|
] }),
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
3984
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
3985
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3721
3986
|
"Radius",
|
|
3722
|
-
/* @__PURE__ */
|
|
3987
|
+
/* @__PURE__ */ jsx20("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}` })
|
|
3723
3988
|
] }),
|
|
3724
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
3989
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3725
3990
|
"Sides",
|
|
3726
|
-
/* @__PURE__ */
|
|
3991
|
+
/* @__PURE__ */ jsx20("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}` })
|
|
3727
3992
|
] }),
|
|
3728
|
-
options.kind === "star" && /* @__PURE__ */
|
|
3729
|
-
/* @__PURE__ */
|
|
3993
|
+
options.kind === "star" && /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
3994
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3730
3995
|
"Points",
|
|
3731
|
-
/* @__PURE__ */
|
|
3996
|
+
/* @__PURE__ */ jsx20("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}` })
|
|
3732
3997
|
] }),
|
|
3733
|
-
/* @__PURE__ */
|
|
3998
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3734
3999
|
"Inner",
|
|
3735
|
-
/* @__PURE__ */
|
|
4000
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
3736
4001
|
] })
|
|
3737
4002
|
] }),
|
|
3738
|
-
options.kind === "line" && /* @__PURE__ */
|
|
3739
|
-
/* @__PURE__ */
|
|
4003
|
+
options.kind === "line" && /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
4004
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
3740
4005
|
"Weight",
|
|
3741
|
-
/* @__PURE__ */
|
|
4006
|
+
/* @__PURE__ */ jsx20("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}` })
|
|
3742
4007
|
] }),
|
|
3743
|
-
/* @__PURE__ */
|
|
3744
|
-
/* @__PURE__ */
|
|
4008
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
4009
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
3745
4010
|
"Arrowhead"
|
|
3746
4011
|
] })
|
|
3747
4012
|
] })
|
|
3748
4013
|
] }),
|
|
3749
|
-
/* @__PURE__ */
|
|
3750
|
-
error && /* @__PURE__ */
|
|
4014
|
+
/* @__PURE__ */ jsx20("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." }),
|
|
4015
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
|
|
3751
4016
|
] });
|
|
3752
4017
|
};
|
|
3753
4018
|
|
|
3754
4019
|
// src/image-editor/TypeOptionsBar.tsx
|
|
3755
|
-
import { useEffect as
|
|
4020
|
+
import { useEffect as useEffect14, useState as useState17 } from "react";
|
|
3756
4021
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
3757
|
-
import { jsx as
|
|
4022
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3758
4023
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
3759
4024
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
3760
4025
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
3761
|
-
const [, setTick] =
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
const [error, setError] =
|
|
4026
|
+
const [, setTick] = useState17(0);
|
|
4027
|
+
useEffect14(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4028
|
+
useEffect14(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4029
|
+
const [error, setError] = useState17(null);
|
|
3765
4030
|
const active = controller.getActiveLayer();
|
|
3766
4031
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
3767
4032
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -3814,11 +4079,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3814
4079
|
setError(e instanceof Error ? e.message : String(e));
|
|
3815
4080
|
}
|
|
3816
4081
|
};
|
|
3817
|
-
return /* @__PURE__ */
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
4082
|
+
return /* @__PURE__ */ jsxs19("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4083
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4084
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
3820
4085
|
"Font",
|
|
3821
|
-
/* @__PURE__ */
|
|
4086
|
+
/* @__PURE__ */ jsx21(
|
|
3822
4087
|
"input",
|
|
3823
4088
|
{
|
|
3824
4089
|
list: "pixerate-type-fonts",
|
|
@@ -3828,11 +4093,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3828
4093
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
3829
4094
|
}
|
|
3830
4095
|
),
|
|
3831
|
-
/* @__PURE__ */
|
|
4096
|
+
/* @__PURE__ */ jsx21("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx21("option", { value: f }, f)) })
|
|
3832
4097
|
] }),
|
|
3833
|
-
/* @__PURE__ */
|
|
4098
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
3834
4099
|
"Size",
|
|
3835
|
-
/* @__PURE__ */
|
|
4100
|
+
/* @__PURE__ */ jsx21(
|
|
3836
4101
|
"input",
|
|
3837
4102
|
{
|
|
3838
4103
|
type: "number",
|
|
@@ -3845,14 +4110,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3845
4110
|
}
|
|
3846
4111
|
)
|
|
3847
4112
|
] }),
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
/* @__PURE__ */
|
|
3850
|
-
/* @__PURE__ */
|
|
4113
|
+
/* @__PURE__ */ jsx21("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" }),
|
|
4114
|
+
/* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4115
|
+
/* @__PURE__ */ jsx21(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
3851
4116
|
] }),
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
3855
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
4117
|
+
/* @__PURE__ */ jsx21("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4118
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
4119
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
4120
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx21(
|
|
3856
4121
|
"button",
|
|
3857
4122
|
{
|
|
3858
4123
|
type: "button",
|
|
@@ -3864,19 +4129,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
3864
4129
|
}
|
|
3865
4130
|
)
|
|
3866
4131
|
] }),
|
|
3867
|
-
/* @__PURE__ */
|
|
3868
|
-
missing.length > 0 && /* @__PURE__ */
|
|
4132
|
+
/* @__PURE__ */ jsx21("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." }),
|
|
4133
|
+
missing.length > 0 && /* @__PURE__ */ jsxs19("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
3869
4134
|
"Missing ",
|
|
3870
4135
|
missing.length === 1 ? "font" : "fonts",
|
|
3871
4136
|
": ",
|
|
3872
4137
|
missing.join(", ")
|
|
3873
4138
|
] }),
|
|
3874
|
-
error && /* @__PURE__ */
|
|
4139
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
3875
4140
|
] });
|
|
3876
4141
|
};
|
|
3877
4142
|
|
|
3878
4143
|
// src/image-editor/ImageEditor.tsx
|
|
3879
|
-
import { Fragment as Fragment5, jsx as
|
|
4144
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3880
4145
|
var ImageEditor = ({
|
|
3881
4146
|
editor: externalEditor,
|
|
3882
4147
|
src,
|
|
@@ -3901,32 +4166,32 @@ var ImageEditor = ({
|
|
|
3901
4166
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
3902
4167
|
});
|
|
3903
4168
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
3904
|
-
const [activeTab, setActiveTab] =
|
|
3905
|
-
const rootRef =
|
|
4169
|
+
const [activeTab, setActiveTab] = useState18("crop");
|
|
4170
|
+
const rootRef = useRef9(null);
|
|
3906
4171
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
3907
|
-
const activeTabRef =
|
|
4172
|
+
const activeTabRef = useRef9(activeTab);
|
|
3908
4173
|
activeTabRef.current = activeTab;
|
|
3909
4174
|
const openPanel = async (ref) => {
|
|
3910
4175
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
3911
4176
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
3912
4177
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
3913
4178
|
};
|
|
3914
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
3915
|
-
const [selectionOptions, setSelectionOptions] =
|
|
3916
|
-
const [shapeOptions, setShapeOptions] =
|
|
3917
|
-
const [typeOptions, setTypeOptions] =
|
|
3918
|
-
const [typeSession, setTypeSession] =
|
|
3919
|
-
const [selectionError, setSelectionError] =
|
|
3920
|
-
const [paintError, setPaintError] =
|
|
3921
|
-
const [shapeTypeError, setShapeTypeError] =
|
|
4179
|
+
const [activeCropRatio, setActiveCropRatio] = useState18(null);
|
|
4180
|
+
const [selectionOptions, setSelectionOptions] = useState18(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
4181
|
+
const [shapeOptions, setShapeOptions] = useState18(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
4182
|
+
const [typeOptions, setTypeOptions] = useState18(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
4183
|
+
const [typeSession, setTypeSession] = useState18(null);
|
|
4184
|
+
const [selectionError, setSelectionError] = useState18(null);
|
|
4185
|
+
const [paintError, setPaintError] = useState18(null);
|
|
4186
|
+
const [shapeTypeError, setShapeTypeError] = useState18(null);
|
|
3922
4187
|
const handleCanvasError = (source, message) => {
|
|
3923
4188
|
if (source === "paint") setPaintError(message);
|
|
3924
4189
|
else if (source === "select") setSelectionError(message);
|
|
3925
4190
|
else setShapeTypeError(message);
|
|
3926
4191
|
};
|
|
3927
4192
|
const finishTyping = () => setTypeSession(null);
|
|
3928
|
-
const transformToolRef =
|
|
3929
|
-
const transformControllerRef =
|
|
4193
|
+
const transformToolRef = useRef9(null);
|
|
4194
|
+
const transformControllerRef = useRef9(controller);
|
|
3930
4195
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
3931
4196
|
transformToolRef.current?.cancel();
|
|
3932
4197
|
transformToolRef.current = new FreeTransformTool2(controller, {
|
|
@@ -3935,16 +4200,16 @@ var ImageEditor = ({
|
|
|
3935
4200
|
transformControllerRef.current = controller;
|
|
3936
4201
|
}
|
|
3937
4202
|
const transformTool = transformToolRef.current;
|
|
3938
|
-
const [, setTransformTick] =
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
3942
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
3943
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
3944
|
-
const [isInpainting, setIsInpainting] =
|
|
3945
|
-
const [aiError, setAiError] =
|
|
3946
|
-
const [aiSuccess, setAiSuccess] =
|
|
3947
|
-
const [aiTarget, setAiTarget] =
|
|
4203
|
+
const [, setTransformTick] = useState18(0);
|
|
4204
|
+
useEffect15(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4205
|
+
useEffect15(() => () => transformToolRef.current?.cancel(), []);
|
|
4206
|
+
const [inpaintPrompt, setInpaintPrompt] = useState18("");
|
|
4207
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState18("annotations");
|
|
4208
|
+
const [isRemovingBg, setIsRemovingBg] = useState18(false);
|
|
4209
|
+
const [isInpainting, setIsInpainting] = useState18(false);
|
|
4210
|
+
const [aiError, setAiError] = useState18(null);
|
|
4211
|
+
const [aiSuccess, setAiSuccess] = useState18(null);
|
|
4212
|
+
const [aiTarget, setAiTarget] = useState18("auto");
|
|
3948
4213
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
3949
4214
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
3950
4215
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4007,11 +4272,11 @@ var ImageEditor = ({
|
|
|
4007
4272
|
setIsInpainting(false);
|
|
4008
4273
|
}
|
|
4009
4274
|
};
|
|
4010
|
-
const [activeColor, setActiveColor] =
|
|
4011
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4012
|
-
const [fontSize, setFontSize] =
|
|
4013
|
-
const [textInput, setTextInput] =
|
|
4014
|
-
|
|
4275
|
+
const [activeColor, setActiveColor] = useState18("#ef4444");
|
|
4276
|
+
const [strokeWidth, setStrokeWidth] = useState18(3);
|
|
4277
|
+
const [fontSize, setFontSize] = useState18(24);
|
|
4278
|
+
const [textInput, setTextInput] = useState18("");
|
|
4279
|
+
useEffect15(() => {
|
|
4015
4280
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4016
4281
|
editor.setTool("crop");
|
|
4017
4282
|
}
|
|
@@ -4039,16 +4304,16 @@ var ImageEditor = ({
|
|
|
4039
4304
|
link.click();
|
|
4040
4305
|
}
|
|
4041
4306
|
};
|
|
4042
|
-
return /* @__PURE__ */
|
|
4307
|
+
return /* @__PURE__ */ jsxs20(
|
|
4043
4308
|
"div",
|
|
4044
4309
|
{
|
|
4045
4310
|
ref: rootRef,
|
|
4046
4311
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4047
4312
|
style,
|
|
4048
4313
|
children: [
|
|
4049
|
-
/* @__PURE__ */
|
|
4050
|
-
/* @__PURE__ */
|
|
4051
|
-
/* @__PURE__ */
|
|
4314
|
+
/* @__PURE__ */ jsxs20("div", { className: imageEditorHeaderClass, children: [
|
|
4315
|
+
/* @__PURE__ */ jsxs20("div", { role: "tablist", className: imageTabListClass, children: [
|
|
4316
|
+
/* @__PURE__ */ jsx22(
|
|
4052
4317
|
"button",
|
|
4053
4318
|
{
|
|
4054
4319
|
type: "button",
|
|
@@ -4063,7 +4328,7 @@ var ImageEditor = ({
|
|
|
4063
4328
|
children: "Transform & Crop"
|
|
4064
4329
|
}
|
|
4065
4330
|
),
|
|
4066
|
-
/* @__PURE__ */
|
|
4331
|
+
/* @__PURE__ */ jsx22(
|
|
4067
4332
|
"button",
|
|
4068
4333
|
{
|
|
4069
4334
|
type: "button",
|
|
@@ -4078,7 +4343,7 @@ var ImageEditor = ({
|
|
|
4078
4343
|
children: "Adjustments"
|
|
4079
4344
|
}
|
|
4080
4345
|
),
|
|
4081
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx22(
|
|
4082
4347
|
"button",
|
|
4083
4348
|
{
|
|
4084
4349
|
type: "button",
|
|
@@ -4093,7 +4358,7 @@ var ImageEditor = ({
|
|
|
4093
4358
|
children: "Layers"
|
|
4094
4359
|
}
|
|
4095
4360
|
),
|
|
4096
|
-
/* @__PURE__ */
|
|
4361
|
+
/* @__PURE__ */ jsx22(
|
|
4097
4362
|
"button",
|
|
4098
4363
|
{
|
|
4099
4364
|
type: "button",
|
|
@@ -4108,7 +4373,7 @@ var ImageEditor = ({
|
|
|
4108
4373
|
children: "Paint"
|
|
4109
4374
|
}
|
|
4110
4375
|
),
|
|
4111
|
-
/* @__PURE__ */
|
|
4376
|
+
/* @__PURE__ */ jsx22(
|
|
4112
4377
|
"button",
|
|
4113
4378
|
{
|
|
4114
4379
|
type: "button",
|
|
@@ -4123,7 +4388,7 @@ var ImageEditor = ({
|
|
|
4123
4388
|
children: "Select & Mask"
|
|
4124
4389
|
}
|
|
4125
4390
|
),
|
|
4126
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ jsx22(
|
|
4127
4392
|
"button",
|
|
4128
4393
|
{
|
|
4129
4394
|
type: "button",
|
|
@@ -4138,7 +4403,7 @@ var ImageEditor = ({
|
|
|
4138
4403
|
children: "Annotations"
|
|
4139
4404
|
}
|
|
4140
4405
|
),
|
|
4141
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsx22(
|
|
4142
4407
|
"button",
|
|
4143
4408
|
{
|
|
4144
4409
|
type: "button",
|
|
@@ -4153,7 +4418,7 @@ var ImageEditor = ({
|
|
|
4153
4418
|
children: "Depth Mask"
|
|
4154
4419
|
}
|
|
4155
4420
|
),
|
|
4156
|
-
/* @__PURE__ */
|
|
4421
|
+
/* @__PURE__ */ jsxs20(
|
|
4157
4422
|
"button",
|
|
4158
4423
|
{
|
|
4159
4424
|
type: "button",
|
|
@@ -4166,14 +4431,14 @@ var ImageEditor = ({
|
|
|
4166
4431
|
"aria-selected": activeTab === "ai",
|
|
4167
4432
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
4168
4433
|
children: [
|
|
4169
|
-
/* @__PURE__ */
|
|
4434
|
+
/* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
|
|
4170
4435
|
"AI Tools"
|
|
4171
4436
|
]
|
|
4172
4437
|
}
|
|
4173
4438
|
)
|
|
4174
4439
|
] }),
|
|
4175
|
-
/* @__PURE__ */
|
|
4176
|
-
/* @__PURE__ */
|
|
4440
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4441
|
+
/* @__PURE__ */ jsx22(
|
|
4177
4442
|
"button",
|
|
4178
4443
|
{
|
|
4179
4444
|
type: "button",
|
|
@@ -4184,7 +4449,7 @@ var ImageEditor = ({
|
|
|
4184
4449
|
children: "\u21A9"
|
|
4185
4450
|
}
|
|
4186
4451
|
),
|
|
4187
|
-
/* @__PURE__ */
|
|
4452
|
+
/* @__PURE__ */ jsx22(
|
|
4188
4453
|
"button",
|
|
4189
4454
|
{
|
|
4190
4455
|
type: "button",
|
|
@@ -4195,7 +4460,7 @@ var ImageEditor = ({
|
|
|
4195
4460
|
children: "\u21AA"
|
|
4196
4461
|
}
|
|
4197
4462
|
),
|
|
4198
|
-
/* @__PURE__ */
|
|
4463
|
+
/* @__PURE__ */ jsx22(
|
|
4199
4464
|
"button",
|
|
4200
4465
|
{
|
|
4201
4466
|
type: "button",
|
|
@@ -4204,8 +4469,8 @@ var ImageEditor = ({
|
|
|
4204
4469
|
children: "Reset"
|
|
4205
4470
|
}
|
|
4206
4471
|
),
|
|
4207
|
-
/* @__PURE__ */
|
|
4208
|
-
/* @__PURE__ */
|
|
4472
|
+
/* @__PURE__ */ jsx22("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4473
|
+
/* @__PURE__ */ jsx22(
|
|
4209
4474
|
"button",
|
|
4210
4475
|
{
|
|
4211
4476
|
type: "button",
|
|
@@ -4215,11 +4480,11 @@ var ImageEditor = ({
|
|
|
4215
4480
|
children: "-"
|
|
4216
4481
|
}
|
|
4217
4482
|
),
|
|
4218
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsxs20("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
4219
4484
|
Math.round(state.zoom * 100),
|
|
4220
4485
|
"%"
|
|
4221
4486
|
] }),
|
|
4222
|
-
/* @__PURE__ */
|
|
4487
|
+
/* @__PURE__ */ jsx22(
|
|
4223
4488
|
"button",
|
|
4224
4489
|
{
|
|
4225
4490
|
type: "button",
|
|
@@ -4229,8 +4494,8 @@ var ImageEditor = ({
|
|
|
4229
4494
|
children: "+"
|
|
4230
4495
|
}
|
|
4231
4496
|
),
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4497
|
+
/* @__PURE__ */ jsx22("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4498
|
+
/* @__PURE__ */ jsx22(
|
|
4234
4499
|
"button",
|
|
4235
4500
|
{
|
|
4236
4501
|
type: "button",
|
|
@@ -4241,7 +4506,7 @@ var ImageEditor = ({
|
|
|
4241
4506
|
children: "Hold Compare"
|
|
4242
4507
|
}
|
|
4243
4508
|
),
|
|
4244
|
-
/* @__PURE__ */
|
|
4509
|
+
/* @__PURE__ */ jsx22(
|
|
4245
4510
|
"button",
|
|
4246
4511
|
{
|
|
4247
4512
|
type: "button",
|
|
@@ -4252,10 +4517,10 @@ var ImageEditor = ({
|
|
|
4252
4517
|
)
|
|
4253
4518
|
] })
|
|
4254
4519
|
] }),
|
|
4255
|
-
transformTool.active && /* @__PURE__ */
|
|
4256
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
4257
|
-
/* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */
|
|
4520
|
+
transformTool.active && /* @__PURE__ */ jsx22(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
4521
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx22("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
4522
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
4523
|
+
/* @__PURE__ */ jsx22(
|
|
4259
4524
|
ImageEditorCanvas,
|
|
4260
4525
|
{
|
|
4261
4526
|
editor,
|
|
@@ -4279,11 +4544,11 @@ var ImageEditor = ({
|
|
|
4279
4544
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
4280
4545
|
}
|
|
4281
4546
|
),
|
|
4282
|
-
/* @__PURE__ */
|
|
4283
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
4284
|
-
/* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4547
|
+
/* @__PURE__ */ jsxs20("div", { className: imageSidebarClass, children: [
|
|
4548
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
4549
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
4550
|
+
/* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
4551
|
+
/* @__PURE__ */ jsx22(
|
|
4287
4552
|
"button",
|
|
4288
4553
|
{
|
|
4289
4554
|
type: "button",
|
|
@@ -4295,7 +4560,7 @@ var ImageEditor = ({
|
|
|
4295
4560
|
children: "Freeform"
|
|
4296
4561
|
}
|
|
4297
4562
|
),
|
|
4298
|
-
/* @__PURE__ */
|
|
4563
|
+
/* @__PURE__ */ jsx22(
|
|
4299
4564
|
"button",
|
|
4300
4565
|
{
|
|
4301
4566
|
type: "button",
|
|
@@ -4307,7 +4572,7 @@ var ImageEditor = ({
|
|
|
4307
4572
|
children: "1:1 Square"
|
|
4308
4573
|
}
|
|
4309
4574
|
),
|
|
4310
|
-
/* @__PURE__ */
|
|
4575
|
+
/* @__PURE__ */ jsx22(
|
|
4311
4576
|
"button",
|
|
4312
4577
|
{
|
|
4313
4578
|
type: "button",
|
|
@@ -4319,7 +4584,7 @@ var ImageEditor = ({
|
|
|
4319
4584
|
children: "4:3 Standard"
|
|
4320
4585
|
}
|
|
4321
4586
|
),
|
|
4322
|
-
/* @__PURE__ */
|
|
4587
|
+
/* @__PURE__ */ jsx22(
|
|
4323
4588
|
"button",
|
|
4324
4589
|
{
|
|
4325
4590
|
type: "button",
|
|
@@ -4331,7 +4596,7 @@ var ImageEditor = ({
|
|
|
4331
4596
|
children: "16:9 Wide"
|
|
4332
4597
|
}
|
|
4333
4598
|
),
|
|
4334
|
-
/* @__PURE__ */
|
|
4599
|
+
/* @__PURE__ */ jsx22(
|
|
4335
4600
|
"button",
|
|
4336
4601
|
{
|
|
4337
4602
|
type: "button",
|
|
@@ -4343,7 +4608,7 @@ var ImageEditor = ({
|
|
|
4343
4608
|
children: "3:2 Photo"
|
|
4344
4609
|
}
|
|
4345
4610
|
),
|
|
4346
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsx22(
|
|
4347
4612
|
"button",
|
|
4348
4613
|
{
|
|
4349
4614
|
type: "button",
|
|
@@ -4356,10 +4621,10 @@ var ImageEditor = ({
|
|
|
4356
4621
|
}
|
|
4357
4622
|
)
|
|
4358
4623
|
] }),
|
|
4359
|
-
/* @__PURE__ */
|
|
4360
|
-
/* @__PURE__ */
|
|
4361
|
-
/* @__PURE__ */
|
|
4362
|
-
/* @__PURE__ */
|
|
4624
|
+
/* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
|
|
4625
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
4626
|
+
/* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4627
|
+
/* @__PURE__ */ jsx22(
|
|
4363
4628
|
"button",
|
|
4364
4629
|
{
|
|
4365
4630
|
type: "button",
|
|
@@ -4368,7 +4633,7 @@ var ImageEditor = ({
|
|
|
4368
4633
|
children: "Rotate -90\xB0"
|
|
4369
4634
|
}
|
|
4370
4635
|
),
|
|
4371
|
-
/* @__PURE__ */
|
|
4636
|
+
/* @__PURE__ */ jsx22(
|
|
4372
4637
|
"button",
|
|
4373
4638
|
{
|
|
4374
4639
|
type: "button",
|
|
@@ -4377,7 +4642,7 @@ var ImageEditor = ({
|
|
|
4377
4642
|
children: "Rotate +90\xB0"
|
|
4378
4643
|
}
|
|
4379
4644
|
),
|
|
4380
|
-
/* @__PURE__ */
|
|
4645
|
+
/* @__PURE__ */ jsx22(
|
|
4381
4646
|
"button",
|
|
4382
4647
|
{
|
|
4383
4648
|
type: "button",
|
|
@@ -4386,7 +4651,7 @@ var ImageEditor = ({
|
|
|
4386
4651
|
children: "Flip Horizontal"
|
|
4387
4652
|
}
|
|
4388
4653
|
),
|
|
4389
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ jsx22(
|
|
4390
4655
|
"button",
|
|
4391
4656
|
{
|
|
4392
4657
|
type: "button",
|
|
@@ -4397,10 +4662,10 @@ var ImageEditor = ({
|
|
|
4397
4662
|
)
|
|
4398
4663
|
] })
|
|
4399
4664
|
] }),
|
|
4400
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
/* @__PURE__ */
|
|
4665
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4666
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
|
|
4667
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
4668
|
+
/* @__PURE__ */ jsx22(
|
|
4404
4669
|
"button",
|
|
4405
4670
|
{
|
|
4406
4671
|
type: "button",
|
|
@@ -4410,9 +4675,9 @@ var ImageEditor = ({
|
|
|
4410
4675
|
}
|
|
4411
4676
|
)
|
|
4412
4677
|
] }),
|
|
4413
|
-
/* @__PURE__ */
|
|
4414
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
4415
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__PURE__ */ jsx22(Histogram, { histogram: editor.histogram }),
|
|
4679
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs20(React17.Fragment, { children: [
|
|
4680
|
+
/* @__PURE__ */ jsx22(
|
|
4416
4681
|
ControlSlider,
|
|
4417
4682
|
{
|
|
4418
4683
|
spec,
|
|
@@ -4421,14 +4686,14 @@ var ImageEditor = ({
|
|
|
4421
4686
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
4422
4687
|
}
|
|
4423
4688
|
),
|
|
4424
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
4689
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs20(
|
|
4425
4690
|
"div",
|
|
4426
4691
|
{
|
|
4427
4692
|
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",
|
|
4428
4693
|
"data-testid": "image-editor-process-notice",
|
|
4429
4694
|
children: [
|
|
4430
|
-
/* @__PURE__ */
|
|
4431
|
-
/* @__PURE__ */
|
|
4695
|
+
/* @__PURE__ */ jsx22("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
4696
|
+
/* @__PURE__ */ jsx22(
|
|
4432
4697
|
"button",
|
|
4433
4698
|
{
|
|
4434
4699
|
type: "button",
|
|
@@ -4441,7 +4706,7 @@ var ImageEditor = ({
|
|
|
4441
4706
|
}
|
|
4442
4707
|
)
|
|
4443
4708
|
] }, spec.id)),
|
|
4444
|
-
/* @__PURE__ */
|
|
4709
|
+
/* @__PURE__ */ jsx22("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx22(
|
|
4445
4710
|
AdjustmentLayersPanel,
|
|
4446
4711
|
{
|
|
4447
4712
|
controller,
|
|
@@ -4450,9 +4715,9 @@ var ImageEditor = ({
|
|
|
4450
4715
|
}
|
|
4451
4716
|
) })
|
|
4452
4717
|
] }),
|
|
4453
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
4454
|
-
/* @__PURE__ */
|
|
4455
|
-
/* @__PURE__ */
|
|
4718
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4719
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
4720
|
+
/* @__PURE__ */ jsx22(
|
|
4456
4721
|
"button",
|
|
4457
4722
|
{
|
|
4458
4723
|
type: "button",
|
|
@@ -4463,15 +4728,15 @@ var ImageEditor = ({
|
|
|
4463
4728
|
children: "Free Transform"
|
|
4464
4729
|
}
|
|
4465
4730
|
),
|
|
4466
|
-
/* @__PURE__ */
|
|
4467
|
-
effectsShown && /* @__PURE__ */
|
|
4468
|
-
/* @__PURE__ */
|
|
4469
|
-
/* @__PURE__ */
|
|
4731
|
+
/* @__PURE__ */ jsx22(LayersPanel, { controller }),
|
|
4732
|
+
effectsShown && /* @__PURE__ */ jsx22(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
4733
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
4734
|
+
/* @__PURE__ */ jsx22(ColorProfilePanel, { controller })
|
|
4470
4735
|
] }),
|
|
4471
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
4472
|
-
/* @__PURE__ */
|
|
4473
|
-
/* @__PURE__ */
|
|
4474
|
-
/* @__PURE__ */
|
|
4736
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4737
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
4738
|
+
/* @__PURE__ */ jsx22(BrushOptionsBar, { controller }),
|
|
4739
|
+
/* @__PURE__ */ jsx22(
|
|
4475
4740
|
"button",
|
|
4476
4741
|
{
|
|
4477
4742
|
type: "button",
|
|
@@ -4482,12 +4747,12 @@ var ImageEditor = ({
|
|
|
4482
4747
|
children: "Free Transform"
|
|
4483
4748
|
}
|
|
4484
4749
|
),
|
|
4485
|
-
paintError && /* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4750
|
+
paintError && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
4751
|
+
/* @__PURE__ */ jsx22("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx22(LayersPanel, { controller }) })
|
|
4487
4752
|
] }),
|
|
4488
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
4489
|
-
/* @__PURE__ */
|
|
4490
|
-
/* @__PURE__ */
|
|
4753
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4754
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
4755
|
+
/* @__PURE__ */ jsx22("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx22(
|
|
4491
4756
|
"button",
|
|
4492
4757
|
{
|
|
4493
4758
|
type: "button",
|
|
@@ -4498,13 +4763,13 @@ var ImageEditor = ({
|
|
|
4498
4763
|
},
|
|
4499
4764
|
t
|
|
4500
4765
|
)) }),
|
|
4501
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
4502
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
4503
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
4504
|
-
shapeTypeError && /* @__PURE__ */
|
|
4505
|
-
/* @__PURE__ */
|
|
4506
|
-
/* @__PURE__ */
|
|
4507
|
-
/* @__PURE__ */
|
|
4766
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx22(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
4767
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx22(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
4768
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx22("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" }),
|
|
4769
|
+
shapeTypeError && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
4770
|
+
/* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
|
|
4771
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
4772
|
+
/* @__PURE__ */ jsx22("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx22(
|
|
4508
4773
|
"button",
|
|
4509
4774
|
{
|
|
4510
4775
|
type: "button",
|
|
@@ -4514,18 +4779,18 @@ var ImageEditor = ({
|
|
|
4514
4779
|
},
|
|
4515
4780
|
t
|
|
4516
4781
|
)) }),
|
|
4517
|
-
/* @__PURE__ */
|
|
4518
|
-
/* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
/* @__PURE__ */
|
|
4523
|
-
/* @__PURE__ */
|
|
4782
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
4783
|
+
/* @__PURE__ */ jsx22("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
4784
|
+
/* @__PURE__ */ jsx22(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
4785
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex-1 ml-2", children: [
|
|
4786
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
4787
|
+
/* @__PURE__ */ jsx22("span", { children: "Width:" }),
|
|
4788
|
+
/* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
|
|
4524
4789
|
strokeWidth,
|
|
4525
4790
|
"px"
|
|
4526
4791
|
] })
|
|
4527
4792
|
] }),
|
|
4528
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ jsx22(
|
|
4529
4794
|
"input",
|
|
4530
4795
|
{
|
|
4531
4796
|
type: "range",
|
|
@@ -4538,10 +4803,10 @@ var ImageEditor = ({
|
|
|
4538
4803
|
)
|
|
4539
4804
|
] })
|
|
4540
4805
|
] }),
|
|
4541
|
-
/* @__PURE__ */
|
|
4542
|
-
/* @__PURE__ */
|
|
4543
|
-
/* @__PURE__ */
|
|
4544
|
-
/* @__PURE__ */
|
|
4806
|
+
/* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
|
|
4807
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
4808
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
|
|
4809
|
+
/* @__PURE__ */ jsx22(
|
|
4545
4810
|
"input",
|
|
4546
4811
|
{
|
|
4547
4812
|
type: "text",
|
|
@@ -4552,7 +4817,7 @@ var ImageEditor = ({
|
|
|
4552
4817
|
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"
|
|
4553
4818
|
}
|
|
4554
4819
|
),
|
|
4555
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsx22(
|
|
4556
4821
|
"button",
|
|
4557
4822
|
{
|
|
4558
4823
|
type: "button",
|
|
@@ -4562,14 +4827,14 @@ var ImageEditor = ({
|
|
|
4562
4827
|
}
|
|
4563
4828
|
)
|
|
4564
4829
|
] }),
|
|
4565
|
-
/* @__PURE__ */
|
|
4566
|
-
/* @__PURE__ */
|
|
4567
|
-
/* @__PURE__ */
|
|
4830
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
4831
|
+
/* @__PURE__ */ jsx22("span", { children: "Font Size:" }),
|
|
4832
|
+
/* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
|
|
4568
4833
|
fontSize,
|
|
4569
4834
|
"px"
|
|
4570
4835
|
] })
|
|
4571
4836
|
] }),
|
|
4572
|
-
/* @__PURE__ */
|
|
4837
|
+
/* @__PURE__ */ jsx22(
|
|
4573
4838
|
"input",
|
|
4574
4839
|
{
|
|
4575
4840
|
type: "range",
|
|
@@ -4580,14 +4845,14 @@ var ImageEditor = ({
|
|
|
4580
4845
|
className: imageRangeClass
|
|
4581
4846
|
}
|
|
4582
4847
|
),
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4848
|
+
/* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
|
|
4849
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
|
|
4850
|
+
/* @__PURE__ */ jsxs20("span", { className: "text-muted-foreground", children: [
|
|
4586
4851
|
"Layers (",
|
|
4587
4852
|
state.annotations.length,
|
|
4588
4853
|
")"
|
|
4589
4854
|
] }),
|
|
4590
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
4855
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx22(
|
|
4591
4856
|
"button",
|
|
4592
4857
|
{
|
|
4593
4858
|
type: "button",
|
|
@@ -4596,7 +4861,7 @@ var ImageEditor = ({
|
|
|
4596
4861
|
children: "Delete Selected"
|
|
4597
4862
|
}
|
|
4598
4863
|
),
|
|
4599
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
4864
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx22(
|
|
4600
4865
|
"button",
|
|
4601
4866
|
{
|
|
4602
4867
|
type: "button",
|
|
@@ -4607,10 +4872,10 @@ var ImageEditor = ({
|
|
|
4607
4872
|
)
|
|
4608
4873
|
] })
|
|
4609
4874
|
] }),
|
|
4610
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
4611
|
-
/* @__PURE__ */
|
|
4612
|
-
/* @__PURE__ */
|
|
4613
|
-
/* @__PURE__ */
|
|
4875
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4876
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
|
|
4877
|
+
/* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
4878
|
+
/* @__PURE__ */ jsx22(
|
|
4614
4879
|
"button",
|
|
4615
4880
|
{
|
|
4616
4881
|
type: "button",
|
|
@@ -4620,8 +4885,8 @@ var ImageEditor = ({
|
|
|
4620
4885
|
}
|
|
4621
4886
|
)
|
|
4622
4887
|
] }),
|
|
4623
|
-
/* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4888
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
4889
|
+
/* @__PURE__ */ jsx22(
|
|
4625
4890
|
"input",
|
|
4626
4891
|
{
|
|
4627
4892
|
type: "checkbox",
|
|
@@ -4630,12 +4895,12 @@ var ImageEditor = ({
|
|
|
4630
4895
|
className: "rounded accent-primary"
|
|
4631
4896
|
}
|
|
4632
4897
|
),
|
|
4633
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ jsx22("span", { children: "Enable Depth / Alpha Mask" })
|
|
4634
4899
|
] }),
|
|
4635
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4638
|
-
/* @__PURE__ */
|
|
4900
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
4901
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4902
|
+
/* @__PURE__ */ jsx22("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
4903
|
+
/* @__PURE__ */ jsx22(
|
|
4639
4904
|
"input",
|
|
4640
4905
|
{
|
|
4641
4906
|
type: "text",
|
|
@@ -4646,8 +4911,8 @@ var ImageEditor = ({
|
|
|
4646
4911
|
}
|
|
4647
4912
|
)
|
|
4648
4913
|
] }),
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4914
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
|
|
4915
|
+
/* @__PURE__ */ jsx22(
|
|
4651
4916
|
"button",
|
|
4652
4917
|
{
|
|
4653
4918
|
type: "button",
|
|
@@ -4656,7 +4921,7 @@ var ImageEditor = ({
|
|
|
4656
4921
|
children: "Threshold Mode"
|
|
4657
4922
|
}
|
|
4658
4923
|
),
|
|
4659
|
-
/* @__PURE__ */
|
|
4924
|
+
/* @__PURE__ */ jsx22(
|
|
4660
4925
|
"button",
|
|
4661
4926
|
{
|
|
4662
4927
|
type: "button",
|
|
@@ -4666,12 +4931,12 @@ var ImageEditor = ({
|
|
|
4666
4931
|
}
|
|
4667
4932
|
)
|
|
4668
4933
|
] }),
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
/* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4934
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4935
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
4936
|
+
/* @__PURE__ */ jsx22("span", { children: "Depth Start (Lower):" }),
|
|
4937
|
+
/* @__PURE__ */ jsx22("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
4673
4938
|
] }),
|
|
4674
|
-
/* @__PURE__ */
|
|
4939
|
+
/* @__PURE__ */ jsx22(
|
|
4675
4940
|
"input",
|
|
4676
4941
|
{
|
|
4677
4942
|
type: "range",
|
|
@@ -4685,12 +4950,12 @@ var ImageEditor = ({
|
|
|
4685
4950
|
}
|
|
4686
4951
|
)
|
|
4687
4952
|
] }),
|
|
4688
|
-
/* @__PURE__ */
|
|
4689
|
-
/* @__PURE__ */
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4954
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
4955
|
+
/* @__PURE__ */ jsx22("span", { children: "Depth Stop (Upper):" }),
|
|
4956
|
+
/* @__PURE__ */ jsx22("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
4692
4957
|
] }),
|
|
4693
|
-
/* @__PURE__ */
|
|
4958
|
+
/* @__PURE__ */ jsx22(
|
|
4694
4959
|
"input",
|
|
4695
4960
|
{
|
|
4696
4961
|
type: "range",
|
|
@@ -4704,12 +4969,12 @@ var ImageEditor = ({
|
|
|
4704
4969
|
}
|
|
4705
4970
|
)
|
|
4706
4971
|
] }),
|
|
4707
|
-
/* @__PURE__ */
|
|
4708
|
-
/* @__PURE__ */
|
|
4709
|
-
/* @__PURE__ */
|
|
4710
|
-
/* @__PURE__ */
|
|
4972
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4973
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
4974
|
+
/* @__PURE__ */ jsx22("span", { children: "Softness:" }),
|
|
4975
|
+
/* @__PURE__ */ jsx22("span", { className: "font-mono", children: state.depthMask.softness })
|
|
4711
4976
|
] }),
|
|
4712
|
-
/* @__PURE__ */
|
|
4977
|
+
/* @__PURE__ */ jsx22(
|
|
4713
4978
|
"input",
|
|
4714
4979
|
{
|
|
4715
4980
|
type: "range",
|
|
@@ -4721,8 +4986,8 @@ var ImageEditor = ({
|
|
|
4721
4986
|
}
|
|
4722
4987
|
)
|
|
4723
4988
|
] }),
|
|
4724
|
-
/* @__PURE__ */
|
|
4725
|
-
/* @__PURE__ */
|
|
4989
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
4990
|
+
/* @__PURE__ */ jsx22(
|
|
4726
4991
|
"input",
|
|
4727
4992
|
{
|
|
4728
4993
|
type: "checkbox",
|
|
@@ -4731,12 +4996,12 @@ var ImageEditor = ({
|
|
|
4731
4996
|
className: "rounded accent-primary"
|
|
4732
4997
|
}
|
|
4733
4998
|
),
|
|
4734
|
-
/* @__PURE__ */
|
|
4999
|
+
/* @__PURE__ */ jsx22("span", { children: "Invert Mask" })
|
|
4735
5000
|
] })
|
|
4736
5001
|
] })
|
|
4737
5002
|
] }),
|
|
4738
|
-
activeTab === "select" && /* @__PURE__ */
|
|
4739
|
-
/* @__PURE__ */
|
|
5003
|
+
activeTab === "select" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5004
|
+
/* @__PURE__ */ jsx22(
|
|
4740
5005
|
SelectionOptionsBar,
|
|
4741
5006
|
{
|
|
4742
5007
|
controller,
|
|
@@ -4747,9 +5012,9 @@ var ImageEditor = ({
|
|
|
4747
5012
|
selectionDisplay: state.selectionDisplay
|
|
4748
5013
|
}
|
|
4749
5014
|
),
|
|
4750
|
-
selectionError && /* @__PURE__ */
|
|
4751
|
-
/* @__PURE__ */
|
|
4752
|
-
/* @__PURE__ */
|
|
5015
|
+
selectionError && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5016
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
|
|
5017
|
+
/* @__PURE__ */ jsx22(
|
|
4753
5018
|
"button",
|
|
4754
5019
|
{
|
|
4755
5020
|
type: "button",
|
|
@@ -4760,7 +5025,7 @@ var ImageEditor = ({
|
|
|
4760
5025
|
children: "Transform Selection"
|
|
4761
5026
|
}
|
|
4762
5027
|
),
|
|
4763
|
-
/* @__PURE__ */
|
|
5028
|
+
/* @__PURE__ */ jsx22(
|
|
4764
5029
|
"button",
|
|
4765
5030
|
{
|
|
4766
5031
|
type: "button",
|
|
@@ -4772,13 +5037,13 @@ var ImageEditor = ({
|
|
|
4772
5037
|
}
|
|
4773
5038
|
)
|
|
4774
5039
|
] }),
|
|
4775
|
-
/* @__PURE__ */
|
|
4776
|
-
/* @__PURE__ */
|
|
5040
|
+
/* @__PURE__ */ jsx22(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5041
|
+
/* @__PURE__ */ jsx22(ChannelsPanel, { controller })
|
|
4777
5042
|
] }),
|
|
4778
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
/* @__PURE__ */
|
|
4781
|
-
/* @__PURE__ */
|
|
5043
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5044
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5045
|
+
/* @__PURE__ */ jsx22("span", { children: "Results go to" }),
|
|
5046
|
+
/* @__PURE__ */ jsxs20(
|
|
4782
5047
|
"select",
|
|
4783
5048
|
{
|
|
4784
5049
|
"aria-label": "AI result target",
|
|
@@ -4786,54 +5051,54 @@ var ImageEditor = ({
|
|
|
4786
5051
|
onChange: (e) => setAiTarget(e.target.value),
|
|
4787
5052
|
className: imageSelectClass,
|
|
4788
5053
|
children: [
|
|
4789
|
-
/* @__PURE__ */
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
5054
|
+
/* @__PURE__ */ jsx22("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5055
|
+
/* @__PURE__ */ jsx22("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5056
|
+
/* @__PURE__ */ jsx22("option", { value: "replace", children: "Replace image" })
|
|
4792
5057
|
]
|
|
4793
5058
|
}
|
|
4794
5059
|
)
|
|
4795
5060
|
] }),
|
|
4796
|
-
/* @__PURE__ */
|
|
4797
|
-
/* @__PURE__ */
|
|
4798
|
-
/* @__PURE__ */
|
|
4799
|
-
/* @__PURE__ */
|
|
5061
|
+
/* @__PURE__ */ jsxs20("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5062
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
|
|
5063
|
+
/* @__PURE__ */ jsxs20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5064
|
+
/* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
|
|
4800
5065
|
"Background Removal"
|
|
4801
5066
|
] }),
|
|
4802
|
-
isRemovingBg && /* @__PURE__ */
|
|
5067
|
+
isRemovingBg && /* @__PURE__ */ jsx22("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..." })
|
|
4803
5068
|
] }),
|
|
4804
|
-
/* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
5069
|
+
/* @__PURE__ */ jsx22("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5070
|
+
/* @__PURE__ */ jsx22(
|
|
4806
5071
|
"button",
|
|
4807
5072
|
{
|
|
4808
5073
|
type: "button",
|
|
4809
5074
|
onClick: handleRemoveBackground,
|
|
4810
5075
|
disabled: isRemovingBg || isInpainting,
|
|
4811
5076
|
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",
|
|
4812
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
4813
|
-
/* @__PURE__ */
|
|
5077
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
5078
|
+
/* @__PURE__ */ jsx22("div", { className: imageSpinnerClass }),
|
|
4814
5079
|
"Removing Background..."
|
|
4815
|
-
] }) : /* @__PURE__ */
|
|
4816
|
-
/* @__PURE__ */
|
|
5080
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
5081
|
+
/* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
|
|
4817
5082
|
"Remove Background"
|
|
4818
5083
|
] })
|
|
4819
5084
|
}
|
|
4820
5085
|
)
|
|
4821
5086
|
] }),
|
|
4822
|
-
/* @__PURE__ */
|
|
4823
|
-
/* @__PURE__ */
|
|
4824
|
-
/* @__PURE__ */
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
5087
|
+
/* @__PURE__ */ jsxs20("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5088
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
|
|
5089
|
+
/* @__PURE__ */ jsxs20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5090
|
+
/* @__PURE__ */ jsxs20("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5091
|
+
/* @__PURE__ */ jsx22("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" }),
|
|
5092
|
+
/* @__PURE__ */ jsx22("path", { d: "m14 7 3 3" })
|
|
4828
5093
|
] }),
|
|
4829
5094
|
"Generative Inpainting"
|
|
4830
5095
|
] }),
|
|
4831
|
-
isInpainting && /* @__PURE__ */
|
|
5096
|
+
isInpainting && /* @__PURE__ */ jsx22("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..." })
|
|
4832
5097
|
] }),
|
|
4833
|
-
/* @__PURE__ */
|
|
4834
|
-
/* @__PURE__ */
|
|
4835
|
-
/* @__PURE__ */
|
|
4836
|
-
/* @__PURE__ */
|
|
5098
|
+
/* @__PURE__ */ jsx22("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5099
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
5100
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5101
|
+
/* @__PURE__ */ jsx22(
|
|
4837
5102
|
"textarea",
|
|
4838
5103
|
{
|
|
4839
5104
|
id: "ai-inpaint-prompt-react",
|
|
@@ -4845,10 +5110,10 @@ var ImageEditor = ({
|
|
|
4845
5110
|
}
|
|
4846
5111
|
)
|
|
4847
5112
|
] }),
|
|
4848
|
-
/* @__PURE__ */
|
|
4849
|
-
/* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
5113
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
|
|
5114
|
+
/* @__PURE__ */ jsx22("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5115
|
+
/* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5116
|
+
/* @__PURE__ */ jsxs20(
|
|
4852
5117
|
"button",
|
|
4853
5118
|
{
|
|
4854
5119
|
type: "button",
|
|
@@ -4861,7 +5126,7 @@ var ImageEditor = ({
|
|
|
4861
5126
|
]
|
|
4862
5127
|
}
|
|
4863
5128
|
),
|
|
4864
|
-
/* @__PURE__ */
|
|
5129
|
+
/* @__PURE__ */ jsxs20(
|
|
4865
5130
|
"button",
|
|
4866
5131
|
{
|
|
4867
5132
|
type: "button",
|
|
@@ -4876,25 +5141,25 @@ var ImageEditor = ({
|
|
|
4876
5141
|
)
|
|
4877
5142
|
] })
|
|
4878
5143
|
] }),
|
|
4879
|
-
/* @__PURE__ */
|
|
5144
|
+
/* @__PURE__ */ jsx22(
|
|
4880
5145
|
"button",
|
|
4881
5146
|
{
|
|
4882
5147
|
type: "button",
|
|
4883
5148
|
onClick: handleInpaint,
|
|
4884
5149
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
4885
5150
|
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",
|
|
4886
|
-
children: isInpainting ? /* @__PURE__ */
|
|
4887
|
-
/* @__PURE__ */
|
|
5151
|
+
children: isInpainting ? /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
5152
|
+
/* @__PURE__ */ jsx22("div", { className: imageSpinnerClass }),
|
|
4888
5153
|
"Generating Inpaint..."
|
|
4889
|
-
] }) : /* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
5154
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
5155
|
+
/* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
4891
5156
|
"Apply Inpainting"
|
|
4892
5157
|
] })
|
|
4893
5158
|
}
|
|
4894
5159
|
)
|
|
4895
5160
|
] }),
|
|
4896
|
-
aiError && /* @__PURE__ */
|
|
4897
|
-
aiSuccess && /* @__PURE__ */
|
|
5161
|
+
aiError && /* @__PURE__ */ jsx22("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5162
|
+
aiSuccess && /* @__PURE__ */ jsx22("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
4898
5163
|
] })
|
|
4899
5164
|
] })
|
|
4900
5165
|
] })
|
|
@@ -4925,6 +5190,7 @@ export {
|
|
|
4925
5190
|
PaintGradientEditor,
|
|
4926
5191
|
BrushOptionsBar,
|
|
4927
5192
|
ColorProfilePanel,
|
|
5193
|
+
SelectAndMaskWorkspace,
|
|
4928
5194
|
SelectionOptionsBar,
|
|
4929
5195
|
RefineEdgePanel,
|
|
4930
5196
|
ChannelsPanel,
|