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