@pixerate/editor-react 0.172.1 → 0.174.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/{paint-editor → brushes}/BrushLibraryBrowser.d.cts +2 -2
- package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.ts +2 -2
- package/dist/brushes/index.cjs +102 -0
- package/dist/brushes/index.d.cts +2 -0
- package/dist/brushes/index.d.ts +2 -0
- package/dist/brushes/index.js +10 -0
- package/dist/brushes/useBrushLibrary.d.cts +7 -0
- package/dist/brushes/useBrushLibrary.d.ts +7 -0
- package/dist/canvas/index.cjs +7 -2
- package/dist/canvas/index.js +7 -2
- package/dist/canvas/useCanvasDraw.d.cts +4 -2
- package/dist/canvas/useCanvasDraw.d.ts +4 -2
- package/dist/canvas/useShapeBrushstroke.d.cts +6 -2
- package/dist/canvas/useShapeBrushstroke.d.ts +6 -2
- package/dist/chunk-62FMEDGG.js +54 -0
- package/dist/chunk-PQK2UMAY.js +23 -0
- package/dist/{chunk-NQ22NA7S.js → chunk-UR4KL7WE.js} +28 -0
- package/dist/image-editor/BrushOptionsBar.d.cts +2 -1
- package/dist/image-editor/BrushOptionsBar.d.ts +2 -1
- package/dist/image-editor/index.cjs +964 -869
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +1484 -1389
- package/dist/index.js +12 -10
- package/dist/paint-editor/PaintCanvas.d.cts +9 -1
- package/dist/paint-editor/PaintCanvas.d.ts +9 -1
- package/dist/paint-editor/PaintEditor.d.cts +3 -1
- package/dist/paint-editor/PaintEditor.d.ts +3 -1
- package/dist/paint-editor/index.cjs +77 -7
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +416 -389
- package/dist/paint-editor/usePaintEditor.d.cts +30 -1
- package/dist/paint-editor/usePaintEditor.d.ts +30 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +3 -4
- package/package.json +16 -3
|
@@ -240,7 +240,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
// src/image-editor/ImageEditor.tsx
|
|
243
|
-
var
|
|
243
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
244
244
|
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
245
245
|
|
|
246
246
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -4455,7 +4455,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4455
4455
|
}
|
|
4456
4456
|
|
|
4457
4457
|
// src/image-editor/BrushOptionsBar.tsx
|
|
4458
|
-
var
|
|
4458
|
+
var import_react27 = require("react");
|
|
4459
4459
|
var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
4460
4460
|
var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
4461
4461
|
|
|
@@ -4589,14 +4589,91 @@ var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
|
4589
4589
|
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
|
|
4590
4590
|
|
|
4591
4591
|
// src/image-editor/BrushOptionsBar.tsx
|
|
4592
|
+
var import_brushes2 = require("@pixerate/editor/brushes");
|
|
4593
|
+
|
|
4594
|
+
// src/brushes/BrushLibraryBrowser.tsx
|
|
4595
|
+
var import_react25 = require("react");
|
|
4596
|
+
var import_brushes = require("@pixerate/editor/brushes");
|
|
4592
4597
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4598
|
+
var Thumbnail2 = ({ image, label, style }) => {
|
|
4599
|
+
const ref = (0, import_react25.useRef)(null);
|
|
4600
|
+
(0, import_react25.useEffect)(() => {
|
|
4601
|
+
const canvas = ref.current;
|
|
4602
|
+
const ctx = canvas?.getContext("2d");
|
|
4603
|
+
if (!canvas || !ctx || !image || typeof image === "string" || typeof ctx.createImageData !== "function") return;
|
|
4604
|
+
canvas.width = image.width;
|
|
4605
|
+
canvas.height = image.height;
|
|
4606
|
+
const img = ctx.createImageData(image.width, image.height);
|
|
4607
|
+
img.data.set(image.data);
|
|
4608
|
+
ctx.putImageData(img, 0, 0);
|
|
4609
|
+
}, [image]);
|
|
4610
|
+
if (typeof image === "string") return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { src: image, alt: label, className: "rounded object-contain", style });
|
|
4611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("canvas", { ref, role: "img", "aria-label": label, className: "rounded", style, width: image?.width, height: image?.height });
|
|
4612
|
+
};
|
|
4613
|
+
var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
|
|
4614
|
+
const [text, setText] = (0, import_react25.useState)("");
|
|
4615
|
+
const groups = (0, import_react25.useMemo)(() => (0, import_brushes.brushLibraryGroups)(entries, { text, profile }), [entries, text, profile]);
|
|
4616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "brush-library", children: [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "search", value: text, placeholder: "Find a brush", "aria-label": "Find a brush", onChange: (e) => setText(e.target.value), className: "rounded bg-slate-800 px-1.5 py-0.5" }),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1.5", role: "listbox", "aria-label": "Brushes", children: [
|
|
4619
|
+
groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "group", "aria-label": g.title, className: "flex flex-col gap-0.5", children: [
|
|
4620
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[10px] uppercase tracking-wide text-slate-500", children: g.title }),
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap(
|
|
4622
|
+
(v) => v.entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4623
|
+
"button",
|
|
4624
|
+
{
|
|
4625
|
+
type: "button",
|
|
4626
|
+
role: "option",
|
|
4627
|
+
"aria-selected": activeId === e.brush.id,
|
|
4628
|
+
title: [e.brush.name, v.title.toLowerCase() === e.brush.name.toLowerCase() ? "" : v.title, e.builtin ? "" : "saved"].filter(Boolean).join(" \xB7 "),
|
|
4629
|
+
className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${activeId === e.brush.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
|
|
4630
|
+
onClick: () => onSelect(e.brush.id),
|
|
4631
|
+
children: [
|
|
4632
|
+
thumbnail && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Thumbnail2, { image: thumbnail(e.brush.id) ?? null, label: `${e.brush.name} thumbnail`, style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
|
|
4633
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-[10px] text-slate-300", children: e.brush.name })
|
|
4634
|
+
]
|
|
4635
|
+
},
|
|
4636
|
+
e.brush.id
|
|
4637
|
+
))
|
|
4638
|
+
) })
|
|
4639
|
+
] }, g.id)),
|
|
4640
|
+
!groups.length && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-slate-500", children: "No brush matches." })
|
|
4641
|
+
] })
|
|
4642
|
+
] });
|
|
4643
|
+
};
|
|
4644
|
+
|
|
4645
|
+
// src/brushes/useBrushLibrary.ts
|
|
4646
|
+
var import_react26 = require("react");
|
|
4647
|
+
function useBrushLibrary(library, filter = {}) {
|
|
4648
|
+
const [entries, setEntries] = (0, import_react26.useState)([]);
|
|
4649
|
+
const { profile, ...rest } = filter;
|
|
4650
|
+
const key = `${profile?.id ?? ""}:${JSON.stringify(rest)}`;
|
|
4651
|
+
(0, import_react26.useEffect)(() => {
|
|
4652
|
+
if (!library) return;
|
|
4653
|
+
let live = true;
|
|
4654
|
+
const read = () => void library.list(filter).then((list) => live && setEntries(list), () => void 0);
|
|
4655
|
+
read();
|
|
4656
|
+
const unsubscribe = library.subscribe(read);
|
|
4657
|
+
return () => {
|
|
4658
|
+
live = false;
|
|
4659
|
+
unsubscribe();
|
|
4660
|
+
};
|
|
4661
|
+
}, [library, key]);
|
|
4662
|
+
return entries;
|
|
4663
|
+
}
|
|
4664
|
+
|
|
4665
|
+
// src/image-editor/BrushOptionsBar.tsx
|
|
4666
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4593
4667
|
var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
4594
|
-
const [, setTick] = (0,
|
|
4595
|
-
(0,
|
|
4596
|
-
const [error, setError] = (0,
|
|
4668
|
+
const [, setTick] = (0, import_react27.useState)(0);
|
|
4669
|
+
(0, import_react27.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4670
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
4597
4671
|
const state = controller.getState();
|
|
4598
4672
|
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
|
|
4599
4673
|
const tool = state.activeTool;
|
|
4674
|
+
const [presetsOpen, setPresetsOpen] = (0, import_react27.useState)(false);
|
|
4675
|
+
const presets = useBrushLibrary(presetsOpen ? controller.brushLibrary : null, { profile: import_brushes2.IMAGE_PROFILE });
|
|
4676
|
+
const presetName = presets.find((e) => e.brush.id === state.paint.brushPreset)?.brush.name ?? state.paint.brushPreset;
|
|
4600
4677
|
const attempt = (fn) => {
|
|
4601
4678
|
try {
|
|
4602
4679
|
setError(null);
|
|
@@ -4605,8 +4682,8 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4605
4682
|
setError((0, import_image_editor11.userErrorMessage)(err));
|
|
4606
4683
|
}
|
|
4607
4684
|
};
|
|
4608
|
-
return /* @__PURE__ */ (0,
|
|
4609
|
-
showTools && /* @__PURE__ */ (0,
|
|
4685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
4686
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4610
4687
|
"button",
|
|
4611
4688
|
{
|
|
4612
4689
|
type: "button",
|
|
@@ -4618,18 +4695,36 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4618
4695
|
},
|
|
4619
4696
|
t.id
|
|
4620
4697
|
)) }),
|
|
4621
|
-
/* @__PURE__ */ (0,
|
|
4622
|
-
/* @__PURE__ */ (0,
|
|
4623
|
-
|
|
4624
|
-
|
|
4698
|
+
(tool === "brush" || tool === "mixer" || tool === "eraser") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "brush-presets", children: [
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("button", { type: "button", "aria-expanded": presetsOpen, className: imageChipClass(presetsOpen), onClick: () => setPresetsOpen((o) => !o), title: "Paint with a brush from the brush library", children: [
|
|
4700
|
+
"Brush presets",
|
|
4701
|
+
presetName ? `: ${presetName}` : ""
|
|
4702
|
+
] }),
|
|
4703
|
+
presetsOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4704
|
+
BrushLibraryBrowser,
|
|
4705
|
+
{
|
|
4706
|
+
entries: presets,
|
|
4707
|
+
activeId: state.paint.brushPreset ?? void 0,
|
|
4708
|
+
profile: import_brushes2.IMAGE_PROFILE,
|
|
4709
|
+
onSelect: (id) => {
|
|
4710
|
+
setError(null);
|
|
4711
|
+
controller.setBrushPreset(id).catch((err) => setError((0, import_image_editor11.userErrorMessage)(err)));
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
)
|
|
4715
|
+
] }),
|
|
4716
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4718
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
|
|
4719
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
4625
4720
|
] }),
|
|
4626
|
-
/* @__PURE__ */ (0,
|
|
4627
|
-
/* @__PURE__ */ (0,
|
|
4628
|
-
/* @__PURE__ */ (0,
|
|
4721
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
4629
4724
|
] }),
|
|
4630
|
-
/* @__PURE__ */ (0,
|
|
4631
|
-
/* @__PURE__ */ (0,
|
|
4632
|
-
state.activeTool === "brush" && /* @__PURE__ */ (0,
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
4727
|
+
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4633
4728
|
"button",
|
|
4634
4729
|
{
|
|
4635
4730
|
type: "button",
|
|
@@ -4641,8 +4736,8 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4641
4736
|
}
|
|
4642
4737
|
)
|
|
4643
4738
|
] }),
|
|
4644
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0,
|
|
4645
|
-
import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4739
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
4740
|
+
import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4646
4741
|
ControlSlider,
|
|
4647
4742
|
{
|
|
4648
4743
|
spec,
|
|
@@ -4651,9 +4746,9 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4651
4746
|
},
|
|
4652
4747
|
spec.id
|
|
4653
4748
|
)),
|
|
4654
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0,
|
|
4655
|
-
/* @__PURE__ */ (0,
|
|
4656
|
-
/* @__PURE__ */ (0,
|
|
4749
|
+
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4751
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4657
4752
|
"span",
|
|
4658
4753
|
{
|
|
4659
4754
|
"aria-label": "Brush load",
|
|
@@ -4662,10 +4757,10 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4662
4757
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
4663
4758
|
}
|
|
4664
4759
|
),
|
|
4665
|
-
/* @__PURE__ */ (0,
|
|
4666
|
-
/* @__PURE__ */ (0,
|
|
4760
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
4761
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
4667
4762
|
] }),
|
|
4668
|
-
/* @__PURE__ */ (0,
|
|
4763
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4669
4764
|
"button",
|
|
4670
4765
|
{
|
|
4671
4766
|
type: "button",
|
|
@@ -4677,34 +4772,34 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4677
4772
|
},
|
|
4678
4773
|
m.id
|
|
4679
4774
|
)) }),
|
|
4680
|
-
import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4681
|
-
/* @__PURE__ */ (0,
|
|
4682
|
-
/* @__PURE__ */ (0,
|
|
4683
|
-
/* @__PURE__ */ (0,
|
|
4775
|
+
import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
4777
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4778
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
4684
4779
|
"Load each stroke"
|
|
4685
4780
|
] }),
|
|
4686
|
-
/* @__PURE__ */ (0,
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4782
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
4688
4783
|
"Clean each stroke"
|
|
4689
4784
|
] })
|
|
4690
4785
|
] })
|
|
4691
4786
|
] }),
|
|
4692
|
-
(0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0,
|
|
4693
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
4694
|
-
/* @__PURE__ */ (0,
|
|
4695
|
-
cloneSource && /* @__PURE__ */ (0,
|
|
4787
|
+
(0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
4788
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
|
|
4790
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
4696
4791
|
] }),
|
|
4697
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
4698
|
-
import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4699
|
-
/* @__PURE__ */ (0,
|
|
4700
|
-
/* @__PURE__ */ (0,
|
|
4701
|
-
/* @__PURE__ */ (0,
|
|
4702
|
-
!(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0,
|
|
4792
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
4793
|
+
import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4795
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
4796
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
4797
|
+
!(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
4703
4798
|
] })
|
|
4704
4799
|
] }),
|
|
4705
|
-
import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0,
|
|
4706
|
-
/* @__PURE__ */ (0,
|
|
4707
|
-
choice.options.map((o) => /* @__PURE__ */ (0,
|
|
4800
|
+
import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
4801
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
4802
|
+
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4708
4803
|
"button",
|
|
4709
4804
|
{
|
|
4710
4805
|
type: "button",
|
|
@@ -4717,43 +4812,43 @@ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
|
|
|
4717
4812
|
o.id
|
|
4718
4813
|
))
|
|
4719
4814
|
] }, choice.id)),
|
|
4720
|
-
import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0,
|
|
4721
|
-
/* @__PURE__ */ (0,
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4815
|
+
import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
4816
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
4723
4818
|
t.label
|
|
4724
4819
|
] }, t.id)) })
|
|
4725
4820
|
] }),
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4727
|
-
/* @__PURE__ */ (0,
|
|
4728
|
-
/* @__PURE__ */ (0,
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
4822
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4823
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
4729
4824
|
"Pressure size"
|
|
4730
4825
|
] }),
|
|
4731
|
-
/* @__PURE__ */ (0,
|
|
4732
|
-
/* @__PURE__ */ (0,
|
|
4826
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
4733
4828
|
"Pressure opacity"
|
|
4734
4829
|
] })
|
|
4735
4830
|
] }),
|
|
4736
|
-
/* @__PURE__ */ (0,
|
|
4737
|
-
/* @__PURE__ */ (0,
|
|
4738
|
-
/* @__PURE__ */ (0,
|
|
4831
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
4833
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
4739
4834
|
] }),
|
|
4740
|
-
error && /* @__PURE__ */ (0,
|
|
4835
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4741
4836
|
] });
|
|
4742
4837
|
};
|
|
4743
4838
|
|
|
4744
4839
|
// src/image-editor/ColorProfilePanel.tsx
|
|
4745
|
-
var
|
|
4840
|
+
var import_react28 = require("react");
|
|
4746
4841
|
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
4747
|
-
var
|
|
4842
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4748
4843
|
var chip = imageChipClass(false);
|
|
4749
4844
|
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
4750
4845
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
4751
|
-
const [, setTick] = (0,
|
|
4752
|
-
(0,
|
|
4753
|
-
const [target, setTarget] = (0,
|
|
4754
|
-
const [intent, setIntent] = (0,
|
|
4755
|
-
const [bpc, setBpc] = (0,
|
|
4756
|
-
const [error, setError] = (0,
|
|
4846
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
4847
|
+
(0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4848
|
+
const [target, setTarget] = (0, import_react28.useState)("display-p3");
|
|
4849
|
+
const [intent, setIntent] = (0, import_react28.useState)("relative");
|
|
4850
|
+
const [bpc, setBpc] = (0, import_react28.useState)(true);
|
|
4851
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
4757
4852
|
const view = (0, import_image_editor12.colorPanelView)(controller);
|
|
4758
4853
|
const attempt = (fn) => {
|
|
4759
4854
|
try {
|
|
@@ -4775,29 +4870,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4775
4870
|
})
|
|
4776
4871
|
);
|
|
4777
4872
|
};
|
|
4778
|
-
return /* @__PURE__ */ (0,
|
|
4779
|
-
/* @__PURE__ */ (0,
|
|
4780
|
-
/* @__PURE__ */ (0,
|
|
4781
|
-
/* @__PURE__ */ (0,
|
|
4873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
4874
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4875
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
4876
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
4782
4877
|
] }),
|
|
4783
|
-
/* @__PURE__ */ (0,
|
|
4784
|
-
/* @__PURE__ */ (0,
|
|
4785
|
-
/* @__PURE__ */ (0,
|
|
4786
|
-
view.cmykProfileName && /* @__PURE__ */ (0,
|
|
4878
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
4879
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4881
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
4787
4882
|
] }),
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
/* @__PURE__ */ (0,
|
|
4790
|
-
/* @__PURE__ */ (0,
|
|
4791
|
-
/* @__PURE__ */ (0,
|
|
4792
|
-
/* @__PURE__ */ (0,
|
|
4883
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
4884
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4885
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4886
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4887
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
4793
4888
|
"BPC"
|
|
4794
4889
|
] }),
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
4796
|
-
/* @__PURE__ */ (0,
|
|
4890
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
4797
4892
|
] }),
|
|
4798
|
-
/* @__PURE__ */ (0,
|
|
4799
|
-
/* @__PURE__ */ (0,
|
|
4800
|
-
/* @__PURE__ */ (0,
|
|
4893
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
4894
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
4895
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4801
4896
|
"select",
|
|
4802
4897
|
{
|
|
4803
4898
|
"aria-label": "Proof profile",
|
|
@@ -4805,67 +4900,67 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4805
4900
|
value: view.proof?.id ?? "",
|
|
4806
4901
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
4807
4902
|
children: [
|
|
4808
|
-
/* @__PURE__ */ (0,
|
|
4809
|
-
import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "Off" }),
|
|
4904
|
+
import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
4810
4905
|
]
|
|
4811
4906
|
}
|
|
4812
4907
|
),
|
|
4813
|
-
view.proof && /* @__PURE__ */ (0,
|
|
4814
|
-
/* @__PURE__ */ (0,
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
4816
|
-
/* @__PURE__ */ (0,
|
|
4908
|
+
view.proof && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
4909
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4910
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4911
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
4817
4912
|
"Paper"
|
|
4818
4913
|
] }),
|
|
4819
|
-
/* @__PURE__ */ (0,
|
|
4820
|
-
/* @__PURE__ */ (0,
|
|
4914
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4915
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
4821
4916
|
"Gamut warning"
|
|
4822
4917
|
] })
|
|
4823
4918
|
] })
|
|
4824
4919
|
] }),
|
|
4825
|
-
error && /* @__PURE__ */ (0,
|
|
4920
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4826
4921
|
] });
|
|
4827
4922
|
};
|
|
4828
4923
|
|
|
4829
4924
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
4830
|
-
var
|
|
4925
|
+
var import_react32 = require("react");
|
|
4831
4926
|
|
|
4832
4927
|
// src/image-editor/SelectionRecipePanel.tsx
|
|
4833
|
-
var
|
|
4928
|
+
var import_react29 = require("react");
|
|
4834
4929
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
4835
|
-
var
|
|
4930
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4836
4931
|
var MODES2 = ["replace", "add", "subtract", "intersect"];
|
|
4837
4932
|
var button2 = "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";
|
|
4838
4933
|
var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
4839
|
-
const [error, setError] = (0,
|
|
4934
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
4840
4935
|
const recipe = controller.getSelectionRecipe();
|
|
4841
4936
|
if (!recipe.live) return null;
|
|
4842
4937
|
const run = (p) => {
|
|
4843
4938
|
setError(null);
|
|
4844
4939
|
Promise.resolve(p).catch((err) => setError(err instanceof Error ? err.message : String(err)));
|
|
4845
4940
|
};
|
|
4846
|
-
return /* @__PURE__ */ (0,
|
|
4847
|
-
/* @__PURE__ */ (0,
|
|
4848
|
-
/* @__PURE__ */ (0,
|
|
4849
|
-
/* @__PURE__ */ (0,
|
|
4941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "selection-recipe", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
4942
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4943
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Selection steps" }),
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button2, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
|
|
4850
4945
|
] }),
|
|
4851
|
-
/* @__PURE__ */ (0,
|
|
4946
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
|
|
4852
4947
|
const setting = (0, import_image_editor13.recipeStepSetting)(step);
|
|
4853
4948
|
const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
|
|
4854
|
-
return /* @__PURE__ */ (0,
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
4856
|
-
shape && step.index > 0 && /* @__PURE__ */ (0,
|
|
4949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
|
|
4950
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: (0, import_image_editor13.describeRecipeStep)(step) }),
|
|
4951
|
+
shape && step.index > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4857
4952
|
"select",
|
|
4858
4953
|
{
|
|
4859
4954
|
"aria-label": `Step ${step.index + 1} mode`,
|
|
4860
4955
|
value: step.mode ?? "replace",
|
|
4861
4956
|
onChange: (e) => run(controller.editSelectionStep(step.index, { mode: e.target.value })),
|
|
4862
4957
|
className: "bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
4863
|
-
children: MODES2.map((m) => /* @__PURE__ */ (0,
|
|
4958
|
+
children: MODES2.map((m) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: m, children: m }, m))
|
|
4864
4959
|
}
|
|
4865
4960
|
),
|
|
4866
|
-
setting && /* @__PURE__ */ (0,
|
|
4961
|
+
setting && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4867
4962
|
setting.label,
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4963
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4869
4964
|
"input",
|
|
4870
4965
|
{
|
|
4871
4966
|
type: "number",
|
|
@@ -4879,10 +4974,10 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
4879
4974
|
}
|
|
4880
4975
|
)
|
|
4881
4976
|
] }),
|
|
4882
|
-
/* @__PURE__ */ (0,
|
|
4977
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button2, "aria-label": `Remove step ${step.index + 1}`, disabled: recipe.steps.length === 1, onClick: () => run(controller.removeSelectionStep(step.index)), children: "\xD7" })
|
|
4883
4978
|
] }, `${step.index}:${JSON.stringify(step)}`);
|
|
4884
4979
|
}) }),
|
|
4885
|
-
error && /* @__PURE__ */ (0,
|
|
4980
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4886
4981
|
] });
|
|
4887
4982
|
};
|
|
4888
4983
|
|
|
@@ -4890,30 +4985,30 @@ var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
|
4890
4985
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4891
4986
|
|
|
4892
4987
|
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
4893
|
-
var
|
|
4988
|
+
var import_react30 = require("react");
|
|
4894
4989
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4895
|
-
var
|
|
4990
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4896
4991
|
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";
|
|
4897
4992
|
var toggle = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
4898
4993
|
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
4899
|
-
const session = (0,
|
|
4900
|
-
const [, setRevision] = (0,
|
|
4901
|
-
const [zoom, setZoom] = (0,
|
|
4902
|
-
const [pan, setPan] = (0,
|
|
4903
|
-
const [busy, setBusy] = (0,
|
|
4904
|
-
const [error, setError] = (0,
|
|
4905
|
-
const canvasRef = (0,
|
|
4906
|
-
const panFrom = (0,
|
|
4994
|
+
const session = (0, import_react30.useMemo)(() => new import_image_editor14.SelectAndMaskSession(controller), [controller]);
|
|
4995
|
+
const [, setRevision] = (0, import_react30.useState)(0);
|
|
4996
|
+
const [zoom, setZoom] = (0, import_react30.useState)(1);
|
|
4997
|
+
const [pan, setPan] = (0, import_react30.useState)({ x: 0, y: 0 });
|
|
4998
|
+
const [busy, setBusy] = (0, import_react30.useState)(false);
|
|
4999
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5000
|
+
const canvasRef = (0, import_react30.useRef)(null);
|
|
5001
|
+
const panFrom = (0, import_react30.useRef)(null);
|
|
4907
5002
|
const settings = session.settings;
|
|
4908
5003
|
const size = session.previewSize;
|
|
4909
|
-
(0,
|
|
5004
|
+
(0, import_react30.useEffect)(() => {
|
|
4910
5005
|
const off = session.subscribe(() => setRevision(session.revision));
|
|
4911
5006
|
void session.open();
|
|
4912
5007
|
return () => {
|
|
4913
5008
|
off();
|
|
4914
5009
|
};
|
|
4915
5010
|
}, [session]);
|
|
4916
|
-
(0,
|
|
5011
|
+
(0, import_react30.useEffect)(() => {
|
|
4917
5012
|
const canvas = canvasRef.current;
|
|
4918
5013
|
const ctx = canvas?.getContext?.("2d");
|
|
4919
5014
|
if (!canvas || !ctx || !size.width || typeof ImageData === "undefined") return;
|
|
@@ -4932,7 +5027,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4932
5027
|
setBusy(false);
|
|
4933
5028
|
}
|
|
4934
5029
|
};
|
|
4935
|
-
(0,
|
|
5030
|
+
(0, import_react30.useEffect)(() => {
|
|
4936
5031
|
const onKey = (e) => {
|
|
4937
5032
|
const t = e.target;
|
|
4938
5033
|
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
@@ -4977,7 +5072,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4977
5072
|
};
|
|
4978
5073
|
const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
|
|
4979
5074
|
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
4980
|
-
return /* @__PURE__ */ (0,
|
|
5075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4981
5076
|
"div",
|
|
4982
5077
|
{
|
|
4983
5078
|
"data-testid": "select-and-mask-workspace",
|
|
@@ -4985,12 +5080,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4985
5080
|
"aria-label": "Select and Mask",
|
|
4986
5081
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
4987
5082
|
children: [
|
|
4988
|
-
/* @__PURE__ */ (0,
|
|
4989
|
-
/* @__PURE__ */ (0,
|
|
4990
|
-
/* @__PURE__ */ (0,
|
|
4991
|
-
brushTool && /* @__PURE__ */ (0,
|
|
5083
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: import_image_editor14.SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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)) }),
|
|
5084
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
5086
|
+
brushTool && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4992
5087
|
"Size",
|
|
4993
|
-
/* @__PURE__ */ (0,
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4994
5089
|
"input",
|
|
4995
5090
|
{
|
|
4996
5091
|
type: "number",
|
|
@@ -5003,22 +5098,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5003
5098
|
),
|
|
5004
5099
|
"px"
|
|
5005
5100
|
] }),
|
|
5006
|
-
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5101
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
5102
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
5103
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
5009
5104
|
] }),
|
|
5010
|
-
/* @__PURE__ */ (0,
|
|
5105
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5011
5106
|
session.edits.length,
|
|
5012
5107
|
" strokes"
|
|
5013
5108
|
] }),
|
|
5014
|
-
/* @__PURE__ */ (0,
|
|
5015
|
-
/* @__PURE__ */ (0,
|
|
5109
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button3, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
|
|
5016
5111
|
Math.round(zoom * 100),
|
|
5017
5112
|
"%"
|
|
5018
5113
|
] }),
|
|
5019
|
-
session.computing && /* @__PURE__ */ (0,
|
|
5114
|
+
session.computing && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
5020
5115
|
] }),
|
|
5021
|
-
/* @__PURE__ */ (0,
|
|
5116
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5022
5117
|
"canvas",
|
|
5023
5118
|
{
|
|
5024
5119
|
ref: canvasRef,
|
|
@@ -5037,11 +5132,11 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5037
5132
|
}
|
|
5038
5133
|
) })
|
|
5039
5134
|
] }),
|
|
5040
|
-
/* @__PURE__ */ (0,
|
|
5041
|
-
/* @__PURE__ */ (0,
|
|
5042
|
-
/* @__PURE__ */ (0,
|
|
5135
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5043
5138
|
"View",
|
|
5044
|
-
/* @__PURE__ */ (0,
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5045
5140
|
ImageSelect,
|
|
5046
5141
|
{
|
|
5047
5142
|
label: "View",
|
|
@@ -5051,36 +5146,36 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5051
5146
|
}
|
|
5052
5147
|
)
|
|
5053
5148
|
] }),
|
|
5054
|
-
/* @__PURE__ */ (0,
|
|
5055
|
-
/* @__PURE__ */ (0,
|
|
5056
|
-
/* @__PURE__ */ (0,
|
|
5057
|
-
/* @__PURE__ */ (0,
|
|
5149
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5150
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Opacity" }),
|
|
5152
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5058
5153
|
Math.round(settings.opacity * 100),
|
|
5059
5154
|
"%"
|
|
5060
5155
|
] })
|
|
5061
5156
|
] }),
|
|
5062
|
-
/* @__PURE__ */ (0,
|
|
5157
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
5063
5158
|
] }),
|
|
5064
|
-
/* @__PURE__ */ (0,
|
|
5065
|
-
/* @__PURE__ */ (0,
|
|
5159
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
5066
5161
|
"Show Edge (J)"
|
|
5067
5162
|
] }),
|
|
5068
|
-
/* @__PURE__ */ (0,
|
|
5069
|
-
/* @__PURE__ */ (0,
|
|
5163
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5164
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
5070
5165
|
"Show Original (P)"
|
|
5071
5166
|
] }),
|
|
5072
|
-
/* @__PURE__ */ (0,
|
|
5073
|
-
/* @__PURE__ */ (0,
|
|
5167
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5168
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
5074
5169
|
"Real-Time Refinement"
|
|
5075
5170
|
] }),
|
|
5076
|
-
/* @__PURE__ */ (0,
|
|
5077
|
-
/* @__PURE__ */ (0,
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
5078
5173
|
"High Quality Preview"
|
|
5079
5174
|
] }),
|
|
5080
|
-
/* @__PURE__ */ (0,
|
|
5081
|
-
controller.segmentationProvider && /* @__PURE__ */ (0,
|
|
5175
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
5176
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5082
5177
|
"Mode",
|
|
5083
|
-
/* @__PURE__ */ (0,
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5084
5179
|
ImageSelect,
|
|
5085
5180
|
{
|
|
5086
5181
|
label: "Refine mode",
|
|
@@ -5093,37 +5188,37 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5093
5188
|
}
|
|
5094
5189
|
)
|
|
5095
5190
|
] }),
|
|
5096
|
-
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
5097
|
-
/* @__PURE__ */ (0,
|
|
5098
|
-
/* @__PURE__ */ (0,
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5191
|
+
import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5192
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: c.label }),
|
|
5194
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5100
5195
|
settings.params[c.id],
|
|
5101
5196
|
c.unit
|
|
5102
5197
|
] })
|
|
5103
5198
|
] }),
|
|
5104
|
-
/* @__PURE__ */ (0,
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(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 } }) })
|
|
5105
5200
|
] }, c.id)),
|
|
5106
|
-
/* @__PURE__ */ (0,
|
|
5107
|
-
/* @__PURE__ */ (0,
|
|
5201
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5202
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
5108
5203
|
"Smart Radius"
|
|
5109
5204
|
] }),
|
|
5110
|
-
/* @__PURE__ */ (0,
|
|
5111
|
-
/* @__PURE__ */ (0,
|
|
5112
|
-
/* @__PURE__ */ (0,
|
|
5113
|
-
/* @__PURE__ */ (0,
|
|
5205
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
5206
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5207
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
5114
5209
|
"Decontaminate Colors",
|
|
5115
5210
|
toLayer ? "" : " (new layer or document outputs)"
|
|
5116
5211
|
] }),
|
|
5117
|
-
/* @__PURE__ */ (0,
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5118
5213
|
settings.decontaminate,
|
|
5119
5214
|
"%"
|
|
5120
5215
|
] })
|
|
5121
5216
|
] }),
|
|
5122
|
-
/* @__PURE__ */ (0,
|
|
5217
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
5123
5218
|
] }),
|
|
5124
|
-
/* @__PURE__ */ (0,
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5125
5220
|
"Output To",
|
|
5126
|
-
/* @__PURE__ */ (0,
|
|
5221
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5127
5222
|
ImageSelect,
|
|
5128
5223
|
{
|
|
5129
5224
|
label: "Output to",
|
|
@@ -5133,16 +5228,16 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5133
5228
|
}
|
|
5134
5229
|
)
|
|
5135
5230
|
] }),
|
|
5136
|
-
/* @__PURE__ */ (0,
|
|
5137
|
-
/* @__PURE__ */ (0,
|
|
5231
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
5138
5233
|
"Remember Settings"
|
|
5139
5234
|
] }),
|
|
5140
|
-
(error ?? session.error) && /* @__PURE__ */ (0,
|
|
5141
|
-
session.note && /* @__PURE__ */ (0,
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5143
|
-
/* @__PURE__ */ (0,
|
|
5144
|
-
/* @__PURE__ */ (0,
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5235
|
+
(error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
5236
|
+
session.note && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-muted-foreground", children: session.note }),
|
|
5237
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
|
|
5238
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
|
|
5240
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
5146
5241
|
] })
|
|
5147
5242
|
] })
|
|
5148
5243
|
]
|
|
@@ -5151,31 +5246,31 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5151
5246
|
};
|
|
5152
5247
|
|
|
5153
5248
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
5154
|
-
var
|
|
5249
|
+
var import_react31 = require("react");
|
|
5155
5250
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
5156
|
-
var
|
|
5251
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5157
5252
|
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";
|
|
5158
5253
|
var toggle2 = (on) => `${button4} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
5159
5254
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
5160
|
-
const session = (0,
|
|
5161
|
-
const [, setRevision] = (0,
|
|
5162
|
-
const [zoom, setZoom] = (0,
|
|
5163
|
-
const [pan, setPan] = (0,
|
|
5164
|
-
const [busy, setBusy] = (0,
|
|
5165
|
-
const [error, setError] = (0,
|
|
5166
|
-
const sourceRef = (0,
|
|
5167
|
-
const previewRef = (0,
|
|
5168
|
-
const panFrom = (0,
|
|
5255
|
+
const session = (0, import_react31.useMemo)(() => new import_image_editor15.ContentAwareFillSession(controller), [controller]);
|
|
5256
|
+
const [, setRevision] = (0, import_react31.useState)(0);
|
|
5257
|
+
const [zoom, setZoom] = (0, import_react31.useState)(1);
|
|
5258
|
+
const [pan, setPan] = (0, import_react31.useState)({ x: 0, y: 0 });
|
|
5259
|
+
const [busy, setBusy] = (0, import_react31.useState)(false);
|
|
5260
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
5261
|
+
const sourceRef = (0, import_react31.useRef)(null);
|
|
5262
|
+
const previewRef = (0, import_react31.useRef)(null);
|
|
5263
|
+
const panFrom = (0, import_react31.useRef)(null);
|
|
5169
5264
|
const settings = session.settings;
|
|
5170
5265
|
const win = session.window;
|
|
5171
|
-
(0,
|
|
5266
|
+
(0, import_react31.useEffect)(() => {
|
|
5172
5267
|
const off = session.subscribe(() => setRevision(session.revision));
|
|
5173
5268
|
void session.open();
|
|
5174
5269
|
return () => {
|
|
5175
5270
|
off();
|
|
5176
5271
|
};
|
|
5177
5272
|
}, [session]);
|
|
5178
|
-
(0,
|
|
5273
|
+
(0, import_react31.useEffect)(() => {
|
|
5179
5274
|
if (!win || typeof ImageData === "undefined") return;
|
|
5180
5275
|
for (const [canvas, rgba] of [
|
|
5181
5276
|
[sourceRef.current, session.renderSource()],
|
|
@@ -5199,7 +5294,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5199
5294
|
setBusy(false);
|
|
5200
5295
|
}
|
|
5201
5296
|
};
|
|
5202
|
-
(0,
|
|
5297
|
+
(0, import_react31.useEffect)(() => {
|
|
5203
5298
|
const onKey = (e) => {
|
|
5204
5299
|
const t = e.target;
|
|
5205
5300
|
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
@@ -5241,14 +5336,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5241
5336
|
session.end();
|
|
5242
5337
|
};
|
|
5243
5338
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
5244
|
-
return /* @__PURE__ */ (0,
|
|
5245
|
-
/* @__PURE__ */ (0,
|
|
5246
|
-
/* @__PURE__ */ (0,
|
|
5247
|
-
/* @__PURE__ */ (0,
|
|
5248
|
-
settings.tool === "sampling-brush" && /* @__PURE__ */ (0,
|
|
5249
|
-
/* @__PURE__ */ (0,
|
|
5339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("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: [
|
|
5340
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: import_image_editor15.CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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)) }),
|
|
5341
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
5342
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
5343
|
+
settings.tool === "sampling-brush" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5344
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5250
5345
|
"Size",
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5346
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5252
5347
|
"input",
|
|
5253
5348
|
{
|
|
5254
5349
|
type: "number",
|
|
@@ -5261,22 +5356,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5261
5356
|
),
|
|
5262
5357
|
"px"
|
|
5263
5358
|
] }),
|
|
5264
|
-
/* @__PURE__ */ (0,
|
|
5265
|
-
/* @__PURE__ */ (0,
|
|
5266
|
-
/* @__PURE__ */ (0,
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
5267
5362
|
] })
|
|
5268
5363
|
] }),
|
|
5269
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
|
|
5270
5365
|
Math.round(zoom * 100),
|
|
5271
5366
|
"%"
|
|
5272
5367
|
] }),
|
|
5273
|
-
!session.showsWholeImage && /* @__PURE__ */ (0,
|
|
5274
|
-
session.computing && /* @__PURE__ */ (0,
|
|
5368
|
+
!session.showsWholeImage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button4, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
|
|
5369
|
+
session.computing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
5275
5370
|
] }),
|
|
5276
|
-
/* @__PURE__ */ (0,
|
|
5277
|
-
/* @__PURE__ */ (0,
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
5371
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col min-h-0", children: [
|
|
5373
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
|
|
5374
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5280
5375
|
"canvas",
|
|
5281
5376
|
{
|
|
5282
5377
|
ref: sourceRef,
|
|
@@ -5288,33 +5383,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5288
5383
|
}
|
|
5289
5384
|
) })
|
|
5290
5385
|
] }),
|
|
5291
|
-
/* @__PURE__ */ (0,
|
|
5292
|
-
/* @__PURE__ */ (0,
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col min-h-0", children: [
|
|
5387
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "Preview" }),
|
|
5388
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
|
|
5294
5389
|
] })
|
|
5295
5390
|
] })
|
|
5296
5391
|
] }),
|
|
5297
|
-
/* @__PURE__ */ (0,
|
|
5298
|
-
/* @__PURE__ */ (0,
|
|
5299
|
-
/* @__PURE__ */ (0,
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5392
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
5393
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
5394
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: import_image_editor15.CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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)) }),
|
|
5395
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5396
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
5302
5397
|
"Show Sampling Area"
|
|
5303
5398
|
] }),
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5305
|
-
/* @__PURE__ */ (0,
|
|
5306
|
-
/* @__PURE__ */ (0,
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5399
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5400
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5401
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Opacity" }),
|
|
5402
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5308
5403
|
Math.round(settings.opacity * 100),
|
|
5309
5404
|
"%"
|
|
5310
5405
|
] })
|
|
5311
5406
|
] }),
|
|
5312
|
-
/* @__PURE__ */ (0,
|
|
5407
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
5313
5408
|
] }),
|
|
5314
|
-
/* @__PURE__ */ (0,
|
|
5315
|
-
/* @__PURE__ */ (0,
|
|
5409
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
|
|
5410
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5316
5411
|
"Seed",
|
|
5317
|
-
/* @__PURE__ */ (0,
|
|
5412
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5318
5413
|
"input",
|
|
5319
5414
|
{
|
|
5320
5415
|
type: "number",
|
|
@@ -5325,17 +5420,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5325
5420
|
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
5326
5421
|
}
|
|
5327
5422
|
),
|
|
5328
|
-
/* @__PURE__ */ (0,
|
|
5423
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button4, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
|
|
5329
5424
|
] }),
|
|
5330
|
-
/* @__PURE__ */ (0,
|
|
5331
|
-
/* @__PURE__ */ (0,
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5426
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
|
|
5332
5427
|
"Live Preview"
|
|
5333
5428
|
] }),
|
|
5334
|
-
!settings.livePreview && /* @__PURE__ */ (0,
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5336
|
-
/* @__PURE__ */ (0,
|
|
5429
|
+
!settings.livePreview && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button4, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
|
|
5430
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
5431
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5337
5432
|
"Output To",
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5339
5434
|
ImageSelect,
|
|
5340
5435
|
{
|
|
5341
5436
|
label: "Fill output",
|
|
@@ -5349,18 +5444,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5349
5444
|
}
|
|
5350
5445
|
)
|
|
5351
5446
|
] }),
|
|
5352
|
-
(error ?? session.error) && /* @__PURE__ */ (0,
|
|
5353
|
-
/* @__PURE__ */ (0,
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5356
|
-
/* @__PURE__ */ (0,
|
|
5447
|
+
(error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
5448
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button4, onClick: () => session.reset(), children: "Reset" }),
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button4, onClick: () => onClose(null), children: "Cancel" }),
|
|
5451
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
5357
5452
|
] })
|
|
5358
5453
|
] })
|
|
5359
5454
|
] });
|
|
5360
5455
|
};
|
|
5361
5456
|
|
|
5362
5457
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
5363
|
-
var
|
|
5458
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5364
5459
|
var MODIFY_OPS = [
|
|
5365
5460
|
{ op: "expand", label: "Expand" },
|
|
5366
5461
|
{ op: "contract", label: "Contract" },
|
|
@@ -5385,15 +5480,15 @@ var SelectionOptionsBar = ({
|
|
|
5385
5480
|
showTools = true,
|
|
5386
5481
|
className = ""
|
|
5387
5482
|
}) => {
|
|
5388
|
-
const [radius, setRadius] = (0,
|
|
5483
|
+
const [radius, setRadius] = (0, import_react32.useState)(2);
|
|
5389
5484
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
5390
5485
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5391
5486
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
5392
|
-
const [preset, setPreset] = (0,
|
|
5393
|
-
const [rangeStatus, setRangeStatus] = (0,
|
|
5394
|
-
const [colorStatus, setColorStatus] = (0,
|
|
5395
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5396
|
-
const [strokeLocation, setStrokeLocation] = (0,
|
|
5487
|
+
const [preset, setPreset] = (0, import_react32.useState)("reds");
|
|
5488
|
+
const [rangeStatus, setRangeStatus] = (0, import_react32.useState)(null);
|
|
5489
|
+
const [colorStatus, setColorStatus] = (0, import_react32.useState)(null);
|
|
5490
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react32.useState)(4);
|
|
5491
|
+
const [strokeLocation, setStrokeLocation] = (0, import_react32.useState)("outside");
|
|
5397
5492
|
const edit = (fn) => {
|
|
5398
5493
|
setColorStatus(null);
|
|
5399
5494
|
try {
|
|
@@ -5426,8 +5521,8 @@ var SelectionOptionsBar = ({
|
|
|
5426
5521
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
5427
5522
|
}
|
|
5428
5523
|
};
|
|
5429
|
-
const [task, setTask] = (0,
|
|
5430
|
-
const taskAbort = (0,
|
|
5524
|
+
const [task, setTask] = (0, import_react32.useState)(null);
|
|
5525
|
+
const taskAbort = (0, import_react32.useRef)(null);
|
|
5431
5526
|
const tracked = () => {
|
|
5432
5527
|
const abort = new AbortController();
|
|
5433
5528
|
taskAbort.current = abort;
|
|
@@ -5439,9 +5534,9 @@ var SelectionOptionsBar = ({
|
|
|
5439
5534
|
setTask(null);
|
|
5440
5535
|
};
|
|
5441
5536
|
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
5442
|
-
const [subject, setSubject] = (0,
|
|
5443
|
-
const [segmenting, setSegmenting] = (0,
|
|
5444
|
-
const [subjectStatus, setSubjectStatus] = (0,
|
|
5537
|
+
const [subject, setSubject] = (0, import_react32.useState)("");
|
|
5538
|
+
const [segmenting, setSegmenting] = (0, import_react32.useState)(false);
|
|
5539
|
+
const [subjectStatus, setSubjectStatus] = (0, import_react32.useState)(null);
|
|
5445
5540
|
const selectSubject = async () => {
|
|
5446
5541
|
const target = subject.trim();
|
|
5447
5542
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -5458,10 +5553,10 @@ var SelectionOptionsBar = ({
|
|
|
5458
5553
|
setSegmenting(false);
|
|
5459
5554
|
}
|
|
5460
5555
|
};
|
|
5461
|
-
const [workspace, setWorkspace] = (0,
|
|
5462
|
-
const [fillWorkspace, setFillWorkspace] = (0,
|
|
5463
|
-
const [skying, setSkying] = (0,
|
|
5464
|
-
const [skyStatus, setSkyStatus] = (0,
|
|
5556
|
+
const [workspace, setWorkspace] = (0, import_react32.useState)(false);
|
|
5557
|
+
const [fillWorkspace, setFillWorkspace] = (0, import_react32.useState)(false);
|
|
5558
|
+
const [skying, setSkying] = (0, import_react32.useState)(false);
|
|
5559
|
+
const [skyStatus, setSkyStatus] = (0, import_react32.useState)(null);
|
|
5465
5560
|
const selectSky = async () => {
|
|
5466
5561
|
if (skying) return;
|
|
5467
5562
|
setSkying(true);
|
|
@@ -5476,8 +5571,8 @@ var SelectionOptionsBar = ({
|
|
|
5476
5571
|
setSkying(false);
|
|
5477
5572
|
}
|
|
5478
5573
|
};
|
|
5479
|
-
const [focusing, setFocusing] = (0,
|
|
5480
|
-
const [focusStatus, setFocusStatus] = (0,
|
|
5574
|
+
const [focusing, setFocusing] = (0, import_react32.useState)(false);
|
|
5575
|
+
const [focusStatus, setFocusStatus] = (0, import_react32.useState)(null);
|
|
5481
5576
|
const selectFocusArea = async () => {
|
|
5482
5577
|
if (focusing) return;
|
|
5483
5578
|
setFocusing(true);
|
|
@@ -5498,24 +5593,24 @@ var SelectionOptionsBar = ({
|
|
|
5498
5593
|
setFocusing(false);
|
|
5499
5594
|
}
|
|
5500
5595
|
};
|
|
5501
|
-
return /* @__PURE__ */ (0,
|
|
5502
|
-
showTools && /* @__PURE__ */ (0,
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5504
|
-
options.tool === "wand" && /* @__PURE__ */ (0,
|
|
5505
|
-
/* @__PURE__ */ (0,
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5507
|
-
/* @__PURE__ */ (0,
|
|
5508
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5597
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor16.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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)) }),
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor16.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor16.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
5599
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5600
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5602
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Tolerance" }),
|
|
5603
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
5509
5604
|
] }),
|
|
5510
|
-
/* @__PURE__ */ (0,
|
|
5605
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
5511
5606
|
] }),
|
|
5512
|
-
/* @__PURE__ */ (0,
|
|
5513
|
-
/* @__PURE__ */ (0,
|
|
5607
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
5514
5609
|
"Contiguous"
|
|
5515
5610
|
] }),
|
|
5516
|
-
/* @__PURE__ */ (0,
|
|
5611
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5517
5612
|
"Distance",
|
|
5518
|
-
/* @__PURE__ */ (0,
|
|
5613
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5519
5614
|
ImageSelect,
|
|
5520
5615
|
{
|
|
5521
5616
|
label: "Colour distance",
|
|
@@ -5528,13 +5623,13 @@ var SelectionOptionsBar = ({
|
|
|
5528
5623
|
}
|
|
5529
5624
|
)
|
|
5530
5625
|
] }),
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5626
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5627
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
5533
5628
|
"Sample adjusted image"
|
|
5534
5629
|
] }),
|
|
5535
|
-
/* @__PURE__ */ (0,
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5536
5631
|
"Sample",
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5538
5633
|
ImageSelect,
|
|
5539
5634
|
{
|
|
5540
5635
|
label: "Sample from",
|
|
@@ -5548,77 +5643,77 @@ var SelectionOptionsBar = ({
|
|
|
5548
5643
|
)
|
|
5549
5644
|
] })
|
|
5550
5645
|
] }),
|
|
5551
|
-
options.tool === "polygon" && /* @__PURE__ */ (0,
|
|
5552
|
-
options.tool === "magnetic" && /* @__PURE__ */ (0,
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5554
|
-
/* @__PURE__ */ (0,
|
|
5555
|
-
/* @__PURE__ */ (0,
|
|
5556
|
-
/* @__PURE__ */ (0,
|
|
5557
|
-
/* @__PURE__ */ (0,
|
|
5646
|
+
options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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." }),
|
|
5647
|
+
options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
5648
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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." }),
|
|
5649
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Width" }),
|
|
5652
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5558
5653
|
options.magneticWidth ?? 10,
|
|
5559
5654
|
" px"
|
|
5560
5655
|
] })
|
|
5561
5656
|
] }),
|
|
5562
|
-
/* @__PURE__ */ (0,
|
|
5657
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
5563
5658
|
] }),
|
|
5564
|
-
/* @__PURE__ */ (0,
|
|
5565
|
-
/* @__PURE__ */ (0,
|
|
5566
|
-
/* @__PURE__ */ (0,
|
|
5567
|
-
/* @__PURE__ */ (0,
|
|
5659
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5660
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5661
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Contrast" }),
|
|
5662
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5568
5663
|
options.magneticContrast ?? 10,
|
|
5569
5664
|
"%"
|
|
5570
5665
|
] })
|
|
5571
5666
|
] }),
|
|
5572
|
-
/* @__PURE__ */ (0,
|
|
5667
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
5573
5668
|
] }),
|
|
5574
|
-
/* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5669
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5670
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5671
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Frequency" }),
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
5578
5673
|
] }),
|
|
5579
|
-
/* @__PURE__ */ (0,
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
5580
5675
|
] })
|
|
5581
5676
|
] }),
|
|
5582
|
-
options.tool === "quick" && /* @__PURE__ */ (0,
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5584
|
-
/* @__PURE__ */ (0,
|
|
5585
|
-
/* @__PURE__ */ (0,
|
|
5586
|
-
/* @__PURE__ */ (0,
|
|
5587
|
-
/* @__PURE__ */ (0,
|
|
5677
|
+
options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
5678
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5680
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5681
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Size" }),
|
|
5682
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5588
5683
|
options.quickSize ?? 30,
|
|
5589
5684
|
" px"
|
|
5590
5685
|
] })
|
|
5591
5686
|
] }),
|
|
5592
|
-
/* @__PURE__ */ (0,
|
|
5687
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
5593
5688
|
] }),
|
|
5594
|
-
/* @__PURE__ */ (0,
|
|
5595
|
-
/* @__PURE__ */ (0,
|
|
5689
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5690
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
5596
5691
|
"Sample all layers"
|
|
5597
5692
|
] }),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5693
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5694
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
5600
5695
|
"Auto-enhance edges"
|
|
5601
5696
|
] })
|
|
5602
5697
|
] }),
|
|
5603
|
-
options.tool === "object" && /* @__PURE__ */ (0,
|
|
5604
|
-
/* @__PURE__ */ (0,
|
|
5605
|
-
/* @__PURE__ */ (0,
|
|
5606
|
-
/* @__PURE__ */ (0,
|
|
5698
|
+
options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
5699
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
5700
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5701
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
5607
5702
|
"Sample all layers"
|
|
5608
5703
|
] }),
|
|
5609
|
-
/* @__PURE__ */ (0,
|
|
5610
|
-
/* @__PURE__ */ (0,
|
|
5704
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5705
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
5611
5706
|
"Auto-enhance edges"
|
|
5612
5707
|
] })
|
|
5613
5708
|
] }),
|
|
5614
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0,
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5709
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
5710
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
5616
5711
|
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).",
|
|
5617
5712
|
" Shift-click adds, Alt-click subtracts."
|
|
5618
5713
|
] }),
|
|
5619
|
-
/* @__PURE__ */ (0,
|
|
5714
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5620
5715
|
"Text",
|
|
5621
|
-
/* @__PURE__ */ (0,
|
|
5716
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5622
5717
|
"input",
|
|
5623
5718
|
{
|
|
5624
5719
|
type: "text",
|
|
@@ -5629,9 +5724,9 @@ var SelectionOptionsBar = ({
|
|
|
5629
5724
|
}
|
|
5630
5725
|
)
|
|
5631
5726
|
] }),
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
5727
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5633
5728
|
"Size",
|
|
5634
|
-
/* @__PURE__ */ (0,
|
|
5729
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5635
5730
|
"input",
|
|
5636
5731
|
{
|
|
5637
5732
|
type: "number",
|
|
@@ -5645,9 +5740,9 @@ var SelectionOptionsBar = ({
|
|
|
5645
5740
|
),
|
|
5646
5741
|
"px"
|
|
5647
5742
|
] }),
|
|
5648
|
-
/* @__PURE__ */ (0,
|
|
5743
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5649
5744
|
"Font",
|
|
5650
|
-
/* @__PURE__ */ (0,
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5651
5746
|
"input",
|
|
5652
5747
|
{
|
|
5653
5748
|
type: "text",
|
|
@@ -5659,18 +5754,18 @@ var SelectionOptionsBar = ({
|
|
|
5659
5754
|
)
|
|
5660
5755
|
] })
|
|
5661
5756
|
] }),
|
|
5662
|
-
options.tool === "range" && /* @__PURE__ */ (0,
|
|
5663
|
-
/* @__PURE__ */ (0,
|
|
5664
|
-
/* @__PURE__ */ (0,
|
|
5665
|
-
/* @__PURE__ */ (0,
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
5667
|
-
/* @__PURE__ */ (0,
|
|
5757
|
+
options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
5759
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Fuzziness" }),
|
|
5762
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
5668
5763
|
] }),
|
|
5669
|
-
/* @__PURE__ */ (0,
|
|
5764
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
5670
5765
|
] }),
|
|
5671
|
-
/* @__PURE__ */ (0,
|
|
5766
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5672
5767
|
"Localized radius",
|
|
5673
|
-
/* @__PURE__ */ (0,
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5674
5769
|
"input",
|
|
5675
5770
|
{
|
|
5676
5771
|
type: "number",
|
|
@@ -5684,12 +5779,12 @@ var SelectionOptionsBar = ({
|
|
|
5684
5779
|
),
|
|
5685
5780
|
"px"
|
|
5686
5781
|
] }),
|
|
5687
|
-
/* @__PURE__ */ (0,
|
|
5688
|
-
/* @__PURE__ */ (0,
|
|
5782
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5783
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
5689
5784
|
"Invert"
|
|
5690
5785
|
] }),
|
|
5691
|
-
/* @__PURE__ */ (0,
|
|
5692
|
-
/* @__PURE__ */ (0,
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5693
5788
|
ImageSelect,
|
|
5694
5789
|
{
|
|
5695
5790
|
label: "Color Range preset",
|
|
@@ -5698,13 +5793,13 @@ var SelectionOptionsBar = ({
|
|
|
5698
5793
|
onChange: (v) => setPreset(v)
|
|
5699
5794
|
}
|
|
5700
5795
|
),
|
|
5701
|
-
/* @__PURE__ */ (0,
|
|
5796
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
5702
5797
|
] }),
|
|
5703
|
-
rangeStatus && /* @__PURE__ */ (0,
|
|
5798
|
+
rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
5704
5799
|
] }),
|
|
5705
|
-
/* @__PURE__ */ (0,
|
|
5800
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5706
5801
|
"Feather",
|
|
5707
|
-
/* @__PURE__ */ (0,
|
|
5802
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5708
5803
|
"input",
|
|
5709
5804
|
{
|
|
5710
5805
|
type: "number",
|
|
@@ -5719,7 +5814,7 @@ var SelectionOptionsBar = ({
|
|
|
5719
5814
|
),
|
|
5720
5815
|
"px"
|
|
5721
5816
|
] }),
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5817
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5723
5818
|
"form",
|
|
5724
5819
|
{
|
|
5725
5820
|
"data-testid": "select-subject",
|
|
@@ -5729,8 +5824,8 @@ var SelectionOptionsBar = ({
|
|
|
5729
5824
|
void selectSubject();
|
|
5730
5825
|
},
|
|
5731
5826
|
children: [
|
|
5732
|
-
/* @__PURE__ */ (0,
|
|
5733
|
-
controller.segmentationProvider && /* @__PURE__ */ (0,
|
|
5827
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
5828
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5734
5829
|
"input",
|
|
5735
5830
|
{
|
|
5736
5831
|
type: "text",
|
|
@@ -5742,7 +5837,7 @@ var SelectionOptionsBar = ({
|
|
|
5742
5837
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
5743
5838
|
}
|
|
5744
5839
|
),
|
|
5745
|
-
/* @__PURE__ */ (0,
|
|
5840
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5746
5841
|
"button",
|
|
5747
5842
|
{
|
|
5748
5843
|
type: "submit",
|
|
@@ -5754,12 +5849,12 @@ var SelectionOptionsBar = ({
|
|
|
5754
5849
|
}
|
|
5755
5850
|
)
|
|
5756
5851
|
] }),
|
|
5757
|
-
subjectStatus && /* @__PURE__ */ (0,
|
|
5852
|
+
subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
5758
5853
|
]
|
|
5759
5854
|
}
|
|
5760
5855
|
),
|
|
5761
|
-
task && /* @__PURE__ */ (0,
|
|
5762
|
-
/* @__PURE__ */ (0,
|
|
5856
|
+
task && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5763
5858
|
"div",
|
|
5764
5859
|
{
|
|
5765
5860
|
role: "progressbar",
|
|
@@ -5768,69 +5863,69 @@ var SelectionOptionsBar = ({
|
|
|
5768
5863
|
"aria-valuemax": 100,
|
|
5769
5864
|
"aria-valuenow": Math.round(task.fraction * 100),
|
|
5770
5865
|
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
5771
|
-
children: /* @__PURE__ */ (0,
|
|
5866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
5772
5867
|
}
|
|
5773
5868
|
),
|
|
5774
|
-
/* @__PURE__ */ (0,
|
|
5775
|
-
/* @__PURE__ */ (0,
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: task.stage }),
|
|
5870
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
5776
5871
|
] }),
|
|
5777
|
-
/* @__PURE__ */ (0,
|
|
5778
|
-
workspace && /* @__PURE__ */ (0,
|
|
5779
|
-
/* @__PURE__ */ (0,
|
|
5780
|
-
/* @__PURE__ */ (0,
|
|
5781
|
-
skyStatus && /* @__PURE__ */ (0,
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
5873
|
+
workspace && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
5875
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
5876
|
+
skyStatus && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
5782
5877
|
] }),
|
|
5783
|
-
/* @__PURE__ */ (0,
|
|
5784
|
-
/* @__PURE__ */ (0,
|
|
5785
|
-
/* @__PURE__ */ (0,
|
|
5786
|
-
/* @__PURE__ */ (0,
|
|
5787
|
-
/* @__PURE__ */ (0,
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
5878
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
5880
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
5881
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5882
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "In-focus range" }),
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
5790
5885
|
] }),
|
|
5791
|
-
/* @__PURE__ */ (0,
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
5792
5887
|
] }),
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
5795
|
-
/* @__PURE__ */ (0,
|
|
5796
|
-
/* @__PURE__ */ (0,
|
|
5888
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5889
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5890
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Image noise level" }),
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
5797
5892
|
] }),
|
|
5798
|
-
/* @__PURE__ */ (0,
|
|
5893
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
5799
5894
|
] }),
|
|
5800
|
-
/* @__PURE__ */ (0,
|
|
5801
|
-
/* @__PURE__ */ (0,
|
|
5802
|
-
/* @__PURE__ */ (0,
|
|
5803
|
-
/* @__PURE__ */ (0,
|
|
5895
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5896
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Soften edge" }),
|
|
5898
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5804
5899
|
options.focusSoftness ?? 4,
|
|
5805
5900
|
" px"
|
|
5806
5901
|
] })
|
|
5807
5902
|
] }),
|
|
5808
|
-
/* @__PURE__ */ (0,
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
5809
5904
|
] }),
|
|
5810
|
-
/* @__PURE__ */ (0,
|
|
5811
|
-
focusStatus && /* @__PURE__ */ (0,
|
|
5905
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
5906
|
+
focusStatus && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
5812
5907
|
] })
|
|
5813
5908
|
] }),
|
|
5814
|
-
/* @__PURE__ */ (0,
|
|
5815
|
-
/* @__PURE__ */ (0,
|
|
5909
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5910
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
5816
5911
|
"Anti-alias"
|
|
5817
5912
|
] }),
|
|
5818
|
-
/* @__PURE__ */ (0,
|
|
5819
|
-
/* @__PURE__ */ (0,
|
|
5820
|
-
/* @__PURE__ */ (0,
|
|
5821
|
-
/* @__PURE__ */ (0,
|
|
5822
|
-
/* @__PURE__ */ (0,
|
|
5823
|
-
/* @__PURE__ */ (0,
|
|
5824
|
-
/* @__PURE__ */ (0,
|
|
5913
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
5915
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
5916
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
5917
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
5919
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
5825
5920
|
] }),
|
|
5826
|
-
/* @__PURE__ */ (0,
|
|
5827
|
-
/* @__PURE__ */ (0,
|
|
5828
|
-
DISPLAYS.map((d) => /* @__PURE__ */ (0,
|
|
5921
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
|
|
5923
|
+
DISPLAYS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
5829
5924
|
] }),
|
|
5830
|
-
/* @__PURE__ */ (0,
|
|
5831
|
-
/* @__PURE__ */ (0,
|
|
5925
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5832
5927
|
"Radius",
|
|
5833
|
-
/* @__PURE__ */ (0,
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5834
5929
|
"input",
|
|
5835
5930
|
{
|
|
5836
5931
|
type: "number",
|
|
@@ -5844,12 +5939,12 @@ var SelectionOptionsBar = ({
|
|
|
5844
5939
|
}
|
|
5845
5940
|
)
|
|
5846
5941
|
] }),
|
|
5847
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
5942
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
5848
5943
|
] }),
|
|
5849
|
-
/* @__PURE__ */ (0,
|
|
5850
|
-
/* @__PURE__ */ (0,
|
|
5944
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5945
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5851
5946
|
"Stroke",
|
|
5852
|
-
/* @__PURE__ */ (0,
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5853
5948
|
"input",
|
|
5854
5949
|
{
|
|
5855
5950
|
type: "number",
|
|
@@ -5864,7 +5959,7 @@ var SelectionOptionsBar = ({
|
|
|
5864
5959
|
),
|
|
5865
5960
|
"px"
|
|
5866
5961
|
] }),
|
|
5867
|
-
/* @__PURE__ */ (0,
|
|
5962
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5868
5963
|
ImageSelect,
|
|
5869
5964
|
{
|
|
5870
5965
|
label: "Stroke location",
|
|
@@ -5877,40 +5972,40 @@ var SelectionOptionsBar = ({
|
|
|
5877
5972
|
onChange: (v) => setStrokeLocation(v)
|
|
5878
5973
|
}
|
|
5879
5974
|
),
|
|
5880
|
-
/* @__PURE__ */ (0,
|
|
5881
|
-
/* @__PURE__ */ (0,
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
5883
|
-
/* @__PURE__ */ (0,
|
|
5884
|
-
fillWorkspace && /* @__PURE__ */ (0,
|
|
5975
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
5976
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
5977
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
|
|
5978
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
|
|
5979
|
+
fillWorkspace && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
|
|
5885
5980
|
] }),
|
|
5886
|
-
/* @__PURE__ */ (0,
|
|
5887
|
-
/* @__PURE__ */ (0,
|
|
5888
|
-
/* @__PURE__ */ (0,
|
|
5889
|
-
/* @__PURE__ */ (0,
|
|
5890
|
-
/* @__PURE__ */ (0,
|
|
5891
|
-
/* @__PURE__ */ (0,
|
|
5892
|
-
/* @__PURE__ */ (0,
|
|
5893
|
-
/* @__PURE__ */ (0,
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
5982
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
5985
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
5986
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
5987
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
5988
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
5894
5989
|
] }),
|
|
5895
|
-
colorStatus && /* @__PURE__ */ (0,
|
|
5896
|
-
/* @__PURE__ */ (0,
|
|
5897
|
-
/* @__PURE__ */ (0,
|
|
5990
|
+
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
5991
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor16.describeSelection)(sel) }),
|
|
5992
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectionRecipePanel, { controller, selection: sel })
|
|
5898
5993
|
] });
|
|
5899
5994
|
};
|
|
5900
5995
|
|
|
5901
5996
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5902
|
-
var
|
|
5997
|
+
var import_react36 = require("react");
|
|
5903
5998
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5904
5999
|
|
|
5905
6000
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
5906
|
-
var
|
|
6001
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
5907
6002
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5908
|
-
var
|
|
6003
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5909
6004
|
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";
|
|
5910
6005
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
5911
6006
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5912
|
-
const [result, setResult] = (0,
|
|
5913
|
-
const [error, setError] = (0,
|
|
6007
|
+
const [result, setResult] = (0, import_react33.useState)(null);
|
|
6008
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
5914
6009
|
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
5915
6010
|
const check = () => {
|
|
5916
6011
|
setError(null);
|
|
@@ -5928,35 +6023,35 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
5928
6023
|
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
5929
6024
|
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
5930
6025
|
] : [];
|
|
5931
|
-
return /* @__PURE__ */ (0,
|
|
5932
|
-
/* @__PURE__ */ (0,
|
|
5933
|
-
report && /* @__PURE__ */ (0,
|
|
5934
|
-
/* @__PURE__ */ (0,
|
|
5935
|
-
rows.map((r) => /* @__PURE__ */ (0,
|
|
5936
|
-
/* @__PURE__ */ (0,
|
|
5937
|
-
/* @__PURE__ */ (0,
|
|
6026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: `${button5} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
6028
|
+
report && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
6030
|
+
rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react33.default.Fragment, { children: [
|
|
6031
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("dt", { className: "text-muted-foreground", children: r.label }),
|
|
6032
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
5938
6033
|
] }, r.label)),
|
|
5939
|
-
/* @__PURE__ */ (0,
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
6034
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
6035
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
5941
6036
|
report.holes.count,
|
|
5942
6037
|
" / ",
|
|
5943
6038
|
report.islands.count
|
|
5944
6039
|
] })
|
|
5945
6040
|
] }),
|
|
5946
|
-
report.issues.length ? /* @__PURE__ */ (0,
|
|
6041
|
+
report.issues.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { children: s }, s)) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
5947
6042
|
] }),
|
|
5948
|
-
error && /* @__PURE__ */ (0,
|
|
6043
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5949
6044
|
] });
|
|
5950
6045
|
};
|
|
5951
6046
|
|
|
5952
6047
|
// src/image-editor/SelectionChangeCheck.tsx
|
|
5953
|
-
var
|
|
5954
|
-
var
|
|
6048
|
+
var import_react34 = require("react");
|
|
6049
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5955
6050
|
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";
|
|
5956
6051
|
var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
5957
6052
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5958
|
-
const [result, setResult] = (0,
|
|
5959
|
-
const [error, setError] = (0,
|
|
6053
|
+
const [result, setResult] = (0, import_react34.useState)(null);
|
|
6054
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
5960
6055
|
const diff = result && result.for === sel ? result.diff : null;
|
|
5961
6056
|
const show = () => {
|
|
5962
6057
|
setError(null);
|
|
@@ -5967,16 +6062,16 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
5967
6062
|
setError(err instanceof Error ? err.message : String(err));
|
|
5968
6063
|
}
|
|
5969
6064
|
};
|
|
5970
|
-
return /* @__PURE__ */ (0,
|
|
5971
|
-
/* @__PURE__ */ (0,
|
|
5972
|
-
diff && /* @__PURE__ */ (0,
|
|
5973
|
-
/* @__PURE__ */ (0,
|
|
6065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: `${button6} self-start`, onClick: show, children: "Show Last Change" }),
|
|
6067
|
+
diff && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "text-green-600", children: [
|
|
5974
6069
|
"+",
|
|
5975
6070
|
diff.added.area,
|
|
5976
6071
|
" px"
|
|
5977
6072
|
] }),
|
|
5978
6073
|
" ",
|
|
5979
|
-
/* @__PURE__ */ (0,
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "text-destructive", children: [
|
|
5980
6075
|
"\u2212",
|
|
5981
6076
|
diff.removed.area,
|
|
5982
6077
|
" px"
|
|
@@ -5985,21 +6080,21 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
5985
6080
|
Math.round(diff.iou * 100),
|
|
5986
6081
|
"%"
|
|
5987
6082
|
] }) }),
|
|
5988
|
-
error && /* @__PURE__ */ (0,
|
|
6083
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5989
6084
|
] });
|
|
5990
6085
|
};
|
|
5991
6086
|
|
|
5992
6087
|
// src/image-editor/SeparateSubjectPanel.tsx
|
|
5993
|
-
var
|
|
5994
|
-
var
|
|
6088
|
+
var import_react35 = require("react");
|
|
6089
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5995
6090
|
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";
|
|
5996
6091
|
var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
5997
6092
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5998
|
-
const [dilate, setDilate] = (0,
|
|
5999
|
-
const [fill, setFill] = (0,
|
|
6000
|
-
const [progress, setProgress] = (0,
|
|
6001
|
-
const [error, setError] = (0,
|
|
6002
|
-
const abort = (0,
|
|
6093
|
+
const [dilate, setDilate] = (0, import_react35.useState)(8);
|
|
6094
|
+
const [fill, setFill] = (0, import_react35.useState)(true);
|
|
6095
|
+
const [progress, setProgress] = (0, import_react35.useState)(null);
|
|
6096
|
+
const [error, setError] = (0, import_react35.useState)(null);
|
|
6097
|
+
const abort = (0, import_react35.useRef)(null);
|
|
6003
6098
|
const run = async () => {
|
|
6004
6099
|
setError(null);
|
|
6005
6100
|
abort.current = new AbortController();
|
|
@@ -6018,13 +6113,13 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
6018
6113
|
setProgress(null);
|
|
6019
6114
|
}
|
|
6020
6115
|
};
|
|
6021
|
-
return /* @__PURE__ */ (0,
|
|
6022
|
-
/* @__PURE__ */ (0,
|
|
6023
|
-
/* @__PURE__ */ (0,
|
|
6024
|
-
/* @__PURE__ */ (0,
|
|
6025
|
-
/* @__PURE__ */ (0,
|
|
6116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
6117
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
|
|
6118
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
|
|
6119
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6120
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
6026
6121
|
"Grow",
|
|
6027
|
-
/* @__PURE__ */ (0,
|
|
6122
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6028
6123
|
"input",
|
|
6029
6124
|
{
|
|
6030
6125
|
type: "number",
|
|
@@ -6038,34 +6133,34 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
6038
6133
|
),
|
|
6039
6134
|
"px"
|
|
6040
6135
|
] }),
|
|
6041
|
-
/* @__PURE__ */ (0,
|
|
6042
|
-
/* @__PURE__ */ (0,
|
|
6136
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
6137
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
|
|
6043
6138
|
"Fill the background"
|
|
6044
6139
|
] })
|
|
6045
6140
|
] }),
|
|
6046
|
-
/* @__PURE__ */ (0,
|
|
6047
|
-
/* @__PURE__ */ (0,
|
|
6048
|
-
progress !== null && /* @__PURE__ */ (0,
|
|
6141
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", children: [
|
|
6142
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button7, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
|
|
6143
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button7, onClick: () => abort.current?.abort(), children: "Cancel" })
|
|
6049
6144
|
] }),
|
|
6050
|
-
progress !== null && /* @__PURE__ */ (0,
|
|
6051
|
-
error && /* @__PURE__ */ (0,
|
|
6145
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "status", className: "text-muted-foreground", children: progress }),
|
|
6146
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6052
6147
|
] });
|
|
6053
6148
|
};
|
|
6054
6149
|
|
|
6055
6150
|
// src/image-editor/RefineEdgePanel.tsx
|
|
6056
|
-
var
|
|
6151
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6057
6152
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
6058
6153
|
var button8 = "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";
|
|
6059
6154
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
6060
|
-
const [params, setParams] = (0,
|
|
6061
|
-
const [busy, setBusy] = (0,
|
|
6062
|
-
const [error, setError] = (0,
|
|
6063
|
-
const [layerId, setLayerId] = (0,
|
|
6064
|
-
const [newKind, setNewKind] = (0,
|
|
6065
|
-
const [output, setOutput] = (0,
|
|
6066
|
-
const [decontaminate, setDecontaminate] = (0,
|
|
6067
|
-
const [objectAware, setObjectAware] = (0,
|
|
6068
|
-
const [onlyUncertain, setOnlyUncertain] = (0,
|
|
6155
|
+
const [params, setParams] = (0, import_react36.useState)(DEFAULT_PARAMS);
|
|
6156
|
+
const [busy, setBusy] = (0, import_react36.useState)(false);
|
|
6157
|
+
const [error, setError] = (0, import_react36.useState)(null);
|
|
6158
|
+
const [layerId, setLayerId] = (0, import_react36.useState)("");
|
|
6159
|
+
const [newKind, setNewKind] = (0, import_react36.useState)("hueSaturation");
|
|
6160
|
+
const [output, setOutput] = (0, import_react36.useState)("selection");
|
|
6161
|
+
const [decontaminate, setDecontaminate] = (0, import_react36.useState)(0);
|
|
6162
|
+
const [objectAware, setObjectAware] = (0, import_react36.useState)(false);
|
|
6163
|
+
const [onlyUncertain, setOnlyUncertain] = (0, import_react36.useState)(false);
|
|
6069
6164
|
const canObject = Boolean(controller.segmentationProvider);
|
|
6070
6165
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
6071
6166
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -6088,17 +6183,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6088
6183
|
setBusy(false);
|
|
6089
6184
|
}
|
|
6090
6185
|
};
|
|
6091
|
-
return /* @__PURE__ */ (0,
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
6094
|
-
/* @__PURE__ */ (0,
|
|
6095
|
-
/* @__PURE__ */ (0,
|
|
6096
|
-
/* @__PURE__ */ (0,
|
|
6186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
6187
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
6188
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6189
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6190
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: c.label }),
|
|
6191
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
|
|
6097
6192
|
params[c.id],
|
|
6098
6193
|
c.unit
|
|
6099
6194
|
] })
|
|
6100
6195
|
] }),
|
|
6101
|
-
/* @__PURE__ */ (0,
|
|
6196
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6102
6197
|
"input",
|
|
6103
6198
|
{
|
|
6104
6199
|
type: "range",
|
|
@@ -6112,43 +6207,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6112
6207
|
}
|
|
6113
6208
|
)
|
|
6114
6209
|
] }, c.id)),
|
|
6115
|
-
/* @__PURE__ */ (0,
|
|
6116
|
-
/* @__PURE__ */ (0,
|
|
6210
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
6117
6212
|
"Smart Radius"
|
|
6118
6213
|
] }),
|
|
6119
|
-
/* @__PURE__ */ (0,
|
|
6120
|
-
/* @__PURE__ */ (0,
|
|
6214
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
6215
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
6121
6216
|
"Only uncertain areas"
|
|
6122
6217
|
] }),
|
|
6123
|
-
canObject && /* @__PURE__ */ (0,
|
|
6124
|
-
/* @__PURE__ */ (0,
|
|
6218
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
6219
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
6125
6220
|
"Object aware (segmentation model)"
|
|
6126
6221
|
] }),
|
|
6127
|
-
/* @__PURE__ */ (0,
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
6128
6223
|
"Output to",
|
|
6129
|
-
/* @__PURE__ */ (0,
|
|
6224
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6130
6225
|
"select",
|
|
6131
6226
|
{
|
|
6132
6227
|
"aria-label": "Refine output",
|
|
6133
6228
|
value: output,
|
|
6134
6229
|
onChange: (e) => setOutput(e.target.value),
|
|
6135
6230
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6136
|
-
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0,
|
|
6231
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
6137
6232
|
}
|
|
6138
6233
|
)
|
|
6139
6234
|
] }),
|
|
6140
|
-
/* @__PURE__ */ (0,
|
|
6141
|
-
/* @__PURE__ */ (0,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6235
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6236
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
|
|
6143
6238
|
"Decontaminate colors",
|
|
6144
6239
|
toLayer ? "" : " (new layer or document outputs)"
|
|
6145
6240
|
] }),
|
|
6146
|
-
/* @__PURE__ */ (0,
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
|
|
6147
6242
|
decontaminate,
|
|
6148
6243
|
"%"
|
|
6149
6244
|
] })
|
|
6150
6245
|
] }),
|
|
6151
|
-
/* @__PURE__ */ (0,
|
|
6246
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6152
6247
|
"input",
|
|
6153
6248
|
{
|
|
6154
6249
|
type: "range",
|
|
@@ -6163,27 +6258,27 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6163
6258
|
}
|
|
6164
6259
|
)
|
|
6165
6260
|
] }),
|
|
6166
|
-
/* @__PURE__ */ (0,
|
|
6167
|
-
/* @__PURE__ */ (0,
|
|
6168
|
-
/* @__PURE__ */ (0,
|
|
6261
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1", children: [
|
|
6262
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: button8, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
6263
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: button8, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
6169
6264
|
] }),
|
|
6170
|
-
error && /* @__PURE__ */ (0,
|
|
6171
|
-
/* @__PURE__ */ (0,
|
|
6172
|
-
/* @__PURE__ */ (0,
|
|
6173
|
-
/* @__PURE__ */ (0,
|
|
6174
|
-
/* @__PURE__ */ (0,
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6176
|
-
/* @__PURE__ */ (0,
|
|
6265
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
6266
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MaskEdgeCheck, { controller, selection: sel }),
|
|
6267
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectionChangeCheck, { controller, selection: sel }),
|
|
6268
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
|
|
6269
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
6270
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
6271
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6177
6272
|
"select",
|
|
6178
6273
|
{
|
|
6179
6274
|
"aria-label": "New masked layer kind",
|
|
6180
6275
|
value: newKind,
|
|
6181
6276
|
onChange: (e) => setNewKind(e.target.value),
|
|
6182
6277
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6183
|
-
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
6278
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
6184
6279
|
}
|
|
6185
6280
|
),
|
|
6186
|
-
/* @__PURE__ */ (0,
|
|
6281
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6187
6282
|
"button",
|
|
6188
6283
|
{
|
|
6189
6284
|
type: "button",
|
|
@@ -6194,35 +6289,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6194
6289
|
}
|
|
6195
6290
|
)
|
|
6196
6291
|
] }),
|
|
6197
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6292
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
6293
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6199
6294
|
"select",
|
|
6200
6295
|
{
|
|
6201
6296
|
"aria-label": "Mask layer",
|
|
6202
6297
|
value: target.id,
|
|
6203
6298
|
onChange: (e) => setLayerId(e.target.value),
|
|
6204
6299
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6205
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
6300
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("option", { value: l.id, children: [
|
|
6206
6301
|
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
6207
6302
|
l.mask ? " (masked)" : ""
|
|
6208
6303
|
] }, l.id))
|
|
6209
6304
|
}
|
|
6210
6305
|
),
|
|
6211
|
-
/* @__PURE__ */ (0,
|
|
6212
|
-
/* @__PURE__ */ (0,
|
|
6213
|
-
/* @__PURE__ */ (0,
|
|
6214
|
-
/* @__PURE__ */ (0,
|
|
6306
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6307
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: button8, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
6308
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: button8, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
6309
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: button8, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
6215
6310
|
] }),
|
|
6216
|
-
target.mask && /* @__PURE__ */ (0,
|
|
6217
|
-
/* @__PURE__ */ (0,
|
|
6218
|
-
/* @__PURE__ */ (0,
|
|
6219
|
-
/* @__PURE__ */ (0,
|
|
6220
|
-
/* @__PURE__ */ (0,
|
|
6311
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
6312
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6313
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6314
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Density" }),
|
|
6315
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
|
|
6221
6316
|
Math.round((target.mask.density ?? 1) * 100),
|
|
6222
6317
|
"%"
|
|
6223
6318
|
] })
|
|
6224
6319
|
] }),
|
|
6225
|
-
/* @__PURE__ */ (0,
|
|
6320
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6226
6321
|
"input",
|
|
6227
6322
|
{
|
|
6228
6323
|
type: "range",
|
|
@@ -6236,15 +6331,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6236
6331
|
}
|
|
6237
6332
|
)
|
|
6238
6333
|
] }),
|
|
6239
|
-
/* @__PURE__ */ (0,
|
|
6240
|
-
/* @__PURE__ */ (0,
|
|
6241
|
-
/* @__PURE__ */ (0,
|
|
6242
|
-
/* @__PURE__ */ (0,
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Mask Feather" }),
|
|
6337
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
|
|
6243
6338
|
target.mask.feather ?? 0,
|
|
6244
6339
|
"px"
|
|
6245
6340
|
] })
|
|
6246
6341
|
] }),
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6342
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6248
6343
|
"input",
|
|
6249
6344
|
{
|
|
6250
6345
|
type: "range",
|
|
@@ -6264,13 +6359,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6264
6359
|
};
|
|
6265
6360
|
|
|
6266
6361
|
// src/image-editor/ChannelsPanel.tsx
|
|
6267
|
-
var
|
|
6362
|
+
var import_react37 = require("react");
|
|
6268
6363
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
6269
|
-
var
|
|
6364
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6270
6365
|
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"}`;
|
|
6271
6366
|
var ChannelThumb = ({ channel, size }) => {
|
|
6272
|
-
const ref = (0,
|
|
6273
|
-
(0,
|
|
6367
|
+
const ref = (0, import_react37.useRef)(null);
|
|
6368
|
+
(0, import_react37.useEffect)(() => {
|
|
6274
6369
|
const canvas = ref.current;
|
|
6275
6370
|
const ctx = canvas?.getContext("2d");
|
|
6276
6371
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -6281,15 +6376,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
6281
6376
|
img.data.set(px.data);
|
|
6282
6377
|
ctx.putImageData(img, 0, 0);
|
|
6283
6378
|
}, [channel.mask]);
|
|
6284
|
-
return /* @__PURE__ */ (0,
|
|
6379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
6285
6380
|
};
|
|
6286
6381
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
6287
|
-
const [, setTick] = (0,
|
|
6288
|
-
(0,
|
|
6289
|
-
const [activeId, setActiveId] = (0,
|
|
6290
|
-
const [renaming, setRenaming] = (0,
|
|
6291
|
-
const [error, setError] = (0,
|
|
6292
|
-
const fileInput = (0,
|
|
6382
|
+
const [, setTick] = (0, import_react37.useState)(0);
|
|
6383
|
+
(0, import_react37.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6384
|
+
const [activeId, setActiveId] = (0, import_react37.useState)(null);
|
|
6385
|
+
const [renaming, setRenaming] = (0, import_react37.useState)(null);
|
|
6386
|
+
const [error, setError] = (0, import_react37.useState)(null);
|
|
6387
|
+
const fileInput = (0, import_react37.useRef)(null);
|
|
6293
6388
|
const channels = controller.getChannels();
|
|
6294
6389
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
6295
6390
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -6311,13 +6406,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6311
6406
|
setError(err instanceof Error ? err.message : String(err));
|
|
6312
6407
|
}
|
|
6313
6408
|
};
|
|
6314
|
-
return /* @__PURE__ */ (0,
|
|
6315
|
-
/* @__PURE__ */ (0,
|
|
6316
|
-
/* @__PURE__ */ (0,
|
|
6317
|
-
/* @__PURE__ */ (0,
|
|
6409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
6410
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6411
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
6412
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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" })
|
|
6318
6413
|
] }),
|
|
6319
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
6320
|
-
/* @__PURE__ */ (0,
|
|
6414
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
6415
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6321
6416
|
"li",
|
|
6322
6417
|
{
|
|
6323
6418
|
"data-testid": "channel-row",
|
|
@@ -6329,7 +6424,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6329
6424
|
},
|
|
6330
6425
|
onDoubleClick: () => setRenaming(c.id),
|
|
6331
6426
|
children: [
|
|
6332
|
-
/* @__PURE__ */ (0,
|
|
6427
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6333
6428
|
"button",
|
|
6334
6429
|
{
|
|
6335
6430
|
type: "button",
|
|
@@ -6343,8 +6438,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6343
6438
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
6344
6439
|
}
|
|
6345
6440
|
),
|
|
6346
|
-
/* @__PURE__ */ (0,
|
|
6347
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
6441
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
6442
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6348
6443
|
"input",
|
|
6349
6444
|
{
|
|
6350
6445
|
autoFocus: true,
|
|
@@ -6361,16 +6456,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6361
6456
|
if (e.key === "Escape") setRenaming(null);
|
|
6362
6457
|
}
|
|
6363
6458
|
}
|
|
6364
|
-
) : /* @__PURE__ */ (0,
|
|
6459
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
6365
6460
|
]
|
|
6366
6461
|
},
|
|
6367
6462
|
c.id
|
|
6368
6463
|
)) }),
|
|
6369
|
-
/* @__PURE__ */ (0,
|
|
6370
|
-
/* @__PURE__ */ (0,
|
|
6371
|
-
/* @__PURE__ */ (0,
|
|
6372
|
-
/* @__PURE__ */ (0,
|
|
6373
|
-
/* @__PURE__ */ (0,
|
|
6464
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6465
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
6466
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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" }),
|
|
6467
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6374
6469
|
"button",
|
|
6375
6470
|
{
|
|
6376
6471
|
type: "button",
|
|
@@ -6383,8 +6478,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6383
6478
|
children: "Delete"
|
|
6384
6479
|
}
|
|
6385
6480
|
),
|
|
6386
|
-
/* @__PURE__ */ (0,
|
|
6387
|
-
/* @__PURE__ */ (0,
|
|
6481
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
6482
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6388
6483
|
"button",
|
|
6389
6484
|
{
|
|
6390
6485
|
type: "button",
|
|
@@ -6395,7 +6490,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6395
6490
|
children: "Export PNG"
|
|
6396
6491
|
}
|
|
6397
6492
|
),
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
6493
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6399
6494
|
"input",
|
|
6400
6495
|
{
|
|
6401
6496
|
ref: fileInput,
|
|
@@ -6410,22 +6505,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6410
6505
|
}
|
|
6411
6506
|
)
|
|
6412
6507
|
] }),
|
|
6413
|
-
error && /* @__PURE__ */ (0,
|
|
6508
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6414
6509
|
] });
|
|
6415
6510
|
};
|
|
6416
6511
|
|
|
6417
6512
|
// src/image-editor/PathsPanel.tsx
|
|
6418
|
-
var
|
|
6513
|
+
var import_react38 = require("react");
|
|
6419
6514
|
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
6420
|
-
var
|
|
6515
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6421
6516
|
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"}`;
|
|
6422
6517
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
6423
|
-
const [, setTick] = (0,
|
|
6424
|
-
(0,
|
|
6425
|
-
const [renaming, setRenaming] = (0,
|
|
6426
|
-
const [color, setColor] = (0,
|
|
6427
|
-
const [width, setWidth] = (0,
|
|
6428
|
-
const [error, setError] = (0,
|
|
6518
|
+
const [, setTick] = (0, import_react38.useState)(0);
|
|
6519
|
+
(0, import_react38.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6520
|
+
const [renaming, setRenaming] = (0, import_react38.useState)(null);
|
|
6521
|
+
const [color, setColor] = (0, import_react38.useState)("#000000");
|
|
6522
|
+
const [width, setWidth] = (0, import_react38.useState)(2);
|
|
6523
|
+
const [error, setError] = (0, import_react38.useState)(null);
|
|
6429
6524
|
const paths = controller.getPaths();
|
|
6430
6525
|
const activeId = controller.getState().activePathId ?? null;
|
|
6431
6526
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -6441,10 +6536,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6441
6536
|
};
|
|
6442
6537
|
return (
|
|
6443
6538
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6446
|
-
paths.length === 0 && /* @__PURE__ */ (0,
|
|
6447
|
-
/* @__PURE__ */ (0,
|
|
6539
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("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: [
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
6541
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
6542
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6448
6543
|
"li",
|
|
6449
6544
|
{
|
|
6450
6545
|
"data-testid": "path-row",
|
|
@@ -6453,8 +6548,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6453
6548
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6454
6549
|
onDoubleClick: () => setRenaming(p.id),
|
|
6455
6550
|
children: [
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
renaming === p.id ? /* @__PURE__ */ (0,
|
|
6551
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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__ */ (0, import_jsx_runtime37.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6552
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6458
6553
|
"input",
|
|
6459
6554
|
{
|
|
6460
6555
|
autoFocus: true,
|
|
@@ -6473,13 +6568,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6473
6568
|
if (e.key === "Escape") setRenaming(null);
|
|
6474
6569
|
}
|
|
6475
6570
|
}
|
|
6476
|
-
) : /* @__PURE__ */ (0,
|
|
6571
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
6477
6572
|
]
|
|
6478
6573
|
},
|
|
6479
6574
|
p.id
|
|
6480
6575
|
)) }),
|
|
6481
|
-
/* @__PURE__ */ (0,
|
|
6482
|
-
/* @__PURE__ */ (0,
|
|
6576
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6577
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6483
6578
|
"button",
|
|
6484
6579
|
{
|
|
6485
6580
|
type: "button",
|
|
@@ -6490,15 +6585,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6490
6585
|
children: "Load as Selection"
|
|
6491
6586
|
}
|
|
6492
6587
|
),
|
|
6493
|
-
/* @__PURE__ */ (0,
|
|
6494
|
-
active?.work && /* @__PURE__ */ (0,
|
|
6495
|
-
/* @__PURE__ */ (0,
|
|
6588
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
6589
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
6590
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
6496
6591
|
] }),
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6498
|
-
/* @__PURE__ */ (0,
|
|
6499
|
-
/* @__PURE__ */ (0,
|
|
6500
|
-
/* @__PURE__ */ (0,
|
|
6501
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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" }),
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6502
6597
|
"input",
|
|
6503
6598
|
{
|
|
6504
6599
|
type: "number",
|
|
@@ -6513,25 +6608,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6513
6608
|
),
|
|
6514
6609
|
"px"
|
|
6515
6610
|
] }),
|
|
6516
|
-
/* @__PURE__ */ (0,
|
|
6611
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
6517
6612
|
] }),
|
|
6518
|
-
/* @__PURE__ */ (0,
|
|
6519
|
-
/* @__PURE__ */ (0,
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
6521
6616
|
] }),
|
|
6522
|
-
error && /* @__PURE__ */ (0,
|
|
6617
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6523
6618
|
] })
|
|
6524
6619
|
);
|
|
6525
6620
|
};
|
|
6526
6621
|
|
|
6527
6622
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
6528
|
-
var
|
|
6623
|
+
var import_react39 = require("react");
|
|
6529
6624
|
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
6530
|
-
var
|
|
6625
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6531
6626
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
6532
6627
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
6533
|
-
const [, setTick] = (0,
|
|
6534
|
-
(0,
|
|
6628
|
+
const [, setTick] = (0, import_react39.useState)(0);
|
|
6629
|
+
(0, import_react39.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
6535
6630
|
const bar = tool.bar();
|
|
6536
6631
|
if (!tool.active || !bar) return null;
|
|
6537
6632
|
const warp = tool.warpBar();
|
|
@@ -6543,17 +6638,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6543
6638
|
const v = Number(raw);
|
|
6544
6639
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
6545
6640
|
};
|
|
6546
|
-
return /* @__PURE__ */ (0,
|
|
6547
|
-
/* @__PURE__ */ (0,
|
|
6548
|
-
/* @__PURE__ */ (0,
|
|
6549
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
6550
|
-
/* @__PURE__ */ (0,
|
|
6551
|
-
/* @__PURE__ */ (0,
|
|
6552
|
-
/* @__PURE__ */ (0,
|
|
6641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("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: [
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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)) }),
|
|
6643
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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)) }),
|
|
6644
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6646
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
6553
6648
|
] }),
|
|
6554
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
6555
|
-
/* @__PURE__ */ (0,
|
|
6556
|
-
/* @__PURE__ */ (0,
|
|
6649
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6650
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
6651
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6557
6652
|
"input",
|
|
6558
6653
|
{
|
|
6559
6654
|
type: "number",
|
|
@@ -6574,9 +6669,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6574
6669
|
},
|
|
6575
6670
|
`${k}:${warp[k]}`
|
|
6576
6671
|
),
|
|
6577
|
-
/* @__PURE__ */ (0,
|
|
6672
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
6578
6673
|
] }, k)),
|
|
6579
|
-
/* @__PURE__ */ (0,
|
|
6674
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6580
6675
|
"button",
|
|
6581
6676
|
{
|
|
6582
6677
|
type: "button",
|
|
@@ -6588,9 +6683,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6588
6683
|
children: "Vertical"
|
|
6589
6684
|
}
|
|
6590
6685
|
),
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6592
|
-
/* @__PURE__ */ (0,
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6686
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6687
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
6688
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6594
6689
|
"select",
|
|
6595
6690
|
{
|
|
6596
6691
|
"aria-label": "Warp grid",
|
|
@@ -6600,14 +6695,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6600
6695
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
6601
6696
|
},
|
|
6602
6697
|
className: imageFieldClass,
|
|
6603
|
-
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
6698
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
6604
6699
|
}
|
|
6605
6700
|
)
|
|
6606
6701
|
] })
|
|
6607
6702
|
] }),
|
|
6608
|
-
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
6609
|
-
/* @__PURE__ */ (0,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6703
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
6704
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
6705
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6611
6706
|
"input",
|
|
6612
6707
|
{
|
|
6613
6708
|
type: "number",
|
|
@@ -6627,8 +6722,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6627
6722
|
},
|
|
6628
6723
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
6629
6724
|
),
|
|
6630
|
-
/* @__PURE__ */ (0,
|
|
6631
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
6725
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
6726
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6632
6727
|
"button",
|
|
6633
6728
|
{
|
|
6634
6729
|
type: "button",
|
|
@@ -6643,33 +6738,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6643
6738
|
}
|
|
6644
6739
|
)
|
|
6645
6740
|
] }, f.id)),
|
|
6646
|
-
/* @__PURE__ */ (0,
|
|
6647
|
-
/* @__PURE__ */ (0,
|
|
6648
|
-
/* @__PURE__ */ (0,
|
|
6741
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6742
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
6743
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6649
6744
|
"select",
|
|
6650
6745
|
{
|
|
6651
6746
|
"aria-label": "Interpolation",
|
|
6652
6747
|
value: tool.interpolation,
|
|
6653
6748
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
6654
6749
|
className: imageFieldClass,
|
|
6655
|
-
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
6750
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
6656
6751
|
}
|
|
6657
6752
|
)
|
|
6658
6753
|
] }),
|
|
6659
|
-
/* @__PURE__ */ (0,
|
|
6660
|
-
/* @__PURE__ */ (0,
|
|
6661
|
-
tool.error && /* @__PURE__ */ (0,
|
|
6754
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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" }),
|
|
6755
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
6756
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
6662
6757
|
] });
|
|
6663
6758
|
};
|
|
6664
6759
|
|
|
6665
6760
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
6666
|
-
var
|
|
6761
|
+
var import_react40 = require("react");
|
|
6667
6762
|
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
6668
|
-
var
|
|
6763
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6669
6764
|
var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
|
|
6670
|
-
const [, setTick] = (0,
|
|
6671
|
-
(0,
|
|
6672
|
-
const [error, setError] = (0,
|
|
6765
|
+
const [, setTick] = (0, import_react40.useState)(0);
|
|
6766
|
+
(0, import_react40.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6767
|
+
const [error, setError] = (0, import_react40.useState)(null);
|
|
6673
6768
|
const active = controller.getActiveLayer();
|
|
6674
6769
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
6675
6770
|
const set = (change) => {
|
|
@@ -6683,22 +6778,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
6683
6778
|
}
|
|
6684
6779
|
};
|
|
6685
6780
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
6686
|
-
return /* @__PURE__ */ (0,
|
|
6687
|
-
showTools && /* @__PURE__ */ (0,
|
|
6688
|
-
/* @__PURE__ */ (0,
|
|
6689
|
-
/* @__PURE__ */ (0,
|
|
6690
|
-
/* @__PURE__ */ (0,
|
|
6781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
6782
|
+
showTools && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
6783
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6784
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6785
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
6691
6786
|
"Fill",
|
|
6692
|
-
/* @__PURE__ */ (0,
|
|
6787
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
6693
6788
|
] }),
|
|
6694
|
-
/* @__PURE__ */ (0,
|
|
6695
|
-
/* @__PURE__ */ (0,
|
|
6789
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6790
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
6696
6791
|
"Stroke",
|
|
6697
|
-
/* @__PURE__ */ (0,
|
|
6792
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
6698
6793
|
] }),
|
|
6699
|
-
/* @__PURE__ */ (0,
|
|
6794
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6700
6795
|
"Width",
|
|
6701
|
-
/* @__PURE__ */ (0,
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6702
6797
|
"input",
|
|
6703
6798
|
{
|
|
6704
6799
|
type: "number",
|
|
@@ -6712,52 +6807,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, classN
|
|
|
6712
6807
|
)
|
|
6713
6808
|
] })
|
|
6714
6809
|
] }),
|
|
6715
|
-
/* @__PURE__ */ (0,
|
|
6716
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
6810
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6811
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6717
6812
|
"Radius",
|
|
6718
|
-
/* @__PURE__ */ (0,
|
|
6813
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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}` })
|
|
6719
6814
|
] }),
|
|
6720
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
6815
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6721
6816
|
"Sides",
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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}` })
|
|
6723
6818
|
] }),
|
|
6724
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
6725
|
-
/* @__PURE__ */ (0,
|
|
6819
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
6820
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6726
6821
|
"Points",
|
|
6727
|
-
/* @__PURE__ */ (0,
|
|
6822
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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}` })
|
|
6728
6823
|
] }),
|
|
6729
|
-
/* @__PURE__ */ (0,
|
|
6824
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6730
6825
|
"Inner",
|
|
6731
|
-
/* @__PURE__ */ (0,
|
|
6826
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
6732
6827
|
] })
|
|
6733
6828
|
] }),
|
|
6734
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
6735
|
-
/* @__PURE__ */ (0,
|
|
6829
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6736
6831
|
"Weight",
|
|
6737
|
-
/* @__PURE__ */ (0,
|
|
6832
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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}` })
|
|
6738
6833
|
] }),
|
|
6739
|
-
/* @__PURE__ */ (0,
|
|
6740
|
-
/* @__PURE__ */ (0,
|
|
6834
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6835
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
6741
6836
|
"Arrowhead"
|
|
6742
6837
|
] })
|
|
6743
6838
|
] })
|
|
6744
6839
|
] }),
|
|
6745
|
-
/* @__PURE__ */ (0,
|
|
6746
|
-
error && /* @__PURE__ */ (0,
|
|
6840
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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." }),
|
|
6841
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6747
6842
|
] });
|
|
6748
6843
|
};
|
|
6749
6844
|
|
|
6750
6845
|
// src/image-editor/TypeOptionsBar.tsx
|
|
6751
|
-
var
|
|
6846
|
+
var import_react41 = require("react");
|
|
6752
6847
|
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
6753
|
-
var
|
|
6848
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6754
6849
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
6755
6850
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
6756
6851
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
6757
|
-
const [, setTick] = (0,
|
|
6758
|
-
(0,
|
|
6759
|
-
(0,
|
|
6760
|
-
const [error, setError] = (0,
|
|
6852
|
+
const [, setTick] = (0, import_react41.useState)(0);
|
|
6853
|
+
(0, import_react41.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6854
|
+
(0, import_react41.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
6855
|
+
const [error, setError] = (0, import_react41.useState)(null);
|
|
6761
6856
|
const active = controller.getActiveLayer();
|
|
6762
6857
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
6763
6858
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -6810,11 +6905,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6810
6905
|
setError(e instanceof Error ? e.message : String(e));
|
|
6811
6906
|
}
|
|
6812
6907
|
};
|
|
6813
|
-
return /* @__PURE__ */ (0,
|
|
6814
|
-
/* @__PURE__ */ (0,
|
|
6815
|
-
/* @__PURE__ */ (0,
|
|
6908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6910
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6816
6911
|
"Font",
|
|
6817
|
-
/* @__PURE__ */ (0,
|
|
6912
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6818
6913
|
"input",
|
|
6819
6914
|
{
|
|
6820
6915
|
list: "pixerate-type-fonts",
|
|
@@ -6824,11 +6919,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6824
6919
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
6825
6920
|
}
|
|
6826
6921
|
),
|
|
6827
|
-
/* @__PURE__ */ (0,
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: f }, f)) })
|
|
6828
6923
|
] }),
|
|
6829
|
-
/* @__PURE__ */ (0,
|
|
6924
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6830
6925
|
"Size",
|
|
6831
|
-
/* @__PURE__ */ (0,
|
|
6926
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6832
6927
|
"input",
|
|
6833
6928
|
{
|
|
6834
6929
|
type: "number",
|
|
@@ -6841,14 +6936,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6841
6936
|
}
|
|
6842
6937
|
)
|
|
6843
6938
|
] }),
|
|
6844
|
-
/* @__PURE__ */ (0,
|
|
6845
|
-
/* @__PURE__ */ (0,
|
|
6846
|
-
/* @__PURE__ */ (0,
|
|
6939
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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" }),
|
|
6940
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6941
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
6847
6942
|
] }),
|
|
6848
|
-
/* @__PURE__ */ (0,
|
|
6849
|
-
/* @__PURE__ */ (0,
|
|
6850
|
-
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0,
|
|
6851
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6943
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6944
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6945
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6946
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6852
6947
|
"button",
|
|
6853
6948
|
{
|
|
6854
6949
|
type: "button",
|
|
@@ -6860,19 +6955,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6860
6955
|
}
|
|
6861
6956
|
)
|
|
6862
6957
|
] }),
|
|
6863
|
-
/* @__PURE__ */ (0,
|
|
6864
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6958
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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." }),
|
|
6959
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
6865
6960
|
"Missing ",
|
|
6866
6961
|
missing.length === 1 ? "font" : "fonts",
|
|
6867
6962
|
": ",
|
|
6868
6963
|
missing.join(", ")
|
|
6869
6964
|
] }),
|
|
6870
|
-
error && /* @__PURE__ */ (0,
|
|
6965
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6871
6966
|
] });
|
|
6872
6967
|
};
|
|
6873
6968
|
|
|
6874
6969
|
// src/image-editor/ImageEditor.tsx
|
|
6875
|
-
var
|
|
6970
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6876
6971
|
var ImageEditor = ({
|
|
6877
6972
|
editor: externalEditor,
|
|
6878
6973
|
src,
|
|
@@ -6897,32 +6992,32 @@ var ImageEditor = ({
|
|
|
6897
6992
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
6898
6993
|
});
|
|
6899
6994
|
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
6900
|
-
const [activeTab, setActiveTab] = (0,
|
|
6901
|
-
const rootRef = (0,
|
|
6995
|
+
const [activeTab, setActiveTab] = (0, import_react42.useState)("crop");
|
|
6996
|
+
const rootRef = (0, import_react42.useRef)(null);
|
|
6902
6997
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
6903
|
-
const activeTabRef = (0,
|
|
6998
|
+
const activeTabRef = (0, import_react42.useRef)(activeTab);
|
|
6904
6999
|
activeTabRef.current = activeTab;
|
|
6905
7000
|
const openPanel = async (ref) => {
|
|
6906
7001
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
6907
7002
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
6908
7003
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
6909
7004
|
};
|
|
6910
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
6911
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
6912
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
6913
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
6914
|
-
const [typeSession, setTypeSession] = (0,
|
|
6915
|
-
const [selectionError, setSelectionError] = (0,
|
|
6916
|
-
const [paintError, setPaintError] = (0,
|
|
6917
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
7005
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react42.useState)(null);
|
|
7006
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react42.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
7007
|
+
const [shapeOptions, setShapeOptions] = (0, import_react42.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
7008
|
+
const [typeOptions, setTypeOptions] = (0, import_react42.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
7009
|
+
const [typeSession, setTypeSession] = (0, import_react42.useState)(null);
|
|
7010
|
+
const [selectionError, setSelectionError] = (0, import_react42.useState)(null);
|
|
7011
|
+
const [paintError, setPaintError] = (0, import_react42.useState)(null);
|
|
7012
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react42.useState)(null);
|
|
6918
7013
|
const handleCanvasError = (source, message) => {
|
|
6919
7014
|
if (source === "paint") setPaintError(message);
|
|
6920
7015
|
else if (source === "select") setSelectionError(message);
|
|
6921
7016
|
else setShapeTypeError(message);
|
|
6922
7017
|
};
|
|
6923
7018
|
const finishTyping = () => setTypeSession(null);
|
|
6924
|
-
const transformToolRef = (0,
|
|
6925
|
-
const transformControllerRef = (0,
|
|
7019
|
+
const transformToolRef = (0, import_react42.useRef)(null);
|
|
7020
|
+
const transformControllerRef = (0, import_react42.useRef)(controller);
|
|
6926
7021
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
6927
7022
|
transformToolRef.current?.cancel();
|
|
6928
7023
|
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
@@ -6931,16 +7026,16 @@ var ImageEditor = ({
|
|
|
6931
7026
|
transformControllerRef.current = controller;
|
|
6932
7027
|
}
|
|
6933
7028
|
const transformTool = transformToolRef.current;
|
|
6934
|
-
const [, setTransformTick] = (0,
|
|
6935
|
-
(0,
|
|
6936
|
-
(0,
|
|
6937
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
6938
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
6939
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
6940
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
6941
|
-
const [aiError, setAiError] = (0,
|
|
6942
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
6943
|
-
const [aiTarget, setAiTarget] = (0,
|
|
7029
|
+
const [, setTransformTick] = (0, import_react42.useState)(0);
|
|
7030
|
+
(0, import_react42.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
7031
|
+
(0, import_react42.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
7032
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react42.useState)("");
|
|
7033
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react42.useState)("annotations");
|
|
7034
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react42.useState)(false);
|
|
7035
|
+
const [isInpainting, setIsInpainting] = (0, import_react42.useState)(false);
|
|
7036
|
+
const [aiError, setAiError] = (0, import_react42.useState)(null);
|
|
7037
|
+
const [aiSuccess, setAiSuccess] = (0, import_react42.useState)(null);
|
|
7038
|
+
const [aiTarget, setAiTarget] = (0, import_react42.useState)("auto");
|
|
6944
7039
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
6945
7040
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
6946
7041
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -7003,11 +7098,11 @@ var ImageEditor = ({
|
|
|
7003
7098
|
setIsInpainting(false);
|
|
7004
7099
|
}
|
|
7005
7100
|
};
|
|
7006
|
-
const [activeColor, setActiveColor] = (0,
|
|
7007
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
7008
|
-
const [fontSize, setFontSize] = (0,
|
|
7009
|
-
const [textInput, setTextInput] = (0,
|
|
7010
|
-
(0,
|
|
7101
|
+
const [activeColor, setActiveColor] = (0, import_react42.useState)("#ef4444");
|
|
7102
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react42.useState)(3);
|
|
7103
|
+
const [fontSize, setFontSize] = (0, import_react42.useState)(24);
|
|
7104
|
+
const [textInput, setTextInput] = (0, import_react42.useState)("");
|
|
7105
|
+
(0, import_react42.useEffect)(() => {
|
|
7011
7106
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
7012
7107
|
editor.setTool("crop");
|
|
7013
7108
|
}
|
|
@@ -7035,16 +7130,16 @@ var ImageEditor = ({
|
|
|
7035
7130
|
link.click();
|
|
7036
7131
|
}
|
|
7037
7132
|
};
|
|
7038
|
-
return /* @__PURE__ */ (0,
|
|
7133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7039
7134
|
"div",
|
|
7040
7135
|
{
|
|
7041
7136
|
ref: rootRef,
|
|
7042
7137
|
className: `${imageEditorFrameClass} ${className}`,
|
|
7043
7138
|
style,
|
|
7044
7139
|
children: [
|
|
7045
|
-
/* @__PURE__ */ (0,
|
|
7046
|
-
/* @__PURE__ */ (0,
|
|
7047
|
-
/* @__PURE__ */ (0,
|
|
7140
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
7141
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
7142
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7048
7143
|
"button",
|
|
7049
7144
|
{
|
|
7050
7145
|
type: "button",
|
|
@@ -7059,7 +7154,7 @@ var ImageEditor = ({
|
|
|
7059
7154
|
children: "Transform & Crop"
|
|
7060
7155
|
}
|
|
7061
7156
|
),
|
|
7062
|
-
/* @__PURE__ */ (0,
|
|
7157
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7063
7158
|
"button",
|
|
7064
7159
|
{
|
|
7065
7160
|
type: "button",
|
|
@@ -7074,7 +7169,7 @@ var ImageEditor = ({
|
|
|
7074
7169
|
children: "Adjustments"
|
|
7075
7170
|
}
|
|
7076
7171
|
),
|
|
7077
|
-
/* @__PURE__ */ (0,
|
|
7172
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7078
7173
|
"button",
|
|
7079
7174
|
{
|
|
7080
7175
|
type: "button",
|
|
@@ -7089,7 +7184,7 @@ var ImageEditor = ({
|
|
|
7089
7184
|
children: "Layers"
|
|
7090
7185
|
}
|
|
7091
7186
|
),
|
|
7092
|
-
/* @__PURE__ */ (0,
|
|
7187
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7093
7188
|
"button",
|
|
7094
7189
|
{
|
|
7095
7190
|
type: "button",
|
|
@@ -7104,7 +7199,7 @@ var ImageEditor = ({
|
|
|
7104
7199
|
children: "Paint"
|
|
7105
7200
|
}
|
|
7106
7201
|
),
|
|
7107
|
-
/* @__PURE__ */ (0,
|
|
7202
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7108
7203
|
"button",
|
|
7109
7204
|
{
|
|
7110
7205
|
type: "button",
|
|
@@ -7119,7 +7214,7 @@ var ImageEditor = ({
|
|
|
7119
7214
|
children: "Select & Mask"
|
|
7120
7215
|
}
|
|
7121
7216
|
),
|
|
7122
|
-
/* @__PURE__ */ (0,
|
|
7217
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7123
7218
|
"button",
|
|
7124
7219
|
{
|
|
7125
7220
|
type: "button",
|
|
@@ -7134,7 +7229,7 @@ var ImageEditor = ({
|
|
|
7134
7229
|
children: "Annotations"
|
|
7135
7230
|
}
|
|
7136
7231
|
),
|
|
7137
|
-
/* @__PURE__ */ (0,
|
|
7232
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7138
7233
|
"button",
|
|
7139
7234
|
{
|
|
7140
7235
|
type: "button",
|
|
@@ -7149,7 +7244,7 @@ var ImageEditor = ({
|
|
|
7149
7244
|
children: "Depth Mask"
|
|
7150
7245
|
}
|
|
7151
7246
|
),
|
|
7152
|
-
/* @__PURE__ */ (0,
|
|
7247
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7153
7248
|
"button",
|
|
7154
7249
|
{
|
|
7155
7250
|
type: "button",
|
|
@@ -7162,14 +7257,14 @@ var ImageEditor = ({
|
|
|
7162
7257
|
"aria-selected": activeTab === "ai",
|
|
7163
7258
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
7164
7259
|
children: [
|
|
7165
|
-
/* @__PURE__ */ (0,
|
|
7260
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }) }),
|
|
7166
7261
|
"AI Tools"
|
|
7167
7262
|
]
|
|
7168
7263
|
}
|
|
7169
7264
|
)
|
|
7170
7265
|
] }),
|
|
7171
|
-
/* @__PURE__ */ (0,
|
|
7172
|
-
/* @__PURE__ */ (0,
|
|
7266
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
7267
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7173
7268
|
"button",
|
|
7174
7269
|
{
|
|
7175
7270
|
type: "button",
|
|
@@ -7180,7 +7275,7 @@ var ImageEditor = ({
|
|
|
7180
7275
|
children: "\u21A9"
|
|
7181
7276
|
}
|
|
7182
7277
|
),
|
|
7183
|
-
/* @__PURE__ */ (0,
|
|
7278
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7184
7279
|
"button",
|
|
7185
7280
|
{
|
|
7186
7281
|
type: "button",
|
|
@@ -7191,7 +7286,7 @@ var ImageEditor = ({
|
|
|
7191
7286
|
children: "\u21AA"
|
|
7192
7287
|
}
|
|
7193
7288
|
),
|
|
7194
|
-
/* @__PURE__ */ (0,
|
|
7289
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7195
7290
|
"button",
|
|
7196
7291
|
{
|
|
7197
7292
|
type: "button",
|
|
@@ -7200,8 +7295,8 @@ var ImageEditor = ({
|
|
|
7200
7295
|
children: "Reset"
|
|
7201
7296
|
}
|
|
7202
7297
|
),
|
|
7203
|
-
/* @__PURE__ */ (0,
|
|
7204
|
-
/* @__PURE__ */ (0,
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
7299
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7205
7300
|
"button",
|
|
7206
7301
|
{
|
|
7207
7302
|
type: "button",
|
|
@@ -7211,11 +7306,11 @@ var ImageEditor = ({
|
|
|
7211
7306
|
children: "-"
|
|
7212
7307
|
}
|
|
7213
7308
|
),
|
|
7214
|
-
/* @__PURE__ */ (0,
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
7215
7310
|
Math.round(state.zoom * 100),
|
|
7216
7311
|
"%"
|
|
7217
7312
|
] }),
|
|
7218
|
-
/* @__PURE__ */ (0,
|
|
7313
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7219
7314
|
"button",
|
|
7220
7315
|
{
|
|
7221
7316
|
type: "button",
|
|
@@ -7225,8 +7320,8 @@ var ImageEditor = ({
|
|
|
7225
7320
|
children: "+"
|
|
7226
7321
|
}
|
|
7227
7322
|
),
|
|
7228
|
-
/* @__PURE__ */ (0,
|
|
7229
|
-
/* @__PURE__ */ (0,
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
7324
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7230
7325
|
"button",
|
|
7231
7326
|
{
|
|
7232
7327
|
type: "button",
|
|
@@ -7237,7 +7332,7 @@ var ImageEditor = ({
|
|
|
7237
7332
|
children: "Hold Compare"
|
|
7238
7333
|
}
|
|
7239
7334
|
),
|
|
7240
|
-
/* @__PURE__ */ (0,
|
|
7335
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7241
7336
|
"button",
|
|
7242
7337
|
{
|
|
7243
7338
|
type: "button",
|
|
@@ -7248,10 +7343,10 @@ var ImageEditor = ({
|
|
|
7248
7343
|
)
|
|
7249
7344
|
] })
|
|
7250
7345
|
] }),
|
|
7251
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
7252
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
7253
|
-
/* @__PURE__ */ (0,
|
|
7254
|
-
/* @__PURE__ */ (0,
|
|
7346
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
7347
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
7348
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7255
7350
|
ImageEditorCanvas,
|
|
7256
7351
|
{
|
|
7257
7352
|
editor,
|
|
@@ -7275,11 +7370,11 @@ var ImageEditor = ({
|
|
|
7275
7370
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
7276
7371
|
}
|
|
7277
7372
|
),
|
|
7278
|
-
/* @__PURE__ */ (0,
|
|
7279
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
7280
|
-
/* @__PURE__ */ (0,
|
|
7281
|
-
/* @__PURE__ */ (0,
|
|
7282
|
-
/* @__PURE__ */ (0,
|
|
7373
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: imageSidebarClass, children: [
|
|
7374
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7375
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
7376
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
7377
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7283
7378
|
"button",
|
|
7284
7379
|
{
|
|
7285
7380
|
type: "button",
|
|
@@ -7291,7 +7386,7 @@ var ImageEditor = ({
|
|
|
7291
7386
|
children: "Freeform"
|
|
7292
7387
|
}
|
|
7293
7388
|
),
|
|
7294
|
-
/* @__PURE__ */ (0,
|
|
7389
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7295
7390
|
"button",
|
|
7296
7391
|
{
|
|
7297
7392
|
type: "button",
|
|
@@ -7303,7 +7398,7 @@ var ImageEditor = ({
|
|
|
7303
7398
|
children: "1:1 Square"
|
|
7304
7399
|
}
|
|
7305
7400
|
),
|
|
7306
|
-
/* @__PURE__ */ (0,
|
|
7401
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7307
7402
|
"button",
|
|
7308
7403
|
{
|
|
7309
7404
|
type: "button",
|
|
@@ -7315,7 +7410,7 @@ var ImageEditor = ({
|
|
|
7315
7410
|
children: "4:3 Standard"
|
|
7316
7411
|
}
|
|
7317
7412
|
),
|
|
7318
|
-
/* @__PURE__ */ (0,
|
|
7413
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7319
7414
|
"button",
|
|
7320
7415
|
{
|
|
7321
7416
|
type: "button",
|
|
@@ -7327,7 +7422,7 @@ var ImageEditor = ({
|
|
|
7327
7422
|
children: "16:9 Wide"
|
|
7328
7423
|
}
|
|
7329
7424
|
),
|
|
7330
|
-
/* @__PURE__ */ (0,
|
|
7425
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7331
7426
|
"button",
|
|
7332
7427
|
{
|
|
7333
7428
|
type: "button",
|
|
@@ -7339,7 +7434,7 @@ var ImageEditor = ({
|
|
|
7339
7434
|
children: "3:2 Photo"
|
|
7340
7435
|
}
|
|
7341
7436
|
),
|
|
7342
|
-
/* @__PURE__ */ (0,
|
|
7437
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7343
7438
|
"button",
|
|
7344
7439
|
{
|
|
7345
7440
|
type: "button",
|
|
@@ -7352,10 +7447,10 @@ var ImageEditor = ({
|
|
|
7352
7447
|
}
|
|
7353
7448
|
)
|
|
7354
7449
|
] }),
|
|
7355
|
-
/* @__PURE__ */ (0,
|
|
7356
|
-
/* @__PURE__ */ (0,
|
|
7357
|
-
/* @__PURE__ */ (0,
|
|
7358
|
-
/* @__PURE__ */ (0,
|
|
7450
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageDividerClass }),
|
|
7451
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
7452
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
7453
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7359
7454
|
"button",
|
|
7360
7455
|
{
|
|
7361
7456
|
type: "button",
|
|
@@ -7364,7 +7459,7 @@ var ImageEditor = ({
|
|
|
7364
7459
|
children: "Rotate -90\xB0"
|
|
7365
7460
|
}
|
|
7366
7461
|
),
|
|
7367
|
-
/* @__PURE__ */ (0,
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7368
7463
|
"button",
|
|
7369
7464
|
{
|
|
7370
7465
|
type: "button",
|
|
@@ -7373,7 +7468,7 @@ var ImageEditor = ({
|
|
|
7373
7468
|
children: "Rotate +90\xB0"
|
|
7374
7469
|
}
|
|
7375
7470
|
),
|
|
7376
|
-
/* @__PURE__ */ (0,
|
|
7471
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7377
7472
|
"button",
|
|
7378
7473
|
{
|
|
7379
7474
|
type: "button",
|
|
@@ -7382,7 +7477,7 @@ var ImageEditor = ({
|
|
|
7382
7477
|
children: "Flip Horizontal"
|
|
7383
7478
|
}
|
|
7384
7479
|
),
|
|
7385
|
-
/* @__PURE__ */ (0,
|
|
7480
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7386
7481
|
"button",
|
|
7387
7482
|
{
|
|
7388
7483
|
type: "button",
|
|
@@ -7393,10 +7488,10 @@ var ImageEditor = ({
|
|
|
7393
7488
|
)
|
|
7394
7489
|
] })
|
|
7395
7490
|
] }),
|
|
7396
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
7397
|
-
/* @__PURE__ */ (0,
|
|
7398
|
-
/* @__PURE__ */ (0,
|
|
7399
|
-
/* @__PURE__ */ (0,
|
|
7491
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7492
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7493
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
7494
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7400
7495
|
"button",
|
|
7401
7496
|
{
|
|
7402
7497
|
type: "button",
|
|
@@ -7406,9 +7501,9 @@ var ImageEditor = ({
|
|
|
7406
7501
|
}
|
|
7407
7502
|
)
|
|
7408
7503
|
] }),
|
|
7409
|
-
/* @__PURE__ */ (0,
|
|
7410
|
-
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
7411
|
-
/* @__PURE__ */ (0,
|
|
7504
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Histogram, { histogram: editor.histogram }),
|
|
7505
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react42.default.Fragment, { children: [
|
|
7506
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7412
7507
|
ControlSlider,
|
|
7413
7508
|
{
|
|
7414
7509
|
spec,
|
|
@@ -7417,14 +7512,14 @@ var ImageEditor = ({
|
|
|
7417
7512
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
7418
7513
|
}
|
|
7419
7514
|
),
|
|
7420
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
7515
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7421
7516
|
"div",
|
|
7422
7517
|
{
|
|
7423
7518
|
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",
|
|
7424
7519
|
"data-testid": "image-editor-process-notice",
|
|
7425
7520
|
children: [
|
|
7426
|
-
/* @__PURE__ */ (0,
|
|
7427
|
-
/* @__PURE__ */ (0,
|
|
7521
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
7522
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7428
7523
|
"button",
|
|
7429
7524
|
{
|
|
7430
7525
|
type: "button",
|
|
@@ -7437,7 +7532,7 @@ var ImageEditor = ({
|
|
|
7437
7532
|
}
|
|
7438
7533
|
)
|
|
7439
7534
|
] }, spec.id)),
|
|
7440
|
-
/* @__PURE__ */ (0,
|
|
7535
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7441
7536
|
AdjustmentLayersPanel,
|
|
7442
7537
|
{
|
|
7443
7538
|
controller,
|
|
@@ -7446,9 +7541,9 @@ var ImageEditor = ({
|
|
|
7446
7541
|
}
|
|
7447
7542
|
) })
|
|
7448
7543
|
] }),
|
|
7449
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
7450
|
-
/* @__PURE__ */ (0,
|
|
7451
|
-
/* @__PURE__ */ (0,
|
|
7544
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7545
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
7546
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7452
7547
|
"button",
|
|
7453
7548
|
{
|
|
7454
7549
|
type: "button",
|
|
@@ -7459,15 +7554,15 @@ var ImageEditor = ({
|
|
|
7459
7554
|
children: "Free Transform"
|
|
7460
7555
|
}
|
|
7461
7556
|
),
|
|
7462
|
-
/* @__PURE__ */ (0,
|
|
7463
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
7464
|
-
/* @__PURE__ */ (0,
|
|
7465
|
-
/* @__PURE__ */ (0,
|
|
7557
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LayersPanel, { controller }),
|
|
7558
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
7559
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
7560
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ColorProfilePanel, { controller })
|
|
7466
7561
|
] }),
|
|
7467
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
7468
|
-
/* @__PURE__ */ (0,
|
|
7469
|
-
/* @__PURE__ */ (0,
|
|
7470
|
-
/* @__PURE__ */ (0,
|
|
7562
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7563
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
7564
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BrushOptionsBar, { controller }),
|
|
7565
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7471
7566
|
"button",
|
|
7472
7567
|
{
|
|
7473
7568
|
type: "button",
|
|
@@ -7478,12 +7573,12 @@ var ImageEditor = ({
|
|
|
7478
7573
|
children: "Free Transform"
|
|
7479
7574
|
}
|
|
7480
7575
|
),
|
|
7481
|
-
paintError && /* @__PURE__ */ (0,
|
|
7482
|
-
/* @__PURE__ */ (0,
|
|
7576
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
7577
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LayersPanel, { controller }) })
|
|
7483
7578
|
] }),
|
|
7484
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
7485
|
-
/* @__PURE__ */ (0,
|
|
7486
|
-
/* @__PURE__ */ (0,
|
|
7579
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7580
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
7581
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7487
7582
|
"button",
|
|
7488
7583
|
{
|
|
7489
7584
|
type: "button",
|
|
@@ -7494,13 +7589,13 @@ var ImageEditor = ({
|
|
|
7494
7589
|
},
|
|
7495
7590
|
t
|
|
7496
7591
|
)) }),
|
|
7497
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
7498
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
7499
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
7500
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
7501
|
-
/* @__PURE__ */ (0,
|
|
7502
|
-
/* @__PURE__ */ (0,
|
|
7503
|
-
/* @__PURE__ */ (0,
|
|
7592
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
7593
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
7594
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }),
|
|
7595
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
7596
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageDividerClass }),
|
|
7597
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
7598
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7504
7599
|
"button",
|
|
7505
7600
|
{
|
|
7506
7601
|
type: "button",
|
|
@@ -7510,18 +7605,18 @@ var ImageEditor = ({
|
|
|
7510
7605
|
},
|
|
7511
7606
|
t
|
|
7512
7607
|
)) }),
|
|
7513
|
-
/* @__PURE__ */ (0,
|
|
7514
|
-
/* @__PURE__ */ (0,
|
|
7515
|
-
/* @__PURE__ */ (0,
|
|
7516
|
-
/* @__PURE__ */ (0,
|
|
7517
|
-
/* @__PURE__ */ (0,
|
|
7518
|
-
/* @__PURE__ */ (0,
|
|
7519
|
-
/* @__PURE__ */ (0,
|
|
7608
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
7609
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
7610
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
7611
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
7612
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
7613
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Width:" }),
|
|
7614
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "font-mono", children: [
|
|
7520
7615
|
strokeWidth,
|
|
7521
7616
|
"px"
|
|
7522
7617
|
] })
|
|
7523
7618
|
] }),
|
|
7524
|
-
/* @__PURE__ */ (0,
|
|
7619
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7525
7620
|
"input",
|
|
7526
7621
|
{
|
|
7527
7622
|
type: "range",
|
|
@@ -7534,10 +7629,10 @@ var ImageEditor = ({
|
|
|
7534
7629
|
)
|
|
7535
7630
|
] })
|
|
7536
7631
|
] }),
|
|
7537
|
-
/* @__PURE__ */ (0,
|
|
7538
|
-
/* @__PURE__ */ (0,
|
|
7539
|
-
/* @__PURE__ */ (0,
|
|
7540
|
-
/* @__PURE__ */ (0,
|
|
7632
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageDividerClass }),
|
|
7633
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
7634
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex gap-2", children: [
|
|
7635
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7541
7636
|
"input",
|
|
7542
7637
|
{
|
|
7543
7638
|
type: "text",
|
|
@@ -7548,7 +7643,7 @@ var ImageEditor = ({
|
|
|
7548
7643
|
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"
|
|
7549
7644
|
}
|
|
7550
7645
|
),
|
|
7551
|
-
/* @__PURE__ */ (0,
|
|
7646
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7552
7647
|
"button",
|
|
7553
7648
|
{
|
|
7554
7649
|
type: "button",
|
|
@@ -7558,14 +7653,14 @@ var ImageEditor = ({
|
|
|
7558
7653
|
}
|
|
7559
7654
|
)
|
|
7560
7655
|
] }),
|
|
7561
|
-
/* @__PURE__ */ (0,
|
|
7562
|
-
/* @__PURE__ */ (0,
|
|
7563
|
-
/* @__PURE__ */ (0,
|
|
7656
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
7657
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Font Size:" }),
|
|
7658
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "font-mono", children: [
|
|
7564
7659
|
fontSize,
|
|
7565
7660
|
"px"
|
|
7566
7661
|
] })
|
|
7567
7662
|
] }),
|
|
7568
|
-
/* @__PURE__ */ (0,
|
|
7663
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7569
7664
|
"input",
|
|
7570
7665
|
{
|
|
7571
7666
|
type: "range",
|
|
@@ -7576,14 +7671,14 @@ var ImageEditor = ({
|
|
|
7576
7671
|
className: imageRangeClass
|
|
7577
7672
|
}
|
|
7578
7673
|
),
|
|
7579
|
-
/* @__PURE__ */ (0,
|
|
7580
|
-
/* @__PURE__ */ (0,
|
|
7581
|
-
/* @__PURE__ */ (0,
|
|
7674
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageDividerClass }),
|
|
7675
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
7582
7677
|
"Layers (",
|
|
7583
7678
|
state.annotations.length,
|
|
7584
7679
|
")"
|
|
7585
7680
|
] }),
|
|
7586
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
7681
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7587
7682
|
"button",
|
|
7588
7683
|
{
|
|
7589
7684
|
type: "button",
|
|
@@ -7592,7 +7687,7 @@ var ImageEditor = ({
|
|
|
7592
7687
|
children: "Delete Selected"
|
|
7593
7688
|
}
|
|
7594
7689
|
),
|
|
7595
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
7690
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7596
7691
|
"button",
|
|
7597
7692
|
{
|
|
7598
7693
|
type: "button",
|
|
@@ -7603,10 +7698,10 @@ var ImageEditor = ({
|
|
|
7603
7698
|
)
|
|
7604
7699
|
] })
|
|
7605
7700
|
] }),
|
|
7606
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
7607
|
-
/* @__PURE__ */ (0,
|
|
7608
|
-
/* @__PURE__ */ (0,
|
|
7609
|
-
/* @__PURE__ */ (0,
|
|
7701
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7702
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7703
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
7704
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7610
7705
|
"button",
|
|
7611
7706
|
{
|
|
7612
7707
|
type: "button",
|
|
@@ -7616,8 +7711,8 @@ var ImageEditor = ({
|
|
|
7616
7711
|
}
|
|
7617
7712
|
)
|
|
7618
7713
|
] }),
|
|
7619
|
-
/* @__PURE__ */ (0,
|
|
7620
|
-
/* @__PURE__ */ (0,
|
|
7714
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
7715
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7621
7716
|
"input",
|
|
7622
7717
|
{
|
|
7623
7718
|
type: "checkbox",
|
|
@@ -7626,12 +7721,12 @@ var ImageEditor = ({
|
|
|
7626
7721
|
className: "rounded accent-primary"
|
|
7627
7722
|
}
|
|
7628
7723
|
),
|
|
7629
|
-
/* @__PURE__ */ (0,
|
|
7724
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
7630
7725
|
] }),
|
|
7631
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
7632
|
-
/* @__PURE__ */ (0,
|
|
7633
|
-
/* @__PURE__ */ (0,
|
|
7634
|
-
/* @__PURE__ */ (0,
|
|
7726
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
7727
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
7728
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
7729
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7635
7730
|
"input",
|
|
7636
7731
|
{
|
|
7637
7732
|
type: "text",
|
|
@@ -7642,8 +7737,8 @@ var ImageEditor = ({
|
|
|
7642
7737
|
}
|
|
7643
7738
|
)
|
|
7644
7739
|
] }),
|
|
7645
|
-
/* @__PURE__ */ (0,
|
|
7646
|
-
/* @__PURE__ */ (0,
|
|
7740
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex gap-2", children: [
|
|
7741
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7647
7742
|
"button",
|
|
7648
7743
|
{
|
|
7649
7744
|
type: "button",
|
|
@@ -7652,7 +7747,7 @@ var ImageEditor = ({
|
|
|
7652
7747
|
children: "Threshold Mode"
|
|
7653
7748
|
}
|
|
7654
7749
|
),
|
|
7655
|
-
/* @__PURE__ */ (0,
|
|
7750
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7656
7751
|
"button",
|
|
7657
7752
|
{
|
|
7658
7753
|
type: "button",
|
|
@@ -7662,12 +7757,12 @@ var ImageEditor = ({
|
|
|
7662
7757
|
}
|
|
7663
7758
|
)
|
|
7664
7759
|
] }),
|
|
7665
|
-
/* @__PURE__ */ (0,
|
|
7666
|
-
/* @__PURE__ */ (0,
|
|
7667
|
-
/* @__PURE__ */ (0,
|
|
7668
|
-
/* @__PURE__ */ (0,
|
|
7760
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
7761
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7762
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
7763
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
7669
7764
|
] }),
|
|
7670
|
-
/* @__PURE__ */ (0,
|
|
7765
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7671
7766
|
"input",
|
|
7672
7767
|
{
|
|
7673
7768
|
type: "range",
|
|
@@ -7681,12 +7776,12 @@ var ImageEditor = ({
|
|
|
7681
7776
|
}
|
|
7682
7777
|
)
|
|
7683
7778
|
] }),
|
|
7684
|
-
/* @__PURE__ */ (0,
|
|
7685
|
-
/* @__PURE__ */ (0,
|
|
7686
|
-
/* @__PURE__ */ (0,
|
|
7687
|
-
/* @__PURE__ */ (0,
|
|
7779
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
7780
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7781
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
7782
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
7688
7783
|
] }),
|
|
7689
|
-
/* @__PURE__ */ (0,
|
|
7784
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7690
7785
|
"input",
|
|
7691
7786
|
{
|
|
7692
7787
|
type: "range",
|
|
@@ -7700,12 +7795,12 @@ var ImageEditor = ({
|
|
|
7700
7795
|
}
|
|
7701
7796
|
)
|
|
7702
7797
|
] }),
|
|
7703
|
-
/* @__PURE__ */ (0,
|
|
7704
|
-
/* @__PURE__ */ (0,
|
|
7705
|
-
/* @__PURE__ */ (0,
|
|
7706
|
-
/* @__PURE__ */ (0,
|
|
7798
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
7799
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7800
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Softness:" }),
|
|
7801
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
7707
7802
|
] }),
|
|
7708
|
-
/* @__PURE__ */ (0,
|
|
7803
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7709
7804
|
"input",
|
|
7710
7805
|
{
|
|
7711
7806
|
type: "range",
|
|
@@ -7717,8 +7812,8 @@ var ImageEditor = ({
|
|
|
7717
7812
|
}
|
|
7718
7813
|
)
|
|
7719
7814
|
] }),
|
|
7720
|
-
/* @__PURE__ */ (0,
|
|
7721
|
-
/* @__PURE__ */ (0,
|
|
7815
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
7816
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7722
7817
|
"input",
|
|
7723
7818
|
{
|
|
7724
7819
|
type: "checkbox",
|
|
@@ -7727,12 +7822,12 @@ var ImageEditor = ({
|
|
|
7727
7822
|
className: "rounded accent-primary"
|
|
7728
7823
|
}
|
|
7729
7824
|
),
|
|
7730
|
-
/* @__PURE__ */ (0,
|
|
7825
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Invert Mask" })
|
|
7731
7826
|
] })
|
|
7732
7827
|
] })
|
|
7733
7828
|
] }),
|
|
7734
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
7735
|
-
/* @__PURE__ */ (0,
|
|
7829
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7830
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7736
7831
|
SelectionOptionsBar,
|
|
7737
7832
|
{
|
|
7738
7833
|
controller,
|
|
@@ -7743,9 +7838,9 @@ var ImageEditor = ({
|
|
|
7743
7838
|
selectionDisplay: state.selectionDisplay
|
|
7744
7839
|
}
|
|
7745
7840
|
),
|
|
7746
|
-
selectionError && /* @__PURE__ */ (0,
|
|
7747
|
-
/* @__PURE__ */ (0,
|
|
7748
|
-
/* @__PURE__ */ (0,
|
|
7841
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
7842
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex gap-1", children: [
|
|
7843
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7749
7844
|
"button",
|
|
7750
7845
|
{
|
|
7751
7846
|
type: "button",
|
|
@@ -7756,7 +7851,7 @@ var ImageEditor = ({
|
|
|
7756
7851
|
children: "Transform Selection"
|
|
7757
7852
|
}
|
|
7758
7853
|
),
|
|
7759
|
-
/* @__PURE__ */ (0,
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7760
7855
|
"button",
|
|
7761
7856
|
{
|
|
7762
7857
|
type: "button",
|
|
@@ -7768,14 +7863,14 @@ var ImageEditor = ({
|
|
|
7768
7863
|
}
|
|
7769
7864
|
)
|
|
7770
7865
|
] }),
|
|
7771
|
-
/* @__PURE__ */ (0,
|
|
7772
|
-
/* @__PURE__ */ (0,
|
|
7773
|
-
/* @__PURE__ */ (0,
|
|
7866
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
7867
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChannelsPanel, { controller }),
|
|
7868
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PathsPanel, { controller })
|
|
7774
7869
|
] }),
|
|
7775
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
7776
|
-
/* @__PURE__ */ (0,
|
|
7777
|
-
/* @__PURE__ */ (0,
|
|
7778
|
-
/* @__PURE__ */ (0,
|
|
7870
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7871
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
7872
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Results go to" }),
|
|
7873
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7779
7874
|
"select",
|
|
7780
7875
|
{
|
|
7781
7876
|
"aria-label": "AI result target",
|
|
@@ -7783,54 +7878,54 @@ var ImageEditor = ({
|
|
|
7783
7878
|
onChange: (e) => setAiTarget(e.target.value),
|
|
7784
7879
|
className: imageSelectClass,
|
|
7785
7880
|
children: [
|
|
7786
|
-
/* @__PURE__ */ (0,
|
|
7787
|
-
/* @__PURE__ */ (0,
|
|
7788
|
-
/* @__PURE__ */ (0,
|
|
7881
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
7882
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
7883
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("option", { value: "replace", children: "Replace image" })
|
|
7789
7884
|
]
|
|
7790
7885
|
}
|
|
7791
7886
|
)
|
|
7792
7887
|
] }),
|
|
7793
|
-
/* @__PURE__ */ (0,
|
|
7794
|
-
/* @__PURE__ */ (0,
|
|
7795
|
-
/* @__PURE__ */ (0,
|
|
7796
|
-
/* @__PURE__ */ (0,
|
|
7888
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7889
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7890
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7891
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }) }),
|
|
7797
7892
|
"Background Removal"
|
|
7798
7893
|
] }),
|
|
7799
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
7894
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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..." })
|
|
7800
7895
|
] }),
|
|
7801
|
-
/* @__PURE__ */ (0,
|
|
7802
|
-
/* @__PURE__ */ (0,
|
|
7896
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
7897
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7803
7898
|
"button",
|
|
7804
7899
|
{
|
|
7805
7900
|
type: "button",
|
|
7806
7901
|
onClick: handleRemoveBackground,
|
|
7807
7902
|
disabled: isRemovingBg || isInpainting,
|
|
7808
7903
|
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",
|
|
7809
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
7810
|
-
/* @__PURE__ */ (0,
|
|
7904
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
7905
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageSpinnerClass }),
|
|
7811
7906
|
"Removing Background..."
|
|
7812
|
-
] }) : /* @__PURE__ */ (0,
|
|
7813
|
-
/* @__PURE__ */ (0,
|
|
7907
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
7908
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }) }),
|
|
7814
7909
|
"Remove Background"
|
|
7815
7910
|
] })
|
|
7816
7911
|
}
|
|
7817
7912
|
)
|
|
7818
7913
|
] }),
|
|
7819
|
-
/* @__PURE__ */ (0,
|
|
7820
|
-
/* @__PURE__ */ (0,
|
|
7821
|
-
/* @__PURE__ */ (0,
|
|
7822
|
-
/* @__PURE__ */ (0,
|
|
7823
|
-
/* @__PURE__ */ (0,
|
|
7824
|
-
/* @__PURE__ */ (0,
|
|
7914
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7915
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7916
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7917
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
7918
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }),
|
|
7919
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "m14 7 3 3" })
|
|
7825
7920
|
] }),
|
|
7826
7921
|
"Generative Inpainting"
|
|
7827
7922
|
] }),
|
|
7828
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7923
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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..." })
|
|
7829
7924
|
] }),
|
|
7830
|
-
/* @__PURE__ */ (0,
|
|
7831
|
-
/* @__PURE__ */ (0,
|
|
7832
|
-
/* @__PURE__ */ (0,
|
|
7833
|
-
/* @__PURE__ */ (0,
|
|
7925
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
7926
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7927
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7928
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7834
7929
|
"textarea",
|
|
7835
7930
|
{
|
|
7836
7931
|
id: "ai-inpaint-prompt-react",
|
|
@@ -7842,10 +7937,10 @@ var ImageEditor = ({
|
|
|
7842
7937
|
}
|
|
7843
7938
|
)
|
|
7844
7939
|
] }),
|
|
7845
|
-
/* @__PURE__ */ (0,
|
|
7846
|
-
/* @__PURE__ */ (0,
|
|
7847
|
-
/* @__PURE__ */ (0,
|
|
7848
|
-
/* @__PURE__ */ (0,
|
|
7940
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7941
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7942
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7943
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7849
7944
|
"button",
|
|
7850
7945
|
{
|
|
7851
7946
|
type: "button",
|
|
@@ -7858,7 +7953,7 @@ var ImageEditor = ({
|
|
|
7858
7953
|
]
|
|
7859
7954
|
}
|
|
7860
7955
|
),
|
|
7861
|
-
/* @__PURE__ */ (0,
|
|
7956
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7862
7957
|
"button",
|
|
7863
7958
|
{
|
|
7864
7959
|
type: "button",
|
|
@@ -7873,25 +7968,25 @@ var ImageEditor = ({
|
|
|
7873
7968
|
)
|
|
7874
7969
|
] })
|
|
7875
7970
|
] }),
|
|
7876
|
-
/* @__PURE__ */ (0,
|
|
7971
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7877
7972
|
"button",
|
|
7878
7973
|
{
|
|
7879
7974
|
type: "button",
|
|
7880
7975
|
onClick: handleInpaint,
|
|
7881
7976
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
7882
7977
|
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",
|
|
7883
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
7884
|
-
/* @__PURE__ */ (0,
|
|
7978
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
7979
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: imageSpinnerClass }),
|
|
7885
7980
|
"Generating Inpaint..."
|
|
7886
|
-
] }) : /* @__PURE__ */ (0,
|
|
7887
|
-
/* @__PURE__ */ (0,
|
|
7981
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
7982
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }) }),
|
|
7888
7983
|
"Apply Inpainting"
|
|
7889
7984
|
] })
|
|
7890
7985
|
}
|
|
7891
7986
|
)
|
|
7892
7987
|
] }),
|
|
7893
|
-
aiError && /* @__PURE__ */ (0,
|
|
7894
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7988
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
7989
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
7895
7990
|
] })
|
|
7896
7991
|
] })
|
|
7897
7992
|
] })
|