@pixerate/editor-react 0.143.0 → 0.144.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-35MOGNMT.js → chunk-3CB4WG24.js} +452 -401
- package/dist/image-editor/MaskEdgeCheck.d.cts +16 -0
- package/dist/image-editor/MaskEdgeCheck.d.ts +16 -0
- package/dist/image-editor/RefineEdgePanel.d.cts +2 -1
- package/dist/image-editor/RefineEdgePanel.d.ts +2 -1
- package/dist/image-editor/index.cjs +490 -438
- 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 +1015 -963
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
// src/image-editor/ImageEditor.tsx
|
|
193
|
-
import
|
|
193
|
+
import React20, { useRef as useRef11, useEffect as useEffect17, useState as useState21 } from "react";
|
|
194
194
|
import {
|
|
195
195
|
normalizeProcessVersion,
|
|
196
196
|
LATEST_PROCESS_VERSION,
|
|
@@ -3731,7 +3731,7 @@ var SelectionOptionsBar = ({
|
|
|
3731
3731
|
};
|
|
3732
3732
|
|
|
3733
3733
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3734
|
-
import { useState as
|
|
3734
|
+
import { useState as useState15 } from "react";
|
|
3735
3735
|
import {
|
|
3736
3736
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3737
3737
|
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
@@ -3739,18 +3739,67 @@ import {
|
|
|
3739
3739
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
3740
3740
|
layerMaskFromSelection
|
|
3741
3741
|
} from "@pixerate/editor/image-editor";
|
|
3742
|
+
|
|
3743
|
+
// src/image-editor/MaskEdgeCheck.tsx
|
|
3744
|
+
import React13, { useState as useState14 } from "react";
|
|
3745
|
+
import { MASK_EDGE_THRESHOLDS } from "@pixerate/editor/image-editor";
|
|
3742
3746
|
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3743
|
-
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3744
3747
|
var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
3745
|
-
var
|
|
3746
|
-
const
|
|
3747
|
-
const [
|
|
3748
|
+
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
3749
|
+
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3750
|
+
const [result, setResult] = useState14(null);
|
|
3748
3751
|
const [error, setError] = useState14(null);
|
|
3749
|
-
const
|
|
3750
|
-
const
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3752
|
+
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
3753
|
+
const check = () => {
|
|
3754
|
+
setError(null);
|
|
3755
|
+
try {
|
|
3756
|
+
setResult({ report: controller.inspectMaskEdge(target, { layerId }), for: sel });
|
|
3757
|
+
} catch (err) {
|
|
3758
|
+
setResult(null);
|
|
3759
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
const T = MASK_EDGE_THRESHOLDS;
|
|
3763
|
+
const rows = report ? [
|
|
3764
|
+
{ label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
|
|
3765
|
+
{ label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
|
|
3766
|
+
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
3767
|
+
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
3768
|
+
] : [];
|
|
3769
|
+
return /* @__PURE__ */ jsxs16("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
3770
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: `${button3} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
3771
|
+
report && /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
3772
|
+
/* @__PURE__ */ jsxs16("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
3773
|
+
rows.map((r) => /* @__PURE__ */ jsxs16(React13.Fragment, { children: [
|
|
3774
|
+
/* @__PURE__ */ jsx18("dt", { className: "text-muted-foreground", children: r.label }),
|
|
3775
|
+
/* @__PURE__ */ jsx18("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
3776
|
+
] }, r.label)),
|
|
3777
|
+
/* @__PURE__ */ jsx18("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
3778
|
+
/* @__PURE__ */ jsxs16("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
3779
|
+
report.holes.count,
|
|
3780
|
+
" / ",
|
|
3781
|
+
report.islands.count
|
|
3782
|
+
] })
|
|
3783
|
+
] }),
|
|
3784
|
+
report.issues.length ? /* @__PURE__ */ jsx18("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx18("li", { children: s }, s)) }) : /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
3785
|
+
] }),
|
|
3786
|
+
error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error })
|
|
3787
|
+
] });
|
|
3788
|
+
};
|
|
3789
|
+
|
|
3790
|
+
// src/image-editor/RefineEdgePanel.tsx
|
|
3791
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3792
|
+
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3793
|
+
var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
3794
|
+
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
3795
|
+
const [params, setParams] = useState15(DEFAULT_PARAMS);
|
|
3796
|
+
const [busy, setBusy] = useState15(false);
|
|
3797
|
+
const [error, setError] = useState15(null);
|
|
3798
|
+
const [layerId, setLayerId] = useState15("");
|
|
3799
|
+
const [newKind, setNewKind] = useState15("hueSaturation");
|
|
3800
|
+
const [output, setOutput] = useState15("selection");
|
|
3801
|
+
const [decontaminate, setDecontaminate] = useState15(0);
|
|
3802
|
+
const [objectAware, setObjectAware] = useState15(false);
|
|
3754
3803
|
const canObject = Boolean(controller.segmentationProvider);
|
|
3755
3804
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
3756
3805
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -3770,17 +3819,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3770
3819
|
setBusy(false);
|
|
3771
3820
|
}
|
|
3772
3821
|
};
|
|
3773
|
-
return /* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
3775
|
-
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
/* @__PURE__ */
|
|
3778
|
-
/* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ jsxs17("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
3823
|
+
/* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
3824
|
+
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3825
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3826
|
+
/* @__PURE__ */ jsx19("span", { children: c.label }),
|
|
3827
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3779
3828
|
params[c.id],
|
|
3780
3829
|
c.unit
|
|
3781
3830
|
] })
|
|
3782
3831
|
] }),
|
|
3783
|
-
/* @__PURE__ */
|
|
3832
|
+
/* @__PURE__ */ jsx19(
|
|
3784
3833
|
"input",
|
|
3785
3834
|
{
|
|
3786
3835
|
type: "range",
|
|
@@ -3794,39 +3843,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3794
3843
|
}
|
|
3795
3844
|
)
|
|
3796
3845
|
] }, c.id)),
|
|
3797
|
-
/* @__PURE__ */
|
|
3798
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3847
|
+
/* @__PURE__ */ jsx19("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
3799
3848
|
"Smart Radius"
|
|
3800
3849
|
] }),
|
|
3801
|
-
canObject && /* @__PURE__ */
|
|
3802
|
-
/* @__PURE__ */
|
|
3850
|
+
canObject && /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3851
|
+
/* @__PURE__ */ jsx19("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
3803
3852
|
"Object aware (segmentation model)"
|
|
3804
3853
|
] }),
|
|
3805
|
-
/* @__PURE__ */
|
|
3854
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3806
3855
|
"Output to",
|
|
3807
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ jsx19(
|
|
3808
3857
|
"select",
|
|
3809
3858
|
{
|
|
3810
3859
|
"aria-label": "Refine output",
|
|
3811
3860
|
value: output,
|
|
3812
3861
|
onChange: (e) => setOutput(e.target.value),
|
|
3813
3862
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3814
|
-
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */
|
|
3863
|
+
children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx19("option", { value: o.id, children: o.label }, o.id))
|
|
3815
3864
|
}
|
|
3816
3865
|
)
|
|
3817
3866
|
] }),
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3867
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3868
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3869
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
3821
3870
|
"Decontaminate colors",
|
|
3822
3871
|
toLayer ? "" : " (new layer or document outputs)"
|
|
3823
3872
|
] }),
|
|
3824
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3825
3874
|
decontaminate,
|
|
3826
3875
|
"%"
|
|
3827
3876
|
] })
|
|
3828
3877
|
] }),
|
|
3829
|
-
/* @__PURE__ */
|
|
3878
|
+
/* @__PURE__ */ jsx19(
|
|
3830
3879
|
"input",
|
|
3831
3880
|
{
|
|
3832
3881
|
type: "range",
|
|
@@ -3841,63 +3890,64 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3841
3890
|
}
|
|
3842
3891
|
)
|
|
3843
3892
|
] }),
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3893
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1", children: [
|
|
3894
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
3895
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
3847
3896
|
] }),
|
|
3848
|
-
error && /* @__PURE__ */
|
|
3849
|
-
/* @__PURE__ */
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
|
|
3897
|
+
error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error }),
|
|
3898
|
+
/* @__PURE__ */ jsx19(MaskEdgeCheck, { controller, selection: sel }),
|
|
3899
|
+
/* @__PURE__ */ jsx19("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
3900
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1 items-center", children: [
|
|
3901
|
+
/* @__PURE__ */ jsx19(
|
|
3852
3902
|
"select",
|
|
3853
3903
|
{
|
|
3854
3904
|
"aria-label": "New masked layer kind",
|
|
3855
3905
|
value: newKind,
|
|
3856
3906
|
onChange: (e) => setNewKind(e.target.value),
|
|
3857
3907
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3858
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
3908
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx19("option", { value: k.kind, children: k.label }, k.kind))
|
|
3859
3909
|
}
|
|
3860
3910
|
),
|
|
3861
|
-
/* @__PURE__ */
|
|
3911
|
+
/* @__PURE__ */ jsx19(
|
|
3862
3912
|
"button",
|
|
3863
3913
|
{
|
|
3864
3914
|
type: "button",
|
|
3865
|
-
className:
|
|
3915
|
+
className: button4,
|
|
3866
3916
|
disabled: !sel,
|
|
3867
3917
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
3868
3918
|
children: "New Masked Layer"
|
|
3869
3919
|
}
|
|
3870
3920
|
)
|
|
3871
3921
|
] }),
|
|
3872
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
3873
|
-
/* @__PURE__ */
|
|
3922
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
|
|
3923
|
+
/* @__PURE__ */ jsx19(
|
|
3874
3924
|
"select",
|
|
3875
3925
|
{
|
|
3876
3926
|
"aria-label": "Mask layer",
|
|
3877
3927
|
value: target.id,
|
|
3878
3928
|
onChange: (e) => setLayerId(e.target.value),
|
|
3879
3929
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3880
|
-
children: list.map((l) => /* @__PURE__ */
|
|
3930
|
+
children: list.map((l) => /* @__PURE__ */ jsxs17("option", { value: l.id, children: [
|
|
3881
3931
|
l.name || adjustmentKindLabel2(l.kind),
|
|
3882
3932
|
l.mask ? " (masked)" : ""
|
|
3883
3933
|
] }, l.id))
|
|
3884
3934
|
}
|
|
3885
3935
|
),
|
|
3886
|
-
/* @__PURE__ */
|
|
3887
|
-
/* @__PURE__ */
|
|
3888
|
-
/* @__PURE__ */
|
|
3889
|
-
/* @__PURE__ */
|
|
3936
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap gap-1", children: [
|
|
3937
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
3938
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
3939
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
3890
3940
|
] }),
|
|
3891
|
-
target.mask && /* @__PURE__ */
|
|
3892
|
-
/* @__PURE__ */
|
|
3893
|
-
/* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3941
|
+
target.mask && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3942
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3943
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3944
|
+
/* @__PURE__ */ jsx19("span", { children: "Density" }),
|
|
3945
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3896
3946
|
Math.round((target.mask.density ?? 1) * 100),
|
|
3897
3947
|
"%"
|
|
3898
3948
|
] })
|
|
3899
3949
|
] }),
|
|
3900
|
-
/* @__PURE__ */
|
|
3950
|
+
/* @__PURE__ */ jsx19(
|
|
3901
3951
|
"input",
|
|
3902
3952
|
{
|
|
3903
3953
|
type: "range",
|
|
@@ -3911,15 +3961,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3911
3961
|
}
|
|
3912
3962
|
)
|
|
3913
3963
|
] }),
|
|
3914
|
-
/* @__PURE__ */
|
|
3915
|
-
/* @__PURE__ */
|
|
3916
|
-
/* @__PURE__ */
|
|
3917
|
-
/* @__PURE__ */
|
|
3964
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
|
|
3965
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3966
|
+
/* @__PURE__ */ jsx19("span", { children: "Mask Feather" }),
|
|
3967
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3918
3968
|
target.mask.feather ?? 0,
|
|
3919
3969
|
"px"
|
|
3920
3970
|
] })
|
|
3921
3971
|
] }),
|
|
3922
|
-
/* @__PURE__ */
|
|
3972
|
+
/* @__PURE__ */ jsx19(
|
|
3923
3973
|
"input",
|
|
3924
3974
|
{
|
|
3925
3975
|
type: "range",
|
|
@@ -3939,9 +3989,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3939
3989
|
};
|
|
3940
3990
|
|
|
3941
3991
|
// src/image-editor/ChannelsPanel.tsx
|
|
3942
|
-
import { useEffect as useEffect12, useRef as useRef10, useState as
|
|
3992
|
+
import { useEffect as useEffect12, useRef as useRef10, useState as useState16 } from "react";
|
|
3943
3993
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3944
|
-
import { jsx as
|
|
3994
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3945
3995
|
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"}`;
|
|
3946
3996
|
var ChannelThumb = ({ channel, size }) => {
|
|
3947
3997
|
const ref = useRef10(null);
|
|
@@ -3956,14 +4006,14 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
3956
4006
|
img.data.set(px.data);
|
|
3957
4007
|
ctx.putImageData(img, 0, 0);
|
|
3958
4008
|
}, [channel.mask]);
|
|
3959
|
-
return /* @__PURE__ */
|
|
4009
|
+
return /* @__PURE__ */ jsx20("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
3960
4010
|
};
|
|
3961
4011
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
3962
|
-
const [, setTick] =
|
|
4012
|
+
const [, setTick] = useState16(0);
|
|
3963
4013
|
useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3964
|
-
const [activeId, setActiveId] =
|
|
3965
|
-
const [renaming, setRenaming] =
|
|
3966
|
-
const [error, setError] =
|
|
4014
|
+
const [activeId, setActiveId] = useState16(null);
|
|
4015
|
+
const [renaming, setRenaming] = useState16(null);
|
|
4016
|
+
const [error, setError] = useState16(null);
|
|
3967
4017
|
const fileInput = useRef10(null);
|
|
3968
4018
|
const channels = controller.getChannels();
|
|
3969
4019
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
@@ -3986,13 +4036,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3986
4036
|
setError(err instanceof Error ? err.message : String(err));
|
|
3987
4037
|
}
|
|
3988
4038
|
};
|
|
3989
|
-
return /* @__PURE__ */
|
|
3990
|
-
/* @__PURE__ */
|
|
3991
|
-
/* @__PURE__ */
|
|
3992
|
-
/* @__PURE__ */
|
|
4039
|
+
return /* @__PURE__ */ jsxs18("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
4040
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
|
|
4041
|
+
/* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
4042
|
+
/* @__PURE__ */ jsx20("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" })
|
|
3993
4043
|
] }),
|
|
3994
|
-
channels.length === 0 && /* @__PURE__ */
|
|
3995
|
-
/* @__PURE__ */
|
|
4044
|
+
channels.length === 0 && /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
4045
|
+
/* @__PURE__ */ jsx20("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs18(
|
|
3996
4046
|
"li",
|
|
3997
4047
|
{
|
|
3998
4048
|
"data-testid": "channel-row",
|
|
@@ -4004,7 +4054,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4004
4054
|
},
|
|
4005
4055
|
onDoubleClick: () => setRenaming(c.id),
|
|
4006
4056
|
children: [
|
|
4007
|
-
/* @__PURE__ */
|
|
4057
|
+
/* @__PURE__ */ jsx20(
|
|
4008
4058
|
"button",
|
|
4009
4059
|
{
|
|
4010
4060
|
type: "button",
|
|
@@ -4018,8 +4068,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4018
4068
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
4019
4069
|
}
|
|
4020
4070
|
),
|
|
4021
|
-
/* @__PURE__ */
|
|
4022
|
-
renaming === c.id ? /* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ jsx20(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
4072
|
+
renaming === c.id ? /* @__PURE__ */ jsx20(
|
|
4023
4073
|
"input",
|
|
4024
4074
|
{
|
|
4025
4075
|
autoFocus: true,
|
|
@@ -4036,16 +4086,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4036
4086
|
if (e.key === "Escape") setRenaming(null);
|
|
4037
4087
|
}
|
|
4038
4088
|
}
|
|
4039
|
-
) : /* @__PURE__ */
|
|
4089
|
+
) : /* @__PURE__ */ jsx20("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
4040
4090
|
]
|
|
4041
4091
|
},
|
|
4042
4092
|
c.id
|
|
4043
4093
|
)) }),
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4046
|
-
/* @__PURE__ */
|
|
4047
|
-
/* @__PURE__ */
|
|
4048
|
-
/* @__PURE__ */
|
|
4094
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
|
|
4095
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
4096
|
+
/* @__PURE__ */ jsx20("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" }),
|
|
4097
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
4098
|
+
/* @__PURE__ */ jsx20(
|
|
4049
4099
|
"button",
|
|
4050
4100
|
{
|
|
4051
4101
|
type: "button",
|
|
@@ -4058,8 +4108,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4058
4108
|
children: "Delete"
|
|
4059
4109
|
}
|
|
4060
4110
|
),
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4111
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
4112
|
+
/* @__PURE__ */ jsx20(
|
|
4063
4113
|
"button",
|
|
4064
4114
|
{
|
|
4065
4115
|
type: "button",
|
|
@@ -4070,7 +4120,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4070
4120
|
children: "Export PNG"
|
|
4071
4121
|
}
|
|
4072
4122
|
),
|
|
4073
|
-
/* @__PURE__ */
|
|
4123
|
+
/* @__PURE__ */ jsx20(
|
|
4074
4124
|
"input",
|
|
4075
4125
|
{
|
|
4076
4126
|
ref: fileInput,
|
|
@@ -4085,22 +4135,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4085
4135
|
}
|
|
4086
4136
|
)
|
|
4087
4137
|
] }),
|
|
4088
|
-
error && /* @__PURE__ */
|
|
4138
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
|
|
4089
4139
|
] });
|
|
4090
4140
|
};
|
|
4091
4141
|
|
|
4092
4142
|
// src/image-editor/PathsPanel.tsx
|
|
4093
|
-
import { useEffect as useEffect13, useState as
|
|
4143
|
+
import { useEffect as useEffect13, useState as useState17 } from "react";
|
|
4094
4144
|
import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
|
|
4095
|
-
import { jsx as
|
|
4145
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4096
4146
|
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"}`;
|
|
4097
4147
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4098
|
-
const [, setTick] =
|
|
4148
|
+
const [, setTick] = useState17(0);
|
|
4099
4149
|
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4100
|
-
const [renaming, setRenaming] =
|
|
4101
|
-
const [color, setColor] =
|
|
4102
|
-
const [width, setWidth] =
|
|
4103
|
-
const [error, setError] =
|
|
4150
|
+
const [renaming, setRenaming] = useState17(null);
|
|
4151
|
+
const [color, setColor] = useState17("#000000");
|
|
4152
|
+
const [width, setWidth] = useState17(2);
|
|
4153
|
+
const [error, setError] = useState17(null);
|
|
4104
4154
|
const paths = controller.getPaths();
|
|
4105
4155
|
const activeId = controller.getState().activePathId ?? null;
|
|
4106
4156
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -4116,10 +4166,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4116
4166
|
};
|
|
4117
4167
|
return (
|
|
4118
4168
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
4119
|
-
/* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
4121
|
-
paths.length === 0 && /* @__PURE__ */
|
|
4122
|
-
/* @__PURE__ */
|
|
4169
|
+
/* @__PURE__ */ jsxs19("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: [
|
|
4170
|
+
/* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
4171
|
+
paths.length === 0 && /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
4172
|
+
/* @__PURE__ */ jsx21("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__ */ jsxs19(
|
|
4123
4173
|
"li",
|
|
4124
4174
|
{
|
|
4125
4175
|
"data-testid": "path-row",
|
|
@@ -4128,8 +4178,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4128
4178
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4129
4179
|
onDoubleClick: () => setRenaming(p.id),
|
|
4130
4180
|
children: [
|
|
4131
|
-
/* @__PURE__ */
|
|
4132
|
-
renaming === p.id ? /* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
4182
|
+
renaming === p.id ? /* @__PURE__ */ jsx21(
|
|
4133
4183
|
"input",
|
|
4134
4184
|
{
|
|
4135
4185
|
autoFocus: true,
|
|
@@ -4148,13 +4198,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4148
4198
|
if (e.key === "Escape") setRenaming(null);
|
|
4149
4199
|
}
|
|
4150
4200
|
}
|
|
4151
|
-
) : /* @__PURE__ */
|
|
4201
|
+
) : /* @__PURE__ */ jsx21("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4152
4202
|
]
|
|
4153
4203
|
},
|
|
4154
4204
|
p.id
|
|
4155
4205
|
)) }),
|
|
4156
|
-
/* @__PURE__ */
|
|
4157
|
-
/* @__PURE__ */
|
|
4206
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
|
|
4207
|
+
/* @__PURE__ */ jsx21(
|
|
4158
4208
|
"button",
|
|
4159
4209
|
{
|
|
4160
4210
|
type: "button",
|
|
@@ -4165,15 +4215,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4165
4215
|
children: "Load as Selection"
|
|
4166
4216
|
}
|
|
4167
4217
|
),
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
active?.work && /* @__PURE__ */
|
|
4170
|
-
/* @__PURE__ */
|
|
4218
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
4219
|
+
active?.work && /* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
4220
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
4171
4221
|
] }),
|
|
4172
|
-
/* @__PURE__ */
|
|
4173
|
-
/* @__PURE__ */
|
|
4174
|
-
/* @__PURE__ */
|
|
4175
|
-
/* @__PURE__ */
|
|
4176
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4223
|
+
/* @__PURE__ */ jsx21("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" }),
|
|
4224
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
4225
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4226
|
+
/* @__PURE__ */ jsx21(
|
|
4177
4227
|
"input",
|
|
4178
4228
|
{
|
|
4179
4229
|
type: "number",
|
|
@@ -4188,24 +4238,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4188
4238
|
),
|
|
4189
4239
|
"px"
|
|
4190
4240
|
] }),
|
|
4191
|
-
/* @__PURE__ */
|
|
4241
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
4192
4242
|
] }),
|
|
4193
|
-
/* @__PURE__ */
|
|
4194
|
-
/* @__PURE__ */
|
|
4195
|
-
/* @__PURE__ */
|
|
4243
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
|
|
4244
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
4245
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
4196
4246
|
] }),
|
|
4197
|
-
error && /* @__PURE__ */
|
|
4247
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
4198
4248
|
] })
|
|
4199
4249
|
);
|
|
4200
4250
|
};
|
|
4201
4251
|
|
|
4202
4252
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4203
|
-
import { useEffect as useEffect14, useState as
|
|
4253
|
+
import { useEffect as useEffect14, useState as useState18 } from "react";
|
|
4204
4254
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
4205
|
-
import { jsx as
|
|
4255
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4206
4256
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4207
4257
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4208
|
-
const [, setTick] =
|
|
4258
|
+
const [, setTick] = useState18(0);
|
|
4209
4259
|
useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4210
4260
|
const bar = tool.bar();
|
|
4211
4261
|
if (!tool.active || !bar) return null;
|
|
@@ -4218,17 +4268,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4218
4268
|
const v = Number(raw);
|
|
4219
4269
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4220
4270
|
};
|
|
4221
|
-
return /* @__PURE__ */
|
|
4222
|
-
/* @__PURE__ */
|
|
4223
|
-
/* @__PURE__ */
|
|
4224
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
4225
|
-
/* @__PURE__ */
|
|
4226
|
-
/* @__PURE__ */
|
|
4227
|
-
/* @__PURE__ */
|
|
4271
|
+
return /* @__PURE__ */ jsxs20("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: [
|
|
4272
|
+
/* @__PURE__ */ jsx22("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx22("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)) }),
|
|
4273
|
+
/* @__PURE__ */ jsx22("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx22("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)) }),
|
|
4274
|
+
tool.mode === "warp" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4275
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4276
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4277
|
+
/* @__PURE__ */ jsx22("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx22("option", { value: o.id, children: o.label }, o.id)) })
|
|
4228
4278
|
] }),
|
|
4229
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
4230
|
-
/* @__PURE__ */
|
|
4231
|
-
/* @__PURE__ */
|
|
4279
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4280
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4281
|
+
/* @__PURE__ */ jsx22(
|
|
4232
4282
|
"input",
|
|
4233
4283
|
{
|
|
4234
4284
|
type: "number",
|
|
@@ -4249,9 +4299,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4249
4299
|
},
|
|
4250
4300
|
`${k}:${warp[k]}`
|
|
4251
4301
|
),
|
|
4252
|
-
/* @__PURE__ */
|
|
4302
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "%" })
|
|
4253
4303
|
] }, k)),
|
|
4254
|
-
/* @__PURE__ */
|
|
4304
|
+
/* @__PURE__ */ jsx22(
|
|
4255
4305
|
"button",
|
|
4256
4306
|
{
|
|
4257
4307
|
type: "button",
|
|
@@ -4263,9 +4313,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4263
4313
|
children: "Vertical"
|
|
4264
4314
|
}
|
|
4265
4315
|
),
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
/* @__PURE__ */
|
|
4268
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4317
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4318
|
+
/* @__PURE__ */ jsx22(
|
|
4269
4319
|
"select",
|
|
4270
4320
|
{
|
|
4271
4321
|
"aria-label": "Warp grid",
|
|
@@ -4275,14 +4325,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4275
4325
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4276
4326
|
},
|
|
4277
4327
|
className: imageFieldClass,
|
|
4278
|
-
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */
|
|
4328
|
+
children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx22("option", { value: g.id, children: g.label }, g.id))
|
|
4279
4329
|
}
|
|
4280
4330
|
)
|
|
4281
4331
|
] })
|
|
4282
4332
|
] }),
|
|
4283
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
4284
|
-
/* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4333
|
+
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4334
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: f.label }),
|
|
4335
|
+
/* @__PURE__ */ jsx22(
|
|
4286
4336
|
"input",
|
|
4287
4337
|
{
|
|
4288
4338
|
type: "number",
|
|
@@ -4302,8 +4352,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4302
4352
|
},
|
|
4303
4353
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4304
4354
|
),
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4356
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx22(
|
|
4307
4357
|
"button",
|
|
4308
4358
|
{
|
|
4309
4359
|
type: "button",
|
|
@@ -4318,33 +4368,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4318
4368
|
}
|
|
4319
4369
|
)
|
|
4320
4370
|
] }, f.id)),
|
|
4321
|
-
/* @__PURE__ */
|
|
4322
|
-
/* @__PURE__ */
|
|
4323
|
-
/* @__PURE__ */
|
|
4371
|
+
/* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1", children: [
|
|
4372
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4373
|
+
/* @__PURE__ */ jsx22(
|
|
4324
4374
|
"select",
|
|
4325
4375
|
{
|
|
4326
4376
|
"aria-label": "Interpolation",
|
|
4327
4377
|
value: tool.interpolation,
|
|
4328
4378
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4329
4379
|
className: imageFieldClass,
|
|
4330
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4380
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx22("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4331
4381
|
}
|
|
4332
4382
|
)
|
|
4333
4383
|
] }),
|
|
4334
|
-
/* @__PURE__ */
|
|
4335
|
-
/* @__PURE__ */
|
|
4336
|
-
tool.error && /* @__PURE__ */
|
|
4384
|
+
/* @__PURE__ */ jsx22("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" }),
|
|
4385
|
+
/* @__PURE__ */ jsx22("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4386
|
+
tool.error && /* @__PURE__ */ jsx22("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4337
4387
|
] });
|
|
4338
4388
|
};
|
|
4339
4389
|
|
|
4340
4390
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4341
|
-
import { useEffect as useEffect15, useState as
|
|
4391
|
+
import { useEffect as useEffect15, useState as useState19 } from "react";
|
|
4342
4392
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
4343
|
-
import { Fragment as
|
|
4393
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4344
4394
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4345
|
-
const [, setTick] =
|
|
4395
|
+
const [, setTick] = useState19(0);
|
|
4346
4396
|
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4347
|
-
const [error, setError] =
|
|
4397
|
+
const [error, setError] = useState19(null);
|
|
4348
4398
|
const active = controller.getActiveLayer();
|
|
4349
4399
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4350
4400
|
const set = (change) => {
|
|
@@ -4358,22 +4408,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4358
4408
|
}
|
|
4359
4409
|
};
|
|
4360
4410
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4361
|
-
return /* @__PURE__ */
|
|
4362
|
-
/* @__PURE__ */
|
|
4363
|
-
/* @__PURE__ */
|
|
4364
|
-
/* @__PURE__ */
|
|
4365
|
-
/* @__PURE__ */
|
|
4411
|
+
return /* @__PURE__ */ jsxs21("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4412
|
+
/* @__PURE__ */ jsx23("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4413
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4414
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4415
|
+
/* @__PURE__ */ jsx23(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
4366
4416
|
"Fill",
|
|
4367
|
-
/* @__PURE__ */
|
|
4417
|
+
/* @__PURE__ */ jsx23(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
4368
4418
|
] }),
|
|
4369
|
-
/* @__PURE__ */
|
|
4370
|
-
/* @__PURE__ */
|
|
4419
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4420
|
+
/* @__PURE__ */ jsx23(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
4371
4421
|
"Stroke",
|
|
4372
|
-
/* @__PURE__ */
|
|
4422
|
+
/* @__PURE__ */ jsx23(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4373
4423
|
] }),
|
|
4374
|
-
/* @__PURE__ */
|
|
4424
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4375
4425
|
"Width",
|
|
4376
|
-
/* @__PURE__ */
|
|
4426
|
+
/* @__PURE__ */ jsx23(
|
|
4377
4427
|
"input",
|
|
4378
4428
|
{
|
|
4379
4429
|
type: "number",
|
|
@@ -4387,52 +4437,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4387
4437
|
)
|
|
4388
4438
|
] })
|
|
4389
4439
|
] }),
|
|
4390
|
-
/* @__PURE__ */
|
|
4391
|
-
options.kind === "rect" && /* @__PURE__ */
|
|
4440
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4441
|
+
options.kind === "rect" && /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4392
4442
|
"Radius",
|
|
4393
|
-
/* @__PURE__ */
|
|
4443
|
+
/* @__PURE__ */ jsx23("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}` })
|
|
4394
4444
|
] }),
|
|
4395
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4445
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4396
4446
|
"Sides",
|
|
4397
|
-
/* @__PURE__ */
|
|
4447
|
+
/* @__PURE__ */ jsx23("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}` })
|
|
4398
4448
|
] }),
|
|
4399
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4400
|
-
/* @__PURE__ */
|
|
4449
|
+
options.kind === "star" && /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
4450
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4401
4451
|
"Points",
|
|
4402
|
-
/* @__PURE__ */
|
|
4452
|
+
/* @__PURE__ */ jsx23("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}` })
|
|
4403
4453
|
] }),
|
|
4404
|
-
/* @__PURE__ */
|
|
4454
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4405
4455
|
"Inner",
|
|
4406
|
-
/* @__PURE__ */
|
|
4456
|
+
/* @__PURE__ */ jsx23(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4407
4457
|
] })
|
|
4408
4458
|
] }),
|
|
4409
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4459
|
+
options.kind === "line" && /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
4460
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4411
4461
|
"Weight",
|
|
4412
|
-
/* @__PURE__ */
|
|
4462
|
+
/* @__PURE__ */ jsx23("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}` })
|
|
4413
4463
|
] }),
|
|
4414
|
-
/* @__PURE__ */
|
|
4415
|
-
/* @__PURE__ */
|
|
4464
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4465
|
+
/* @__PURE__ */ jsx23(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4416
4466
|
"Arrowhead"
|
|
4417
4467
|
] })
|
|
4418
4468
|
] })
|
|
4419
4469
|
] }),
|
|
4420
|
-
/* @__PURE__ */
|
|
4421
|
-
error && /* @__PURE__ */
|
|
4470
|
+
/* @__PURE__ */ jsx23("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." }),
|
|
4471
|
+
error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
|
|
4422
4472
|
] });
|
|
4423
4473
|
};
|
|
4424
4474
|
|
|
4425
4475
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4426
|
-
import { useEffect as useEffect16, useState as
|
|
4476
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
4427
4477
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4428
|
-
import { jsx as
|
|
4478
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4429
4479
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4430
4480
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4431
4481
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4432
|
-
const [, setTick] =
|
|
4482
|
+
const [, setTick] = useState20(0);
|
|
4433
4483
|
useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4434
4484
|
useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4435
|
-
const [error, setError] =
|
|
4485
|
+
const [error, setError] = useState20(null);
|
|
4436
4486
|
const active = controller.getActiveLayer();
|
|
4437
4487
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4438
4488
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4485,11 +4535,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4485
4535
|
setError(e instanceof Error ? e.message : String(e));
|
|
4486
4536
|
}
|
|
4487
4537
|
};
|
|
4488
|
-
return /* @__PURE__ */
|
|
4489
|
-
/* @__PURE__ */
|
|
4490
|
-
/* @__PURE__ */
|
|
4538
|
+
return /* @__PURE__ */ jsxs22("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4539
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4540
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4491
4541
|
"Font",
|
|
4492
|
-
/* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsx24(
|
|
4493
4543
|
"input",
|
|
4494
4544
|
{
|
|
4495
4545
|
list: "pixerate-type-fonts",
|
|
@@ -4499,11 +4549,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4499
4549
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4500
4550
|
}
|
|
4501
4551
|
),
|
|
4502
|
-
/* @__PURE__ */
|
|
4552
|
+
/* @__PURE__ */ jsx24("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx24("option", { value: f }, f)) })
|
|
4503
4553
|
] }),
|
|
4504
|
-
/* @__PURE__ */
|
|
4554
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4505
4555
|
"Size",
|
|
4506
|
-
/* @__PURE__ */
|
|
4556
|
+
/* @__PURE__ */ jsx24(
|
|
4507
4557
|
"input",
|
|
4508
4558
|
{
|
|
4509
4559
|
type: "number",
|
|
@@ -4516,14 +4566,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4516
4566
|
}
|
|
4517
4567
|
)
|
|
4518
4568
|
] }),
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4569
|
+
/* @__PURE__ */ jsx24("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" }),
|
|
4570
|
+
/* @__PURE__ */ jsx24("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4571
|
+
/* @__PURE__ */ jsx24(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
4522
4572
|
] }),
|
|
4523
|
-
/* @__PURE__ */
|
|
4524
|
-
/* @__PURE__ */
|
|
4525
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4526
|
-
orientation === "vertical" && editedId && /* @__PURE__ */
|
|
4573
|
+
/* @__PURE__ */ jsx24("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx24("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4574
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
4575
|
+
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx24("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
4576
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ jsx24(
|
|
4527
4577
|
"button",
|
|
4528
4578
|
{
|
|
4529
4579
|
type: "button",
|
|
@@ -4535,19 +4585,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4535
4585
|
}
|
|
4536
4586
|
)
|
|
4537
4587
|
] }),
|
|
4538
|
-
/* @__PURE__ */
|
|
4539
|
-
missing.length > 0 && /* @__PURE__ */
|
|
4588
|
+
/* @__PURE__ */ jsx24("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." }),
|
|
4589
|
+
missing.length > 0 && /* @__PURE__ */ jsxs22("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4540
4590
|
"Missing ",
|
|
4541
4591
|
missing.length === 1 ? "font" : "fonts",
|
|
4542
4592
|
": ",
|
|
4543
4593
|
missing.join(", ")
|
|
4544
4594
|
] }),
|
|
4545
|
-
error && /* @__PURE__ */
|
|
4595
|
+
error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
|
|
4546
4596
|
] });
|
|
4547
4597
|
};
|
|
4548
4598
|
|
|
4549
4599
|
// src/image-editor/ImageEditor.tsx
|
|
4550
|
-
import { Fragment as
|
|
4600
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4551
4601
|
var ImageEditor = ({
|
|
4552
4602
|
editor: externalEditor,
|
|
4553
4603
|
src,
|
|
@@ -4572,7 +4622,7 @@ var ImageEditor = ({
|
|
|
4572
4622
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4573
4623
|
});
|
|
4574
4624
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4575
|
-
const [activeTab, setActiveTab] =
|
|
4625
|
+
const [activeTab, setActiveTab] = useState21("crop");
|
|
4576
4626
|
const rootRef = useRef11(null);
|
|
4577
4627
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4578
4628
|
const activeTabRef = useRef11(activeTab);
|
|
@@ -4582,14 +4632,14 @@ var ImageEditor = ({
|
|
|
4582
4632
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4583
4633
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4584
4634
|
};
|
|
4585
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
4586
|
-
const [selectionOptions, setSelectionOptions] =
|
|
4587
|
-
const [shapeOptions, setShapeOptions] =
|
|
4588
|
-
const [typeOptions, setTypeOptions] =
|
|
4589
|
-
const [typeSession, setTypeSession] =
|
|
4590
|
-
const [selectionError, setSelectionError] =
|
|
4591
|
-
const [paintError, setPaintError] =
|
|
4592
|
-
const [shapeTypeError, setShapeTypeError] =
|
|
4635
|
+
const [activeCropRatio, setActiveCropRatio] = useState21(null);
|
|
4636
|
+
const [selectionOptions, setSelectionOptions] = useState21(DEFAULT_SELECTION_TOOL_OPTIONS2);
|
|
4637
|
+
const [shapeOptions, setShapeOptions] = useState21(DEFAULT_SHAPE_TOOL_OPTIONS2);
|
|
4638
|
+
const [typeOptions, setTypeOptions] = useState21(DEFAULT_TYPE_TOOL_OPTIONS2);
|
|
4639
|
+
const [typeSession, setTypeSession] = useState21(null);
|
|
4640
|
+
const [selectionError, setSelectionError] = useState21(null);
|
|
4641
|
+
const [paintError, setPaintError] = useState21(null);
|
|
4642
|
+
const [shapeTypeError, setShapeTypeError] = useState21(null);
|
|
4593
4643
|
const handleCanvasError = (source, message) => {
|
|
4594
4644
|
if (source === "paint") setPaintError(message);
|
|
4595
4645
|
else if (source === "select") setSelectionError(message);
|
|
@@ -4606,16 +4656,16 @@ var ImageEditor = ({
|
|
|
4606
4656
|
transformControllerRef.current = controller;
|
|
4607
4657
|
}
|
|
4608
4658
|
const transformTool = transformToolRef.current;
|
|
4609
|
-
const [, setTransformTick] =
|
|
4659
|
+
const [, setTransformTick] = useState21(0);
|
|
4610
4660
|
useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4611
4661
|
useEffect17(() => () => transformToolRef.current?.cancel(), []);
|
|
4612
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
4613
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
4614
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
4615
|
-
const [isInpainting, setIsInpainting] =
|
|
4616
|
-
const [aiError, setAiError] =
|
|
4617
|
-
const [aiSuccess, setAiSuccess] =
|
|
4618
|
-
const [aiTarget, setAiTarget] =
|
|
4662
|
+
const [inpaintPrompt, setInpaintPrompt] = useState21("");
|
|
4663
|
+
const [inpaintMaskMode, setInpaintMaskMode] = useState21("annotations");
|
|
4664
|
+
const [isRemovingBg, setIsRemovingBg] = useState21(false);
|
|
4665
|
+
const [isInpainting, setIsInpainting] = useState21(false);
|
|
4666
|
+
const [aiError, setAiError] = useState21(null);
|
|
4667
|
+
const [aiSuccess, setAiSuccess] = useState21(null);
|
|
4668
|
+
const [aiTarget, setAiTarget] = useState21("auto");
|
|
4619
4669
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4620
4670
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4621
4671
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4678,10 +4728,10 @@ var ImageEditor = ({
|
|
|
4678
4728
|
setIsInpainting(false);
|
|
4679
4729
|
}
|
|
4680
4730
|
};
|
|
4681
|
-
const [activeColor, setActiveColor] =
|
|
4682
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4683
|
-
const [fontSize, setFontSize] =
|
|
4684
|
-
const [textInput, setTextInput] =
|
|
4731
|
+
const [activeColor, setActiveColor] = useState21("#ef4444");
|
|
4732
|
+
const [strokeWidth, setStrokeWidth] = useState21(3);
|
|
4733
|
+
const [fontSize, setFontSize] = useState21(24);
|
|
4734
|
+
const [textInput, setTextInput] = useState21("");
|
|
4685
4735
|
useEffect17(() => {
|
|
4686
4736
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4687
4737
|
editor.setTool("crop");
|
|
@@ -4710,16 +4760,16 @@ var ImageEditor = ({
|
|
|
4710
4760
|
link.click();
|
|
4711
4761
|
}
|
|
4712
4762
|
};
|
|
4713
|
-
return /* @__PURE__ */
|
|
4763
|
+
return /* @__PURE__ */ jsxs23(
|
|
4714
4764
|
"div",
|
|
4715
4765
|
{
|
|
4716
4766
|
ref: rootRef,
|
|
4717
4767
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4718
4768
|
style,
|
|
4719
4769
|
children: [
|
|
4720
|
-
/* @__PURE__ */
|
|
4721
|
-
/* @__PURE__ */
|
|
4722
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsxs23("div", { className: imageEditorHeaderClass, children: [
|
|
4771
|
+
/* @__PURE__ */ jsxs23("div", { role: "tablist", className: imageTabListClass, children: [
|
|
4772
|
+
/* @__PURE__ */ jsx25(
|
|
4723
4773
|
"button",
|
|
4724
4774
|
{
|
|
4725
4775
|
type: "button",
|
|
@@ -4734,7 +4784,7 @@ var ImageEditor = ({
|
|
|
4734
4784
|
children: "Transform & Crop"
|
|
4735
4785
|
}
|
|
4736
4786
|
),
|
|
4737
|
-
/* @__PURE__ */
|
|
4787
|
+
/* @__PURE__ */ jsx25(
|
|
4738
4788
|
"button",
|
|
4739
4789
|
{
|
|
4740
4790
|
type: "button",
|
|
@@ -4749,7 +4799,7 @@ var ImageEditor = ({
|
|
|
4749
4799
|
children: "Adjustments"
|
|
4750
4800
|
}
|
|
4751
4801
|
),
|
|
4752
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ jsx25(
|
|
4753
4803
|
"button",
|
|
4754
4804
|
{
|
|
4755
4805
|
type: "button",
|
|
@@ -4764,7 +4814,7 @@ var ImageEditor = ({
|
|
|
4764
4814
|
children: "Layers"
|
|
4765
4815
|
}
|
|
4766
4816
|
),
|
|
4767
|
-
/* @__PURE__ */
|
|
4817
|
+
/* @__PURE__ */ jsx25(
|
|
4768
4818
|
"button",
|
|
4769
4819
|
{
|
|
4770
4820
|
type: "button",
|
|
@@ -4779,7 +4829,7 @@ var ImageEditor = ({
|
|
|
4779
4829
|
children: "Paint"
|
|
4780
4830
|
}
|
|
4781
4831
|
),
|
|
4782
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ jsx25(
|
|
4783
4833
|
"button",
|
|
4784
4834
|
{
|
|
4785
4835
|
type: "button",
|
|
@@ -4794,7 +4844,7 @@ var ImageEditor = ({
|
|
|
4794
4844
|
children: "Select & Mask"
|
|
4795
4845
|
}
|
|
4796
4846
|
),
|
|
4797
|
-
/* @__PURE__ */
|
|
4847
|
+
/* @__PURE__ */ jsx25(
|
|
4798
4848
|
"button",
|
|
4799
4849
|
{
|
|
4800
4850
|
type: "button",
|
|
@@ -4809,7 +4859,7 @@ var ImageEditor = ({
|
|
|
4809
4859
|
children: "Annotations"
|
|
4810
4860
|
}
|
|
4811
4861
|
),
|
|
4812
|
-
/* @__PURE__ */
|
|
4862
|
+
/* @__PURE__ */ jsx25(
|
|
4813
4863
|
"button",
|
|
4814
4864
|
{
|
|
4815
4865
|
type: "button",
|
|
@@ -4824,7 +4874,7 @@ var ImageEditor = ({
|
|
|
4824
4874
|
children: "Depth Mask"
|
|
4825
4875
|
}
|
|
4826
4876
|
),
|
|
4827
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsxs23(
|
|
4828
4878
|
"button",
|
|
4829
4879
|
{
|
|
4830
4880
|
type: "button",
|
|
@@ -4837,14 +4887,14 @@ var ImageEditor = ({
|
|
|
4837
4887
|
"aria-selected": activeTab === "ai",
|
|
4838
4888
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
4839
4889
|
children: [
|
|
4840
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ jsx25("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx25("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" }) }),
|
|
4841
4891
|
"AI Tools"
|
|
4842
4892
|
]
|
|
4843
4893
|
}
|
|
4844
4894
|
)
|
|
4845
4895
|
] }),
|
|
4846
|
-
/* @__PURE__ */
|
|
4847
|
-
/* @__PURE__ */
|
|
4896
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4897
|
+
/* @__PURE__ */ jsx25(
|
|
4848
4898
|
"button",
|
|
4849
4899
|
{
|
|
4850
4900
|
type: "button",
|
|
@@ -4855,7 +4905,7 @@ var ImageEditor = ({
|
|
|
4855
4905
|
children: "\u21A9"
|
|
4856
4906
|
}
|
|
4857
4907
|
),
|
|
4858
|
-
/* @__PURE__ */
|
|
4908
|
+
/* @__PURE__ */ jsx25(
|
|
4859
4909
|
"button",
|
|
4860
4910
|
{
|
|
4861
4911
|
type: "button",
|
|
@@ -4866,7 +4916,7 @@ var ImageEditor = ({
|
|
|
4866
4916
|
children: "\u21AA"
|
|
4867
4917
|
}
|
|
4868
4918
|
),
|
|
4869
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsx25(
|
|
4870
4920
|
"button",
|
|
4871
4921
|
{
|
|
4872
4922
|
type: "button",
|
|
@@ -4875,8 +4925,8 @@ var ImageEditor = ({
|
|
|
4875
4925
|
children: "Reset"
|
|
4876
4926
|
}
|
|
4877
4927
|
),
|
|
4878
|
-
/* @__PURE__ */
|
|
4879
|
-
/* @__PURE__ */
|
|
4928
|
+
/* @__PURE__ */ jsx25("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4929
|
+
/* @__PURE__ */ jsx25(
|
|
4880
4930
|
"button",
|
|
4881
4931
|
{
|
|
4882
4932
|
type: "button",
|
|
@@ -4886,11 +4936,11 @@ var ImageEditor = ({
|
|
|
4886
4936
|
children: "-"
|
|
4887
4937
|
}
|
|
4888
4938
|
),
|
|
4889
|
-
/* @__PURE__ */
|
|
4939
|
+
/* @__PURE__ */ jsxs23("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
4890
4940
|
Math.round(state.zoom * 100),
|
|
4891
4941
|
"%"
|
|
4892
4942
|
] }),
|
|
4893
|
-
/* @__PURE__ */
|
|
4943
|
+
/* @__PURE__ */ jsx25(
|
|
4894
4944
|
"button",
|
|
4895
4945
|
{
|
|
4896
4946
|
type: "button",
|
|
@@ -4900,8 +4950,8 @@ var ImageEditor = ({
|
|
|
4900
4950
|
children: "+"
|
|
4901
4951
|
}
|
|
4902
4952
|
),
|
|
4903
|
-
/* @__PURE__ */
|
|
4904
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsx25("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4954
|
+
/* @__PURE__ */ jsx25(
|
|
4905
4955
|
"button",
|
|
4906
4956
|
{
|
|
4907
4957
|
type: "button",
|
|
@@ -4912,7 +4962,7 @@ var ImageEditor = ({
|
|
|
4912
4962
|
children: "Hold Compare"
|
|
4913
4963
|
}
|
|
4914
4964
|
),
|
|
4915
|
-
/* @__PURE__ */
|
|
4965
|
+
/* @__PURE__ */ jsx25(
|
|
4916
4966
|
"button",
|
|
4917
4967
|
{
|
|
4918
4968
|
type: "button",
|
|
@@ -4923,10 +4973,10 @@ var ImageEditor = ({
|
|
|
4923
4973
|
)
|
|
4924
4974
|
] })
|
|
4925
4975
|
] }),
|
|
4926
|
-
transformTool.active && /* @__PURE__ */
|
|
4927
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
4928
|
-
/* @__PURE__ */
|
|
4929
|
-
/* @__PURE__ */
|
|
4976
|
+
transformTool.active && /* @__PURE__ */ jsx25(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
4977
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ jsx25("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
4978
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
4979
|
+
/* @__PURE__ */ jsx25(
|
|
4930
4980
|
ImageEditorCanvas,
|
|
4931
4981
|
{
|
|
4932
4982
|
editor,
|
|
@@ -4950,11 +5000,11 @@ var ImageEditor = ({
|
|
|
4950
5000
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
4951
5001
|
}
|
|
4952
5002
|
),
|
|
4953
|
-
/* @__PURE__ */
|
|
4954
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
4955
|
-
/* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
4957
|
-
/* @__PURE__ */
|
|
5003
|
+
/* @__PURE__ */ jsxs23("div", { className: imageSidebarClass, children: [
|
|
5004
|
+
activeTab === "crop" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5005
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5006
|
+
/* @__PURE__ */ jsxs23("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5007
|
+
/* @__PURE__ */ jsx25(
|
|
4958
5008
|
"button",
|
|
4959
5009
|
{
|
|
4960
5010
|
type: "button",
|
|
@@ -4966,7 +5016,7 @@ var ImageEditor = ({
|
|
|
4966
5016
|
children: "Freeform"
|
|
4967
5017
|
}
|
|
4968
5018
|
),
|
|
4969
|
-
/* @__PURE__ */
|
|
5019
|
+
/* @__PURE__ */ jsx25(
|
|
4970
5020
|
"button",
|
|
4971
5021
|
{
|
|
4972
5022
|
type: "button",
|
|
@@ -4978,7 +5028,7 @@ var ImageEditor = ({
|
|
|
4978
5028
|
children: "1:1 Square"
|
|
4979
5029
|
}
|
|
4980
5030
|
),
|
|
4981
|
-
/* @__PURE__ */
|
|
5031
|
+
/* @__PURE__ */ jsx25(
|
|
4982
5032
|
"button",
|
|
4983
5033
|
{
|
|
4984
5034
|
type: "button",
|
|
@@ -4990,7 +5040,7 @@ var ImageEditor = ({
|
|
|
4990
5040
|
children: "4:3 Standard"
|
|
4991
5041
|
}
|
|
4992
5042
|
),
|
|
4993
|
-
/* @__PURE__ */
|
|
5043
|
+
/* @__PURE__ */ jsx25(
|
|
4994
5044
|
"button",
|
|
4995
5045
|
{
|
|
4996
5046
|
type: "button",
|
|
@@ -5002,7 +5052,7 @@ var ImageEditor = ({
|
|
|
5002
5052
|
children: "16:9 Wide"
|
|
5003
5053
|
}
|
|
5004
5054
|
),
|
|
5005
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ jsx25(
|
|
5006
5056
|
"button",
|
|
5007
5057
|
{
|
|
5008
5058
|
type: "button",
|
|
@@ -5014,7 +5064,7 @@ var ImageEditor = ({
|
|
|
5014
5064
|
children: "3:2 Photo"
|
|
5015
5065
|
}
|
|
5016
5066
|
),
|
|
5017
|
-
/* @__PURE__ */
|
|
5067
|
+
/* @__PURE__ */ jsx25(
|
|
5018
5068
|
"button",
|
|
5019
5069
|
{
|
|
5020
5070
|
type: "button",
|
|
@@ -5027,10 +5077,10 @@ var ImageEditor = ({
|
|
|
5027
5077
|
}
|
|
5028
5078
|
)
|
|
5029
5079
|
] }),
|
|
5030
|
-
/* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5080
|
+
/* @__PURE__ */ jsx25("div", { className: imageDividerClass }),
|
|
5081
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5082
|
+
/* @__PURE__ */ jsxs23("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5083
|
+
/* @__PURE__ */ jsx25(
|
|
5034
5084
|
"button",
|
|
5035
5085
|
{
|
|
5036
5086
|
type: "button",
|
|
@@ -5039,7 +5089,7 @@ var ImageEditor = ({
|
|
|
5039
5089
|
children: "Rotate -90\xB0"
|
|
5040
5090
|
}
|
|
5041
5091
|
),
|
|
5042
|
-
/* @__PURE__ */
|
|
5092
|
+
/* @__PURE__ */ jsx25(
|
|
5043
5093
|
"button",
|
|
5044
5094
|
{
|
|
5045
5095
|
type: "button",
|
|
@@ -5048,7 +5098,7 @@ var ImageEditor = ({
|
|
|
5048
5098
|
children: "Rotate +90\xB0"
|
|
5049
5099
|
}
|
|
5050
5100
|
),
|
|
5051
|
-
/* @__PURE__ */
|
|
5101
|
+
/* @__PURE__ */ jsx25(
|
|
5052
5102
|
"button",
|
|
5053
5103
|
{
|
|
5054
5104
|
type: "button",
|
|
@@ -5057,7 +5107,7 @@ var ImageEditor = ({
|
|
|
5057
5107
|
children: "Flip Horizontal"
|
|
5058
5108
|
}
|
|
5059
5109
|
),
|
|
5060
|
-
/* @__PURE__ */
|
|
5110
|
+
/* @__PURE__ */ jsx25(
|
|
5061
5111
|
"button",
|
|
5062
5112
|
{
|
|
5063
5113
|
type: "button",
|
|
@@ -5068,10 +5118,10 @@ var ImageEditor = ({
|
|
|
5068
5118
|
)
|
|
5069
5119
|
] })
|
|
5070
5120
|
] }),
|
|
5071
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
5072
|
-
/* @__PURE__ */
|
|
5073
|
-
/* @__PURE__ */
|
|
5074
|
-
/* @__PURE__ */
|
|
5121
|
+
activeTab === "adjust" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5122
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
|
|
5123
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5124
|
+
/* @__PURE__ */ jsx25(
|
|
5075
5125
|
"button",
|
|
5076
5126
|
{
|
|
5077
5127
|
type: "button",
|
|
@@ -5081,9 +5131,9 @@ var ImageEditor = ({
|
|
|
5081
5131
|
}
|
|
5082
5132
|
)
|
|
5083
5133
|
] }),
|
|
5084
|
-
/* @__PURE__ */
|
|
5085
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
5086
|
-
/* @__PURE__ */
|
|
5134
|
+
/* @__PURE__ */ jsx25(Histogram, { histogram: editor.histogram }),
|
|
5135
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs23(React20.Fragment, { children: [
|
|
5136
|
+
/* @__PURE__ */ jsx25(
|
|
5087
5137
|
ControlSlider,
|
|
5088
5138
|
{
|
|
5089
5139
|
spec,
|
|
@@ -5092,14 +5142,14 @@ var ImageEditor = ({
|
|
|
5092
5142
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5093
5143
|
}
|
|
5094
5144
|
),
|
|
5095
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
5145
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs23(
|
|
5096
5146
|
"div",
|
|
5097
5147
|
{
|
|
5098
5148
|
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",
|
|
5099
5149
|
"data-testid": "image-editor-process-notice",
|
|
5100
5150
|
children: [
|
|
5101
|
-
/* @__PURE__ */
|
|
5102
|
-
/* @__PURE__ */
|
|
5151
|
+
/* @__PURE__ */ jsx25("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5152
|
+
/* @__PURE__ */ jsx25(
|
|
5103
5153
|
"button",
|
|
5104
5154
|
{
|
|
5105
5155
|
type: "button",
|
|
@@ -5112,7 +5162,7 @@ var ImageEditor = ({
|
|
|
5112
5162
|
}
|
|
5113
5163
|
)
|
|
5114
5164
|
] }, spec.id)),
|
|
5115
|
-
/* @__PURE__ */
|
|
5165
|
+
/* @__PURE__ */ jsx25("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx25(
|
|
5116
5166
|
AdjustmentLayersPanel,
|
|
5117
5167
|
{
|
|
5118
5168
|
controller,
|
|
@@ -5121,9 +5171,9 @@ var ImageEditor = ({
|
|
|
5121
5171
|
}
|
|
5122
5172
|
) })
|
|
5123
5173
|
] }),
|
|
5124
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5126
|
-
/* @__PURE__ */
|
|
5174
|
+
activeTab === "layers" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5175
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5176
|
+
/* @__PURE__ */ jsx25(
|
|
5127
5177
|
"button",
|
|
5128
5178
|
{
|
|
5129
5179
|
type: "button",
|
|
@@ -5134,15 +5184,15 @@ var ImageEditor = ({
|
|
|
5134
5184
|
children: "Free Transform"
|
|
5135
5185
|
}
|
|
5136
5186
|
),
|
|
5137
|
-
/* @__PURE__ */
|
|
5138
|
-
effectsShown && /* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5140
|
-
/* @__PURE__ */
|
|
5187
|
+
/* @__PURE__ */ jsx25(LayersPanel, { controller }),
|
|
5188
|
+
effectsShown && /* @__PURE__ */ jsx25(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5189
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5190
|
+
/* @__PURE__ */ jsx25(ColorProfilePanel, { controller })
|
|
5141
5191
|
] }),
|
|
5142
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
5143
|
-
/* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
5145
|
-
/* @__PURE__ */
|
|
5192
|
+
activeTab === "paint" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5193
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5194
|
+
/* @__PURE__ */ jsx25(BrushOptionsBar, { controller }),
|
|
5195
|
+
/* @__PURE__ */ jsx25(
|
|
5146
5196
|
"button",
|
|
5147
5197
|
{
|
|
5148
5198
|
type: "button",
|
|
@@ -5153,12 +5203,12 @@ var ImageEditor = ({
|
|
|
5153
5203
|
children: "Free Transform"
|
|
5154
5204
|
}
|
|
5155
5205
|
),
|
|
5156
|
-
paintError && /* @__PURE__ */
|
|
5157
|
-
/* @__PURE__ */
|
|
5206
|
+
paintError && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5207
|
+
/* @__PURE__ */ jsx25("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx25(LayersPanel, { controller }) })
|
|
5158
5208
|
] }),
|
|
5159
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5161
|
-
/* @__PURE__ */
|
|
5209
|
+
activeTab === "annotate" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5210
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
5211
|
+
/* @__PURE__ */ jsx25("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx25(
|
|
5162
5212
|
"button",
|
|
5163
5213
|
{
|
|
5164
5214
|
type: "button",
|
|
@@ -5169,13 +5219,13 @@ var ImageEditor = ({
|
|
|
5169
5219
|
},
|
|
5170
5220
|
t
|
|
5171
5221
|
)) }),
|
|
5172
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
5173
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
5174
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
5175
|
-
shapeTypeError && /* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5177
|
-
/* @__PURE__ */
|
|
5178
|
-
/* @__PURE__ */
|
|
5222
|
+
state.activeTool === "shape" && /* @__PURE__ */ jsx25(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5223
|
+
state.activeTool === "type" && /* @__PURE__ */ jsx25(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5224
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx25("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" }),
|
|
5225
|
+
shapeTypeError && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5226
|
+
/* @__PURE__ */ jsx25("div", { className: imageDividerClass }),
|
|
5227
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5228
|
+
/* @__PURE__ */ jsx25("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx25(
|
|
5179
5229
|
"button",
|
|
5180
5230
|
{
|
|
5181
5231
|
type: "button",
|
|
@@ -5185,18 +5235,18 @@ var ImageEditor = ({
|
|
|
5185
5235
|
},
|
|
5186
5236
|
t
|
|
5187
5237
|
)) }),
|
|
5188
|
-
/* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5190
|
-
/* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5192
|
-
/* @__PURE__ */
|
|
5193
|
-
/* @__PURE__ */
|
|
5194
|
-
/* @__PURE__ */
|
|
5238
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5239
|
+
/* @__PURE__ */ jsx25("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5240
|
+
/* @__PURE__ */ jsx25(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
5241
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex-1 ml-2", children: [
|
|
5242
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5243
|
+
/* @__PURE__ */ jsx25("span", { children: "Width:" }),
|
|
5244
|
+
/* @__PURE__ */ jsxs23("span", { className: "font-mono", children: [
|
|
5195
5245
|
strokeWidth,
|
|
5196
5246
|
"px"
|
|
5197
5247
|
] })
|
|
5198
5248
|
] }),
|
|
5199
|
-
/* @__PURE__ */
|
|
5249
|
+
/* @__PURE__ */ jsx25(
|
|
5200
5250
|
"input",
|
|
5201
5251
|
{
|
|
5202
5252
|
type: "range",
|
|
@@ -5209,10 +5259,10 @@ var ImageEditor = ({
|
|
|
5209
5259
|
)
|
|
5210
5260
|
] })
|
|
5211
5261
|
] }),
|
|
5212
|
-
/* @__PURE__ */
|
|
5213
|
-
/* @__PURE__ */
|
|
5214
|
-
/* @__PURE__ */
|
|
5215
|
-
/* @__PURE__ */
|
|
5262
|
+
/* @__PURE__ */ jsx25("div", { className: imageDividerClass }),
|
|
5263
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5264
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
|
|
5265
|
+
/* @__PURE__ */ jsx25(
|
|
5216
5266
|
"input",
|
|
5217
5267
|
{
|
|
5218
5268
|
type: "text",
|
|
@@ -5223,7 +5273,7 @@ var ImageEditor = ({
|
|
|
5223
5273
|
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"
|
|
5224
5274
|
}
|
|
5225
5275
|
),
|
|
5226
|
-
/* @__PURE__ */
|
|
5276
|
+
/* @__PURE__ */ jsx25(
|
|
5227
5277
|
"button",
|
|
5228
5278
|
{
|
|
5229
5279
|
type: "button",
|
|
@@ -5233,14 +5283,14 @@ var ImageEditor = ({
|
|
|
5233
5283
|
}
|
|
5234
5284
|
)
|
|
5235
5285
|
] }),
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
/* @__PURE__ */
|
|
5286
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5287
|
+
/* @__PURE__ */ jsx25("span", { children: "Font Size:" }),
|
|
5288
|
+
/* @__PURE__ */ jsxs23("span", { className: "font-mono", children: [
|
|
5239
5289
|
fontSize,
|
|
5240
5290
|
"px"
|
|
5241
5291
|
] })
|
|
5242
5292
|
] }),
|
|
5243
|
-
/* @__PURE__ */
|
|
5293
|
+
/* @__PURE__ */ jsx25(
|
|
5244
5294
|
"input",
|
|
5245
5295
|
{
|
|
5246
5296
|
type: "range",
|
|
@@ -5251,14 +5301,14 @@ var ImageEditor = ({
|
|
|
5251
5301
|
className: imageRangeClass
|
|
5252
5302
|
}
|
|
5253
5303
|
),
|
|
5254
|
-
/* @__PURE__ */
|
|
5255
|
-
/* @__PURE__ */
|
|
5256
|
-
/* @__PURE__ */
|
|
5304
|
+
/* @__PURE__ */ jsx25("div", { className: imageDividerClass }),
|
|
5305
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
|
|
5306
|
+
/* @__PURE__ */ jsxs23("span", { className: "text-muted-foreground", children: [
|
|
5257
5307
|
"Layers (",
|
|
5258
5308
|
state.annotations.length,
|
|
5259
5309
|
")"
|
|
5260
5310
|
] }),
|
|
5261
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5311
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx25(
|
|
5262
5312
|
"button",
|
|
5263
5313
|
{
|
|
5264
5314
|
type: "button",
|
|
@@ -5267,7 +5317,7 @@ var ImageEditor = ({
|
|
|
5267
5317
|
children: "Delete Selected"
|
|
5268
5318
|
}
|
|
5269
5319
|
),
|
|
5270
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5320
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx25(
|
|
5271
5321
|
"button",
|
|
5272
5322
|
{
|
|
5273
5323
|
type: "button",
|
|
@@ -5278,10 +5328,10 @@ var ImageEditor = ({
|
|
|
5278
5328
|
)
|
|
5279
5329
|
] })
|
|
5280
5330
|
] }),
|
|
5281
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
5282
|
-
/* @__PURE__ */
|
|
5283
|
-
/* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5331
|
+
activeTab === "depth" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5332
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
|
|
5333
|
+
/* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5334
|
+
/* @__PURE__ */ jsx25(
|
|
5285
5335
|
"button",
|
|
5286
5336
|
{
|
|
5287
5337
|
type: "button",
|
|
@@ -5291,8 +5341,8 @@ var ImageEditor = ({
|
|
|
5291
5341
|
}
|
|
5292
5342
|
)
|
|
5293
5343
|
] }),
|
|
5294
|
-
/* @__PURE__ */
|
|
5295
|
-
/* @__PURE__ */
|
|
5344
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5345
|
+
/* @__PURE__ */ jsx25(
|
|
5296
5346
|
"input",
|
|
5297
5347
|
{
|
|
5298
5348
|
type: "checkbox",
|
|
@@ -5301,12 +5351,12 @@ var ImageEditor = ({
|
|
|
5301
5351
|
className: "rounded accent-primary"
|
|
5302
5352
|
}
|
|
5303
5353
|
),
|
|
5304
|
-
/* @__PURE__ */
|
|
5354
|
+
/* @__PURE__ */ jsx25("span", { children: "Enable Depth / Alpha Mask" })
|
|
5305
5355
|
] }),
|
|
5306
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5308
|
-
/* @__PURE__ */
|
|
5309
|
-
/* @__PURE__ */
|
|
5356
|
+
state.depthMask.enabled && /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5357
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5358
|
+
/* @__PURE__ */ jsx25("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5359
|
+
/* @__PURE__ */ jsx25(
|
|
5310
5360
|
"input",
|
|
5311
5361
|
{
|
|
5312
5362
|
type: "text",
|
|
@@ -5317,8 +5367,8 @@ var ImageEditor = ({
|
|
|
5317
5367
|
}
|
|
5318
5368
|
)
|
|
5319
5369
|
] }),
|
|
5320
|
-
/* @__PURE__ */
|
|
5321
|
-
/* @__PURE__ */
|
|
5370
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
|
|
5371
|
+
/* @__PURE__ */ jsx25(
|
|
5322
5372
|
"button",
|
|
5323
5373
|
{
|
|
5324
5374
|
type: "button",
|
|
@@ -5327,7 +5377,7 @@ var ImageEditor = ({
|
|
|
5327
5377
|
children: "Threshold Mode"
|
|
5328
5378
|
}
|
|
5329
5379
|
),
|
|
5330
|
-
/* @__PURE__ */
|
|
5380
|
+
/* @__PURE__ */ jsx25(
|
|
5331
5381
|
"button",
|
|
5332
5382
|
{
|
|
5333
5383
|
type: "button",
|
|
@@ -5337,12 +5387,12 @@ var ImageEditor = ({
|
|
|
5337
5387
|
}
|
|
5338
5388
|
)
|
|
5339
5389
|
] }),
|
|
5340
|
-
/* @__PURE__ */
|
|
5341
|
-
/* @__PURE__ */
|
|
5342
|
-
/* @__PURE__ */
|
|
5343
|
-
/* @__PURE__ */
|
|
5390
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5391
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5392
|
+
/* @__PURE__ */ jsx25("span", { children: "Depth Start (Lower):" }),
|
|
5393
|
+
/* @__PURE__ */ jsx25("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5344
5394
|
] }),
|
|
5345
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsx25(
|
|
5346
5396
|
"input",
|
|
5347
5397
|
{
|
|
5348
5398
|
type: "range",
|
|
@@ -5356,12 +5406,12 @@ var ImageEditor = ({
|
|
|
5356
5406
|
}
|
|
5357
5407
|
)
|
|
5358
5408
|
] }),
|
|
5359
|
-
/* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5361
|
-
/* @__PURE__ */
|
|
5362
|
-
/* @__PURE__ */
|
|
5409
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5410
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5411
|
+
/* @__PURE__ */ jsx25("span", { children: "Depth Stop (Upper):" }),
|
|
5412
|
+
/* @__PURE__ */ jsx25("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5363
5413
|
] }),
|
|
5364
|
-
/* @__PURE__ */
|
|
5414
|
+
/* @__PURE__ */ jsx25(
|
|
5365
5415
|
"input",
|
|
5366
5416
|
{
|
|
5367
5417
|
type: "range",
|
|
@@ -5375,12 +5425,12 @@ var ImageEditor = ({
|
|
|
5375
5425
|
}
|
|
5376
5426
|
)
|
|
5377
5427
|
] }),
|
|
5378
|
-
/* @__PURE__ */
|
|
5379
|
-
/* @__PURE__ */
|
|
5380
|
-
/* @__PURE__ */
|
|
5381
|
-
/* @__PURE__ */
|
|
5428
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5429
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5430
|
+
/* @__PURE__ */ jsx25("span", { children: "Softness:" }),
|
|
5431
|
+
/* @__PURE__ */ jsx25("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5382
5432
|
] }),
|
|
5383
|
-
/* @__PURE__ */
|
|
5433
|
+
/* @__PURE__ */ jsx25(
|
|
5384
5434
|
"input",
|
|
5385
5435
|
{
|
|
5386
5436
|
type: "range",
|
|
@@ -5392,8 +5442,8 @@ var ImageEditor = ({
|
|
|
5392
5442
|
}
|
|
5393
5443
|
)
|
|
5394
5444
|
] }),
|
|
5395
|
-
/* @__PURE__ */
|
|
5396
|
-
/* @__PURE__ */
|
|
5445
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5446
|
+
/* @__PURE__ */ jsx25(
|
|
5397
5447
|
"input",
|
|
5398
5448
|
{
|
|
5399
5449
|
type: "checkbox",
|
|
@@ -5402,12 +5452,12 @@ var ImageEditor = ({
|
|
|
5402
5452
|
className: "rounded accent-primary"
|
|
5403
5453
|
}
|
|
5404
5454
|
),
|
|
5405
|
-
/* @__PURE__ */
|
|
5455
|
+
/* @__PURE__ */ jsx25("span", { children: "Invert Mask" })
|
|
5406
5456
|
] })
|
|
5407
5457
|
] })
|
|
5408
5458
|
] }),
|
|
5409
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5410
|
-
/* @__PURE__ */
|
|
5459
|
+
activeTab === "select" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5460
|
+
/* @__PURE__ */ jsx25(
|
|
5411
5461
|
SelectionOptionsBar,
|
|
5412
5462
|
{
|
|
5413
5463
|
controller,
|
|
@@ -5418,9 +5468,9 @@ var ImageEditor = ({
|
|
|
5418
5468
|
selectionDisplay: state.selectionDisplay
|
|
5419
5469
|
}
|
|
5420
5470
|
),
|
|
5421
|
-
selectionError && /* @__PURE__ */
|
|
5422
|
-
/* @__PURE__ */
|
|
5423
|
-
/* @__PURE__ */
|
|
5471
|
+
selectionError && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5472
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex gap-1", children: [
|
|
5473
|
+
/* @__PURE__ */ jsx25(
|
|
5424
5474
|
"button",
|
|
5425
5475
|
{
|
|
5426
5476
|
type: "button",
|
|
@@ -5431,7 +5481,7 @@ var ImageEditor = ({
|
|
|
5431
5481
|
children: "Transform Selection"
|
|
5432
5482
|
}
|
|
5433
5483
|
),
|
|
5434
|
-
/* @__PURE__ */
|
|
5484
|
+
/* @__PURE__ */ jsx25(
|
|
5435
5485
|
"button",
|
|
5436
5486
|
{
|
|
5437
5487
|
type: "button",
|
|
@@ -5443,14 +5493,14 @@ var ImageEditor = ({
|
|
|
5443
5493
|
}
|
|
5444
5494
|
)
|
|
5445
5495
|
] }),
|
|
5446
|
-
/* @__PURE__ */
|
|
5447
|
-
/* @__PURE__ */
|
|
5448
|
-
/* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsx25(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5497
|
+
/* @__PURE__ */ jsx25(ChannelsPanel, { controller }),
|
|
5498
|
+
/* @__PURE__ */ jsx25(PathsPanel, { controller })
|
|
5449
5499
|
] }),
|
|
5450
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5500
|
+
activeTab === "ai" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5501
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5502
|
+
/* @__PURE__ */ jsx25("span", { children: "Results go to" }),
|
|
5503
|
+
/* @__PURE__ */ jsxs23(
|
|
5454
5504
|
"select",
|
|
5455
5505
|
{
|
|
5456
5506
|
"aria-label": "AI result target",
|
|
@@ -5458,54 +5508,54 @@ var ImageEditor = ({
|
|
|
5458
5508
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5459
5509
|
className: imageSelectClass,
|
|
5460
5510
|
children: [
|
|
5461
|
-
/* @__PURE__ */
|
|
5462
|
-
/* @__PURE__ */
|
|
5463
|
-
/* @__PURE__ */
|
|
5511
|
+
/* @__PURE__ */ jsx25("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5512
|
+
/* @__PURE__ */ jsx25("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5513
|
+
/* @__PURE__ */ jsx25("option", { value: "replace", children: "Replace image" })
|
|
5464
5514
|
]
|
|
5465
5515
|
}
|
|
5466
5516
|
)
|
|
5467
5517
|
] }),
|
|
5468
|
-
/* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5470
|
-
/* @__PURE__ */
|
|
5471
|
-
/* @__PURE__ */
|
|
5518
|
+
/* @__PURE__ */ jsxs23("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5519
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
|
|
5520
|
+
/* @__PURE__ */ jsxs23("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5521
|
+
/* @__PURE__ */ jsx25("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx25("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" }) }),
|
|
5472
5522
|
"Background Removal"
|
|
5473
5523
|
] }),
|
|
5474
|
-
isRemovingBg && /* @__PURE__ */
|
|
5524
|
+
isRemovingBg && /* @__PURE__ */ jsx25("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..." })
|
|
5475
5525
|
] }),
|
|
5476
|
-
/* @__PURE__ */
|
|
5477
|
-
/* @__PURE__ */
|
|
5526
|
+
/* @__PURE__ */ jsx25("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5527
|
+
/* @__PURE__ */ jsx25(
|
|
5478
5528
|
"button",
|
|
5479
5529
|
{
|
|
5480
5530
|
type: "button",
|
|
5481
5531
|
onClick: handleRemoveBackground,
|
|
5482
5532
|
disabled: isRemovingBg || isInpainting,
|
|
5483
5533
|
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",
|
|
5484
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
5485
|
-
/* @__PURE__ */
|
|
5534
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5535
|
+
/* @__PURE__ */ jsx25("div", { className: imageSpinnerClass }),
|
|
5486
5536
|
"Removing Background..."
|
|
5487
|
-
] }) : /* @__PURE__ */
|
|
5488
|
-
/* @__PURE__ */
|
|
5537
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5538
|
+
/* @__PURE__ */ jsx25("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx25("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" }) }),
|
|
5489
5539
|
"Remove Background"
|
|
5490
5540
|
] })
|
|
5491
5541
|
}
|
|
5492
5542
|
)
|
|
5493
5543
|
] }),
|
|
5494
|
-
/* @__PURE__ */
|
|
5495
|
-
/* @__PURE__ */
|
|
5496
|
-
/* @__PURE__ */
|
|
5497
|
-
/* @__PURE__ */
|
|
5498
|
-
/* @__PURE__ */
|
|
5499
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsxs23("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5545
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
|
|
5546
|
+
/* @__PURE__ */ jsxs23("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5547
|
+
/* @__PURE__ */ jsxs23("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5548
|
+
/* @__PURE__ */ jsx25("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" }),
|
|
5549
|
+
/* @__PURE__ */ jsx25("path", { d: "m14 7 3 3" })
|
|
5500
5550
|
] }),
|
|
5501
5551
|
"Generative Inpainting"
|
|
5502
5552
|
] }),
|
|
5503
|
-
isInpainting && /* @__PURE__ */
|
|
5553
|
+
isInpainting && /* @__PURE__ */ jsx25("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..." })
|
|
5504
5554
|
] }),
|
|
5505
|
-
/* @__PURE__ */
|
|
5506
|
-
/* @__PURE__ */
|
|
5507
|
-
/* @__PURE__ */
|
|
5508
|
-
/* @__PURE__ */
|
|
5555
|
+
/* @__PURE__ */ jsx25("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5556
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1", children: [
|
|
5557
|
+
/* @__PURE__ */ jsx25("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5558
|
+
/* @__PURE__ */ jsx25(
|
|
5509
5559
|
"textarea",
|
|
5510
5560
|
{
|
|
5511
5561
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5517,10 +5567,10 @@ var ImageEditor = ({
|
|
|
5517
5567
|
}
|
|
5518
5568
|
)
|
|
5519
5569
|
] }),
|
|
5520
|
-
/* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5522
|
-
/* @__PURE__ */
|
|
5523
|
-
/* @__PURE__ */
|
|
5570
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1", children: [
|
|
5571
|
+
/* @__PURE__ */ jsx25("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5572
|
+
/* @__PURE__ */ jsxs23("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5573
|
+
/* @__PURE__ */ jsxs23(
|
|
5524
5574
|
"button",
|
|
5525
5575
|
{
|
|
5526
5576
|
type: "button",
|
|
@@ -5533,7 +5583,7 @@ var ImageEditor = ({
|
|
|
5533
5583
|
]
|
|
5534
5584
|
}
|
|
5535
5585
|
),
|
|
5536
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsxs23(
|
|
5537
5587
|
"button",
|
|
5538
5588
|
{
|
|
5539
5589
|
type: "button",
|
|
@@ -5548,25 +5598,25 @@ var ImageEditor = ({
|
|
|
5548
5598
|
)
|
|
5549
5599
|
] })
|
|
5550
5600
|
] }),
|
|
5551
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsx25(
|
|
5552
5602
|
"button",
|
|
5553
5603
|
{
|
|
5554
5604
|
type: "button",
|
|
5555
5605
|
onClick: handleInpaint,
|
|
5556
5606
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5557
5607
|
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",
|
|
5558
|
-
children: isInpainting ? /* @__PURE__ */
|
|
5559
|
-
/* @__PURE__ */
|
|
5608
|
+
children: isInpainting ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5609
|
+
/* @__PURE__ */ jsx25("div", { className: imageSpinnerClass }),
|
|
5560
5610
|
"Generating Inpaint..."
|
|
5561
|
-
] }) : /* @__PURE__ */
|
|
5562
|
-
/* @__PURE__ */
|
|
5611
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5612
|
+
/* @__PURE__ */ jsx25("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx25("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" }) }),
|
|
5563
5613
|
"Apply Inpainting"
|
|
5564
5614
|
] })
|
|
5565
5615
|
}
|
|
5566
5616
|
)
|
|
5567
5617
|
] }),
|
|
5568
|
-
aiError && /* @__PURE__ */
|
|
5569
|
-
aiSuccess && /* @__PURE__ */
|
|
5618
|
+
aiError && /* @__PURE__ */ jsx25("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5619
|
+
aiSuccess && /* @__PURE__ */ jsx25("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5570
5620
|
] })
|
|
5571
5621
|
] })
|
|
5572
5622
|
] })
|
|
@@ -5600,6 +5650,7 @@ export {
|
|
|
5600
5650
|
SelectAndMaskWorkspace,
|
|
5601
5651
|
ContentAwareFillWorkspace,
|
|
5602
5652
|
SelectionOptionsBar,
|
|
5653
|
+
MaskEdgeCheck,
|
|
5603
5654
|
RefineEdgePanel,
|
|
5604
5655
|
ChannelsPanel,
|
|
5605
5656
|
PathsPanel,
|