@pixerate/editor-react 0.149.0 → 0.150.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3UIHKJ75.js → chunk-4GVCM2UX.js} +801 -740
- package/dist/image-editor/SelectionRecipePanel.d.cts +14 -0
- package/dist/image-editor/SelectionRecipePanel.d.ts +14 -0
- package/dist/image-editor/index.cjs +861 -799
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +1386 -1324
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -59,6 +59,7 @@ __export(image_editor_exports, {
|
|
|
59
59
|
SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
|
|
60
60
|
SelectionChangeCheck: () => SelectionChangeCheck,
|
|
61
61
|
SelectionOptionsBar: () => SelectionOptionsBar,
|
|
62
|
+
SelectionRecipePanel: () => SelectionRecipePanel,
|
|
62
63
|
SeparateSubjectPanel: () => SeparateSubjectPanel,
|
|
63
64
|
ShapeOptionsBar: () => ShapeOptionsBar,
|
|
64
65
|
TypeOptionsBar: () => TypeOptionsBar,
|
|
@@ -239,8 +240,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
// src/image-editor/ImageEditor.tsx
|
|
242
|
-
var
|
|
243
|
-
var
|
|
243
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
244
|
+
var import_image_editor25 = require("@pixerate/editor/image-editor");
|
|
244
245
|
|
|
245
246
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
246
247
|
var import_react5 = require("react");
|
|
@@ -4794,34 +4795,93 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4794
4795
|
};
|
|
4795
4796
|
|
|
4796
4797
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
4797
|
-
var
|
|
4798
|
-
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4798
|
+
var import_react30 = require("react");
|
|
4799
4799
|
|
|
4800
|
-
// src/image-editor/
|
|
4800
|
+
// src/image-editor/SelectionRecipePanel.tsx
|
|
4801
4801
|
var import_react27 = require("react");
|
|
4802
4802
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4803
4803
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4804
|
-
var
|
|
4805
|
-
var
|
|
4806
|
-
var
|
|
4807
|
-
const session = (0, import_react27.useMemo)(() => new import_image_editor14.SelectAndMaskSession(controller), [controller]);
|
|
4808
|
-
const [, setRevision] = (0, import_react27.useState)(0);
|
|
4809
|
-
const [zoom, setZoom] = (0, import_react27.useState)(1);
|
|
4810
|
-
const [pan, setPan] = (0, import_react27.useState)({ x: 0, y: 0 });
|
|
4811
|
-
const [busy, setBusy] = (0, import_react27.useState)(false);
|
|
4804
|
+
var MODES2 = ["replace", "add", "subtract", "intersect"];
|
|
4805
|
+
var button2 = "px-1.5 py-0.5 rounded border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4806
|
+
var SelectionRecipePanel = ({ controller, className = "" }) => {
|
|
4812
4807
|
const [error, setError] = (0, import_react27.useState)(null);
|
|
4813
|
-
const
|
|
4814
|
-
|
|
4808
|
+
const recipe = controller.getSelectionRecipe();
|
|
4809
|
+
if (!recipe.live) return null;
|
|
4810
|
+
const run = (p) => {
|
|
4811
|
+
setError(null);
|
|
4812
|
+
Promise.resolve(p).catch((err) => setError(err instanceof Error ? err.message : String(err)));
|
|
4813
|
+
};
|
|
4814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "selection-recipe", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
4815
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4816
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Selection steps" }),
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button2, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
|
|
4818
|
+
] }),
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
|
|
4820
|
+
const setting = (0, import_image_editor14.recipeStepSetting)(step);
|
|
4821
|
+
const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
|
|
4822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
|
|
4823
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "flex-1 min-w-0 truncate text-foreground", children: (0, import_image_editor14.describeRecipeStep)(step) }),
|
|
4824
|
+
shape && step.index > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4825
|
+
"select",
|
|
4826
|
+
{
|
|
4827
|
+
"aria-label": `Step ${step.index + 1} mode`,
|
|
4828
|
+
value: step.mode ?? "replace",
|
|
4829
|
+
onChange: (e) => run(controller.editSelectionStep(step.index, { mode: e.target.value })),
|
|
4830
|
+
className: "bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
4831
|
+
children: MODES2.map((m) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: m, children: m }, m))
|
|
4832
|
+
}
|
|
4833
|
+
),
|
|
4834
|
+
setting && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4835
|
+
setting.label,
|
|
4836
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4837
|
+
"input",
|
|
4838
|
+
{
|
|
4839
|
+
type: "number",
|
|
4840
|
+
min: setting.min,
|
|
4841
|
+
max: setting.max,
|
|
4842
|
+
"aria-label": `Step ${step.index + 1} ${setting.label}`,
|
|
4843
|
+
defaultValue: setting.value,
|
|
4844
|
+
onBlur: (e) => Number(e.target.value) !== setting.value && run(controller.editSelectionStep(step.index, setting.change(Number(e.target.value)))),
|
|
4845
|
+
onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(),
|
|
4846
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4847
|
+
}
|
|
4848
|
+
)
|
|
4849
|
+
] }),
|
|
4850
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button2, "aria-label": `Remove step ${step.index + 1}`, disabled: recipe.steps.length === 1, onClick: () => run(controller.removeSelectionStep(step.index)), children: "\xD7" })
|
|
4851
|
+
] }, `${step.index}:${JSON.stringify(step)}`);
|
|
4852
|
+
}) }),
|
|
4853
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4854
|
+
] });
|
|
4855
|
+
};
|
|
4856
|
+
|
|
4857
|
+
// src/image-editor/SelectionOptionsBar.tsx
|
|
4858
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
4859
|
+
|
|
4860
|
+
// src/image-editor/SelectAndMaskWorkspace.tsx
|
|
4861
|
+
var import_react28 = require("react");
|
|
4862
|
+
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
4863
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4864
|
+
var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4865
|
+
var toggle = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
4866
|
+
var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
4867
|
+
const session = (0, import_react28.useMemo)(() => new import_image_editor15.SelectAndMaskSession(controller), [controller]);
|
|
4868
|
+
const [, setRevision] = (0, import_react28.useState)(0);
|
|
4869
|
+
const [zoom, setZoom] = (0, import_react28.useState)(1);
|
|
4870
|
+
const [pan, setPan] = (0, import_react28.useState)({ x: 0, y: 0 });
|
|
4871
|
+
const [busy, setBusy] = (0, import_react28.useState)(false);
|
|
4872
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
4873
|
+
const canvasRef = (0, import_react28.useRef)(null);
|
|
4874
|
+
const panFrom = (0, import_react28.useRef)(null);
|
|
4815
4875
|
const settings = session.settings;
|
|
4816
4876
|
const size = session.previewSize;
|
|
4817
|
-
(0,
|
|
4877
|
+
(0, import_react28.useEffect)(() => {
|
|
4818
4878
|
const off = session.subscribe(() => setRevision(session.revision));
|
|
4819
4879
|
void session.open();
|
|
4820
4880
|
return () => {
|
|
4821
4881
|
off();
|
|
4822
4882
|
};
|
|
4823
4883
|
}, [session]);
|
|
4824
|
-
(0,
|
|
4884
|
+
(0, import_react28.useEffect)(() => {
|
|
4825
4885
|
const canvas = canvasRef.current;
|
|
4826
4886
|
const ctx = canvas?.getContext?.("2d");
|
|
4827
4887
|
if (!canvas || !ctx || !size.width || typeof ImageData === "undefined") return;
|
|
@@ -4840,7 +4900,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4840
4900
|
setBusy(false);
|
|
4841
4901
|
}
|
|
4842
4902
|
};
|
|
4843
|
-
(0,
|
|
4903
|
+
(0, import_react28.useEffect)(() => {
|
|
4844
4904
|
const onKey = (e) => {
|
|
4845
4905
|
const t = e.target;
|
|
4846
4906
|
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
@@ -4885,7 +4945,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4885
4945
|
};
|
|
4886
4946
|
const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
|
|
4887
4947
|
const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
|
|
4888
|
-
return /* @__PURE__ */ (0,
|
|
4948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4889
4949
|
"div",
|
|
4890
4950
|
{
|
|
4891
4951
|
"data-testid": "select-and-mask-workspace",
|
|
@@ -4893,12 +4953,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4893
4953
|
"aria-label": "Select and Mask",
|
|
4894
4954
|
className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
|
|
4895
4955
|
children: [
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
4897
|
-
/* @__PURE__ */ (0,
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
4899
|
-
brushTool && /* @__PURE__ */ (0,
|
|
4956
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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_editor15.SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.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)) }),
|
|
4957
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
4958
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
4959
|
+
brushTool && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4900
4960
|
"Size",
|
|
4901
|
-
/* @__PURE__ */ (0,
|
|
4961
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4902
4962
|
"input",
|
|
4903
4963
|
{
|
|
4904
4964
|
type: "number",
|
|
@@ -4911,22 +4971,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4911
4971
|
),
|
|
4912
4972
|
"px"
|
|
4913
4973
|
] }),
|
|
4914
|
-
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ (0,
|
|
4915
|
-
/* @__PURE__ */ (0,
|
|
4916
|
-
/* @__PURE__ */ (0,
|
|
4974
|
+
settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
|
|
4975
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
4976
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
4917
4977
|
] }),
|
|
4918
|
-
/* @__PURE__ */ (0,
|
|
4978
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
4919
4979
|
session.edits.length,
|
|
4920
4980
|
" strokes"
|
|
4921
4981
|
] }),
|
|
4922
|
-
/* @__PURE__ */ (0,
|
|
4923
|
-
/* @__PURE__ */ (0,
|
|
4982
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button3, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
|
|
4983
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
|
|
4924
4984
|
Math.round(zoom * 100),
|
|
4925
4985
|
"%"
|
|
4926
4986
|
] }),
|
|
4927
|
-
session.computing && /* @__PURE__ */ (0,
|
|
4987
|
+
session.computing && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
4928
4988
|
] }),
|
|
4929
|
-
/* @__PURE__ */ (0,
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4930
4990
|
"canvas",
|
|
4931
4991
|
{
|
|
4932
4992
|
ref: canvasRef,
|
|
@@ -4945,50 +5005,50 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4945
5005
|
}
|
|
4946
5006
|
) })
|
|
4947
5007
|
] }),
|
|
4948
|
-
/* @__PURE__ */ (0,
|
|
4949
|
-
/* @__PURE__ */ (0,
|
|
4950
|
-
/* @__PURE__ */ (0,
|
|
5008
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
5009
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "View Mode" }),
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4951
5011
|
"View",
|
|
4952
|
-
/* @__PURE__ */ (0,
|
|
5012
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4953
5013
|
ImageSelect,
|
|
4954
5014
|
{
|
|
4955
5015
|
label: "View",
|
|
4956
5016
|
value: settings.view,
|
|
4957
|
-
options:
|
|
5017
|
+
options: import_image_editor15.SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
|
|
4958
5018
|
onChange: (v) => set({ view: v })
|
|
4959
5019
|
}
|
|
4960
5020
|
)
|
|
4961
5021
|
] }),
|
|
4962
|
-
/* @__PURE__ */ (0,
|
|
4963
|
-
/* @__PURE__ */ (0,
|
|
4964
|
-
/* @__PURE__ */ (0,
|
|
4965
|
-
/* @__PURE__ */ (0,
|
|
5022
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5024
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Opacity" }),
|
|
5025
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
|
|
4966
5026
|
Math.round(settings.opacity * 100),
|
|
4967
5027
|
"%"
|
|
4968
5028
|
] })
|
|
4969
5029
|
] }),
|
|
4970
|
-
/* @__PURE__ */ (0,
|
|
5030
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
4971
5031
|
] }),
|
|
4972
|
-
/* @__PURE__ */ (0,
|
|
4973
|
-
/* @__PURE__ */ (0,
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
|
|
4974
5034
|
"Show Edge (J)"
|
|
4975
5035
|
] }),
|
|
4976
|
-
/* @__PURE__ */ (0,
|
|
4977
|
-
/* @__PURE__ */ (0,
|
|
5036
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5037
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
|
|
4978
5038
|
"Show Original (P)"
|
|
4979
5039
|
] }),
|
|
4980
|
-
/* @__PURE__ */ (0,
|
|
4981
|
-
/* @__PURE__ */ (0,
|
|
5040
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5041
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
|
|
4982
5042
|
"Real-Time Refinement"
|
|
4983
5043
|
] }),
|
|
4984
|
-
/* @__PURE__ */ (0,
|
|
4985
|
-
/* @__PURE__ */ (0,
|
|
5044
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5045
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
|
|
4986
5046
|
"High Quality Preview"
|
|
4987
5047
|
] }),
|
|
4988
|
-
/* @__PURE__ */ (0,
|
|
4989
|
-
controller.segmentationProvider && /* @__PURE__ */ (0,
|
|
5048
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
|
|
5049
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
4990
5050
|
"Mode",
|
|
4991
|
-
/* @__PURE__ */ (0,
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4992
5052
|
ImageSelect,
|
|
4993
5053
|
{
|
|
4994
5054
|
label: "Refine mode",
|
|
@@ -5001,56 +5061,56 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5001
5061
|
}
|
|
5002
5062
|
)
|
|
5003
5063
|
] }),
|
|
5004
|
-
|
|
5005
|
-
/* @__PURE__ */ (0,
|
|
5006
|
-
/* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5064
|
+
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5065
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5066
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: c.label }),
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
|
|
5008
5068
|
settings.params[c.id],
|
|
5009
5069
|
c.unit
|
|
5010
5070
|
] })
|
|
5011
5071
|
] }),
|
|
5012
|
-
/* @__PURE__ */ (0,
|
|
5072
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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 } }) })
|
|
5013
5073
|
] }, c.id)),
|
|
5014
|
-
/* @__PURE__ */ (0,
|
|
5015
|
-
/* @__PURE__ */ (0,
|
|
5074
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5075
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
|
|
5016
5076
|
"Smart Radius"
|
|
5017
5077
|
] }),
|
|
5018
|
-
/* @__PURE__ */ (0,
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5020
|
-
/* @__PURE__ */ (0,
|
|
5021
|
-
/* @__PURE__ */ (0,
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5080
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
|
|
5022
5082
|
"Decontaminate Colors",
|
|
5023
5083
|
toLayer ? "" : " (new layer or document outputs)"
|
|
5024
5084
|
] }),
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
|
|
5026
5086
|
settings.decontaminate,
|
|
5027
5087
|
"%"
|
|
5028
5088
|
] })
|
|
5029
5089
|
] }),
|
|
5030
|
-
/* @__PURE__ */ (0,
|
|
5090
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
|
|
5031
5091
|
] }),
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5092
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5033
5093
|
"Output To",
|
|
5034
|
-
/* @__PURE__ */ (0,
|
|
5094
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5035
5095
|
ImageSelect,
|
|
5036
5096
|
{
|
|
5037
5097
|
label: "Output to",
|
|
5038
5098
|
value: settings.output,
|
|
5039
|
-
options:
|
|
5099
|
+
options: import_image_editor15.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => ({ value: o.id, label: o.label })),
|
|
5040
5100
|
onChange: (v) => set({ output: v })
|
|
5041
5101
|
}
|
|
5042
5102
|
)
|
|
5043
5103
|
] }),
|
|
5044
|
-
/* @__PURE__ */ (0,
|
|
5045
|
-
/* @__PURE__ */ (0,
|
|
5104
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5105
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
|
|
5046
5106
|
"Remember Settings"
|
|
5047
5107
|
] }),
|
|
5048
|
-
(error ?? session.error) && /* @__PURE__ */ (0,
|
|
5049
|
-
session.note && /* @__PURE__ */ (0,
|
|
5050
|
-
/* @__PURE__ */ (0,
|
|
5051
|
-
/* @__PURE__ */ (0,
|
|
5052
|
-
/* @__PURE__ */ (0,
|
|
5053
|
-
/* @__PURE__ */ (0,
|
|
5108
|
+
(error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
5109
|
+
session.note && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground", children: session.note }),
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
|
|
5111
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
|
|
5112
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
|
|
5113
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
5054
5114
|
] })
|
|
5055
5115
|
] })
|
|
5056
5116
|
]
|
|
@@ -5059,31 +5119,31 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5059
5119
|
};
|
|
5060
5120
|
|
|
5061
5121
|
// src/image-editor/ContentAwareFillWorkspace.tsx
|
|
5062
|
-
var
|
|
5063
|
-
var
|
|
5064
|
-
var
|
|
5065
|
-
var
|
|
5066
|
-
var toggle2 = (on) => `${
|
|
5122
|
+
var import_react29 = require("react");
|
|
5123
|
+
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
5124
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5125
|
+
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";
|
|
5126
|
+
var toggle2 = (on) => `${button4} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
|
|
5067
5127
|
var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
5068
|
-
const session = (0,
|
|
5069
|
-
const [, setRevision] = (0,
|
|
5070
|
-
const [zoom, setZoom] = (0,
|
|
5071
|
-
const [pan, setPan] = (0,
|
|
5072
|
-
const [busy, setBusy] = (0,
|
|
5073
|
-
const [error, setError] = (0,
|
|
5074
|
-
const sourceRef = (0,
|
|
5075
|
-
const previewRef = (0,
|
|
5076
|
-
const panFrom = (0,
|
|
5128
|
+
const session = (0, import_react29.useMemo)(() => new import_image_editor16.ContentAwareFillSession(controller), [controller]);
|
|
5129
|
+
const [, setRevision] = (0, import_react29.useState)(0);
|
|
5130
|
+
const [zoom, setZoom] = (0, import_react29.useState)(1);
|
|
5131
|
+
const [pan, setPan] = (0, import_react29.useState)({ x: 0, y: 0 });
|
|
5132
|
+
const [busy, setBusy] = (0, import_react29.useState)(false);
|
|
5133
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
5134
|
+
const sourceRef = (0, import_react29.useRef)(null);
|
|
5135
|
+
const previewRef = (0, import_react29.useRef)(null);
|
|
5136
|
+
const panFrom = (0, import_react29.useRef)(null);
|
|
5077
5137
|
const settings = session.settings;
|
|
5078
5138
|
const win = session.window;
|
|
5079
|
-
(0,
|
|
5139
|
+
(0, import_react29.useEffect)(() => {
|
|
5080
5140
|
const off = session.subscribe(() => setRevision(session.revision));
|
|
5081
5141
|
void session.open();
|
|
5082
5142
|
return () => {
|
|
5083
5143
|
off();
|
|
5084
5144
|
};
|
|
5085
5145
|
}, [session]);
|
|
5086
|
-
(0,
|
|
5146
|
+
(0, import_react29.useEffect)(() => {
|
|
5087
5147
|
if (!win || typeof ImageData === "undefined") return;
|
|
5088
5148
|
for (const [canvas, rgba] of [
|
|
5089
5149
|
[sourceRef.current, session.renderSource()],
|
|
@@ -5107,7 +5167,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5107
5167
|
setBusy(false);
|
|
5108
5168
|
}
|
|
5109
5169
|
};
|
|
5110
|
-
(0,
|
|
5170
|
+
(0, import_react29.useEffect)(() => {
|
|
5111
5171
|
const onKey = (e) => {
|
|
5112
5172
|
const t = e.target;
|
|
5113
5173
|
if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
|
|
@@ -5149,14 +5209,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5149
5209
|
session.end();
|
|
5150
5210
|
};
|
|
5151
5211
|
const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
|
|
5152
|
-
return /* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5154
|
-
/* @__PURE__ */ (0,
|
|
5155
|
-
/* @__PURE__ */ (0,
|
|
5156
|
-
settings.tool === "sampling-brush" && /* @__PURE__ */ (0,
|
|
5157
|
-
/* @__PURE__ */ (0,
|
|
5212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.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: [
|
|
5213
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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_editor16.CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
5214
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
5215
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
|
|
5216
|
+
settings.tool === "sampling-brush" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5217
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5158
5218
|
"Size",
|
|
5159
|
-
/* @__PURE__ */ (0,
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5160
5220
|
"input",
|
|
5161
5221
|
{
|
|
5162
5222
|
type: "number",
|
|
@@ -5169,22 +5229,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5169
5229
|
),
|
|
5170
5230
|
"px"
|
|
5171
5231
|
] }),
|
|
5172
|
-
/* @__PURE__ */ (0,
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5174
|
-
/* @__PURE__ */ (0,
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
|
|
5175
5235
|
] })
|
|
5176
5236
|
] }),
|
|
5177
|
-
/* @__PURE__ */ (0,
|
|
5237
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
|
|
5178
5238
|
Math.round(zoom * 100),
|
|
5179
5239
|
"%"
|
|
5180
5240
|
] }),
|
|
5181
|
-
!session.showsWholeImage && /* @__PURE__ */ (0,
|
|
5182
|
-
session.computing && /* @__PURE__ */ (0,
|
|
5241
|
+
!session.showsWholeImage && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button4, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
|
|
5242
|
+
session.computing && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
5183
5243
|
] }),
|
|
5184
|
-
/* @__PURE__ */ (0,
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5186
|
-
/* @__PURE__ */ (0,
|
|
5187
|
-
/* @__PURE__ */ (0,
|
|
5244
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col min-h-0", children: [
|
|
5246
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5188
5248
|
"canvas",
|
|
5189
5249
|
{
|
|
5190
5250
|
ref: sourceRef,
|
|
@@ -5196,33 +5256,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5196
5256
|
}
|
|
5197
5257
|
) })
|
|
5198
5258
|
] }),
|
|
5199
|
-
/* @__PURE__ */ (0,
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5201
|
-
/* @__PURE__ */ (0,
|
|
5259
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col min-h-0", children: [
|
|
5260
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Preview" }),
|
|
5261
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
|
|
5202
5262
|
] })
|
|
5203
5263
|
] })
|
|
5204
5264
|
] }),
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5206
|
-
/* @__PURE__ */ (0,
|
|
5207
|
-
/* @__PURE__ */ (0,
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
|
|
5266
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
|
|
5267
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: import_image_editor16.CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime29.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)) }),
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5269
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
|
|
5210
5270
|
"Show Sampling Area"
|
|
5211
5271
|
] }),
|
|
5212
|
-
/* @__PURE__ */ (0,
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5214
|
-
/* @__PURE__ */ (0,
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
5272
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5273
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5274
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Opacity" }),
|
|
5275
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5216
5276
|
Math.round(settings.opacity * 100),
|
|
5217
5277
|
"%"
|
|
5218
5278
|
] })
|
|
5219
5279
|
] }),
|
|
5220
|
-
/* @__PURE__ */ (0,
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
|
|
5221
5281
|
] }),
|
|
5222
|
-
/* @__PURE__ */ (0,
|
|
5223
|
-
/* @__PURE__ */ (0,
|
|
5282
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
|
|
5283
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5224
5284
|
"Seed",
|
|
5225
|
-
/* @__PURE__ */ (0,
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5226
5286
|
"input",
|
|
5227
5287
|
{
|
|
5228
5288
|
type: "number",
|
|
@@ -5233,17 +5293,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5233
5293
|
className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
5234
5294
|
}
|
|
5235
5295
|
),
|
|
5236
|
-
/* @__PURE__ */ (0,
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button4, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
|
|
5237
5297
|
] }),
|
|
5238
|
-
/* @__PURE__ */ (0,
|
|
5239
|
-
/* @__PURE__ */ (0,
|
|
5298
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
|
|
5240
5300
|
"Live Preview"
|
|
5241
5301
|
] }),
|
|
5242
|
-
!settings.livePreview && /* @__PURE__ */ (0,
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5244
|
-
/* @__PURE__ */ (0,
|
|
5302
|
+
!settings.livePreview && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button4, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
|
|
5303
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
|
|
5304
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
5245
5305
|
"Output To",
|
|
5246
|
-
/* @__PURE__ */ (0,
|
|
5306
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5247
5307
|
ImageSelect,
|
|
5248
5308
|
{
|
|
5249
5309
|
label: "Fill output",
|
|
@@ -5257,18 +5317,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5257
5317
|
}
|
|
5258
5318
|
)
|
|
5259
5319
|
] }),
|
|
5260
|
-
(error ?? session.error) && /* @__PURE__ */ (0,
|
|
5261
|
-
/* @__PURE__ */ (0,
|
|
5262
|
-
/* @__PURE__ */ (0,
|
|
5263
|
-
/* @__PURE__ */ (0,
|
|
5264
|
-
/* @__PURE__ */ (0,
|
|
5320
|
+
(error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
|
|
5321
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
|
|
5322
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button4, onClick: () => session.reset(), children: "Reset" }),
|
|
5323
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button4, onClick: () => onClose(null), children: "Cancel" }),
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
|
|
5265
5325
|
] })
|
|
5266
5326
|
] })
|
|
5267
5327
|
] });
|
|
5268
5328
|
};
|
|
5269
5329
|
|
|
5270
5330
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
5271
|
-
var
|
|
5331
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5272
5332
|
var MODIFY_OPS = [
|
|
5273
5333
|
{ op: "expand", label: "Expand" },
|
|
5274
5334
|
{ op: "contract", label: "Contract" },
|
|
@@ -5292,15 +5352,15 @@ var SelectionOptionsBar = ({
|
|
|
5292
5352
|
selectionDisplay,
|
|
5293
5353
|
className = ""
|
|
5294
5354
|
}) => {
|
|
5295
|
-
const [radius, setRadius] = (0,
|
|
5355
|
+
const [radius, setRadius] = (0, import_react30.useState)(2);
|
|
5296
5356
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
5297
5357
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5298
5358
|
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
5299
|
-
const [preset, setPreset] = (0,
|
|
5300
|
-
const [rangeStatus, setRangeStatus] = (0,
|
|
5301
|
-
const [colorStatus, setColorStatus] = (0,
|
|
5302
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5303
|
-
const [strokeLocation, setStrokeLocation] = (0,
|
|
5359
|
+
const [preset, setPreset] = (0, import_react30.useState)("reds");
|
|
5360
|
+
const [rangeStatus, setRangeStatus] = (0, import_react30.useState)(null);
|
|
5361
|
+
const [colorStatus, setColorStatus] = (0, import_react30.useState)(null);
|
|
5362
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react30.useState)(4);
|
|
5363
|
+
const [strokeLocation, setStrokeLocation] = (0, import_react30.useState)("outside");
|
|
5304
5364
|
const edit = (fn) => {
|
|
5305
5365
|
setColorStatus(null);
|
|
5306
5366
|
try {
|
|
@@ -5333,8 +5393,8 @@ var SelectionOptionsBar = ({
|
|
|
5333
5393
|
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
5334
5394
|
}
|
|
5335
5395
|
};
|
|
5336
|
-
const [task, setTask] = (0,
|
|
5337
|
-
const taskAbort = (0,
|
|
5396
|
+
const [task, setTask] = (0, import_react30.useState)(null);
|
|
5397
|
+
const taskAbort = (0, import_react30.useRef)(null);
|
|
5338
5398
|
const tracked = () => {
|
|
5339
5399
|
const abort = new AbortController();
|
|
5340
5400
|
taskAbort.current = abort;
|
|
@@ -5346,9 +5406,9 @@ var SelectionOptionsBar = ({
|
|
|
5346
5406
|
setTask(null);
|
|
5347
5407
|
};
|
|
5348
5408
|
const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
|
|
5349
|
-
const [subject, setSubject] = (0,
|
|
5350
|
-
const [segmenting, setSegmenting] = (0,
|
|
5351
|
-
const [subjectStatus, setSubjectStatus] = (0,
|
|
5409
|
+
const [subject, setSubject] = (0, import_react30.useState)("");
|
|
5410
|
+
const [segmenting, setSegmenting] = (0, import_react30.useState)(false);
|
|
5411
|
+
const [subjectStatus, setSubjectStatus] = (0, import_react30.useState)(null);
|
|
5352
5412
|
const selectSubject = async () => {
|
|
5353
5413
|
const target = subject.trim();
|
|
5354
5414
|
const canSegment = Boolean(controller.segmentationProvider);
|
|
@@ -5365,10 +5425,10 @@ var SelectionOptionsBar = ({
|
|
|
5365
5425
|
setSegmenting(false);
|
|
5366
5426
|
}
|
|
5367
5427
|
};
|
|
5368
|
-
const [workspace, setWorkspace] = (0,
|
|
5369
|
-
const [fillWorkspace, setFillWorkspace] = (0,
|
|
5370
|
-
const [skying, setSkying] = (0,
|
|
5371
|
-
const [skyStatus, setSkyStatus] = (0,
|
|
5428
|
+
const [workspace, setWorkspace] = (0, import_react30.useState)(false);
|
|
5429
|
+
const [fillWorkspace, setFillWorkspace] = (0, import_react30.useState)(false);
|
|
5430
|
+
const [skying, setSkying] = (0, import_react30.useState)(false);
|
|
5431
|
+
const [skyStatus, setSkyStatus] = (0, import_react30.useState)(null);
|
|
5372
5432
|
const selectSky = async () => {
|
|
5373
5433
|
if (skying) return;
|
|
5374
5434
|
setSkying(true);
|
|
@@ -5383,8 +5443,8 @@ var SelectionOptionsBar = ({
|
|
|
5383
5443
|
setSkying(false);
|
|
5384
5444
|
}
|
|
5385
5445
|
};
|
|
5386
|
-
const [focusing, setFocusing] = (0,
|
|
5387
|
-
const [focusStatus, setFocusStatus] = (0,
|
|
5446
|
+
const [focusing, setFocusing] = (0, import_react30.useState)(false);
|
|
5447
|
+
const [focusStatus, setFocusStatus] = (0, import_react30.useState)(null);
|
|
5388
5448
|
const selectFocusArea = async () => {
|
|
5389
5449
|
if (focusing) return;
|
|
5390
5450
|
setFocusing(true);
|
|
@@ -5405,24 +5465,24 @@ var SelectionOptionsBar = ({
|
|
|
5405
5465
|
setFocusing(false);
|
|
5406
5466
|
}
|
|
5407
5467
|
};
|
|
5408
|
-
return /* @__PURE__ */ (0,
|
|
5409
|
-
/* @__PURE__ */ (0,
|
|
5410
|
-
/* @__PURE__ */ (0,
|
|
5411
|
-
options.tool === "wand" && /* @__PURE__ */ (0,
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5413
|
-
/* @__PURE__ */ (0,
|
|
5414
|
-
/* @__PURE__ */ (0,
|
|
5415
|
-
/* @__PURE__ */ (0,
|
|
5468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5469
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.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)) }),
|
|
5470
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor17.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
5471
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Tolerance" }),
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
5416
5476
|
] }),
|
|
5417
|
-
/* @__PURE__ */ (0,
|
|
5477
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
5418
5478
|
] }),
|
|
5419
|
-
/* @__PURE__ */ (0,
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5479
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5480
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
5421
5481
|
"Contiguous"
|
|
5422
5482
|
] }),
|
|
5423
|
-
/* @__PURE__ */ (0,
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5424
5484
|
"Distance",
|
|
5425
|
-
/* @__PURE__ */ (0,
|
|
5485
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5426
5486
|
ImageSelect,
|
|
5427
5487
|
{
|
|
5428
5488
|
label: "Colour distance",
|
|
@@ -5435,13 +5495,13 @@ var SelectionOptionsBar = ({
|
|
|
5435
5495
|
}
|
|
5436
5496
|
)
|
|
5437
5497
|
] }),
|
|
5438
|
-
/* @__PURE__ */ (0,
|
|
5439
|
-
/* @__PURE__ */ (0,
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5499
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
5440
5500
|
"Sample adjusted image"
|
|
5441
5501
|
] }),
|
|
5442
|
-
/* @__PURE__ */ (0,
|
|
5502
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5443
5503
|
"Sample",
|
|
5444
|
-
/* @__PURE__ */ (0,
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5445
5505
|
ImageSelect,
|
|
5446
5506
|
{
|
|
5447
5507
|
label: "Sample from",
|
|
@@ -5455,77 +5515,77 @@ var SelectionOptionsBar = ({
|
|
|
5455
5515
|
)
|
|
5456
5516
|
] })
|
|
5457
5517
|
] }),
|
|
5458
|
-
options.tool === "polygon" && /* @__PURE__ */ (0,
|
|
5459
|
-
options.tool === "magnetic" && /* @__PURE__ */ (0,
|
|
5460
|
-
/* @__PURE__ */ (0,
|
|
5461
|
-
/* @__PURE__ */ (0,
|
|
5462
|
-
/* @__PURE__ */ (0,
|
|
5463
|
-
/* @__PURE__ */ (0,
|
|
5464
|
-
/* @__PURE__ */ (0,
|
|
5518
|
+
options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime30.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." }),
|
|
5519
|
+
options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
|
|
5520
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.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." }),
|
|
5521
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5522
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Width" }),
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5465
5525
|
options.magneticWidth ?? 10,
|
|
5466
5526
|
" px"
|
|
5467
5527
|
] })
|
|
5468
5528
|
] }),
|
|
5469
|
-
/* @__PURE__ */ (0,
|
|
5529
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
|
|
5470
5530
|
] }),
|
|
5471
|
-
/* @__PURE__ */ (0,
|
|
5472
|
-
/* @__PURE__ */ (0,
|
|
5473
|
-
/* @__PURE__ */ (0,
|
|
5474
|
-
/* @__PURE__ */ (0,
|
|
5531
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5533
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Contrast" }),
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5475
5535
|
options.magneticContrast ?? 10,
|
|
5476
5536
|
"%"
|
|
5477
5537
|
] })
|
|
5478
5538
|
] }),
|
|
5479
|
-
/* @__PURE__ */ (0,
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
|
|
5480
5540
|
] }),
|
|
5481
|
-
/* @__PURE__ */ (0,
|
|
5482
|
-
/* @__PURE__ */ (0,
|
|
5483
|
-
/* @__PURE__ */ (0,
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5541
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5542
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Frequency" }),
|
|
5544
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
|
|
5485
5545
|
] }),
|
|
5486
|
-
/* @__PURE__ */ (0,
|
|
5546
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
|
|
5487
5547
|
] })
|
|
5488
5548
|
] }),
|
|
5489
|
-
options.tool === "quick" && /* @__PURE__ */ (0,
|
|
5490
|
-
/* @__PURE__ */ (0,
|
|
5491
|
-
/* @__PURE__ */ (0,
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5494
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
|
|
5551
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5552
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5553
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Size" }),
|
|
5554
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5495
5555
|
options.quickSize ?? 30,
|
|
5496
5556
|
" px"
|
|
5497
5557
|
] })
|
|
5498
5558
|
] }),
|
|
5499
|
-
/* @__PURE__ */ (0,
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
|
|
5500
5560
|
] }),
|
|
5501
|
-
/* @__PURE__ */ (0,
|
|
5502
|
-
/* @__PURE__ */ (0,
|
|
5561
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5562
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
|
|
5503
5563
|
"Sample all layers"
|
|
5504
5564
|
] }),
|
|
5505
|
-
/* @__PURE__ */ (0,
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5565
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5566
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
|
|
5507
5567
|
"Auto-enhance edges"
|
|
5508
5568
|
] })
|
|
5509
5569
|
] }),
|
|
5510
|
-
options.tool === "object" && /* @__PURE__ */ (0,
|
|
5511
|
-
/* @__PURE__ */ (0,
|
|
5512
|
-
/* @__PURE__ */ (0,
|
|
5513
|
-
/* @__PURE__ */ (0,
|
|
5570
|
+
options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
5571
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
5514
5574
|
"Sample all layers"
|
|
5515
5575
|
] }),
|
|
5516
|
-
/* @__PURE__ */ (0,
|
|
5517
|
-
/* @__PURE__ */ (0,
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
5518
5578
|
"Auto-enhance edges"
|
|
5519
5579
|
] })
|
|
5520
5580
|
] }),
|
|
5521
|
-
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0,
|
|
5522
|
-
/* @__PURE__ */ (0,
|
|
5581
|
+
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
5582
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
5523
5583
|
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).",
|
|
5524
5584
|
" Shift-click adds, Alt-click subtracts."
|
|
5525
5585
|
] }),
|
|
5526
|
-
/* @__PURE__ */ (0,
|
|
5586
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5527
5587
|
"Text",
|
|
5528
|
-
/* @__PURE__ */ (0,
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5529
5589
|
"input",
|
|
5530
5590
|
{
|
|
5531
5591
|
type: "text",
|
|
@@ -5536,9 +5596,9 @@ var SelectionOptionsBar = ({
|
|
|
5536
5596
|
}
|
|
5537
5597
|
)
|
|
5538
5598
|
] }),
|
|
5539
|
-
/* @__PURE__ */ (0,
|
|
5599
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5540
5600
|
"Size",
|
|
5541
|
-
/* @__PURE__ */ (0,
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5542
5602
|
"input",
|
|
5543
5603
|
{
|
|
5544
5604
|
type: "number",
|
|
@@ -5552,9 +5612,9 @@ var SelectionOptionsBar = ({
|
|
|
5552
5612
|
),
|
|
5553
5613
|
"px"
|
|
5554
5614
|
] }),
|
|
5555
|
-
/* @__PURE__ */ (0,
|
|
5615
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5556
5616
|
"Font",
|
|
5557
|
-
/* @__PURE__ */ (0,
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5558
5618
|
"input",
|
|
5559
5619
|
{
|
|
5560
5620
|
type: "text",
|
|
@@ -5566,18 +5626,18 @@ var SelectionOptionsBar = ({
|
|
|
5566
5626
|
)
|
|
5567
5627
|
] })
|
|
5568
5628
|
] }),
|
|
5569
|
-
options.tool === "range" && /* @__PURE__ */ (0,
|
|
5570
|
-
/* @__PURE__ */ (0,
|
|
5571
|
-
/* @__PURE__ */ (0,
|
|
5572
|
-
/* @__PURE__ */ (0,
|
|
5573
|
-
/* @__PURE__ */ (0,
|
|
5574
|
-
/* @__PURE__ */ (0,
|
|
5629
|
+
options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
5631
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Fuzziness" }),
|
|
5634
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
5575
5635
|
] }),
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5636
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
5577
5637
|
] }),
|
|
5578
|
-
/* @__PURE__ */ (0,
|
|
5638
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5579
5639
|
"Localized radius",
|
|
5580
|
-
/* @__PURE__ */ (0,
|
|
5640
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5581
5641
|
"input",
|
|
5582
5642
|
{
|
|
5583
5643
|
type: "number",
|
|
@@ -5591,27 +5651,27 @@ var SelectionOptionsBar = ({
|
|
|
5591
5651
|
),
|
|
5592
5652
|
"px"
|
|
5593
5653
|
] }),
|
|
5594
|
-
/* @__PURE__ */ (0,
|
|
5595
|
-
/* @__PURE__ */ (0,
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5655
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
5596
5656
|
"Invert"
|
|
5597
5657
|
] }),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5659
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5600
5660
|
ImageSelect,
|
|
5601
5661
|
{
|
|
5602
5662
|
label: "Color Range preset",
|
|
5603
5663
|
value: preset,
|
|
5604
|
-
options:
|
|
5664
|
+
options: import_image_editor17.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor17.COLOR_RANGE_PRESET_LABELS[p] })),
|
|
5605
5665
|
onChange: (v) => setPreset(v)
|
|
5606
5666
|
}
|
|
5607
5667
|
),
|
|
5608
|
-
/* @__PURE__ */ (0,
|
|
5668
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
5609
5669
|
] }),
|
|
5610
|
-
rangeStatus && /* @__PURE__ */ (0,
|
|
5670
|
+
rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
5611
5671
|
] }),
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5613
5673
|
"Feather",
|
|
5614
|
-
/* @__PURE__ */ (0,
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5615
5675
|
"input",
|
|
5616
5676
|
{
|
|
5617
5677
|
type: "number",
|
|
@@ -5626,7 +5686,7 @@ var SelectionOptionsBar = ({
|
|
|
5626
5686
|
),
|
|
5627
5687
|
"px"
|
|
5628
5688
|
] }),
|
|
5629
|
-
/* @__PURE__ */ (0,
|
|
5689
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5630
5690
|
"form",
|
|
5631
5691
|
{
|
|
5632
5692
|
"data-testid": "select-subject",
|
|
@@ -5636,8 +5696,8 @@ var SelectionOptionsBar = ({
|
|
|
5636
5696
|
void selectSubject();
|
|
5637
5697
|
},
|
|
5638
5698
|
children: [
|
|
5639
|
-
/* @__PURE__ */ (0,
|
|
5640
|
-
controller.segmentationProvider && /* @__PURE__ */ (0,
|
|
5699
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
|
|
5700
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5641
5701
|
"input",
|
|
5642
5702
|
{
|
|
5643
5703
|
type: "text",
|
|
@@ -5649,7 +5709,7 @@ var SelectionOptionsBar = ({
|
|
|
5649
5709
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
5650
5710
|
}
|
|
5651
5711
|
),
|
|
5652
|
-
/* @__PURE__ */ (0,
|
|
5712
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5653
5713
|
"button",
|
|
5654
5714
|
{
|
|
5655
5715
|
type: "submit",
|
|
@@ -5661,12 +5721,12 @@ var SelectionOptionsBar = ({
|
|
|
5661
5721
|
}
|
|
5662
5722
|
)
|
|
5663
5723
|
] }),
|
|
5664
|
-
subjectStatus && /* @__PURE__ */ (0,
|
|
5724
|
+
subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
5665
5725
|
]
|
|
5666
5726
|
}
|
|
5667
5727
|
),
|
|
5668
|
-
task && /* @__PURE__ */ (0,
|
|
5669
|
-
/* @__PURE__ */ (0,
|
|
5728
|
+
task && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
|
|
5729
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5670
5730
|
"div",
|
|
5671
5731
|
{
|
|
5672
5732
|
role: "progressbar",
|
|
@@ -5675,69 +5735,69 @@ var SelectionOptionsBar = ({
|
|
|
5675
5735
|
"aria-valuemax": 100,
|
|
5676
5736
|
"aria-valuenow": Math.round(task.fraction * 100),
|
|
5677
5737
|
className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
|
|
5678
|
-
children: /* @__PURE__ */ (0,
|
|
5738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
|
|
5679
5739
|
}
|
|
5680
5740
|
),
|
|
5681
|
-
/* @__PURE__ */ (0,
|
|
5682
|
-
/* @__PURE__ */ (0,
|
|
5741
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: task.stage }),
|
|
5742
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
|
|
5683
5743
|
] }),
|
|
5684
|
-
/* @__PURE__ */ (0,
|
|
5685
|
-
workspace && /* @__PURE__ */ (0,
|
|
5686
|
-
/* @__PURE__ */ (0,
|
|
5687
|
-
/* @__PURE__ */ (0,
|
|
5688
|
-
skyStatus && /* @__PURE__ */ (0,
|
|
5744
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
|
|
5745
|
+
workspace && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
|
|
5748
|
+
skyStatus && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
|
|
5689
5749
|
] }),
|
|
5690
|
-
/* @__PURE__ */ (0,
|
|
5691
|
-
/* @__PURE__ */ (0,
|
|
5692
|
-
/* @__PURE__ */ (0,
|
|
5693
|
-
/* @__PURE__ */ (0,
|
|
5694
|
-
/* @__PURE__ */ (0,
|
|
5695
|
-
/* @__PURE__ */ (0,
|
|
5696
|
-
/* @__PURE__ */ (0,
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "In-focus range" }),
|
|
5756
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
5697
5757
|
] }),
|
|
5698
|
-
/* @__PURE__ */ (0,
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
5699
5759
|
] }),
|
|
5700
|
-
/* @__PURE__ */ (0,
|
|
5701
|
-
/* @__PURE__ */ (0,
|
|
5702
|
-
/* @__PURE__ */ (0,
|
|
5703
|
-
/* @__PURE__ */ (0,
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5762
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Image noise level" }),
|
|
5763
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
5704
5764
|
] }),
|
|
5705
|
-
/* @__PURE__ */ (0,
|
|
5765
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
5706
5766
|
] }),
|
|
5707
|
-
/* @__PURE__ */ (0,
|
|
5708
|
-
/* @__PURE__ */ (0,
|
|
5709
|
-
/* @__PURE__ */ (0,
|
|
5710
|
-
/* @__PURE__ */ (0,
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5769
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Soften edge" }),
|
|
5770
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5711
5771
|
options.focusSoftness ?? 4,
|
|
5712
5772
|
" px"
|
|
5713
5773
|
] })
|
|
5714
5774
|
] }),
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
5716
5776
|
] }),
|
|
5717
|
-
/* @__PURE__ */ (0,
|
|
5718
|
-
focusStatus && /* @__PURE__ */ (0,
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
5778
|
+
focusStatus && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
5719
5779
|
] })
|
|
5720
5780
|
] }),
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5781
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5782
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
5723
5783
|
"Anti-alias"
|
|
5724
5784
|
] }),
|
|
5725
|
-
/* @__PURE__ */ (0,
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
5727
|
-
/* @__PURE__ */ (0,
|
|
5728
|
-
/* @__PURE__ */ (0,
|
|
5729
|
-
/* @__PURE__ */ (0,
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5731
|
-
/* @__PURE__ */ (0,
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
5789
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.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" }),
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.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" })
|
|
5732
5792
|
] }),
|
|
5733
|
-
/* @__PURE__ */ (0,
|
|
5734
|
-
/* @__PURE__ */ (0,
|
|
5735
|
-
DISPLAYS.map((d) => /* @__PURE__ */ (0,
|
|
5793
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5794
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
|
|
5795
|
+
DISPLAYS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
5736
5796
|
] }),
|
|
5737
|
-
/* @__PURE__ */ (0,
|
|
5738
|
-
/* @__PURE__ */ (0,
|
|
5797
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
5798
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5739
5799
|
"Radius",
|
|
5740
|
-
/* @__PURE__ */ (0,
|
|
5800
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5741
5801
|
"input",
|
|
5742
5802
|
{
|
|
5743
5803
|
type: "number",
|
|
@@ -5751,12 +5811,12 @@ var SelectionOptionsBar = ({
|
|
|
5751
5811
|
}
|
|
5752
5812
|
)
|
|
5753
5813
|
] }),
|
|
5754
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
5814
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
5755
5815
|
] }),
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
5757
|
-
/* @__PURE__ */ (0,
|
|
5816
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
5817
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5758
5818
|
"Stroke",
|
|
5759
|
-
/* @__PURE__ */ (0,
|
|
5819
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5760
5820
|
"input",
|
|
5761
5821
|
{
|
|
5762
5822
|
type: "number",
|
|
@@ -5771,7 +5831,7 @@ var SelectionOptionsBar = ({
|
|
|
5771
5831
|
),
|
|
5772
5832
|
"px"
|
|
5773
5833
|
] }),
|
|
5774
|
-
/* @__PURE__ */ (0,
|
|
5834
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5775
5835
|
ImageSelect,
|
|
5776
5836
|
{
|
|
5777
5837
|
label: "Stroke location",
|
|
@@ -5784,39 +5844,40 @@ var SelectionOptionsBar = ({
|
|
|
5784
5844
|
onChange: (v) => setStrokeLocation(v)
|
|
5785
5845
|
}
|
|
5786
5846
|
),
|
|
5787
|
-
/* @__PURE__ */ (0,
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
5790
|
-
/* @__PURE__ */ (0,
|
|
5791
|
-
fillWorkspace && /* @__PURE__ */ (0,
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
5848
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
5849
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
|
|
5850
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
|
|
5851
|
+
fillWorkspace && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
|
|
5792
5852
|
] }),
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
5795
|
-
/* @__PURE__ */ (0,
|
|
5796
|
-
/* @__PURE__ */ (0,
|
|
5797
|
-
/* @__PURE__ */ (0,
|
|
5798
|
-
/* @__PURE__ */ (0,
|
|
5799
|
-
/* @__PURE__ */ (0,
|
|
5800
|
-
/* @__PURE__ */ (0,
|
|
5853
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
5854
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
5855
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
5856
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
5801
5861
|
] }),
|
|
5802
|
-
colorStatus && /* @__PURE__ */ (0,
|
|
5803
|
-
/* @__PURE__ */ (0,
|
|
5862
|
+
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor17.describeSelection)(sel) }),
|
|
5864
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SelectionRecipePanel, { controller, selection: sel })
|
|
5804
5865
|
] });
|
|
5805
5866
|
};
|
|
5806
5867
|
|
|
5807
5868
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5808
|
-
var
|
|
5809
|
-
var
|
|
5869
|
+
var import_react34 = require("react");
|
|
5870
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5810
5871
|
|
|
5811
5872
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
5812
|
-
var
|
|
5813
|
-
var
|
|
5814
|
-
var
|
|
5815
|
-
var
|
|
5873
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
5874
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5875
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5876
|
+
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";
|
|
5816
5877
|
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
5817
5878
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5818
|
-
const [result, setResult] = (0,
|
|
5819
|
-
const [error, setError] = (0,
|
|
5879
|
+
const [result, setResult] = (0, import_react31.useState)(null);
|
|
5880
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
5820
5881
|
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
5821
5882
|
const check = () => {
|
|
5822
5883
|
setError(null);
|
|
@@ -5827,42 +5888,42 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
5827
5888
|
setError(err instanceof Error ? err.message : String(err));
|
|
5828
5889
|
}
|
|
5829
5890
|
};
|
|
5830
|
-
const T =
|
|
5891
|
+
const T = import_image_editor18.MASK_EDGE_THRESHOLDS;
|
|
5831
5892
|
const rows = report ? [
|
|
5832
5893
|
{ label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
|
|
5833
5894
|
{ label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
|
|
5834
5895
|
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
5835
5896
|
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
5836
5897
|
] : [];
|
|
5837
|
-
return /* @__PURE__ */ (0,
|
|
5838
|
-
/* @__PURE__ */ (0,
|
|
5839
|
-
report && /* @__PURE__ */ (0,
|
|
5840
|
-
/* @__PURE__ */ (0,
|
|
5841
|
-
rows.map((r) => /* @__PURE__ */ (0,
|
|
5842
|
-
/* @__PURE__ */ (0,
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
5899
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: `${button5} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
5900
|
+
report && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
5901
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
5902
|
+
rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react31.default.Fragment, { children: [
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("dt", { className: "text-muted-foreground", children: r.label }),
|
|
5904
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
5844
5905
|
] }, r.label)),
|
|
5845
|
-
/* @__PURE__ */ (0,
|
|
5846
|
-
/* @__PURE__ */ (0,
|
|
5906
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
5907
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
5847
5908
|
report.holes.count,
|
|
5848
5909
|
" / ",
|
|
5849
5910
|
report.islands.count
|
|
5850
5911
|
] })
|
|
5851
5912
|
] }),
|
|
5852
|
-
report.issues.length ? /* @__PURE__ */ (0,
|
|
5913
|
+
report.issues.length ? /* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.jsx)("li", { children: s }, s)) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
5853
5914
|
] }),
|
|
5854
|
-
error && /* @__PURE__ */ (0,
|
|
5915
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5855
5916
|
] });
|
|
5856
5917
|
};
|
|
5857
5918
|
|
|
5858
5919
|
// src/image-editor/SelectionChangeCheck.tsx
|
|
5859
|
-
var
|
|
5860
|
-
var
|
|
5861
|
-
var
|
|
5920
|
+
var import_react32 = require("react");
|
|
5921
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5922
|
+
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";
|
|
5862
5923
|
var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
5863
5924
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5864
|
-
const [result, setResult] = (0,
|
|
5865
|
-
const [error, setError] = (0,
|
|
5925
|
+
const [result, setResult] = (0, import_react32.useState)(null);
|
|
5926
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
5866
5927
|
const diff = result && result.for === sel ? result.diff : null;
|
|
5867
5928
|
const show = () => {
|
|
5868
5929
|
setError(null);
|
|
@@ -5873,16 +5934,16 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
5873
5934
|
setError(err instanceof Error ? err.message : String(err));
|
|
5874
5935
|
}
|
|
5875
5936
|
};
|
|
5876
|
-
return /* @__PURE__ */ (0,
|
|
5877
|
-
/* @__PURE__ */ (0,
|
|
5878
|
-
diff && /* @__PURE__ */ (0,
|
|
5879
|
-
/* @__PURE__ */ (0,
|
|
5937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: `${button6} self-start`, onClick: show, children: "Show Last Change" }),
|
|
5939
|
+
diff && /* @__PURE__ */ (0, import_jsx_runtime32.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_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
5940
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-green-600", children: [
|
|
5880
5941
|
"+",
|
|
5881
5942
|
diff.added.area,
|
|
5882
5943
|
" px"
|
|
5883
5944
|
] }),
|
|
5884
5945
|
" ",
|
|
5885
|
-
/* @__PURE__ */ (0,
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-destructive", children: [
|
|
5886
5947
|
"\u2212",
|
|
5887
5948
|
diff.removed.area,
|
|
5888
5949
|
" px"
|
|
@@ -5891,21 +5952,21 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
5891
5952
|
Math.round(diff.iou * 100),
|
|
5892
5953
|
"%"
|
|
5893
5954
|
] }) }),
|
|
5894
|
-
error && /* @__PURE__ */ (0,
|
|
5955
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5895
5956
|
] });
|
|
5896
5957
|
};
|
|
5897
5958
|
|
|
5898
5959
|
// src/image-editor/SeparateSubjectPanel.tsx
|
|
5899
|
-
var
|
|
5900
|
-
var
|
|
5901
|
-
var
|
|
5960
|
+
var import_react33 = require("react");
|
|
5961
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5962
|
+
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";
|
|
5902
5963
|
var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
5903
5964
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5904
|
-
const [dilate, setDilate] = (0,
|
|
5905
|
-
const [fill, setFill] = (0,
|
|
5906
|
-
const [progress, setProgress] = (0,
|
|
5907
|
-
const [error, setError] = (0,
|
|
5908
|
-
const abort = (0,
|
|
5965
|
+
const [dilate, setDilate] = (0, import_react33.useState)(8);
|
|
5966
|
+
const [fill, setFill] = (0, import_react33.useState)(true);
|
|
5967
|
+
const [progress, setProgress] = (0, import_react33.useState)(null);
|
|
5968
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
5969
|
+
const abort = (0, import_react33.useRef)(null);
|
|
5909
5970
|
const run = async () => {
|
|
5910
5971
|
setError(null);
|
|
5911
5972
|
abort.current = new AbortController();
|
|
@@ -5924,13 +5985,13 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
5924
5985
|
setProgress(null);
|
|
5925
5986
|
}
|
|
5926
5987
|
};
|
|
5927
|
-
return /* @__PURE__ */ (0,
|
|
5928
|
-
/* @__PURE__ */ (0,
|
|
5929
|
-
/* @__PURE__ */ (0,
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
5931
|
-
/* @__PURE__ */ (0,
|
|
5988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
5989
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
|
|
5990
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
|
|
5991
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5992
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5932
5993
|
"Grow",
|
|
5933
|
-
/* @__PURE__ */ (0,
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5934
5995
|
"input",
|
|
5935
5996
|
{
|
|
5936
5997
|
type: "number",
|
|
@@ -5944,34 +6005,34 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
|
5944
6005
|
),
|
|
5945
6006
|
"px"
|
|
5946
6007
|
] }),
|
|
5947
|
-
/* @__PURE__ */ (0,
|
|
5948
|
-
/* @__PURE__ */ (0,
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
6009
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
|
|
5949
6010
|
"Fill the background"
|
|
5950
6011
|
] })
|
|
5951
6012
|
] }),
|
|
5952
|
-
/* @__PURE__ */ (0,
|
|
5953
|
-
/* @__PURE__ */ (0,
|
|
5954
|
-
progress !== null && /* @__PURE__ */ (0,
|
|
6013
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-1", children: [
|
|
6014
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button7, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
|
|
6015
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button7, onClick: () => abort.current?.abort(), children: "Cancel" })
|
|
5955
6016
|
] }),
|
|
5956
|
-
progress !== null && /* @__PURE__ */ (0,
|
|
5957
|
-
error && /* @__PURE__ */ (0,
|
|
6017
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "status", className: "text-muted-foreground", children: progress }),
|
|
6018
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5958
6019
|
] });
|
|
5959
6020
|
};
|
|
5960
6021
|
|
|
5961
6022
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5962
|
-
var
|
|
6023
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5963
6024
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5964
|
-
var
|
|
6025
|
+
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";
|
|
5965
6026
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
5966
|
-
const [params, setParams] = (0,
|
|
5967
|
-
const [busy, setBusy] = (0,
|
|
5968
|
-
const [error, setError] = (0,
|
|
5969
|
-
const [layerId, setLayerId] = (0,
|
|
5970
|
-
const [newKind, setNewKind] = (0,
|
|
5971
|
-
const [output, setOutput] = (0,
|
|
5972
|
-
const [decontaminate, setDecontaminate] = (0,
|
|
5973
|
-
const [objectAware, setObjectAware] = (0,
|
|
5974
|
-
const [onlyUncertain, setOnlyUncertain] = (0,
|
|
6027
|
+
const [params, setParams] = (0, import_react34.useState)(DEFAULT_PARAMS);
|
|
6028
|
+
const [busy, setBusy] = (0, import_react34.useState)(false);
|
|
6029
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
6030
|
+
const [layerId, setLayerId] = (0, import_react34.useState)("");
|
|
6031
|
+
const [newKind, setNewKind] = (0, import_react34.useState)("hueSaturation");
|
|
6032
|
+
const [output, setOutput] = (0, import_react34.useState)("selection");
|
|
6033
|
+
const [decontaminate, setDecontaminate] = (0, import_react34.useState)(0);
|
|
6034
|
+
const [objectAware, setObjectAware] = (0, import_react34.useState)(false);
|
|
6035
|
+
const [onlyUncertain, setOnlyUncertain] = (0, import_react34.useState)(false);
|
|
5975
6036
|
const canObject = Boolean(controller.segmentationProvider);
|
|
5976
6037
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
5977
6038
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -5994,17 +6055,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5994
6055
|
setBusy(false);
|
|
5995
6056
|
}
|
|
5996
6057
|
};
|
|
5997
|
-
return /* @__PURE__ */ (0,
|
|
5998
|
-
/* @__PURE__ */ (0,
|
|
5999
|
-
|
|
6000
|
-
/* @__PURE__ */ (0,
|
|
6001
|
-
/* @__PURE__ */ (0,
|
|
6002
|
-
/* @__PURE__ */ (0,
|
|
6058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
6059
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
6060
|
+
import_image_editor19.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6061
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6062
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: c.label }),
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
6003
6064
|
params[c.id],
|
|
6004
6065
|
c.unit
|
|
6005
6066
|
] })
|
|
6006
6067
|
] }),
|
|
6007
|
-
/* @__PURE__ */ (0,
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6008
6069
|
"input",
|
|
6009
6070
|
{
|
|
6010
6071
|
type: "range",
|
|
@@ -6018,43 +6079,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6018
6079
|
}
|
|
6019
6080
|
)
|
|
6020
6081
|
] }, c.id)),
|
|
6021
|
-
/* @__PURE__ */ (0,
|
|
6022
|
-
/* @__PURE__ */ (0,
|
|
6082
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
6083
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
6023
6084
|
"Smart Radius"
|
|
6024
6085
|
] }),
|
|
6025
|
-
/* @__PURE__ */ (0,
|
|
6026
|
-
/* @__PURE__ */ (0,
|
|
6086
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
6087
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
6027
6088
|
"Only uncertain areas"
|
|
6028
6089
|
] }),
|
|
6029
|
-
canObject && /* @__PURE__ */ (0,
|
|
6030
|
-
/* @__PURE__ */ (0,
|
|
6090
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
6091
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
6031
6092
|
"Object aware (segmentation model)"
|
|
6032
6093
|
] }),
|
|
6033
|
-
/* @__PURE__ */ (0,
|
|
6094
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
6034
6095
|
"Output to",
|
|
6035
|
-
/* @__PURE__ */ (0,
|
|
6096
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6036
6097
|
"select",
|
|
6037
6098
|
{
|
|
6038
6099
|
"aria-label": "Refine output",
|
|
6039
6100
|
value: output,
|
|
6040
6101
|
onChange: (e) => setOutput(e.target.value),
|
|
6041
6102
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6042
|
-
children:
|
|
6103
|
+
children: import_image_editor19.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
6043
6104
|
}
|
|
6044
6105
|
)
|
|
6045
6106
|
] }),
|
|
6046
|
-
/* @__PURE__ */ (0,
|
|
6047
|
-
/* @__PURE__ */ (0,
|
|
6048
|
-
/* @__PURE__ */ (0,
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6108
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6109
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
|
|
6049
6110
|
"Decontaminate colors",
|
|
6050
6111
|
toLayer ? "" : " (new layer or document outputs)"
|
|
6051
6112
|
] }),
|
|
6052
|
-
/* @__PURE__ */ (0,
|
|
6113
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
6053
6114
|
decontaminate,
|
|
6054
6115
|
"%"
|
|
6055
6116
|
] })
|
|
6056
6117
|
] }),
|
|
6057
|
-
/* @__PURE__ */ (0,
|
|
6118
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6058
6119
|
"input",
|
|
6059
6120
|
{
|
|
6060
6121
|
type: "range",
|
|
@@ -6069,66 +6130,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6069
6130
|
}
|
|
6070
6131
|
)
|
|
6071
6132
|
] }),
|
|
6072
|
-
/* @__PURE__ */ (0,
|
|
6073
|
-
/* @__PURE__ */ (0,
|
|
6074
|
-
/* @__PURE__ */ (0,
|
|
6133
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", children: [
|
|
6134
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button8, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
6135
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button8, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
6075
6136
|
] }),
|
|
6076
|
-
error && /* @__PURE__ */ (0,
|
|
6077
|
-
/* @__PURE__ */ (0,
|
|
6078
|
-
/* @__PURE__ */ (0,
|
|
6079
|
-
/* @__PURE__ */ (0,
|
|
6080
|
-
/* @__PURE__ */ (0,
|
|
6081
|
-
/* @__PURE__ */ (0,
|
|
6082
|
-
/* @__PURE__ */ (0,
|
|
6137
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
6138
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(MaskEdgeCheck, { controller, selection: sel }),
|
|
6139
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectionChangeCheck, { controller, selection: sel }),
|
|
6140
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
|
|
6141
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
6142
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
6143
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6083
6144
|
"select",
|
|
6084
6145
|
{
|
|
6085
6146
|
"aria-label": "New masked layer kind",
|
|
6086
6147
|
value: newKind,
|
|
6087
6148
|
onChange: (e) => setNewKind(e.target.value),
|
|
6088
6149
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6089
|
-
children:
|
|
6150
|
+
children: import_image_editor19.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
6090
6151
|
}
|
|
6091
6152
|
),
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6153
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6093
6154
|
"button",
|
|
6094
6155
|
{
|
|
6095
6156
|
type: "button",
|
|
6096
|
-
className:
|
|
6157
|
+
className: button8,
|
|
6097
6158
|
disabled: !sel,
|
|
6098
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
6159
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor19.layerMaskFromSelection)(sel) })),
|
|
6099
6160
|
children: "New Masked Layer"
|
|
6100
6161
|
}
|
|
6101
6162
|
)
|
|
6102
6163
|
] }),
|
|
6103
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
6104
|
-
/* @__PURE__ */ (0,
|
|
6164
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
6165
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6105
6166
|
"select",
|
|
6106
6167
|
{
|
|
6107
6168
|
"aria-label": "Mask layer",
|
|
6108
6169
|
value: target.id,
|
|
6109
6170
|
onChange: (e) => setLayerId(e.target.value),
|
|
6110
6171
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
6111
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
6112
|
-
l.name || (0,
|
|
6172
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("option", { value: l.id, children: [
|
|
6173
|
+
l.name || (0, import_image_editor19.adjustmentKindLabel)(l.kind),
|
|
6113
6174
|
l.mask ? " (masked)" : ""
|
|
6114
6175
|
] }, l.id))
|
|
6115
6176
|
}
|
|
6116
6177
|
),
|
|
6117
|
-
/* @__PURE__ */ (0,
|
|
6118
|
-
/* @__PURE__ */ (0,
|
|
6119
|
-
/* @__PURE__ */ (0,
|
|
6120
|
-
/* @__PURE__ */ (0,
|
|
6178
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6179
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button8, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
6180
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button8, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
6181
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button8, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
6121
6182
|
] }),
|
|
6122
|
-
target.mask && /* @__PURE__ */ (0,
|
|
6123
|
-
/* @__PURE__ */ (0,
|
|
6124
|
-
/* @__PURE__ */ (0,
|
|
6125
|
-
/* @__PURE__ */ (0,
|
|
6126
|
-
/* @__PURE__ */ (0,
|
|
6183
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6184
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6185
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6186
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Density" }),
|
|
6187
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
6127
6188
|
Math.round((target.mask.density ?? 1) * 100),
|
|
6128
6189
|
"%"
|
|
6129
6190
|
] })
|
|
6130
6191
|
] }),
|
|
6131
|
-
/* @__PURE__ */ (0,
|
|
6192
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6132
6193
|
"input",
|
|
6133
6194
|
{
|
|
6134
6195
|
type: "range",
|
|
@@ -6142,15 +6203,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6142
6203
|
}
|
|
6143
6204
|
)
|
|
6144
6205
|
] }),
|
|
6145
|
-
/* @__PURE__ */ (0,
|
|
6146
|
-
/* @__PURE__ */ (0,
|
|
6147
|
-
/* @__PURE__ */ (0,
|
|
6148
|
-
/* @__PURE__ */ (0,
|
|
6206
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6207
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Mask Feather" }),
|
|
6209
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
6149
6210
|
target.mask.feather ?? 0,
|
|
6150
6211
|
"px"
|
|
6151
6212
|
] })
|
|
6152
6213
|
] }),
|
|
6153
|
-
/* @__PURE__ */ (0,
|
|
6214
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6154
6215
|
"input",
|
|
6155
6216
|
{
|
|
6156
6217
|
type: "range",
|
|
@@ -6170,32 +6231,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6170
6231
|
};
|
|
6171
6232
|
|
|
6172
6233
|
// src/image-editor/ChannelsPanel.tsx
|
|
6173
|
-
var
|
|
6174
|
-
var
|
|
6175
|
-
var
|
|
6234
|
+
var import_react35 = require("react");
|
|
6235
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
6236
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6176
6237
|
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"}`;
|
|
6177
6238
|
var ChannelThumb = ({ channel, size }) => {
|
|
6178
|
-
const ref = (0,
|
|
6179
|
-
(0,
|
|
6239
|
+
const ref = (0, import_react35.useRef)(null);
|
|
6240
|
+
(0, import_react35.useEffect)(() => {
|
|
6180
6241
|
const canvas = ref.current;
|
|
6181
6242
|
const ctx = canvas?.getContext("2d");
|
|
6182
6243
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
6183
|
-
const px = (0,
|
|
6244
|
+
const px = (0, import_image_editor20.channelThumbnail)(channel, 64);
|
|
6184
6245
|
canvas.width = px.width;
|
|
6185
6246
|
canvas.height = px.height;
|
|
6186
6247
|
const img = ctx.createImageData(px.width, px.height);
|
|
6187
6248
|
img.data.set(px.data);
|
|
6188
6249
|
ctx.putImageData(img, 0, 0);
|
|
6189
6250
|
}, [channel.mask]);
|
|
6190
|
-
return /* @__PURE__ */ (0,
|
|
6251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
6191
6252
|
};
|
|
6192
6253
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
6193
|
-
const [, setTick] = (0,
|
|
6194
|
-
(0,
|
|
6195
|
-
const [activeId, setActiveId] = (0,
|
|
6196
|
-
const [renaming, setRenaming] = (0,
|
|
6197
|
-
const [error, setError] = (0,
|
|
6198
|
-
const fileInput = (0,
|
|
6254
|
+
const [, setTick] = (0, import_react35.useState)(0);
|
|
6255
|
+
(0, import_react35.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6256
|
+
const [activeId, setActiveId] = (0, import_react35.useState)(null);
|
|
6257
|
+
const [renaming, setRenaming] = (0, import_react35.useState)(null);
|
|
6258
|
+
const [error, setError] = (0, import_react35.useState)(null);
|
|
6259
|
+
const fileInput = (0, import_react35.useRef)(null);
|
|
6199
6260
|
const channels = controller.getChannels();
|
|
6200
6261
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
6201
6262
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -6212,18 +6273,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6212
6273
|
if (!file) return;
|
|
6213
6274
|
setError(null);
|
|
6214
6275
|
try {
|
|
6215
|
-
setActiveId((await (0,
|
|
6276
|
+
setActiveId((await (0, import_image_editor20.openMaskFile)(controller, file)).id);
|
|
6216
6277
|
} catch (err) {
|
|
6217
6278
|
setError(err instanceof Error ? err.message : String(err));
|
|
6218
6279
|
}
|
|
6219
6280
|
};
|
|
6220
|
-
return /* @__PURE__ */ (0,
|
|
6221
|
-
/* @__PURE__ */ (0,
|
|
6222
|
-
/* @__PURE__ */ (0,
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
6282
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6283
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
6284
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.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" })
|
|
6224
6285
|
] }),
|
|
6225
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
6226
|
-
/* @__PURE__ */ (0,
|
|
6286
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6227
6288
|
"li",
|
|
6228
6289
|
{
|
|
6229
6290
|
"data-testid": "channel-row",
|
|
@@ -6231,11 +6292,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6231
6292
|
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
6232
6293
|
onClick: (e) => {
|
|
6233
6294
|
setActiveId(c.id);
|
|
6234
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
6295
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") }));
|
|
6235
6296
|
},
|
|
6236
6297
|
onDoubleClick: () => setRenaming(c.id),
|
|
6237
6298
|
children: [
|
|
6238
|
-
/* @__PURE__ */ (0,
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6239
6300
|
"button",
|
|
6240
6301
|
{
|
|
6241
6302
|
type: "button",
|
|
@@ -6249,8 +6310,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6249
6310
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
6250
6311
|
}
|
|
6251
6312
|
),
|
|
6252
|
-
/* @__PURE__ */ (0,
|
|
6253
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
6313
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
6314
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6254
6315
|
"input",
|
|
6255
6316
|
{
|
|
6256
6317
|
autoFocus: true,
|
|
@@ -6267,16 +6328,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6267
6328
|
if (e.key === "Escape") setRenaming(null);
|
|
6268
6329
|
}
|
|
6269
6330
|
}
|
|
6270
|
-
) : /* @__PURE__ */ (0,
|
|
6331
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
6271
6332
|
]
|
|
6272
6333
|
},
|
|
6273
6334
|
c.id
|
|
6274
6335
|
)) }),
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6276
|
-
/* @__PURE__ */ (0,
|
|
6277
|
-
/* @__PURE__ */ (0,
|
|
6278
|
-
/* @__PURE__ */ (0,
|
|
6279
|
-
/* @__PURE__ */ (0,
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6337
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
6338
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.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" }),
|
|
6339
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
6340
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6280
6341
|
"button",
|
|
6281
6342
|
{
|
|
6282
6343
|
type: "button",
|
|
@@ -6289,24 +6350,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6289
6350
|
children: "Delete"
|
|
6290
6351
|
}
|
|
6291
6352
|
),
|
|
6292
|
-
/* @__PURE__ */ (0,
|
|
6293
|
-
/* @__PURE__ */ (0,
|
|
6353
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
6354
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6294
6355
|
"button",
|
|
6295
6356
|
{
|
|
6296
6357
|
type: "button",
|
|
6297
6358
|
className: btn2(),
|
|
6298
6359
|
disabled: !active && !hasSelection,
|
|
6299
6360
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
6300
|
-
onClick: () => attempt(() => (0,
|
|
6361
|
+
onClick: () => attempt(() => (0, import_image_editor20.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
6301
6362
|
children: "Export PNG"
|
|
6302
6363
|
}
|
|
6303
6364
|
),
|
|
6304
|
-
/* @__PURE__ */ (0,
|
|
6365
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6305
6366
|
"input",
|
|
6306
6367
|
{
|
|
6307
6368
|
ref: fileInput,
|
|
6308
6369
|
type: "file",
|
|
6309
|
-
accept:
|
|
6370
|
+
accept: import_image_editor20.MASK_FILE_ACCEPT,
|
|
6310
6371
|
hidden: true,
|
|
6311
6372
|
"data-testid": "channel-import-input",
|
|
6312
6373
|
onChange: (e) => {
|
|
@@ -6316,22 +6377,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6316
6377
|
}
|
|
6317
6378
|
)
|
|
6318
6379
|
] }),
|
|
6319
|
-
error && /* @__PURE__ */ (0,
|
|
6380
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6320
6381
|
] });
|
|
6321
6382
|
};
|
|
6322
6383
|
|
|
6323
6384
|
// src/image-editor/PathsPanel.tsx
|
|
6324
|
-
var
|
|
6325
|
-
var
|
|
6326
|
-
var
|
|
6385
|
+
var import_react36 = require("react");
|
|
6386
|
+
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
6387
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6327
6388
|
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"}`;
|
|
6328
6389
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
6329
|
-
const [, setTick] = (0,
|
|
6330
|
-
(0,
|
|
6331
|
-
const [renaming, setRenaming] = (0,
|
|
6332
|
-
const [color, setColor] = (0,
|
|
6333
|
-
const [width, setWidth] = (0,
|
|
6334
|
-
const [error, setError] = (0,
|
|
6390
|
+
const [, setTick] = (0, import_react36.useState)(0);
|
|
6391
|
+
(0, import_react36.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6392
|
+
const [renaming, setRenaming] = (0, import_react36.useState)(null);
|
|
6393
|
+
const [color, setColor] = (0, import_react36.useState)("#000000");
|
|
6394
|
+
const [width, setWidth] = (0, import_react36.useState)(2);
|
|
6395
|
+
const [error, setError] = (0, import_react36.useState)(null);
|
|
6335
6396
|
const paths = controller.getPaths();
|
|
6336
6397
|
const activeId = controller.getState().activePathId ?? null;
|
|
6337
6398
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -6347,10 +6408,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6347
6408
|
};
|
|
6348
6409
|
return (
|
|
6349
6410
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
6350
|
-
/* @__PURE__ */ (0,
|
|
6351
|
-
/* @__PURE__ */ (0,
|
|
6352
|
-
paths.length === 0 && /* @__PURE__ */ (0,
|
|
6353
|
-
/* @__PURE__ */ (0,
|
|
6411
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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: [
|
|
6412
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
6413
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.jsxs)(
|
|
6354
6415
|
"li",
|
|
6355
6416
|
{
|
|
6356
6417
|
"data-testid": "path-row",
|
|
@@ -6359,8 +6420,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6359
6420
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6360
6421
|
onDoubleClick: () => setRenaming(p.id),
|
|
6361
6422
|
children: [
|
|
6362
|
-
/* @__PURE__ */ (0,
|
|
6363
|
-
renaming === p.id ? /* @__PURE__ */ (0,
|
|
6423
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.jsx)("path", { d: (0, import_image_editor21.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6424
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6364
6425
|
"input",
|
|
6365
6426
|
{
|
|
6366
6427
|
autoFocus: true,
|
|
@@ -6379,32 +6440,32 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6379
6440
|
if (e.key === "Escape") setRenaming(null);
|
|
6380
6441
|
}
|
|
6381
6442
|
}
|
|
6382
|
-
) : /* @__PURE__ */ (0,
|
|
6443
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
6383
6444
|
]
|
|
6384
6445
|
},
|
|
6385
6446
|
p.id
|
|
6386
6447
|
)) }),
|
|
6387
|
-
/* @__PURE__ */ (0,
|
|
6388
|
-
/* @__PURE__ */ (0,
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6449
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6389
6450
|
"button",
|
|
6390
6451
|
{
|
|
6391
6452
|
type: "button",
|
|
6392
6453
|
className: btn3(),
|
|
6393
6454
|
disabled: !active,
|
|
6394
6455
|
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
6395
|
-
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0,
|
|
6456
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor21.selectionModeFromModifiers)(e, "replace") })),
|
|
6396
6457
|
children: "Load as Selection"
|
|
6397
6458
|
}
|
|
6398
6459
|
),
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6400
|
-
active?.work && /* @__PURE__ */ (0,
|
|
6401
|
-
/* @__PURE__ */ (0,
|
|
6460
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
6461
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
6462
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
6402
6463
|
] }),
|
|
6403
|
-
/* @__PURE__ */ (0,
|
|
6404
|
-
/* @__PURE__ */ (0,
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6406
|
-
/* @__PURE__ */ (0,
|
|
6407
|
-
/* @__PURE__ */ (0,
|
|
6464
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6465
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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" }),
|
|
6466
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
6467
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6408
6469
|
"input",
|
|
6409
6470
|
{
|
|
6410
6471
|
type: "number",
|
|
@@ -6419,25 +6480,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6419
6480
|
),
|
|
6420
6481
|
"px"
|
|
6421
6482
|
] }),
|
|
6422
|
-
/* @__PURE__ */ (0,
|
|
6483
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
6423
6484
|
] }),
|
|
6424
|
-
/* @__PURE__ */ (0,
|
|
6425
|
-
/* @__PURE__ */ (0,
|
|
6426
|
-
/* @__PURE__ */ (0,
|
|
6485
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6486
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
6487
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
6427
6488
|
] }),
|
|
6428
|
-
error && /* @__PURE__ */ (0,
|
|
6489
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6429
6490
|
] })
|
|
6430
6491
|
);
|
|
6431
6492
|
};
|
|
6432
6493
|
|
|
6433
6494
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
6434
|
-
var
|
|
6435
|
-
var
|
|
6436
|
-
var
|
|
6495
|
+
var import_react37 = require("react");
|
|
6496
|
+
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
6497
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6437
6498
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
6438
6499
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
6439
|
-
const [, setTick] = (0,
|
|
6440
|
-
(0,
|
|
6500
|
+
const [, setTick] = (0, import_react37.useState)(0);
|
|
6501
|
+
(0, import_react37.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
6441
6502
|
const bar = tool.bar();
|
|
6442
6503
|
if (!tool.active || !bar) return null;
|
|
6443
6504
|
const warp = tool.warpBar();
|
|
@@ -6449,17 +6510,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6449
6510
|
const v = Number(raw);
|
|
6450
6511
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
6451
6512
|
};
|
|
6452
|
-
return /* @__PURE__ */ (0,
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6455
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
/* @__PURE__ */ (0,
|
|
6458
|
-
/* @__PURE__ */ (0,
|
|
6513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.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: [
|
|
6514
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor22.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime37.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)) }),
|
|
6515
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor22.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime37.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)) }),
|
|
6516
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
6517
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6518
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
6519
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor22.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
6459
6520
|
] }),
|
|
6460
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
6461
|
-
/* @__PURE__ */ (0,
|
|
6462
|
-
/* @__PURE__ */ (0,
|
|
6521
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6522
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
6523
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6463
6524
|
"input",
|
|
6464
6525
|
{
|
|
6465
6526
|
type: "number",
|
|
@@ -6480,9 +6541,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6480
6541
|
},
|
|
6481
6542
|
`${k}:${warp[k]}`
|
|
6482
6543
|
),
|
|
6483
|
-
/* @__PURE__ */ (0,
|
|
6544
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
6484
6545
|
] }, k)),
|
|
6485
|
-
/* @__PURE__ */ (0,
|
|
6546
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6486
6547
|
"button",
|
|
6487
6548
|
{
|
|
6488
6549
|
type: "button",
|
|
@@ -6494,26 +6555,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6494
6555
|
children: "Vertical"
|
|
6495
6556
|
}
|
|
6496
6557
|
),
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6498
|
-
/* @__PURE__ */ (0,
|
|
6499
|
-
/* @__PURE__ */ (0,
|
|
6558
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6559
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
6560
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6500
6561
|
"select",
|
|
6501
6562
|
{
|
|
6502
6563
|
"aria-label": "Warp grid",
|
|
6503
|
-
value:
|
|
6564
|
+
value: import_image_editor22.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
6504
6565
|
onChange: (e) => {
|
|
6505
|
-
const g =
|
|
6566
|
+
const g = import_image_editor22.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
6506
6567
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
6507
6568
|
},
|
|
6508
6569
|
className: imageFieldClass,
|
|
6509
|
-
children:
|
|
6570
|
+
children: import_image_editor22.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
6510
6571
|
}
|
|
6511
6572
|
)
|
|
6512
6573
|
] })
|
|
6513
6574
|
] }),
|
|
6514
|
-
tool.mode !== "warp" &&
|
|
6515
|
-
/* @__PURE__ */ (0,
|
|
6516
|
-
/* @__PURE__ */ (0,
|
|
6575
|
+
tool.mode !== "warp" && import_image_editor22.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
6576
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
6577
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6517
6578
|
"input",
|
|
6518
6579
|
{
|
|
6519
6580
|
type: "number",
|
|
@@ -6533,8 +6594,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6533
6594
|
},
|
|
6534
6595
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
6535
6596
|
),
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6537
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
6597
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
6598
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6538
6599
|
"button",
|
|
6539
6600
|
{
|
|
6540
6601
|
type: "button",
|
|
@@ -6549,33 +6610,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6549
6610
|
}
|
|
6550
6611
|
)
|
|
6551
6612
|
] }, f.id)),
|
|
6552
|
-
/* @__PURE__ */ (0,
|
|
6553
|
-
/* @__PURE__ */ (0,
|
|
6554
|
-
/* @__PURE__ */ (0,
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6555
6616
|
"select",
|
|
6556
6617
|
{
|
|
6557
6618
|
"aria-label": "Interpolation",
|
|
6558
6619
|
value: tool.interpolation,
|
|
6559
6620
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
6560
6621
|
className: imageFieldClass,
|
|
6561
|
-
children:
|
|
6622
|
+
children: import_image_editor22.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
6562
6623
|
}
|
|
6563
6624
|
)
|
|
6564
6625
|
] }),
|
|
6565
|
-
/* @__PURE__ */ (0,
|
|
6566
|
-
/* @__PURE__ */ (0,
|
|
6567
|
-
tool.error && /* @__PURE__ */ (0,
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.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" }),
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
6628
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
6568
6629
|
] });
|
|
6569
6630
|
};
|
|
6570
6631
|
|
|
6571
6632
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
6572
|
-
var
|
|
6573
|
-
var
|
|
6574
|
-
var
|
|
6633
|
+
var import_react38 = require("react");
|
|
6634
|
+
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
6635
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6575
6636
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
6576
|
-
const [, setTick] = (0,
|
|
6577
|
-
(0,
|
|
6578
|
-
const [error, setError] = (0,
|
|
6637
|
+
const [, setTick] = (0, import_react38.useState)(0);
|
|
6638
|
+
(0, import_react38.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6639
|
+
const [error, setError] = (0, import_react38.useState)(null);
|
|
6579
6640
|
const active = controller.getActiveLayer();
|
|
6580
6641
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
6581
6642
|
const set = (change) => {
|
|
@@ -6583,28 +6644,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6583
6644
|
if (!shapeId) return;
|
|
6584
6645
|
try {
|
|
6585
6646
|
setError(null);
|
|
6586
|
-
(0,
|
|
6647
|
+
(0, import_image_editor23.applyShapeOptions)(controller, shapeId, change);
|
|
6587
6648
|
} catch (e) {
|
|
6588
6649
|
setError(e instanceof Error ? e.message : String(e));
|
|
6589
6650
|
}
|
|
6590
6651
|
};
|
|
6591
6652
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
6592
|
-
return /* @__PURE__ */ (0,
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6594
|
-
/* @__PURE__ */ (0,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
6654
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor23.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor23.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
6655
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6656
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6657
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
6597
6658
|
"Fill",
|
|
6598
|
-
/* @__PURE__ */ (0,
|
|
6659
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
6599
6660
|
] }),
|
|
6600
|
-
/* @__PURE__ */ (0,
|
|
6601
|
-
/* @__PURE__ */ (0,
|
|
6661
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6662
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
6602
6663
|
"Stroke",
|
|
6603
|
-
/* @__PURE__ */ (0,
|
|
6664
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
6604
6665
|
] }),
|
|
6605
|
-
/* @__PURE__ */ (0,
|
|
6666
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6606
6667
|
"Width",
|
|
6607
|
-
/* @__PURE__ */ (0,
|
|
6668
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6608
6669
|
"input",
|
|
6609
6670
|
{
|
|
6610
6671
|
type: "number",
|
|
@@ -6618,52 +6679,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6618
6679
|
)
|
|
6619
6680
|
] })
|
|
6620
6681
|
] }),
|
|
6621
|
-
/* @__PURE__ */ (0,
|
|
6622
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
6682
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6683
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6623
6684
|
"Radius",
|
|
6624
|
-
/* @__PURE__ */ (0,
|
|
6685
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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}` })
|
|
6625
6686
|
] }),
|
|
6626
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
6687
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6627
6688
|
"Sides",
|
|
6628
|
-
/* @__PURE__ */ (0,
|
|
6689
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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}` })
|
|
6629
6690
|
] }),
|
|
6630
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
6631
|
-
/* @__PURE__ */ (0,
|
|
6691
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6692
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6632
6693
|
"Points",
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6694
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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}` })
|
|
6634
6695
|
] }),
|
|
6635
|
-
/* @__PURE__ */ (0,
|
|
6696
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6636
6697
|
"Inner",
|
|
6637
|
-
/* @__PURE__ */ (0,
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
6638
6699
|
] })
|
|
6639
6700
|
] }),
|
|
6640
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6701
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6702
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6642
6703
|
"Weight",
|
|
6643
|
-
/* @__PURE__ */ (0,
|
|
6704
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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}` })
|
|
6644
6705
|
] }),
|
|
6645
|
-
/* @__PURE__ */ (0,
|
|
6646
|
-
/* @__PURE__ */ (0,
|
|
6706
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6707
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
6647
6708
|
"Arrowhead"
|
|
6648
6709
|
] })
|
|
6649
6710
|
] })
|
|
6650
6711
|
] }),
|
|
6651
|
-
/* @__PURE__ */ (0,
|
|
6652
|
-
error && /* @__PURE__ */ (0,
|
|
6712
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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." }),
|
|
6713
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6653
6714
|
] });
|
|
6654
6715
|
};
|
|
6655
6716
|
|
|
6656
6717
|
// src/image-editor/TypeOptionsBar.tsx
|
|
6657
|
-
var
|
|
6658
|
-
var
|
|
6659
|
-
var
|
|
6718
|
+
var import_react39 = require("react");
|
|
6719
|
+
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
6720
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6660
6721
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
6661
6722
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
6662
6723
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
6663
|
-
const [, setTick] = (0,
|
|
6664
|
-
(0,
|
|
6665
|
-
(0,
|
|
6666
|
-
const [error, setError] = (0,
|
|
6724
|
+
const [, setTick] = (0, import_react39.useState)(0);
|
|
6725
|
+
(0, import_react39.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6726
|
+
(0, import_react39.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
6727
|
+
const [error, setError] = (0, import_react39.useState)(null);
|
|
6667
6728
|
const active = controller.getActiveLayer();
|
|
6668
6729
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
6669
6730
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -6716,11 +6777,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6716
6777
|
setError(e instanceof Error ? e.message : String(e));
|
|
6717
6778
|
}
|
|
6718
6779
|
};
|
|
6719
|
-
return /* @__PURE__ */ (0,
|
|
6720
|
-
/* @__PURE__ */ (0,
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6781
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6782
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6722
6783
|
"Font",
|
|
6723
|
-
/* @__PURE__ */ (0,
|
|
6784
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6724
6785
|
"input",
|
|
6725
6786
|
{
|
|
6726
6787
|
list: "pixerate-type-fonts",
|
|
@@ -6730,11 +6791,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6730
6791
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
6731
6792
|
}
|
|
6732
6793
|
),
|
|
6733
|
-
/* @__PURE__ */ (0,
|
|
6794
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("option", { value: f }, f)) })
|
|
6734
6795
|
] }),
|
|
6735
|
-
/* @__PURE__ */ (0,
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6736
6797
|
"Size",
|
|
6737
|
-
/* @__PURE__ */ (0,
|
|
6798
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6738
6799
|
"input",
|
|
6739
6800
|
{
|
|
6740
6801
|
type: "number",
|
|
@@ -6747,14 +6808,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6747
6808
|
}
|
|
6748
6809
|
)
|
|
6749
6810
|
] }),
|
|
6750
|
-
/* @__PURE__ */ (0,
|
|
6751
|
-
/* @__PURE__ */ (0,
|
|
6752
|
-
/* @__PURE__ */ (0,
|
|
6811
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.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" }),
|
|
6812
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6813
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
6753
6814
|
] }),
|
|
6754
|
-
/* @__PURE__ */ (0,
|
|
6755
|
-
/* @__PURE__ */ (0,
|
|
6756
|
-
|
|
6757
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6815
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor24.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6816
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6817
|
+
import_image_editor24.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6818
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6758
6819
|
"button",
|
|
6759
6820
|
{
|
|
6760
6821
|
type: "button",
|
|
@@ -6766,19 +6827,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6766
6827
|
}
|
|
6767
6828
|
)
|
|
6768
6829
|
] }),
|
|
6769
|
-
/* @__PURE__ */ (0,
|
|
6770
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.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." }),
|
|
6831
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
6771
6832
|
"Missing ",
|
|
6772
6833
|
missing.length === 1 ? "font" : "fonts",
|
|
6773
6834
|
": ",
|
|
6774
6835
|
missing.join(", ")
|
|
6775
6836
|
] }),
|
|
6776
|
-
error && /* @__PURE__ */ (0,
|
|
6837
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6777
6838
|
] });
|
|
6778
6839
|
};
|
|
6779
6840
|
|
|
6780
6841
|
// src/image-editor/ImageEditor.tsx
|
|
6781
|
-
var
|
|
6842
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6782
6843
|
var ImageEditor = ({
|
|
6783
6844
|
editor: externalEditor,
|
|
6784
6845
|
src,
|
|
@@ -6802,51 +6863,51 @@ var ImageEditor = ({
|
|
|
6802
6863
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
6803
6864
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
6804
6865
|
});
|
|
6805
|
-
const legacyProcess = (0,
|
|
6806
|
-
const [activeTab, setActiveTab] = (0,
|
|
6807
|
-
const rootRef = (0,
|
|
6866
|
+
const legacyProcess = (0, import_image_editor25.normalizeProcessVersion)(state.adjustments.process) < import_image_editor25.LATEST_PROCESS_VERSION;
|
|
6867
|
+
const [activeTab, setActiveTab] = (0, import_react40.useState)("crop");
|
|
6868
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
6808
6869
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
6809
|
-
const activeTabRef = (0,
|
|
6870
|
+
const activeTabRef = (0, import_react40.useRef)(activeTab);
|
|
6810
6871
|
activeTabRef.current = activeTab;
|
|
6811
6872
|
const openPanel = async (ref) => {
|
|
6812
6873
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
6813
6874
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
6814
6875
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
6815
6876
|
};
|
|
6816
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
6817
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
6818
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
6819
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
6820
|
-
const [typeSession, setTypeSession] = (0,
|
|
6821
|
-
const [selectionError, setSelectionError] = (0,
|
|
6822
|
-
const [paintError, setPaintError] = (0,
|
|
6823
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
6877
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react40.useState)(null);
|
|
6878
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react40.useState)(import_image_editor25.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6879
|
+
const [shapeOptions, setShapeOptions] = (0, import_react40.useState)(import_image_editor25.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6880
|
+
const [typeOptions, setTypeOptions] = (0, import_react40.useState)(import_image_editor25.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6881
|
+
const [typeSession, setTypeSession] = (0, import_react40.useState)(null);
|
|
6882
|
+
const [selectionError, setSelectionError] = (0, import_react40.useState)(null);
|
|
6883
|
+
const [paintError, setPaintError] = (0, import_react40.useState)(null);
|
|
6884
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react40.useState)(null);
|
|
6824
6885
|
const handleCanvasError = (source, message) => {
|
|
6825
6886
|
if (source === "paint") setPaintError(message);
|
|
6826
6887
|
else if (source === "select") setSelectionError(message);
|
|
6827
6888
|
else setShapeTypeError(message);
|
|
6828
6889
|
};
|
|
6829
6890
|
const finishTyping = () => setTypeSession(null);
|
|
6830
|
-
const transformToolRef = (0,
|
|
6831
|
-
const transformControllerRef = (0,
|
|
6891
|
+
const transformToolRef = (0, import_react40.useRef)(null);
|
|
6892
|
+
const transformControllerRef = (0, import_react40.useRef)(controller);
|
|
6832
6893
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
6833
6894
|
transformToolRef.current?.cancel();
|
|
6834
|
-
transformToolRef.current = new
|
|
6895
|
+
transformToolRef.current = new import_image_editor25.FreeTransformTool(controller, {
|
|
6835
6896
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
6836
6897
|
});
|
|
6837
6898
|
transformControllerRef.current = controller;
|
|
6838
6899
|
}
|
|
6839
6900
|
const transformTool = transformToolRef.current;
|
|
6840
|
-
const [, setTransformTick] = (0,
|
|
6841
|
-
(0,
|
|
6842
|
-
(0,
|
|
6843
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
6844
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
6845
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
6846
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
6847
|
-
const [aiError, setAiError] = (0,
|
|
6848
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
6849
|
-
const [aiTarget, setAiTarget] = (0,
|
|
6901
|
+
const [, setTransformTick] = (0, import_react40.useState)(0);
|
|
6902
|
+
(0, import_react40.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
6903
|
+
(0, import_react40.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
6904
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react40.useState)("");
|
|
6905
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react40.useState)("annotations");
|
|
6906
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react40.useState)(false);
|
|
6907
|
+
const [isInpainting, setIsInpainting] = (0, import_react40.useState)(false);
|
|
6908
|
+
const [aiError, setAiError] = (0, import_react40.useState)(null);
|
|
6909
|
+
const [aiSuccess, setAiSuccess] = (0, import_react40.useState)(null);
|
|
6910
|
+
const [aiTarget, setAiTarget] = (0, import_react40.useState)("auto");
|
|
6850
6911
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
6851
6912
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
6852
6913
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -6909,11 +6970,11 @@ var ImageEditor = ({
|
|
|
6909
6970
|
setIsInpainting(false);
|
|
6910
6971
|
}
|
|
6911
6972
|
};
|
|
6912
|
-
const [activeColor, setActiveColor] = (0,
|
|
6913
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
6914
|
-
const [fontSize, setFontSize] = (0,
|
|
6915
|
-
const [textInput, setTextInput] = (0,
|
|
6916
|
-
(0,
|
|
6973
|
+
const [activeColor, setActiveColor] = (0, import_react40.useState)("#ef4444");
|
|
6974
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react40.useState)(3);
|
|
6975
|
+
const [fontSize, setFontSize] = (0, import_react40.useState)(24);
|
|
6976
|
+
const [textInput, setTextInput] = (0, import_react40.useState)("");
|
|
6977
|
+
(0, import_react40.useEffect)(() => {
|
|
6917
6978
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
6918
6979
|
editor.setTool("crop");
|
|
6919
6980
|
}
|
|
@@ -6941,16 +7002,16 @@ var ImageEditor = ({
|
|
|
6941
7002
|
link.click();
|
|
6942
7003
|
}
|
|
6943
7004
|
};
|
|
6944
|
-
return /* @__PURE__ */ (0,
|
|
7005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6945
7006
|
"div",
|
|
6946
7007
|
{
|
|
6947
7008
|
ref: rootRef,
|
|
6948
7009
|
className: `${imageEditorFrameClass} ${className}`,
|
|
6949
7010
|
style,
|
|
6950
7011
|
children: [
|
|
6951
|
-
/* @__PURE__ */ (0,
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
6953
|
-
/* @__PURE__ */ (0,
|
|
7012
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
7013
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6954
7015
|
"button",
|
|
6955
7016
|
{
|
|
6956
7017
|
type: "button",
|
|
@@ -6965,7 +7026,7 @@ var ImageEditor = ({
|
|
|
6965
7026
|
children: "Transform & Crop"
|
|
6966
7027
|
}
|
|
6967
7028
|
),
|
|
6968
|
-
/* @__PURE__ */ (0,
|
|
7029
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6969
7030
|
"button",
|
|
6970
7031
|
{
|
|
6971
7032
|
type: "button",
|
|
@@ -6980,7 +7041,7 @@ var ImageEditor = ({
|
|
|
6980
7041
|
children: "Adjustments"
|
|
6981
7042
|
}
|
|
6982
7043
|
),
|
|
6983
|
-
/* @__PURE__ */ (0,
|
|
7044
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6984
7045
|
"button",
|
|
6985
7046
|
{
|
|
6986
7047
|
type: "button",
|
|
@@ -6995,7 +7056,7 @@ var ImageEditor = ({
|
|
|
6995
7056
|
children: "Layers"
|
|
6996
7057
|
}
|
|
6997
7058
|
),
|
|
6998
|
-
/* @__PURE__ */ (0,
|
|
7059
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6999
7060
|
"button",
|
|
7000
7061
|
{
|
|
7001
7062
|
type: "button",
|
|
@@ -7010,7 +7071,7 @@ var ImageEditor = ({
|
|
|
7010
7071
|
children: "Paint"
|
|
7011
7072
|
}
|
|
7012
7073
|
),
|
|
7013
|
-
/* @__PURE__ */ (0,
|
|
7074
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7014
7075
|
"button",
|
|
7015
7076
|
{
|
|
7016
7077
|
type: "button",
|
|
@@ -7025,7 +7086,7 @@ var ImageEditor = ({
|
|
|
7025
7086
|
children: "Select & Mask"
|
|
7026
7087
|
}
|
|
7027
7088
|
),
|
|
7028
|
-
/* @__PURE__ */ (0,
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7029
7090
|
"button",
|
|
7030
7091
|
{
|
|
7031
7092
|
type: "button",
|
|
@@ -7040,7 +7101,7 @@ var ImageEditor = ({
|
|
|
7040
7101
|
children: "Annotations"
|
|
7041
7102
|
}
|
|
7042
7103
|
),
|
|
7043
|
-
/* @__PURE__ */ (0,
|
|
7104
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7044
7105
|
"button",
|
|
7045
7106
|
{
|
|
7046
7107
|
type: "button",
|
|
@@ -7055,7 +7116,7 @@ var ImageEditor = ({
|
|
|
7055
7116
|
children: "Depth Mask"
|
|
7056
7117
|
}
|
|
7057
7118
|
),
|
|
7058
|
-
/* @__PURE__ */ (0,
|
|
7119
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7059
7120
|
"button",
|
|
7060
7121
|
{
|
|
7061
7122
|
type: "button",
|
|
@@ -7068,14 +7129,14 @@ var ImageEditor = ({
|
|
|
7068
7129
|
"aria-selected": activeTab === "ai",
|
|
7069
7130
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
7070
7131
|
children: [
|
|
7071
|
-
/* @__PURE__ */ (0,
|
|
7132
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.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" }) }),
|
|
7072
7133
|
"AI Tools"
|
|
7073
7134
|
]
|
|
7074
7135
|
}
|
|
7075
7136
|
)
|
|
7076
7137
|
] }),
|
|
7077
|
-
/* @__PURE__ */ (0,
|
|
7078
|
-
/* @__PURE__ */ (0,
|
|
7138
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
7139
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7079
7140
|
"button",
|
|
7080
7141
|
{
|
|
7081
7142
|
type: "button",
|
|
@@ -7086,7 +7147,7 @@ var ImageEditor = ({
|
|
|
7086
7147
|
children: "\u21A9"
|
|
7087
7148
|
}
|
|
7088
7149
|
),
|
|
7089
|
-
/* @__PURE__ */ (0,
|
|
7150
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7090
7151
|
"button",
|
|
7091
7152
|
{
|
|
7092
7153
|
type: "button",
|
|
@@ -7097,7 +7158,7 @@ var ImageEditor = ({
|
|
|
7097
7158
|
children: "\u21AA"
|
|
7098
7159
|
}
|
|
7099
7160
|
),
|
|
7100
|
-
/* @__PURE__ */ (0,
|
|
7161
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7101
7162
|
"button",
|
|
7102
7163
|
{
|
|
7103
7164
|
type: "button",
|
|
@@ -7106,8 +7167,8 @@ var ImageEditor = ({
|
|
|
7106
7167
|
children: "Reset"
|
|
7107
7168
|
}
|
|
7108
7169
|
),
|
|
7109
|
-
/* @__PURE__ */ (0,
|
|
7110
|
-
/* @__PURE__ */ (0,
|
|
7170
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
7171
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7111
7172
|
"button",
|
|
7112
7173
|
{
|
|
7113
7174
|
type: "button",
|
|
@@ -7117,11 +7178,11 @@ var ImageEditor = ({
|
|
|
7117
7178
|
children: "-"
|
|
7118
7179
|
}
|
|
7119
7180
|
),
|
|
7120
|
-
/* @__PURE__ */ (0,
|
|
7181
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
7121
7182
|
Math.round(state.zoom * 100),
|
|
7122
7183
|
"%"
|
|
7123
7184
|
] }),
|
|
7124
|
-
/* @__PURE__ */ (0,
|
|
7185
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7125
7186
|
"button",
|
|
7126
7187
|
{
|
|
7127
7188
|
type: "button",
|
|
@@ -7131,8 +7192,8 @@ var ImageEditor = ({
|
|
|
7131
7192
|
children: "+"
|
|
7132
7193
|
}
|
|
7133
7194
|
),
|
|
7134
|
-
/* @__PURE__ */ (0,
|
|
7135
|
-
/* @__PURE__ */ (0,
|
|
7195
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7136
7197
|
"button",
|
|
7137
7198
|
{
|
|
7138
7199
|
type: "button",
|
|
@@ -7143,7 +7204,7 @@ var ImageEditor = ({
|
|
|
7143
7204
|
children: "Hold Compare"
|
|
7144
7205
|
}
|
|
7145
7206
|
),
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7207
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7147
7208
|
"button",
|
|
7148
7209
|
{
|
|
7149
7210
|
type: "button",
|
|
@@ -7154,10 +7215,10 @@ var ImageEditor = ({
|
|
|
7154
7215
|
)
|
|
7155
7216
|
] })
|
|
7156
7217
|
] }),
|
|
7157
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
7158
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
7159
|
-
/* @__PURE__ */ (0,
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7218
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
7219
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
7221
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7161
7222
|
ImageEditorCanvas,
|
|
7162
7223
|
{
|
|
7163
7224
|
editor,
|
|
@@ -7181,11 +7242,11 @@ var ImageEditor = ({
|
|
|
7181
7242
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
7182
7243
|
}
|
|
7183
7244
|
),
|
|
7184
|
-
/* @__PURE__ */ (0,
|
|
7185
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
7186
|
-
/* @__PURE__ */ (0,
|
|
7187
|
-
/* @__PURE__ */ (0,
|
|
7188
|
-
/* @__PURE__ */ (0,
|
|
7245
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: imageSidebarClass, children: [
|
|
7246
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7247
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
7248
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
7249
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7189
7250
|
"button",
|
|
7190
7251
|
{
|
|
7191
7252
|
type: "button",
|
|
@@ -7197,7 +7258,7 @@ var ImageEditor = ({
|
|
|
7197
7258
|
children: "Freeform"
|
|
7198
7259
|
}
|
|
7199
7260
|
),
|
|
7200
|
-
/* @__PURE__ */ (0,
|
|
7261
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7201
7262
|
"button",
|
|
7202
7263
|
{
|
|
7203
7264
|
type: "button",
|
|
@@ -7209,7 +7270,7 @@ var ImageEditor = ({
|
|
|
7209
7270
|
children: "1:1 Square"
|
|
7210
7271
|
}
|
|
7211
7272
|
),
|
|
7212
|
-
/* @__PURE__ */ (0,
|
|
7273
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7213
7274
|
"button",
|
|
7214
7275
|
{
|
|
7215
7276
|
type: "button",
|
|
@@ -7221,7 +7282,7 @@ var ImageEditor = ({
|
|
|
7221
7282
|
children: "4:3 Standard"
|
|
7222
7283
|
}
|
|
7223
7284
|
),
|
|
7224
|
-
/* @__PURE__ */ (0,
|
|
7285
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7225
7286
|
"button",
|
|
7226
7287
|
{
|
|
7227
7288
|
type: "button",
|
|
@@ -7233,7 +7294,7 @@ var ImageEditor = ({
|
|
|
7233
7294
|
children: "16:9 Wide"
|
|
7234
7295
|
}
|
|
7235
7296
|
),
|
|
7236
|
-
/* @__PURE__ */ (0,
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7237
7298
|
"button",
|
|
7238
7299
|
{
|
|
7239
7300
|
type: "button",
|
|
@@ -7245,7 +7306,7 @@ var ImageEditor = ({
|
|
|
7245
7306
|
children: "3:2 Photo"
|
|
7246
7307
|
}
|
|
7247
7308
|
),
|
|
7248
|
-
/* @__PURE__ */ (0,
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7249
7310
|
"button",
|
|
7250
7311
|
{
|
|
7251
7312
|
type: "button",
|
|
@@ -7258,10 +7319,10 @@ var ImageEditor = ({
|
|
|
7258
7319
|
}
|
|
7259
7320
|
)
|
|
7260
7321
|
] }),
|
|
7261
|
-
/* @__PURE__ */ (0,
|
|
7262
|
-
/* @__PURE__ */ (0,
|
|
7263
|
-
/* @__PURE__ */ (0,
|
|
7264
|
-
/* @__PURE__ */ (0,
|
|
7322
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageDividerClass }),
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
7324
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
7325
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7265
7326
|
"button",
|
|
7266
7327
|
{
|
|
7267
7328
|
type: "button",
|
|
@@ -7270,7 +7331,7 @@ var ImageEditor = ({
|
|
|
7270
7331
|
children: "Rotate -90\xB0"
|
|
7271
7332
|
}
|
|
7272
7333
|
),
|
|
7273
|
-
/* @__PURE__ */ (0,
|
|
7334
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7274
7335
|
"button",
|
|
7275
7336
|
{
|
|
7276
7337
|
type: "button",
|
|
@@ -7279,7 +7340,7 @@ var ImageEditor = ({
|
|
|
7279
7340
|
children: "Rotate +90\xB0"
|
|
7280
7341
|
}
|
|
7281
7342
|
),
|
|
7282
|
-
/* @__PURE__ */ (0,
|
|
7343
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7283
7344
|
"button",
|
|
7284
7345
|
{
|
|
7285
7346
|
type: "button",
|
|
@@ -7288,7 +7349,7 @@ var ImageEditor = ({
|
|
|
7288
7349
|
children: "Flip Horizontal"
|
|
7289
7350
|
}
|
|
7290
7351
|
),
|
|
7291
|
-
/* @__PURE__ */ (0,
|
|
7352
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7292
7353
|
"button",
|
|
7293
7354
|
{
|
|
7294
7355
|
type: "button",
|
|
@@ -7299,10 +7360,10 @@ var ImageEditor = ({
|
|
|
7299
7360
|
)
|
|
7300
7361
|
] })
|
|
7301
7362
|
] }),
|
|
7302
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
7303
|
-
/* @__PURE__ */ (0,
|
|
7304
|
-
/* @__PURE__ */ (0,
|
|
7305
|
-
/* @__PURE__ */ (0,
|
|
7363
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7364
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7365
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
7366
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7306
7367
|
"button",
|
|
7307
7368
|
{
|
|
7308
7369
|
type: "button",
|
|
@@ -7312,25 +7373,25 @@ var ImageEditor = ({
|
|
|
7312
7373
|
}
|
|
7313
7374
|
)
|
|
7314
7375
|
] }),
|
|
7315
|
-
/* @__PURE__ */ (0,
|
|
7316
|
-
|
|
7317
|
-
/* @__PURE__ */ (0,
|
|
7376
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Histogram, { histogram: editor.histogram }),
|
|
7377
|
+
import_image_editor25.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react40.default.Fragment, { children: [
|
|
7378
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7318
7379
|
ControlSlider,
|
|
7319
7380
|
{
|
|
7320
7381
|
spec,
|
|
7321
|
-
value: (0,
|
|
7382
|
+
value: (0, import_image_editor25.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
7322
7383
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
7323
7384
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
7324
7385
|
}
|
|
7325
7386
|
),
|
|
7326
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
7387
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7327
7388
|
"div",
|
|
7328
7389
|
{
|
|
7329
7390
|
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",
|
|
7330
7391
|
"data-testid": "image-editor-process-notice",
|
|
7331
7392
|
children: [
|
|
7332
|
-
/* @__PURE__ */ (0,
|
|
7333
|
-
/* @__PURE__ */ (0,
|
|
7393
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
7394
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7334
7395
|
"button",
|
|
7335
7396
|
{
|
|
7336
7397
|
type: "button",
|
|
@@ -7343,7 +7404,7 @@ var ImageEditor = ({
|
|
|
7343
7404
|
}
|
|
7344
7405
|
)
|
|
7345
7406
|
] }, spec.id)),
|
|
7346
|
-
/* @__PURE__ */ (0,
|
|
7407
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7347
7408
|
AdjustmentLayersPanel,
|
|
7348
7409
|
{
|
|
7349
7410
|
controller,
|
|
@@ -7352,9 +7413,9 @@ var ImageEditor = ({
|
|
|
7352
7413
|
}
|
|
7353
7414
|
) })
|
|
7354
7415
|
] }),
|
|
7355
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
7356
|
-
/* @__PURE__ */ (0,
|
|
7357
|
-
/* @__PURE__ */ (0,
|
|
7416
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7417
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
7418
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7358
7419
|
"button",
|
|
7359
7420
|
{
|
|
7360
7421
|
type: "button",
|
|
@@ -7365,15 +7426,15 @@ var ImageEditor = ({
|
|
|
7365
7426
|
children: "Free Transform"
|
|
7366
7427
|
}
|
|
7367
7428
|
),
|
|
7368
|
-
/* @__PURE__ */ (0,
|
|
7369
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
7370
|
-
/* @__PURE__ */ (0,
|
|
7371
|
-
/* @__PURE__ */ (0,
|
|
7429
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LayersPanel, { controller }),
|
|
7430
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
7431
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
7432
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ColorProfilePanel, { controller })
|
|
7372
7433
|
] }),
|
|
7373
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7375
|
-
/* @__PURE__ */ (0,
|
|
7376
|
-
/* @__PURE__ */ (0,
|
|
7434
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7435
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BrushOptionsBar, { controller }),
|
|
7437
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7377
7438
|
"button",
|
|
7378
7439
|
{
|
|
7379
7440
|
type: "button",
|
|
@@ -7384,29 +7445,29 @@ var ImageEditor = ({
|
|
|
7384
7445
|
children: "Free Transform"
|
|
7385
7446
|
}
|
|
7386
7447
|
),
|
|
7387
|
-
paintError && /* @__PURE__ */ (0,
|
|
7388
|
-
/* @__PURE__ */ (0,
|
|
7448
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
7449
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LayersPanel, { controller }) })
|
|
7389
7450
|
] }),
|
|
7390
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
7391
|
-
/* @__PURE__ */ (0,
|
|
7392
|
-
/* @__PURE__ */ (0,
|
|
7451
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7452
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
7453
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.jsx)(
|
|
7393
7454
|
"button",
|
|
7394
7455
|
{
|
|
7395
7456
|
type: "button",
|
|
7396
7457
|
"aria-pressed": state.activeTool === t,
|
|
7397
7458
|
onClick: () => editor.setTool(t),
|
|
7398
7459
|
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
7399
|
-
children: (0,
|
|
7460
|
+
children: (0, import_image_editor25.imageToolLabel)(t)
|
|
7400
7461
|
},
|
|
7401
7462
|
t
|
|
7402
7463
|
)) }),
|
|
7403
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
7404
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
7405
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
7406
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
7407
|
-
/* @__PURE__ */ (0,
|
|
7408
|
-
/* @__PURE__ */ (0,
|
|
7409
|
-
/* @__PURE__ */ (0,
|
|
7464
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
7465
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
7466
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime40.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" }),
|
|
7467
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
7468
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageDividerClass }),
|
|
7469
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
7470
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7410
7471
|
"button",
|
|
7411
7472
|
{
|
|
7412
7473
|
type: "button",
|
|
@@ -7416,18 +7477,18 @@ var ImageEditor = ({
|
|
|
7416
7477
|
},
|
|
7417
7478
|
t
|
|
7418
7479
|
)) }),
|
|
7419
|
-
/* @__PURE__ */ (0,
|
|
7420
|
-
/* @__PURE__ */ (0,
|
|
7421
|
-
/* @__PURE__ */ (0,
|
|
7422
|
-
/* @__PURE__ */ (0,
|
|
7423
|
-
/* @__PURE__ */ (0,
|
|
7424
|
-
/* @__PURE__ */ (0,
|
|
7425
|
-
/* @__PURE__ */ (0,
|
|
7480
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
7481
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
7482
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
7483
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
7484
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
7485
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Width:" }),
|
|
7486
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "font-mono", children: [
|
|
7426
7487
|
strokeWidth,
|
|
7427
7488
|
"px"
|
|
7428
7489
|
] })
|
|
7429
7490
|
] }),
|
|
7430
|
-
/* @__PURE__ */ (0,
|
|
7491
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7431
7492
|
"input",
|
|
7432
7493
|
{
|
|
7433
7494
|
type: "range",
|
|
@@ -7440,10 +7501,10 @@ var ImageEditor = ({
|
|
|
7440
7501
|
)
|
|
7441
7502
|
] })
|
|
7442
7503
|
] }),
|
|
7443
|
-
/* @__PURE__ */ (0,
|
|
7444
|
-
/* @__PURE__ */ (0,
|
|
7445
|
-
/* @__PURE__ */ (0,
|
|
7446
|
-
/* @__PURE__ */ (0,
|
|
7504
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageDividerClass }),
|
|
7505
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
7506
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-2", children: [
|
|
7507
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7447
7508
|
"input",
|
|
7448
7509
|
{
|
|
7449
7510
|
type: "text",
|
|
@@ -7454,7 +7515,7 @@ var ImageEditor = ({
|
|
|
7454
7515
|
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"
|
|
7455
7516
|
}
|
|
7456
7517
|
),
|
|
7457
|
-
/* @__PURE__ */ (0,
|
|
7518
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7458
7519
|
"button",
|
|
7459
7520
|
{
|
|
7460
7521
|
type: "button",
|
|
@@ -7464,14 +7525,14 @@ var ImageEditor = ({
|
|
|
7464
7525
|
}
|
|
7465
7526
|
)
|
|
7466
7527
|
] }),
|
|
7467
|
-
/* @__PURE__ */ (0,
|
|
7468
|
-
/* @__PURE__ */ (0,
|
|
7469
|
-
/* @__PURE__ */ (0,
|
|
7528
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
7529
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Font Size:" }),
|
|
7530
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "font-mono", children: [
|
|
7470
7531
|
fontSize,
|
|
7471
7532
|
"px"
|
|
7472
7533
|
] })
|
|
7473
7534
|
] }),
|
|
7474
|
-
/* @__PURE__ */ (0,
|
|
7535
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7475
7536
|
"input",
|
|
7476
7537
|
{
|
|
7477
7538
|
type: "range",
|
|
@@ -7482,14 +7543,14 @@ var ImageEditor = ({
|
|
|
7482
7543
|
className: imageRangeClass
|
|
7483
7544
|
}
|
|
7484
7545
|
),
|
|
7485
|
-
/* @__PURE__ */ (0,
|
|
7486
|
-
/* @__PURE__ */ (0,
|
|
7487
|
-
/* @__PURE__ */ (0,
|
|
7546
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageDividerClass }),
|
|
7547
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7548
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
7488
7549
|
"Layers (",
|
|
7489
7550
|
state.annotations.length,
|
|
7490
7551
|
")"
|
|
7491
7552
|
] }),
|
|
7492
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
7553
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7493
7554
|
"button",
|
|
7494
7555
|
{
|
|
7495
7556
|
type: "button",
|
|
@@ -7498,7 +7559,7 @@ var ImageEditor = ({
|
|
|
7498
7559
|
children: "Delete Selected"
|
|
7499
7560
|
}
|
|
7500
7561
|
),
|
|
7501
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
7562
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7502
7563
|
"button",
|
|
7503
7564
|
{
|
|
7504
7565
|
type: "button",
|
|
@@ -7509,10 +7570,10 @@ var ImageEditor = ({
|
|
|
7509
7570
|
)
|
|
7510
7571
|
] })
|
|
7511
7572
|
] }),
|
|
7512
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
7513
|
-
/* @__PURE__ */ (0,
|
|
7514
|
-
/* @__PURE__ */ (0,
|
|
7515
|
-
/* @__PURE__ */ (0,
|
|
7573
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7574
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7575
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
7576
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7516
7577
|
"button",
|
|
7517
7578
|
{
|
|
7518
7579
|
type: "button",
|
|
@@ -7522,8 +7583,8 @@ var ImageEditor = ({
|
|
|
7522
7583
|
}
|
|
7523
7584
|
)
|
|
7524
7585
|
] }),
|
|
7525
|
-
/* @__PURE__ */ (0,
|
|
7526
|
-
/* @__PURE__ */ (0,
|
|
7586
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
7587
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7527
7588
|
"input",
|
|
7528
7589
|
{
|
|
7529
7590
|
type: "checkbox",
|
|
@@ -7532,12 +7593,12 @@ var ImageEditor = ({
|
|
|
7532
7593
|
className: "rounded accent-primary"
|
|
7533
7594
|
}
|
|
7534
7595
|
),
|
|
7535
|
-
/* @__PURE__ */ (0,
|
|
7596
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
7536
7597
|
] }),
|
|
7537
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
7538
|
-
/* @__PURE__ */ (0,
|
|
7539
|
-
/* @__PURE__ */ (0,
|
|
7540
|
-
/* @__PURE__ */ (0,
|
|
7598
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
7599
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
7600
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
7601
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7541
7602
|
"input",
|
|
7542
7603
|
{
|
|
7543
7604
|
type: "text",
|
|
@@ -7548,8 +7609,8 @@ var ImageEditor = ({
|
|
|
7548
7609
|
}
|
|
7549
7610
|
)
|
|
7550
7611
|
] }),
|
|
7551
|
-
/* @__PURE__ */ (0,
|
|
7552
|
-
/* @__PURE__ */ (0,
|
|
7612
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-2", children: [
|
|
7613
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7553
7614
|
"button",
|
|
7554
7615
|
{
|
|
7555
7616
|
type: "button",
|
|
@@ -7558,7 +7619,7 @@ var ImageEditor = ({
|
|
|
7558
7619
|
children: "Threshold Mode"
|
|
7559
7620
|
}
|
|
7560
7621
|
),
|
|
7561
|
-
/* @__PURE__ */ (0,
|
|
7622
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7562
7623
|
"button",
|
|
7563
7624
|
{
|
|
7564
7625
|
type: "button",
|
|
@@ -7568,12 +7629,12 @@ var ImageEditor = ({
|
|
|
7568
7629
|
}
|
|
7569
7630
|
)
|
|
7570
7631
|
] }),
|
|
7571
|
-
/* @__PURE__ */ (0,
|
|
7572
|
-
/* @__PURE__ */ (0,
|
|
7573
|
-
/* @__PURE__ */ (0,
|
|
7574
|
-
/* @__PURE__ */ (0,
|
|
7632
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
7633
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7634
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
7635
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
7575
7636
|
] }),
|
|
7576
|
-
/* @__PURE__ */ (0,
|
|
7637
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7577
7638
|
"input",
|
|
7578
7639
|
{
|
|
7579
7640
|
type: "range",
|
|
@@ -7587,12 +7648,12 @@ var ImageEditor = ({
|
|
|
7587
7648
|
}
|
|
7588
7649
|
)
|
|
7589
7650
|
] }),
|
|
7590
|
-
/* @__PURE__ */ (0,
|
|
7591
|
-
/* @__PURE__ */ (0,
|
|
7592
|
-
/* @__PURE__ */ (0,
|
|
7593
|
-
/* @__PURE__ */ (0,
|
|
7651
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
7652
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7653
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
7654
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
7594
7655
|
] }),
|
|
7595
|
-
/* @__PURE__ */ (0,
|
|
7656
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7596
7657
|
"input",
|
|
7597
7658
|
{
|
|
7598
7659
|
type: "range",
|
|
@@ -7606,12 +7667,12 @@ var ImageEditor = ({
|
|
|
7606
7667
|
}
|
|
7607
7668
|
)
|
|
7608
7669
|
] }),
|
|
7609
|
-
/* @__PURE__ */ (0,
|
|
7610
|
-
/* @__PURE__ */ (0,
|
|
7611
|
-
/* @__PURE__ */ (0,
|
|
7612
|
-
/* @__PURE__ */ (0,
|
|
7670
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
7671
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7672
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Softness:" }),
|
|
7673
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
7613
7674
|
] }),
|
|
7614
|
-
/* @__PURE__ */ (0,
|
|
7675
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7615
7676
|
"input",
|
|
7616
7677
|
{
|
|
7617
7678
|
type: "range",
|
|
@@ -7623,8 +7684,8 @@ var ImageEditor = ({
|
|
|
7623
7684
|
}
|
|
7624
7685
|
)
|
|
7625
7686
|
] }),
|
|
7626
|
-
/* @__PURE__ */ (0,
|
|
7627
|
-
/* @__PURE__ */ (0,
|
|
7687
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
7688
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7628
7689
|
"input",
|
|
7629
7690
|
{
|
|
7630
7691
|
type: "checkbox",
|
|
@@ -7633,12 +7694,12 @@ var ImageEditor = ({
|
|
|
7633
7694
|
className: "rounded accent-primary"
|
|
7634
7695
|
}
|
|
7635
7696
|
),
|
|
7636
|
-
/* @__PURE__ */ (0,
|
|
7697
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Invert Mask" })
|
|
7637
7698
|
] })
|
|
7638
7699
|
] })
|
|
7639
7700
|
] }),
|
|
7640
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
7641
|
-
/* @__PURE__ */ (0,
|
|
7701
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7702
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7642
7703
|
SelectionOptionsBar,
|
|
7643
7704
|
{
|
|
7644
7705
|
controller,
|
|
@@ -7649,9 +7710,9 @@ var ImageEditor = ({
|
|
|
7649
7710
|
selectionDisplay: state.selectionDisplay
|
|
7650
7711
|
}
|
|
7651
7712
|
),
|
|
7652
|
-
selectionError && /* @__PURE__ */ (0,
|
|
7653
|
-
/* @__PURE__ */ (0,
|
|
7654
|
-
/* @__PURE__ */ (0,
|
|
7713
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
7714
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-1", children: [
|
|
7715
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7655
7716
|
"button",
|
|
7656
7717
|
{
|
|
7657
7718
|
type: "button",
|
|
@@ -7662,7 +7723,7 @@ var ImageEditor = ({
|
|
|
7662
7723
|
children: "Transform Selection"
|
|
7663
7724
|
}
|
|
7664
7725
|
),
|
|
7665
|
-
/* @__PURE__ */ (0,
|
|
7726
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7666
7727
|
"button",
|
|
7667
7728
|
{
|
|
7668
7729
|
type: "button",
|
|
@@ -7674,14 +7735,14 @@ var ImageEditor = ({
|
|
|
7674
7735
|
}
|
|
7675
7736
|
)
|
|
7676
7737
|
] }),
|
|
7677
|
-
/* @__PURE__ */ (0,
|
|
7678
|
-
/* @__PURE__ */ (0,
|
|
7679
|
-
/* @__PURE__ */ (0,
|
|
7738
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
7739
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ChannelsPanel, { controller }),
|
|
7740
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PathsPanel, { controller })
|
|
7680
7741
|
] }),
|
|
7681
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
7682
|
-
/* @__PURE__ */ (0,
|
|
7683
|
-
/* @__PURE__ */ (0,
|
|
7684
|
-
/* @__PURE__ */ (0,
|
|
7742
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7743
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
7744
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Results go to" }),
|
|
7745
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7685
7746
|
"select",
|
|
7686
7747
|
{
|
|
7687
7748
|
"aria-label": "AI result target",
|
|
@@ -7689,54 +7750,54 @@ var ImageEditor = ({
|
|
|
7689
7750
|
onChange: (e) => setAiTarget(e.target.value),
|
|
7690
7751
|
className: imageSelectClass,
|
|
7691
7752
|
children: [
|
|
7692
|
-
/* @__PURE__ */ (0,
|
|
7693
|
-
/* @__PURE__ */ (0,
|
|
7694
|
-
/* @__PURE__ */ (0,
|
|
7753
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
7754
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
7755
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: "replace", children: "Replace image" })
|
|
7695
7756
|
]
|
|
7696
7757
|
}
|
|
7697
7758
|
)
|
|
7698
7759
|
] }),
|
|
7699
|
-
/* @__PURE__ */ (0,
|
|
7700
|
-
/* @__PURE__ */ (0,
|
|
7701
|
-
/* @__PURE__ */ (0,
|
|
7702
|
-
/* @__PURE__ */ (0,
|
|
7760
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7761
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7762
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7763
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.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" }) }),
|
|
7703
7764
|
"Background Removal"
|
|
7704
7765
|
] }),
|
|
7705
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
7766
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime40.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..." })
|
|
7706
7767
|
] }),
|
|
7707
|
-
/* @__PURE__ */ (0,
|
|
7708
|
-
/* @__PURE__ */ (0,
|
|
7768
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
7769
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7709
7770
|
"button",
|
|
7710
7771
|
{
|
|
7711
7772
|
type: "button",
|
|
7712
7773
|
onClick: handleRemoveBackground,
|
|
7713
7774
|
disabled: isRemovingBg || isInpainting,
|
|
7714
7775
|
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",
|
|
7715
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
7716
|
-
/* @__PURE__ */ (0,
|
|
7776
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
7777
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageSpinnerClass }),
|
|
7717
7778
|
"Removing Background..."
|
|
7718
|
-
] }) : /* @__PURE__ */ (0,
|
|
7719
|
-
/* @__PURE__ */ (0,
|
|
7779
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
7780
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.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" }) }),
|
|
7720
7781
|
"Remove Background"
|
|
7721
7782
|
] })
|
|
7722
7783
|
}
|
|
7723
7784
|
)
|
|
7724
7785
|
] }),
|
|
7725
|
-
/* @__PURE__ */ (0,
|
|
7726
|
-
/* @__PURE__ */ (0,
|
|
7727
|
-
/* @__PURE__ */ (0,
|
|
7728
|
-
/* @__PURE__ */ (0,
|
|
7729
|
-
/* @__PURE__ */ (0,
|
|
7730
|
-
/* @__PURE__ */ (0,
|
|
7786
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7787
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7788
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7789
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
7790
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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" }),
|
|
7791
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("path", { d: "m14 7 3 3" })
|
|
7731
7792
|
] }),
|
|
7732
7793
|
"Generative Inpainting"
|
|
7733
7794
|
] }),
|
|
7734
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7795
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime40.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..." })
|
|
7735
7796
|
] }),
|
|
7736
|
-
/* @__PURE__ */ (0,
|
|
7737
|
-
/* @__PURE__ */ (0,
|
|
7738
|
-
/* @__PURE__ */ (0,
|
|
7739
|
-
/* @__PURE__ */ (0,
|
|
7797
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
7798
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7799
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7800
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7740
7801
|
"textarea",
|
|
7741
7802
|
{
|
|
7742
7803
|
id: "ai-inpaint-prompt-react",
|
|
@@ -7748,10 +7809,10 @@ var ImageEditor = ({
|
|
|
7748
7809
|
}
|
|
7749
7810
|
)
|
|
7750
7811
|
] }),
|
|
7751
|
-
/* @__PURE__ */ (0,
|
|
7752
|
-
/* @__PURE__ */ (0,
|
|
7753
|
-
/* @__PURE__ */ (0,
|
|
7754
|
-
/* @__PURE__ */ (0,
|
|
7812
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7813
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7814
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7815
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7755
7816
|
"button",
|
|
7756
7817
|
{
|
|
7757
7818
|
type: "button",
|
|
@@ -7764,7 +7825,7 @@ var ImageEditor = ({
|
|
|
7764
7825
|
]
|
|
7765
7826
|
}
|
|
7766
7827
|
),
|
|
7767
|
-
/* @__PURE__ */ (0,
|
|
7828
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
7768
7829
|
"button",
|
|
7769
7830
|
{
|
|
7770
7831
|
type: "button",
|
|
@@ -7779,25 +7840,25 @@ var ImageEditor = ({
|
|
|
7779
7840
|
)
|
|
7780
7841
|
] })
|
|
7781
7842
|
] }),
|
|
7782
|
-
/* @__PURE__ */ (0,
|
|
7843
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7783
7844
|
"button",
|
|
7784
7845
|
{
|
|
7785
7846
|
type: "button",
|
|
7786
7847
|
onClick: handleInpaint,
|
|
7787
7848
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
7788
7849
|
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",
|
|
7789
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
7790
|
-
/* @__PURE__ */ (0,
|
|
7850
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
7851
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: imageSpinnerClass }),
|
|
7791
7852
|
"Generating Inpaint..."
|
|
7792
|
-
] }) : /* @__PURE__ */ (0,
|
|
7793
|
-
/* @__PURE__ */ (0,
|
|
7853
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.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" }) }),
|
|
7794
7855
|
"Apply Inpainting"
|
|
7795
7856
|
] })
|
|
7796
7857
|
}
|
|
7797
7858
|
)
|
|
7798
7859
|
] }),
|
|
7799
|
-
aiError && /* @__PURE__ */ (0,
|
|
7800
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7860
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
7861
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
7801
7862
|
] })
|
|
7802
7863
|
] })
|
|
7803
7864
|
] })
|
|
@@ -7835,6 +7896,7 @@ var ImageEditor = ({
|
|
|
7835
7896
|
SelectAndMaskWorkspace,
|
|
7836
7897
|
SelectionChangeCheck,
|
|
7837
7898
|
SelectionOptionsBar,
|
|
7899
|
+
SelectionRecipePanel,
|
|
7838
7900
|
SeparateSubjectPanel,
|
|
7839
7901
|
ShapeOptionsBar,
|
|
7840
7902
|
TypeOptionsBar,
|