@pixerate/editor-react 0.149.0 → 0.150.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-3UIHKJ75.js → chunk-4GVCM2UX.js} +801 -740
- package/dist/image-editor/SelectionRecipePanel.d.cts +14 -0
- package/dist/image-editor/SelectionRecipePanel.d.ts +14 -0
- package/dist/image-editor/index.cjs +861 -799
- 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 +1386 -1324
- 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 React25, { useRef as useRef13, useEffect as useEffect17, useState as useState26 } from "react";
|
|
194
194
|
import {
|
|
195
195
|
normalizeProcessVersion,
|
|
196
196
|
LATEST_PROCESS_VERSION,
|
|
@@ -2851,7 +2851,66 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
2851
2851
|
};
|
|
2852
2852
|
|
|
2853
2853
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
2854
|
-
import { useRef as useRef10, useState as
|
|
2854
|
+
import { useRef as useRef10, useState as useState16 } from "react";
|
|
2855
|
+
|
|
2856
|
+
// src/image-editor/SelectionRecipePanel.tsx
|
|
2857
|
+
import { useState as useState13 } from "react";
|
|
2858
|
+
import { describeRecipeStep, recipeStepSetting } from "@pixerate/editor/image-editor";
|
|
2859
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2860
|
+
var MODES2 = ["replace", "add", "subtract", "intersect"];
|
|
2861
|
+
var button = "px-1.5 py-0.5 rounded border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
2862
|
+
var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
2863
|
+
const [error, setError] = useState13(null);
|
|
2864
|
+
const recipe = controller.getSelectionRecipe();
|
|
2865
|
+
if (!recipe.live) return null;
|
|
2866
|
+
const run = (p) => {
|
|
2867
|
+
setError(null);
|
|
2868
|
+
Promise.resolve(p).catch((err) => setError(err instanceof Error ? err.message : String(err)));
|
|
2869
|
+
};
|
|
2870
|
+
return /* @__PURE__ */ jsxs15("div", { "data-testid": "selection-recipe", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
2871
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
|
|
2872
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Selection steps" }),
|
|
2873
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
|
|
2874
|
+
] }),
|
|
2875
|
+
/* @__PURE__ */ jsx17("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
|
|
2876
|
+
const setting = recipeStepSetting(step);
|
|
2877
|
+
const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
|
|
2878
|
+
return /* @__PURE__ */ jsxs15("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
|
|
2879
|
+
/* @__PURE__ */ jsx17("span", { className: "flex-1 min-w-0 truncate text-foreground", children: describeRecipeStep(step) }),
|
|
2880
|
+
shape && step.index > 0 && /* @__PURE__ */ jsx17(
|
|
2881
|
+
"select",
|
|
2882
|
+
{
|
|
2883
|
+
"aria-label": `Step ${step.index + 1} mode`,
|
|
2884
|
+
value: step.mode ?? "replace",
|
|
2885
|
+
onChange: (e) => run(controller.editSelectionStep(step.index, { mode: e.target.value })),
|
|
2886
|
+
className: "bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
2887
|
+
children: MODES2.map((m) => /* @__PURE__ */ jsx17("option", { value: m, children: m }, m))
|
|
2888
|
+
}
|
|
2889
|
+
),
|
|
2890
|
+
setting && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2891
|
+
setting.label,
|
|
2892
|
+
/* @__PURE__ */ jsx17(
|
|
2893
|
+
"input",
|
|
2894
|
+
{
|
|
2895
|
+
type: "number",
|
|
2896
|
+
min: setting.min,
|
|
2897
|
+
max: setting.max,
|
|
2898
|
+
"aria-label": `Step ${step.index + 1} ${setting.label}`,
|
|
2899
|
+
defaultValue: setting.value,
|
|
2900
|
+
onBlur: (e) => Number(e.target.value) !== setting.value && run(controller.editSelectionStep(step.index, setting.change(Number(e.target.value)))),
|
|
2901
|
+
onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(),
|
|
2902
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
2903
|
+
}
|
|
2904
|
+
)
|
|
2905
|
+
] }),
|
|
2906
|
+
/* @__PURE__ */ jsx17("button", { type: "button", className: button, "aria-label": `Remove step ${step.index + 1}`, disabled: recipe.steps.length === 1, onClick: () => run(controller.removeSelectionStep(step.index)), children: "\xD7" })
|
|
2907
|
+
] }, `${step.index}:${JSON.stringify(step)}`);
|
|
2908
|
+
}) }),
|
|
2909
|
+
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
|
|
2910
|
+
] });
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2913
|
+
// src/image-editor/SelectionOptionsBar.tsx
|
|
2855
2914
|
import {
|
|
2856
2915
|
COLOR_RANGE_PRESETS,
|
|
2857
2916
|
COLOR_RANGE_PRESET_LABELS,
|
|
@@ -2862,18 +2921,18 @@ import {
|
|
|
2862
2921
|
} from "@pixerate/editor/image-editor";
|
|
2863
2922
|
|
|
2864
2923
|
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
2865
|
-
import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as
|
|
2924
|
+
import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState14 } from "react";
|
|
2866
2925
|
import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
|
|
2867
|
-
import { jsx as
|
|
2868
|
-
var
|
|
2869
|
-
var toggle = (on) => `${
|
|
2926
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2927
|
+
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";
|
|
2928
|
+
var toggle = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
2870
2929
|
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
2871
2930
|
const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
|
|
2872
|
-
const [, setRevision] =
|
|
2873
|
-
const [zoom, setZoom] =
|
|
2874
|
-
const [pan, setPan] =
|
|
2875
|
-
const [busy, setBusy] =
|
|
2876
|
-
const [error, setError] =
|
|
2931
|
+
const [, setRevision] = useState14(0);
|
|
2932
|
+
const [zoom, setZoom] = useState14(1);
|
|
2933
|
+
const [pan, setPan] = useState14({ x: 0, y: 0 });
|
|
2934
|
+
const [busy, setBusy] = useState14(false);
|
|
2935
|
+
const [error, setError] = useState14(null);
|
|
2877
2936
|
const canvasRef = useRef8(null);
|
|
2878
2937
|
const panFrom = useRef8(null);
|
|
2879
2938
|
const settings = session.settings;
|
|
@@ -2949,7 +3008,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2949
3008
|
};
|
|
2950
3009
|
const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
|
|
2951
3010
|
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
2952
|
-
return /* @__PURE__ */
|
|
3011
|
+
return /* @__PURE__ */ jsxs16(
|
|
2953
3012
|
"div",
|
|
2954
3013
|
{
|
|
2955
3014
|
"data-testid": "select-and-mask-workspace",
|
|
@@ -2957,12 +3016,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2957
3016
|
"aria-label": "Select and Mask",
|
|
2958
3017
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
2959
3018
|
children: [
|
|
2960
|
-
/* @__PURE__ */
|
|
2961
|
-
/* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
brushTool && /* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx18("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__ */ jsx18("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)) }),
|
|
3020
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
3021
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
3022
|
+
brushTool && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
2964
3023
|
"Size",
|
|
2965
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsx18(
|
|
2966
3025
|
"input",
|
|
2967
3026
|
{
|
|
2968
3027
|
type: "number",
|
|
@@ -2975,22 +3034,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
2975
3034
|
),
|
|
2976
3035
|
"px"
|
|
2977
3036
|
] }),
|
|
2978
|
-
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
3037
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
3038
|
+
/* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
3039
|
+
/* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
2981
3040
|
] }),
|
|
2982
|
-
/* @__PURE__ */
|
|
3041
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-muted-foreground", children: [
|
|
2983
3042
|
session.edits.length,
|
|
2984
3043
|
" strokes"
|
|
2985
3044
|
] }),
|
|
2986
|
-
/* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button2, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
3046
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono text-muted-foreground", children: [
|
|
2988
3047
|
Math.round(zoom * 100),
|
|
2989
3048
|
"%"
|
|
2990
3049
|
] }),
|
|
2991
|
-
session.computing && /* @__PURE__ */
|
|
3050
|
+
session.computing && /* @__PURE__ */ jsx18("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
2992
3051
|
] }),
|
|
2993
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx18(
|
|
2994
3053
|
"canvas",
|
|
2995
3054
|
{
|
|
2996
3055
|
ref: canvasRef,
|
|
@@ -3009,11 +3068,11 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3009
3068
|
}
|
|
3010
3069
|
) })
|
|
3011
3070
|
] }),
|
|
3012
|
-
/* @__PURE__ */
|
|
3013
|
-
/* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */
|
|
3071
|
+
/* @__PURE__ */ jsxs16("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
3072
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
3073
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3015
3074
|
"View",
|
|
3016
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ jsx18(
|
|
3017
3076
|
ImageSelect,
|
|
3018
3077
|
{
|
|
3019
3078
|
label: "View",
|
|
@@ -3023,36 +3082,36 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3023
3082
|
}
|
|
3024
3083
|
)
|
|
3025
3084
|
] }),
|
|
3026
|
-
/* @__PURE__ */
|
|
3027
|
-
/* @__PURE__ */
|
|
3028
|
-
/* @__PURE__ */
|
|
3029
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3086
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3087
|
+
/* @__PURE__ */ jsx18("span", { children: "Opacity" }),
|
|
3088
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3030
3089
|
Math.round(settings.opacity * 100),
|
|
3031
3090
|
"%"
|
|
3032
3091
|
] })
|
|
3033
3092
|
] }),
|
|
3034
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
3035
3094
|
] }),
|
|
3036
|
-
/* @__PURE__ */
|
|
3037
|
-
/* @__PURE__ */
|
|
3095
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3096
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
3038
3097
|
"Show Edge (J)"
|
|
3039
3098
|
] }),
|
|
3040
|
-
/* @__PURE__ */
|
|
3041
|
-
/* @__PURE__ */
|
|
3099
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3100
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
3042
3101
|
"Show Original (P)"
|
|
3043
3102
|
] }),
|
|
3044
|
-
/* @__PURE__ */
|
|
3045
|
-
/* @__PURE__ */
|
|
3103
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3104
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
3046
3105
|
"Real-Time Refinement"
|
|
3047
3106
|
] }),
|
|
3048
|
-
/* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
3107
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3108
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
3050
3109
|
"High Quality Preview"
|
|
3051
3110
|
] }),
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
3112
|
+
controller.segmentationProvider && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3054
3113
|
"Mode",
|
|
3055
|
-
/* @__PURE__ */
|
|
3114
|
+
/* @__PURE__ */ jsx18(
|
|
3056
3115
|
ImageSelect,
|
|
3057
3116
|
{
|
|
3058
3117
|
label: "Refine mode",
|
|
@@ -3065,37 +3124,37 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3065
3124
|
}
|
|
3066
3125
|
)
|
|
3067
3126
|
] }),
|
|
3068
|
-
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3127
|
+
REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3128
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3129
|
+
/* @__PURE__ */ jsx18("span", { children: c.label }),
|
|
3130
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3072
3131
|
settings.params[c.id],
|
|
3073
3132
|
c.unit
|
|
3074
3133
|
] })
|
|
3075
3134
|
] }),
|
|
3076
|
-
/* @__PURE__ */
|
|
3135
|
+
/* @__PURE__ */ jsx18(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 } }) })
|
|
3077
3136
|
] }, c.id)),
|
|
3078
|
-
/* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3137
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3138
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
3080
3139
|
"Smart Radius"
|
|
3081
3140
|
] }),
|
|
3082
|
-
/* @__PURE__ */
|
|
3083
|
-
/* @__PURE__ */
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
/* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3142
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
3143
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3144
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
3086
3145
|
"Decontaminate Colors",
|
|
3087
3146
|
toLayer ? "" : " (new layer or document outputs)"
|
|
3088
3147
|
] }),
|
|
3089
|
-
/* @__PURE__ */
|
|
3148
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
|
|
3090
3149
|
settings.decontaminate,
|
|
3091
3150
|
"%"
|
|
3092
3151
|
] })
|
|
3093
3152
|
] }),
|
|
3094
|
-
/* @__PURE__ */
|
|
3153
|
+
/* @__PURE__ */ jsx18(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
3095
3154
|
] }),
|
|
3096
|
-
/* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3097
3156
|
"Output To",
|
|
3098
|
-
/* @__PURE__ */
|
|
3157
|
+
/* @__PURE__ */ jsx18(
|
|
3099
3158
|
ImageSelect,
|
|
3100
3159
|
{
|
|
3101
3160
|
label: "Output to",
|
|
@@ -3105,16 +3164,16 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3105
3164
|
}
|
|
3106
3165
|
)
|
|
3107
3166
|
] }),
|
|
3108
|
-
/* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3167
|
+
/* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
|
|
3168
|
+
/* @__PURE__ */ jsx18(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
3110
3169
|
"Remember Settings"
|
|
3111
3170
|
] }),
|
|
3112
|
-
(error ?? session.error) && /* @__PURE__ */
|
|
3113
|
-
session.note && /* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3116
|
-
/* @__PURE__ */
|
|
3117
|
-
/* @__PURE__ */
|
|
3171
|
+
(error ?? session.error) && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3172
|
+
session.note && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: session.note }),
|
|
3173
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1 mt-auto", children: [
|
|
3174
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
|
|
3175
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
|
|
3176
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
3118
3177
|
] })
|
|
3119
3178
|
] })
|
|
3120
3179
|
]
|
|
@@ -3123,18 +3182,18 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3123
3182
|
};
|
|
3124
3183
|
|
|
3125
3184
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
3126
|
-
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as
|
|
3185
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState15 } from "react";
|
|
3127
3186
|
import { CONTENT_AWARE_FILL_SAMPLING, CONTENT_AWARE_FILL_TOOLS, ContentAwareFillSession } from "@pixerate/editor/image-editor";
|
|
3128
|
-
import { Fragment as Fragment4, jsx as
|
|
3129
|
-
var
|
|
3130
|
-
var toggle2 = (on) => `${
|
|
3187
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3188
|
+
var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
3189
|
+
var toggle2 = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
3131
3190
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
3132
3191
|
const session = useMemo5(() => new ContentAwareFillSession(controller), [controller]);
|
|
3133
|
-
const [, setRevision] =
|
|
3134
|
-
const [zoom, setZoom] =
|
|
3135
|
-
const [pan, setPan] =
|
|
3136
|
-
const [busy, setBusy] =
|
|
3137
|
-
const [error, setError] =
|
|
3192
|
+
const [, setRevision] = useState15(0);
|
|
3193
|
+
const [zoom, setZoom] = useState15(1);
|
|
3194
|
+
const [pan, setPan] = useState15({ x: 0, y: 0 });
|
|
3195
|
+
const [busy, setBusy] = useState15(false);
|
|
3196
|
+
const [error, setError] = useState15(null);
|
|
3138
3197
|
const sourceRef = useRef9(null);
|
|
3139
3198
|
const previewRef = useRef9(null);
|
|
3140
3199
|
const panFrom = useRef9(null);
|
|
@@ -3213,14 +3272,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3213
3272
|
session.end();
|
|
3214
3273
|
};
|
|
3215
3274
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
3216
|
-
return /* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
3220
|
-
settings.tool === "sampling-brush" && /* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3275
|
+
return /* @__PURE__ */ jsxs17("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
|
|
3276
|
+
/* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx19("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
3277
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
3278
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
3279
|
+
settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
3280
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3222
3281
|
"Size",
|
|
3223
|
-
/* @__PURE__ */
|
|
3282
|
+
/* @__PURE__ */ jsx19(
|
|
3224
3283
|
"input",
|
|
3225
3284
|
{
|
|
3226
3285
|
type: "number",
|
|
@@ -3233,22 +3292,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3233
3292
|
),
|
|
3234
3293
|
"px"
|
|
3235
3294
|
] }),
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3295
|
+
/* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
|
|
3296
|
+
/* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
3297
|
+
/* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
3239
3298
|
] })
|
|
3240
3299
|
] }),
|
|
3241
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-muted-foreground", children: [
|
|
3242
3301
|
Math.round(zoom * 100),
|
|
3243
3302
|
"%"
|
|
3244
3303
|
] }),
|
|
3245
|
-
!session.showsWholeImage && /* @__PURE__ */
|
|
3246
|
-
session.computing && /* @__PURE__ */
|
|
3304
|
+
!session.showsWholeImage && /* @__PURE__ */ jsx19("button", { type: "button", className: button3, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
|
|
3305
|
+
session.computing && /* @__PURE__ */ jsx19("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
3247
3306
|
] }),
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
/* @__PURE__ */
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3307
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
3308
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col min-h-0", children: [
|
|
3309
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
|
|
3310
|
+
/* @__PURE__ */ jsx19("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx19(
|
|
3252
3311
|
"canvas",
|
|
3253
3312
|
{
|
|
3254
3313
|
ref: sourceRef,
|
|
@@ -3260,33 +3319,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3260
3319
|
}
|
|
3261
3320
|
) })
|
|
3262
3321
|
] }),
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
/* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3322
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col min-h-0", children: [
|
|
3323
|
+
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Preview" }),
|
|
3324
|
+
/* @__PURE__ */ jsx19("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx19("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
|
|
3266
3325
|
] })
|
|
3267
3326
|
] })
|
|
3268
3327
|
] }),
|
|
3269
|
-
/* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3272
|
-
/* @__PURE__ */
|
|
3273
|
-
/* @__PURE__ */
|
|
3328
|
+
/* @__PURE__ */ jsxs17("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
3329
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
3330
|
+
/* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
|
|
3331
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2", children: [
|
|
3332
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
3274
3333
|
"Show Sampling Area"
|
|
3275
3334
|
] }),
|
|
3276
|
-
/* @__PURE__ */
|
|
3277
|
-
/* @__PURE__ */
|
|
3278
|
-
/* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3336
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3337
|
+
/* @__PURE__ */ jsx19("span", { children: "Opacity" }),
|
|
3338
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3280
3339
|
Math.round(settings.opacity * 100),
|
|
3281
3340
|
"%"
|
|
3282
3341
|
] })
|
|
3283
3342
|
] }),
|
|
3284
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ jsx19(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
3285
3344
|
] }),
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
|
|
3346
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3288
3347
|
"Seed",
|
|
3289
|
-
/* @__PURE__ */
|
|
3348
|
+
/* @__PURE__ */ jsx19(
|
|
3290
3349
|
"input",
|
|
3291
3350
|
{
|
|
3292
3351
|
type: "number",
|
|
@@ -3297,17 +3356,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3297
3356
|
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
3298
3357
|
}
|
|
3299
3358
|
),
|
|
3300
|
-
/* @__PURE__ */
|
|
3359
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button3, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
|
|
3301
3360
|
] }),
|
|
3302
|
-
/* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2", children: [
|
|
3362
|
+
/* @__PURE__ */ jsx19(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
|
|
3304
3363
|
"Live Preview"
|
|
3305
3364
|
] }),
|
|
3306
|
-
!settings.livePreview && /* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3365
|
+
!settings.livePreview && /* @__PURE__ */ jsx19("button", { type: "button", className: button3, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
|
|
3366
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
3367
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2", children: [
|
|
3309
3368
|
"Output To",
|
|
3310
|
-
/* @__PURE__ */
|
|
3369
|
+
/* @__PURE__ */ jsx19(
|
|
3311
3370
|
ImageSelect,
|
|
3312
3371
|
{
|
|
3313
3372
|
label: "Fill output",
|
|
@@ -3321,18 +3380,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
3321
3380
|
}
|
|
3322
3381
|
)
|
|
3323
3382
|
] }),
|
|
3324
|
-
(error ?? session.error) && /* @__PURE__ */
|
|
3325
|
-
/* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3383
|
+
(error ?? session.error) && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
3384
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1 mt-auto", children: [
|
|
3385
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
|
|
3386
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
|
|
3387
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
3329
3388
|
] })
|
|
3330
3389
|
] })
|
|
3331
3390
|
] });
|
|
3332
3391
|
};
|
|
3333
3392
|
|
|
3334
3393
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
3335
|
-
import { jsx as
|
|
3394
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3336
3395
|
var MODIFY_OPS = [
|
|
3337
3396
|
{ op: "expand", label: "Expand" },
|
|
3338
3397
|
{ op: "contract", label: "Contract" },
|
|
@@ -3356,15 +3415,15 @@ var SelectionOptionsBar = ({
|
|
|
3356
3415
|
selectionDisplay,
|
|
3357
3416
|
className = ""
|
|
3358
3417
|
}) => {
|
|
3359
|
-
const [radius, setRadius] =
|
|
3418
|
+
const [radius, setRadius] = useState16(2);
|
|
3360
3419
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
3361
3420
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3362
3421
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
3363
|
-
const [preset, setPreset] =
|
|
3364
|
-
const [rangeStatus, setRangeStatus] =
|
|
3365
|
-
const [colorStatus, setColorStatus] =
|
|
3366
|
-
const [strokeWidth, setStrokeWidth] =
|
|
3367
|
-
const [strokeLocation, setStrokeLocation] =
|
|
3422
|
+
const [preset, setPreset] = useState16("reds");
|
|
3423
|
+
const [rangeStatus, setRangeStatus] = useState16(null);
|
|
3424
|
+
const [colorStatus, setColorStatus] = useState16(null);
|
|
3425
|
+
const [strokeWidth, setStrokeWidth] = useState16(4);
|
|
3426
|
+
const [strokeLocation, setStrokeLocation] = useState16("outside");
|
|
3368
3427
|
const edit = (fn) => {
|
|
3369
3428
|
setColorStatus(null);
|
|
3370
3429
|
try {
|
|
@@ -3397,7 +3456,7 @@ var SelectionOptionsBar = ({
|
|
|
3397
3456
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
3398
3457
|
}
|
|
3399
3458
|
};
|
|
3400
|
-
const [task, setTask] =
|
|
3459
|
+
const [task, setTask] = useState16(null);
|
|
3401
3460
|
const taskAbort = useRef10(null);
|
|
3402
3461
|
const tracked = () => {
|
|
3403
3462
|
const abort = new AbortController();
|
|
@@ -3410,9 +3469,9 @@ var SelectionOptionsBar = ({
|
|
|
3410
3469
|
setTask(null);
|
|
3411
3470
|
};
|
|
3412
3471
|
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
3413
|
-
const [subject, setSubject] =
|
|
3414
|
-
const [segmenting, setSegmenting] =
|
|
3415
|
-
const [subjectStatus, setSubjectStatus] =
|
|
3472
|
+
const [subject, setSubject] = useState16("");
|
|
3473
|
+
const [segmenting, setSegmenting] = useState16(false);
|
|
3474
|
+
const [subjectStatus, setSubjectStatus] = useState16(null);
|
|
3416
3475
|
const selectSubject = async () => {
|
|
3417
3476
|
const target = subject.trim();
|
|
3418
3477
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -3429,10 +3488,10 @@ var SelectionOptionsBar = ({
|
|
|
3429
3488
|
setSegmenting(false);
|
|
3430
3489
|
}
|
|
3431
3490
|
};
|
|
3432
|
-
const [workspace, setWorkspace] =
|
|
3433
|
-
const [fillWorkspace, setFillWorkspace] =
|
|
3434
|
-
const [skying, setSkying] =
|
|
3435
|
-
const [skyStatus, setSkyStatus] =
|
|
3491
|
+
const [workspace, setWorkspace] = useState16(false);
|
|
3492
|
+
const [fillWorkspace, setFillWorkspace] = useState16(false);
|
|
3493
|
+
const [skying, setSkying] = useState16(false);
|
|
3494
|
+
const [skyStatus, setSkyStatus] = useState16(null);
|
|
3436
3495
|
const selectSky = async () => {
|
|
3437
3496
|
if (skying) return;
|
|
3438
3497
|
setSkying(true);
|
|
@@ -3447,8 +3506,8 @@ var SelectionOptionsBar = ({
|
|
|
3447
3506
|
setSkying(false);
|
|
3448
3507
|
}
|
|
3449
3508
|
};
|
|
3450
|
-
const [focusing, setFocusing] =
|
|
3451
|
-
const [focusStatus, setFocusStatus] =
|
|
3509
|
+
const [focusing, setFocusing] = useState16(false);
|
|
3510
|
+
const [focusStatus, setFocusStatus] = useState16(null);
|
|
3452
3511
|
const selectFocusArea = async () => {
|
|
3453
3512
|
if (focusing) return;
|
|
3454
3513
|
setFocusing(true);
|
|
@@ -3469,24 +3528,24 @@ var SelectionOptionsBar = ({
|
|
|
3469
3528
|
setFocusing(false);
|
|
3470
3529
|
}
|
|
3471
3530
|
};
|
|
3472
|
-
return /* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3475
|
-
options.tool === "wand" && /* @__PURE__ */
|
|
3476
|
-
/* @__PURE__ */
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3531
|
+
return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3532
|
+
/* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx20("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)) }),
|
|
3533
|
+
/* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
3534
|
+
options.tool === "wand" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
|
|
3535
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3536
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3537
|
+
/* @__PURE__ */ jsx20("span", { children: "Tolerance" }),
|
|
3538
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.tolerance })
|
|
3480
3539
|
] }),
|
|
3481
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
3482
3541
|
] }),
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3543
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
3485
3544
|
"Contiguous"
|
|
3486
3545
|
] }),
|
|
3487
|
-
/* @__PURE__ */
|
|
3546
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3488
3547
|
"Distance",
|
|
3489
|
-
/* @__PURE__ */
|
|
3548
|
+
/* @__PURE__ */ jsx20(
|
|
3490
3549
|
ImageSelect,
|
|
3491
3550
|
{
|
|
3492
3551
|
label: "Colour distance",
|
|
@@ -3499,13 +3558,13 @@ var SelectionOptionsBar = ({
|
|
|
3499
3558
|
}
|
|
3500
3559
|
)
|
|
3501
3560
|
] }),
|
|
3502
|
-
/* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
3561
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3562
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
3504
3563
|
"Sample adjusted image"
|
|
3505
3564
|
] }),
|
|
3506
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3507
3566
|
"Sample",
|
|
3508
|
-
/* @__PURE__ */
|
|
3567
|
+
/* @__PURE__ */ jsx20(
|
|
3509
3568
|
ImageSelect,
|
|
3510
3569
|
{
|
|
3511
3570
|
label: "Sample from",
|
|
@@ -3519,77 +3578,77 @@ var SelectionOptionsBar = ({
|
|
|
3519
3578
|
)
|
|
3520
3579
|
] })
|
|
3521
3580
|
] }),
|
|
3522
|
-
options.tool === "polygon" && /* @__PURE__ */
|
|
3523
|
-
options.tool === "magnetic" && /* @__PURE__ */
|
|
3524
|
-
/* @__PURE__ */
|
|
3525
|
-
/* @__PURE__ */
|
|
3526
|
-
/* @__PURE__ */
|
|
3527
|
-
/* @__PURE__ */
|
|
3528
|
-
/* @__PURE__ */
|
|
3581
|
+
options.tool === "polygon" && /* @__PURE__ */ jsx20("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." }),
|
|
3582
|
+
options.tool === "magnetic" && /* @__PURE__ */ jsxs18("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
3583
|
+
/* @__PURE__ */ jsx20("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." }),
|
|
3584
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3585
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3586
|
+
/* @__PURE__ */ jsx20("span", { children: "Width" }),
|
|
3587
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3529
3588
|
options.magneticWidth ?? 10,
|
|
3530
3589
|
" px"
|
|
3531
3590
|
] })
|
|
3532
3591
|
] }),
|
|
3533
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
3534
3593
|
] }),
|
|
3535
|
-
/* @__PURE__ */
|
|
3536
|
-
/* @__PURE__ */
|
|
3537
|
-
/* @__PURE__ */
|
|
3538
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3595
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3596
|
+
/* @__PURE__ */ jsx20("span", { children: "Contrast" }),
|
|
3597
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3539
3598
|
options.magneticContrast ?? 10,
|
|
3540
3599
|
"%"
|
|
3541
3600
|
] })
|
|
3542
3601
|
] }),
|
|
3543
|
-
/* @__PURE__ */
|
|
3602
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
3544
3603
|
] }),
|
|
3545
|
-
/* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3605
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3606
|
+
/* @__PURE__ */ jsx20("span", { children: "Frequency" }),
|
|
3607
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
3549
3608
|
] }),
|
|
3550
|
-
/* @__PURE__ */
|
|
3609
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
3551
3610
|
] })
|
|
3552
3611
|
] }),
|
|
3553
|
-
options.tool === "quick" && /* @__PURE__ */
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3556
|
-
/* @__PURE__ */
|
|
3557
|
-
/* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3612
|
+
options.tool === "quick" && /* @__PURE__ */ jsxs18("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
3613
|
+
/* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
3614
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3615
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3616
|
+
/* @__PURE__ */ jsx20("span", { children: "Size" }),
|
|
3617
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3559
3618
|
options.quickSize ?? 30,
|
|
3560
3619
|
" px"
|
|
3561
3620
|
] })
|
|
3562
3621
|
] }),
|
|
3563
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
3564
3623
|
] }),
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3625
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
3567
3626
|
"Sample all layers"
|
|
3568
3627
|
] }),
|
|
3569
|
-
/* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3629
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
3571
3630
|
"Auto-enhance edges"
|
|
3572
3631
|
] })
|
|
3573
3632
|
] }),
|
|
3574
|
-
options.tool === "object" && /* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3576
|
-
/* @__PURE__ */
|
|
3577
|
-
/* @__PURE__ */
|
|
3633
|
+
options.tool === "object" && /* @__PURE__ */ jsxs18("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
3634
|
+
/* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
3635
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3636
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
3578
3637
|
"Sample all layers"
|
|
3579
3638
|
] }),
|
|
3580
|
-
/* @__PURE__ */
|
|
3581
|
-
/* @__PURE__ */
|
|
3639
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3640
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
3582
3641
|
"Auto-enhance edges"
|
|
3583
3642
|
] })
|
|
3584
3643
|
] }),
|
|
3585
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */
|
|
3644
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs18("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
3645
|
+
/* @__PURE__ */ jsxs18("p", { className: "text-muted-foreground", children: [
|
|
3587
3646
|
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).",
|
|
3588
3647
|
" Shift-click adds, Alt-click subtracts."
|
|
3589
3648
|
] }),
|
|
3590
|
-
/* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3591
3650
|
"Text",
|
|
3592
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsx20(
|
|
3593
3652
|
"input",
|
|
3594
3653
|
{
|
|
3595
3654
|
type: "text",
|
|
@@ -3600,9 +3659,9 @@ var SelectionOptionsBar = ({
|
|
|
3600
3659
|
}
|
|
3601
3660
|
)
|
|
3602
3661
|
] }),
|
|
3603
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3604
3663
|
"Size",
|
|
3605
|
-
/* @__PURE__ */
|
|
3664
|
+
/* @__PURE__ */ jsx20(
|
|
3606
3665
|
"input",
|
|
3607
3666
|
{
|
|
3608
3667
|
type: "number",
|
|
@@ -3616,9 +3675,9 @@ var SelectionOptionsBar = ({
|
|
|
3616
3675
|
),
|
|
3617
3676
|
"px"
|
|
3618
3677
|
] }),
|
|
3619
|
-
/* @__PURE__ */
|
|
3678
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3620
3679
|
"Font",
|
|
3621
|
-
/* @__PURE__ */
|
|
3680
|
+
/* @__PURE__ */ jsx20(
|
|
3622
3681
|
"input",
|
|
3623
3682
|
{
|
|
3624
3683
|
type: "text",
|
|
@@ -3630,18 +3689,18 @@ var SelectionOptionsBar = ({
|
|
|
3630
3689
|
)
|
|
3631
3690
|
] })
|
|
3632
3691
|
] }),
|
|
3633
|
-
options.tool === "range" && /* @__PURE__ */
|
|
3634
|
-
/* @__PURE__ */
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3638
|
-
/* @__PURE__ */
|
|
3692
|
+
options.tool === "range" && /* @__PURE__ */ jsxs18("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
3693
|
+
/* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
3694
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3695
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3696
|
+
/* @__PURE__ */ jsx20("span", { children: "Fuzziness" }),
|
|
3697
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
3639
3698
|
] }),
|
|
3640
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
3641
3700
|
] }),
|
|
3642
|
-
/* @__PURE__ */
|
|
3701
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3643
3702
|
"Localized radius",
|
|
3644
|
-
/* @__PURE__ */
|
|
3703
|
+
/* @__PURE__ */ jsx20(
|
|
3645
3704
|
"input",
|
|
3646
3705
|
{
|
|
3647
3706
|
type: "number",
|
|
@@ -3655,12 +3714,12 @@ var SelectionOptionsBar = ({
|
|
|
3655
3714
|
),
|
|
3656
3715
|
"px"
|
|
3657
3716
|
] }),
|
|
3658
|
-
/* @__PURE__ */
|
|
3659
|
-
/* @__PURE__ */
|
|
3717
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3718
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
3660
3719
|
"Invert"
|
|
3661
3720
|
] }),
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3721
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
|
|
3722
|
+
/* @__PURE__ */ jsx20(
|
|
3664
3723
|
ImageSelect,
|
|
3665
3724
|
{
|
|
3666
3725
|
label: "Color Range preset",
|
|
@@ -3669,13 +3728,13 @@ var SelectionOptionsBar = ({
|
|
|
3669
3728
|
onChange: (v) => setPreset(v)
|
|
3670
3729
|
}
|
|
3671
3730
|
),
|
|
3672
|
-
/* @__PURE__ */
|
|
3731
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
3673
3732
|
] }),
|
|
3674
|
-
rangeStatus && /* @__PURE__ */
|
|
3733
|
+
rangeStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
3675
3734
|
] }),
|
|
3676
|
-
/* @__PURE__ */
|
|
3735
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3677
3736
|
"Feather",
|
|
3678
|
-
/* @__PURE__ */
|
|
3737
|
+
/* @__PURE__ */ jsx20(
|
|
3679
3738
|
"input",
|
|
3680
3739
|
{
|
|
3681
3740
|
type: "number",
|
|
@@ -3690,7 +3749,7 @@ var SelectionOptionsBar = ({
|
|
|
3690
3749
|
),
|
|
3691
3750
|
"px"
|
|
3692
3751
|
] }),
|
|
3693
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ jsxs18(
|
|
3694
3753
|
"form",
|
|
3695
3754
|
{
|
|
3696
3755
|
"data-testid": "select-subject",
|
|
@@ -3700,8 +3759,8 @@ var SelectionOptionsBar = ({
|
|
|
3700
3759
|
void selectSubject();
|
|
3701
3760
|
},
|
|
3702
3761
|
children: [
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
controller.segmentationProvider && /* @__PURE__ */
|
|
3762
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
|
|
3763
|
+
controller.segmentationProvider && /* @__PURE__ */ jsx20(
|
|
3705
3764
|
"input",
|
|
3706
3765
|
{
|
|
3707
3766
|
type: "text",
|
|
@@ -3713,7 +3772,7 @@ var SelectionOptionsBar = ({
|
|
|
3713
3772
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
3714
3773
|
}
|
|
3715
3774
|
),
|
|
3716
|
-
/* @__PURE__ */
|
|
3775
|
+
/* @__PURE__ */ jsx20(
|
|
3717
3776
|
"button",
|
|
3718
3777
|
{
|
|
3719
3778
|
type: "submit",
|
|
@@ -3725,12 +3784,12 @@ var SelectionOptionsBar = ({
|
|
|
3725
3784
|
}
|
|
3726
3785
|
)
|
|
3727
3786
|
] }),
|
|
3728
|
-
subjectStatus && /* @__PURE__ */
|
|
3787
|
+
subjectStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
3729
3788
|
]
|
|
3730
3789
|
}
|
|
3731
3790
|
),
|
|
3732
|
-
task && /* @__PURE__ */
|
|
3733
|
-
/* @__PURE__ */
|
|
3791
|
+
task && /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
3792
|
+
/* @__PURE__ */ jsx20(
|
|
3734
3793
|
"div",
|
|
3735
3794
|
{
|
|
3736
3795
|
role: "progressbar",
|
|
@@ -3739,69 +3798,69 @@ var SelectionOptionsBar = ({
|
|
|
3739
3798
|
"aria-valuemax": 100,
|
|
3740
3799
|
"aria-valuenow": Math.round(task.fraction * 100),
|
|
3741
3800
|
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
3742
|
-
children: /* @__PURE__ */
|
|
3801
|
+
children: /* @__PURE__ */ jsx20("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
3743
3802
|
}
|
|
3744
3803
|
),
|
|
3745
|
-
/* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3804
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: task.stage }),
|
|
3805
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
3747
3806
|
] }),
|
|
3748
|
-
/* @__PURE__ */
|
|
3749
|
-
workspace && /* @__PURE__ */
|
|
3750
|
-
/* @__PURE__ */
|
|
3751
|
-
/* @__PURE__ */
|
|
3752
|
-
skyStatus && /* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
3808
|
+
workspace && /* @__PURE__ */ jsx20(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
3809
|
+
/* @__PURE__ */ jsxs18("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
3810
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
3811
|
+
skyStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
3753
3812
|
] }),
|
|
3754
|
-
/* @__PURE__ */
|
|
3755
|
-
/* @__PURE__ */
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
/* @__PURE__ */
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3760
|
-
/* @__PURE__ */
|
|
3813
|
+
/* @__PURE__ */ jsxs18("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
3814
|
+
/* @__PURE__ */ jsx20("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
3815
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
3816
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3817
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3818
|
+
/* @__PURE__ */ jsx20("span", { children: "In-focus range" }),
|
|
3819
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
3761
3820
|
] }),
|
|
3762
|
-
/* @__PURE__ */
|
|
3821
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
3763
3822
|
] }),
|
|
3764
|
-
/* @__PURE__ */
|
|
3765
|
-
/* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */
|
|
3823
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3824
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3825
|
+
/* @__PURE__ */ jsx20("span", { children: "Image noise level" }),
|
|
3826
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
3768
3827
|
] }),
|
|
3769
|
-
/* @__PURE__ */
|
|
3828
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
3770
3829
|
] }),
|
|
3771
|
-
/* @__PURE__ */
|
|
3772
|
-
/* @__PURE__ */
|
|
3773
|
-
/* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
3830
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
|
|
3831
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3832
|
+
/* @__PURE__ */ jsx20("span", { children: "Soften edge" }),
|
|
3833
|
+
/* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
|
|
3775
3834
|
options.focusSoftness ?? 4,
|
|
3776
3835
|
" px"
|
|
3777
3836
|
] })
|
|
3778
3837
|
] }),
|
|
3779
|
-
/* @__PURE__ */
|
|
3838
|
+
/* @__PURE__ */ jsx20(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
3780
3839
|
] }),
|
|
3781
|
-
/* @__PURE__ */
|
|
3782
|
-
focusStatus && /* @__PURE__ */
|
|
3840
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
3841
|
+
focusStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
3783
3842
|
] })
|
|
3784
3843
|
] }),
|
|
3785
|
-
/* @__PURE__ */
|
|
3786
|
-
/* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3845
|
+
/* @__PURE__ */ jsx20(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
3787
3846
|
"Anti-alias"
|
|
3788
3847
|
] }),
|
|
3789
|
-
/* @__PURE__ */
|
|
3790
|
-
/* @__PURE__ */
|
|
3791
|
-
/* @__PURE__ */
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3794
|
-
/* @__PURE__ */
|
|
3795
|
-
/* @__PURE__ */
|
|
3848
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
|
|
3849
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
3850
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
3851
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
3852
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
3853
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
3854
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
3796
3855
|
] }),
|
|
3797
|
-
/* @__PURE__ */
|
|
3798
|
-
/* @__PURE__ */
|
|
3799
|
-
DISPLAYS.map((d) => /* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ jsxs18("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3857
|
+
/* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "Show" }),
|
|
3858
|
+
DISPLAYS.map((d) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
3800
3859
|
] }),
|
|
3801
|
-
/* @__PURE__ */
|
|
3802
|
-
/* @__PURE__ */
|
|
3860
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3861
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3803
3862
|
"Radius",
|
|
3804
|
-
/* @__PURE__ */
|
|
3863
|
+
/* @__PURE__ */ jsx20(
|
|
3805
3864
|
"input",
|
|
3806
3865
|
{
|
|
3807
3866
|
type: "number",
|
|
@@ -3815,12 +3874,12 @@ var SelectionOptionsBar = ({
|
|
|
3815
3874
|
}
|
|
3816
3875
|
)
|
|
3817
3876
|
] }),
|
|
3818
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */
|
|
3877
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
3819
3878
|
] }),
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ jsxs18("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
3880
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
3822
3881
|
"Stroke",
|
|
3823
|
-
/* @__PURE__ */
|
|
3882
|
+
/* @__PURE__ */ jsx20(
|
|
3824
3883
|
"input",
|
|
3825
3884
|
{
|
|
3826
3885
|
type: "number",
|
|
@@ -3835,7 +3894,7 @@ var SelectionOptionsBar = ({
|
|
|
3835
3894
|
),
|
|
3836
3895
|
"px"
|
|
3837
3896
|
] }),
|
|
3838
|
-
/* @__PURE__ */
|
|
3897
|
+
/* @__PURE__ */ jsx20(
|
|
3839
3898
|
ImageSelect,
|
|
3840
3899
|
{
|
|
3841
3900
|
label: "Stroke location",
|
|
@@ -3848,28 +3907,29 @@ var SelectionOptionsBar = ({
|
|
|
3848
3907
|
onChange: (v) => setStrokeLocation(v)
|
|
3849
3908
|
}
|
|
3850
3909
|
),
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3855
|
-
fillWorkspace && /* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
3911
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
3912
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
|
|
3913
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
|
|
3914
|
+
fillWorkspace && /* @__PURE__ */ jsx20(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
|
|
3856
3915
|
] }),
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */
|
|
3861
|
-
/* @__PURE__ */
|
|
3862
|
-
/* @__PURE__ */
|
|
3863
|
-
/* @__PURE__ */
|
|
3864
|
-
/* @__PURE__ */
|
|
3916
|
+
/* @__PURE__ */ jsxs18("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
3917
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
3918
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
3919
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
3920
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
3921
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
3922
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
3923
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
3865
3924
|
] }),
|
|
3866
|
-
colorStatus && /* @__PURE__ */
|
|
3867
|
-
/* @__PURE__ */
|
|
3925
|
+
colorStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
3926
|
+
/* @__PURE__ */ jsx20("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) }),
|
|
3927
|
+
/* @__PURE__ */ jsx20(SelectionRecipePanel, { controller, selection: sel })
|
|
3868
3928
|
] });
|
|
3869
3929
|
};
|
|
3870
3930
|
|
|
3871
3931
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3872
|
-
import { useState as
|
|
3932
|
+
import { useState as useState20 } from "react";
|
|
3873
3933
|
import {
|
|
3874
3934
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3875
3935
|
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
@@ -3879,14 +3939,14 @@ import {
|
|
|
3879
3939
|
} from "@pixerate/editor/image-editor";
|
|
3880
3940
|
|
|
3881
3941
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
3882
|
-
import
|
|
3942
|
+
import React16, { useState as useState17 } from "react";
|
|
3883
3943
|
import { MASK_EDGE_THRESHOLDS } from "@pixerate/editor/image-editor";
|
|
3884
|
-
import { Fragment as Fragment5, jsx as
|
|
3885
|
-
var
|
|
3944
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3945
|
+
var button4 = "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";
|
|
3886
3946
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
3887
3947
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3888
|
-
const [result, setResult] =
|
|
3889
|
-
const [error, setError] =
|
|
3948
|
+
const [result, setResult] = useState17(null);
|
|
3949
|
+
const [error, setError] = useState17(null);
|
|
3890
3950
|
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
3891
3951
|
const check = () => {
|
|
3892
3952
|
setError(null);
|
|
@@ -3904,35 +3964,35 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
3904
3964
|
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
3905
3965
|
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
3906
3966
|
] : [];
|
|
3907
|
-
return /* @__PURE__ */
|
|
3908
|
-
/* @__PURE__ */
|
|
3909
|
-
report && /* @__PURE__ */
|
|
3910
|
-
/* @__PURE__ */
|
|
3911
|
-
rows.map((r) => /* @__PURE__ */
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
3967
|
+
return /* @__PURE__ */ jsxs19("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
3968
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: `${button4} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
3969
|
+
report && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
3970
|
+
/* @__PURE__ */ jsxs19("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
3971
|
+
rows.map((r) => /* @__PURE__ */ jsxs19(React16.Fragment, { children: [
|
|
3972
|
+
/* @__PURE__ */ jsx21("dt", { className: "text-muted-foreground", children: r.label }),
|
|
3973
|
+
/* @__PURE__ */ jsx21("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
3914
3974
|
] }, r.label)),
|
|
3915
|
-
/* @__PURE__ */
|
|
3916
|
-
/* @__PURE__ */
|
|
3975
|
+
/* @__PURE__ */ jsx21("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
3976
|
+
/* @__PURE__ */ jsxs19("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
3917
3977
|
report.holes.count,
|
|
3918
3978
|
" / ",
|
|
3919
3979
|
report.islands.count
|
|
3920
3980
|
] })
|
|
3921
3981
|
] }),
|
|
3922
|
-
report.issues.length ? /* @__PURE__ */
|
|
3982
|
+
report.issues.length ? /* @__PURE__ */ jsx21("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx21("li", { children: s }, s)) }) : /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
3923
3983
|
] }),
|
|
3924
|
-
error && /* @__PURE__ */
|
|
3984
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
3925
3985
|
] });
|
|
3926
3986
|
};
|
|
3927
3987
|
|
|
3928
3988
|
// src/image-editor/SelectionChangeCheck.tsx
|
|
3929
|
-
import { useState as
|
|
3930
|
-
import { Fragment as Fragment6, jsx as
|
|
3931
|
-
var
|
|
3989
|
+
import { useState as useState18 } from "react";
|
|
3990
|
+
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3991
|
+
var button5 = "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";
|
|
3932
3992
|
var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
3933
3993
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3934
|
-
const [result, setResult] =
|
|
3935
|
-
const [error, setError] =
|
|
3994
|
+
const [result, setResult] = useState18(null);
|
|
3995
|
+
const [error, setError] = useState18(null);
|
|
3936
3996
|
const diff = result && result.for === sel ? result.diff : null;
|
|
3937
3997
|
const show = () => {
|
|
3938
3998
|
setError(null);
|
|
@@ -3943,16 +4003,16 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
3943
4003
|
setError(err instanceof Error ? err.message : String(err));
|
|
3944
4004
|
}
|
|
3945
4005
|
};
|
|
3946
|
-
return /* @__PURE__ */
|
|
3947
|
-
/* @__PURE__ */
|
|
3948
|
-
diff && /* @__PURE__ */
|
|
3949
|
-
/* @__PURE__ */
|
|
4006
|
+
return /* @__PURE__ */ jsxs20("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
4007
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: `${button5} self-start`, onClick: show, children: "Show Last Change" }),
|
|
4008
|
+
diff && /* @__PURE__ */ jsx22("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
4009
|
+
/* @__PURE__ */ jsxs20("span", { className: "text-green-600", children: [
|
|
3950
4010
|
"+",
|
|
3951
4011
|
diff.added.area,
|
|
3952
4012
|
" px"
|
|
3953
4013
|
] }),
|
|
3954
4014
|
" ",
|
|
3955
|
-
/* @__PURE__ */
|
|
4015
|
+
/* @__PURE__ */ jsxs20("span", { className: "text-destructive", children: [
|
|
3956
4016
|
"\u2212",
|
|
3957
4017
|
diff.removed.area,
|
|
3958
4018
|
" px"
|
|
@@ -3961,20 +4021,20 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
3961
4021
|
Math.round(diff.iou * 100),
|
|
3962
4022
|
"%"
|
|
3963
4023
|
] }) }),
|
|
3964
|
-
error && /* @__PURE__ */
|
|
4024
|
+
error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
|
|
3965
4025
|
] });
|
|
3966
4026
|
};
|
|
3967
4027
|
|
|
3968
4028
|
// src/image-editor/SeparateSubjectPanel.tsx
|
|
3969
|
-
import { useRef as useRef11, useState as
|
|
3970
|
-
import { jsx as
|
|
3971
|
-
var
|
|
4029
|
+
import { useRef as useRef11, useState as useState19 } from "react";
|
|
4030
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4031
|
+
var button6 = "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";
|
|
3972
4032
|
var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
3973
4033
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3974
|
-
const [dilate, setDilate] =
|
|
3975
|
-
const [fill, setFill] =
|
|
3976
|
-
const [progress, setProgress] =
|
|
3977
|
-
const [error, setError] =
|
|
4034
|
+
const [dilate, setDilate] = useState19(8);
|
|
4035
|
+
const [fill, setFill] = useState19(true);
|
|
4036
|
+
const [progress, setProgress] = useState19(null);
|
|
4037
|
+
const [error, setError] = useState19(null);
|
|
3978
4038
|
const abort = useRef11(null);
|
|
3979
4039
|
const run = async () => {
|
|
3980
4040
|
setError(null);
|
|
@@ -3994,13 +4054,13 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
3994
4054
|
setProgress(null);
|
|
3995
4055
|
}
|
|
3996
4056
|
};
|
|
3997
|
-
return /* @__PURE__ */
|
|
3998
|
-
/* @__PURE__ */
|
|
3999
|
-
/* @__PURE__ */
|
|
4000
|
-
/* @__PURE__ */
|
|
4001
|
-
/* @__PURE__ */
|
|
4057
|
+
return /* @__PURE__ */ jsxs21("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
4058
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
|
|
4059
|
+
/* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
|
|
4060
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4061
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4002
4062
|
"Grow",
|
|
4003
|
-
/* @__PURE__ */
|
|
4063
|
+
/* @__PURE__ */ jsx23(
|
|
4004
4064
|
"input",
|
|
4005
4065
|
{
|
|
4006
4066
|
type: "number",
|
|
@@ -4014,34 +4074,34 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
4014
4074
|
),
|
|
4015
4075
|
"px"
|
|
4016
4076
|
] }),
|
|
4017
|
-
/* @__PURE__ */
|
|
4018
|
-
/* @__PURE__ */
|
|
4077
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
4078
|
+
/* @__PURE__ */ jsx23("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
|
|
4019
4079
|
"Fill the background"
|
|
4020
4080
|
] })
|
|
4021
4081
|
] }),
|
|
4022
|
-
/* @__PURE__ */
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
progress !== null && /* @__PURE__ */
|
|
4082
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex gap-1", children: [
|
|
4083
|
+
/* @__PURE__ */ jsx23("button", { type: "button", className: button6, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
|
|
4084
|
+
progress !== null && /* @__PURE__ */ jsx23("button", { type: "button", className: button6, onClick: () => abort.current?.abort(), children: "Cancel" })
|
|
4025
4085
|
] }),
|
|
4026
|
-
progress !== null && /* @__PURE__ */
|
|
4027
|
-
error && /* @__PURE__ */
|
|
4086
|
+
progress !== null && /* @__PURE__ */ jsx23("p", { role: "status", className: "text-muted-foreground", children: progress }),
|
|
4087
|
+
error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
|
|
4028
4088
|
] });
|
|
4029
4089
|
};
|
|
4030
4090
|
|
|
4031
4091
|
// src/image-editor/RefineEdgePanel.tsx
|
|
4032
|
-
import { Fragment as Fragment7, jsx as
|
|
4092
|
+
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4033
4093
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
4034
|
-
var
|
|
4094
|
+
var button7 = "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";
|
|
4035
4095
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
4036
|
-
const [params, setParams] =
|
|
4037
|
-
const [busy, setBusy] =
|
|
4038
|
-
const [error, setError] =
|
|
4039
|
-
const [layerId, setLayerId] =
|
|
4040
|
-
const [newKind, setNewKind] =
|
|
4041
|
-
const [output, setOutput] =
|
|
4042
|
-
const [decontaminate, setDecontaminate] =
|
|
4043
|
-
const [objectAware, setObjectAware] =
|
|
4044
|
-
const [onlyUncertain, setOnlyUncertain] =
|
|
4096
|
+
const [params, setParams] = useState20(DEFAULT_PARAMS);
|
|
4097
|
+
const [busy, setBusy] = useState20(false);
|
|
4098
|
+
const [error, setError] = useState20(null);
|
|
4099
|
+
const [layerId, setLayerId] = useState20("");
|
|
4100
|
+
const [newKind, setNewKind] = useState20("hueSaturation");
|
|
4101
|
+
const [output, setOutput] = useState20("selection");
|
|
4102
|
+
const [decontaminate, setDecontaminate] = useState20(0);
|
|
4103
|
+
const [objectAware, setObjectAware] = useState20(false);
|
|
4104
|
+
const [onlyUncertain, setOnlyUncertain] = useState20(false);
|
|
4045
4105
|
const canObject = Boolean(controller.segmentationProvider);
|
|
4046
4106
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
4047
4107
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -4064,17 +4124,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4064
4124
|
setBusy(false);
|
|
4065
4125
|
}
|
|
4066
4126
|
};
|
|
4067
|
-
return /* @__PURE__ */
|
|
4068
|
-
/* @__PURE__ */
|
|
4069
|
-
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */
|
|
4070
|
-
/* @__PURE__ */
|
|
4071
|
-
/* @__PURE__ */
|
|
4072
|
-
/* @__PURE__ */
|
|
4127
|
+
return /* @__PURE__ */ jsxs22("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4128
|
+
/* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
4129
|
+
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
|
|
4130
|
+
/* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4131
|
+
/* @__PURE__ */ jsx24("span", { children: c.label }),
|
|
4132
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
|
|
4073
4133
|
params[c.id],
|
|
4074
4134
|
c.unit
|
|
4075
4135
|
] })
|
|
4076
4136
|
] }),
|
|
4077
|
-
/* @__PURE__ */
|
|
4137
|
+
/* @__PURE__ */ jsx24(
|
|
4078
4138
|
"input",
|
|
4079
4139
|
{
|
|
4080
4140
|
type: "range",
|
|
@@ -4088,43 +4148,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4088
4148
|
}
|
|
4089
4149
|
)
|
|
4090
4150
|
] }, c.id)),
|
|
4091
|
-
/* @__PURE__ */
|
|
4092
|
-
/* @__PURE__ */
|
|
4151
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4152
|
+
/* @__PURE__ */ jsx24("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
4093
4153
|
"Smart Radius"
|
|
4094
4154
|
] }),
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
/* @__PURE__ */
|
|
4155
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
4156
|
+
/* @__PURE__ */ jsx24("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
4097
4157
|
"Only uncertain areas"
|
|
4098
4158
|
] }),
|
|
4099
|
-
canObject && /* @__PURE__ */
|
|
4100
|
-
/* @__PURE__ */
|
|
4159
|
+
canObject && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4160
|
+
/* @__PURE__ */ jsx24("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
4101
4161
|
"Object aware (segmentation model)"
|
|
4102
4162
|
] }),
|
|
4103
|
-
/* @__PURE__ */
|
|
4163
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
4104
4164
|
"Output to",
|
|
4105
|
-
/* @__PURE__ */
|
|
4165
|
+
/* @__PURE__ */ jsx24(
|
|
4106
4166
|
"select",
|
|
4107
4167
|
{
|
|
4108
4168
|
"aria-label": "Refine output",
|
|
4109
4169
|
value: output,
|
|
4110
4170
|
onChange: (e) => setOutput(e.target.value),
|
|
4111
4171
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4112
|
-
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */
|
|
4172
|
+
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx24("option", { value: o.id, children: o.label }, o.id))
|
|
4113
4173
|
}
|
|
4114
4174
|
)
|
|
4115
4175
|
] }),
|
|
4116
|
-
/* @__PURE__ */
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
4176
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
|
|
4177
|
+
/* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4178
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
4119
4179
|
"Decontaminate colors",
|
|
4120
4180
|
toLayer ? "" : " (new layer or document outputs)"
|
|
4121
4181
|
] }),
|
|
4122
|
-
/* @__PURE__ */
|
|
4182
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
|
|
4123
4183
|
decontaminate,
|
|
4124
4184
|
"%"
|
|
4125
4185
|
] })
|
|
4126
4186
|
] }),
|
|
4127
|
-
/* @__PURE__ */
|
|
4187
|
+
/* @__PURE__ */ jsx24(
|
|
4128
4188
|
"input",
|
|
4129
4189
|
{
|
|
4130
4190
|
type: "range",
|
|
@@ -4139,66 +4199,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4139
4199
|
}
|
|
4140
4200
|
)
|
|
4141
4201
|
] }),
|
|
4142
|
-
/* @__PURE__ */
|
|
4143
|
-
/* @__PURE__ */
|
|
4144
|
-
/* @__PURE__ */
|
|
4202
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-1", children: [
|
|
4203
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
4204
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: button7, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
4145
4205
|
] }),
|
|
4146
|
-
error && /* @__PURE__ */
|
|
4147
|
-
/* @__PURE__ */
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4150
|
-
/* @__PURE__ */
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4206
|
+
error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error }),
|
|
4207
|
+
/* @__PURE__ */ jsx24(MaskEdgeCheck, { controller, selection: sel }),
|
|
4208
|
+
/* @__PURE__ */ jsx24(SelectionChangeCheck, { controller, selection: sel }),
|
|
4209
|
+
/* @__PURE__ */ jsx24(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
|
|
4210
|
+
/* @__PURE__ */ jsx24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
4211
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-1 items-center", children: [
|
|
4212
|
+
/* @__PURE__ */ jsx24(
|
|
4153
4213
|
"select",
|
|
4154
4214
|
{
|
|
4155
4215
|
"aria-label": "New masked layer kind",
|
|
4156
4216
|
value: newKind,
|
|
4157
4217
|
onChange: (e) => setNewKind(e.target.value),
|
|
4158
4218
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4159
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
4219
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx24("option", { value: k.kind, children: k.label }, k.kind))
|
|
4160
4220
|
}
|
|
4161
4221
|
),
|
|
4162
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsx24(
|
|
4163
4223
|
"button",
|
|
4164
4224
|
{
|
|
4165
4225
|
type: "button",
|
|
4166
|
-
className:
|
|
4226
|
+
className: button7,
|
|
4167
4227
|
disabled: !sel,
|
|
4168
4228
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
4169
4229
|
children: "New Masked Layer"
|
|
4170
4230
|
}
|
|
4171
4231
|
)
|
|
4172
4232
|
] }),
|
|
4173
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
4174
|
-
/* @__PURE__ */
|
|
4233
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-2", children: [
|
|
4234
|
+
/* @__PURE__ */ jsx24(
|
|
4175
4235
|
"select",
|
|
4176
4236
|
{
|
|
4177
4237
|
"aria-label": "Mask layer",
|
|
4178
4238
|
value: target.id,
|
|
4179
4239
|
onChange: (e) => setLayerId(e.target.value),
|
|
4180
4240
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4181
|
-
children: list.map((l) => /* @__PURE__ */
|
|
4241
|
+
children: list.map((l) => /* @__PURE__ */ jsxs22("option", { value: l.id, children: [
|
|
4182
4242
|
l.name || adjustmentKindLabel2(l.kind),
|
|
4183
4243
|
l.mask ? " (masked)" : ""
|
|
4184
4244
|
] }, l.id))
|
|
4185
4245
|
}
|
|
4186
4246
|
),
|
|
4187
|
-
/* @__PURE__ */
|
|
4188
|
-
/* @__PURE__ */
|
|
4189
|
-
/* @__PURE__ */
|
|
4190
|
-
/* @__PURE__ */
|
|
4247
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
|
|
4248
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4249
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4250
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
4191
4251
|
] }),
|
|
4192
|
-
target.mask && /* @__PURE__ */
|
|
4193
|
-
/* @__PURE__ */
|
|
4194
|
-
/* @__PURE__ */
|
|
4195
|
-
/* @__PURE__ */
|
|
4196
|
-
/* @__PURE__ */
|
|
4252
|
+
target.mask && /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
4253
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
|
|
4254
|
+
/* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4255
|
+
/* @__PURE__ */ jsx24("span", { children: "Density" }),
|
|
4256
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
|
|
4197
4257
|
Math.round((target.mask.density ?? 1) * 100),
|
|
4198
4258
|
"%"
|
|
4199
4259
|
] })
|
|
4200
4260
|
] }),
|
|
4201
|
-
/* @__PURE__ */
|
|
4261
|
+
/* @__PURE__ */ jsx24(
|
|
4202
4262
|
"input",
|
|
4203
4263
|
{
|
|
4204
4264
|
type: "range",
|
|
@@ -4212,15 +4272,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4212
4272
|
}
|
|
4213
4273
|
)
|
|
4214
4274
|
] }),
|
|
4215
|
-
/* @__PURE__ */
|
|
4216
|
-
/* @__PURE__ */
|
|
4217
|
-
/* @__PURE__ */
|
|
4218
|
-
/* @__PURE__ */
|
|
4275
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
|
|
4276
|
+
/* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4277
|
+
/* @__PURE__ */ jsx24("span", { children: "Mask Feather" }),
|
|
4278
|
+
/* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
|
|
4219
4279
|
target.mask.feather ?? 0,
|
|
4220
4280
|
"px"
|
|
4221
4281
|
] })
|
|
4222
4282
|
] }),
|
|
4223
|
-
/* @__PURE__ */
|
|
4283
|
+
/* @__PURE__ */ jsx24(
|
|
4224
4284
|
"input",
|
|
4225
4285
|
{
|
|
4226
4286
|
type: "range",
|
|
@@ -4240,9 +4300,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4240
4300
|
};
|
|
4241
4301
|
|
|
4242
4302
|
// src/image-editor/ChannelsPanel.tsx
|
|
4243
|
-
import { useEffect as useEffect12, useRef as useRef12, useState as
|
|
4303
|
+
import { useEffect as useEffect12, useRef as useRef12, useState as useState21 } from "react";
|
|
4244
4304
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
4245
|
-
import { jsx as
|
|
4305
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4246
4306
|
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"}`;
|
|
4247
4307
|
var ChannelThumb = ({ channel, size }) => {
|
|
4248
4308
|
const ref = useRef12(null);
|
|
@@ -4257,14 +4317,14 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
4257
4317
|
img.data.set(px.data);
|
|
4258
4318
|
ctx.putImageData(img, 0, 0);
|
|
4259
4319
|
}, [channel.mask]);
|
|
4260
|
-
return /* @__PURE__ */
|
|
4320
|
+
return /* @__PURE__ */ jsx25("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
4261
4321
|
};
|
|
4262
4322
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4263
|
-
const [, setTick] =
|
|
4323
|
+
const [, setTick] = useState21(0);
|
|
4264
4324
|
useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4265
|
-
const [activeId, setActiveId] =
|
|
4266
|
-
const [renaming, setRenaming] =
|
|
4267
|
-
const [error, setError] =
|
|
4325
|
+
const [activeId, setActiveId] = useState21(null);
|
|
4326
|
+
const [renaming, setRenaming] = useState21(null);
|
|
4327
|
+
const [error, setError] = useState21(null);
|
|
4268
4328
|
const fileInput = useRef12(null);
|
|
4269
4329
|
const channels = controller.getChannels();
|
|
4270
4330
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
@@ -4287,13 +4347,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4287
4347
|
setError(err instanceof Error ? err.message : String(err));
|
|
4288
4348
|
}
|
|
4289
4349
|
};
|
|
4290
|
-
return /* @__PURE__ */
|
|
4291
|
-
/* @__PURE__ */
|
|
4292
|
-
/* @__PURE__ */
|
|
4293
|
-
/* @__PURE__ */
|
|
4350
|
+
return /* @__PURE__ */ jsxs23("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
4351
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
|
|
4352
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
4353
|
+
/* @__PURE__ */ jsx25("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" })
|
|
4294
4354
|
] }),
|
|
4295
|
-
channels.length === 0 && /* @__PURE__ */
|
|
4296
|
-
/* @__PURE__ */
|
|
4355
|
+
channels.length === 0 && /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
4356
|
+
/* @__PURE__ */ jsx25("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs23(
|
|
4297
4357
|
"li",
|
|
4298
4358
|
{
|
|
4299
4359
|
"data-testid": "channel-row",
|
|
@@ -4305,7 +4365,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4305
4365
|
},
|
|
4306
4366
|
onDoubleClick: () => setRenaming(c.id),
|
|
4307
4367
|
children: [
|
|
4308
|
-
/* @__PURE__ */
|
|
4368
|
+
/* @__PURE__ */ jsx25(
|
|
4309
4369
|
"button",
|
|
4310
4370
|
{
|
|
4311
4371
|
type: "button",
|
|
@@ -4319,8 +4379,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4319
4379
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
4320
4380
|
}
|
|
4321
4381
|
),
|
|
4322
|
-
/* @__PURE__ */
|
|
4323
|
-
renaming === c.id ? /* @__PURE__ */
|
|
4382
|
+
/* @__PURE__ */ jsx25(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
4383
|
+
renaming === c.id ? /* @__PURE__ */ jsx25(
|
|
4324
4384
|
"input",
|
|
4325
4385
|
{
|
|
4326
4386
|
autoFocus: true,
|
|
@@ -4337,16 +4397,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4337
4397
|
if (e.key === "Escape") setRenaming(null);
|
|
4338
4398
|
}
|
|
4339
4399
|
}
|
|
4340
|
-
) : /* @__PURE__ */
|
|
4400
|
+
) : /* @__PURE__ */ jsx25("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
4341
4401
|
]
|
|
4342
4402
|
},
|
|
4343
4403
|
c.id
|
|
4344
4404
|
)) }),
|
|
4345
|
-
/* @__PURE__ */
|
|
4346
|
-
/* @__PURE__ */
|
|
4347
|
-
/* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4349
|
-
/* @__PURE__ */
|
|
4405
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
|
|
4406
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
4407
|
+
/* @__PURE__ */ jsx25("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" }),
|
|
4408
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
4409
|
+
/* @__PURE__ */ jsx25(
|
|
4350
4410
|
"button",
|
|
4351
4411
|
{
|
|
4352
4412
|
type: "button",
|
|
@@ -4359,8 +4419,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4359
4419
|
children: "Delete"
|
|
4360
4420
|
}
|
|
4361
4421
|
),
|
|
4362
|
-
/* @__PURE__ */
|
|
4363
|
-
/* @__PURE__ */
|
|
4422
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
4423
|
+
/* @__PURE__ */ jsx25(
|
|
4364
4424
|
"button",
|
|
4365
4425
|
{
|
|
4366
4426
|
type: "button",
|
|
@@ -4371,7 +4431,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4371
4431
|
children: "Export PNG"
|
|
4372
4432
|
}
|
|
4373
4433
|
),
|
|
4374
|
-
/* @__PURE__ */
|
|
4434
|
+
/* @__PURE__ */ jsx25(
|
|
4375
4435
|
"input",
|
|
4376
4436
|
{
|
|
4377
4437
|
ref: fileInput,
|
|
@@ -4386,22 +4446,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4386
4446
|
}
|
|
4387
4447
|
)
|
|
4388
4448
|
] }),
|
|
4389
|
-
error && /* @__PURE__ */
|
|
4449
|
+
error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
|
|
4390
4450
|
] });
|
|
4391
4451
|
};
|
|
4392
4452
|
|
|
4393
4453
|
// src/image-editor/PathsPanel.tsx
|
|
4394
|
-
import { useEffect as useEffect13, useState as
|
|
4454
|
+
import { useEffect as useEffect13, useState as useState22 } from "react";
|
|
4395
4455
|
import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
|
|
4396
|
-
import { jsx as
|
|
4456
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4397
4457
|
var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
4398
4458
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4399
|
-
const [, setTick] =
|
|
4459
|
+
const [, setTick] = useState22(0);
|
|
4400
4460
|
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4401
|
-
const [renaming, setRenaming] =
|
|
4402
|
-
const [color, setColor] =
|
|
4403
|
-
const [width, setWidth] =
|
|
4404
|
-
const [error, setError] =
|
|
4461
|
+
const [renaming, setRenaming] = useState22(null);
|
|
4462
|
+
const [color, setColor] = useState22("#000000");
|
|
4463
|
+
const [width, setWidth] = useState22(2);
|
|
4464
|
+
const [error, setError] = useState22(null);
|
|
4405
4465
|
const paths = controller.getPaths();
|
|
4406
4466
|
const activeId = controller.getState().activePathId ?? null;
|
|
4407
4467
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -4417,10 +4477,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4417
4477
|
};
|
|
4418
4478
|
return (
|
|
4419
4479
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
4420
|
-
/* @__PURE__ */
|
|
4421
|
-
/* @__PURE__ */
|
|
4422
|
-
paths.length === 0 && /* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4480
|
+
/* @__PURE__ */ jsxs24("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
|
|
4481
|
+
/* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
4482
|
+
paths.length === 0 && /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
4483
|
+
/* @__PURE__ */ jsx26("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs24(
|
|
4424
4484
|
"li",
|
|
4425
4485
|
{
|
|
4426
4486
|
"data-testid": "path-row",
|
|
@@ -4429,8 +4489,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4429
4489
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4430
4490
|
onDoubleClick: () => setRenaming(p.id),
|
|
4431
4491
|
children: [
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
renaming === p.id ? /* @__PURE__ */
|
|
4492
|
+
/* @__PURE__ */ jsx26("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx26("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
4493
|
+
renaming === p.id ? /* @__PURE__ */ jsx26(
|
|
4434
4494
|
"input",
|
|
4435
4495
|
{
|
|
4436
4496
|
autoFocus: true,
|
|
@@ -4449,13 +4509,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4449
4509
|
if (e.key === "Escape") setRenaming(null);
|
|
4450
4510
|
}
|
|
4451
4511
|
}
|
|
4452
|
-
) : /* @__PURE__ */
|
|
4512
|
+
) : /* @__PURE__ */ jsx26("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4453
4513
|
]
|
|
4454
4514
|
},
|
|
4455
4515
|
p.id
|
|
4456
4516
|
)) }),
|
|
4457
|
-
/* @__PURE__ */
|
|
4458
|
-
/* @__PURE__ */
|
|
4517
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap gap-1", children: [
|
|
4518
|
+
/* @__PURE__ */ jsx26(
|
|
4459
4519
|
"button",
|
|
4460
4520
|
{
|
|
4461
4521
|
type: "button",
|
|
@@ -4466,15 +4526,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4466
4526
|
children: "Load as Selection"
|
|
4467
4527
|
}
|
|
4468
4528
|
),
|
|
4469
|
-
/* @__PURE__ */
|
|
4470
|
-
active?.work && /* @__PURE__ */
|
|
4471
|
-
/* @__PURE__ */
|
|
4529
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
4530
|
+
active?.work && /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
4531
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
4472
4532
|
] }),
|
|
4473
|
-
/* @__PURE__ */
|
|
4474
|
-
/* @__PURE__ */
|
|
4475
|
-
/* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
4533
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4534
|
+
/* @__PURE__ */ jsx26("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
|
|
4535
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
4536
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4537
|
+
/* @__PURE__ */ jsx26(
|
|
4478
4538
|
"input",
|
|
4479
4539
|
{
|
|
4480
4540
|
type: "number",
|
|
@@ -4489,24 +4549,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4489
4549
|
),
|
|
4490
4550
|
"px"
|
|
4491
4551
|
] }),
|
|
4492
|
-
/* @__PURE__ */
|
|
4552
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
4493
4553
|
] }),
|
|
4494
|
-
/* @__PURE__ */
|
|
4495
|
-
/* @__PURE__ */
|
|
4496
|
-
/* @__PURE__ */
|
|
4554
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap gap-1", children: [
|
|
4555
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
4556
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
4497
4557
|
] }),
|
|
4498
|
-
error && /* @__PURE__ */
|
|
4558
|
+
error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
|
|
4499
4559
|
] })
|
|
4500
4560
|
);
|
|
4501
4561
|
};
|
|
4502
4562
|
|
|
4503
4563
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4504
|
-
import { useEffect as useEffect14, useState as
|
|
4564
|
+
import { useEffect as useEffect14, useState as useState23 } from "react";
|
|
4505
4565
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
4506
|
-
import { jsx as
|
|
4566
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4507
4567
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4508
4568
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4509
|
-
const [, setTick] =
|
|
4569
|
+
const [, setTick] = useState23(0);
|
|
4510
4570
|
useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4511
4571
|
const bar = tool.bar();
|
|
4512
4572
|
if (!tool.active || !bar) return null;
|
|
@@ -4519,17 +4579,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4519
4579
|
const v = Number(raw);
|
|
4520
4580
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4521
4581
|
};
|
|
4522
|
-
return /* @__PURE__ */
|
|
4523
|
-
/* @__PURE__ */
|
|
4524
|
-
/* @__PURE__ */
|
|
4525
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
4526
|
-
/* @__PURE__ */
|
|
4527
|
-
/* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4582
|
+
return /* @__PURE__ */ jsxs25("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: [
|
|
4583
|
+
/* @__PURE__ */ jsx27("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx27("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)) }),
|
|
4584
|
+
/* @__PURE__ */ jsx27("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx27("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)) }),
|
|
4585
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4586
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4587
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4588
|
+
/* @__PURE__ */ jsx27("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__ */ jsx27("option", { value: o.id, children: o.label }, o.id)) })
|
|
4529
4589
|
] }),
|
|
4530
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
4531
|
-
/* @__PURE__ */
|
|
4532
|
-
/* @__PURE__ */
|
|
4590
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4591
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4592
|
+
/* @__PURE__ */ jsx27(
|
|
4533
4593
|
"input",
|
|
4534
4594
|
{
|
|
4535
4595
|
type: "number",
|
|
@@ -4550,9 +4610,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4550
4610
|
},
|
|
4551
4611
|
`${k}:${warp[k]}`
|
|
4552
4612
|
),
|
|
4553
|
-
/* @__PURE__ */
|
|
4613
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "%" })
|
|
4554
4614
|
] }, k)),
|
|
4555
|
-
/* @__PURE__ */
|
|
4615
|
+
/* @__PURE__ */ jsx27(
|
|
4556
4616
|
"button",
|
|
4557
4617
|
{
|
|
4558
4618
|
type: "button",
|
|
@@ -4564,9 +4624,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4564
4624
|
children: "Vertical"
|
|
4565
4625
|
}
|
|
4566
4626
|
),
|
|
4567
|
-
/* @__PURE__ */
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
4627
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4628
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4629
|
+
/* @__PURE__ */ jsx27(
|
|
4570
4630
|
"select",
|
|
4571
4631
|
{
|
|
4572
4632
|
"aria-label": "Warp grid",
|
|
@@ -4576,14 +4636,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4576
4636
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4577
4637
|
},
|
|
4578
4638
|
className: imageFieldClass,
|
|
4579
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
4639
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx27("option", { value: g.id, children: g.label }, g.id))
|
|
4580
4640
|
}
|
|
4581
4641
|
)
|
|
4582
4642
|
] })
|
|
4583
4643
|
] }),
|
|
4584
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
/* @__PURE__ */
|
|
4644
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4645
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: f.label }),
|
|
4646
|
+
/* @__PURE__ */ jsx27(
|
|
4587
4647
|
"input",
|
|
4588
4648
|
{
|
|
4589
4649
|
type: "number",
|
|
@@ -4603,8 +4663,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4603
4663
|
},
|
|
4604
4664
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4605
4665
|
),
|
|
4606
|
-
/* @__PURE__ */
|
|
4607
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4666
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4667
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx27(
|
|
4608
4668
|
"button",
|
|
4609
4669
|
{
|
|
4610
4670
|
type: "button",
|
|
@@ -4619,33 +4679,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4619
4679
|
}
|
|
4620
4680
|
)
|
|
4621
4681
|
] }, f.id)),
|
|
4622
|
-
/* @__PURE__ */
|
|
4623
|
-
/* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
|
|
4683
|
+
/* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4684
|
+
/* @__PURE__ */ jsx27(
|
|
4625
4685
|
"select",
|
|
4626
4686
|
{
|
|
4627
4687
|
"aria-label": "Interpolation",
|
|
4628
4688
|
value: tool.interpolation,
|
|
4629
4689
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4630
4690
|
className: imageFieldClass,
|
|
4631
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4691
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx27("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4632
4692
|
}
|
|
4633
4693
|
)
|
|
4634
4694
|
] }),
|
|
4635
|
-
/* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
tool.error && /* @__PURE__ */
|
|
4695
|
+
/* @__PURE__ */ jsx27("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" }),
|
|
4696
|
+
/* @__PURE__ */ jsx27("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4697
|
+
tool.error && /* @__PURE__ */ jsx27("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4638
4698
|
] });
|
|
4639
4699
|
};
|
|
4640
4700
|
|
|
4641
4701
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4642
|
-
import { useEffect as useEffect15, useState as
|
|
4702
|
+
import { useEffect as useEffect15, useState as useState24 } from "react";
|
|
4643
4703
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
4644
|
-
import { Fragment as Fragment8, jsx as
|
|
4704
|
+
import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4645
4705
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4646
|
-
const [, setTick] =
|
|
4706
|
+
const [, setTick] = useState24(0);
|
|
4647
4707
|
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4648
|
-
const [error, setError] =
|
|
4708
|
+
const [error, setError] = useState24(null);
|
|
4649
4709
|
const active = controller.getActiveLayer();
|
|
4650
4710
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4651
4711
|
const set = (change) => {
|
|
@@ -4659,22 +4719,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4659
4719
|
}
|
|
4660
4720
|
};
|
|
4661
4721
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4662
|
-
return /* @__PURE__ */
|
|
4663
|
-
/* @__PURE__ */
|
|
4664
|
-
/* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4722
|
+
return /* @__PURE__ */ jsxs26("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4723
|
+
/* @__PURE__ */ jsx28("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4724
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4725
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4726
|
+
/* @__PURE__ */ jsx28(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
4667
4727
|
"Fill",
|
|
4668
|
-
/* @__PURE__ */
|
|
4728
|
+
/* @__PURE__ */ jsx28(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
4669
4729
|
] }),
|
|
4670
|
-
/* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4730
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4731
|
+
/* @__PURE__ */ jsx28(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
4672
4732
|
"Stroke",
|
|
4673
|
-
/* @__PURE__ */
|
|
4733
|
+
/* @__PURE__ */ jsx28(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4674
4734
|
] }),
|
|
4675
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4676
4736
|
"Width",
|
|
4677
|
-
/* @__PURE__ */
|
|
4737
|
+
/* @__PURE__ */ jsx28(
|
|
4678
4738
|
"input",
|
|
4679
4739
|
{
|
|
4680
4740
|
type: "number",
|
|
@@ -4688,52 +4748,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4688
4748
|
)
|
|
4689
4749
|
] })
|
|
4690
4750
|
] }),
|
|
4691
|
-
/* @__PURE__ */
|
|
4692
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
4751
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4752
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4693
4753
|
"Radius",
|
|
4694
|
-
/* @__PURE__ */
|
|
4754
|
+
/* @__PURE__ */ jsx28("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}` })
|
|
4695
4755
|
] }),
|
|
4696
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4756
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4697
4757
|
"Sides",
|
|
4698
|
-
/* @__PURE__ */
|
|
4758
|
+
/* @__PURE__ */ jsx28("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}` })
|
|
4699
4759
|
] }),
|
|
4700
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
4760
|
+
options.kind === "star" && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
4761
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4702
4762
|
"Points",
|
|
4703
|
-
/* @__PURE__ */
|
|
4763
|
+
/* @__PURE__ */ jsx28("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}` })
|
|
4704
4764
|
] }),
|
|
4705
|
-
/* @__PURE__ */
|
|
4765
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4706
4766
|
"Inner",
|
|
4707
|
-
/* @__PURE__ */
|
|
4767
|
+
/* @__PURE__ */ jsx28(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4708
4768
|
] })
|
|
4709
4769
|
] }),
|
|
4710
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4711
|
-
/* @__PURE__ */
|
|
4770
|
+
options.kind === "line" && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
4771
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4712
4772
|
"Weight",
|
|
4713
|
-
/* @__PURE__ */
|
|
4773
|
+
/* @__PURE__ */ jsx28("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}` })
|
|
4714
4774
|
] }),
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
/* @__PURE__ */
|
|
4775
|
+
/* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
|
|
4776
|
+
/* @__PURE__ */ jsx28(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4717
4777
|
"Arrowhead"
|
|
4718
4778
|
] })
|
|
4719
4779
|
] })
|
|
4720
4780
|
] }),
|
|
4721
|
-
/* @__PURE__ */
|
|
4722
|
-
error && /* @__PURE__ */
|
|
4781
|
+
/* @__PURE__ */ jsx28("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." }),
|
|
4782
|
+
error && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: error })
|
|
4723
4783
|
] });
|
|
4724
4784
|
};
|
|
4725
4785
|
|
|
4726
4786
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4727
|
-
import { useEffect as useEffect16, useState as
|
|
4787
|
+
import { useEffect as useEffect16, useState as useState25 } from "react";
|
|
4728
4788
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4729
|
-
import { jsx as
|
|
4789
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4730
4790
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4731
4791
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4732
4792
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4733
|
-
const [, setTick] =
|
|
4793
|
+
const [, setTick] = useState25(0);
|
|
4734
4794
|
useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4735
4795
|
useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4736
|
-
const [error, setError] =
|
|
4796
|
+
const [error, setError] = useState25(null);
|
|
4737
4797
|
const active = controller.getActiveLayer();
|
|
4738
4798
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4739
4799
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4786,11 +4846,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4786
4846
|
setError(e instanceof Error ? e.message : String(e));
|
|
4787
4847
|
}
|
|
4788
4848
|
};
|
|
4789
|
-
return /* @__PURE__ */
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4849
|
+
return /* @__PURE__ */ jsxs27("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4850
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4851
|
+
/* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-1", children: [
|
|
4792
4852
|
"Font",
|
|
4793
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsx29(
|
|
4794
4854
|
"input",
|
|
4795
4855
|
{
|
|
4796
4856
|
list: "pixerate-type-fonts",
|
|
@@ -4800,11 +4860,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4800
4860
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4801
4861
|
}
|
|
4802
4862
|
),
|
|
4803
|
-
/* @__PURE__ */
|
|
4863
|
+
/* @__PURE__ */ jsx29("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx29("option", { value: f }, f)) })
|
|
4804
4864
|
] }),
|
|
4805
|
-
/* @__PURE__ */
|
|
4865
|
+
/* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-1", children: [
|
|
4806
4866
|
"Size",
|
|
4807
|
-
/* @__PURE__ */
|
|
4867
|
+
/* @__PURE__ */ jsx29(
|
|
4808
4868
|
"input",
|
|
4809
4869
|
{
|
|
4810
4870
|
type: "number",
|
|
@@ -4817,14 +4877,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4817
4877
|
}
|
|
4818
4878
|
)
|
|
4819
4879
|
] }),
|
|
4820
|
-
/* @__PURE__ */
|
|
4821
|
-
/* @__PURE__ */
|
|
4822
|
-
/* @__PURE__ */
|
|
4880
|
+
/* @__PURE__ */ jsx29("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" }),
|
|
4881
|
+
/* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4882
|
+
/* @__PURE__ */ jsx29(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
4823
4883
|
] }),
|
|
4824
|
-
/* @__PURE__ */
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4827
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
4884
|
+
/* @__PURE__ */ jsx29("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4885
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
4886
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
4887
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx29(
|
|
4828
4888
|
"button",
|
|
4829
4889
|
{
|
|
4830
4890
|
type: "button",
|
|
@@ -4836,19 +4896,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4836
4896
|
}
|
|
4837
4897
|
)
|
|
4838
4898
|
] }),
|
|
4839
|
-
/* @__PURE__ */
|
|
4840
|
-
missing.length > 0 && /* @__PURE__ */
|
|
4899
|
+
/* @__PURE__ */ jsx29("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." }),
|
|
4900
|
+
missing.length > 0 && /* @__PURE__ */ jsxs27("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4841
4901
|
"Missing ",
|
|
4842
4902
|
missing.length === 1 ? "font" : "fonts",
|
|
4843
4903
|
": ",
|
|
4844
4904
|
missing.join(", ")
|
|
4845
4905
|
] }),
|
|
4846
|
-
error && /* @__PURE__ */
|
|
4906
|
+
error && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", children: error })
|
|
4847
4907
|
] });
|
|
4848
4908
|
};
|
|
4849
4909
|
|
|
4850
4910
|
// src/image-editor/ImageEditor.tsx
|
|
4851
|
-
import { Fragment as Fragment9, jsx as
|
|
4911
|
+
import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4852
4912
|
var ImageEditor = ({
|
|
4853
4913
|
editor: externalEditor,
|
|
4854
4914
|
src,
|
|
@@ -4873,7 +4933,7 @@ var ImageEditor = ({
|
|
|
4873
4933
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4874
4934
|
});
|
|
4875
4935
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4876
|
-
const [activeTab, setActiveTab] =
|
|
4936
|
+
const [activeTab, setActiveTab] = useState26("crop");
|
|
4877
4937
|
const rootRef = useRef13(null);
|
|
4878
4938
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4879
4939
|
const activeTabRef = useRef13(activeTab);
|
|
@@ -4883,14 +4943,14 @@ var ImageEditor = ({
|
|
|
4883
4943
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4884
4944
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4885
4945
|
};
|
|
4886
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
4887
|
-
const [selectionOptions, setSelectionOptions] =
|
|
4888
|
-
const [shapeOptions, setShapeOptions] =
|
|
4889
|
-
const [typeOptions, setTypeOptions] =
|
|
4890
|
-
const [typeSession, setTypeSession] =
|
|
4891
|
-
const [selectionError, setSelectionError] =
|
|
4892
|
-
const [paintError, setPaintError] =
|
|
4893
|
-
const [shapeTypeError, setShapeTypeError] =
|
|
4946
|
+
const [activeCropRatio, setActiveCropRatio] = useState26(null);
|
|
4947
|
+
const [selectionOptions, setSelectionOptions] = useState26(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
4948
|
+
const [shapeOptions, setShapeOptions] = useState26(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
4949
|
+
const [typeOptions, setTypeOptions] = useState26(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
4950
|
+
const [typeSession, setTypeSession] = useState26(null);
|
|
4951
|
+
const [selectionError, setSelectionError] = useState26(null);
|
|
4952
|
+
const [paintError, setPaintError] = useState26(null);
|
|
4953
|
+
const [shapeTypeError, setShapeTypeError] = useState26(null);
|
|
4894
4954
|
const handleCanvasError = (source, message) => {
|
|
4895
4955
|
if (source === "paint") setPaintError(message);
|
|
4896
4956
|
else if (source === "select") setSelectionError(message);
|
|
@@ -4907,16 +4967,16 @@ var ImageEditor = ({
|
|
|
4907
4967
|
transformControllerRef.current = controller;
|
|
4908
4968
|
}
|
|
4909
4969
|
const transformTool = transformToolRef.current;
|
|
4910
|
-
const [, setTransformTick] =
|
|
4970
|
+
const [, setTransformTick] = useState26(0);
|
|
4911
4971
|
useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4912
4972
|
useEffect17(() => () => transformToolRef.current?.cancel(), []);
|
|
4913
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
4914
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
4915
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
4916
|
-
const [isInpainting, setIsInpainting] =
|
|
4917
|
-
const [aiError, setAiError] =
|
|
4918
|
-
const [aiSuccess, setAiSuccess] =
|
|
4919
|
-
const [aiTarget, setAiTarget] =
|
|
4973
|
+
const [inpaintPrompt, setInpaintPrompt] = useState26("");
|
|
4974
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState26("annotations");
|
|
4975
|
+
const [isRemovingBg, setIsRemovingBg] = useState26(false);
|
|
4976
|
+
const [isInpainting, setIsInpainting] = useState26(false);
|
|
4977
|
+
const [aiError, setAiError] = useState26(null);
|
|
4978
|
+
const [aiSuccess, setAiSuccess] = useState26(null);
|
|
4979
|
+
const [aiTarget, setAiTarget] = useState26("auto");
|
|
4920
4980
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4921
4981
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4922
4982
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4979,10 +5039,10 @@ var ImageEditor = ({
|
|
|
4979
5039
|
setIsInpainting(false);
|
|
4980
5040
|
}
|
|
4981
5041
|
};
|
|
4982
|
-
const [activeColor, setActiveColor] =
|
|
4983
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4984
|
-
const [fontSize, setFontSize] =
|
|
4985
|
-
const [textInput, setTextInput] =
|
|
5042
|
+
const [activeColor, setActiveColor] = useState26("#ef4444");
|
|
5043
|
+
const [strokeWidth, setStrokeWidth] = useState26(3);
|
|
5044
|
+
const [fontSize, setFontSize] = useState26(24);
|
|
5045
|
+
const [textInput, setTextInput] = useState26("");
|
|
4986
5046
|
useEffect17(() => {
|
|
4987
5047
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4988
5048
|
editor.setTool("crop");
|
|
@@ -5011,16 +5071,16 @@ var ImageEditor = ({
|
|
|
5011
5071
|
link.click();
|
|
5012
5072
|
}
|
|
5013
5073
|
};
|
|
5014
|
-
return /* @__PURE__ */
|
|
5074
|
+
return /* @__PURE__ */ jsxs28(
|
|
5015
5075
|
"div",
|
|
5016
5076
|
{
|
|
5017
5077
|
ref: rootRef,
|
|
5018
5078
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5019
5079
|
style,
|
|
5020
5080
|
children: [
|
|
5021
|
-
/* @__PURE__ */
|
|
5022
|
-
/* @__PURE__ */
|
|
5023
|
-
/* @__PURE__ */
|
|
5081
|
+
/* @__PURE__ */ jsxs28("div", { className: imageEditorHeaderClass, children: [
|
|
5082
|
+
/* @__PURE__ */ jsxs28("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5083
|
+
/* @__PURE__ */ jsx30(
|
|
5024
5084
|
"button",
|
|
5025
5085
|
{
|
|
5026
5086
|
type: "button",
|
|
@@ -5035,7 +5095,7 @@ var ImageEditor = ({
|
|
|
5035
5095
|
children: "Transform & Crop"
|
|
5036
5096
|
}
|
|
5037
5097
|
),
|
|
5038
|
-
/* @__PURE__ */
|
|
5098
|
+
/* @__PURE__ */ jsx30(
|
|
5039
5099
|
"button",
|
|
5040
5100
|
{
|
|
5041
5101
|
type: "button",
|
|
@@ -5050,7 +5110,7 @@ var ImageEditor = ({
|
|
|
5050
5110
|
children: "Adjustments"
|
|
5051
5111
|
}
|
|
5052
5112
|
),
|
|
5053
|
-
/* @__PURE__ */
|
|
5113
|
+
/* @__PURE__ */ jsx30(
|
|
5054
5114
|
"button",
|
|
5055
5115
|
{
|
|
5056
5116
|
type: "button",
|
|
@@ -5065,7 +5125,7 @@ var ImageEditor = ({
|
|
|
5065
5125
|
children: "Layers"
|
|
5066
5126
|
}
|
|
5067
5127
|
),
|
|
5068
|
-
/* @__PURE__ */
|
|
5128
|
+
/* @__PURE__ */ jsx30(
|
|
5069
5129
|
"button",
|
|
5070
5130
|
{
|
|
5071
5131
|
type: "button",
|
|
@@ -5080,7 +5140,7 @@ var ImageEditor = ({
|
|
|
5080
5140
|
children: "Paint"
|
|
5081
5141
|
}
|
|
5082
5142
|
),
|
|
5083
|
-
/* @__PURE__ */
|
|
5143
|
+
/* @__PURE__ */ jsx30(
|
|
5084
5144
|
"button",
|
|
5085
5145
|
{
|
|
5086
5146
|
type: "button",
|
|
@@ -5095,7 +5155,7 @@ var ImageEditor = ({
|
|
|
5095
5155
|
children: "Select & Mask"
|
|
5096
5156
|
}
|
|
5097
5157
|
),
|
|
5098
|
-
/* @__PURE__ */
|
|
5158
|
+
/* @__PURE__ */ jsx30(
|
|
5099
5159
|
"button",
|
|
5100
5160
|
{
|
|
5101
5161
|
type: "button",
|
|
@@ -5110,7 +5170,7 @@ var ImageEditor = ({
|
|
|
5110
5170
|
children: "Annotations"
|
|
5111
5171
|
}
|
|
5112
5172
|
),
|
|
5113
|
-
/* @__PURE__ */
|
|
5173
|
+
/* @__PURE__ */ jsx30(
|
|
5114
5174
|
"button",
|
|
5115
5175
|
{
|
|
5116
5176
|
type: "button",
|
|
@@ -5125,7 +5185,7 @@ var ImageEditor = ({
|
|
|
5125
5185
|
children: "Depth Mask"
|
|
5126
5186
|
}
|
|
5127
5187
|
),
|
|
5128
|
-
/* @__PURE__ */
|
|
5188
|
+
/* @__PURE__ */ jsxs28(
|
|
5129
5189
|
"button",
|
|
5130
5190
|
{
|
|
5131
5191
|
type: "button",
|
|
@@ -5138,14 +5198,14 @@ var ImageEditor = ({
|
|
|
5138
5198
|
"aria-selected": activeTab === "ai",
|
|
5139
5199
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5140
5200
|
children: [
|
|
5141
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("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" }) }),
|
|
5142
5202
|
"AI Tools"
|
|
5143
5203
|
]
|
|
5144
5204
|
}
|
|
5145
5205
|
)
|
|
5146
5206
|
] }),
|
|
5147
|
-
/* @__PURE__ */
|
|
5148
|
-
/* @__PURE__ */
|
|
5207
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
5208
|
+
/* @__PURE__ */ jsx30(
|
|
5149
5209
|
"button",
|
|
5150
5210
|
{
|
|
5151
5211
|
type: "button",
|
|
@@ -5156,7 +5216,7 @@ var ImageEditor = ({
|
|
|
5156
5216
|
children: "\u21A9"
|
|
5157
5217
|
}
|
|
5158
5218
|
),
|
|
5159
|
-
/* @__PURE__ */
|
|
5219
|
+
/* @__PURE__ */ jsx30(
|
|
5160
5220
|
"button",
|
|
5161
5221
|
{
|
|
5162
5222
|
type: "button",
|
|
@@ -5167,7 +5227,7 @@ var ImageEditor = ({
|
|
|
5167
5227
|
children: "\u21AA"
|
|
5168
5228
|
}
|
|
5169
5229
|
),
|
|
5170
|
-
/* @__PURE__ */
|
|
5230
|
+
/* @__PURE__ */ jsx30(
|
|
5171
5231
|
"button",
|
|
5172
5232
|
{
|
|
5173
5233
|
type: "button",
|
|
@@ -5176,8 +5236,8 @@ var ImageEditor = ({
|
|
|
5176
5236
|
children: "Reset"
|
|
5177
5237
|
}
|
|
5178
5238
|
),
|
|
5179
|
-
/* @__PURE__ */
|
|
5180
|
-
/* @__PURE__ */
|
|
5239
|
+
/* @__PURE__ */ jsx30("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5240
|
+
/* @__PURE__ */ jsx30(
|
|
5181
5241
|
"button",
|
|
5182
5242
|
{
|
|
5183
5243
|
type: "button",
|
|
@@ -5187,11 +5247,11 @@ var ImageEditor = ({
|
|
|
5187
5247
|
children: "-"
|
|
5188
5248
|
}
|
|
5189
5249
|
),
|
|
5190
|
-
/* @__PURE__ */
|
|
5250
|
+
/* @__PURE__ */ jsxs28("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5191
5251
|
Math.round(state.zoom * 100),
|
|
5192
5252
|
"%"
|
|
5193
5253
|
] }),
|
|
5194
|
-
/* @__PURE__ */
|
|
5254
|
+
/* @__PURE__ */ jsx30(
|
|
5195
5255
|
"button",
|
|
5196
5256
|
{
|
|
5197
5257
|
type: "button",
|
|
@@ -5201,8 +5261,8 @@ var ImageEditor = ({
|
|
|
5201
5261
|
children: "+"
|
|
5202
5262
|
}
|
|
5203
5263
|
),
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
/* @__PURE__ */
|
|
5264
|
+
/* @__PURE__ */ jsx30("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5265
|
+
/* @__PURE__ */ jsx30(
|
|
5206
5266
|
"button",
|
|
5207
5267
|
{
|
|
5208
5268
|
type: "button",
|
|
@@ -5213,7 +5273,7 @@ var ImageEditor = ({
|
|
|
5213
5273
|
children: "Hold Compare"
|
|
5214
5274
|
}
|
|
5215
5275
|
),
|
|
5216
|
-
/* @__PURE__ */
|
|
5276
|
+
/* @__PURE__ */ jsx30(
|
|
5217
5277
|
"button",
|
|
5218
5278
|
{
|
|
5219
5279
|
type: "button",
|
|
@@ -5224,10 +5284,10 @@ var ImageEditor = ({
|
|
|
5224
5284
|
)
|
|
5225
5285
|
] })
|
|
5226
5286
|
] }),
|
|
5227
|
-
transformTool.active && /* @__PURE__ */
|
|
5228
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
5229
|
-
/* @__PURE__ */
|
|
5230
|
-
/* @__PURE__ */
|
|
5287
|
+
transformTool.active && /* @__PURE__ */ jsx30(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5288
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx30("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5289
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5290
|
+
/* @__PURE__ */ jsx30(
|
|
5231
5291
|
ImageEditorCanvas,
|
|
5232
5292
|
{
|
|
5233
5293
|
editor,
|
|
@@ -5251,11 +5311,11 @@ var ImageEditor = ({
|
|
|
5251
5311
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5252
5312
|
}
|
|
5253
5313
|
),
|
|
5254
|
-
/* @__PURE__ */
|
|
5255
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
5256
|
-
/* @__PURE__ */
|
|
5257
|
-
/* @__PURE__ */
|
|
5258
|
-
/* @__PURE__ */
|
|
5314
|
+
/* @__PURE__ */ jsxs28("div", { className: imageSidebarClass, children: [
|
|
5315
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5316
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5317
|
+
/* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5318
|
+
/* @__PURE__ */ jsx30(
|
|
5259
5319
|
"button",
|
|
5260
5320
|
{
|
|
5261
5321
|
type: "button",
|
|
@@ -5267,7 +5327,7 @@ var ImageEditor = ({
|
|
|
5267
5327
|
children: "Freeform"
|
|
5268
5328
|
}
|
|
5269
5329
|
),
|
|
5270
|
-
/* @__PURE__ */
|
|
5330
|
+
/* @__PURE__ */ jsx30(
|
|
5271
5331
|
"button",
|
|
5272
5332
|
{
|
|
5273
5333
|
type: "button",
|
|
@@ -5279,7 +5339,7 @@ var ImageEditor = ({
|
|
|
5279
5339
|
children: "1:1 Square"
|
|
5280
5340
|
}
|
|
5281
5341
|
),
|
|
5282
|
-
/* @__PURE__ */
|
|
5342
|
+
/* @__PURE__ */ jsx30(
|
|
5283
5343
|
"button",
|
|
5284
5344
|
{
|
|
5285
5345
|
type: "button",
|
|
@@ -5291,7 +5351,7 @@ var ImageEditor = ({
|
|
|
5291
5351
|
children: "4:3 Standard"
|
|
5292
5352
|
}
|
|
5293
5353
|
),
|
|
5294
|
-
/* @__PURE__ */
|
|
5354
|
+
/* @__PURE__ */ jsx30(
|
|
5295
5355
|
"button",
|
|
5296
5356
|
{
|
|
5297
5357
|
type: "button",
|
|
@@ -5303,7 +5363,7 @@ var ImageEditor = ({
|
|
|
5303
5363
|
children: "16:9 Wide"
|
|
5304
5364
|
}
|
|
5305
5365
|
),
|
|
5306
|
-
/* @__PURE__ */
|
|
5366
|
+
/* @__PURE__ */ jsx30(
|
|
5307
5367
|
"button",
|
|
5308
5368
|
{
|
|
5309
5369
|
type: "button",
|
|
@@ -5315,7 +5375,7 @@ var ImageEditor = ({
|
|
|
5315
5375
|
children: "3:2 Photo"
|
|
5316
5376
|
}
|
|
5317
5377
|
),
|
|
5318
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsx30(
|
|
5319
5379
|
"button",
|
|
5320
5380
|
{
|
|
5321
5381
|
type: "button",
|
|
@@ -5328,10 +5388,10 @@ var ImageEditor = ({
|
|
|
5328
5388
|
}
|
|
5329
5389
|
)
|
|
5330
5390
|
] }),
|
|
5331
|
-
/* @__PURE__ */
|
|
5332
|
-
/* @__PURE__ */
|
|
5333
|
-
/* @__PURE__ */
|
|
5334
|
-
/* @__PURE__ */
|
|
5391
|
+
/* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
|
|
5392
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5393
|
+
/* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5394
|
+
/* @__PURE__ */ jsx30(
|
|
5335
5395
|
"button",
|
|
5336
5396
|
{
|
|
5337
5397
|
type: "button",
|
|
@@ -5340,7 +5400,7 @@ var ImageEditor = ({
|
|
|
5340
5400
|
children: "Rotate -90\xB0"
|
|
5341
5401
|
}
|
|
5342
5402
|
),
|
|
5343
|
-
/* @__PURE__ */
|
|
5403
|
+
/* @__PURE__ */ jsx30(
|
|
5344
5404
|
"button",
|
|
5345
5405
|
{
|
|
5346
5406
|
type: "button",
|
|
@@ -5349,7 +5409,7 @@ var ImageEditor = ({
|
|
|
5349
5409
|
children: "Rotate +90\xB0"
|
|
5350
5410
|
}
|
|
5351
5411
|
),
|
|
5352
|
-
/* @__PURE__ */
|
|
5412
|
+
/* @__PURE__ */ jsx30(
|
|
5353
5413
|
"button",
|
|
5354
5414
|
{
|
|
5355
5415
|
type: "button",
|
|
@@ -5358,7 +5418,7 @@ var ImageEditor = ({
|
|
|
5358
5418
|
children: "Flip Horizontal"
|
|
5359
5419
|
}
|
|
5360
5420
|
),
|
|
5361
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ jsx30(
|
|
5362
5422
|
"button",
|
|
5363
5423
|
{
|
|
5364
5424
|
type: "button",
|
|
@@ -5369,10 +5429,10 @@ var ImageEditor = ({
|
|
|
5369
5429
|
)
|
|
5370
5430
|
] })
|
|
5371
5431
|
] }),
|
|
5372
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
5373
|
-
/* @__PURE__ */
|
|
5374
|
-
/* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5432
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5433
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
5434
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5435
|
+
/* @__PURE__ */ jsx30(
|
|
5376
5436
|
"button",
|
|
5377
5437
|
{
|
|
5378
5438
|
type: "button",
|
|
@@ -5382,9 +5442,9 @@ var ImageEditor = ({
|
|
|
5382
5442
|
}
|
|
5383
5443
|
)
|
|
5384
5444
|
] }),
|
|
5385
|
-
/* @__PURE__ */
|
|
5386
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
5387
|
-
/* @__PURE__ */
|
|
5445
|
+
/* @__PURE__ */ jsx30(Histogram, { histogram: editor.histogram }),
|
|
5446
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs28(React25.Fragment, { children: [
|
|
5447
|
+
/* @__PURE__ */ jsx30(
|
|
5388
5448
|
ControlSlider,
|
|
5389
5449
|
{
|
|
5390
5450
|
spec,
|
|
@@ -5393,14 +5453,14 @@ var ImageEditor = ({
|
|
|
5393
5453
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5394
5454
|
}
|
|
5395
5455
|
),
|
|
5396
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
5456
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs28(
|
|
5397
5457
|
"div",
|
|
5398
5458
|
{
|
|
5399
5459
|
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",
|
|
5400
5460
|
"data-testid": "image-editor-process-notice",
|
|
5401
5461
|
children: [
|
|
5402
|
-
/* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5462
|
+
/* @__PURE__ */ jsx30("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5463
|
+
/* @__PURE__ */ jsx30(
|
|
5404
5464
|
"button",
|
|
5405
5465
|
{
|
|
5406
5466
|
type: "button",
|
|
@@ -5413,7 +5473,7 @@ var ImageEditor = ({
|
|
|
5413
5473
|
}
|
|
5414
5474
|
)
|
|
5415
5475
|
] }, spec.id)),
|
|
5416
|
-
/* @__PURE__ */
|
|
5476
|
+
/* @__PURE__ */ jsx30("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx30(
|
|
5417
5477
|
AdjustmentLayersPanel,
|
|
5418
5478
|
{
|
|
5419
5479
|
controller,
|
|
@@ -5422,9 +5482,9 @@ var ImageEditor = ({
|
|
|
5422
5482
|
}
|
|
5423
5483
|
) })
|
|
5424
5484
|
] }),
|
|
5425
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
5426
|
-
/* @__PURE__ */
|
|
5427
|
-
/* @__PURE__ */
|
|
5485
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5486
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5487
|
+
/* @__PURE__ */ jsx30(
|
|
5428
5488
|
"button",
|
|
5429
5489
|
{
|
|
5430
5490
|
type: "button",
|
|
@@ -5435,15 +5495,15 @@ var ImageEditor = ({
|
|
|
5435
5495
|
children: "Free Transform"
|
|
5436
5496
|
}
|
|
5437
5497
|
),
|
|
5438
|
-
/* @__PURE__ */
|
|
5439
|
-
effectsShown && /* @__PURE__ */
|
|
5440
|
-
/* @__PURE__ */
|
|
5441
|
-
/* @__PURE__ */
|
|
5498
|
+
/* @__PURE__ */ jsx30(LayersPanel, { controller }),
|
|
5499
|
+
effectsShown && /* @__PURE__ */ jsx30(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5500
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5501
|
+
/* @__PURE__ */ jsx30(ColorProfilePanel, { controller })
|
|
5442
5502
|
] }),
|
|
5443
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
5444
|
-
/* @__PURE__ */
|
|
5445
|
-
/* @__PURE__ */
|
|
5446
|
-
/* @__PURE__ */
|
|
5503
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5504
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5505
|
+
/* @__PURE__ */ jsx30(BrushOptionsBar, { controller }),
|
|
5506
|
+
/* @__PURE__ */ jsx30(
|
|
5447
5507
|
"button",
|
|
5448
5508
|
{
|
|
5449
5509
|
type: "button",
|
|
@@ -5454,12 +5514,12 @@ var ImageEditor = ({
|
|
|
5454
5514
|
children: "Free Transform"
|
|
5455
5515
|
}
|
|
5456
5516
|
),
|
|
5457
|
-
paintError && /* @__PURE__ */
|
|
5458
|
-
/* @__PURE__ */
|
|
5517
|
+
paintError && /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5518
|
+
/* @__PURE__ */ jsx30("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx30(LayersPanel, { controller }) })
|
|
5459
5519
|
] }),
|
|
5460
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
5461
|
-
/* @__PURE__ */
|
|
5462
|
-
/* @__PURE__ */
|
|
5520
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5521
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
5522
|
+
/* @__PURE__ */ jsx30("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx30(
|
|
5463
5523
|
"button",
|
|
5464
5524
|
{
|
|
5465
5525
|
type: "button",
|
|
@@ -5470,13 +5530,13 @@ var ImageEditor = ({
|
|
|
5470
5530
|
},
|
|
5471
5531
|
t
|
|
5472
5532
|
)) }),
|
|
5473
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
5474
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
5475
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
5476
|
-
shapeTypeError && /* @__PURE__ */
|
|
5477
|
-
/* @__PURE__ */
|
|
5478
|
-
/* @__PURE__ */
|
|
5479
|
-
/* @__PURE__ */
|
|
5533
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx30(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5534
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx30(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5535
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx30("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" }),
|
|
5536
|
+
shapeTypeError && /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5537
|
+
/* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
|
|
5538
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5539
|
+
/* @__PURE__ */ jsx30("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx30(
|
|
5480
5540
|
"button",
|
|
5481
5541
|
{
|
|
5482
5542
|
type: "button",
|
|
@@ -5486,18 +5546,18 @@ var ImageEditor = ({
|
|
|
5486
5546
|
},
|
|
5487
5547
|
t
|
|
5488
5548
|
)) }),
|
|
5489
|
-
/* @__PURE__ */
|
|
5490
|
-
/* @__PURE__ */
|
|
5491
|
-
/* @__PURE__ */
|
|
5492
|
-
/* @__PURE__ */
|
|
5493
|
-
/* @__PURE__ */
|
|
5494
|
-
/* @__PURE__ */
|
|
5495
|
-
/* @__PURE__ */
|
|
5549
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5550
|
+
/* @__PURE__ */ jsx30("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5551
|
+
/* @__PURE__ */ jsx30(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
5552
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex-1 ml-2", children: [
|
|
5553
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5554
|
+
/* @__PURE__ */ jsx30("span", { children: "Width:" }),
|
|
5555
|
+
/* @__PURE__ */ jsxs28("span", { className: "font-mono", children: [
|
|
5496
5556
|
strokeWidth,
|
|
5497
5557
|
"px"
|
|
5498
5558
|
] })
|
|
5499
5559
|
] }),
|
|
5500
|
-
/* @__PURE__ */
|
|
5560
|
+
/* @__PURE__ */ jsx30(
|
|
5501
5561
|
"input",
|
|
5502
5562
|
{
|
|
5503
5563
|
type: "range",
|
|
@@ -5510,10 +5570,10 @@ var ImageEditor = ({
|
|
|
5510
5570
|
)
|
|
5511
5571
|
] })
|
|
5512
5572
|
] }),
|
|
5513
|
-
/* @__PURE__ */
|
|
5514
|
-
/* @__PURE__ */
|
|
5515
|
-
/* @__PURE__ */
|
|
5516
|
-
/* @__PURE__ */
|
|
5573
|
+
/* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
|
|
5574
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5575
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-2", children: [
|
|
5576
|
+
/* @__PURE__ */ jsx30(
|
|
5517
5577
|
"input",
|
|
5518
5578
|
{
|
|
5519
5579
|
type: "text",
|
|
@@ -5524,7 +5584,7 @@ var ImageEditor = ({
|
|
|
5524
5584
|
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"
|
|
5525
5585
|
}
|
|
5526
5586
|
),
|
|
5527
|
-
/* @__PURE__ */
|
|
5587
|
+
/* @__PURE__ */ jsx30(
|
|
5528
5588
|
"button",
|
|
5529
5589
|
{
|
|
5530
5590
|
type: "button",
|
|
@@ -5534,14 +5594,14 @@ var ImageEditor = ({
|
|
|
5534
5594
|
}
|
|
5535
5595
|
)
|
|
5536
5596
|
] }),
|
|
5537
|
-
/* @__PURE__ */
|
|
5538
|
-
/* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5597
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5598
|
+
/* @__PURE__ */ jsx30("span", { children: "Font Size:" }),
|
|
5599
|
+
/* @__PURE__ */ jsxs28("span", { className: "font-mono", children: [
|
|
5540
5600
|
fontSize,
|
|
5541
5601
|
"px"
|
|
5542
5602
|
] })
|
|
5543
5603
|
] }),
|
|
5544
|
-
/* @__PURE__ */
|
|
5604
|
+
/* @__PURE__ */ jsx30(
|
|
5545
5605
|
"input",
|
|
5546
5606
|
{
|
|
5547
5607
|
type: "range",
|
|
@@ -5552,14 +5612,14 @@ var ImageEditor = ({
|
|
|
5552
5612
|
className: imageRangeClass
|
|
5553
5613
|
}
|
|
5554
5614
|
),
|
|
5555
|
-
/* @__PURE__ */
|
|
5556
|
-
/* @__PURE__ */
|
|
5557
|
-
/* @__PURE__ */
|
|
5615
|
+
/* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
|
|
5616
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
5617
|
+
/* @__PURE__ */ jsxs28("span", { className: "text-muted-foreground", children: [
|
|
5558
5618
|
"Layers (",
|
|
5559
5619
|
state.annotations.length,
|
|
5560
5620
|
")"
|
|
5561
5621
|
] }),
|
|
5562
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5622
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx30(
|
|
5563
5623
|
"button",
|
|
5564
5624
|
{
|
|
5565
5625
|
type: "button",
|
|
@@ -5568,7 +5628,7 @@ var ImageEditor = ({
|
|
|
5568
5628
|
children: "Delete Selected"
|
|
5569
5629
|
}
|
|
5570
5630
|
),
|
|
5571
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5631
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx30(
|
|
5572
5632
|
"button",
|
|
5573
5633
|
{
|
|
5574
5634
|
type: "button",
|
|
@@ -5579,10 +5639,10 @@ var ImageEditor = ({
|
|
|
5579
5639
|
)
|
|
5580
5640
|
] })
|
|
5581
5641
|
] }),
|
|
5582
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
5583
|
-
/* @__PURE__ */
|
|
5584
|
-
/* @__PURE__ */
|
|
5585
|
-
/* @__PURE__ */
|
|
5642
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5643
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
5644
|
+
/* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5645
|
+
/* @__PURE__ */ jsx30(
|
|
5586
5646
|
"button",
|
|
5587
5647
|
{
|
|
5588
5648
|
type: "button",
|
|
@@ -5592,8 +5652,8 @@ var ImageEditor = ({
|
|
|
5592
5652
|
}
|
|
5593
5653
|
)
|
|
5594
5654
|
] }),
|
|
5595
|
-
/* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
5655
|
+
/* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5656
|
+
/* @__PURE__ */ jsx30(
|
|
5597
5657
|
"input",
|
|
5598
5658
|
{
|
|
5599
5659
|
type: "checkbox",
|
|
@@ -5602,12 +5662,12 @@ var ImageEditor = ({
|
|
|
5602
5662
|
className: "rounded accent-primary"
|
|
5603
5663
|
}
|
|
5604
5664
|
),
|
|
5605
|
-
/* @__PURE__ */
|
|
5665
|
+
/* @__PURE__ */ jsx30("span", { children: "Enable Depth / Alpha Mask" })
|
|
5606
5666
|
] }),
|
|
5607
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
5608
|
-
/* @__PURE__ */
|
|
5609
|
-
/* @__PURE__ */
|
|
5610
|
-
/* @__PURE__ */
|
|
5667
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs28(Fragment9, { children: [
|
|
5668
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
5669
|
+
/* @__PURE__ */ jsx30("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5670
|
+
/* @__PURE__ */ jsx30(
|
|
5611
5671
|
"input",
|
|
5612
5672
|
{
|
|
5613
5673
|
type: "text",
|
|
@@ -5618,8 +5678,8 @@ var ImageEditor = ({
|
|
|
5618
5678
|
}
|
|
5619
5679
|
)
|
|
5620
5680
|
] }),
|
|
5621
|
-
/* @__PURE__ */
|
|
5622
|
-
/* @__PURE__ */
|
|
5681
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-2", children: [
|
|
5682
|
+
/* @__PURE__ */ jsx30(
|
|
5623
5683
|
"button",
|
|
5624
5684
|
{
|
|
5625
5685
|
type: "button",
|
|
@@ -5628,7 +5688,7 @@ var ImageEditor = ({
|
|
|
5628
5688
|
children: "Threshold Mode"
|
|
5629
5689
|
}
|
|
5630
5690
|
),
|
|
5631
|
-
/* @__PURE__ */
|
|
5691
|
+
/* @__PURE__ */ jsx30(
|
|
5632
5692
|
"button",
|
|
5633
5693
|
{
|
|
5634
5694
|
type: "button",
|
|
@@ -5638,12 +5698,12 @@ var ImageEditor = ({
|
|
|
5638
5698
|
}
|
|
5639
5699
|
)
|
|
5640
5700
|
] }),
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
/* @__PURE__ */
|
|
5643
|
-
/* @__PURE__ */
|
|
5644
|
-
/* @__PURE__ */
|
|
5701
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
5702
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5703
|
+
/* @__PURE__ */ jsx30("span", { children: "Depth Start (Lower):" }),
|
|
5704
|
+
/* @__PURE__ */ jsx30("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5645
5705
|
] }),
|
|
5646
|
-
/* @__PURE__ */
|
|
5706
|
+
/* @__PURE__ */ jsx30(
|
|
5647
5707
|
"input",
|
|
5648
5708
|
{
|
|
5649
5709
|
type: "range",
|
|
@@ -5657,12 +5717,12 @@ var ImageEditor = ({
|
|
|
5657
5717
|
}
|
|
5658
5718
|
)
|
|
5659
5719
|
] }),
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5663
|
-
/* @__PURE__ */
|
|
5720
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
5721
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5722
|
+
/* @__PURE__ */ jsx30("span", { children: "Depth Stop (Upper):" }),
|
|
5723
|
+
/* @__PURE__ */ jsx30("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5664
5724
|
] }),
|
|
5665
|
-
/* @__PURE__ */
|
|
5725
|
+
/* @__PURE__ */ jsx30(
|
|
5666
5726
|
"input",
|
|
5667
5727
|
{
|
|
5668
5728
|
type: "range",
|
|
@@ -5676,12 +5736,12 @@ var ImageEditor = ({
|
|
|
5676
5736
|
}
|
|
5677
5737
|
)
|
|
5678
5738
|
] }),
|
|
5679
|
-
/* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5681
|
-
/* @__PURE__ */
|
|
5682
|
-
/* @__PURE__ */
|
|
5739
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
5740
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5741
|
+
/* @__PURE__ */ jsx30("span", { children: "Softness:" }),
|
|
5742
|
+
/* @__PURE__ */ jsx30("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5683
5743
|
] }),
|
|
5684
|
-
/* @__PURE__ */
|
|
5744
|
+
/* @__PURE__ */ jsx30(
|
|
5685
5745
|
"input",
|
|
5686
5746
|
{
|
|
5687
5747
|
type: "range",
|
|
@@ -5693,8 +5753,8 @@ var ImageEditor = ({
|
|
|
5693
5753
|
}
|
|
5694
5754
|
)
|
|
5695
5755
|
] }),
|
|
5696
|
-
/* @__PURE__ */
|
|
5697
|
-
/* @__PURE__ */
|
|
5756
|
+
/* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5757
|
+
/* @__PURE__ */ jsx30(
|
|
5698
5758
|
"input",
|
|
5699
5759
|
{
|
|
5700
5760
|
type: "checkbox",
|
|
@@ -5703,12 +5763,12 @@ var ImageEditor = ({
|
|
|
5703
5763
|
className: "rounded accent-primary"
|
|
5704
5764
|
}
|
|
5705
5765
|
),
|
|
5706
|
-
/* @__PURE__ */
|
|
5766
|
+
/* @__PURE__ */ jsx30("span", { children: "Invert Mask" })
|
|
5707
5767
|
] })
|
|
5708
5768
|
] })
|
|
5709
5769
|
] }),
|
|
5710
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5711
|
-
/* @__PURE__ */
|
|
5770
|
+
activeTab === "select" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5771
|
+
/* @__PURE__ */ jsx30(
|
|
5712
5772
|
SelectionOptionsBar,
|
|
5713
5773
|
{
|
|
5714
5774
|
controller,
|
|
@@ -5719,9 +5779,9 @@ var ImageEditor = ({
|
|
|
5719
5779
|
selectionDisplay: state.selectionDisplay
|
|
5720
5780
|
}
|
|
5721
5781
|
),
|
|
5722
|
-
selectionError && /* @__PURE__ */
|
|
5723
|
-
/* @__PURE__ */
|
|
5724
|
-
/* @__PURE__ */
|
|
5782
|
+
selectionError && /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5783
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-1", children: [
|
|
5784
|
+
/* @__PURE__ */ jsx30(
|
|
5725
5785
|
"button",
|
|
5726
5786
|
{
|
|
5727
5787
|
type: "button",
|
|
@@ -5732,7 +5792,7 @@ var ImageEditor = ({
|
|
|
5732
5792
|
children: "Transform Selection"
|
|
5733
5793
|
}
|
|
5734
5794
|
),
|
|
5735
|
-
/* @__PURE__ */
|
|
5795
|
+
/* @__PURE__ */ jsx30(
|
|
5736
5796
|
"button",
|
|
5737
5797
|
{
|
|
5738
5798
|
type: "button",
|
|
@@ -5744,14 +5804,14 @@ var ImageEditor = ({
|
|
|
5744
5804
|
}
|
|
5745
5805
|
)
|
|
5746
5806
|
] }),
|
|
5747
|
-
/* @__PURE__ */
|
|
5748
|
-
/* @__PURE__ */
|
|
5749
|
-
/* @__PURE__ */
|
|
5807
|
+
/* @__PURE__ */ jsx30(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5808
|
+
/* @__PURE__ */ jsx30(ChannelsPanel, { controller }),
|
|
5809
|
+
/* @__PURE__ */ jsx30(PathsPanel, { controller })
|
|
5750
5810
|
] }),
|
|
5751
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5752
|
-
/* @__PURE__ */
|
|
5753
|
-
/* @__PURE__ */
|
|
5754
|
-
/* @__PURE__ */
|
|
5811
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5812
|
+
/* @__PURE__ */ jsxs28("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5813
|
+
/* @__PURE__ */ jsx30("span", { children: "Results go to" }),
|
|
5814
|
+
/* @__PURE__ */ jsxs28(
|
|
5755
5815
|
"select",
|
|
5756
5816
|
{
|
|
5757
5817
|
"aria-label": "AI result target",
|
|
@@ -5759,54 +5819,54 @@ var ImageEditor = ({
|
|
|
5759
5819
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5760
5820
|
className: imageSelectClass,
|
|
5761
5821
|
children: [
|
|
5762
|
-
/* @__PURE__ */
|
|
5763
|
-
/* @__PURE__ */
|
|
5764
|
-
/* @__PURE__ */
|
|
5822
|
+
/* @__PURE__ */ jsx30("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5823
|
+
/* @__PURE__ */ jsx30("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5824
|
+
/* @__PURE__ */ jsx30("option", { value: "replace", children: "Replace image" })
|
|
5765
5825
|
]
|
|
5766
5826
|
}
|
|
5767
5827
|
)
|
|
5768
5828
|
] }),
|
|
5769
|
-
/* @__PURE__ */
|
|
5770
|
-
/* @__PURE__ */
|
|
5771
|
-
/* @__PURE__ */
|
|
5772
|
-
/* @__PURE__ */
|
|
5829
|
+
/* @__PURE__ */ jsxs28("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5830
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
5831
|
+
/* @__PURE__ */ jsxs28("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5832
|
+
/* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("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" }) }),
|
|
5773
5833
|
"Background Removal"
|
|
5774
5834
|
] }),
|
|
5775
|
-
isRemovingBg && /* @__PURE__ */
|
|
5835
|
+
isRemovingBg && /* @__PURE__ */ jsx30("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..." })
|
|
5776
5836
|
] }),
|
|
5777
|
-
/* @__PURE__ */
|
|
5778
|
-
/* @__PURE__ */
|
|
5837
|
+
/* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5838
|
+
/* @__PURE__ */ jsx30(
|
|
5779
5839
|
"button",
|
|
5780
5840
|
{
|
|
5781
5841
|
type: "button",
|
|
5782
5842
|
onClick: handleRemoveBackground,
|
|
5783
5843
|
disabled: isRemovingBg || isInpainting,
|
|
5784
5844
|
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",
|
|
5785
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
5786
|
-
/* @__PURE__ */
|
|
5845
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs28(Fragment9, { children: [
|
|
5846
|
+
/* @__PURE__ */ jsx30("div", { className: imageSpinnerClass }),
|
|
5787
5847
|
"Removing Background..."
|
|
5788
|
-
] }) : /* @__PURE__ */
|
|
5789
|
-
/* @__PURE__ */
|
|
5848
|
+
] }) : /* @__PURE__ */ jsxs28(Fragment9, { children: [
|
|
5849
|
+
/* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("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" }) }),
|
|
5790
5850
|
"Remove Background"
|
|
5791
5851
|
] })
|
|
5792
5852
|
}
|
|
5793
5853
|
)
|
|
5794
5854
|
] }),
|
|
5795
|
-
/* @__PURE__ */
|
|
5796
|
-
/* @__PURE__ */
|
|
5797
|
-
/* @__PURE__ */
|
|
5798
|
-
/* @__PURE__ */
|
|
5799
|
-
/* @__PURE__ */
|
|
5800
|
-
/* @__PURE__ */
|
|
5855
|
+
/* @__PURE__ */ jsxs28("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5856
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
5857
|
+
/* @__PURE__ */ jsxs28("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5858
|
+
/* @__PURE__ */ jsxs28("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5859
|
+
/* @__PURE__ */ jsx30("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" }),
|
|
5860
|
+
/* @__PURE__ */ jsx30("path", { d: "m14 7 3 3" })
|
|
5801
5861
|
] }),
|
|
5802
5862
|
"Generative Inpainting"
|
|
5803
5863
|
] }),
|
|
5804
|
-
isInpainting && /* @__PURE__ */
|
|
5864
|
+
isInpainting && /* @__PURE__ */ jsx30("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..." })
|
|
5805
5865
|
] }),
|
|
5806
|
-
/* @__PURE__ */
|
|
5807
|
-
/* @__PURE__ */
|
|
5808
|
-
/* @__PURE__ */
|
|
5809
|
-
/* @__PURE__ */
|
|
5866
|
+
/* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5867
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", children: [
|
|
5868
|
+
/* @__PURE__ */ jsx30("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5869
|
+
/* @__PURE__ */ jsx30(
|
|
5810
5870
|
"textarea",
|
|
5811
5871
|
{
|
|
5812
5872
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5818,10 +5878,10 @@ var ImageEditor = ({
|
|
|
5818
5878
|
}
|
|
5819
5879
|
)
|
|
5820
5880
|
] }),
|
|
5821
|
-
/* @__PURE__ */
|
|
5822
|
-
/* @__PURE__ */
|
|
5823
|
-
/* @__PURE__ */
|
|
5824
|
-
/* @__PURE__ */
|
|
5881
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", children: [
|
|
5882
|
+
/* @__PURE__ */ jsx30("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5883
|
+
/* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5884
|
+
/* @__PURE__ */ jsxs28(
|
|
5825
5885
|
"button",
|
|
5826
5886
|
{
|
|
5827
5887
|
type: "button",
|
|
@@ -5834,7 +5894,7 @@ var ImageEditor = ({
|
|
|
5834
5894
|
]
|
|
5835
5895
|
}
|
|
5836
5896
|
),
|
|
5837
|
-
/* @__PURE__ */
|
|
5897
|
+
/* @__PURE__ */ jsxs28(
|
|
5838
5898
|
"button",
|
|
5839
5899
|
{
|
|
5840
5900
|
type: "button",
|
|
@@ -5849,25 +5909,25 @@ var ImageEditor = ({
|
|
|
5849
5909
|
)
|
|
5850
5910
|
] })
|
|
5851
5911
|
] }),
|
|
5852
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsx30(
|
|
5853
5913
|
"button",
|
|
5854
5914
|
{
|
|
5855
5915
|
type: "button",
|
|
5856
5916
|
onClick: handleInpaint,
|
|
5857
5917
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5858
5918
|
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",
|
|
5859
|
-
children: isInpainting ? /* @__PURE__ */
|
|
5860
|
-
/* @__PURE__ */
|
|
5919
|
+
children: isInpainting ? /* @__PURE__ */ jsxs28(Fragment9, { children: [
|
|
5920
|
+
/* @__PURE__ */ jsx30("div", { className: imageSpinnerClass }),
|
|
5861
5921
|
"Generating Inpaint..."
|
|
5862
|
-
] }) : /* @__PURE__ */
|
|
5863
|
-
/* @__PURE__ */
|
|
5922
|
+
] }) : /* @__PURE__ */ jsxs28(Fragment9, { children: [
|
|
5923
|
+
/* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("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" }) }),
|
|
5864
5924
|
"Apply Inpainting"
|
|
5865
5925
|
] })
|
|
5866
5926
|
}
|
|
5867
5927
|
)
|
|
5868
5928
|
] }),
|
|
5869
|
-
aiError && /* @__PURE__ */
|
|
5870
|
-
aiSuccess && /* @__PURE__ */
|
|
5929
|
+
aiError && /* @__PURE__ */ jsx30("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5930
|
+
aiSuccess && /* @__PURE__ */ jsx30("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5871
5931
|
] })
|
|
5872
5932
|
] })
|
|
5873
5933
|
] })
|
|
@@ -5900,6 +5960,7 @@ export {
|
|
|
5900
5960
|
PaintGradientEditor,
|
|
5901
5961
|
BrushOptionsBar,
|
|
5902
5962
|
ColorProfilePanel,
|
|
5963
|
+
SelectionRecipePanel,
|
|
5903
5964
|
SelectAndMaskWorkspace,
|
|
5904
5965
|
ContentAwareFillWorkspace,
|
|
5905
5966
|
SelectionOptionsBar,
|