@pixerate/editor-react 0.139.0 → 0.141.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-7M3PJKFN.js → chunk-DD2SZVT2.js} +870 -550
- package/dist/image-editor/ContentAwareFillWorkspace.d.cts +20 -0
- package/dist/image-editor/ContentAwareFillWorkspace.d.ts +20 -0
- package/dist/image-editor/PathsPanel.d.cts +16 -0
- package/dist/image-editor/PathsPanel.d.ts +16 -0
- package/dist/image-editor/index.cjs +893 -571
- package/dist/image-editor/index.d.cts +2 -0
- package/dist/image-editor/index.d.ts +2 -0
- package/dist/image-editor/index.js +5 -1
- package/dist/index.cjs +1418 -1096
- package/dist/index.js +5 -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 React19, { useRef as useRef11, useEffect as useEffect17, useState as useState20 } 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,
|
|
@@ -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,18 +3687,18 @@ 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
3703
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
3494
3704
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -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.filter((o) => !o.needsDocuments || controller.canOpenDocuments).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
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,125 @@ 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 })
|
|
4037
|
+
] });
|
|
4038
|
+
};
|
|
4039
|
+
|
|
4040
|
+
// src/image-editor/PathsPanel.tsx
|
|
4041
|
+
import { useEffect as useEffect13, useState as useState16 } from "react";
|
|
4042
|
+
import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
|
|
4043
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4044
|
+
var btn3 = (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"}`;
|
|
4045
|
+
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4046
|
+
const [, setTick] = useState16(0);
|
|
4047
|
+
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4048
|
+
const [renaming, setRenaming] = useState16(null);
|
|
4049
|
+
const [color, setColor] = useState16("#000000");
|
|
4050
|
+
const [width, setWidth] = useState16(2);
|
|
4051
|
+
const [error, setError] = useState16(null);
|
|
4052
|
+
const paths = controller.getPaths();
|
|
4053
|
+
const activeId = controller.getState().activePathId ?? null;
|
|
4054
|
+
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
4055
|
+
const hasSelection = Boolean(controller.getSelection());
|
|
4056
|
+
const { width: w, height: h } = controller.getState().imageDimensions;
|
|
4057
|
+
const attempt = (fn) => {
|
|
4058
|
+
setError(null);
|
|
4059
|
+
try {
|
|
4060
|
+
fn();
|
|
4061
|
+
} catch (err) {
|
|
4062
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
4063
|
+
}
|
|
4064
|
+
};
|
|
4065
|
+
return /* @__PURE__ */ jsxs18("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
4066
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
4067
|
+
paths.length === 0 && /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
4068
|
+
/* @__PURE__ */ jsx20("ul", { role: "list", className: "flex flex-col gap-0.5", children: paths.map((p) => /* @__PURE__ */ jsxs18(
|
|
4069
|
+
"li",
|
|
4070
|
+
{
|
|
4071
|
+
"data-testid": "path-row",
|
|
4072
|
+
"aria-current": p.id === activeId ? "true" : void 0,
|
|
4073
|
+
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
4074
|
+
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4075
|
+
onDoubleClick: () => setRenaming(p.id),
|
|
4076
|
+
children: [
|
|
4077
|
+
/* @__PURE__ */ jsx20("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx20("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
4078
|
+
renaming === p.id ? /* @__PURE__ */ jsx20(
|
|
4079
|
+
"input",
|
|
4080
|
+
{
|
|
4081
|
+
autoFocus: true,
|
|
4082
|
+
"aria-label": "Path name",
|
|
4083
|
+
defaultValue: p.work ? "" : p.name,
|
|
4084
|
+
placeholder: "Path name",
|
|
4085
|
+
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
4086
|
+
onClick: (e) => e.stopPropagation(),
|
|
4087
|
+
onBlur: (e) => {
|
|
4088
|
+
setRenaming(null);
|
|
4089
|
+
const name = e.currentTarget.value.trim();
|
|
4090
|
+
if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
|
|
4091
|
+
},
|
|
4092
|
+
onKeyDown: (e) => {
|
|
4093
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
4094
|
+
if (e.key === "Escape") setRenaming(null);
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
) : /* @__PURE__ */ jsx20("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4098
|
+
]
|
|
4099
|
+
},
|
|
4100
|
+
p.id
|
|
4101
|
+
)) }),
|
|
4102
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
|
|
4103
|
+
/* @__PURE__ */ jsx20(
|
|
4104
|
+
"button",
|
|
4105
|
+
{
|
|
4106
|
+
type: "button",
|
|
4107
|
+
className: btn3(),
|
|
4108
|
+
disabled: !active,
|
|
4109
|
+
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
4110
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: selectionModeFromModifiers2(e, "replace") })),
|
|
4111
|
+
children: "Load as Selection"
|
|
4112
|
+
}
|
|
4113
|
+
),
|
|
4114
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
4115
|
+
active?.work && /* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
4116
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
4117
|
+
] }),
|
|
4118
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4119
|
+
/* @__PURE__ */ jsx20("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
|
|
4120
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
4121
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4122
|
+
/* @__PURE__ */ jsx20(
|
|
4123
|
+
"input",
|
|
4124
|
+
{
|
|
4125
|
+
type: "number",
|
|
4126
|
+
min: 0.5,
|
|
4127
|
+
max: 250,
|
|
4128
|
+
step: 0.5,
|
|
4129
|
+
"aria-label": "Stroke width",
|
|
4130
|
+
value: width,
|
|
4131
|
+
onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
|
|
4132
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4133
|
+
}
|
|
4134
|
+
),
|
|
4135
|
+
"px"
|
|
4136
|
+
] }),
|
|
4137
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
4138
|
+
] }),
|
|
4139
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
|
|
4140
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
4141
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
4142
|
+
] }),
|
|
4143
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
|
|
3827
4144
|
] });
|
|
3828
4145
|
};
|
|
3829
4146
|
|
|
3830
4147
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
3831
|
-
import { useEffect as
|
|
4148
|
+
import { useEffect as useEffect14, useState as useState17 } from "react";
|
|
3832
4149
|
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
|
|
4150
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3834
4151
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
3835
4152
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
3836
|
-
const [, setTick] =
|
|
3837
|
-
|
|
4153
|
+
const [, setTick] = useState17(0);
|
|
4154
|
+
useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
3838
4155
|
const bar = tool.bar();
|
|
3839
4156
|
if (!tool.active || !bar) return null;
|
|
3840
4157
|
const warp = tool.warpBar();
|
|
@@ -3846,17 +4163,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3846
4163
|
const v = Number(raw);
|
|
3847
4164
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
3848
4165
|
};
|
|
3849
|
-
return /* @__PURE__ */
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3855
|
-
/* @__PURE__ */
|
|
4166
|
+
return /* @__PURE__ */ jsxs19("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: [
|
|
4167
|
+
/* @__PURE__ */ jsx21("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx21("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)) }),
|
|
4168
|
+
/* @__PURE__ */ jsx21("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx21("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)) }),
|
|
4169
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4170
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4171
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4172
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21("option", { value: o.id, children: o.label }, o.id)) })
|
|
3856
4173
|
] }),
|
|
3857
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
4174
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4175
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4176
|
+
/* @__PURE__ */ jsx21(
|
|
3860
4177
|
"input",
|
|
3861
4178
|
{
|
|
3862
4179
|
type: "number",
|
|
@@ -3877,9 +4194,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3877
4194
|
},
|
|
3878
4195
|
`${k}:${warp[k]}`
|
|
3879
4196
|
),
|
|
3880
|
-
/* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "%" })
|
|
3881
4198
|
] }, k)),
|
|
3882
|
-
/* @__PURE__ */
|
|
4199
|
+
/* @__PURE__ */ jsx21(
|
|
3883
4200
|
"button",
|
|
3884
4201
|
{
|
|
3885
4202
|
type: "button",
|
|
@@ -3891,9 +4208,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3891
4208
|
children: "Vertical"
|
|
3892
4209
|
}
|
|
3893
4210
|
),
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
4211
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4212
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4213
|
+
/* @__PURE__ */ jsx21(
|
|
3897
4214
|
"select",
|
|
3898
4215
|
{
|
|
3899
4216
|
"aria-label": "Warp grid",
|
|
@@ -3903,14 +4220,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3903
4220
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
3904
4221
|
},
|
|
3905
4222
|
className: imageFieldClass,
|
|
3906
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
4223
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx21("option", { value: g.id, children: g.label }, g.id))
|
|
3907
4224
|
}
|
|
3908
4225
|
)
|
|
3909
4226
|
] })
|
|
3910
4227
|
] }),
|
|
3911
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
4228
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4229
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: f.label }),
|
|
4230
|
+
/* @__PURE__ */ jsx21(
|
|
3914
4231
|
"input",
|
|
3915
4232
|
{
|
|
3916
4233
|
type: "number",
|
|
@@ -3930,8 +4247,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3930
4247
|
},
|
|
3931
4248
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
3932
4249
|
),
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4250
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4251
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx21(
|
|
3935
4252
|
"button",
|
|
3936
4253
|
{
|
|
3937
4254
|
type: "button",
|
|
@@ -3946,33 +4263,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
3946
4263
|
}
|
|
3947
4264
|
)
|
|
3948
4265
|
] }, f.id)),
|
|
3949
|
-
/* @__PURE__ */
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
/* @__PURE__ */
|
|
4266
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
|
|
4267
|
+
/* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4268
|
+
/* @__PURE__ */ jsx21(
|
|
3952
4269
|
"select",
|
|
3953
4270
|
{
|
|
3954
4271
|
"aria-label": "Interpolation",
|
|
3955
4272
|
value: tool.interpolation,
|
|
3956
4273
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
3957
4274
|
className: imageFieldClass,
|
|
3958
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4275
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx21("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
3959
4276
|
}
|
|
3960
4277
|
)
|
|
3961
4278
|
] }),
|
|
3962
|
-
/* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
tool.error && /* @__PURE__ */
|
|
4279
|
+
/* @__PURE__ */ jsx21("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" }),
|
|
4280
|
+
/* @__PURE__ */ jsx21("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4281
|
+
tool.error && /* @__PURE__ */ jsx21("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
3965
4282
|
] });
|
|
3966
4283
|
};
|
|
3967
4284
|
|
|
3968
4285
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
3969
|
-
import { useEffect as
|
|
4286
|
+
import { useEffect as useEffect15, useState as useState18 } from "react";
|
|
3970
4287
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
3971
|
-
import { Fragment as
|
|
4288
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3972
4289
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
3973
|
-
const [, setTick] =
|
|
3974
|
-
|
|
3975
|
-
const [error, setError] =
|
|
4290
|
+
const [, setTick] = useState18(0);
|
|
4291
|
+
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4292
|
+
const [error, setError] = useState18(null);
|
|
3976
4293
|
const active = controller.getActiveLayer();
|
|
3977
4294
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
3978
4295
|
const set = (change) => {
|
|
@@ -3986,22 +4303,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
3986
4303
|
}
|
|
3987
4304
|
};
|
|
3988
4305
|
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__ */
|
|
4306
|
+
return /* @__PURE__ */ jsxs20("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4307
|
+
/* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx22("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4308
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4309
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4310
|
+
/* @__PURE__ */ jsx22(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
3994
4311
|
"Fill",
|
|
3995
|
-
/* @__PURE__ */
|
|
4312
|
+
/* @__PURE__ */ jsx22(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
3996
4313
|
] }),
|
|
3997
|
-
/* @__PURE__ */
|
|
3998
|
-
/* @__PURE__ */
|
|
4314
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4315
|
+
/* @__PURE__ */ jsx22(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
3999
4316
|
"Stroke",
|
|
4000
|
-
/* @__PURE__ */
|
|
4317
|
+
/* @__PURE__ */ jsx22(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4001
4318
|
] }),
|
|
4002
|
-
/* @__PURE__ */
|
|
4319
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4003
4320
|
"Width",
|
|
4004
|
-
/* @__PURE__ */
|
|
4321
|
+
/* @__PURE__ */ jsx22(
|
|
4005
4322
|
"input",
|
|
4006
4323
|
{
|
|
4007
4324
|
type: "number",
|
|
@@ -4015,52 +4332,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4015
4332
|
)
|
|
4016
4333
|
] })
|
|
4017
4334
|
] }),
|
|
4018
|
-
/* @__PURE__ */
|
|
4019
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
4335
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4336
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4020
4337
|
"Radius",
|
|
4021
|
-
/* @__PURE__ */
|
|
4338
|
+
/* @__PURE__ */ jsx22("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
4339
|
] }),
|
|
4023
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4340
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4024
4341
|
"Sides",
|
|
4025
|
-
/* @__PURE__ */
|
|
4342
|
+
/* @__PURE__ */ jsx22("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
4343
|
] }),
|
|
4027
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4344
|
+
options.kind === "star" && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
4345
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4029
4346
|
"Points",
|
|
4030
|
-
/* @__PURE__ */
|
|
4347
|
+
/* @__PURE__ */ jsx22("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
4348
|
] }),
|
|
4032
|
-
/* @__PURE__ */
|
|
4349
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4033
4350
|
"Inner",
|
|
4034
|
-
/* @__PURE__ */
|
|
4351
|
+
/* @__PURE__ */ jsx22(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4035
4352
|
] })
|
|
4036
4353
|
] }),
|
|
4037
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4038
|
-
/* @__PURE__ */
|
|
4354
|
+
options.kind === "line" && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
4355
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4039
4356
|
"Weight",
|
|
4040
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsx22("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
4358
|
] }),
|
|
4042
|
-
/* @__PURE__ */
|
|
4043
|
-
/* @__PURE__ */
|
|
4359
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4360
|
+
/* @__PURE__ */ jsx22(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4044
4361
|
"Arrowhead"
|
|
4045
4362
|
] })
|
|
4046
4363
|
] })
|
|
4047
4364
|
] }),
|
|
4048
|
-
/* @__PURE__ */
|
|
4049
|
-
error && /* @__PURE__ */
|
|
4365
|
+
/* @__PURE__ */ jsx22("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." }),
|
|
4366
|
+
error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
|
|
4050
4367
|
] });
|
|
4051
4368
|
};
|
|
4052
4369
|
|
|
4053
4370
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4054
|
-
import { useEffect as
|
|
4371
|
+
import { useEffect as useEffect16, useState as useState19 } from "react";
|
|
4055
4372
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4056
|
-
import { jsx as
|
|
4373
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4057
4374
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4058
4375
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4059
4376
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4060
|
-
const [, setTick] =
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
const [error, setError] =
|
|
4377
|
+
const [, setTick] = useState19(0);
|
|
4378
|
+
useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4379
|
+
useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4380
|
+
const [error, setError] = useState19(null);
|
|
4064
4381
|
const active = controller.getActiveLayer();
|
|
4065
4382
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4066
4383
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4113,11 +4430,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4113
4430
|
setError(e instanceof Error ? e.message : String(e));
|
|
4114
4431
|
}
|
|
4115
4432
|
};
|
|
4116
|
-
return /* @__PURE__ */
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
4433
|
+
return /* @__PURE__ */ jsxs21("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4434
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4435
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4119
4436
|
"Font",
|
|
4120
|
-
/* @__PURE__ */
|
|
4437
|
+
/* @__PURE__ */ jsx23(
|
|
4121
4438
|
"input",
|
|
4122
4439
|
{
|
|
4123
4440
|
list: "pixerate-type-fonts",
|
|
@@ -4127,11 +4444,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4127
4444
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4128
4445
|
}
|
|
4129
4446
|
),
|
|
4130
|
-
/* @__PURE__ */
|
|
4447
|
+
/* @__PURE__ */ jsx23("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx23("option", { value: f }, f)) })
|
|
4131
4448
|
] }),
|
|
4132
|
-
/* @__PURE__ */
|
|
4449
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4133
4450
|
"Size",
|
|
4134
|
-
/* @__PURE__ */
|
|
4451
|
+
/* @__PURE__ */ jsx23(
|
|
4135
4452
|
"input",
|
|
4136
4453
|
{
|
|
4137
4454
|
type: "number",
|
|
@@ -4144,14 +4461,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4144
4461
|
}
|
|
4145
4462
|
)
|
|
4146
4463
|
] }),
|
|
4147
|
-
/* @__PURE__ */
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4464
|
+
/* @__PURE__ */ jsx23("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" }),
|
|
4465
|
+
/* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4466
|
+
/* @__PURE__ */ jsx23(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
4150
4467
|
] }),
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4154
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
4468
|
+
/* @__PURE__ */ jsx23("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4469
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
4470
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
4471
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx23(
|
|
4155
4472
|
"button",
|
|
4156
4473
|
{
|
|
4157
4474
|
type: "button",
|
|
@@ -4163,19 +4480,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4163
4480
|
}
|
|
4164
4481
|
)
|
|
4165
4482
|
] }),
|
|
4166
|
-
/* @__PURE__ */
|
|
4167
|
-
missing.length > 0 && /* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsx23("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." }),
|
|
4484
|
+
missing.length > 0 && /* @__PURE__ */ jsxs21("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4168
4485
|
"Missing ",
|
|
4169
4486
|
missing.length === 1 ? "font" : "fonts",
|
|
4170
4487
|
": ",
|
|
4171
4488
|
missing.join(", ")
|
|
4172
4489
|
] }),
|
|
4173
|
-
error && /* @__PURE__ */
|
|
4490
|
+
error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
|
|
4174
4491
|
] });
|
|
4175
4492
|
};
|
|
4176
4493
|
|
|
4177
4494
|
// src/image-editor/ImageEditor.tsx
|
|
4178
|
-
import { Fragment as
|
|
4495
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4179
4496
|
var ImageEditor = ({
|
|
4180
4497
|
editor: externalEditor,
|
|
4181
4498
|
src,
|
|
@@ -4200,32 +4517,32 @@ var ImageEditor = ({
|
|
|
4200
4517
|
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
4518
|
});
|
|
4202
4519
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4203
|
-
const [activeTab, setActiveTab] =
|
|
4204
|
-
const rootRef =
|
|
4520
|
+
const [activeTab, setActiveTab] = useState20("crop");
|
|
4521
|
+
const rootRef = useRef11(null);
|
|
4205
4522
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4206
|
-
const activeTabRef =
|
|
4523
|
+
const activeTabRef = useRef11(activeTab);
|
|
4207
4524
|
activeTabRef.current = activeTab;
|
|
4208
4525
|
const openPanel = async (ref) => {
|
|
4209
4526
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
4210
4527
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4211
4528
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4212
4529
|
};
|
|
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] =
|
|
4530
|
+
const [activeCropRatio, setActiveCropRatio] = useState20(null);
|
|
4531
|
+
const [selectionOptions, setSelectionOptions] = useState20(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
4532
|
+
const [shapeOptions, setShapeOptions] = useState20(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
4533
|
+
const [typeOptions, setTypeOptions] = useState20(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
4534
|
+
const [typeSession, setTypeSession] = useState20(null);
|
|
4535
|
+
const [selectionError, setSelectionError] = useState20(null);
|
|
4536
|
+
const [paintError, setPaintError] = useState20(null);
|
|
4537
|
+
const [shapeTypeError, setShapeTypeError] = useState20(null);
|
|
4221
4538
|
const handleCanvasError = (source, message) => {
|
|
4222
4539
|
if (source === "paint") setPaintError(message);
|
|
4223
4540
|
else if (source === "select") setSelectionError(message);
|
|
4224
4541
|
else setShapeTypeError(message);
|
|
4225
4542
|
};
|
|
4226
4543
|
const finishTyping = () => setTypeSession(null);
|
|
4227
|
-
const transformToolRef =
|
|
4228
|
-
const transformControllerRef =
|
|
4544
|
+
const transformToolRef = useRef11(null);
|
|
4545
|
+
const transformControllerRef = useRef11(controller);
|
|
4229
4546
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
4230
4547
|
transformToolRef.current?.cancel();
|
|
4231
4548
|
transformToolRef.current = new FreeTransformTool2(controller, {
|
|
@@ -4234,16 +4551,16 @@ var ImageEditor = ({
|
|
|
4234
4551
|
transformControllerRef.current = controller;
|
|
4235
4552
|
}
|
|
4236
4553
|
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] =
|
|
4554
|
+
const [, setTransformTick] = useState20(0);
|
|
4555
|
+
useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4556
|
+
useEffect17(() => () => transformToolRef.current?.cancel(), []);
|
|
4557
|
+
const [inpaintPrompt, setInpaintPrompt] = useState20("");
|
|
4558
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState20("annotations");
|
|
4559
|
+
const [isRemovingBg, setIsRemovingBg] = useState20(false);
|
|
4560
|
+
const [isInpainting, setIsInpainting] = useState20(false);
|
|
4561
|
+
const [aiError, setAiError] = useState20(null);
|
|
4562
|
+
const [aiSuccess, setAiSuccess] = useState20(null);
|
|
4563
|
+
const [aiTarget, setAiTarget] = useState20("auto");
|
|
4247
4564
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4248
4565
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4249
4566
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4306,11 +4623,11 @@ var ImageEditor = ({
|
|
|
4306
4623
|
setIsInpainting(false);
|
|
4307
4624
|
}
|
|
4308
4625
|
};
|
|
4309
|
-
const [activeColor, setActiveColor] =
|
|
4310
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4311
|
-
const [fontSize, setFontSize] =
|
|
4312
|
-
const [textInput, setTextInput] =
|
|
4313
|
-
|
|
4626
|
+
const [activeColor, setActiveColor] = useState20("#ef4444");
|
|
4627
|
+
const [strokeWidth, setStrokeWidth] = useState20(3);
|
|
4628
|
+
const [fontSize, setFontSize] = useState20(24);
|
|
4629
|
+
const [textInput, setTextInput] = useState20("");
|
|
4630
|
+
useEffect17(() => {
|
|
4314
4631
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4315
4632
|
editor.setTool("crop");
|
|
4316
4633
|
}
|
|
@@ -4338,16 +4655,16 @@ var ImageEditor = ({
|
|
|
4338
4655
|
link.click();
|
|
4339
4656
|
}
|
|
4340
4657
|
};
|
|
4341
|
-
return /* @__PURE__ */
|
|
4658
|
+
return /* @__PURE__ */ jsxs22(
|
|
4342
4659
|
"div",
|
|
4343
4660
|
{
|
|
4344
4661
|
ref: rootRef,
|
|
4345
4662
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4346
4663
|
style,
|
|
4347
4664
|
children: [
|
|
4348
|
-
/* @__PURE__ */
|
|
4349
|
-
/* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4665
|
+
/* @__PURE__ */ jsxs22("div", { className: imageEditorHeaderClass, children: [
|
|
4666
|
+
/* @__PURE__ */ jsxs22("div", { role: "tablist", className: imageTabListClass, children: [
|
|
4667
|
+
/* @__PURE__ */ jsx24(
|
|
4351
4668
|
"button",
|
|
4352
4669
|
{
|
|
4353
4670
|
type: "button",
|
|
@@ -4362,7 +4679,7 @@ var ImageEditor = ({
|
|
|
4362
4679
|
children: "Transform & Crop"
|
|
4363
4680
|
}
|
|
4364
4681
|
),
|
|
4365
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx24(
|
|
4366
4683
|
"button",
|
|
4367
4684
|
{
|
|
4368
4685
|
type: "button",
|
|
@@ -4377,7 +4694,7 @@ var ImageEditor = ({
|
|
|
4377
4694
|
children: "Adjustments"
|
|
4378
4695
|
}
|
|
4379
4696
|
),
|
|
4380
|
-
/* @__PURE__ */
|
|
4697
|
+
/* @__PURE__ */ jsx24(
|
|
4381
4698
|
"button",
|
|
4382
4699
|
{
|
|
4383
4700
|
type: "button",
|
|
@@ -4392,7 +4709,7 @@ var ImageEditor = ({
|
|
|
4392
4709
|
children: "Layers"
|
|
4393
4710
|
}
|
|
4394
4711
|
),
|
|
4395
|
-
/* @__PURE__ */
|
|
4712
|
+
/* @__PURE__ */ jsx24(
|
|
4396
4713
|
"button",
|
|
4397
4714
|
{
|
|
4398
4715
|
type: "button",
|
|
@@ -4407,7 +4724,7 @@ var ImageEditor = ({
|
|
|
4407
4724
|
children: "Paint"
|
|
4408
4725
|
}
|
|
4409
4726
|
),
|
|
4410
|
-
/* @__PURE__ */
|
|
4727
|
+
/* @__PURE__ */ jsx24(
|
|
4411
4728
|
"button",
|
|
4412
4729
|
{
|
|
4413
4730
|
type: "button",
|
|
@@ -4422,7 +4739,7 @@ var ImageEditor = ({
|
|
|
4422
4739
|
children: "Select & Mask"
|
|
4423
4740
|
}
|
|
4424
4741
|
),
|
|
4425
|
-
/* @__PURE__ */
|
|
4742
|
+
/* @__PURE__ */ jsx24(
|
|
4426
4743
|
"button",
|
|
4427
4744
|
{
|
|
4428
4745
|
type: "button",
|
|
@@ -4437,7 +4754,7 @@ var ImageEditor = ({
|
|
|
4437
4754
|
children: "Annotations"
|
|
4438
4755
|
}
|
|
4439
4756
|
),
|
|
4440
|
-
/* @__PURE__ */
|
|
4757
|
+
/* @__PURE__ */ jsx24(
|
|
4441
4758
|
"button",
|
|
4442
4759
|
{
|
|
4443
4760
|
type: "button",
|
|
@@ -4452,7 +4769,7 @@ var ImageEditor = ({
|
|
|
4452
4769
|
children: "Depth Mask"
|
|
4453
4770
|
}
|
|
4454
4771
|
),
|
|
4455
|
-
/* @__PURE__ */
|
|
4772
|
+
/* @__PURE__ */ jsxs22(
|
|
4456
4773
|
"button",
|
|
4457
4774
|
{
|
|
4458
4775
|
type: "button",
|
|
@@ -4465,14 +4782,14 @@ var ImageEditor = ({
|
|
|
4465
4782
|
"aria-selected": activeTab === "ai",
|
|
4466
4783
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
4467
4784
|
children: [
|
|
4468
|
-
/* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx24("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("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
4786
|
"AI Tools"
|
|
4470
4787
|
]
|
|
4471
4788
|
}
|
|
4472
4789
|
)
|
|
4473
4790
|
] }),
|
|
4474
|
-
/* @__PURE__ */
|
|
4475
|
-
/* @__PURE__ */
|
|
4791
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4792
|
+
/* @__PURE__ */ jsx24(
|
|
4476
4793
|
"button",
|
|
4477
4794
|
{
|
|
4478
4795
|
type: "button",
|
|
@@ -4483,7 +4800,7 @@ var ImageEditor = ({
|
|
|
4483
4800
|
children: "\u21A9"
|
|
4484
4801
|
}
|
|
4485
4802
|
),
|
|
4486
|
-
/* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ jsx24(
|
|
4487
4804
|
"button",
|
|
4488
4805
|
{
|
|
4489
4806
|
type: "button",
|
|
@@ -4494,7 +4811,7 @@ var ImageEditor = ({
|
|
|
4494
4811
|
children: "\u21AA"
|
|
4495
4812
|
}
|
|
4496
4813
|
),
|
|
4497
|
-
/* @__PURE__ */
|
|
4814
|
+
/* @__PURE__ */ jsx24(
|
|
4498
4815
|
"button",
|
|
4499
4816
|
{
|
|
4500
4817
|
type: "button",
|
|
@@ -4503,8 +4820,8 @@ var ImageEditor = ({
|
|
|
4503
4820
|
children: "Reset"
|
|
4504
4821
|
}
|
|
4505
4822
|
),
|
|
4506
|
-
/* @__PURE__ */
|
|
4507
|
-
/* @__PURE__ */
|
|
4823
|
+
/* @__PURE__ */ jsx24("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4824
|
+
/* @__PURE__ */ jsx24(
|
|
4508
4825
|
"button",
|
|
4509
4826
|
{
|
|
4510
4827
|
type: "button",
|
|
@@ -4514,11 +4831,11 @@ var ImageEditor = ({
|
|
|
4514
4831
|
children: "-"
|
|
4515
4832
|
}
|
|
4516
4833
|
),
|
|
4517
|
-
/* @__PURE__ */
|
|
4834
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
4518
4835
|
Math.round(state.zoom * 100),
|
|
4519
4836
|
"%"
|
|
4520
4837
|
] }),
|
|
4521
|
-
/* @__PURE__ */
|
|
4838
|
+
/* @__PURE__ */ jsx24(
|
|
4522
4839
|
"button",
|
|
4523
4840
|
{
|
|
4524
4841
|
type: "button",
|
|
@@ -4528,8 +4845,8 @@ var ImageEditor = ({
|
|
|
4528
4845
|
children: "+"
|
|
4529
4846
|
}
|
|
4530
4847
|
),
|
|
4531
|
-
/* @__PURE__ */
|
|
4532
|
-
/* @__PURE__ */
|
|
4848
|
+
/* @__PURE__ */ jsx24("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4849
|
+
/* @__PURE__ */ jsx24(
|
|
4533
4850
|
"button",
|
|
4534
4851
|
{
|
|
4535
4852
|
type: "button",
|
|
@@ -4540,7 +4857,7 @@ var ImageEditor = ({
|
|
|
4540
4857
|
children: "Hold Compare"
|
|
4541
4858
|
}
|
|
4542
4859
|
),
|
|
4543
|
-
/* @__PURE__ */
|
|
4860
|
+
/* @__PURE__ */ jsx24(
|
|
4544
4861
|
"button",
|
|
4545
4862
|
{
|
|
4546
4863
|
type: "button",
|
|
@@ -4551,10 +4868,10 @@ var ImageEditor = ({
|
|
|
4551
4868
|
)
|
|
4552
4869
|
] })
|
|
4553
4870
|
] }),
|
|
4554
|
-
transformTool.active && /* @__PURE__ */
|
|
4555
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4871
|
+
transformTool.active && /* @__PURE__ */ jsx24(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
4872
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx24("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
4873
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
4874
|
+
/* @__PURE__ */ jsx24(
|
|
4558
4875
|
ImageEditorCanvas,
|
|
4559
4876
|
{
|
|
4560
4877
|
editor,
|
|
@@ -4578,11 +4895,11 @@ var ImageEditor = ({
|
|
|
4578
4895
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
4579
4896
|
}
|
|
4580
4897
|
),
|
|
4581
|
-
/* @__PURE__ */
|
|
4582
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ jsxs22("div", { className: imageSidebarClass, children: [
|
|
4899
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
4900
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
4901
|
+
/* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
4902
|
+
/* @__PURE__ */ jsx24(
|
|
4586
4903
|
"button",
|
|
4587
4904
|
{
|
|
4588
4905
|
type: "button",
|
|
@@ -4594,7 +4911,7 @@ var ImageEditor = ({
|
|
|
4594
4911
|
children: "Freeform"
|
|
4595
4912
|
}
|
|
4596
4913
|
),
|
|
4597
|
-
/* @__PURE__ */
|
|
4914
|
+
/* @__PURE__ */ jsx24(
|
|
4598
4915
|
"button",
|
|
4599
4916
|
{
|
|
4600
4917
|
type: "button",
|
|
@@ -4606,7 +4923,7 @@ var ImageEditor = ({
|
|
|
4606
4923
|
children: "1:1 Square"
|
|
4607
4924
|
}
|
|
4608
4925
|
),
|
|
4609
|
-
/* @__PURE__ */
|
|
4926
|
+
/* @__PURE__ */ jsx24(
|
|
4610
4927
|
"button",
|
|
4611
4928
|
{
|
|
4612
4929
|
type: "button",
|
|
@@ -4618,7 +4935,7 @@ var ImageEditor = ({
|
|
|
4618
4935
|
children: "4:3 Standard"
|
|
4619
4936
|
}
|
|
4620
4937
|
),
|
|
4621
|
-
/* @__PURE__ */
|
|
4938
|
+
/* @__PURE__ */ jsx24(
|
|
4622
4939
|
"button",
|
|
4623
4940
|
{
|
|
4624
4941
|
type: "button",
|
|
@@ -4630,7 +4947,7 @@ var ImageEditor = ({
|
|
|
4630
4947
|
children: "16:9 Wide"
|
|
4631
4948
|
}
|
|
4632
4949
|
),
|
|
4633
|
-
/* @__PURE__ */
|
|
4950
|
+
/* @__PURE__ */ jsx24(
|
|
4634
4951
|
"button",
|
|
4635
4952
|
{
|
|
4636
4953
|
type: "button",
|
|
@@ -4642,7 +4959,7 @@ var ImageEditor = ({
|
|
|
4642
4959
|
children: "3:2 Photo"
|
|
4643
4960
|
}
|
|
4644
4961
|
),
|
|
4645
|
-
/* @__PURE__ */
|
|
4962
|
+
/* @__PURE__ */ jsx24(
|
|
4646
4963
|
"button",
|
|
4647
4964
|
{
|
|
4648
4965
|
type: "button",
|
|
@@ -4655,10 +4972,10 @@ var ImageEditor = ({
|
|
|
4655
4972
|
}
|
|
4656
4973
|
)
|
|
4657
4974
|
] }),
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4975
|
+
/* @__PURE__ */ jsx24("div", { className: imageDividerClass }),
|
|
4976
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
4977
|
+
/* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4978
|
+
/* @__PURE__ */ jsx24(
|
|
4662
4979
|
"button",
|
|
4663
4980
|
{
|
|
4664
4981
|
type: "button",
|
|
@@ -4667,7 +4984,7 @@ var ImageEditor = ({
|
|
|
4667
4984
|
children: "Rotate -90\xB0"
|
|
4668
4985
|
}
|
|
4669
4986
|
),
|
|
4670
|
-
/* @__PURE__ */
|
|
4987
|
+
/* @__PURE__ */ jsx24(
|
|
4671
4988
|
"button",
|
|
4672
4989
|
{
|
|
4673
4990
|
type: "button",
|
|
@@ -4676,7 +4993,7 @@ var ImageEditor = ({
|
|
|
4676
4993
|
children: "Rotate +90\xB0"
|
|
4677
4994
|
}
|
|
4678
4995
|
),
|
|
4679
|
-
/* @__PURE__ */
|
|
4996
|
+
/* @__PURE__ */ jsx24(
|
|
4680
4997
|
"button",
|
|
4681
4998
|
{
|
|
4682
4999
|
type: "button",
|
|
@@ -4685,7 +5002,7 @@ var ImageEditor = ({
|
|
|
4685
5002
|
children: "Flip Horizontal"
|
|
4686
5003
|
}
|
|
4687
5004
|
),
|
|
4688
|
-
/* @__PURE__ */
|
|
5005
|
+
/* @__PURE__ */ jsx24(
|
|
4689
5006
|
"button",
|
|
4690
5007
|
{
|
|
4691
5008
|
type: "button",
|
|
@@ -4696,10 +5013,10 @@ var ImageEditor = ({
|
|
|
4696
5013
|
)
|
|
4697
5014
|
] })
|
|
4698
5015
|
] }),
|
|
4699
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
5016
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5017
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
5018
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5019
|
+
/* @__PURE__ */ jsx24(
|
|
4703
5020
|
"button",
|
|
4704
5021
|
{
|
|
4705
5022
|
type: "button",
|
|
@@ -4709,9 +5026,9 @@ var ImageEditor = ({
|
|
|
4709
5026
|
}
|
|
4710
5027
|
)
|
|
4711
5028
|
] }),
|
|
4712
|
-
/* @__PURE__ */
|
|
4713
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
4714
|
-
/* @__PURE__ */
|
|
5029
|
+
/* @__PURE__ */ jsx24(Histogram, { histogram: editor.histogram }),
|
|
5030
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs22(React19.Fragment, { children: [
|
|
5031
|
+
/* @__PURE__ */ jsx24(
|
|
4715
5032
|
ControlSlider,
|
|
4716
5033
|
{
|
|
4717
5034
|
spec,
|
|
@@ -4720,14 +5037,14 @@ var ImageEditor = ({
|
|
|
4720
5037
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
4721
5038
|
}
|
|
4722
5039
|
),
|
|
4723
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
5040
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs22(
|
|
4724
5041
|
"div",
|
|
4725
5042
|
{
|
|
4726
5043
|
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
5044
|
"data-testid": "image-editor-process-notice",
|
|
4728
5045
|
children: [
|
|
4729
|
-
/* @__PURE__ */
|
|
4730
|
-
/* @__PURE__ */
|
|
5046
|
+
/* @__PURE__ */ jsx24("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5047
|
+
/* @__PURE__ */ jsx24(
|
|
4731
5048
|
"button",
|
|
4732
5049
|
{
|
|
4733
5050
|
type: "button",
|
|
@@ -4740,7 +5057,7 @@ var ImageEditor = ({
|
|
|
4740
5057
|
}
|
|
4741
5058
|
)
|
|
4742
5059
|
] }, spec.id)),
|
|
4743
|
-
/* @__PURE__ */
|
|
5060
|
+
/* @__PURE__ */ jsx24("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx24(
|
|
4744
5061
|
AdjustmentLayersPanel,
|
|
4745
5062
|
{
|
|
4746
5063
|
controller,
|
|
@@ -4749,9 +5066,9 @@ var ImageEditor = ({
|
|
|
4749
5066
|
}
|
|
4750
5067
|
) })
|
|
4751
5068
|
] }),
|
|
4752
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
4753
|
-
/* @__PURE__ */
|
|
4754
|
-
/* @__PURE__ */
|
|
5069
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5070
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5071
|
+
/* @__PURE__ */ jsx24(
|
|
4755
5072
|
"button",
|
|
4756
5073
|
{
|
|
4757
5074
|
type: "button",
|
|
@@ -4762,15 +5079,15 @@ var ImageEditor = ({
|
|
|
4762
5079
|
children: "Free Transform"
|
|
4763
5080
|
}
|
|
4764
5081
|
),
|
|
4765
|
-
/* @__PURE__ */
|
|
4766
|
-
effectsShown && /* @__PURE__ */
|
|
4767
|
-
/* @__PURE__ */
|
|
4768
|
-
/* @__PURE__ */
|
|
5082
|
+
/* @__PURE__ */ jsx24(LayersPanel, { controller }),
|
|
5083
|
+
effectsShown && /* @__PURE__ */ jsx24(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5084
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5085
|
+
/* @__PURE__ */ jsx24(ColorProfilePanel, { controller })
|
|
4769
5086
|
] }),
|
|
4770
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
4771
|
-
/* @__PURE__ */
|
|
4772
|
-
/* @__PURE__ */
|
|
4773
|
-
/* @__PURE__ */
|
|
5087
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5088
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5089
|
+
/* @__PURE__ */ jsx24(BrushOptionsBar, { controller }),
|
|
5090
|
+
/* @__PURE__ */ jsx24(
|
|
4774
5091
|
"button",
|
|
4775
5092
|
{
|
|
4776
5093
|
type: "button",
|
|
@@ -4781,12 +5098,12 @@ var ImageEditor = ({
|
|
|
4781
5098
|
children: "Free Transform"
|
|
4782
5099
|
}
|
|
4783
5100
|
),
|
|
4784
|
-
paintError && /* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
5101
|
+
paintError && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5102
|
+
/* @__PURE__ */ jsx24("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx24(LayersPanel, { controller }) })
|
|
4786
5103
|
] }),
|
|
4787
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
5104
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5105
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
5106
|
+
/* @__PURE__ */ jsx24("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx24(
|
|
4790
5107
|
"button",
|
|
4791
5108
|
{
|
|
4792
5109
|
type: "button",
|
|
@@ -4797,13 +5114,13 @@ var ImageEditor = ({
|
|
|
4797
5114
|
},
|
|
4798
5115
|
t
|
|
4799
5116
|
)) }),
|
|
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__ */
|
|
5117
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx24(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5118
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx24(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5119
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx24("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" }),
|
|
5120
|
+
shapeTypeError && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5121
|
+
/* @__PURE__ */ jsx24("div", { className: imageDividerClass }),
|
|
5122
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5123
|
+
/* @__PURE__ */ jsx24("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx24(
|
|
4807
5124
|
"button",
|
|
4808
5125
|
{
|
|
4809
5126
|
type: "button",
|
|
@@ -4813,18 +5130,18 @@ var ImageEditor = ({
|
|
|
4813
5130
|
},
|
|
4814
5131
|
t
|
|
4815
5132
|
)) }),
|
|
4816
|
-
/* @__PURE__ */
|
|
4817
|
-
/* @__PURE__ */
|
|
4818
|
-
/* @__PURE__ */
|
|
4819
|
-
/* @__PURE__ */
|
|
4820
|
-
/* @__PURE__ */
|
|
4821
|
-
/* @__PURE__ */
|
|
4822
|
-
/* @__PURE__ */
|
|
5133
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5134
|
+
/* @__PURE__ */ jsx24("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5135
|
+
/* @__PURE__ */ jsx24(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
5136
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex-1 ml-2", children: [
|
|
5137
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5138
|
+
/* @__PURE__ */ jsx24("span", { children: "Width:" }),
|
|
5139
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
|
|
4823
5140
|
strokeWidth,
|
|
4824
5141
|
"px"
|
|
4825
5142
|
] })
|
|
4826
5143
|
] }),
|
|
4827
|
-
/* @__PURE__ */
|
|
5144
|
+
/* @__PURE__ */ jsx24(
|
|
4828
5145
|
"input",
|
|
4829
5146
|
{
|
|
4830
5147
|
type: "range",
|
|
@@ -4837,10 +5154,10 @@ var ImageEditor = ({
|
|
|
4837
5154
|
)
|
|
4838
5155
|
] })
|
|
4839
5156
|
] }),
|
|
4840
|
-
/* @__PURE__ */
|
|
4841
|
-
/* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
/* @__PURE__ */
|
|
5157
|
+
/* @__PURE__ */ jsx24("div", { className: imageDividerClass }),
|
|
5158
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5159
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-2", children: [
|
|
5160
|
+
/* @__PURE__ */ jsx24(
|
|
4844
5161
|
"input",
|
|
4845
5162
|
{
|
|
4846
5163
|
type: "text",
|
|
@@ -4851,7 +5168,7 @@ var ImageEditor = ({
|
|
|
4851
5168
|
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
5169
|
}
|
|
4853
5170
|
),
|
|
4854
|
-
/* @__PURE__ */
|
|
5171
|
+
/* @__PURE__ */ jsx24(
|
|
4855
5172
|
"button",
|
|
4856
5173
|
{
|
|
4857
5174
|
type: "button",
|
|
@@ -4861,14 +5178,14 @@ var ImageEditor = ({
|
|
|
4861
5178
|
}
|
|
4862
5179
|
)
|
|
4863
5180
|
] }),
|
|
4864
|
-
/* @__PURE__ */
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
5181
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5182
|
+
/* @__PURE__ */ jsx24("span", { children: "Font Size:" }),
|
|
5183
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
|
|
4867
5184
|
fontSize,
|
|
4868
5185
|
"px"
|
|
4869
5186
|
] })
|
|
4870
5187
|
] }),
|
|
4871
|
-
/* @__PURE__ */
|
|
5188
|
+
/* @__PURE__ */ jsx24(
|
|
4872
5189
|
"input",
|
|
4873
5190
|
{
|
|
4874
5191
|
type: "range",
|
|
@@ -4879,14 +5196,14 @@ var ImageEditor = ({
|
|
|
4879
5196
|
className: imageRangeClass
|
|
4880
5197
|
}
|
|
4881
5198
|
),
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
/* @__PURE__ */
|
|
5199
|
+
/* @__PURE__ */ jsx24("div", { className: imageDividerClass }),
|
|
5200
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
5201
|
+
/* @__PURE__ */ jsxs22("span", { className: "text-muted-foreground", children: [
|
|
4885
5202
|
"Layers (",
|
|
4886
5203
|
state.annotations.length,
|
|
4887
5204
|
")"
|
|
4888
5205
|
] }),
|
|
4889
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5206
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx24(
|
|
4890
5207
|
"button",
|
|
4891
5208
|
{
|
|
4892
5209
|
type: "button",
|
|
@@ -4895,7 +5212,7 @@ var ImageEditor = ({
|
|
|
4895
5212
|
children: "Delete Selected"
|
|
4896
5213
|
}
|
|
4897
5214
|
),
|
|
4898
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5215
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx24(
|
|
4899
5216
|
"button",
|
|
4900
5217
|
{
|
|
4901
5218
|
type: "button",
|
|
@@ -4906,10 +5223,10 @@ var ImageEditor = ({
|
|
|
4906
5223
|
)
|
|
4907
5224
|
] })
|
|
4908
5225
|
] }),
|
|
4909
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
4910
|
-
/* @__PURE__ */
|
|
4911
|
-
/* @__PURE__ */
|
|
4912
|
-
/* @__PURE__ */
|
|
5226
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5227
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
5228
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5229
|
+
/* @__PURE__ */ jsx24(
|
|
4913
5230
|
"button",
|
|
4914
5231
|
{
|
|
4915
5232
|
type: "button",
|
|
@@ -4919,8 +5236,8 @@ var ImageEditor = ({
|
|
|
4919
5236
|
}
|
|
4920
5237
|
)
|
|
4921
5238
|
] }),
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
5239
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5240
|
+
/* @__PURE__ */ jsx24(
|
|
4924
5241
|
"input",
|
|
4925
5242
|
{
|
|
4926
5243
|
type: "checkbox",
|
|
@@ -4929,12 +5246,12 @@ var ImageEditor = ({
|
|
|
4929
5246
|
className: "rounded accent-primary"
|
|
4930
5247
|
}
|
|
4931
5248
|
),
|
|
4932
|
-
/* @__PURE__ */
|
|
5249
|
+
/* @__PURE__ */ jsx24("span", { children: "Enable Depth / Alpha Mask" })
|
|
4933
5250
|
] }),
|
|
4934
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
4935
|
-
/* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
5251
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5252
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5253
|
+
/* @__PURE__ */ jsx24("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5254
|
+
/* @__PURE__ */ jsx24(
|
|
4938
5255
|
"input",
|
|
4939
5256
|
{
|
|
4940
5257
|
type: "text",
|
|
@@ -4945,8 +5262,8 @@ var ImageEditor = ({
|
|
|
4945
5262
|
}
|
|
4946
5263
|
)
|
|
4947
5264
|
] }),
|
|
4948
|
-
/* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
5265
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-2", children: [
|
|
5266
|
+
/* @__PURE__ */ jsx24(
|
|
4950
5267
|
"button",
|
|
4951
5268
|
{
|
|
4952
5269
|
type: "button",
|
|
@@ -4955,7 +5272,7 @@ var ImageEditor = ({
|
|
|
4955
5272
|
children: "Threshold Mode"
|
|
4956
5273
|
}
|
|
4957
5274
|
),
|
|
4958
|
-
/* @__PURE__ */
|
|
5275
|
+
/* @__PURE__ */ jsx24(
|
|
4959
5276
|
"button",
|
|
4960
5277
|
{
|
|
4961
5278
|
type: "button",
|
|
@@ -4965,12 +5282,12 @@ var ImageEditor = ({
|
|
|
4965
5282
|
}
|
|
4966
5283
|
)
|
|
4967
5284
|
] }),
|
|
4968
|
-
/* @__PURE__ */
|
|
4969
|
-
/* @__PURE__ */
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
5285
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5286
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5287
|
+
/* @__PURE__ */ jsx24("span", { children: "Depth Start (Lower):" }),
|
|
5288
|
+
/* @__PURE__ */ jsx24("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
4972
5289
|
] }),
|
|
4973
|
-
/* @__PURE__ */
|
|
5290
|
+
/* @__PURE__ */ jsx24(
|
|
4974
5291
|
"input",
|
|
4975
5292
|
{
|
|
4976
5293
|
type: "range",
|
|
@@ -4984,12 +5301,12 @@ var ImageEditor = ({
|
|
|
4984
5301
|
}
|
|
4985
5302
|
)
|
|
4986
5303
|
] }),
|
|
4987
|
-
/* @__PURE__ */
|
|
4988
|
-
/* @__PURE__ */
|
|
4989
|
-
/* @__PURE__ */
|
|
4990
|
-
/* @__PURE__ */
|
|
5304
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5305
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5306
|
+
/* @__PURE__ */ jsx24("span", { children: "Depth Stop (Upper):" }),
|
|
5307
|
+
/* @__PURE__ */ jsx24("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
4991
5308
|
] }),
|
|
4992
|
-
/* @__PURE__ */
|
|
5309
|
+
/* @__PURE__ */ jsx24(
|
|
4993
5310
|
"input",
|
|
4994
5311
|
{
|
|
4995
5312
|
type: "range",
|
|
@@ -5003,12 +5320,12 @@ var ImageEditor = ({
|
|
|
5003
5320
|
}
|
|
5004
5321
|
)
|
|
5005
5322
|
] }),
|
|
5006
|
-
/* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
/* @__PURE__ */
|
|
5009
|
-
/* @__PURE__ */
|
|
5323
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5324
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5325
|
+
/* @__PURE__ */ jsx24("span", { children: "Softness:" }),
|
|
5326
|
+
/* @__PURE__ */ jsx24("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5010
5327
|
] }),
|
|
5011
|
-
/* @__PURE__ */
|
|
5328
|
+
/* @__PURE__ */ jsx24(
|
|
5012
5329
|
"input",
|
|
5013
5330
|
{
|
|
5014
5331
|
type: "range",
|
|
@@ -5020,8 +5337,8 @@ var ImageEditor = ({
|
|
|
5020
5337
|
}
|
|
5021
5338
|
)
|
|
5022
5339
|
] }),
|
|
5023
|
-
/* @__PURE__ */
|
|
5024
|
-
/* @__PURE__ */
|
|
5340
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5341
|
+
/* @__PURE__ */ jsx24(
|
|
5025
5342
|
"input",
|
|
5026
5343
|
{
|
|
5027
5344
|
type: "checkbox",
|
|
@@ -5030,12 +5347,12 @@ var ImageEditor = ({
|
|
|
5030
5347
|
className: "rounded accent-primary"
|
|
5031
5348
|
}
|
|
5032
5349
|
),
|
|
5033
|
-
/* @__PURE__ */
|
|
5350
|
+
/* @__PURE__ */ jsx24("span", { children: "Invert Mask" })
|
|
5034
5351
|
] })
|
|
5035
5352
|
] })
|
|
5036
5353
|
] }),
|
|
5037
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5354
|
+
activeTab === "select" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5355
|
+
/* @__PURE__ */ jsx24(
|
|
5039
5356
|
SelectionOptionsBar,
|
|
5040
5357
|
{
|
|
5041
5358
|
controller,
|
|
@@ -5046,9 +5363,9 @@ var ImageEditor = ({
|
|
|
5046
5363
|
selectionDisplay: state.selectionDisplay
|
|
5047
5364
|
}
|
|
5048
5365
|
),
|
|
5049
|
-
selectionError && /* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5366
|
+
selectionError && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5367
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-1", children: [
|
|
5368
|
+
/* @__PURE__ */ jsx24(
|
|
5052
5369
|
"button",
|
|
5053
5370
|
{
|
|
5054
5371
|
type: "button",
|
|
@@ -5059,7 +5376,7 @@ var ImageEditor = ({
|
|
|
5059
5376
|
children: "Transform Selection"
|
|
5060
5377
|
}
|
|
5061
5378
|
),
|
|
5062
|
-
/* @__PURE__ */
|
|
5379
|
+
/* @__PURE__ */ jsx24(
|
|
5063
5380
|
"button",
|
|
5064
5381
|
{
|
|
5065
5382
|
type: "button",
|
|
@@ -5071,13 +5388,14 @@ var ImageEditor = ({
|
|
|
5071
5388
|
}
|
|
5072
5389
|
)
|
|
5073
5390
|
] }),
|
|
5074
|
-
/* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5391
|
+
/* @__PURE__ */ jsx24(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5392
|
+
/* @__PURE__ */ jsx24(ChannelsPanel, { controller }),
|
|
5393
|
+
/* @__PURE__ */ jsx24(PathsPanel, { controller })
|
|
5076
5394
|
] }),
|
|
5077
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5078
|
-
/* @__PURE__ */
|
|
5079
|
-
/* @__PURE__ */
|
|
5080
|
-
/* @__PURE__ */
|
|
5395
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5396
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5397
|
+
/* @__PURE__ */ jsx24("span", { children: "Results go to" }),
|
|
5398
|
+
/* @__PURE__ */ jsxs22(
|
|
5081
5399
|
"select",
|
|
5082
5400
|
{
|
|
5083
5401
|
"aria-label": "AI result target",
|
|
@@ -5085,54 +5403,54 @@ var ImageEditor = ({
|
|
|
5085
5403
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5086
5404
|
className: imageSelectClass,
|
|
5087
5405
|
children: [
|
|
5088
|
-
/* @__PURE__ */
|
|
5089
|
-
/* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5406
|
+
/* @__PURE__ */ jsx24("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5407
|
+
/* @__PURE__ */ jsx24("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5408
|
+
/* @__PURE__ */ jsx24("option", { value: "replace", children: "Replace image" })
|
|
5091
5409
|
]
|
|
5092
5410
|
}
|
|
5093
5411
|
)
|
|
5094
5412
|
] }),
|
|
5095
|
-
/* @__PURE__ */
|
|
5096
|
-
/* @__PURE__ */
|
|
5097
|
-
/* @__PURE__ */
|
|
5098
|
-
/* @__PURE__ */
|
|
5413
|
+
/* @__PURE__ */ jsxs22("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5414
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
5415
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5416
|
+
/* @__PURE__ */ jsx24("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("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
5417
|
"Background Removal"
|
|
5100
5418
|
] }),
|
|
5101
|
-
isRemovingBg && /* @__PURE__ */
|
|
5419
|
+
isRemovingBg && /* @__PURE__ */ jsx24("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
5420
|
] }),
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ jsx24("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5422
|
+
/* @__PURE__ */ jsx24(
|
|
5105
5423
|
"button",
|
|
5106
5424
|
{
|
|
5107
5425
|
type: "button",
|
|
5108
5426
|
onClick: handleRemoveBackground,
|
|
5109
5427
|
disabled: isRemovingBg || isInpainting,
|
|
5110
5428
|
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__ */
|
|
5429
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5430
|
+
/* @__PURE__ */ jsx24("div", { className: imageSpinnerClass }),
|
|
5113
5431
|
"Removing Background..."
|
|
5114
|
-
] }) : /* @__PURE__ */
|
|
5115
|
-
/* @__PURE__ */
|
|
5432
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5433
|
+
/* @__PURE__ */ jsx24("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("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
5434
|
"Remove Background"
|
|
5117
5435
|
] })
|
|
5118
5436
|
}
|
|
5119
5437
|
)
|
|
5120
5438
|
] }),
|
|
5121
|
-
/* @__PURE__ */
|
|
5122
|
-
/* @__PURE__ */
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5126
|
-
/* @__PURE__ */
|
|
5439
|
+
/* @__PURE__ */ jsxs22("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5440
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
5441
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5442
|
+
/* @__PURE__ */ jsxs22("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5443
|
+
/* @__PURE__ */ jsx24("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" }),
|
|
5444
|
+
/* @__PURE__ */ jsx24("path", { d: "m14 7 3 3" })
|
|
5127
5445
|
] }),
|
|
5128
5446
|
"Generative Inpainting"
|
|
5129
5447
|
] }),
|
|
5130
|
-
isInpainting && /* @__PURE__ */
|
|
5448
|
+
isInpainting && /* @__PURE__ */ jsx24("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
5449
|
] }),
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5134
|
-
/* @__PURE__ */
|
|
5135
|
-
/* @__PURE__ */
|
|
5450
|
+
/* @__PURE__ */ jsx24("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5451
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-1", children: [
|
|
5452
|
+
/* @__PURE__ */ jsx24("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5453
|
+
/* @__PURE__ */ jsx24(
|
|
5136
5454
|
"textarea",
|
|
5137
5455
|
{
|
|
5138
5456
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5144,10 +5462,10 @@ var ImageEditor = ({
|
|
|
5144
5462
|
}
|
|
5145
5463
|
)
|
|
5146
5464
|
] }),
|
|
5147
|
-
/* @__PURE__ */
|
|
5148
|
-
/* @__PURE__ */
|
|
5149
|
-
/* @__PURE__ */
|
|
5150
|
-
/* @__PURE__ */
|
|
5465
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-1", children: [
|
|
5466
|
+
/* @__PURE__ */ jsx24("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5467
|
+
/* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5468
|
+
/* @__PURE__ */ jsxs22(
|
|
5151
5469
|
"button",
|
|
5152
5470
|
{
|
|
5153
5471
|
type: "button",
|
|
@@ -5160,7 +5478,7 @@ var ImageEditor = ({
|
|
|
5160
5478
|
]
|
|
5161
5479
|
}
|
|
5162
5480
|
),
|
|
5163
|
-
/* @__PURE__ */
|
|
5481
|
+
/* @__PURE__ */ jsxs22(
|
|
5164
5482
|
"button",
|
|
5165
5483
|
{
|
|
5166
5484
|
type: "button",
|
|
@@ -5175,25 +5493,25 @@ var ImageEditor = ({
|
|
|
5175
5493
|
)
|
|
5176
5494
|
] })
|
|
5177
5495
|
] }),
|
|
5178
|
-
/* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsx24(
|
|
5179
5497
|
"button",
|
|
5180
5498
|
{
|
|
5181
5499
|
type: "button",
|
|
5182
5500
|
onClick: handleInpaint,
|
|
5183
5501
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5184
5502
|
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__ */
|
|
5503
|
+
children: isInpainting ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5504
|
+
/* @__PURE__ */ jsx24("div", { className: imageSpinnerClass }),
|
|
5187
5505
|
"Generating Inpaint..."
|
|
5188
|
-
] }) : /* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5506
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
5507
|
+
/* @__PURE__ */ jsx24("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("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
5508
|
"Apply Inpainting"
|
|
5191
5509
|
] })
|
|
5192
5510
|
}
|
|
5193
5511
|
)
|
|
5194
5512
|
] }),
|
|
5195
|
-
aiError && /* @__PURE__ */
|
|
5196
|
-
aiSuccess && /* @__PURE__ */
|
|
5513
|
+
aiError && /* @__PURE__ */ jsx24("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5514
|
+
aiSuccess && /* @__PURE__ */ jsx24("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5197
5515
|
] })
|
|
5198
5516
|
] })
|
|
5199
5517
|
] })
|
|
@@ -5225,9 +5543,11 @@ export {
|
|
|
5225
5543
|
BrushOptionsBar,
|
|
5226
5544
|
ColorProfilePanel,
|
|
5227
5545
|
SelectAndMaskWorkspace,
|
|
5546
|
+
ContentAwareFillWorkspace,
|
|
5228
5547
|
SelectionOptionsBar,
|
|
5229
5548
|
RefineEdgePanel,
|
|
5230
5549
|
ChannelsPanel,
|
|
5550
|
+
PathsPanel,
|
|
5231
5551
|
FreeTransformOptionsBar,
|
|
5232
5552
|
ShapeOptionsBar,
|
|
5233
5553
|
TypeOptionsBar,
|