@pixerate/editor-react 0.138.0 → 0.140.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-3BL4QCPE.js → chunk-75P7WMCR.js} +766 -555
- package/dist/image-editor/ContentAwareFillWorkspace.d.cts +20 -0
- package/dist/image-editor/ContentAwareFillWorkspace.d.ts +20 -0
- package/dist/image-editor/index.cjs +788 -576
- 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 +1313 -1101
- 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 React18, { useRef as useRef11, useEffect as useEffect16, useState as useState19 } 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 { useRef as
|
|
2666
|
+
import { useRef as useRef9, useState as useState13 } from "react";
|
|
2667
2667
|
import {
|
|
2668
2668
|
COLOR_RANGE_PRESETS,
|
|
2669
2669
|
COLOR_RANGE_PRESET_LABELS,
|
|
@@ -2759,7 +2759,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2759
2759
|
panFrom.current = null;
|
|
2760
2760
|
session.end();
|
|
2761
2761
|
};
|
|
2762
|
-
const toLayer = settings.output
|
|
2762
|
+
const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
|
|
2763
2763
|
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
2764
2764
|
return /* @__PURE__ */ jsxs13(
|
|
2765
2765
|
"div",
|
|
@@ -2896,7 +2896,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2896
2896
|
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
2897
2897
|
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2898
2898
|
"Decontaminate Colors",
|
|
2899
|
-
toLayer ? "" : " (new layer outputs)"
|
|
2899
|
+
toLayer ? "" : " (new layer or document outputs)"
|
|
2900
2900
|
] }),
|
|
2901
2901
|
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
2902
2902
|
settings.decontaminate,
|
|
@@ -2912,7 +2912,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2912
2912
|
{
|
|
2913
2913
|
label: "Output to",
|
|
2914
2914
|
value: settings.output,
|
|
2915
|
-
options: REFINE_OUTPUTS.map((o) => ({ value: o.id, label: o.label })),
|
|
2915
|
+
options: REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => ({ value: o.id, label: o.label })),
|
|
2916
2916
|
onChange: (v) => set({ output: v })
|
|
2917
2917
|
}
|
|
2918
2918
|
)
|
|
@@ -2934,8 +2934,215 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2934
2934
|
);
|
|
2935
2935
|
};
|
|
2936
2936
|
|
|
2937
|
+
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
2938
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef8, useState as useState12 } from "react";
|
|
2939
|
+
import { CONTENT_AWARE_FILL_SAMPLING, CONTENT_AWARE_FILL_TOOLS, ContentAwareFillSession } from "@pixerate/editor/image-editor";
|
|
2940
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2941
|
+
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";
|
|
2942
|
+
var toggle2 = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
2943
|
+
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
2944
|
+
const session = useMemo5(() => new ContentAwareFillSession(controller), [controller]);
|
|
2945
|
+
const [, setRevision] = useState12(0);
|
|
2946
|
+
const [zoom, setZoom] = useState12(1);
|
|
2947
|
+
const [pan, setPan] = useState12({ x: 0, y: 0 });
|
|
2948
|
+
const [busy, setBusy] = useState12(false);
|
|
2949
|
+
const [error, setError] = useState12(null);
|
|
2950
|
+
const sourceRef = useRef8(null);
|
|
2951
|
+
const previewRef = useRef8(null);
|
|
2952
|
+
const panFrom = useRef8(null);
|
|
2953
|
+
const settings = session.settings;
|
|
2954
|
+
const win = session.window;
|
|
2955
|
+
useEffect11(() => {
|
|
2956
|
+
const off = session.subscribe(() => setRevision(session.revision));
|
|
2957
|
+
void session.open();
|
|
2958
|
+
return () => {
|
|
2959
|
+
off();
|
|
2960
|
+
};
|
|
2961
|
+
}, [session]);
|
|
2962
|
+
useEffect11(() => {
|
|
2963
|
+
if (!win || typeof ImageData === "undefined") return;
|
|
2964
|
+
for (const [canvas, rgba] of [
|
|
2965
|
+
[sourceRef.current, session.renderSource()],
|
|
2966
|
+
[previewRef.current, session.renderPreview()]
|
|
2967
|
+
]) {
|
|
2968
|
+
const ctx = canvas?.getContext?.("2d");
|
|
2969
|
+
if (!canvas || !ctx || !rgba.length) continue;
|
|
2970
|
+
canvas.width = win.width;
|
|
2971
|
+
canvas.height = win.height;
|
|
2972
|
+
ctx.putImageData(new ImageData(rgba, win.width, win.height), 0, 0);
|
|
2973
|
+
}
|
|
2974
|
+
});
|
|
2975
|
+
const set = (changes) => session.update(changes);
|
|
2976
|
+
const ok = async () => {
|
|
2977
|
+
setBusy(true);
|
|
2978
|
+
setError(null);
|
|
2979
|
+
try {
|
|
2980
|
+
onClose(await session.commit());
|
|
2981
|
+
} catch (err) {
|
|
2982
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
2983
|
+
setBusy(false);
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
useEffect11(() => {
|
|
2987
|
+
const onKey = (e) => {
|
|
2988
|
+
const t = e.target;
|
|
2989
|
+
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
2990
|
+
if (e.key === "Escape") onClose(null);
|
|
2991
|
+
else if (e.key === "Enter") void ok();
|
|
2992
|
+
else if (e.ctrlKey || e.metaKey || e.altKey || !session.handleKey(e.key)) return;
|
|
2993
|
+
e.preventDefault();
|
|
2994
|
+
};
|
|
2995
|
+
window.addEventListener("keydown", onKey);
|
|
2996
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
2997
|
+
});
|
|
2998
|
+
const toImage = (e) => {
|
|
2999
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
3000
|
+
const w = win ?? { x: 0, y: 0, width: 1, height: 1 };
|
|
3001
|
+
return { x: w.x + (e.clientX - rect.left) / Math.max(1, rect.width) * w.width, y: w.y + (e.clientY - rect.top) / Math.max(1, rect.height) * w.height };
|
|
3002
|
+
};
|
|
3003
|
+
const onDown = (e) => {
|
|
3004
|
+
if (settings.tool === "hand") {
|
|
3005
|
+
panFrom.current = { x: e.clientX, y: e.clientY, pan };
|
|
3006
|
+
return;
|
|
3007
|
+
}
|
|
3008
|
+
if (settings.tool === "zoom") {
|
|
3009
|
+
setZoom((z) => Math.min(16, Math.max(0.25, e.altKey ? z / 1.25 : z * 1.25)));
|
|
3010
|
+
return;
|
|
3011
|
+
}
|
|
3012
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
3013
|
+
session.begin(toImage(e), { altKey: e.altKey });
|
|
3014
|
+
};
|
|
3015
|
+
const onMove = (e) => {
|
|
3016
|
+
if (panFrom.current) {
|
|
3017
|
+
const p = panFrom.current;
|
|
3018
|
+
setPan({ x: p.pan.x + e.clientX - p.x, y: p.pan.y + e.clientY - p.y });
|
|
3019
|
+
return;
|
|
3020
|
+
}
|
|
3021
|
+
if (e.buttons) session.move(toImage(e));
|
|
3022
|
+
};
|
|
3023
|
+
const onUp = () => {
|
|
3024
|
+
panFrom.current = null;
|
|
3025
|
+
session.end();
|
|
3026
|
+
};
|
|
3027
|
+
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
3028
|
+
return /* @__PURE__ */ jsxs14("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
|
|
3029
|
+
/* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx16("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
3030
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
3031
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
3032
|
+
settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
3033
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3034
|
+
"Size",
|
|
3035
|
+
/* @__PURE__ */ jsx16(
|
|
3036
|
+
"input",
|
|
3037
|
+
{
|
|
3038
|
+
type: "number",
|
|
3039
|
+
min: 1,
|
|
3040
|
+
"aria-label": "Sampling brush size",
|
|
3041
|
+
value: settings.brushSize,
|
|
3042
|
+
onChange: (e) => set({ brushSize: Math.max(1, Number(e.target.value) || 1) }),
|
|
3043
|
+
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
3044
|
+
}
|
|
3045
|
+
),
|
|
3046
|
+
"px"
|
|
3047
|
+
] }),
|
|
3048
|
+
/* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
|
|
3049
|
+
/* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
3050
|
+
/* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
3051
|
+
] })
|
|
3052
|
+
] }),
|
|
3053
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono text-muted-foreground", children: [
|
|
3054
|
+
Math.round(zoom * 100),
|
|
3055
|
+
"%"
|
|
3056
|
+
] }),
|
|
3057
|
+
session.computing && /* @__PURE__ */ jsx16("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
3058
|
+
] }),
|
|
3059
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
3060
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col min-h-0", children: [
|
|
3061
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
|
|
3062
|
+
/* @__PURE__ */ jsx16("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx16(
|
|
3063
|
+
"canvas",
|
|
3064
|
+
{
|
|
3065
|
+
ref: sourceRef,
|
|
3066
|
+
"data-testid": "content-aware-fill-source",
|
|
3067
|
+
onPointerDown: onDown,
|
|
3068
|
+
onPointerMove: onMove,
|
|
3069
|
+
onPointerUp: onUp,
|
|
3070
|
+
style: { ...view, cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair" }
|
|
3071
|
+
}
|
|
3072
|
+
) })
|
|
3073
|
+
] }),
|
|
3074
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col min-h-0", children: [
|
|
3075
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Preview" }),
|
|
3076
|
+
/* @__PURE__ */ jsx16("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx16("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
|
|
3077
|
+
] })
|
|
3078
|
+
] })
|
|
3079
|
+
] }),
|
|
3080
|
+
/* @__PURE__ */ jsxs14("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
3081
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
3082
|
+
/* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
|
|
3083
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
3084
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
3085
|
+
"Show Sampling Area"
|
|
3086
|
+
] }),
|
|
3087
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3088
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3089
|
+
/* @__PURE__ */ jsx16("span", { children: "Opacity" }),
|
|
3090
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
3091
|
+
Math.round(settings.opacity * 100),
|
|
3092
|
+
"%"
|
|
3093
|
+
] })
|
|
3094
|
+
] }),
|
|
3095
|
+
/* @__PURE__ */ jsx16(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
3096
|
+
] }),
|
|
3097
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
|
|
3098
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3099
|
+
"Seed",
|
|
3100
|
+
/* @__PURE__ */ jsx16(
|
|
3101
|
+
"input",
|
|
3102
|
+
{
|
|
3103
|
+
type: "number",
|
|
3104
|
+
min: 0,
|
|
3105
|
+
"aria-label": "Fill seed",
|
|
3106
|
+
value: settings.seed,
|
|
3107
|
+
onChange: (e) => set({ seed: Math.max(0, Math.round(Number(e.target.value) || 0)) }),
|
|
3108
|
+
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
3109
|
+
}
|
|
3110
|
+
),
|
|
3111
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button2, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
|
|
3112
|
+
] }),
|
|
3113
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
3114
|
+
/* @__PURE__ */ jsx16(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
|
|
3115
|
+
"Live Preview"
|
|
3116
|
+
] }),
|
|
3117
|
+
!settings.livePreview && /* @__PURE__ */ jsx16("button", { type: "button", className: button2, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
|
|
3118
|
+
/* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3119
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
|
|
3120
|
+
"Output To",
|
|
3121
|
+
/* @__PURE__ */ jsx16(
|
|
3122
|
+
ImageSelect,
|
|
3123
|
+
{
|
|
3124
|
+
label: "Fill output",
|
|
3125
|
+
value: settings.output,
|
|
3126
|
+
options: [
|
|
3127
|
+
{ value: "new-layer", label: "New Layer" },
|
|
3128
|
+
{ value: "current", label: "Current Layer" }
|
|
3129
|
+
],
|
|
3130
|
+
onChange: (v) => set({ output: v })
|
|
3131
|
+
}
|
|
3132
|
+
)
|
|
3133
|
+
] }),
|
|
3134
|
+
(error ?? session.error) && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3135
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1 mt-auto", children: [
|
|
3136
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
|
|
3137
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
|
|
3138
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
3139
|
+
] })
|
|
3140
|
+
] })
|
|
3141
|
+
] });
|
|
3142
|
+
};
|
|
3143
|
+
|
|
2937
3144
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
2938
|
-
import { jsx as
|
|
3145
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2939
3146
|
var MODIFY_OPS = [
|
|
2940
3147
|
{ op: "expand", label: "Expand" },
|
|
2941
3148
|
{ op: "contract", label: "Contract" },
|
|
@@ -2959,15 +3166,15 @@ var SelectionOptionsBar = ({
|
|
|
2959
3166
|
selectionDisplay,
|
|
2960
3167
|
className = ""
|
|
2961
3168
|
}) => {
|
|
2962
|
-
const [radius, setRadius] =
|
|
3169
|
+
const [radius, setRadius] = useState13(2);
|
|
2963
3170
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
2964
3171
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
2965
3172
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
2966
|
-
const [preset, setPreset] =
|
|
2967
|
-
const [rangeStatus, setRangeStatus] =
|
|
2968
|
-
const [colorStatus, setColorStatus] =
|
|
2969
|
-
const [strokeWidth, setStrokeWidth] =
|
|
2970
|
-
const [strokeLocation, setStrokeLocation] =
|
|
3173
|
+
const [preset, setPreset] = useState13("reds");
|
|
3174
|
+
const [rangeStatus, setRangeStatus] = useState13(null);
|
|
3175
|
+
const [colorStatus, setColorStatus] = useState13(null);
|
|
3176
|
+
const [strokeWidth, setStrokeWidth] = useState13(4);
|
|
3177
|
+
const [strokeLocation, setStrokeLocation] = useState13("outside");
|
|
2971
3178
|
const edit = (fn) => {
|
|
2972
3179
|
setColorStatus(null);
|
|
2973
3180
|
try {
|
|
@@ -3000,8 +3207,8 @@ var SelectionOptionsBar = ({
|
|
|
3000
3207
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
3001
3208
|
}
|
|
3002
3209
|
};
|
|
3003
|
-
const [task, setTask] =
|
|
3004
|
-
const taskAbort =
|
|
3210
|
+
const [task, setTask] = useState13(null);
|
|
3211
|
+
const taskAbort = useRef9(null);
|
|
3005
3212
|
const tracked = () => {
|
|
3006
3213
|
const abort = new AbortController();
|
|
3007
3214
|
taskAbort.current = abort;
|
|
@@ -3013,9 +3220,9 @@ var SelectionOptionsBar = ({
|
|
|
3013
3220
|
setTask(null);
|
|
3014
3221
|
};
|
|
3015
3222
|
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
3016
|
-
const [subject, setSubject] =
|
|
3017
|
-
const [segmenting, setSegmenting] =
|
|
3018
|
-
const [subjectStatus, setSubjectStatus] =
|
|
3223
|
+
const [subject, setSubject] = useState13("");
|
|
3224
|
+
const [segmenting, setSegmenting] = useState13(false);
|
|
3225
|
+
const [subjectStatus, setSubjectStatus] = useState13(null);
|
|
3019
3226
|
const selectSubject = async () => {
|
|
3020
3227
|
const target = subject.trim();
|
|
3021
3228
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -3032,9 +3239,10 @@ var SelectionOptionsBar = ({
|
|
|
3032
3239
|
setSegmenting(false);
|
|
3033
3240
|
}
|
|
3034
3241
|
};
|
|
3035
|
-
const [workspace, setWorkspace] =
|
|
3036
|
-
const [
|
|
3037
|
-
const [
|
|
3242
|
+
const [workspace, setWorkspace] = useState13(false);
|
|
3243
|
+
const [fillWorkspace, setFillWorkspace] = useState13(false);
|
|
3244
|
+
const [skying, setSkying] = useState13(false);
|
|
3245
|
+
const [skyStatus, setSkyStatus] = useState13(null);
|
|
3038
3246
|
const selectSky = async () => {
|
|
3039
3247
|
if (skying) return;
|
|
3040
3248
|
setSkying(true);
|
|
@@ -3049,8 +3257,8 @@ var SelectionOptionsBar = ({
|
|
|
3049
3257
|
setSkying(false);
|
|
3050
3258
|
}
|
|
3051
3259
|
};
|
|
3052
|
-
const [focusing, setFocusing] =
|
|
3053
|
-
const [focusStatus, setFocusStatus] =
|
|
3260
|
+
const [focusing, setFocusing] = useState13(false);
|
|
3261
|
+
const [focusStatus, setFocusStatus] = useState13(null);
|
|
3054
3262
|
const selectFocusArea = async () => {
|
|
3055
3263
|
if (focusing) return;
|
|
3056
3264
|
setFocusing(true);
|
|
@@ -3071,24 +3279,24 @@ var SelectionOptionsBar = ({
|
|
|
3071
3279
|
setFocusing(false);
|
|
3072
3280
|
}
|
|
3073
3281
|
};
|
|
3074
|
-
return /* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3076
|
-
/* @__PURE__ */
|
|
3077
|
-
options.tool === "wand" && /* @__PURE__ */
|
|
3078
|
-
/* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3282
|
+
return /* @__PURE__ */ jsxs15("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3283
|
+
/* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx17("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)) }),
|
|
3284
|
+
/* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
3285
|
+
options.tool === "wand" && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2", children: [
|
|
3286
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3287
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3288
|
+
/* @__PURE__ */ jsx17("span", { children: "Tolerance" }),
|
|
3289
|
+
/* @__PURE__ */ jsx17("span", { className: "font-mono", children: options.tolerance })
|
|
3082
3290
|
] }),
|
|
3083
|
-
/* @__PURE__ */
|
|
3291
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
3084
3292
|
] }),
|
|
3085
|
-
/* @__PURE__ */
|
|
3086
|
-
/* @__PURE__ */
|
|
3293
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3294
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
3087
3295
|
"Contiguous"
|
|
3088
3296
|
] }),
|
|
3089
|
-
/* @__PURE__ */
|
|
3297
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3090
3298
|
"Distance",
|
|
3091
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsx17(
|
|
3092
3300
|
ImageSelect,
|
|
3093
3301
|
{
|
|
3094
3302
|
label: "Colour distance",
|
|
@@ -3101,13 +3309,13 @@ var SelectionOptionsBar = ({
|
|
|
3101
3309
|
}
|
|
3102
3310
|
)
|
|
3103
3311
|
] }),
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
/* @__PURE__ */
|
|
3312
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3313
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
3106
3314
|
"Sample adjusted image"
|
|
3107
3315
|
] }),
|
|
3108
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3109
3317
|
"Sample",
|
|
3110
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsx17(
|
|
3111
3319
|
ImageSelect,
|
|
3112
3320
|
{
|
|
3113
3321
|
label: "Sample from",
|
|
@@ -3121,77 +3329,77 @@ var SelectionOptionsBar = ({
|
|
|
3121
3329
|
)
|
|
3122
3330
|
] })
|
|
3123
3331
|
] }),
|
|
3124
|
-
options.tool === "polygon" && /* @__PURE__ */
|
|
3125
|
-
options.tool === "magnetic" && /* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3332
|
+
options.tool === "polygon" && /* @__PURE__ */ jsx17("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." }),
|
|
3333
|
+
options.tool === "magnetic" && /* @__PURE__ */ jsxs15("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
3334
|
+
/* @__PURE__ */ jsx17("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." }),
|
|
3335
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3336
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3337
|
+
/* @__PURE__ */ jsx17("span", { children: "Width" }),
|
|
3338
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3131
3339
|
options.magneticWidth ?? 10,
|
|
3132
3340
|
" px"
|
|
3133
3341
|
] })
|
|
3134
3342
|
] }),
|
|
3135
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
3136
3344
|
] }),
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3346
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3347
|
+
/* @__PURE__ */ jsx17("span", { children: "Contrast" }),
|
|
3348
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3141
3349
|
options.magneticContrast ?? 10,
|
|
3142
3350
|
"%"
|
|
3143
3351
|
] })
|
|
3144
3352
|
] }),
|
|
3145
|
-
/* @__PURE__ */
|
|
3353
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
3146
3354
|
] }),
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3150
|
-
/* @__PURE__ */
|
|
3355
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3356
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3357
|
+
/* @__PURE__ */ jsx17("span", { children: "Frequency" }),
|
|
3358
|
+
/* @__PURE__ */ jsx17("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
3151
3359
|
] }),
|
|
3152
|
-
/* @__PURE__ */
|
|
3360
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
3153
3361
|
] })
|
|
3154
3362
|
] }),
|
|
3155
|
-
options.tool === "quick" && /* @__PURE__ */
|
|
3156
|
-
/* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
/* @__PURE__ */
|
|
3159
|
-
/* @__PURE__ */
|
|
3160
|
-
/* @__PURE__ */
|
|
3363
|
+
options.tool === "quick" && /* @__PURE__ */ jsxs15("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
3364
|
+
/* @__PURE__ */ jsx17("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
3365
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3366
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3367
|
+
/* @__PURE__ */ jsx17("span", { children: "Size" }),
|
|
3368
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3161
3369
|
options.quickSize ?? 30,
|
|
3162
3370
|
" px"
|
|
3163
3371
|
] })
|
|
3164
3372
|
] }),
|
|
3165
|
-
/* @__PURE__ */
|
|
3373
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
3166
3374
|
] }),
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
/* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3376
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
3169
3377
|
"Sample all layers"
|
|
3170
3378
|
] }),
|
|
3171
|
-
/* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3380
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
3173
3381
|
"Auto-enhance edges"
|
|
3174
3382
|
] })
|
|
3175
3383
|
] }),
|
|
3176
|
-
options.tool === "object" && /* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3384
|
+
options.tool === "object" && /* @__PURE__ */ jsxs15("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
3385
|
+
/* @__PURE__ */ jsx17("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
3386
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3387
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
3180
3388
|
"Sample all layers"
|
|
3181
3389
|
] }),
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3390
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3391
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
3184
3392
|
"Auto-enhance edges"
|
|
3185
3393
|
] })
|
|
3186
3394
|
] }),
|
|
3187
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */
|
|
3188
|
-
/* @__PURE__ */
|
|
3395
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs15("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
3396
|
+
/* @__PURE__ */ jsxs15("p", { className: "text-muted-foreground", children: [
|
|
3189
3397
|
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).",
|
|
3190
3398
|
" Shift-click adds, Alt-click subtracts."
|
|
3191
3399
|
] }),
|
|
3192
|
-
/* @__PURE__ */
|
|
3400
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3193
3401
|
"Text",
|
|
3194
|
-
/* @__PURE__ */
|
|
3402
|
+
/* @__PURE__ */ jsx17(
|
|
3195
3403
|
"input",
|
|
3196
3404
|
{
|
|
3197
3405
|
type: "text",
|
|
@@ -3202,9 +3410,9 @@ var SelectionOptionsBar = ({
|
|
|
3202
3410
|
}
|
|
3203
3411
|
)
|
|
3204
3412
|
] }),
|
|
3205
|
-
/* @__PURE__ */
|
|
3413
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3206
3414
|
"Size",
|
|
3207
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsx17(
|
|
3208
3416
|
"input",
|
|
3209
3417
|
{
|
|
3210
3418
|
type: "number",
|
|
@@ -3218,9 +3426,9 @@ var SelectionOptionsBar = ({
|
|
|
3218
3426
|
),
|
|
3219
3427
|
"px"
|
|
3220
3428
|
] }),
|
|
3221
|
-
/* @__PURE__ */
|
|
3429
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3222
3430
|
"Font",
|
|
3223
|
-
/* @__PURE__ */
|
|
3431
|
+
/* @__PURE__ */ jsx17(
|
|
3224
3432
|
"input",
|
|
3225
3433
|
{
|
|
3226
3434
|
type: "text",
|
|
@@ -3232,18 +3440,18 @@ var SelectionOptionsBar = ({
|
|
|
3232
3440
|
)
|
|
3233
3441
|
] })
|
|
3234
3442
|
] }),
|
|
3235
|
-
options.tool === "range" && /* @__PURE__ */
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3239
|
-
/* @__PURE__ */
|
|
3240
|
-
/* @__PURE__ */
|
|
3443
|
+
options.tool === "range" && /* @__PURE__ */ jsxs15("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
3444
|
+
/* @__PURE__ */ jsx17("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
3445
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3446
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3447
|
+
/* @__PURE__ */ jsx17("span", { children: "Fuzziness" }),
|
|
3448
|
+
/* @__PURE__ */ jsx17("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
3241
3449
|
] }),
|
|
3242
|
-
/* @__PURE__ */
|
|
3450
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
3243
3451
|
] }),
|
|
3244
|
-
/* @__PURE__ */
|
|
3452
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3245
3453
|
"Localized radius",
|
|
3246
|
-
/* @__PURE__ */
|
|
3454
|
+
/* @__PURE__ */ jsx17(
|
|
3247
3455
|
"input",
|
|
3248
3456
|
{
|
|
3249
3457
|
type: "number",
|
|
@@ -3257,12 +3465,12 @@ var SelectionOptionsBar = ({
|
|
|
3257
3465
|
),
|
|
3258
3466
|
"px"
|
|
3259
3467
|
] }),
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3469
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
3262
3470
|
"Invert"
|
|
3263
3471
|
] }),
|
|
3264
|
-
/* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3472
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
3473
|
+
/* @__PURE__ */ jsx17(
|
|
3266
3474
|
ImageSelect,
|
|
3267
3475
|
{
|
|
3268
3476
|
label: "Color Range preset",
|
|
@@ -3271,13 +3479,13 @@ var SelectionOptionsBar = ({
|
|
|
3271
3479
|
onChange: (v) => setPreset(v)
|
|
3272
3480
|
}
|
|
3273
3481
|
),
|
|
3274
|
-
/* @__PURE__ */
|
|
3482
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
3275
3483
|
] }),
|
|
3276
|
-
rangeStatus && /* @__PURE__ */
|
|
3484
|
+
rangeStatus && /* @__PURE__ */ jsx17("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
3277
3485
|
] }),
|
|
3278
|
-
/* @__PURE__ */
|
|
3486
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3279
3487
|
"Feather",
|
|
3280
|
-
/* @__PURE__ */
|
|
3488
|
+
/* @__PURE__ */ jsx17(
|
|
3281
3489
|
"input",
|
|
3282
3490
|
{
|
|
3283
3491
|
type: "number",
|
|
@@ -3292,7 +3500,7 @@ var SelectionOptionsBar = ({
|
|
|
3292
3500
|
),
|
|
3293
3501
|
"px"
|
|
3294
3502
|
] }),
|
|
3295
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsxs15(
|
|
3296
3504
|
"form",
|
|
3297
3505
|
{
|
|
3298
3506
|
"data-testid": "select-subject",
|
|
@@ -3302,8 +3510,8 @@ var SelectionOptionsBar = ({
|
|
|
3302
3510
|
void selectSubject();
|
|
3303
3511
|
},
|
|
3304
3512
|
children: [
|
|
3305
|
-
/* @__PURE__ */
|
|
3306
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3513
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1", children: [
|
|
3514
|
+
controller.segmentationProvider && /* @__PURE__ */ jsx17(
|
|
3307
3515
|
"input",
|
|
3308
3516
|
{
|
|
3309
3517
|
type: "text",
|
|
@@ -3315,7 +3523,7 @@ var SelectionOptionsBar = ({
|
|
|
3315
3523
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
3316
3524
|
}
|
|
3317
3525
|
),
|
|
3318
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ jsx17(
|
|
3319
3527
|
"button",
|
|
3320
3528
|
{
|
|
3321
3529
|
type: "submit",
|
|
@@ -3327,12 +3535,12 @@ var SelectionOptionsBar = ({
|
|
|
3327
3535
|
}
|
|
3328
3536
|
)
|
|
3329
3537
|
] }),
|
|
3330
|
-
subjectStatus && /* @__PURE__ */
|
|
3538
|
+
subjectStatus && /* @__PURE__ */ jsx17("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
3331
3539
|
]
|
|
3332
3540
|
}
|
|
3333
3541
|
),
|
|
3334
|
-
task && /* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3542
|
+
task && /* @__PURE__ */ jsxs15("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
3543
|
+
/* @__PURE__ */ jsx17(
|
|
3336
3544
|
"div",
|
|
3337
3545
|
{
|
|
3338
3546
|
role: "progressbar",
|
|
@@ -3341,69 +3549,69 @@ var SelectionOptionsBar = ({
|
|
|
3341
3549
|
"aria-valuemax": 100,
|
|
3342
3550
|
"aria-valuenow": Math.round(task.fraction * 100),
|
|
3343
3551
|
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
3344
|
-
children: /* @__PURE__ */
|
|
3552
|
+
children: /* @__PURE__ */ jsx17("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
3345
3553
|
}
|
|
3346
3554
|
),
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: task.stage }),
|
|
3556
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
3349
3557
|
] }),
|
|
3350
|
-
/* @__PURE__ */
|
|
3351
|
-
workspace && /* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3354
|
-
skyStatus && /* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
3559
|
+
workspace && /* @__PURE__ */ jsx17(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
3560
|
+
/* @__PURE__ */ jsxs15("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
3561
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
3562
|
+
skyStatus && /* @__PURE__ */ jsx17("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
3355
3563
|
] }),
|
|
3356
|
-
/* @__PURE__ */
|
|
3357
|
-
/* @__PURE__ */
|
|
3358
|
-
/* @__PURE__ */
|
|
3359
|
-
/* @__PURE__ */
|
|
3360
|
-
/* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3564
|
+
/* @__PURE__ */ jsxs15("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
3565
|
+
/* @__PURE__ */ jsx17("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
3566
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
3567
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3568
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3569
|
+
/* @__PURE__ */ jsx17("span", { children: "In-focus range" }),
|
|
3570
|
+
/* @__PURE__ */ jsx17("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
3363
3571
|
] }),
|
|
3364
|
-
/* @__PURE__ */
|
|
3572
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
3365
3573
|
] }),
|
|
3366
|
-
/* @__PURE__ */
|
|
3367
|
-
/* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3369
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3575
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3576
|
+
/* @__PURE__ */ jsx17("span", { children: "Image noise level" }),
|
|
3577
|
+
/* @__PURE__ */ jsx17("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
3370
3578
|
] }),
|
|
3371
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
3372
3580
|
] }),
|
|
3373
|
-
/* @__PURE__ */
|
|
3374
|
-
/* @__PURE__ */
|
|
3375
|
-
/* @__PURE__ */
|
|
3376
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
3582
|
+
/* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3583
|
+
/* @__PURE__ */ jsx17("span", { children: "Soften edge" }),
|
|
3584
|
+
/* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
|
|
3377
3585
|
options.focusSoftness ?? 4,
|
|
3378
3586
|
" px"
|
|
3379
3587
|
] })
|
|
3380
3588
|
] }),
|
|
3381
|
-
/* @__PURE__ */
|
|
3589
|
+
/* @__PURE__ */ jsx17(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
3382
3590
|
] }),
|
|
3383
|
-
/* @__PURE__ */
|
|
3384
|
-
focusStatus && /* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
3592
|
+
focusStatus && /* @__PURE__ */ jsx17("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
3385
3593
|
] })
|
|
3386
3594
|
] }),
|
|
3387
|
-
/* @__PURE__ */
|
|
3388
|
-
/* @__PURE__ */
|
|
3595
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3596
|
+
/* @__PURE__ */ jsx17(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
3389
3597
|
"Anti-alias"
|
|
3390
3598
|
] }),
|
|
3391
|
-
/* @__PURE__ */
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
/* @__PURE__ */
|
|
3394
|
-
/* @__PURE__ */
|
|
3395
|
-
/* @__PURE__ */
|
|
3396
|
-
/* @__PURE__ */
|
|
3397
|
-
/* @__PURE__ */
|
|
3599
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1", children: [
|
|
3600
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
3601
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
3602
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
3603
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
3604
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
3605
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
3398
3606
|
] }),
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3401
|
-
DISPLAYS.map((d) => /* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3608
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Show" }),
|
|
3609
|
+
DISPLAYS.map((d) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
3402
3610
|
] }),
|
|
3403
|
-
/* @__PURE__ */
|
|
3404
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3612
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3405
3613
|
"Radius",
|
|
3406
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx17(
|
|
3407
3615
|
"input",
|
|
3408
3616
|
{
|
|
3409
3617
|
type: "number",
|
|
@@ -3417,12 +3625,12 @@ var SelectionOptionsBar = ({
|
|
|
3417
3625
|
}
|
|
3418
3626
|
)
|
|
3419
3627
|
] }),
|
|
3420
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
3628
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
3421
3629
|
] }),
|
|
3422
|
-
/* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3630
|
+
/* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3631
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3424
3632
|
"Stroke",
|
|
3425
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsx17(
|
|
3426
3634
|
"input",
|
|
3427
3635
|
{
|
|
3428
3636
|
type: "number",
|
|
@@ -3437,7 +3645,7 @@ var SelectionOptionsBar = ({
|
|
|
3437
3645
|
),
|
|
3438
3646
|
"px"
|
|
3439
3647
|
] }),
|
|
3440
|
-
/* @__PURE__ */
|
|
3648
|
+
/* @__PURE__ */ jsx17(
|
|
3441
3649
|
ImageSelect,
|
|
3442
3650
|
{
|
|
3443
3651
|
label: "Stroke location",
|
|
@@ -3450,26 +3658,28 @@ var SelectionOptionsBar = ({
|
|
|
3450
3658
|
onChange: (v) => setStrokeLocation(v)
|
|
3451
3659
|
}
|
|
3452
3660
|
),
|
|
3453
|
-
/* @__PURE__ */
|
|
3454
|
-
/* @__PURE__ */
|
|
3455
|
-
/* @__PURE__ */
|
|
3661
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
3662
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
3663
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
|
|
3664
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
|
|
3665
|
+
fillWorkspace && /* @__PURE__ */ jsx17(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
|
|
3456
3666
|
] }),
|
|
3457
|
-
/* @__PURE__ */
|
|
3458
|
-
/* @__PURE__ */
|
|
3459
|
-
/* @__PURE__ */
|
|
3460
|
-
/* @__PURE__ */
|
|
3461
|
-
/* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
/* @__PURE__ */
|
|
3667
|
+
/* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
3668
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
3669
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
3670
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
3671
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
3672
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
3673
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
3674
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
3465
3675
|
] }),
|
|
3466
|
-
colorStatus && /* @__PURE__ */
|
|
3467
|
-
/* @__PURE__ */
|
|
3676
|
+
colorStatus && /* @__PURE__ */ jsx17("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
3677
|
+
/* @__PURE__ */ jsx17("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
|
|
3468
3678
|
] });
|
|
3469
3679
|
};
|
|
3470
3680
|
|
|
3471
3681
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3472
|
-
import { useState as
|
|
3682
|
+
import { useState as useState14 } from "react";
|
|
3473
3683
|
import {
|
|
3474
3684
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3475
3685
|
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
@@ -3477,20 +3687,20 @@ import {
|
|
|
3477
3687
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
3478
3688
|
layerMaskFromSelection
|
|
3479
3689
|
} from "@pixerate/editor/image-editor";
|
|
3480
|
-
import { Fragment as
|
|
3690
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3481
3691
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3482
|
-
var
|
|
3692
|
+
var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
3483
3693
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
3484
|
-
const [params, setParams] =
|
|
3485
|
-
const [busy, setBusy] =
|
|
3486
|
-
const [error, setError] =
|
|
3487
|
-
const [layerId, setLayerId] =
|
|
3488
|
-
const [newKind, setNewKind] =
|
|
3489
|
-
const [output, setOutput] =
|
|
3490
|
-
const [decontaminate, setDecontaminate] =
|
|
3491
|
-
const [objectAware, setObjectAware] =
|
|
3694
|
+
const [params, setParams] = useState14(DEFAULT_PARAMS);
|
|
3695
|
+
const [busy, setBusy] = useState14(false);
|
|
3696
|
+
const [error, setError] = useState14(null);
|
|
3697
|
+
const [layerId, setLayerId] = useState14("");
|
|
3698
|
+
const [newKind, setNewKind] = useState14("hueSaturation");
|
|
3699
|
+
const [output, setOutput] = useState14("selection");
|
|
3700
|
+
const [decontaminate, setDecontaminate] = useState14(0);
|
|
3701
|
+
const [objectAware, setObjectAware] = useState14(false);
|
|
3492
3702
|
const canObject = Boolean(controller.segmentationProvider);
|
|
3493
|
-
const toLayer = output
|
|
3703
|
+
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
3494
3704
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3495
3705
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
3496
3706
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -3508,17 +3718,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3508
3718
|
setBusy(false);
|
|
3509
3719
|
}
|
|
3510
3720
|
};
|
|
3511
|
-
return /* @__PURE__ */
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */
|
|
3515
|
-
/* @__PURE__ */
|
|
3516
|
-
/* @__PURE__ */
|
|
3721
|
+
return /* @__PURE__ */ jsxs16("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3722
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
3723
|
+
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3724
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3725
|
+
/* @__PURE__ */ jsx18("span", { children: c.label }),
|
|
3726
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3517
3727
|
params[c.id],
|
|
3518
3728
|
c.unit
|
|
3519
3729
|
] })
|
|
3520
3730
|
] }),
|
|
3521
|
-
/* @__PURE__ */
|
|
3731
|
+
/* @__PURE__ */ jsx18(
|
|
3522
3732
|
"input",
|
|
3523
3733
|
{
|
|
3524
3734
|
type: "range",
|
|
@@ -3532,39 +3742,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3532
3742
|
}
|
|
3533
3743
|
)
|
|
3534
3744
|
] }, c.id)),
|
|
3535
|
-
/* @__PURE__ */
|
|
3536
|
-
/* @__PURE__ */
|
|
3745
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3746
|
+
/* @__PURE__ */ jsx18("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
3537
3747
|
"Smart Radius"
|
|
3538
3748
|
] }),
|
|
3539
|
-
canObject && /* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3749
|
+
canObject && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3750
|
+
/* @__PURE__ */ jsx18("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
3541
3751
|
"Object aware (segmentation model)"
|
|
3542
3752
|
] }),
|
|
3543
|
-
/* @__PURE__ */
|
|
3753
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3544
3754
|
"Output to",
|
|
3545
|
-
/* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ jsx18(
|
|
3546
3756
|
"select",
|
|
3547
3757
|
{
|
|
3548
3758
|
"aria-label": "Refine output",
|
|
3549
3759
|
value: output,
|
|
3550
3760
|
onChange: (e) => setOutput(e.target.value),
|
|
3551
3761
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3552
|
-
children: REFINE_OUTPUTS2.map((o) => /* @__PURE__ */
|
|
3762
|
+
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx18("option", { value: o.id, children: o.label }, o.id))
|
|
3553
3763
|
}
|
|
3554
3764
|
)
|
|
3555
3765
|
] }),
|
|
3556
|
-
/* @__PURE__ */
|
|
3557
|
-
/* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3766
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3767
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3768
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
3559
3769
|
"Decontaminate colors",
|
|
3560
|
-
toLayer ? "" : " (new layer outputs)"
|
|
3770
|
+
toLayer ? "" : " (new layer or document outputs)"
|
|
3561
3771
|
] }),
|
|
3562
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3563
3773
|
decontaminate,
|
|
3564
3774
|
"%"
|
|
3565
3775
|
] })
|
|
3566
3776
|
] }),
|
|
3567
|
-
/* @__PURE__ */
|
|
3777
|
+
/* @__PURE__ */ jsx18(
|
|
3568
3778
|
"input",
|
|
3569
3779
|
{
|
|
3570
3780
|
type: "range",
|
|
@@ -3579,63 +3789,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3579
3789
|
}
|
|
3580
3790
|
)
|
|
3581
3791
|
] }),
|
|
3582
|
-
/* @__PURE__ */
|
|
3583
|
-
/* @__PURE__ */
|
|
3584
|
-
/* @__PURE__ */
|
|
3792
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1", children: [
|
|
3793
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
3794
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
3585
3795
|
] }),
|
|
3586
|
-
error && /* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
3588
|
-
/* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3796
|
+
error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error }),
|
|
3797
|
+
/* @__PURE__ */ jsx18("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
3798
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1 items-center", children: [
|
|
3799
|
+
/* @__PURE__ */ jsx18(
|
|
3590
3800
|
"select",
|
|
3591
3801
|
{
|
|
3592
3802
|
"aria-label": "New masked layer kind",
|
|
3593
3803
|
value: newKind,
|
|
3594
3804
|
onChange: (e) => setNewKind(e.target.value),
|
|
3595
3805
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3596
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
3806
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx18("option", { value: k.kind, children: k.label }, k.kind))
|
|
3597
3807
|
}
|
|
3598
3808
|
),
|
|
3599
|
-
/* @__PURE__ */
|
|
3809
|
+
/* @__PURE__ */ jsx18(
|
|
3600
3810
|
"button",
|
|
3601
3811
|
{
|
|
3602
3812
|
type: "button",
|
|
3603
|
-
className:
|
|
3813
|
+
className: button3,
|
|
3604
3814
|
disabled: !sel,
|
|
3605
3815
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
3606
3816
|
children: "New Masked Layer"
|
|
3607
3817
|
}
|
|
3608
3818
|
)
|
|
3609
3819
|
] }),
|
|
3610
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
3611
|
-
/* @__PURE__ */
|
|
3820
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
|
|
3821
|
+
/* @__PURE__ */ jsx18(
|
|
3612
3822
|
"select",
|
|
3613
3823
|
{
|
|
3614
3824
|
"aria-label": "Mask layer",
|
|
3615
3825
|
value: target.id,
|
|
3616
3826
|
onChange: (e) => setLayerId(e.target.value),
|
|
3617
3827
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3618
|
-
children: list.map((l) => /* @__PURE__ */
|
|
3828
|
+
children: list.map((l) => /* @__PURE__ */ jsxs16("option", { value: l.id, children: [
|
|
3619
3829
|
l.name || adjustmentKindLabel2(l.kind),
|
|
3620
3830
|
l.mask ? " (masked)" : ""
|
|
3621
3831
|
] }, l.id))
|
|
3622
3832
|
}
|
|
3623
3833
|
),
|
|
3624
|
-
/* @__PURE__ */
|
|
3625
|
-
/* @__PURE__ */
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3834
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-1", children: [
|
|
3835
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
3836
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
3837
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
3628
3838
|
] }),
|
|
3629
|
-
target.mask && /* @__PURE__ */
|
|
3630
|
-
/* @__PURE__ */
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3633
|
-
/* @__PURE__ */
|
|
3839
|
+
target.mask && /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
3840
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3841
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3842
|
+
/* @__PURE__ */ jsx18("span", { children: "Density" }),
|
|
3843
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3634
3844
|
Math.round((target.mask.density ?? 1) * 100),
|
|
3635
3845
|
"%"
|
|
3636
3846
|
] })
|
|
3637
3847
|
] }),
|
|
3638
|
-
/* @__PURE__ */
|
|
3848
|
+
/* @__PURE__ */ jsx18(
|
|
3639
3849
|
"input",
|
|
3640
3850
|
{
|
|
3641
3851
|
type: "range",
|
|
@@ -3649,15 +3859,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3649
3859
|
}
|
|
3650
3860
|
)
|
|
3651
3861
|
] }),
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3863
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3864
|
+
/* @__PURE__ */ jsx18("span", { children: "Mask Feather" }),
|
|
3865
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3656
3866
|
target.mask.feather ?? 0,
|
|
3657
3867
|
"px"
|
|
3658
3868
|
] })
|
|
3659
3869
|
] }),
|
|
3660
|
-
/* @__PURE__ */
|
|
3870
|
+
/* @__PURE__ */ jsx18(
|
|
3661
3871
|
"input",
|
|
3662
3872
|
{
|
|
3663
3873
|
type: "range",
|
|
@@ -3677,13 +3887,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3677
3887
|
};
|
|
3678
3888
|
|
|
3679
3889
|
// src/image-editor/ChannelsPanel.tsx
|
|
3680
|
-
import { useEffect as
|
|
3890
|
+
import { useEffect as useEffect12, useRef as useRef10, useState as useState15 } from "react";
|
|
3681
3891
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3682
|
-
import { jsx as
|
|
3892
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3683
3893
|
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"}`;
|
|
3684
3894
|
var ChannelThumb = ({ channel, size }) => {
|
|
3685
|
-
const ref =
|
|
3686
|
-
|
|
3895
|
+
const ref = useRef10(null);
|
|
3896
|
+
useEffect12(() => {
|
|
3687
3897
|
const canvas = ref.current;
|
|
3688
3898
|
const ctx = canvas?.getContext("2d");
|
|
3689
3899
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -3694,15 +3904,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
3694
3904
|
img.data.set(px.data);
|
|
3695
3905
|
ctx.putImageData(img, 0, 0);
|
|
3696
3906
|
}, [channel.mask]);
|
|
3697
|
-
return /* @__PURE__ */
|
|
3907
|
+
return /* @__PURE__ */ jsx19("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
3698
3908
|
};
|
|
3699
3909
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
3700
|
-
const [, setTick] =
|
|
3701
|
-
|
|
3702
|
-
const [activeId, setActiveId] =
|
|
3703
|
-
const [renaming, setRenaming] =
|
|
3704
|
-
const [error, setError] =
|
|
3705
|
-
const fileInput =
|
|
3910
|
+
const [, setTick] = useState15(0);
|
|
3911
|
+
useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3912
|
+
const [activeId, setActiveId] = useState15(null);
|
|
3913
|
+
const [renaming, setRenaming] = useState15(null);
|
|
3914
|
+
const [error, setError] = useState15(null);
|
|
3915
|
+
const fileInput = useRef10(null);
|
|
3706
3916
|
const channels = controller.getChannels();
|
|
3707
3917
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
3708
3918
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -3724,13 +3934,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3724
3934
|
setError(err instanceof Error ? err.message : String(err));
|
|
3725
3935
|
}
|
|
3726
3936
|
};
|
|
3727
|
-
return /* @__PURE__ */
|
|
3728
|
-
/* @__PURE__ */
|
|
3729
|
-
/* @__PURE__ */
|
|
3730
|
-
/* @__PURE__ */
|
|
3937
|
+
return /* @__PURE__ */ jsxs17("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
3938
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
3939
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
3940
|
+
/* @__PURE__ */ jsx19("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" })
|
|
3731
3941
|
] }),
|
|
3732
|
-
channels.length === 0 && /* @__PURE__ */
|
|
3733
|
-
/* @__PURE__ */
|
|
3942
|
+
channels.length === 0 && /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
3943
|
+
/* @__PURE__ */ jsx19("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs17(
|
|
3734
3944
|
"li",
|
|
3735
3945
|
{
|
|
3736
3946
|
"data-testid": "channel-row",
|
|
@@ -3742,7 +3952,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3742
3952
|
},
|
|
3743
3953
|
onDoubleClick: () => setRenaming(c.id),
|
|
3744
3954
|
children: [
|
|
3745
|
-
/* @__PURE__ */
|
|
3955
|
+
/* @__PURE__ */ jsx19(
|
|
3746
3956
|
"button",
|
|
3747
3957
|
{
|
|
3748
3958
|
type: "button",
|
|
@@ -3756,8 +3966,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3756
3966
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
3757
3967
|
}
|
|
3758
3968
|
),
|
|
3759
|
-
/* @__PURE__ */
|
|
3760
|
-
renaming === c.id ? /* @__PURE__ */
|
|
3969
|
+
/* @__PURE__ */ jsx19(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
3970
|
+
renaming === c.id ? /* @__PURE__ */ jsx19(
|
|
3761
3971
|
"input",
|
|
3762
3972
|
{
|
|
3763
3973
|
autoFocus: true,
|
|
@@ -3774,16 +3984,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3774
3984
|
if (e.key === "Escape") setRenaming(null);
|
|
3775
3985
|
}
|
|
3776
3986
|
}
|
|
3777
|
-
) : /* @__PURE__ */
|
|
3987
|
+
) : /* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
3778
3988
|
]
|
|
3779
3989
|
},
|
|
3780
3990
|
c.id
|
|
3781
3991
|
)) }),
|
|
3782
|
-
/* @__PURE__ */
|
|
3783
|
-
/* @__PURE__ */
|
|
3784
|
-
/* @__PURE__ */
|
|
3785
|
-
/* @__PURE__ */
|
|
3786
|
-
/* @__PURE__ */
|
|
3992
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap gap-1", children: [
|
|
3993
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
3994
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
3995
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
3996
|
+
/* @__PURE__ */ jsx19(
|
|
3787
3997
|
"button",
|
|
3788
3998
|
{
|
|
3789
3999
|
type: "button",
|
|
@@ -3796,8 +4006,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3796
4006
|
children: "Delete"
|
|
3797
4007
|
}
|
|
3798
4008
|
),
|
|
3799
|
-
/* @__PURE__ */
|
|
3800
|
-
/* @__PURE__ */
|
|
4009
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
4010
|
+
/* @__PURE__ */ jsx19(
|
|
3801
4011
|
"button",
|
|
3802
4012
|
{
|
|
3803
4013
|
type: "button",
|
|
@@ -3808,7 +4018,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3808
4018
|
children: "Export PNG"
|
|
3809
4019
|
}
|
|
3810
4020
|
),
|
|
3811
|
-
/* @__PURE__ */
|
|
4021
|
+
/* @__PURE__ */ jsx19(
|
|
3812
4022
|
"input",
|
|
3813
4023
|
{
|
|
3814
4024
|
ref: fileInput,
|
|
@@ -3823,18 +4033,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3823
4033
|
}
|
|
3824
4034
|
)
|
|
3825
4035
|
] }),
|
|
3826
|
-
error && /* @__PURE__ */
|
|
4036
|
+
error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error })
|
|
3827
4037
|
] });
|
|
3828
4038
|
};
|
|
3829
4039
|
|
|
3830
4040
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
3831
|
-
import { useEffect as
|
|
4041
|
+
import { useEffect as useEffect13, useState as useState16 } from "react";
|
|
3832
4042
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
3833
|
-
import { jsx as
|
|
4043
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3834
4044
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
3835
4045
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
3836
|
-
const [, setTick] =
|
|
3837
|
-
|
|
4046
|
+
const [, setTick] = useState16(0);
|
|
4047
|
+
useEffect13(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
3838
4048
|
const bar = tool.bar();
|
|
3839
4049
|
if (!tool.active || !bar) return null;
|
|
3840
4050
|
const warp = tool.warpBar();
|
|
@@ -3846,17 +4056,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3846
4056
|
const v = Number(raw);
|
|
3847
4057
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
3848
4058
|
};
|
|
3849
|
-
return /* @__PURE__ */
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3855
|
-
/* @__PURE__ */
|
|
4059
|
+
return /* @__PURE__ */ jsxs18("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: [
|
|
4060
|
+
/* @__PURE__ */ jsx20("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx20("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)) }),
|
|
4061
|
+
/* @__PURE__ */ jsx20("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx20("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)) }),
|
|
4062
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4063
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
4064
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4065
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20("option", { value: o.id, children: o.label }, o.id)) })
|
|
3856
4066
|
] }),
|
|
3857
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
4067
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
4068
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4069
|
+
/* @__PURE__ */ jsx20(
|
|
3860
4070
|
"input",
|
|
3861
4071
|
{
|
|
3862
4072
|
type: "number",
|
|
@@ -3877,9 +4087,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3877
4087
|
},
|
|
3878
4088
|
`${k}:${warp[k]}`
|
|
3879
4089
|
),
|
|
3880
|
-
/* @__PURE__ */
|
|
4090
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "%" })
|
|
3881
4091
|
] }, k)),
|
|
3882
|
-
/* @__PURE__ */
|
|
4092
|
+
/* @__PURE__ */ jsx20(
|
|
3883
4093
|
"button",
|
|
3884
4094
|
{
|
|
3885
4095
|
type: "button",
|
|
@@ -3891,9 +4101,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3891
4101
|
children: "Vertical"
|
|
3892
4102
|
}
|
|
3893
4103
|
),
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
4105
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4106
|
+
/* @__PURE__ */ jsx20(
|
|
3897
4107
|
"select",
|
|
3898
4108
|
{
|
|
3899
4109
|
"aria-label": "Warp grid",
|
|
@@ -3903,14 +4113,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3903
4113
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
3904
4114
|
},
|
|
3905
4115
|
className: imageFieldClass,
|
|
3906
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
4116
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx20("option", { value: g.id, children: g.label }, g.id))
|
|
3907
4117
|
}
|
|
3908
4118
|
)
|
|
3909
4119
|
] })
|
|
3910
4120
|
] }),
|
|
3911
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
4121
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4122
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: f.label }),
|
|
4123
|
+
/* @__PURE__ */ jsx20(
|
|
3914
4124
|
"input",
|
|
3915
4125
|
{
|
|
3916
4126
|
type: "number",
|
|
@@ -3930,8 +4140,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3930
4140
|
},
|
|
3931
4141
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
3932
4142
|
),
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4143
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4144
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx20(
|
|
3935
4145
|
"button",
|
|
3936
4146
|
{
|
|
3937
4147
|
type: "button",
|
|
@@ -3946,33 +4156,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3946
4156
|
}
|
|
3947
4157
|
)
|
|
3948
4158
|
] }, f.id)),
|
|
3949
|
-
/* @__PURE__ */
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
/* @__PURE__ */
|
|
4159
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
|
|
4160
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4161
|
+
/* @__PURE__ */ jsx20(
|
|
3952
4162
|
"select",
|
|
3953
4163
|
{
|
|
3954
4164
|
"aria-label": "Interpolation",
|
|
3955
4165
|
value: tool.interpolation,
|
|
3956
4166
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
3957
4167
|
className: imageFieldClass,
|
|
3958
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4168
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx20("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
3959
4169
|
}
|
|
3960
4170
|
)
|
|
3961
4171
|
] }),
|
|
3962
|
-
/* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
tool.error && /* @__PURE__ */
|
|
4172
|
+
/* @__PURE__ */ jsx20("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" }),
|
|
4173
|
+
/* @__PURE__ */ jsx20("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4174
|
+
tool.error && /* @__PURE__ */ jsx20("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
3965
4175
|
] });
|
|
3966
4176
|
};
|
|
3967
4177
|
|
|
3968
4178
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
3969
|
-
import { useEffect as
|
|
4179
|
+
import { useEffect as useEffect14, useState as useState17 } from "react";
|
|
3970
4180
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
3971
|
-
import { Fragment as
|
|
4181
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3972
4182
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
3973
|
-
const [, setTick] =
|
|
3974
|
-
|
|
3975
|
-
const [error, setError] =
|
|
4183
|
+
const [, setTick] = useState17(0);
|
|
4184
|
+
useEffect14(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4185
|
+
const [error, setError] = useState17(null);
|
|
3976
4186
|
const active = controller.getActiveLayer();
|
|
3977
4187
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
3978
4188
|
const set = (change) => {
|
|
@@ -3986,22 +4196,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
3986
4196
|
}
|
|
3987
4197
|
};
|
|
3988
4198
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
3989
|
-
return /* @__PURE__ */
|
|
3990
|
-
/* @__PURE__ */
|
|
3991
|
-
/* @__PURE__ */
|
|
3992
|
-
/* @__PURE__ */
|
|
3993
|
-
/* @__PURE__ */
|
|
4199
|
+
return /* @__PURE__ */ jsxs19("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4200
|
+
/* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4201
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4202
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4203
|
+
/* @__PURE__ */ jsx21(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
3994
4204
|
"Fill",
|
|
3995
|
-
/* @__PURE__ */
|
|
4205
|
+
/* @__PURE__ */ jsx21(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
3996
4206
|
] }),
|
|
3997
|
-
/* @__PURE__ */
|
|
3998
|
-
/* @__PURE__ */
|
|
4207
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4208
|
+
/* @__PURE__ */ jsx21(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
3999
4209
|
"Stroke",
|
|
4000
|
-
/* @__PURE__ */
|
|
4210
|
+
/* @__PURE__ */ jsx21(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4001
4211
|
] }),
|
|
4002
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4003
4213
|
"Width",
|
|
4004
|
-
/* @__PURE__ */
|
|
4214
|
+
/* @__PURE__ */ jsx21(
|
|
4005
4215
|
"input",
|
|
4006
4216
|
{
|
|
4007
4217
|
type: "number",
|
|
@@ -4015,52 +4225,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4015
4225
|
)
|
|
4016
4226
|
] })
|
|
4017
4227
|
] }),
|
|
4018
|
-
/* @__PURE__ */
|
|
4019
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
4228
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4229
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4020
4230
|
"Radius",
|
|
4021
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsx21("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}` })
|
|
4022
4232
|
] }),
|
|
4023
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4233
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4024
4234
|
"Sides",
|
|
4025
|
-
/* @__PURE__ */
|
|
4235
|
+
/* @__PURE__ */ jsx21("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}` })
|
|
4026
4236
|
] }),
|
|
4027
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4237
|
+
options.kind === "star" && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
4238
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4029
4239
|
"Points",
|
|
4030
|
-
/* @__PURE__ */
|
|
4240
|
+
/* @__PURE__ */ jsx21("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}` })
|
|
4031
4241
|
] }),
|
|
4032
|
-
/* @__PURE__ */
|
|
4242
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4033
4243
|
"Inner",
|
|
4034
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsx21(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4035
4245
|
] })
|
|
4036
4246
|
] }),
|
|
4037
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4038
|
-
/* @__PURE__ */
|
|
4247
|
+
options.kind === "line" && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
4248
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4039
4249
|
"Weight",
|
|
4040
|
-
/* @__PURE__ */
|
|
4250
|
+
/* @__PURE__ */ jsx21("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}` })
|
|
4041
4251
|
] }),
|
|
4042
|
-
/* @__PURE__ */
|
|
4043
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4253
|
+
/* @__PURE__ */ jsx21(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4044
4254
|
"Arrowhead"
|
|
4045
4255
|
] })
|
|
4046
4256
|
] })
|
|
4047
4257
|
] }),
|
|
4048
|
-
/* @__PURE__ */
|
|
4049
|
-
error && /* @__PURE__ */
|
|
4258
|
+
/* @__PURE__ */ jsx21("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." }),
|
|
4259
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
4050
4260
|
] });
|
|
4051
4261
|
};
|
|
4052
4262
|
|
|
4053
4263
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4054
|
-
import { useEffect as
|
|
4264
|
+
import { useEffect as useEffect15, useState as useState18 } from "react";
|
|
4055
4265
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4056
|
-
import { jsx as
|
|
4266
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4057
4267
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4058
4268
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4059
4269
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4060
|
-
const [, setTick] =
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
const [error, setError] =
|
|
4270
|
+
const [, setTick] = useState18(0);
|
|
4271
|
+
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4272
|
+
useEffect15(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4273
|
+
const [error, setError] = useState18(null);
|
|
4064
4274
|
const active = controller.getActiveLayer();
|
|
4065
4275
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4066
4276
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4113,11 +4323,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4113
4323
|
setError(e instanceof Error ? e.message : String(e));
|
|
4114
4324
|
}
|
|
4115
4325
|
};
|
|
4116
|
-
return /* @__PURE__ */
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
4326
|
+
return /* @__PURE__ */ jsxs20("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4327
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4328
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4119
4329
|
"Font",
|
|
4120
|
-
/* @__PURE__ */
|
|
4330
|
+
/* @__PURE__ */ jsx22(
|
|
4121
4331
|
"input",
|
|
4122
4332
|
{
|
|
4123
4333
|
list: "pixerate-type-fonts",
|
|
@@ -4127,11 +4337,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4127
4337
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4128
4338
|
}
|
|
4129
4339
|
),
|
|
4130
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsx22("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx22("option", { value: f }, f)) })
|
|
4131
4341
|
] }),
|
|
4132
|
-
/* @__PURE__ */
|
|
4342
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4133
4343
|
"Size",
|
|
4134
|
-
/* @__PURE__ */
|
|
4344
|
+
/* @__PURE__ */ jsx22(
|
|
4135
4345
|
"input",
|
|
4136
4346
|
{
|
|
4137
4347
|
type: "number",
|
|
@@ -4144,14 +4354,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4144
4354
|
}
|
|
4145
4355
|
)
|
|
4146
4356
|
] }),
|
|
4147
|
-
/* @__PURE__ */
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsx22("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" }),
|
|
4358
|
+
/* @__PURE__ */ jsx22("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4359
|
+
/* @__PURE__ */ jsx22(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
4150
4360
|
] }),
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4154
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
4361
|
+
/* @__PURE__ */ jsx22("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx22("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4362
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
4363
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx22("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
4364
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx22(
|
|
4155
4365
|
"button",
|
|
4156
4366
|
{
|
|
4157
4367
|
type: "button",
|
|
@@ -4163,19 +4373,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4163
4373
|
}
|
|
4164
4374
|
)
|
|
4165
4375
|
] }),
|
|
4166
|
-
/* @__PURE__ */
|
|
4167
|
-
missing.length > 0 && /* @__PURE__ */
|
|
4376
|
+
/* @__PURE__ */ jsx22("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." }),
|
|
4377
|
+
missing.length > 0 && /* @__PURE__ */ jsxs20("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4168
4378
|
"Missing ",
|
|
4169
4379
|
missing.length === 1 ? "font" : "fonts",
|
|
4170
4380
|
": ",
|
|
4171
4381
|
missing.join(", ")
|
|
4172
4382
|
] }),
|
|
4173
|
-
error && /* @__PURE__ */
|
|
4383
|
+
error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
|
|
4174
4384
|
] });
|
|
4175
4385
|
};
|
|
4176
4386
|
|
|
4177
4387
|
// src/image-editor/ImageEditor.tsx
|
|
4178
|
-
import { Fragment as
|
|
4388
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4179
4389
|
var ImageEditor = ({
|
|
4180
4390
|
editor: externalEditor,
|
|
4181
4391
|
src,
|
|
@@ -4200,32 +4410,32 @@ var ImageEditor = ({
|
|
|
4200
4410
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4201
4411
|
});
|
|
4202
4412
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4203
|
-
const [activeTab, setActiveTab] =
|
|
4204
|
-
const rootRef =
|
|
4413
|
+
const [activeTab, setActiveTab] = useState19("crop");
|
|
4414
|
+
const rootRef = useRef11(null);
|
|
4205
4415
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4206
|
-
const activeTabRef =
|
|
4416
|
+
const activeTabRef = useRef11(activeTab);
|
|
4207
4417
|
activeTabRef.current = activeTab;
|
|
4208
4418
|
const openPanel = async (ref) => {
|
|
4209
4419
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
4210
4420
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4211
4421
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4212
4422
|
};
|
|
4213
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
4214
|
-
const [selectionOptions, setSelectionOptions] =
|
|
4215
|
-
const [shapeOptions, setShapeOptions] =
|
|
4216
|
-
const [typeOptions, setTypeOptions] =
|
|
4217
|
-
const [typeSession, setTypeSession] =
|
|
4218
|
-
const [selectionError, setSelectionError] =
|
|
4219
|
-
const [paintError, setPaintError] =
|
|
4220
|
-
const [shapeTypeError, setShapeTypeError] =
|
|
4423
|
+
const [activeCropRatio, setActiveCropRatio] = useState19(null);
|
|
4424
|
+
const [selectionOptions, setSelectionOptions] = useState19(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
4425
|
+
const [shapeOptions, setShapeOptions] = useState19(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
4426
|
+
const [typeOptions, setTypeOptions] = useState19(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
4427
|
+
const [typeSession, setTypeSession] = useState19(null);
|
|
4428
|
+
const [selectionError, setSelectionError] = useState19(null);
|
|
4429
|
+
const [paintError, setPaintError] = useState19(null);
|
|
4430
|
+
const [shapeTypeError, setShapeTypeError] = useState19(null);
|
|
4221
4431
|
const handleCanvasError = (source, message) => {
|
|
4222
4432
|
if (source === "paint") setPaintError(message);
|
|
4223
4433
|
else if (source === "select") setSelectionError(message);
|
|
4224
4434
|
else setShapeTypeError(message);
|
|
4225
4435
|
};
|
|
4226
4436
|
const finishTyping = () => setTypeSession(null);
|
|
4227
|
-
const transformToolRef =
|
|
4228
|
-
const transformControllerRef =
|
|
4437
|
+
const transformToolRef = useRef11(null);
|
|
4438
|
+
const transformControllerRef = useRef11(controller);
|
|
4229
4439
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
4230
4440
|
transformToolRef.current?.cancel();
|
|
4231
4441
|
transformToolRef.current = new FreeTransformTool2(controller, {
|
|
@@ -4234,16 +4444,16 @@ var ImageEditor = ({
|
|
|
4234
4444
|
transformControllerRef.current = controller;
|
|
4235
4445
|
}
|
|
4236
4446
|
const transformTool = transformToolRef.current;
|
|
4237
|
-
const [, setTransformTick] =
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
4241
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
4242
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
4243
|
-
const [isInpainting, setIsInpainting] =
|
|
4244
|
-
const [aiError, setAiError] =
|
|
4245
|
-
const [aiSuccess, setAiSuccess] =
|
|
4246
|
-
const [aiTarget, setAiTarget] =
|
|
4447
|
+
const [, setTransformTick] = useState19(0);
|
|
4448
|
+
useEffect16(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4449
|
+
useEffect16(() => () => transformToolRef.current?.cancel(), []);
|
|
4450
|
+
const [inpaintPrompt, setInpaintPrompt] = useState19("");
|
|
4451
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState19("annotations");
|
|
4452
|
+
const [isRemovingBg, setIsRemovingBg] = useState19(false);
|
|
4453
|
+
const [isInpainting, setIsInpainting] = useState19(false);
|
|
4454
|
+
const [aiError, setAiError] = useState19(null);
|
|
4455
|
+
const [aiSuccess, setAiSuccess] = useState19(null);
|
|
4456
|
+
const [aiTarget, setAiTarget] = useState19("auto");
|
|
4247
4457
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4248
4458
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4249
4459
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4306,11 +4516,11 @@ var ImageEditor = ({
|
|
|
4306
4516
|
setIsInpainting(false);
|
|
4307
4517
|
}
|
|
4308
4518
|
};
|
|
4309
|
-
const [activeColor, setActiveColor] =
|
|
4310
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4311
|
-
const [fontSize, setFontSize] =
|
|
4312
|
-
const [textInput, setTextInput] =
|
|
4313
|
-
|
|
4519
|
+
const [activeColor, setActiveColor] = useState19("#ef4444");
|
|
4520
|
+
const [strokeWidth, setStrokeWidth] = useState19(3);
|
|
4521
|
+
const [fontSize, setFontSize] = useState19(24);
|
|
4522
|
+
const [textInput, setTextInput] = useState19("");
|
|
4523
|
+
useEffect16(() => {
|
|
4314
4524
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4315
4525
|
editor.setTool("crop");
|
|
4316
4526
|
}
|
|
@@ -4338,16 +4548,16 @@ var ImageEditor = ({
|
|
|
4338
4548
|
link.click();
|
|
4339
4549
|
}
|
|
4340
4550
|
};
|
|
4341
|
-
return /* @__PURE__ */
|
|
4551
|
+
return /* @__PURE__ */ jsxs21(
|
|
4342
4552
|
"div",
|
|
4343
4553
|
{
|
|
4344
4554
|
ref: rootRef,
|
|
4345
4555
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4346
4556
|
style,
|
|
4347
4557
|
children: [
|
|
4348
|
-
/* @__PURE__ */
|
|
4349
|
-
/* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4558
|
+
/* @__PURE__ */ jsxs21("div", { className: imageEditorHeaderClass, children: [
|
|
4559
|
+
/* @__PURE__ */ jsxs21("div", { role: "tablist", className: imageTabListClass, children: [
|
|
4560
|
+
/* @__PURE__ */ jsx23(
|
|
4351
4561
|
"button",
|
|
4352
4562
|
{
|
|
4353
4563
|
type: "button",
|
|
@@ -4362,7 +4572,7 @@ var ImageEditor = ({
|
|
|
4362
4572
|
children: "Transform & Crop"
|
|
4363
4573
|
}
|
|
4364
4574
|
),
|
|
4365
|
-
/* @__PURE__ */
|
|
4575
|
+
/* @__PURE__ */ jsx23(
|
|
4366
4576
|
"button",
|
|
4367
4577
|
{
|
|
4368
4578
|
type: "button",
|
|
@@ -4377,7 +4587,7 @@ var ImageEditor = ({
|
|
|
4377
4587
|
children: "Adjustments"
|
|
4378
4588
|
}
|
|
4379
4589
|
),
|
|
4380
|
-
/* @__PURE__ */
|
|
4590
|
+
/* @__PURE__ */ jsx23(
|
|
4381
4591
|
"button",
|
|
4382
4592
|
{
|
|
4383
4593
|
type: "button",
|
|
@@ -4392,7 +4602,7 @@ var ImageEditor = ({
|
|
|
4392
4602
|
children: "Layers"
|
|
4393
4603
|
}
|
|
4394
4604
|
),
|
|
4395
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__PURE__ */ jsx23(
|
|
4396
4606
|
"button",
|
|
4397
4607
|
{
|
|
4398
4608
|
type: "button",
|
|
@@ -4407,7 +4617,7 @@ var ImageEditor = ({
|
|
|
4407
4617
|
children: "Paint"
|
|
4408
4618
|
}
|
|
4409
4619
|
),
|
|
4410
|
-
/* @__PURE__ */
|
|
4620
|
+
/* @__PURE__ */ jsx23(
|
|
4411
4621
|
"button",
|
|
4412
4622
|
{
|
|
4413
4623
|
type: "button",
|
|
@@ -4422,7 +4632,7 @@ var ImageEditor = ({
|
|
|
4422
4632
|
children: "Select & Mask"
|
|
4423
4633
|
}
|
|
4424
4634
|
),
|
|
4425
|
-
/* @__PURE__ */
|
|
4635
|
+
/* @__PURE__ */ jsx23(
|
|
4426
4636
|
"button",
|
|
4427
4637
|
{
|
|
4428
4638
|
type: "button",
|
|
@@ -4437,7 +4647,7 @@ var ImageEditor = ({
|
|
|
4437
4647
|
children: "Annotations"
|
|
4438
4648
|
}
|
|
4439
4649
|
),
|
|
4440
|
-
/* @__PURE__ */
|
|
4650
|
+
/* @__PURE__ */ jsx23(
|
|
4441
4651
|
"button",
|
|
4442
4652
|
{
|
|
4443
4653
|
type: "button",
|
|
@@ -4452,7 +4662,7 @@ var ImageEditor = ({
|
|
|
4452
4662
|
children: "Depth Mask"
|
|
4453
4663
|
}
|
|
4454
4664
|
),
|
|
4455
|
-
/* @__PURE__ */
|
|
4665
|
+
/* @__PURE__ */ jsxs21(
|
|
4456
4666
|
"button",
|
|
4457
4667
|
{
|
|
4458
4668
|
type: "button",
|
|
@@ -4465,14 +4675,14 @@ var ImageEditor = ({
|
|
|
4465
4675
|
"aria-selected": activeTab === "ai",
|
|
4466
4676
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
4467
4677
|
children: [
|
|
4468
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__PURE__ */ jsx23("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx23("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" }) }),
|
|
4469
4679
|
"AI Tools"
|
|
4470
4680
|
]
|
|
4471
4681
|
}
|
|
4472
4682
|
)
|
|
4473
4683
|
] }),
|
|
4474
|
-
/* @__PURE__ */
|
|
4475
|
-
/* @__PURE__ */
|
|
4684
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4685
|
+
/* @__PURE__ */ jsx23(
|
|
4476
4686
|
"button",
|
|
4477
4687
|
{
|
|
4478
4688
|
type: "button",
|
|
@@ -4483,7 +4693,7 @@ var ImageEditor = ({
|
|
|
4483
4693
|
children: "\u21A9"
|
|
4484
4694
|
}
|
|
4485
4695
|
),
|
|
4486
|
-
/* @__PURE__ */
|
|
4696
|
+
/* @__PURE__ */ jsx23(
|
|
4487
4697
|
"button",
|
|
4488
4698
|
{
|
|
4489
4699
|
type: "button",
|
|
@@ -4494,7 +4704,7 @@ var ImageEditor = ({
|
|
|
4494
4704
|
children: "\u21AA"
|
|
4495
4705
|
}
|
|
4496
4706
|
),
|
|
4497
|
-
/* @__PURE__ */
|
|
4707
|
+
/* @__PURE__ */ jsx23(
|
|
4498
4708
|
"button",
|
|
4499
4709
|
{
|
|
4500
4710
|
type: "button",
|
|
@@ -4503,8 +4713,8 @@ var ImageEditor = ({
|
|
|
4503
4713
|
children: "Reset"
|
|
4504
4714
|
}
|
|
4505
4715
|
),
|
|
4506
|
-
/* @__PURE__ */
|
|
4507
|
-
/* @__PURE__ */
|
|
4716
|
+
/* @__PURE__ */ jsx23("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4717
|
+
/* @__PURE__ */ jsx23(
|
|
4508
4718
|
"button",
|
|
4509
4719
|
{
|
|
4510
4720
|
type: "button",
|
|
@@ -4514,11 +4724,11 @@ var ImageEditor = ({
|
|
|
4514
4724
|
children: "-"
|
|
4515
4725
|
}
|
|
4516
4726
|
),
|
|
4517
|
-
/* @__PURE__ */
|
|
4727
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
4518
4728
|
Math.round(state.zoom * 100),
|
|
4519
4729
|
"%"
|
|
4520
4730
|
] }),
|
|
4521
|
-
/* @__PURE__ */
|
|
4731
|
+
/* @__PURE__ */ jsx23(
|
|
4522
4732
|
"button",
|
|
4523
4733
|
{
|
|
4524
4734
|
type: "button",
|
|
@@ -4528,8 +4738,8 @@ var ImageEditor = ({
|
|
|
4528
4738
|
children: "+"
|
|
4529
4739
|
}
|
|
4530
4740
|
),
|
|
4531
|
-
/* @__PURE__ */
|
|
4532
|
-
/* @__PURE__ */
|
|
4741
|
+
/* @__PURE__ */ jsx23("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4742
|
+
/* @__PURE__ */ jsx23(
|
|
4533
4743
|
"button",
|
|
4534
4744
|
{
|
|
4535
4745
|
type: "button",
|
|
@@ -4540,7 +4750,7 @@ var ImageEditor = ({
|
|
|
4540
4750
|
children: "Hold Compare"
|
|
4541
4751
|
}
|
|
4542
4752
|
),
|
|
4543
|
-
/* @__PURE__ */
|
|
4753
|
+
/* @__PURE__ */ jsx23(
|
|
4544
4754
|
"button",
|
|
4545
4755
|
{
|
|
4546
4756
|
type: "button",
|
|
@@ -4551,10 +4761,10 @@ var ImageEditor = ({
|
|
|
4551
4761
|
)
|
|
4552
4762
|
] })
|
|
4553
4763
|
] }),
|
|
4554
|
-
transformTool.active && /* @__PURE__ */
|
|
4555
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4764
|
+
transformTool.active && /* @__PURE__ */ jsx23(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
4765
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx23("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
4766
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
4767
|
+
/* @__PURE__ */ jsx23(
|
|
4558
4768
|
ImageEditorCanvas,
|
|
4559
4769
|
{
|
|
4560
4770
|
editor,
|
|
@@ -4578,11 +4788,11 @@ var ImageEditor = ({
|
|
|
4578
4788
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
4579
4789
|
}
|
|
4580
4790
|
),
|
|
4581
|
-
/* @__PURE__ */
|
|
4582
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4791
|
+
/* @__PURE__ */ jsxs21("div", { className: imageSidebarClass, children: [
|
|
4792
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
4793
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
4794
|
+
/* @__PURE__ */ jsxs21("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
4795
|
+
/* @__PURE__ */ jsx23(
|
|
4586
4796
|
"button",
|
|
4587
4797
|
{
|
|
4588
4798
|
type: "button",
|
|
@@ -4594,7 +4804,7 @@ var ImageEditor = ({
|
|
|
4594
4804
|
children: "Freeform"
|
|
4595
4805
|
}
|
|
4596
4806
|
),
|
|
4597
|
-
/* @__PURE__ */
|
|
4807
|
+
/* @__PURE__ */ jsx23(
|
|
4598
4808
|
"button",
|
|
4599
4809
|
{
|
|
4600
4810
|
type: "button",
|
|
@@ -4606,7 +4816,7 @@ var ImageEditor = ({
|
|
|
4606
4816
|
children: "1:1 Square"
|
|
4607
4817
|
}
|
|
4608
4818
|
),
|
|
4609
|
-
/* @__PURE__ */
|
|
4819
|
+
/* @__PURE__ */ jsx23(
|
|
4610
4820
|
"button",
|
|
4611
4821
|
{
|
|
4612
4822
|
type: "button",
|
|
@@ -4618,7 +4828,7 @@ var ImageEditor = ({
|
|
|
4618
4828
|
children: "4:3 Standard"
|
|
4619
4829
|
}
|
|
4620
4830
|
),
|
|
4621
|
-
/* @__PURE__ */
|
|
4831
|
+
/* @__PURE__ */ jsx23(
|
|
4622
4832
|
"button",
|
|
4623
4833
|
{
|
|
4624
4834
|
type: "button",
|
|
@@ -4630,7 +4840,7 @@ var ImageEditor = ({
|
|
|
4630
4840
|
children: "16:9 Wide"
|
|
4631
4841
|
}
|
|
4632
4842
|
),
|
|
4633
|
-
/* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ jsx23(
|
|
4634
4844
|
"button",
|
|
4635
4845
|
{
|
|
4636
4846
|
type: "button",
|
|
@@ -4642,7 +4852,7 @@ var ImageEditor = ({
|
|
|
4642
4852
|
children: "3:2 Photo"
|
|
4643
4853
|
}
|
|
4644
4854
|
),
|
|
4645
|
-
/* @__PURE__ */
|
|
4855
|
+
/* @__PURE__ */ jsx23(
|
|
4646
4856
|
"button",
|
|
4647
4857
|
{
|
|
4648
4858
|
type: "button",
|
|
@@ -4655,10 +4865,10 @@ var ImageEditor = ({
|
|
|
4655
4865
|
}
|
|
4656
4866
|
)
|
|
4657
4867
|
] }),
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4868
|
+
/* @__PURE__ */ jsx23("div", { className: imageDividerClass }),
|
|
4869
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
4870
|
+
/* @__PURE__ */ jsxs21("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4871
|
+
/* @__PURE__ */ jsx23(
|
|
4662
4872
|
"button",
|
|
4663
4873
|
{
|
|
4664
4874
|
type: "button",
|
|
@@ -4667,7 +4877,7 @@ var ImageEditor = ({
|
|
|
4667
4877
|
children: "Rotate -90\xB0"
|
|
4668
4878
|
}
|
|
4669
4879
|
),
|
|
4670
|
-
/* @__PURE__ */
|
|
4880
|
+
/* @__PURE__ */ jsx23(
|
|
4671
4881
|
"button",
|
|
4672
4882
|
{
|
|
4673
4883
|
type: "button",
|
|
@@ -4676,7 +4886,7 @@ var ImageEditor = ({
|
|
|
4676
4886
|
children: "Rotate +90\xB0"
|
|
4677
4887
|
}
|
|
4678
4888
|
),
|
|
4679
|
-
/* @__PURE__ */
|
|
4889
|
+
/* @__PURE__ */ jsx23(
|
|
4680
4890
|
"button",
|
|
4681
4891
|
{
|
|
4682
4892
|
type: "button",
|
|
@@ -4685,7 +4895,7 @@ var ImageEditor = ({
|
|
|
4685
4895
|
children: "Flip Horizontal"
|
|
4686
4896
|
}
|
|
4687
4897
|
),
|
|
4688
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ jsx23(
|
|
4689
4899
|
"button",
|
|
4690
4900
|
{
|
|
4691
4901
|
type: "button",
|
|
@@ -4696,10 +4906,10 @@ var ImageEditor = ({
|
|
|
4696
4906
|
)
|
|
4697
4907
|
] })
|
|
4698
4908
|
] }),
|
|
4699
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
4909
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4910
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
|
|
4911
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
4912
|
+
/* @__PURE__ */ jsx23(
|
|
4703
4913
|
"button",
|
|
4704
4914
|
{
|
|
4705
4915
|
type: "button",
|
|
@@ -4709,9 +4919,9 @@ var ImageEditor = ({
|
|
|
4709
4919
|
}
|
|
4710
4920
|
)
|
|
4711
4921
|
] }),
|
|
4712
|
-
/* @__PURE__ */
|
|
4713
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
4714
|
-
/* @__PURE__ */
|
|
4922
|
+
/* @__PURE__ */ jsx23(Histogram, { histogram: editor.histogram }),
|
|
4923
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs21(React18.Fragment, { children: [
|
|
4924
|
+
/* @__PURE__ */ jsx23(
|
|
4715
4925
|
ControlSlider,
|
|
4716
4926
|
{
|
|
4717
4927
|
spec,
|
|
@@ -4720,14 +4930,14 @@ var ImageEditor = ({
|
|
|
4720
4930
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
4721
4931
|
}
|
|
4722
4932
|
),
|
|
4723
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
4933
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs21(
|
|
4724
4934
|
"div",
|
|
4725
4935
|
{
|
|
4726
4936
|
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",
|
|
4727
4937
|
"data-testid": "image-editor-process-notice",
|
|
4728
4938
|
children: [
|
|
4729
|
-
/* @__PURE__ */
|
|
4730
|
-
/* @__PURE__ */
|
|
4939
|
+
/* @__PURE__ */ jsx23("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
4940
|
+
/* @__PURE__ */ jsx23(
|
|
4731
4941
|
"button",
|
|
4732
4942
|
{
|
|
4733
4943
|
type: "button",
|
|
@@ -4740,7 +4950,7 @@ var ImageEditor = ({
|
|
|
4740
4950
|
}
|
|
4741
4951
|
)
|
|
4742
4952
|
] }, spec.id)),
|
|
4743
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsx23("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx23(
|
|
4744
4954
|
AdjustmentLayersPanel,
|
|
4745
4955
|
{
|
|
4746
4956
|
controller,
|
|
@@ -4749,9 +4959,9 @@ var ImageEditor = ({
|
|
|
4749
4959
|
}
|
|
4750
4960
|
) })
|
|
4751
4961
|
] }),
|
|
4752
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
4753
|
-
/* @__PURE__ */
|
|
4754
|
-
/* @__PURE__ */
|
|
4962
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4963
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
4964
|
+
/* @__PURE__ */ jsx23(
|
|
4755
4965
|
"button",
|
|
4756
4966
|
{
|
|
4757
4967
|
type: "button",
|
|
@@ -4762,15 +4972,15 @@ var ImageEditor = ({
|
|
|
4762
4972
|
children: "Free Transform"
|
|
4763
4973
|
}
|
|
4764
4974
|
),
|
|
4765
|
-
/* @__PURE__ */
|
|
4766
|
-
effectsShown && /* @__PURE__ */
|
|
4767
|
-
/* @__PURE__ */
|
|
4768
|
-
/* @__PURE__ */
|
|
4975
|
+
/* @__PURE__ */ jsx23(LayersPanel, { controller }),
|
|
4976
|
+
effectsShown && /* @__PURE__ */ jsx23(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
4977
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
4978
|
+
/* @__PURE__ */ jsx23(ColorProfilePanel, { controller })
|
|
4769
4979
|
] }),
|
|
4770
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
4771
|
-
/* @__PURE__ */
|
|
4772
|
-
/* @__PURE__ */
|
|
4773
|
-
/* @__PURE__ */
|
|
4980
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4981
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
4982
|
+
/* @__PURE__ */ jsx23(BrushOptionsBar, { controller }),
|
|
4983
|
+
/* @__PURE__ */ jsx23(
|
|
4774
4984
|
"button",
|
|
4775
4985
|
{
|
|
4776
4986
|
type: "button",
|
|
@@ -4781,12 +4991,12 @@ var ImageEditor = ({
|
|
|
4781
4991
|
children: "Free Transform"
|
|
4782
4992
|
}
|
|
4783
4993
|
),
|
|
4784
|
-
paintError && /* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4994
|
+
paintError && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
4995
|
+
/* @__PURE__ */ jsx23("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx23(LayersPanel, { controller }) })
|
|
4786
4996
|
] }),
|
|
4787
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
4997
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
4998
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
4999
|
+
/* @__PURE__ */ jsx23("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx23(
|
|
4790
5000
|
"button",
|
|
4791
5001
|
{
|
|
4792
5002
|
type: "button",
|
|
@@ -4797,13 +5007,13 @@ var ImageEditor = ({
|
|
|
4797
5007
|
},
|
|
4798
5008
|
t
|
|
4799
5009
|
)) }),
|
|
4800
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
4801
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
4802
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
4803
|
-
shapeTypeError && /* @__PURE__ */
|
|
4804
|
-
/* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4806
|
-
/* @__PURE__ */
|
|
5010
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx23(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5011
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx23(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5012
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx23("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" }),
|
|
5013
|
+
shapeTypeError && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5014
|
+
/* @__PURE__ */ jsx23("div", { className: imageDividerClass }),
|
|
5015
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5016
|
+
/* @__PURE__ */ jsx23("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx23(
|
|
4807
5017
|
"button",
|
|
4808
5018
|
{
|
|
4809
5019
|
type: "button",
|
|
@@ -4813,18 +5023,18 @@ var ImageEditor = ({
|
|
|
4813
5023
|
},
|
|
4814
5024
|
t
|
|
4815
5025
|
)) }),
|
|
4816
|
-
/* @__PURE__ */
|
|
4817
|
-
/* @__PURE__ */
|
|
4818
|
-
/* @__PURE__ */
|
|
4819
|
-
/* @__PURE__ */
|
|
4820
|
-
/* @__PURE__ */
|
|
4821
|
-
/* @__PURE__ */
|
|
4822
|
-
/* @__PURE__ */
|
|
5026
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5027
|
+
/* @__PURE__ */ jsx23("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5028
|
+
/* @__PURE__ */ jsx23(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
5029
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex-1 ml-2", children: [
|
|
5030
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5031
|
+
/* @__PURE__ */ jsx23("span", { children: "Width:" }),
|
|
5032
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
|
|
4823
5033
|
strokeWidth,
|
|
4824
5034
|
"px"
|
|
4825
5035
|
] })
|
|
4826
5036
|
] }),
|
|
4827
|
-
/* @__PURE__ */
|
|
5037
|
+
/* @__PURE__ */ jsx23(
|
|
4828
5038
|
"input",
|
|
4829
5039
|
{
|
|
4830
5040
|
type: "range",
|
|
@@ -4837,10 +5047,10 @@ var ImageEditor = ({
|
|
|
4837
5047
|
)
|
|
4838
5048
|
] })
|
|
4839
5049
|
] }),
|
|
4840
|
-
/* @__PURE__ */
|
|
4841
|
-
/* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
/* @__PURE__ */
|
|
5050
|
+
/* @__PURE__ */ jsx23("div", { className: imageDividerClass }),
|
|
5051
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5052
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-2", children: [
|
|
5053
|
+
/* @__PURE__ */ jsx23(
|
|
4844
5054
|
"input",
|
|
4845
5055
|
{
|
|
4846
5056
|
type: "text",
|
|
@@ -4851,7 +5061,7 @@ var ImageEditor = ({
|
|
|
4851
5061
|
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"
|
|
4852
5062
|
}
|
|
4853
5063
|
),
|
|
4854
|
-
/* @__PURE__ */
|
|
5064
|
+
/* @__PURE__ */ jsx23(
|
|
4855
5065
|
"button",
|
|
4856
5066
|
{
|
|
4857
5067
|
type: "button",
|
|
@@ -4861,14 +5071,14 @@ var ImageEditor = ({
|
|
|
4861
5071
|
}
|
|
4862
5072
|
)
|
|
4863
5073
|
] }),
|
|
4864
|
-
/* @__PURE__ */
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5075
|
+
/* @__PURE__ */ jsx23("span", { children: "Font Size:" }),
|
|
5076
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
|
|
4867
5077
|
fontSize,
|
|
4868
5078
|
"px"
|
|
4869
5079
|
] })
|
|
4870
5080
|
] }),
|
|
4871
|
-
/* @__PURE__ */
|
|
5081
|
+
/* @__PURE__ */ jsx23(
|
|
4872
5082
|
"input",
|
|
4873
5083
|
{
|
|
4874
5084
|
type: "range",
|
|
@@ -4879,14 +5089,14 @@ var ImageEditor = ({
|
|
|
4879
5089
|
className: imageRangeClass
|
|
4880
5090
|
}
|
|
4881
5091
|
),
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
/* @__PURE__ */
|
|
5092
|
+
/* @__PURE__ */ jsx23("div", { className: imageDividerClass }),
|
|
5093
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
|
|
5094
|
+
/* @__PURE__ */ jsxs21("span", { className: "text-muted-foreground", children: [
|
|
4885
5095
|
"Layers (",
|
|
4886
5096
|
state.annotations.length,
|
|
4887
5097
|
")"
|
|
4888
5098
|
] }),
|
|
4889
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5099
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx23(
|
|
4890
5100
|
"button",
|
|
4891
5101
|
{
|
|
4892
5102
|
type: "button",
|
|
@@ -4895,7 +5105,7 @@ var ImageEditor = ({
|
|
|
4895
5105
|
children: "Delete Selected"
|
|
4896
5106
|
}
|
|
4897
5107
|
),
|
|
4898
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5108
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx23(
|
|
4899
5109
|
"button",
|
|
4900
5110
|
{
|
|
4901
5111
|
type: "button",
|
|
@@ -4906,10 +5116,10 @@ var ImageEditor = ({
|
|
|
4906
5116
|
)
|
|
4907
5117
|
] })
|
|
4908
5118
|
] }),
|
|
4909
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
4910
|
-
/* @__PURE__ */
|
|
4911
|
-
/* @__PURE__ */
|
|
4912
|
-
/* @__PURE__ */
|
|
5119
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5120
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
|
|
5121
|
+
/* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5122
|
+
/* @__PURE__ */ jsx23(
|
|
4913
5123
|
"button",
|
|
4914
5124
|
{
|
|
4915
5125
|
type: "button",
|
|
@@ -4919,8 +5129,8 @@ var ImageEditor = ({
|
|
|
4919
5129
|
}
|
|
4920
5130
|
)
|
|
4921
5131
|
] }),
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
5132
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5133
|
+
/* @__PURE__ */ jsx23(
|
|
4924
5134
|
"input",
|
|
4925
5135
|
{
|
|
4926
5136
|
type: "checkbox",
|
|
@@ -4929,12 +5139,12 @@ var ImageEditor = ({
|
|
|
4929
5139
|
className: "rounded accent-primary"
|
|
4930
5140
|
}
|
|
4931
5141
|
),
|
|
4932
|
-
/* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsx23("span", { children: "Enable Depth / Alpha Mask" })
|
|
4933
5143
|
] }),
|
|
4934
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
4935
|
-
/* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
5144
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
5145
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
5146
|
+
/* @__PURE__ */ jsx23("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5147
|
+
/* @__PURE__ */ jsx23(
|
|
4938
5148
|
"input",
|
|
4939
5149
|
{
|
|
4940
5150
|
type: "text",
|
|
@@ -4945,8 +5155,8 @@ var ImageEditor = ({
|
|
|
4945
5155
|
}
|
|
4946
5156
|
)
|
|
4947
5157
|
] }),
|
|
4948
|
-
/* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
5158
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-2", children: [
|
|
5159
|
+
/* @__PURE__ */ jsx23(
|
|
4950
5160
|
"button",
|
|
4951
5161
|
{
|
|
4952
5162
|
type: "button",
|
|
@@ -4955,7 +5165,7 @@ var ImageEditor = ({
|
|
|
4955
5165
|
children: "Threshold Mode"
|
|
4956
5166
|
}
|
|
4957
5167
|
),
|
|
4958
|
-
/* @__PURE__ */
|
|
5168
|
+
/* @__PURE__ */ jsx23(
|
|
4959
5169
|
"button",
|
|
4960
5170
|
{
|
|
4961
5171
|
type: "button",
|
|
@@ -4965,12 +5175,12 @@ var ImageEditor = ({
|
|
|
4965
5175
|
}
|
|
4966
5176
|
)
|
|
4967
5177
|
] }),
|
|
4968
|
-
/* @__PURE__ */
|
|
4969
|
-
/* @__PURE__ */
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
5178
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
5179
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5180
|
+
/* @__PURE__ */ jsx23("span", { children: "Depth Start (Lower):" }),
|
|
5181
|
+
/* @__PURE__ */ jsx23("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
4972
5182
|
] }),
|
|
4973
|
-
/* @__PURE__ */
|
|
5183
|
+
/* @__PURE__ */ jsx23(
|
|
4974
5184
|
"input",
|
|
4975
5185
|
{
|
|
4976
5186
|
type: "range",
|
|
@@ -4984,12 +5194,12 @@ var ImageEditor = ({
|
|
|
4984
5194
|
}
|
|
4985
5195
|
)
|
|
4986
5196
|
] }),
|
|
4987
|
-
/* @__PURE__ */
|
|
4988
|
-
/* @__PURE__ */
|
|
4989
|
-
/* @__PURE__ */
|
|
4990
|
-
/* @__PURE__ */
|
|
5197
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
5198
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5199
|
+
/* @__PURE__ */ jsx23("span", { children: "Depth Stop (Upper):" }),
|
|
5200
|
+
/* @__PURE__ */ jsx23("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
4991
5201
|
] }),
|
|
4992
|
-
/* @__PURE__ */
|
|
5202
|
+
/* @__PURE__ */ jsx23(
|
|
4993
5203
|
"input",
|
|
4994
5204
|
{
|
|
4995
5205
|
type: "range",
|
|
@@ -5003,12 +5213,12 @@ var ImageEditor = ({
|
|
|
5003
5213
|
}
|
|
5004
5214
|
)
|
|
5005
5215
|
] }),
|
|
5006
|
-
/* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
/* @__PURE__ */
|
|
5009
|
-
/* @__PURE__ */
|
|
5216
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
5217
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5218
|
+
/* @__PURE__ */ jsx23("span", { children: "Softness:" }),
|
|
5219
|
+
/* @__PURE__ */ jsx23("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5010
5220
|
] }),
|
|
5011
|
-
/* @__PURE__ */
|
|
5221
|
+
/* @__PURE__ */ jsx23(
|
|
5012
5222
|
"input",
|
|
5013
5223
|
{
|
|
5014
5224
|
type: "range",
|
|
@@ -5020,8 +5230,8 @@ var ImageEditor = ({
|
|
|
5020
5230
|
}
|
|
5021
5231
|
)
|
|
5022
5232
|
] }),
|
|
5023
|
-
/* @__PURE__ */
|
|
5024
|
-
/* @__PURE__ */
|
|
5233
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5234
|
+
/* @__PURE__ */ jsx23(
|
|
5025
5235
|
"input",
|
|
5026
5236
|
{
|
|
5027
5237
|
type: "checkbox",
|
|
@@ -5030,12 +5240,12 @@ var ImageEditor = ({
|
|
|
5030
5240
|
className: "rounded accent-primary"
|
|
5031
5241
|
}
|
|
5032
5242
|
),
|
|
5033
|
-
/* @__PURE__ */
|
|
5243
|
+
/* @__PURE__ */ jsx23("span", { children: "Invert Mask" })
|
|
5034
5244
|
] })
|
|
5035
5245
|
] })
|
|
5036
5246
|
] }),
|
|
5037
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5247
|
+
activeTab === "select" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5248
|
+
/* @__PURE__ */ jsx23(
|
|
5039
5249
|
SelectionOptionsBar,
|
|
5040
5250
|
{
|
|
5041
5251
|
controller,
|
|
@@ -5046,9 +5256,9 @@ var ImageEditor = ({
|
|
|
5046
5256
|
selectionDisplay: state.selectionDisplay
|
|
5047
5257
|
}
|
|
5048
5258
|
),
|
|
5049
|
-
selectionError && /* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5259
|
+
selectionError && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5260
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-1", children: [
|
|
5261
|
+
/* @__PURE__ */ jsx23(
|
|
5052
5262
|
"button",
|
|
5053
5263
|
{
|
|
5054
5264
|
type: "button",
|
|
@@ -5059,7 +5269,7 @@ var ImageEditor = ({
|
|
|
5059
5269
|
children: "Transform Selection"
|
|
5060
5270
|
}
|
|
5061
5271
|
),
|
|
5062
|
-
/* @__PURE__ */
|
|
5272
|
+
/* @__PURE__ */ jsx23(
|
|
5063
5273
|
"button",
|
|
5064
5274
|
{
|
|
5065
5275
|
type: "button",
|
|
@@ -5071,13 +5281,13 @@ var ImageEditor = ({
|
|
|
5071
5281
|
}
|
|
5072
5282
|
)
|
|
5073
5283
|
] }),
|
|
5074
|
-
/* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5284
|
+
/* @__PURE__ */ jsx23(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5285
|
+
/* @__PURE__ */ jsx23(ChannelsPanel, { controller })
|
|
5076
5286
|
] }),
|
|
5077
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5078
|
-
/* @__PURE__ */
|
|
5079
|
-
/* @__PURE__ */
|
|
5080
|
-
/* @__PURE__ */
|
|
5287
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5288
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5289
|
+
/* @__PURE__ */ jsx23("span", { children: "Results go to" }),
|
|
5290
|
+
/* @__PURE__ */ jsxs21(
|
|
5081
5291
|
"select",
|
|
5082
5292
|
{
|
|
5083
5293
|
"aria-label": "AI result target",
|
|
@@ -5085,54 +5295,54 @@ var ImageEditor = ({
|
|
|
5085
5295
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5086
5296
|
className: imageSelectClass,
|
|
5087
5297
|
children: [
|
|
5088
|
-
/* @__PURE__ */
|
|
5089
|
-
/* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5298
|
+
/* @__PURE__ */ jsx23("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5299
|
+
/* @__PURE__ */ jsx23("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5300
|
+
/* @__PURE__ */ jsx23("option", { value: "replace", children: "Replace image" })
|
|
5091
5301
|
]
|
|
5092
5302
|
}
|
|
5093
5303
|
)
|
|
5094
5304
|
] }),
|
|
5095
|
-
/* @__PURE__ */
|
|
5096
|
-
/* @__PURE__ */
|
|
5097
|
-
/* @__PURE__ */
|
|
5098
|
-
/* @__PURE__ */
|
|
5305
|
+
/* @__PURE__ */ jsxs21("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5306
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
|
|
5307
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5308
|
+
/* @__PURE__ */ jsx23("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx23("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" }) }),
|
|
5099
5309
|
"Background Removal"
|
|
5100
5310
|
] }),
|
|
5101
|
-
isRemovingBg && /* @__PURE__ */
|
|
5311
|
+
isRemovingBg && /* @__PURE__ */ jsx23("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..." })
|
|
5102
5312
|
] }),
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5313
|
+
/* @__PURE__ */ jsx23("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5314
|
+
/* @__PURE__ */ jsx23(
|
|
5105
5315
|
"button",
|
|
5106
5316
|
{
|
|
5107
5317
|
type: "button",
|
|
5108
5318
|
onClick: handleRemoveBackground,
|
|
5109
5319
|
disabled: isRemovingBg || isInpainting,
|
|
5110
5320
|
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",
|
|
5111
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
5112
|
-
/* @__PURE__ */
|
|
5321
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
5322
|
+
/* @__PURE__ */ jsx23("div", { className: imageSpinnerClass }),
|
|
5113
5323
|
"Removing Background..."
|
|
5114
|
-
] }) : /* @__PURE__ */
|
|
5115
|
-
/* @__PURE__ */
|
|
5324
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
5325
|
+
/* @__PURE__ */ jsx23("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx23("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" }) }),
|
|
5116
5326
|
"Remove Background"
|
|
5117
5327
|
] })
|
|
5118
5328
|
}
|
|
5119
5329
|
)
|
|
5120
5330
|
] }),
|
|
5121
|
-
/* @__PURE__ */
|
|
5122
|
-
/* @__PURE__ */
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5126
|
-
/* @__PURE__ */
|
|
5331
|
+
/* @__PURE__ */ jsxs21("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5332
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
|
|
5333
|
+
/* @__PURE__ */ jsxs21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5334
|
+
/* @__PURE__ */ jsxs21("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5335
|
+
/* @__PURE__ */ jsx23("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" }),
|
|
5336
|
+
/* @__PURE__ */ jsx23("path", { d: "m14 7 3 3" })
|
|
5127
5337
|
] }),
|
|
5128
5338
|
"Generative Inpainting"
|
|
5129
5339
|
] }),
|
|
5130
|
-
isInpainting && /* @__PURE__ */
|
|
5340
|
+
isInpainting && /* @__PURE__ */ jsx23("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..." })
|
|
5131
5341
|
] }),
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5134
|
-
/* @__PURE__ */
|
|
5135
|
-
/* @__PURE__ */
|
|
5342
|
+
/* @__PURE__ */ jsx23("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5343
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
|
|
5344
|
+
/* @__PURE__ */ jsx23("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5345
|
+
/* @__PURE__ */ jsx23(
|
|
5136
5346
|
"textarea",
|
|
5137
5347
|
{
|
|
5138
5348
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5144,10 +5354,10 @@ var ImageEditor = ({
|
|
|
5144
5354
|
}
|
|
5145
5355
|
)
|
|
5146
5356
|
] }),
|
|
5147
|
-
/* @__PURE__ */
|
|
5148
|
-
/* @__PURE__ */
|
|
5149
|
-
/* @__PURE__ */
|
|
5150
|
-
/* @__PURE__ */
|
|
5357
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
|
|
5358
|
+
/* @__PURE__ */ jsx23("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5359
|
+
/* @__PURE__ */ jsxs21("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5360
|
+
/* @__PURE__ */ jsxs21(
|
|
5151
5361
|
"button",
|
|
5152
5362
|
{
|
|
5153
5363
|
type: "button",
|
|
@@ -5160,7 +5370,7 @@ var ImageEditor = ({
|
|
|
5160
5370
|
]
|
|
5161
5371
|
}
|
|
5162
5372
|
),
|
|
5163
|
-
/* @__PURE__ */
|
|
5373
|
+
/* @__PURE__ */ jsxs21(
|
|
5164
5374
|
"button",
|
|
5165
5375
|
{
|
|
5166
5376
|
type: "button",
|
|
@@ -5175,25 +5385,25 @@ var ImageEditor = ({
|
|
|
5175
5385
|
)
|
|
5176
5386
|
] })
|
|
5177
5387
|
] }),
|
|
5178
|
-
/* @__PURE__ */
|
|
5388
|
+
/* @__PURE__ */ jsx23(
|
|
5179
5389
|
"button",
|
|
5180
5390
|
{
|
|
5181
5391
|
type: "button",
|
|
5182
5392
|
onClick: handleInpaint,
|
|
5183
5393
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5184
5394
|
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",
|
|
5185
|
-
children: isInpainting ? /* @__PURE__ */
|
|
5186
|
-
/* @__PURE__ */
|
|
5395
|
+
children: isInpainting ? /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
5396
|
+
/* @__PURE__ */ jsx23("div", { className: imageSpinnerClass }),
|
|
5187
5397
|
"Generating Inpaint..."
|
|
5188
|
-
] }) : /* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5398
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
5399
|
+
/* @__PURE__ */ jsx23("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx23("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" }) }),
|
|
5190
5400
|
"Apply Inpainting"
|
|
5191
5401
|
] })
|
|
5192
5402
|
}
|
|
5193
5403
|
)
|
|
5194
5404
|
] }),
|
|
5195
|
-
aiError && /* @__PURE__ */
|
|
5196
|
-
aiSuccess && /* @__PURE__ */
|
|
5405
|
+
aiError && /* @__PURE__ */ jsx23("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5406
|
+
aiSuccess && /* @__PURE__ */ jsx23("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5197
5407
|
] })
|
|
5198
5408
|
] })
|
|
5199
5409
|
] })
|
|
@@ -5225,6 +5435,7 @@ export {
|
|
|
5225
5435
|
BrushOptionsBar,
|
|
5226
5436
|
ColorProfilePanel,
|
|
5227
5437
|
SelectAndMaskWorkspace,
|
|
5438
|
+
ContentAwareFillWorkspace,
|
|
5228
5439
|
SelectionOptionsBar,
|
|
5229
5440
|
RefineEdgePanel,
|
|
5230
5441
|
ChannelsPanel,
|