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