@pixerate/editor-react 0.147.0 → 0.148.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-FL5RL6NO.js → chunk-HVGT7UE7.js} +478 -413
- package/dist/image-editor/SeparateSubjectPanel.d.cts +14 -0
- package/dist/image-editor/SeparateSubjectPanel.d.ts +14 -0
- package/dist/image-editor/index.cjs +489 -423
- 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 +1014 -948
- 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
|
+
SeparateSubjectPanel: () => SeparateSubjectPanel,
|
|
62
63
|
ShapeOptionsBar: () => ShapeOptionsBar,
|
|
63
64
|
TypeOptionsBar: () => TypeOptionsBar,
|
|
64
65
|
useImageEditor: () => useImageEditor,
|
|
@@ -237,7 +238,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
// src/image-editor/ImageEditor.tsx
|
|
240
|
-
var
|
|
241
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
241
242
|
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
242
243
|
|
|
243
244
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -5752,7 +5753,7 @@ var SelectionOptionsBar = ({
|
|
|
5752
5753
|
};
|
|
5753
5754
|
|
|
5754
5755
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5755
|
-
var
|
|
5756
|
+
var import_react32 = require("react");
|
|
5756
5757
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5757
5758
|
|
|
5758
5759
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
@@ -5842,20 +5843,83 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
|
5842
5843
|
] });
|
|
5843
5844
|
};
|
|
5844
5845
|
|
|
5845
|
-
// src/image-editor/
|
|
5846
|
+
// src/image-editor/SeparateSubjectPanel.tsx
|
|
5847
|
+
var import_react31 = require("react");
|
|
5846
5848
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5847
|
-
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5848
5849
|
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";
|
|
5849
|
-
var
|
|
5850
|
-
const
|
|
5851
|
-
const [
|
|
5850
|
+
var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
5851
|
+
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5852
|
+
const [dilate, setDilate] = (0, import_react31.useState)(8);
|
|
5853
|
+
const [fill, setFill] = (0, import_react31.useState)(true);
|
|
5854
|
+
const [progress, setProgress] = (0, import_react31.useState)(null);
|
|
5852
5855
|
const [error, setError] = (0, import_react31.useState)(null);
|
|
5853
|
-
const
|
|
5854
|
-
const
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5856
|
+
const abort = (0, import_react31.useRef)(null);
|
|
5857
|
+
const run = async () => {
|
|
5858
|
+
setError(null);
|
|
5859
|
+
abort.current = new AbortController();
|
|
5860
|
+
setProgress("Starting");
|
|
5861
|
+
try {
|
|
5862
|
+
await controller.separateSubject({
|
|
5863
|
+
dilate,
|
|
5864
|
+
fill: fill ? "content-aware" : "none",
|
|
5865
|
+
signal: abort.current.signal,
|
|
5866
|
+
onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
|
|
5867
|
+
});
|
|
5868
|
+
} catch (err) {
|
|
5869
|
+
if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
|
|
5870
|
+
} finally {
|
|
5871
|
+
abort.current = null;
|
|
5872
|
+
setProgress(null);
|
|
5873
|
+
}
|
|
5874
|
+
};
|
|
5875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
|
|
5878
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
5880
|
+
"Grow",
|
|
5881
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5882
|
+
"input",
|
|
5883
|
+
{
|
|
5884
|
+
type: "number",
|
|
5885
|
+
min: 0,
|
|
5886
|
+
max: 200,
|
|
5887
|
+
"aria-label": "Separate grow",
|
|
5888
|
+
value: dilate,
|
|
5889
|
+
onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
|
|
5890
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
5891
|
+
}
|
|
5892
|
+
),
|
|
5893
|
+
"px"
|
|
5894
|
+
] }),
|
|
5895
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
5896
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
|
|
5897
|
+
"Fill the background"
|
|
5898
|
+
] })
|
|
5899
|
+
] }),
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
5901
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
|
|
5902
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, onClick: () => abort.current?.abort(), children: "Cancel" })
|
|
5903
|
+
] }),
|
|
5904
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: progress }),
|
|
5905
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5906
|
+
] });
|
|
5907
|
+
};
|
|
5908
|
+
|
|
5909
|
+
// src/image-editor/RefineEdgePanel.tsx
|
|
5910
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5911
|
+
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5912
|
+
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";
|
|
5913
|
+
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
5914
|
+
const [params, setParams] = (0, import_react32.useState)(DEFAULT_PARAMS);
|
|
5915
|
+
const [busy, setBusy] = (0, import_react32.useState)(false);
|
|
5916
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
5917
|
+
const [layerId, setLayerId] = (0, import_react32.useState)("");
|
|
5918
|
+
const [newKind, setNewKind] = (0, import_react32.useState)("hueSaturation");
|
|
5919
|
+
const [output, setOutput] = (0, import_react32.useState)("selection");
|
|
5920
|
+
const [decontaminate, setDecontaminate] = (0, import_react32.useState)(0);
|
|
5921
|
+
const [objectAware, setObjectAware] = (0, import_react32.useState)(false);
|
|
5922
|
+
const [onlyUncertain, setOnlyUncertain] = (0, import_react32.useState)(false);
|
|
5859
5923
|
const canObject = Boolean(controller.segmentationProvider);
|
|
5860
5924
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
5861
5925
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -5878,17 +5942,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5878
5942
|
setBusy(false);
|
|
5879
5943
|
}
|
|
5880
5944
|
};
|
|
5881
|
-
return /* @__PURE__ */ (0,
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
5883
|
-
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
5884
|
-
/* @__PURE__ */ (0,
|
|
5885
|
-
/* @__PURE__ */ (0,
|
|
5886
|
-
/* @__PURE__ */ (0,
|
|
5945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
5947
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5948
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: c.label }),
|
|
5950
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
5887
5951
|
params[c.id],
|
|
5888
5952
|
c.unit
|
|
5889
5953
|
] })
|
|
5890
5954
|
] }),
|
|
5891
|
-
/* @__PURE__ */ (0,
|
|
5955
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5892
5956
|
"input",
|
|
5893
5957
|
{
|
|
5894
5958
|
type: "range",
|
|
@@ -5902,43 +5966,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5902
5966
|
}
|
|
5903
5967
|
)
|
|
5904
5968
|
] }, c.id)),
|
|
5905
|
-
/* @__PURE__ */ (0,
|
|
5906
|
-
/* @__PURE__ */ (0,
|
|
5969
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5970
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
5907
5971
|
"Smart Radius"
|
|
5908
5972
|
] }),
|
|
5909
|
-
/* @__PURE__ */ (0,
|
|
5910
|
-
/* @__PURE__ */ (0,
|
|
5973
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
5974
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
5911
5975
|
"Only uncertain areas"
|
|
5912
5976
|
] }),
|
|
5913
|
-
canObject && /* @__PURE__ */ (0,
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
5977
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5978
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
5915
5979
|
"Object aware (segmentation model)"
|
|
5916
5980
|
] }),
|
|
5917
|
-
/* @__PURE__ */ (0,
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5918
5982
|
"Output to",
|
|
5919
|
-
/* @__PURE__ */ (0,
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5920
5984
|
"select",
|
|
5921
5985
|
{
|
|
5922
5986
|
"aria-label": "Refine output",
|
|
5923
5987
|
value: output,
|
|
5924
5988
|
onChange: (e) => setOutput(e.target.value),
|
|
5925
5989
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5926
|
-
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0,
|
|
5990
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
5927
5991
|
}
|
|
5928
5992
|
)
|
|
5929
5993
|
] }),
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
5931
|
-
/* @__PURE__ */ (0,
|
|
5932
|
-
/* @__PURE__ */ (0,
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5995
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5996
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
|
|
5933
5997
|
"Decontaminate colors",
|
|
5934
5998
|
toLayer ? "" : " (new layer or document outputs)"
|
|
5935
5999
|
] }),
|
|
5936
|
-
/* @__PURE__ */ (0,
|
|
6000
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
5937
6001
|
decontaminate,
|
|
5938
6002
|
"%"
|
|
5939
6003
|
] })
|
|
5940
6004
|
] }),
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
6005
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5942
6006
|
"input",
|
|
5943
6007
|
{
|
|
5944
6008
|
type: "range",
|
|
@@ -5953,65 +6017,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5953
6017
|
}
|
|
5954
6018
|
)
|
|
5955
6019
|
] }),
|
|
5956
|
-
/* @__PURE__ */ (0,
|
|
5957
|
-
/* @__PURE__ */ (0,
|
|
5958
|
-
/* @__PURE__ */ (0,
|
|
6020
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", children: [
|
|
6021
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
5959
6023
|
] }),
|
|
5960
|
-
error && /* @__PURE__ */ (0,
|
|
5961
|
-
/* @__PURE__ */ (0,
|
|
5962
|
-
/* @__PURE__ */ (0,
|
|
5963
|
-
/* @__PURE__ */ (0,
|
|
5964
|
-
/* @__PURE__ */ (0,
|
|
5965
|
-
|
|
6024
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
6025
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MaskEdgeCheck, { controller, selection: sel }),
|
|
6026
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectionChangeCheck, { controller, selection: sel }),
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
|
|
6028
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
6030
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5966
6031
|
"select",
|
|
5967
6032
|
{
|
|
5968
6033
|
"aria-label": "New masked layer kind",
|
|
5969
6034
|
value: newKind,
|
|
5970
6035
|
onChange: (e) => setNewKind(e.target.value),
|
|
5971
6036
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5972
|
-
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
6037
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
5973
6038
|
}
|
|
5974
6039
|
),
|
|
5975
|
-
/* @__PURE__ */ (0,
|
|
6040
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5976
6041
|
"button",
|
|
5977
6042
|
{
|
|
5978
6043
|
type: "button",
|
|
5979
|
-
className:
|
|
6044
|
+
className: button7,
|
|
5980
6045
|
disabled: !sel,
|
|
5981
6046
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
|
|
5982
6047
|
children: "New Masked Layer"
|
|
5983
6048
|
}
|
|
5984
6049
|
)
|
|
5985
6050
|
] }),
|
|
5986
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
5987
|
-
/* @__PURE__ */ (0,
|
|
6051
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
6052
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5988
6053
|
"select",
|
|
5989
6054
|
{
|
|
5990
6055
|
"aria-label": "Mask layer",
|
|
5991
6056
|
value: target.id,
|
|
5992
6057
|
onChange: (e) => setLayerId(e.target.value),
|
|
5993
6058
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5994
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
6059
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("option", { value: l.id, children: [
|
|
5995
6060
|
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
5996
6061
|
l.mask ? " (masked)" : ""
|
|
5997
6062
|
] }, l.id))
|
|
5998
6063
|
}
|
|
5999
6064
|
),
|
|
6000
|
-
/* @__PURE__ */ (0,
|
|
6001
|
-
/* @__PURE__ */ (0,
|
|
6002
|
-
/* @__PURE__ */ (0,
|
|
6003
|
-
/* @__PURE__ */ (0,
|
|
6065
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
6067
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
6004
6069
|
] }),
|
|
6005
|
-
target.mask && /* @__PURE__ */ (0,
|
|
6006
|
-
/* @__PURE__ */ (0,
|
|
6007
|
-
/* @__PURE__ */ (0,
|
|
6008
|
-
/* @__PURE__ */ (0,
|
|
6009
|
-
/* @__PURE__ */ (0,
|
|
6070
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6071
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6073
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Density" }),
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
6010
6075
|
Math.round((target.mask.density ?? 1) * 100),
|
|
6011
6076
|
"%"
|
|
6012
6077
|
] })
|
|
6013
6078
|
] }),
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6079
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6015
6080
|
"input",
|
|
6016
6081
|
{
|
|
6017
6082
|
type: "range",
|
|
@@ -6025,15 +6090,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6025
6090
|
}
|
|
6026
6091
|
)
|
|
6027
6092
|
] }),
|
|
6028
|
-
/* @__PURE__ */ (0,
|
|
6029
|
-
/* @__PURE__ */ (0,
|
|
6030
|
-
/* @__PURE__ */ (0,
|
|
6031
|
-
/* @__PURE__ */ (0,
|
|
6093
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6094
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
6095
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Mask Feather" }),
|
|
6096
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
|
|
6032
6097
|
target.mask.feather ?? 0,
|
|
6033
6098
|
"px"
|
|
6034
6099
|
] })
|
|
6035
6100
|
] }),
|
|
6036
|
-
/* @__PURE__ */ (0,
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6037
6102
|
"input",
|
|
6038
6103
|
{
|
|
6039
6104
|
type: "range",
|
|
@@ -6053,13 +6118,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
6053
6118
|
};
|
|
6054
6119
|
|
|
6055
6120
|
// src/image-editor/ChannelsPanel.tsx
|
|
6056
|
-
var
|
|
6121
|
+
var import_react33 = require("react");
|
|
6057
6122
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
6058
|
-
var
|
|
6123
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6059
6124
|
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"}`;
|
|
6060
6125
|
var ChannelThumb = ({ channel, size }) => {
|
|
6061
|
-
const ref = (0,
|
|
6062
|
-
(0,
|
|
6126
|
+
const ref = (0, import_react33.useRef)(null);
|
|
6127
|
+
(0, import_react33.useEffect)(() => {
|
|
6063
6128
|
const canvas = ref.current;
|
|
6064
6129
|
const ctx = canvas?.getContext("2d");
|
|
6065
6130
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -6070,15 +6135,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
6070
6135
|
img.data.set(px.data);
|
|
6071
6136
|
ctx.putImageData(img, 0, 0);
|
|
6072
6137
|
}, [channel.mask]);
|
|
6073
|
-
return /* @__PURE__ */ (0,
|
|
6138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
6074
6139
|
};
|
|
6075
6140
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
6076
|
-
const [, setTick] = (0,
|
|
6077
|
-
(0,
|
|
6078
|
-
const [activeId, setActiveId] = (0,
|
|
6079
|
-
const [renaming, setRenaming] = (0,
|
|
6080
|
-
const [error, setError] = (0,
|
|
6081
|
-
const fileInput = (0,
|
|
6141
|
+
const [, setTick] = (0, import_react33.useState)(0);
|
|
6142
|
+
(0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6143
|
+
const [activeId, setActiveId] = (0, import_react33.useState)(null);
|
|
6144
|
+
const [renaming, setRenaming] = (0, import_react33.useState)(null);
|
|
6145
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
6146
|
+
const fileInput = (0, import_react33.useRef)(null);
|
|
6082
6147
|
const channels = controller.getChannels();
|
|
6083
6148
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
6084
6149
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -6100,13 +6165,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6100
6165
|
setError(err instanceof Error ? err.message : String(err));
|
|
6101
6166
|
}
|
|
6102
6167
|
};
|
|
6103
|
-
return /* @__PURE__ */ (0,
|
|
6104
|
-
/* @__PURE__ */ (0,
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6106
|
-
/* @__PURE__ */ (0,
|
|
6168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
6169
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.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" })
|
|
6107
6172
|
] }),
|
|
6108
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
6109
|
-
/* @__PURE__ */ (0,
|
|
6173
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
6174
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6110
6175
|
"li",
|
|
6111
6176
|
{
|
|
6112
6177
|
"data-testid": "channel-row",
|
|
@@ -6118,7 +6183,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6118
6183
|
},
|
|
6119
6184
|
onDoubleClick: () => setRenaming(c.id),
|
|
6120
6185
|
children: [
|
|
6121
|
-
/* @__PURE__ */ (0,
|
|
6186
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6122
6187
|
"button",
|
|
6123
6188
|
{
|
|
6124
6189
|
type: "button",
|
|
@@ -6132,8 +6197,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6132
6197
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
6133
6198
|
}
|
|
6134
6199
|
),
|
|
6135
|
-
/* @__PURE__ */ (0,
|
|
6136
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
6200
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
6201
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6137
6202
|
"input",
|
|
6138
6203
|
{
|
|
6139
6204
|
autoFocus: true,
|
|
@@ -6150,16 +6215,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6150
6215
|
if (e.key === "Escape") setRenaming(null);
|
|
6151
6216
|
}
|
|
6152
6217
|
}
|
|
6153
|
-
) : /* @__PURE__ */ (0,
|
|
6218
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
6154
6219
|
]
|
|
6155
6220
|
},
|
|
6156
6221
|
c.id
|
|
6157
6222
|
)) }),
|
|
6158
|
-
/* @__PURE__ */ (0,
|
|
6159
|
-
/* @__PURE__ */ (0,
|
|
6160
|
-
/* @__PURE__ */ (0,
|
|
6161
|
-
/* @__PURE__ */ (0,
|
|
6162
|
-
/* @__PURE__ */ (0,
|
|
6223
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6224
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
6225
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.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" }),
|
|
6226
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
6227
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6163
6228
|
"button",
|
|
6164
6229
|
{
|
|
6165
6230
|
type: "button",
|
|
@@ -6172,8 +6237,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6172
6237
|
children: "Delete"
|
|
6173
6238
|
}
|
|
6174
6239
|
),
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6176
|
-
/* @__PURE__ */ (0,
|
|
6240
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6177
6242
|
"button",
|
|
6178
6243
|
{
|
|
6179
6244
|
type: "button",
|
|
@@ -6184,7 +6249,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6184
6249
|
children: "Export PNG"
|
|
6185
6250
|
}
|
|
6186
6251
|
),
|
|
6187
|
-
/* @__PURE__ */ (0,
|
|
6252
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6188
6253
|
"input",
|
|
6189
6254
|
{
|
|
6190
6255
|
ref: fileInput,
|
|
@@ -6199,22 +6264,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6199
6264
|
}
|
|
6200
6265
|
)
|
|
6201
6266
|
] }),
|
|
6202
|
-
error && /* @__PURE__ */ (0,
|
|
6267
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6203
6268
|
] });
|
|
6204
6269
|
};
|
|
6205
6270
|
|
|
6206
6271
|
// src/image-editor/PathsPanel.tsx
|
|
6207
|
-
var
|
|
6272
|
+
var import_react34 = require("react");
|
|
6208
6273
|
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
6209
|
-
var
|
|
6274
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6210
6275
|
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"}`;
|
|
6211
6276
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
6212
|
-
const [, setTick] = (0,
|
|
6213
|
-
(0,
|
|
6214
|
-
const [renaming, setRenaming] = (0,
|
|
6215
|
-
const [color, setColor] = (0,
|
|
6216
|
-
const [width, setWidth] = (0,
|
|
6217
|
-
const [error, setError] = (0,
|
|
6277
|
+
const [, setTick] = (0, import_react34.useState)(0);
|
|
6278
|
+
(0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6279
|
+
const [renaming, setRenaming] = (0, import_react34.useState)(null);
|
|
6280
|
+
const [color, setColor] = (0, import_react34.useState)("#000000");
|
|
6281
|
+
const [width, setWidth] = (0, import_react34.useState)(2);
|
|
6282
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
6218
6283
|
const paths = controller.getPaths();
|
|
6219
6284
|
const activeId = controller.getState().activePathId ?? null;
|
|
6220
6285
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -6230,10 +6295,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6230
6295
|
};
|
|
6231
6296
|
return (
|
|
6232
6297
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
6233
|
-
/* @__PURE__ */ (0,
|
|
6234
|
-
/* @__PURE__ */ (0,
|
|
6235
|
-
paths.length === 0 && /* @__PURE__ */ (0,
|
|
6236
|
-
/* @__PURE__ */ (0,
|
|
6298
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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: [
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
6300
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
6301
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.jsxs)(
|
|
6237
6302
|
"li",
|
|
6238
6303
|
{
|
|
6239
6304
|
"data-testid": "path-row",
|
|
@@ -6242,8 +6307,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6242
6307
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6243
6308
|
onDoubleClick: () => setRenaming(p.id),
|
|
6244
6309
|
children: [
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6246
|
-
renaming === p.id ? /* @__PURE__ */ (0,
|
|
6310
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6311
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6247
6312
|
"input",
|
|
6248
6313
|
{
|
|
6249
6314
|
autoFocus: true,
|
|
@@ -6262,13 +6327,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6262
6327
|
if (e.key === "Escape") setRenaming(null);
|
|
6263
6328
|
}
|
|
6264
6329
|
}
|
|
6265
|
-
) : /* @__PURE__ */ (0,
|
|
6330
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
6266
6331
|
]
|
|
6267
6332
|
},
|
|
6268
6333
|
p.id
|
|
6269
6334
|
)) }),
|
|
6270
|
-
/* @__PURE__ */ (0,
|
|
6271
|
-
/* @__PURE__ */ (0,
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6272
6337
|
"button",
|
|
6273
6338
|
{
|
|
6274
6339
|
type: "button",
|
|
@@ -6279,15 +6344,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6279
6344
|
children: "Load as Selection"
|
|
6280
6345
|
}
|
|
6281
6346
|
),
|
|
6282
|
-
/* @__PURE__ */ (0,
|
|
6283
|
-
active?.work && /* @__PURE__ */ (0,
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6347
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
6348
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
6349
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
6285
6350
|
] }),
|
|
6286
|
-
/* @__PURE__ */ (0,
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6288
|
-
/* @__PURE__ */ (0,
|
|
6289
|
-
/* @__PURE__ */ (0,
|
|
6290
|
-
/* @__PURE__ */ (0,
|
|
6351
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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" }),
|
|
6353
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
6354
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
6355
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6291
6356
|
"input",
|
|
6292
6357
|
{
|
|
6293
6358
|
type: "number",
|
|
@@ -6302,25 +6367,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
6302
6367
|
),
|
|
6303
6368
|
"px"
|
|
6304
6369
|
] }),
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6370
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
6306
6371
|
] }),
|
|
6307
|
-
/* @__PURE__ */ (0,
|
|
6308
|
-
/* @__PURE__ */ (0,
|
|
6309
|
-
/* @__PURE__ */ (0,
|
|
6372
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6373
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
6374
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
6310
6375
|
] }),
|
|
6311
|
-
error && /* @__PURE__ */ (0,
|
|
6376
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6312
6377
|
] })
|
|
6313
6378
|
);
|
|
6314
6379
|
};
|
|
6315
6380
|
|
|
6316
6381
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
6317
|
-
var
|
|
6382
|
+
var import_react35 = require("react");
|
|
6318
6383
|
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
6319
|
-
var
|
|
6384
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6320
6385
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
6321
6386
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
6322
|
-
const [, setTick] = (0,
|
|
6323
|
-
(0,
|
|
6387
|
+
const [, setTick] = (0, import_react35.useState)(0);
|
|
6388
|
+
(0, import_react35.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
6324
6389
|
const bar = tool.bar();
|
|
6325
6390
|
if (!tool.active || !bar) return null;
|
|
6326
6391
|
const warp = tool.warpBar();
|
|
@@ -6332,17 +6397,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6332
6397
|
const v = Number(raw);
|
|
6333
6398
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
6334
6399
|
};
|
|
6335
|
-
return /* @__PURE__ */ (0,
|
|
6336
|
-
/* @__PURE__ */ (0,
|
|
6337
|
-
/* @__PURE__ */ (0,
|
|
6338
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
6339
|
-
/* @__PURE__ */ (0,
|
|
6340
|
-
/* @__PURE__ */ (0,
|
|
6341
|
-
/* @__PURE__ */ (0,
|
|
6400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.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: [
|
|
6401
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime35.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)) }),
|
|
6402
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime35.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)) }),
|
|
6403
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6405
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
6406
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
6342
6407
|
] }),
|
|
6343
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
6344
|
-
/* @__PURE__ */ (0,
|
|
6345
|
-
/* @__PURE__ */ (0,
|
|
6408
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6409
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
6410
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6346
6411
|
"input",
|
|
6347
6412
|
{
|
|
6348
6413
|
type: "number",
|
|
@@ -6363,9 +6428,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6363
6428
|
},
|
|
6364
6429
|
`${k}:${warp[k]}`
|
|
6365
6430
|
),
|
|
6366
|
-
/* @__PURE__ */ (0,
|
|
6431
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
6367
6432
|
] }, k)),
|
|
6368
|
-
/* @__PURE__ */ (0,
|
|
6433
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6369
6434
|
"button",
|
|
6370
6435
|
{
|
|
6371
6436
|
type: "button",
|
|
@@ -6377,9 +6442,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6377
6442
|
children: "Vertical"
|
|
6378
6443
|
}
|
|
6379
6444
|
),
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6381
|
-
/* @__PURE__ */ (0,
|
|
6382
|
-
/* @__PURE__ */ (0,
|
|
6445
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6446
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6383
6448
|
"select",
|
|
6384
6449
|
{
|
|
6385
6450
|
"aria-label": "Warp grid",
|
|
@@ -6389,14 +6454,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6389
6454
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
6390
6455
|
},
|
|
6391
6456
|
className: imageFieldClass,
|
|
6392
|
-
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
6457
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
6393
6458
|
}
|
|
6394
6459
|
)
|
|
6395
6460
|
] })
|
|
6396
6461
|
] }),
|
|
6397
|
-
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6462
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
6463
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
6464
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6400
6465
|
"input",
|
|
6401
6466
|
{
|
|
6402
6467
|
type: "number",
|
|
@@ -6416,8 +6481,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6416
6481
|
},
|
|
6417
6482
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
6418
6483
|
),
|
|
6419
|
-
/* @__PURE__ */ (0,
|
|
6420
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
6484
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
6485
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6421
6486
|
"button",
|
|
6422
6487
|
{
|
|
6423
6488
|
type: "button",
|
|
@@ -6432,33 +6497,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6432
6497
|
}
|
|
6433
6498
|
)
|
|
6434
6499
|
] }, f.id)),
|
|
6435
|
-
/* @__PURE__ */ (0,
|
|
6436
|
-
/* @__PURE__ */ (0,
|
|
6437
|
-
/* @__PURE__ */ (0,
|
|
6500
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6501
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
6502
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6438
6503
|
"select",
|
|
6439
6504
|
{
|
|
6440
6505
|
"aria-label": "Interpolation",
|
|
6441
6506
|
value: tool.interpolation,
|
|
6442
6507
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
6443
6508
|
className: imageFieldClass,
|
|
6444
|
-
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
6509
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
6445
6510
|
}
|
|
6446
6511
|
)
|
|
6447
6512
|
] }),
|
|
6448
|
-
/* @__PURE__ */ (0,
|
|
6449
|
-
/* @__PURE__ */ (0,
|
|
6450
|
-
tool.error && /* @__PURE__ */ (0,
|
|
6513
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.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" }),
|
|
6514
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
6515
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
6451
6516
|
] });
|
|
6452
6517
|
};
|
|
6453
6518
|
|
|
6454
6519
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
6455
|
-
var
|
|
6520
|
+
var import_react36 = require("react");
|
|
6456
6521
|
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
6457
|
-
var
|
|
6522
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6458
6523
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
6459
|
-
const [, setTick] = (0,
|
|
6460
|
-
(0,
|
|
6461
|
-
const [error, setError] = (0,
|
|
6524
|
+
const [, setTick] = (0, import_react36.useState)(0);
|
|
6525
|
+
(0, import_react36.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6526
|
+
const [error, setError] = (0, import_react36.useState)(null);
|
|
6462
6527
|
const active = controller.getActiveLayer();
|
|
6463
6528
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
6464
6529
|
const set = (change) => {
|
|
@@ -6472,22 +6537,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6472
6537
|
}
|
|
6473
6538
|
};
|
|
6474
6539
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
6475
|
-
return /* @__PURE__ */ (0,
|
|
6476
|
-
/* @__PURE__ */ (0,
|
|
6477
|
-
/* @__PURE__ */ (0,
|
|
6478
|
-
/* @__PURE__ */ (0,
|
|
6479
|
-
/* @__PURE__ */ (0,
|
|
6540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
6542
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6543
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6544
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
6480
6545
|
"Fill",
|
|
6481
|
-
/* @__PURE__ */ (0,
|
|
6546
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
6482
6547
|
] }),
|
|
6483
|
-
/* @__PURE__ */ (0,
|
|
6484
|
-
/* @__PURE__ */ (0,
|
|
6548
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6549
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
6485
6550
|
"Stroke",
|
|
6486
|
-
/* @__PURE__ */ (0,
|
|
6551
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
6487
6552
|
] }),
|
|
6488
|
-
/* @__PURE__ */ (0,
|
|
6553
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6489
6554
|
"Width",
|
|
6490
|
-
/* @__PURE__ */ (0,
|
|
6555
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6491
6556
|
"input",
|
|
6492
6557
|
{
|
|
6493
6558
|
type: "number",
|
|
@@ -6501,52 +6566,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6501
6566
|
)
|
|
6502
6567
|
] })
|
|
6503
6568
|
] }),
|
|
6504
|
-
/* @__PURE__ */ (0,
|
|
6505
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
6569
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6570
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6506
6571
|
"Radius",
|
|
6507
|
-
/* @__PURE__ */ (0,
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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}` })
|
|
6508
6573
|
] }),
|
|
6509
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
6574
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6510
6575
|
"Sides",
|
|
6511
|
-
/* @__PURE__ */ (0,
|
|
6576
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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}` })
|
|
6512
6577
|
] }),
|
|
6513
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
6514
|
-
/* @__PURE__ */ (0,
|
|
6578
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6579
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6515
6580
|
"Points",
|
|
6516
|
-
/* @__PURE__ */ (0,
|
|
6581
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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}` })
|
|
6517
6582
|
] }),
|
|
6518
|
-
/* @__PURE__ */ (0,
|
|
6583
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6519
6584
|
"Inner",
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
6521
6586
|
] })
|
|
6522
6587
|
] }),
|
|
6523
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
6524
|
-
/* @__PURE__ */ (0,
|
|
6588
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6589
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6525
6590
|
"Weight",
|
|
6526
|
-
/* @__PURE__ */ (0,
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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}` })
|
|
6527
6592
|
] }),
|
|
6528
|
-
/* @__PURE__ */ (0,
|
|
6529
|
-
/* @__PURE__ */ (0,
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
6530
6595
|
"Arrowhead"
|
|
6531
6596
|
] })
|
|
6532
6597
|
] })
|
|
6533
6598
|
] }),
|
|
6534
|
-
/* @__PURE__ */ (0,
|
|
6535
|
-
error && /* @__PURE__ */ (0,
|
|
6599
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.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." }),
|
|
6600
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6536
6601
|
] });
|
|
6537
6602
|
};
|
|
6538
6603
|
|
|
6539
6604
|
// src/image-editor/TypeOptionsBar.tsx
|
|
6540
|
-
var
|
|
6605
|
+
var import_react37 = require("react");
|
|
6541
6606
|
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
6542
|
-
var
|
|
6607
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6543
6608
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
6544
6609
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
6545
6610
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
6546
|
-
const [, setTick] = (0,
|
|
6547
|
-
(0,
|
|
6548
|
-
(0,
|
|
6549
|
-
const [error, setError] = (0,
|
|
6611
|
+
const [, setTick] = (0, import_react37.useState)(0);
|
|
6612
|
+
(0, import_react37.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6613
|
+
(0, import_react37.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
6614
|
+
const [error, setError] = (0, import_react37.useState)(null);
|
|
6550
6615
|
const active = controller.getActiveLayer();
|
|
6551
6616
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
6552
6617
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -6599,11 +6664,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6599
6664
|
setError(e instanceof Error ? e.message : String(e));
|
|
6600
6665
|
}
|
|
6601
6666
|
};
|
|
6602
|
-
return /* @__PURE__ */ (0,
|
|
6603
|
-
/* @__PURE__ */ (0,
|
|
6604
|
-
/* @__PURE__ */ (0,
|
|
6667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6668
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6669
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6605
6670
|
"Font",
|
|
6606
|
-
/* @__PURE__ */ (0,
|
|
6671
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6607
6672
|
"input",
|
|
6608
6673
|
{
|
|
6609
6674
|
list: "pixerate-type-fonts",
|
|
@@ -6613,11 +6678,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6613
6678
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
6614
6679
|
}
|
|
6615
6680
|
),
|
|
6616
|
-
/* @__PURE__ */ (0,
|
|
6681
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: f }, f)) })
|
|
6617
6682
|
] }),
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6683
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6619
6684
|
"Size",
|
|
6620
|
-
/* @__PURE__ */ (0,
|
|
6685
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6621
6686
|
"input",
|
|
6622
6687
|
{
|
|
6623
6688
|
type: "number",
|
|
@@ -6630,14 +6695,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6630
6695
|
}
|
|
6631
6696
|
)
|
|
6632
6697
|
] }),
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6635
|
-
/* @__PURE__ */ (0,
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.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" }),
|
|
6699
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6700
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
6636
6701
|
] }),
|
|
6637
|
-
/* @__PURE__ */ (0,
|
|
6638
|
-
/* @__PURE__ */ (0,
|
|
6639
|
-
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0,
|
|
6640
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6702
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6703
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6704
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6705
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6641
6706
|
"button",
|
|
6642
6707
|
{
|
|
6643
6708
|
type: "button",
|
|
@@ -6649,19 +6714,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6649
6714
|
}
|
|
6650
6715
|
)
|
|
6651
6716
|
] }),
|
|
6652
|
-
/* @__PURE__ */ (0,
|
|
6653
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6717
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.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." }),
|
|
6718
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
6654
6719
|
"Missing ",
|
|
6655
6720
|
missing.length === 1 ? "font" : "fonts",
|
|
6656
6721
|
": ",
|
|
6657
6722
|
missing.join(", ")
|
|
6658
6723
|
] }),
|
|
6659
|
-
error && /* @__PURE__ */ (0,
|
|
6724
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6660
6725
|
] });
|
|
6661
6726
|
};
|
|
6662
6727
|
|
|
6663
6728
|
// src/image-editor/ImageEditor.tsx
|
|
6664
|
-
var
|
|
6729
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6665
6730
|
var ImageEditor = ({
|
|
6666
6731
|
editor: externalEditor,
|
|
6667
6732
|
src,
|
|
@@ -6686,32 +6751,32 @@ var ImageEditor = ({
|
|
|
6686
6751
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
6687
6752
|
});
|
|
6688
6753
|
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
6689
|
-
const [activeTab, setActiveTab] = (0,
|
|
6690
|
-
const rootRef = (0,
|
|
6754
|
+
const [activeTab, setActiveTab] = (0, import_react38.useState)("crop");
|
|
6755
|
+
const rootRef = (0, import_react38.useRef)(null);
|
|
6691
6756
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
6692
|
-
const activeTabRef = (0,
|
|
6757
|
+
const activeTabRef = (0, import_react38.useRef)(activeTab);
|
|
6693
6758
|
activeTabRef.current = activeTab;
|
|
6694
6759
|
const openPanel = async (ref) => {
|
|
6695
6760
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
6696
6761
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
6697
6762
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
6698
6763
|
};
|
|
6699
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
6700
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
6701
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
6702
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
6703
|
-
const [typeSession, setTypeSession] = (0,
|
|
6704
|
-
const [selectionError, setSelectionError] = (0,
|
|
6705
|
-
const [paintError, setPaintError] = (0,
|
|
6706
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
6764
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react38.useState)(null);
|
|
6765
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react38.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6766
|
+
const [shapeOptions, setShapeOptions] = (0, import_react38.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6767
|
+
const [typeOptions, setTypeOptions] = (0, import_react38.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6768
|
+
const [typeSession, setTypeSession] = (0, import_react38.useState)(null);
|
|
6769
|
+
const [selectionError, setSelectionError] = (0, import_react38.useState)(null);
|
|
6770
|
+
const [paintError, setPaintError] = (0, import_react38.useState)(null);
|
|
6771
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react38.useState)(null);
|
|
6707
6772
|
const handleCanvasError = (source, message) => {
|
|
6708
6773
|
if (source === "paint") setPaintError(message);
|
|
6709
6774
|
else if (source === "select") setSelectionError(message);
|
|
6710
6775
|
else setShapeTypeError(message);
|
|
6711
6776
|
};
|
|
6712
6777
|
const finishTyping = () => setTypeSession(null);
|
|
6713
|
-
const transformToolRef = (0,
|
|
6714
|
-
const transformControllerRef = (0,
|
|
6778
|
+
const transformToolRef = (0, import_react38.useRef)(null);
|
|
6779
|
+
const transformControllerRef = (0, import_react38.useRef)(controller);
|
|
6715
6780
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
6716
6781
|
transformToolRef.current?.cancel();
|
|
6717
6782
|
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
@@ -6720,16 +6785,16 @@ var ImageEditor = ({
|
|
|
6720
6785
|
transformControllerRef.current = controller;
|
|
6721
6786
|
}
|
|
6722
6787
|
const transformTool = transformToolRef.current;
|
|
6723
|
-
const [, setTransformTick] = (0,
|
|
6724
|
-
(0,
|
|
6725
|
-
(0,
|
|
6726
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
6727
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
6728
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
6729
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
6730
|
-
const [aiError, setAiError] = (0,
|
|
6731
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
6732
|
-
const [aiTarget, setAiTarget] = (0,
|
|
6788
|
+
const [, setTransformTick] = (0, import_react38.useState)(0);
|
|
6789
|
+
(0, import_react38.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
6790
|
+
(0, import_react38.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
6791
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react38.useState)("");
|
|
6792
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react38.useState)("annotations");
|
|
6793
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react38.useState)(false);
|
|
6794
|
+
const [isInpainting, setIsInpainting] = (0, import_react38.useState)(false);
|
|
6795
|
+
const [aiError, setAiError] = (0, import_react38.useState)(null);
|
|
6796
|
+
const [aiSuccess, setAiSuccess] = (0, import_react38.useState)(null);
|
|
6797
|
+
const [aiTarget, setAiTarget] = (0, import_react38.useState)("auto");
|
|
6733
6798
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
6734
6799
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
6735
6800
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -6792,11 +6857,11 @@ var ImageEditor = ({
|
|
|
6792
6857
|
setIsInpainting(false);
|
|
6793
6858
|
}
|
|
6794
6859
|
};
|
|
6795
|
-
const [activeColor, setActiveColor] = (0,
|
|
6796
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
6797
|
-
const [fontSize, setFontSize] = (0,
|
|
6798
|
-
const [textInput, setTextInput] = (0,
|
|
6799
|
-
(0,
|
|
6860
|
+
const [activeColor, setActiveColor] = (0, import_react38.useState)("#ef4444");
|
|
6861
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react38.useState)(3);
|
|
6862
|
+
const [fontSize, setFontSize] = (0, import_react38.useState)(24);
|
|
6863
|
+
const [textInput, setTextInput] = (0, import_react38.useState)("");
|
|
6864
|
+
(0, import_react38.useEffect)(() => {
|
|
6800
6865
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
6801
6866
|
editor.setTool("crop");
|
|
6802
6867
|
}
|
|
@@ -6824,16 +6889,16 @@ var ImageEditor = ({
|
|
|
6824
6889
|
link.click();
|
|
6825
6890
|
}
|
|
6826
6891
|
};
|
|
6827
|
-
return /* @__PURE__ */ (0,
|
|
6892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6828
6893
|
"div",
|
|
6829
6894
|
{
|
|
6830
6895
|
ref: rootRef,
|
|
6831
6896
|
className: `${imageEditorFrameClass} ${className}`,
|
|
6832
6897
|
style,
|
|
6833
6898
|
children: [
|
|
6834
|
-
/* @__PURE__ */ (0,
|
|
6835
|
-
/* @__PURE__ */ (0,
|
|
6836
|
-
/* @__PURE__ */ (0,
|
|
6899
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
6901
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6837
6902
|
"button",
|
|
6838
6903
|
{
|
|
6839
6904
|
type: "button",
|
|
@@ -6848,7 +6913,7 @@ var ImageEditor = ({
|
|
|
6848
6913
|
children: "Transform & Crop"
|
|
6849
6914
|
}
|
|
6850
6915
|
),
|
|
6851
|
-
/* @__PURE__ */ (0,
|
|
6916
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6852
6917
|
"button",
|
|
6853
6918
|
{
|
|
6854
6919
|
type: "button",
|
|
@@ -6863,7 +6928,7 @@ var ImageEditor = ({
|
|
|
6863
6928
|
children: "Adjustments"
|
|
6864
6929
|
}
|
|
6865
6930
|
),
|
|
6866
|
-
/* @__PURE__ */ (0,
|
|
6931
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6867
6932
|
"button",
|
|
6868
6933
|
{
|
|
6869
6934
|
type: "button",
|
|
@@ -6878,7 +6943,7 @@ var ImageEditor = ({
|
|
|
6878
6943
|
children: "Layers"
|
|
6879
6944
|
}
|
|
6880
6945
|
),
|
|
6881
|
-
/* @__PURE__ */ (0,
|
|
6946
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6882
6947
|
"button",
|
|
6883
6948
|
{
|
|
6884
6949
|
type: "button",
|
|
@@ -6893,7 +6958,7 @@ var ImageEditor = ({
|
|
|
6893
6958
|
children: "Paint"
|
|
6894
6959
|
}
|
|
6895
6960
|
),
|
|
6896
|
-
/* @__PURE__ */ (0,
|
|
6961
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6897
6962
|
"button",
|
|
6898
6963
|
{
|
|
6899
6964
|
type: "button",
|
|
@@ -6908,7 +6973,7 @@ var ImageEditor = ({
|
|
|
6908
6973
|
children: "Select & Mask"
|
|
6909
6974
|
}
|
|
6910
6975
|
),
|
|
6911
|
-
/* @__PURE__ */ (0,
|
|
6976
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6912
6977
|
"button",
|
|
6913
6978
|
{
|
|
6914
6979
|
type: "button",
|
|
@@ -6923,7 +6988,7 @@ var ImageEditor = ({
|
|
|
6923
6988
|
children: "Annotations"
|
|
6924
6989
|
}
|
|
6925
6990
|
),
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
6991
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6927
6992
|
"button",
|
|
6928
6993
|
{
|
|
6929
6994
|
type: "button",
|
|
@@ -6938,7 +7003,7 @@ var ImageEditor = ({
|
|
|
6938
7003
|
children: "Depth Mask"
|
|
6939
7004
|
}
|
|
6940
7005
|
),
|
|
6941
|
-
/* @__PURE__ */ (0,
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6942
7007
|
"button",
|
|
6943
7008
|
{
|
|
6944
7009
|
type: "button",
|
|
@@ -6951,14 +7016,14 @@ var ImageEditor = ({
|
|
|
6951
7016
|
"aria-selected": activeTab === "ai",
|
|
6952
7017
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
6953
7018
|
children: [
|
|
6954
|
-
/* @__PURE__ */ (0,
|
|
7019
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
|
|
6955
7020
|
"AI Tools"
|
|
6956
7021
|
]
|
|
6957
7022
|
}
|
|
6958
7023
|
)
|
|
6959
7024
|
] }),
|
|
6960
|
-
/* @__PURE__ */ (0,
|
|
6961
|
-
/* @__PURE__ */ (0,
|
|
7025
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
7026
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6962
7027
|
"button",
|
|
6963
7028
|
{
|
|
6964
7029
|
type: "button",
|
|
@@ -6969,7 +7034,7 @@ var ImageEditor = ({
|
|
|
6969
7034
|
children: "\u21A9"
|
|
6970
7035
|
}
|
|
6971
7036
|
),
|
|
6972
|
-
/* @__PURE__ */ (0,
|
|
7037
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6973
7038
|
"button",
|
|
6974
7039
|
{
|
|
6975
7040
|
type: "button",
|
|
@@ -6980,7 +7045,7 @@ var ImageEditor = ({
|
|
|
6980
7045
|
children: "\u21AA"
|
|
6981
7046
|
}
|
|
6982
7047
|
),
|
|
6983
|
-
/* @__PURE__ */ (0,
|
|
7048
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6984
7049
|
"button",
|
|
6985
7050
|
{
|
|
6986
7051
|
type: "button",
|
|
@@ -6989,8 +7054,8 @@ var ImageEditor = ({
|
|
|
6989
7054
|
children: "Reset"
|
|
6990
7055
|
}
|
|
6991
7056
|
),
|
|
6992
|
-
/* @__PURE__ */ (0,
|
|
6993
|
-
/* @__PURE__ */ (0,
|
|
7057
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
7058
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6994
7059
|
"button",
|
|
6995
7060
|
{
|
|
6996
7061
|
type: "button",
|
|
@@ -7000,11 +7065,11 @@ var ImageEditor = ({
|
|
|
7000
7065
|
children: "-"
|
|
7001
7066
|
}
|
|
7002
7067
|
),
|
|
7003
|
-
/* @__PURE__ */ (0,
|
|
7068
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
7004
7069
|
Math.round(state.zoom * 100),
|
|
7005
7070
|
"%"
|
|
7006
7071
|
] }),
|
|
7007
|
-
/* @__PURE__ */ (0,
|
|
7072
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7008
7073
|
"button",
|
|
7009
7074
|
{
|
|
7010
7075
|
type: "button",
|
|
@@ -7014,8 +7079,8 @@ var ImageEditor = ({
|
|
|
7014
7079
|
children: "+"
|
|
7015
7080
|
}
|
|
7016
7081
|
),
|
|
7017
|
-
/* @__PURE__ */ (0,
|
|
7018
|
-
/* @__PURE__ */ (0,
|
|
7082
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
7083
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7019
7084
|
"button",
|
|
7020
7085
|
{
|
|
7021
7086
|
type: "button",
|
|
@@ -7026,7 +7091,7 @@ var ImageEditor = ({
|
|
|
7026
7091
|
children: "Hold Compare"
|
|
7027
7092
|
}
|
|
7028
7093
|
),
|
|
7029
|
-
/* @__PURE__ */ (0,
|
|
7094
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7030
7095
|
"button",
|
|
7031
7096
|
{
|
|
7032
7097
|
type: "button",
|
|
@@ -7037,10 +7102,10 @@ var ImageEditor = ({
|
|
|
7037
7102
|
)
|
|
7038
7103
|
] })
|
|
7039
7104
|
] }),
|
|
7040
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
7041
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
7042
|
-
/* @__PURE__ */ (0,
|
|
7043
|
-
/* @__PURE__ */ (0,
|
|
7105
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
7106
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
7107
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
7108
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7044
7109
|
ImageEditorCanvas,
|
|
7045
7110
|
{
|
|
7046
7111
|
editor,
|
|
@@ -7064,11 +7129,11 @@ var ImageEditor = ({
|
|
|
7064
7129
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
7065
7130
|
}
|
|
7066
7131
|
),
|
|
7067
|
-
/* @__PURE__ */ (0,
|
|
7068
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
7069
|
-
/* @__PURE__ */ (0,
|
|
7070
|
-
/* @__PURE__ */ (0,
|
|
7071
|
-
/* @__PURE__ */ (0,
|
|
7132
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: imageSidebarClass, children: [
|
|
7133
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7134
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
7135
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
7136
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7072
7137
|
"button",
|
|
7073
7138
|
{
|
|
7074
7139
|
type: "button",
|
|
@@ -7080,7 +7145,7 @@ var ImageEditor = ({
|
|
|
7080
7145
|
children: "Freeform"
|
|
7081
7146
|
}
|
|
7082
7147
|
),
|
|
7083
|
-
/* @__PURE__ */ (0,
|
|
7148
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7084
7149
|
"button",
|
|
7085
7150
|
{
|
|
7086
7151
|
type: "button",
|
|
@@ -7092,7 +7157,7 @@ var ImageEditor = ({
|
|
|
7092
7157
|
children: "1:1 Square"
|
|
7093
7158
|
}
|
|
7094
7159
|
),
|
|
7095
|
-
/* @__PURE__ */ (0,
|
|
7160
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7096
7161
|
"button",
|
|
7097
7162
|
{
|
|
7098
7163
|
type: "button",
|
|
@@ -7104,7 +7169,7 @@ var ImageEditor = ({
|
|
|
7104
7169
|
children: "4:3 Standard"
|
|
7105
7170
|
}
|
|
7106
7171
|
),
|
|
7107
|
-
/* @__PURE__ */ (0,
|
|
7172
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7108
7173
|
"button",
|
|
7109
7174
|
{
|
|
7110
7175
|
type: "button",
|
|
@@ -7116,7 +7181,7 @@ var ImageEditor = ({
|
|
|
7116
7181
|
children: "16:9 Wide"
|
|
7117
7182
|
}
|
|
7118
7183
|
),
|
|
7119
|
-
/* @__PURE__ */ (0,
|
|
7184
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7120
7185
|
"button",
|
|
7121
7186
|
{
|
|
7122
7187
|
type: "button",
|
|
@@ -7128,7 +7193,7 @@ var ImageEditor = ({
|
|
|
7128
7193
|
children: "3:2 Photo"
|
|
7129
7194
|
}
|
|
7130
7195
|
),
|
|
7131
|
-
/* @__PURE__ */ (0,
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7132
7197
|
"button",
|
|
7133
7198
|
{
|
|
7134
7199
|
type: "button",
|
|
@@ -7141,10 +7206,10 @@ var ImageEditor = ({
|
|
|
7141
7206
|
}
|
|
7142
7207
|
)
|
|
7143
7208
|
] }),
|
|
7144
|
-
/* @__PURE__ */ (0,
|
|
7145
|
-
/* @__PURE__ */ (0,
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7147
|
-
/* @__PURE__ */ (0,
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
|
|
7210
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
7211
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
7212
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7148
7213
|
"button",
|
|
7149
7214
|
{
|
|
7150
7215
|
type: "button",
|
|
@@ -7153,7 +7218,7 @@ var ImageEditor = ({
|
|
|
7153
7218
|
children: "Rotate -90\xB0"
|
|
7154
7219
|
}
|
|
7155
7220
|
),
|
|
7156
|
-
/* @__PURE__ */ (0,
|
|
7221
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7157
7222
|
"button",
|
|
7158
7223
|
{
|
|
7159
7224
|
type: "button",
|
|
@@ -7162,7 +7227,7 @@ var ImageEditor = ({
|
|
|
7162
7227
|
children: "Rotate +90\xB0"
|
|
7163
7228
|
}
|
|
7164
7229
|
),
|
|
7165
|
-
/* @__PURE__ */ (0,
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7166
7231
|
"button",
|
|
7167
7232
|
{
|
|
7168
7233
|
type: "button",
|
|
@@ -7171,7 +7236,7 @@ var ImageEditor = ({
|
|
|
7171
7236
|
children: "Flip Horizontal"
|
|
7172
7237
|
}
|
|
7173
7238
|
),
|
|
7174
|
-
/* @__PURE__ */ (0,
|
|
7239
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7175
7240
|
"button",
|
|
7176
7241
|
{
|
|
7177
7242
|
type: "button",
|
|
@@ -7182,10 +7247,10 @@ var ImageEditor = ({
|
|
|
7182
7247
|
)
|
|
7183
7248
|
] })
|
|
7184
7249
|
] }),
|
|
7185
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
7186
|
-
/* @__PURE__ */ (0,
|
|
7187
|
-
/* @__PURE__ */ (0,
|
|
7188
|
-
/* @__PURE__ */ (0,
|
|
7250
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7251
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7252
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
7253
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7189
7254
|
"button",
|
|
7190
7255
|
{
|
|
7191
7256
|
type: "button",
|
|
@@ -7195,9 +7260,9 @@ var ImageEditor = ({
|
|
|
7195
7260
|
}
|
|
7196
7261
|
)
|
|
7197
7262
|
] }),
|
|
7198
|
-
/* @__PURE__ */ (0,
|
|
7199
|
-
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
7200
|
-
/* @__PURE__ */ (0,
|
|
7263
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Histogram, { histogram: editor.histogram }),
|
|
7264
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react38.default.Fragment, { children: [
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7201
7266
|
ControlSlider,
|
|
7202
7267
|
{
|
|
7203
7268
|
spec,
|
|
@@ -7206,14 +7271,14 @@ var ImageEditor = ({
|
|
|
7206
7271
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
7207
7272
|
}
|
|
7208
7273
|
),
|
|
7209
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
7274
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
7210
7275
|
"div",
|
|
7211
7276
|
{
|
|
7212
7277
|
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",
|
|
7213
7278
|
"data-testid": "image-editor-process-notice",
|
|
7214
7279
|
children: [
|
|
7215
|
-
/* @__PURE__ */ (0,
|
|
7216
|
-
/* @__PURE__ */ (0,
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
7281
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7217
7282
|
"button",
|
|
7218
7283
|
{
|
|
7219
7284
|
type: "button",
|
|
@@ -7226,7 +7291,7 @@ var ImageEditor = ({
|
|
|
7226
7291
|
}
|
|
7227
7292
|
)
|
|
7228
7293
|
] }, spec.id)),
|
|
7229
|
-
/* @__PURE__ */ (0,
|
|
7294
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7230
7295
|
AdjustmentLayersPanel,
|
|
7231
7296
|
{
|
|
7232
7297
|
controller,
|
|
@@ -7235,9 +7300,9 @@ var ImageEditor = ({
|
|
|
7235
7300
|
}
|
|
7236
7301
|
) })
|
|
7237
7302
|
] }),
|
|
7238
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
7239
|
-
/* @__PURE__ */ (0,
|
|
7240
|
-
/* @__PURE__ */ (0,
|
|
7303
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7304
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
7305
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7241
7306
|
"button",
|
|
7242
7307
|
{
|
|
7243
7308
|
type: "button",
|
|
@@ -7248,15 +7313,15 @@ var ImageEditor = ({
|
|
|
7248
7313
|
children: "Free Transform"
|
|
7249
7314
|
}
|
|
7250
7315
|
),
|
|
7251
|
-
/* @__PURE__ */ (0,
|
|
7252
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
7253
|
-
/* @__PURE__ */ (0,
|
|
7254
|
-
/* @__PURE__ */ (0,
|
|
7316
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LayersPanel, { controller }),
|
|
7317
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
7318
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
7319
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ColorProfilePanel, { controller })
|
|
7255
7320
|
] }),
|
|
7256
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
7257
|
-
/* @__PURE__ */ (0,
|
|
7258
|
-
/* @__PURE__ */ (0,
|
|
7259
|
-
/* @__PURE__ */ (0,
|
|
7321
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7322
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BrushOptionsBar, { controller }),
|
|
7324
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7260
7325
|
"button",
|
|
7261
7326
|
{
|
|
7262
7327
|
type: "button",
|
|
@@ -7267,12 +7332,12 @@ var ImageEditor = ({
|
|
|
7267
7332
|
children: "Free Transform"
|
|
7268
7333
|
}
|
|
7269
7334
|
),
|
|
7270
|
-
paintError && /* @__PURE__ */ (0,
|
|
7271
|
-
/* @__PURE__ */ (0,
|
|
7335
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
7336
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LayersPanel, { controller }) })
|
|
7272
7337
|
] }),
|
|
7273
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
7274
|
-
/* @__PURE__ */ (0,
|
|
7275
|
-
/* @__PURE__ */ (0,
|
|
7338
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
7340
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.jsx)(
|
|
7276
7341
|
"button",
|
|
7277
7342
|
{
|
|
7278
7343
|
type: "button",
|
|
@@ -7283,13 +7348,13 @@ var ImageEditor = ({
|
|
|
7283
7348
|
},
|
|
7284
7349
|
t
|
|
7285
7350
|
)) }),
|
|
7286
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
7287
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
7288
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
7289
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
7290
|
-
/* @__PURE__ */ (0,
|
|
7291
|
-
/* @__PURE__ */ (0,
|
|
7292
|
-
/* @__PURE__ */ (0,
|
|
7351
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
7352
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
7353
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime38.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" }),
|
|
7354
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
7355
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
7357
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7293
7358
|
"button",
|
|
7294
7359
|
{
|
|
7295
7360
|
type: "button",
|
|
@@ -7299,18 +7364,18 @@ var ImageEditor = ({
|
|
|
7299
7364
|
},
|
|
7300
7365
|
t
|
|
7301
7366
|
)) }),
|
|
7302
|
-
/* @__PURE__ */ (0,
|
|
7303
|
-
/* @__PURE__ */ (0,
|
|
7304
|
-
/* @__PURE__ */ (0,
|
|
7305
|
-
/* @__PURE__ */ (0,
|
|
7306
|
-
/* @__PURE__ */ (0,
|
|
7307
|
-
/* @__PURE__ */ (0,
|
|
7308
|
-
/* @__PURE__ */ (0,
|
|
7367
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
7368
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
7369
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
7370
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
7371
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
7372
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Width:" }),
|
|
7373
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-mono", children: [
|
|
7309
7374
|
strokeWidth,
|
|
7310
7375
|
"px"
|
|
7311
7376
|
] })
|
|
7312
7377
|
] }),
|
|
7313
|
-
/* @__PURE__ */ (0,
|
|
7378
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7314
7379
|
"input",
|
|
7315
7380
|
{
|
|
7316
7381
|
type: "range",
|
|
@@ -7323,10 +7388,10 @@ var ImageEditor = ({
|
|
|
7323
7388
|
)
|
|
7324
7389
|
] })
|
|
7325
7390
|
] }),
|
|
7326
|
-
/* @__PURE__ */ (0,
|
|
7327
|
-
/* @__PURE__ */ (0,
|
|
7328
|
-
/* @__PURE__ */ (0,
|
|
7329
|
-
/* @__PURE__ */ (0,
|
|
7391
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
|
|
7392
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
7393
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-2", children: [
|
|
7394
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7330
7395
|
"input",
|
|
7331
7396
|
{
|
|
7332
7397
|
type: "text",
|
|
@@ -7337,7 +7402,7 @@ var ImageEditor = ({
|
|
|
7337
7402
|
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"
|
|
7338
7403
|
}
|
|
7339
7404
|
),
|
|
7340
|
-
/* @__PURE__ */ (0,
|
|
7405
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7341
7406
|
"button",
|
|
7342
7407
|
{
|
|
7343
7408
|
type: "button",
|
|
@@ -7347,14 +7412,14 @@ var ImageEditor = ({
|
|
|
7347
7412
|
}
|
|
7348
7413
|
)
|
|
7349
7414
|
] }),
|
|
7350
|
-
/* @__PURE__ */ (0,
|
|
7351
|
-
/* @__PURE__ */ (0,
|
|
7352
|
-
/* @__PURE__ */ (0,
|
|
7415
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
7416
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Font Size:" }),
|
|
7417
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-mono", children: [
|
|
7353
7418
|
fontSize,
|
|
7354
7419
|
"px"
|
|
7355
7420
|
] })
|
|
7356
7421
|
] }),
|
|
7357
|
-
/* @__PURE__ */ (0,
|
|
7422
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7358
7423
|
"input",
|
|
7359
7424
|
{
|
|
7360
7425
|
type: "range",
|
|
@@ -7365,14 +7430,14 @@ var ImageEditor = ({
|
|
|
7365
7430
|
className: imageRangeClass
|
|
7366
7431
|
}
|
|
7367
7432
|
),
|
|
7368
|
-
/* @__PURE__ */ (0,
|
|
7369
|
-
/* @__PURE__ */ (0,
|
|
7370
|
-
/* @__PURE__ */ (0,
|
|
7433
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
|
|
7434
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7435
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
7371
7436
|
"Layers (",
|
|
7372
7437
|
state.annotations.length,
|
|
7373
7438
|
")"
|
|
7374
7439
|
] }),
|
|
7375
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
7440
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7376
7441
|
"button",
|
|
7377
7442
|
{
|
|
7378
7443
|
type: "button",
|
|
@@ -7381,7 +7446,7 @@ var ImageEditor = ({
|
|
|
7381
7446
|
children: "Delete Selected"
|
|
7382
7447
|
}
|
|
7383
7448
|
),
|
|
7384
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
7449
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7385
7450
|
"button",
|
|
7386
7451
|
{
|
|
7387
7452
|
type: "button",
|
|
@@ -7392,10 +7457,10 @@ var ImageEditor = ({
|
|
|
7392
7457
|
)
|
|
7393
7458
|
] })
|
|
7394
7459
|
] }),
|
|
7395
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
7396
|
-
/* @__PURE__ */ (0,
|
|
7397
|
-
/* @__PURE__ */ (0,
|
|
7398
|
-
/* @__PURE__ */ (0,
|
|
7460
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7461
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
7463
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7399
7464
|
"button",
|
|
7400
7465
|
{
|
|
7401
7466
|
type: "button",
|
|
@@ -7405,8 +7470,8 @@ var ImageEditor = ({
|
|
|
7405
7470
|
}
|
|
7406
7471
|
)
|
|
7407
7472
|
] }),
|
|
7408
|
-
/* @__PURE__ */ (0,
|
|
7409
|
-
/* @__PURE__ */ (0,
|
|
7473
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
7474
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7410
7475
|
"input",
|
|
7411
7476
|
{
|
|
7412
7477
|
type: "checkbox",
|
|
@@ -7415,12 +7480,12 @@ var ImageEditor = ({
|
|
|
7415
7480
|
className: "rounded accent-primary"
|
|
7416
7481
|
}
|
|
7417
7482
|
),
|
|
7418
|
-
/* @__PURE__ */ (0,
|
|
7483
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
7419
7484
|
] }),
|
|
7420
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
7421
|
-
/* @__PURE__ */ (0,
|
|
7422
|
-
/* @__PURE__ */ (0,
|
|
7423
|
-
/* @__PURE__ */ (0,
|
|
7485
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
7486
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
7487
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
7488
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7424
7489
|
"input",
|
|
7425
7490
|
{
|
|
7426
7491
|
type: "text",
|
|
@@ -7431,8 +7496,8 @@ var ImageEditor = ({
|
|
|
7431
7496
|
}
|
|
7432
7497
|
)
|
|
7433
7498
|
] }),
|
|
7434
|
-
/* @__PURE__ */ (0,
|
|
7435
|
-
/* @__PURE__ */ (0,
|
|
7499
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-2", children: [
|
|
7500
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7436
7501
|
"button",
|
|
7437
7502
|
{
|
|
7438
7503
|
type: "button",
|
|
@@ -7441,7 +7506,7 @@ var ImageEditor = ({
|
|
|
7441
7506
|
children: "Threshold Mode"
|
|
7442
7507
|
}
|
|
7443
7508
|
),
|
|
7444
|
-
/* @__PURE__ */ (0,
|
|
7509
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7445
7510
|
"button",
|
|
7446
7511
|
{
|
|
7447
7512
|
type: "button",
|
|
@@ -7451,12 +7516,12 @@ var ImageEditor = ({
|
|
|
7451
7516
|
}
|
|
7452
7517
|
)
|
|
7453
7518
|
] }),
|
|
7454
|
-
/* @__PURE__ */ (0,
|
|
7455
|
-
/* @__PURE__ */ (0,
|
|
7456
|
-
/* @__PURE__ */ (0,
|
|
7457
|
-
/* @__PURE__ */ (0,
|
|
7519
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
7520
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7521
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
7522
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
7458
7523
|
] }),
|
|
7459
|
-
/* @__PURE__ */ (0,
|
|
7524
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7460
7525
|
"input",
|
|
7461
7526
|
{
|
|
7462
7527
|
type: "range",
|
|
@@ -7470,12 +7535,12 @@ var ImageEditor = ({
|
|
|
7470
7535
|
}
|
|
7471
7536
|
)
|
|
7472
7537
|
] }),
|
|
7473
|
-
/* @__PURE__ */ (0,
|
|
7474
|
-
/* @__PURE__ */ (0,
|
|
7475
|
-
/* @__PURE__ */ (0,
|
|
7476
|
-
/* @__PURE__ */ (0,
|
|
7538
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
7539
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7540
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
7541
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
7477
7542
|
] }),
|
|
7478
|
-
/* @__PURE__ */ (0,
|
|
7543
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7479
7544
|
"input",
|
|
7480
7545
|
{
|
|
7481
7546
|
type: "range",
|
|
@@ -7489,12 +7554,12 @@ var ImageEditor = ({
|
|
|
7489
7554
|
}
|
|
7490
7555
|
)
|
|
7491
7556
|
] }),
|
|
7492
|
-
/* @__PURE__ */ (0,
|
|
7493
|
-
/* @__PURE__ */ (0,
|
|
7494
|
-
/* @__PURE__ */ (0,
|
|
7495
|
-
/* @__PURE__ */ (0,
|
|
7557
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
7558
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7559
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Softness:" }),
|
|
7560
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
7496
7561
|
] }),
|
|
7497
|
-
/* @__PURE__ */ (0,
|
|
7562
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7498
7563
|
"input",
|
|
7499
7564
|
{
|
|
7500
7565
|
type: "range",
|
|
@@ -7506,8 +7571,8 @@ var ImageEditor = ({
|
|
|
7506
7571
|
}
|
|
7507
7572
|
)
|
|
7508
7573
|
] }),
|
|
7509
|
-
/* @__PURE__ */ (0,
|
|
7510
|
-
/* @__PURE__ */ (0,
|
|
7574
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
7575
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7511
7576
|
"input",
|
|
7512
7577
|
{
|
|
7513
7578
|
type: "checkbox",
|
|
@@ -7516,12 +7581,12 @@ var ImageEditor = ({
|
|
|
7516
7581
|
className: "rounded accent-primary"
|
|
7517
7582
|
}
|
|
7518
7583
|
),
|
|
7519
|
-
/* @__PURE__ */ (0,
|
|
7584
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Invert Mask" })
|
|
7520
7585
|
] })
|
|
7521
7586
|
] })
|
|
7522
7587
|
] }),
|
|
7523
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
7524
|
-
/* @__PURE__ */ (0,
|
|
7588
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7589
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7525
7590
|
SelectionOptionsBar,
|
|
7526
7591
|
{
|
|
7527
7592
|
controller,
|
|
@@ -7532,9 +7597,9 @@ var ImageEditor = ({
|
|
|
7532
7597
|
selectionDisplay: state.selectionDisplay
|
|
7533
7598
|
}
|
|
7534
7599
|
),
|
|
7535
|
-
selectionError && /* @__PURE__ */ (0,
|
|
7536
|
-
/* @__PURE__ */ (0,
|
|
7537
|
-
/* @__PURE__ */ (0,
|
|
7600
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
7601
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-1", children: [
|
|
7602
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7538
7603
|
"button",
|
|
7539
7604
|
{
|
|
7540
7605
|
type: "button",
|
|
@@ -7545,7 +7610,7 @@ var ImageEditor = ({
|
|
|
7545
7610
|
children: "Transform Selection"
|
|
7546
7611
|
}
|
|
7547
7612
|
),
|
|
7548
|
-
/* @__PURE__ */ (0,
|
|
7613
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7549
7614
|
"button",
|
|
7550
7615
|
{
|
|
7551
7616
|
type: "button",
|
|
@@ -7557,14 +7622,14 @@ var ImageEditor = ({
|
|
|
7557
7622
|
}
|
|
7558
7623
|
)
|
|
7559
7624
|
] }),
|
|
7560
|
-
/* @__PURE__ */ (0,
|
|
7561
|
-
/* @__PURE__ */ (0,
|
|
7562
|
-
/* @__PURE__ */ (0,
|
|
7625
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
7626
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChannelsPanel, { controller }),
|
|
7627
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PathsPanel, { controller })
|
|
7563
7628
|
] }),
|
|
7564
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
7565
|
-
/* @__PURE__ */ (0,
|
|
7566
|
-
/* @__PURE__ */ (0,
|
|
7567
|
-
/* @__PURE__ */ (0,
|
|
7629
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7630
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
7631
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Results go to" }),
|
|
7632
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
7568
7633
|
"select",
|
|
7569
7634
|
{
|
|
7570
7635
|
"aria-label": "AI result target",
|
|
@@ -7572,54 +7637,54 @@ var ImageEditor = ({
|
|
|
7572
7637
|
onChange: (e) => setAiTarget(e.target.value),
|
|
7573
7638
|
className: imageSelectClass,
|
|
7574
7639
|
children: [
|
|
7575
|
-
/* @__PURE__ */ (0,
|
|
7576
|
-
/* @__PURE__ */ (0,
|
|
7577
|
-
/* @__PURE__ */ (0,
|
|
7640
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
7641
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
7642
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "replace", children: "Replace image" })
|
|
7578
7643
|
]
|
|
7579
7644
|
}
|
|
7580
7645
|
)
|
|
7581
7646
|
] }),
|
|
7582
|
-
/* @__PURE__ */ (0,
|
|
7583
|
-
/* @__PURE__ */ (0,
|
|
7584
|
-
/* @__PURE__ */ (0,
|
|
7585
|
-
/* @__PURE__ */ (0,
|
|
7647
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7648
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7649
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7650
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
|
|
7586
7651
|
"Background Removal"
|
|
7587
7652
|
] }),
|
|
7588
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
7653
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime38.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..." })
|
|
7589
7654
|
] }),
|
|
7590
|
-
/* @__PURE__ */ (0,
|
|
7591
|
-
/* @__PURE__ */ (0,
|
|
7655
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
7656
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7592
7657
|
"button",
|
|
7593
7658
|
{
|
|
7594
7659
|
type: "button",
|
|
7595
7660
|
onClick: handleRemoveBackground,
|
|
7596
7661
|
disabled: isRemovingBg || isInpainting,
|
|
7597
7662
|
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",
|
|
7598
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
7599
|
-
/* @__PURE__ */ (0,
|
|
7663
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
7664
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSpinnerClass }),
|
|
7600
7665
|
"Removing Background..."
|
|
7601
|
-
] }) : /* @__PURE__ */ (0,
|
|
7602
|
-
/* @__PURE__ */ (0,
|
|
7666
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
7667
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
|
|
7603
7668
|
"Remove Background"
|
|
7604
7669
|
] })
|
|
7605
7670
|
}
|
|
7606
7671
|
)
|
|
7607
7672
|
] }),
|
|
7608
|
-
/* @__PURE__ */ (0,
|
|
7609
|
-
/* @__PURE__ */ (0,
|
|
7610
|
-
/* @__PURE__ */ (0,
|
|
7611
|
-
/* @__PURE__ */ (0,
|
|
7612
|
-
/* @__PURE__ */ (0,
|
|
7613
|
-
/* @__PURE__ */ (0,
|
|
7673
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7674
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7675
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
7677
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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" }),
|
|
7678
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "m14 7 3 3" })
|
|
7614
7679
|
] }),
|
|
7615
7680
|
"Generative Inpainting"
|
|
7616
7681
|
] }),
|
|
7617
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7682
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime38.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..." })
|
|
7618
7683
|
] }),
|
|
7619
|
-
/* @__PURE__ */ (0,
|
|
7620
|
-
/* @__PURE__ */ (0,
|
|
7621
|
-
/* @__PURE__ */ (0,
|
|
7622
|
-
/* @__PURE__ */ (0,
|
|
7684
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
7685
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7686
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7687
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7623
7688
|
"textarea",
|
|
7624
7689
|
{
|
|
7625
7690
|
id: "ai-inpaint-prompt-react",
|
|
@@ -7631,10 +7696,10 @@ var ImageEditor = ({
|
|
|
7631
7696
|
}
|
|
7632
7697
|
)
|
|
7633
7698
|
] }),
|
|
7634
|
-
/* @__PURE__ */ (0,
|
|
7635
|
-
/* @__PURE__ */ (0,
|
|
7636
|
-
/* @__PURE__ */ (0,
|
|
7637
|
-
/* @__PURE__ */ (0,
|
|
7699
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7700
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7701
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7702
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
7638
7703
|
"button",
|
|
7639
7704
|
{
|
|
7640
7705
|
type: "button",
|
|
@@ -7647,7 +7712,7 @@ var ImageEditor = ({
|
|
|
7647
7712
|
]
|
|
7648
7713
|
}
|
|
7649
7714
|
),
|
|
7650
|
-
/* @__PURE__ */ (0,
|
|
7715
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
7651
7716
|
"button",
|
|
7652
7717
|
{
|
|
7653
7718
|
type: "button",
|
|
@@ -7662,25 +7727,25 @@ var ImageEditor = ({
|
|
|
7662
7727
|
)
|
|
7663
7728
|
] })
|
|
7664
7729
|
] }),
|
|
7665
|
-
/* @__PURE__ */ (0,
|
|
7730
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7666
7731
|
"button",
|
|
7667
7732
|
{
|
|
7668
7733
|
type: "button",
|
|
7669
7734
|
onClick: handleInpaint,
|
|
7670
7735
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
7671
7736
|
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",
|
|
7672
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
7673
|
-
/* @__PURE__ */ (0,
|
|
7737
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
7738
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSpinnerClass }),
|
|
7674
7739
|
"Generating Inpaint..."
|
|
7675
|
-
] }) : /* @__PURE__ */ (0,
|
|
7676
|
-
/* @__PURE__ */ (0,
|
|
7740
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
7741
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
|
|
7677
7742
|
"Apply Inpainting"
|
|
7678
7743
|
] })
|
|
7679
7744
|
}
|
|
7680
7745
|
)
|
|
7681
7746
|
] }),
|
|
7682
|
-
aiError && /* @__PURE__ */ (0,
|
|
7683
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7747
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
7748
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
7684
7749
|
] })
|
|
7685
7750
|
] })
|
|
7686
7751
|
] })
|
|
@@ -7718,6 +7783,7 @@ var ImageEditor = ({
|
|
|
7718
7783
|
SelectAndMaskWorkspace,
|
|
7719
7784
|
SelectionChangeCheck,
|
|
7720
7785
|
SelectionOptionsBar,
|
|
7786
|
+
SeparateSubjectPanel,
|
|
7721
7787
|
ShapeOptionsBar,
|
|
7722
7788
|
TypeOptionsBar,
|
|
7723
7789
|
useImageEditor,
|