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