@pixerate/editor-react 0.142.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-ULBLX67B.js → chunk-3CB4WG24.js} +564 -460
- package/dist/image-editor/ImageEditorCanvas.d.cts +1 -1
- package/dist/image-editor/ImageEditorCanvas.d.ts +1 -1
- package/dist/image-editor/MaskEdgeCheck.d.cts +16 -0
- package/dist/image-editor/MaskEdgeCheck.d.ts +16 -0
- package/dist/image-editor/PathsPanel.d.cts +2 -1
- package/dist/image-editor/PathsPanel.d.ts +2 -1
- package/dist/image-editor/RefineEdgePanel.d.cts +2 -1
- package/dist/image-editor/RefineEdgePanel.d.ts +2 -1
- package/dist/image-editor/index.cjs +596 -494
- 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 +1121 -1019
- 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,
|
|
@@ -199,7 +199,8 @@ import {
|
|
|
199
199
|
DEFAULT_SELECTION_TOOL_OPTIONS as DEFAULT_SELECTION_TOOL_OPTIONS2,
|
|
200
200
|
FreeTransformTool as FreeTransformTool2,
|
|
201
201
|
DEFAULT_SHAPE_TOOL_OPTIONS as DEFAULT_SHAPE_TOOL_OPTIONS2,
|
|
202
|
-
DEFAULT_TYPE_TOOL_OPTIONS as DEFAULT_TYPE_TOOL_OPTIONS2
|
|
202
|
+
DEFAULT_TYPE_TOOL_OPTIONS as DEFAULT_TYPE_TOOL_OPTIONS2,
|
|
203
|
+
imageToolLabel
|
|
203
204
|
} from "@pixerate/editor/image-editor";
|
|
204
205
|
|
|
205
206
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -228,6 +229,8 @@ import {
|
|
|
228
229
|
handleMaskViewKey,
|
|
229
230
|
ShapeDrawGesture,
|
|
230
231
|
TypeToolGesture,
|
|
232
|
+
PathEditGesture,
|
|
233
|
+
isPathEditTool,
|
|
231
234
|
DEFAULT_SHAPE_TOOL_OPTIONS,
|
|
232
235
|
DEFAULT_TYPE_TOOL_OPTIONS
|
|
233
236
|
} from "@pixerate/editor/image-editor";
|
|
@@ -366,6 +369,12 @@ var ImageEditorCanvas = ({
|
|
|
366
369
|
typeToolRef.current = new TypeToolGesture(controller, () => typeOptionsRef.current);
|
|
367
370
|
shapeTypeControllerRef.current = controller;
|
|
368
371
|
}
|
|
372
|
+
const pathGestureRef = useRef2(null);
|
|
373
|
+
const pathControllerRef = useRef2(controller);
|
|
374
|
+
if (!pathGestureRef.current || pathControllerRef.current !== controller) {
|
|
375
|
+
pathGestureRef.current = new PathEditGesture(controller);
|
|
376
|
+
pathControllerRef.current = controller;
|
|
377
|
+
}
|
|
369
378
|
const typeInputRef = useRef2(null);
|
|
370
379
|
const [typeSession, setTypeSessionState] = useState2(typeToolRef.current.session);
|
|
371
380
|
const setTypeSession = (session) => {
|
|
@@ -387,7 +396,10 @@ var ImageEditorCanvas = ({
|
|
|
387
396
|
if (!canvas || !container) return;
|
|
388
397
|
const viewport = measureCanvasViewport(container);
|
|
389
398
|
viewRef.current = { width: viewport.width, height: viewport.height };
|
|
390
|
-
|
|
399
|
+
const viewScale = getViewportProjection(controller.getState(), viewport.width, viewport.height, mode === "crop").scale;
|
|
400
|
+
transformTool.setView(viewScale);
|
|
401
|
+
pathGestureRef.current?.setView(viewScale);
|
|
402
|
+
const activeTool = controller.getState().activeTool;
|
|
391
403
|
await controller.render(canvas, {
|
|
392
404
|
viewportWidth: viewport.width,
|
|
393
405
|
viewportHeight: viewport.height,
|
|
@@ -403,7 +415,8 @@ var ImageEditorCanvas = ({
|
|
|
403
415
|
draftSelectionPath: selectionDraftRef.current,
|
|
404
416
|
brushCursor: mode === "paint" && brushCursorRef.current && controller.getState().activeTool !== "move" && !transformTool.active ? { ...brushCursorRef.current, diameter: controller.getState().paint.brush.size } : null,
|
|
405
417
|
freeTransform: transformTool.overlay(),
|
|
406
|
-
textEdit: typeToolRef.current?.session?.alive ? typeToolRef.current.session.overlay() : null
|
|
418
|
+
textEdit: typeToolRef.current?.session?.alive ? typeToolRef.current.session.overlay() : null,
|
|
419
|
+
pathEdit: mode === "annotate" && isPathEditTool(activeTool) ? pathGestureRef.current?.overlay(activeTool) : null
|
|
407
420
|
});
|
|
408
421
|
},
|
|
409
422
|
[controller, mode, fit, transformTool]
|
|
@@ -620,6 +633,21 @@ var ImageEditorCanvas = ({
|
|
|
620
633
|
window.addEventListener("keydown", onKey);
|
|
621
634
|
return () => window.removeEventListener("keydown", onKey);
|
|
622
635
|
});
|
|
636
|
+
useEffect2(() => {
|
|
637
|
+
if (mode !== "annotate" || typeof window === "undefined") return;
|
|
638
|
+
const onKey = (e) => {
|
|
639
|
+
const target = e.target;
|
|
640
|
+
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
641
|
+
if (!isPathEditTool(controller.getState().activeTool)) return;
|
|
642
|
+
if (pathGestureRef.current?.key(e.key)) {
|
|
643
|
+
e.preventDefault();
|
|
644
|
+
report("path", pathGestureRef.current.error);
|
|
645
|
+
void renderCanvas();
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
window.addEventListener("keydown", onKey);
|
|
649
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
650
|
+
});
|
|
623
651
|
useEffect2(() => {
|
|
624
652
|
if (mode !== "paint" || typeof window === "undefined") return;
|
|
625
653
|
const onKey = (e) => {
|
|
@@ -668,6 +696,13 @@ var ImageEditorCanvas = ({
|
|
|
668
696
|
}
|
|
669
697
|
return;
|
|
670
698
|
}
|
|
699
|
+
if (mode === "annotate" && isPathEditTool(state.activeTool)) {
|
|
700
|
+
const g = pathGestureRef.current;
|
|
701
|
+
g.down(canvasToImagePoint(canvasPt, state, viewRef.current.width, viewRef.current.height, false), state.activeTool, { shift: e.shiftKey, alt: e.altKey });
|
|
702
|
+
report("path", g.error);
|
|
703
|
+
void renderCanvas();
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
671
706
|
if (mode === "annotate" && (state.activeTool === "shape" || state.activeTool === "type")) {
|
|
672
707
|
const imgPt = canvasToImagePoint(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
|
|
673
708
|
report(state.activeTool, null);
|
|
@@ -769,6 +804,16 @@ var ImageEditorCanvas = ({
|
|
|
769
804
|
}
|
|
770
805
|
return;
|
|
771
806
|
}
|
|
807
|
+
if (mode === "annotate" && isPathEditTool(state.activeTool)) {
|
|
808
|
+
const g = pathGestureRef.current;
|
|
809
|
+
const imgPt = canvasToImagePoint(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
|
|
810
|
+
if (g.active) {
|
|
811
|
+
g.move(imgPt, { shift: e.shiftKey, alt: e.altKey });
|
|
812
|
+
if (g.error) report("path", g.error);
|
|
813
|
+
} else g.hover(imgPt);
|
|
814
|
+
void renderCanvas();
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
772
817
|
if (mode === "annotate" && state.activeTool === "shape") {
|
|
773
818
|
const g = shapeGestureRef.current;
|
|
774
819
|
if (g.active) {
|
|
@@ -880,6 +925,11 @@ var ImageEditorCanvas = ({
|
|
|
880
925
|
}
|
|
881
926
|
return;
|
|
882
927
|
}
|
|
928
|
+
if (mode === "annotate" && isPathEditTool(state.activeTool)) {
|
|
929
|
+
pathGestureRef.current.up();
|
|
930
|
+
void renderCanvas();
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
883
933
|
if (mode === "annotate" && state.activeTool === "shape") {
|
|
884
934
|
shapeGestureRef.current.up();
|
|
885
935
|
return;
|
|
@@ -968,7 +1018,7 @@ var ImageEditorCanvas = ({
|
|
|
968
1018
|
onPointerCancel: () => paintGestureRef.current?.cancel(),
|
|
969
1019
|
"data-testid": "image-editor-canvas",
|
|
970
1020
|
style: transformTool.active ? { width: "100%", height: "100%", cursor: transformCursor } : { width: "100%", height: "100%" },
|
|
971
|
-
className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : mode === "paint" ? "touch-none cursor-crosshair" : mode === "annotate" && state.activeTool === "type" ? "cursor-text" : mode === "annotate" && state.activeTool === "shape" ? "cursor-crosshair" : ""}`
|
|
1021
|
+
className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : mode === "paint" ? "touch-none cursor-crosshair" : mode === "annotate" && state.activeTool === "type" ? "cursor-text" : mode === "annotate" && (state.activeTool === "shape" || state.activeTool === "path-pen") ? "cursor-crosshair" : mode === "annotate" && isPathEditTool(state.activeTool) ? "cursor-default" : ""}`
|
|
972
1022
|
}
|
|
973
1023
|
),
|
|
974
1024
|
typeSession && /* @__PURE__ */ jsx(
|
|
@@ -3681,7 +3731,7 @@ var SelectionOptionsBar = ({
|
|
|
3681
3731
|
};
|
|
3682
3732
|
|
|
3683
3733
|
// src/image-editor/RefineEdgePanel.tsx
|
|
3684
|
-
import { useState as
|
|
3734
|
+
import { useState as useState15 } from "react";
|
|
3685
3735
|
import {
|
|
3686
3736
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3687
3737
|
REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
|
|
@@ -3689,18 +3739,67 @@ import {
|
|
|
3689
3739
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
3690
3740
|
layerMaskFromSelection
|
|
3691
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";
|
|
3692
3746
|
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3693
|
-
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
3694
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";
|
|
3695
|
-
var
|
|
3696
|
-
const
|
|
3697
|
-
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);
|
|
3698
3751
|
const [error, setError] = useState14(null);
|
|
3699
|
-
const
|
|
3700
|
-
const
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
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);
|
|
3704
3803
|
const canObject = Boolean(controller.segmentationProvider);
|
|
3705
3804
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
3706
3805
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -3720,17 +3819,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3720
3819
|
setBusy(false);
|
|
3721
3820
|
}
|
|
3722
3821
|
};
|
|
3723
|
-
return /* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */
|
|
3726
|
-
/* @__PURE__ */
|
|
3727
|
-
/* @__PURE__ */
|
|
3728
|
-
/* @__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: [
|
|
3729
3828
|
params[c.id],
|
|
3730
3829
|
c.unit
|
|
3731
3830
|
] })
|
|
3732
3831
|
] }),
|
|
3733
|
-
/* @__PURE__ */
|
|
3832
|
+
/* @__PURE__ */ jsx19(
|
|
3734
3833
|
"input",
|
|
3735
3834
|
{
|
|
3736
3835
|
type: "range",
|
|
@@ -3744,39 +3843,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3744
3843
|
}
|
|
3745
3844
|
)
|
|
3746
3845
|
] }, c.id)),
|
|
3747
|
-
/* @__PURE__ */
|
|
3748
|
-
/* @__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 }) }),
|
|
3749
3848
|
"Smart Radius"
|
|
3750
3849
|
] }),
|
|
3751
|
-
canObject && /* @__PURE__ */
|
|
3752
|
-
/* @__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) }),
|
|
3753
3852
|
"Object aware (segmentation model)"
|
|
3754
3853
|
] }),
|
|
3755
|
-
/* @__PURE__ */
|
|
3854
|
+
/* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3756
3855
|
"Output to",
|
|
3757
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ jsx19(
|
|
3758
3857
|
"select",
|
|
3759
3858
|
{
|
|
3760
3859
|
"aria-label": "Refine output",
|
|
3761
3860
|
value: output,
|
|
3762
3861
|
onChange: (e) => setOutput(e.target.value),
|
|
3763
3862
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3764
|
-
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))
|
|
3765
3864
|
}
|
|
3766
3865
|
)
|
|
3767
3866
|
] }),
|
|
3768
|
-
/* @__PURE__ */
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
/* @__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: [
|
|
3771
3870
|
"Decontaminate colors",
|
|
3772
3871
|
toLayer ? "" : " (new layer or document outputs)"
|
|
3773
3872
|
] }),
|
|
3774
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
|
|
3775
3874
|
decontaminate,
|
|
3776
3875
|
"%"
|
|
3777
3876
|
] })
|
|
3778
3877
|
] }),
|
|
3779
|
-
/* @__PURE__ */
|
|
3878
|
+
/* @__PURE__ */ jsx19(
|
|
3780
3879
|
"input",
|
|
3781
3880
|
{
|
|
3782
3881
|
type: "range",
|
|
@@ -3791,63 +3890,64 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3791
3890
|
}
|
|
3792
3891
|
)
|
|
3793
3892
|
] }),
|
|
3794
|
-
/* @__PURE__ */
|
|
3795
|
-
/* @__PURE__ */
|
|
3796
|
-
/* @__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" })
|
|
3797
3896
|
] }),
|
|
3798
|
-
error && /* @__PURE__ */
|
|
3799
|
-
/* @__PURE__ */
|
|
3800
|
-
/* @__PURE__ */
|
|
3801
|
-
|
|
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(
|
|
3802
3902
|
"select",
|
|
3803
3903
|
{
|
|
3804
3904
|
"aria-label": "New masked layer kind",
|
|
3805
3905
|
value: newKind,
|
|
3806
3906
|
onChange: (e) => setNewKind(e.target.value),
|
|
3807
3907
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3808
|
-
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */
|
|
3908
|
+
children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx19("option", { value: k.kind, children: k.label }, k.kind))
|
|
3809
3909
|
}
|
|
3810
3910
|
),
|
|
3811
|
-
/* @__PURE__ */
|
|
3911
|
+
/* @__PURE__ */ jsx19(
|
|
3812
3912
|
"button",
|
|
3813
3913
|
{
|
|
3814
3914
|
type: "button",
|
|
3815
|
-
className:
|
|
3915
|
+
className: button4,
|
|
3816
3916
|
disabled: !sel,
|
|
3817
3917
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
|
|
3818
3918
|
children: "New Masked Layer"
|
|
3819
3919
|
}
|
|
3820
3920
|
)
|
|
3821
3921
|
] }),
|
|
3822
|
-
list.length > 0 && target && /* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3922
|
+
list.length > 0 && target && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
|
|
3923
|
+
/* @__PURE__ */ jsx19(
|
|
3824
3924
|
"select",
|
|
3825
3925
|
{
|
|
3826
3926
|
"aria-label": "Mask layer",
|
|
3827
3927
|
value: target.id,
|
|
3828
3928
|
onChange: (e) => setLayerId(e.target.value),
|
|
3829
3929
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3830
|
-
children: list.map((l) => /* @__PURE__ */
|
|
3930
|
+
children: list.map((l) => /* @__PURE__ */ jsxs17("option", { value: l.id, children: [
|
|
3831
3931
|
l.name || adjustmentKindLabel2(l.kind),
|
|
3832
3932
|
l.mask ? " (masked)" : ""
|
|
3833
3933
|
] }, l.id))
|
|
3834
3934
|
}
|
|
3835
3935
|
),
|
|
3836
|
-
/* @__PURE__ */
|
|
3837
|
-
/* @__PURE__ */
|
|
3838
|
-
/* @__PURE__ */
|
|
3839
|
-
/* @__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" })
|
|
3840
3940
|
] }),
|
|
3841
|
-
target.mask && /* @__PURE__ */
|
|
3842
|
-
/* @__PURE__ */
|
|
3843
|
-
/* @__PURE__ */
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__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: [
|
|
3846
3946
|
Math.round((target.mask.density ?? 1) * 100),
|
|
3847
3947
|
"%"
|
|
3848
3948
|
] })
|
|
3849
3949
|
] }),
|
|
3850
|
-
/* @__PURE__ */
|
|
3950
|
+
/* @__PURE__ */ jsx19(
|
|
3851
3951
|
"input",
|
|
3852
3952
|
{
|
|
3853
3953
|
type: "range",
|
|
@@ -3861,15 +3961,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3861
3961
|
}
|
|
3862
3962
|
)
|
|
3863
3963
|
] }),
|
|
3864
|
-
/* @__PURE__ */
|
|
3865
|
-
/* @__PURE__ */
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
/* @__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: [
|
|
3868
3968
|
target.mask.feather ?? 0,
|
|
3869
3969
|
"px"
|
|
3870
3970
|
] })
|
|
3871
3971
|
] }),
|
|
3872
|
-
/* @__PURE__ */
|
|
3972
|
+
/* @__PURE__ */ jsx19(
|
|
3873
3973
|
"input",
|
|
3874
3974
|
{
|
|
3875
3975
|
type: "range",
|
|
@@ -3889,9 +3989,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3889
3989
|
};
|
|
3890
3990
|
|
|
3891
3991
|
// src/image-editor/ChannelsPanel.tsx
|
|
3892
|
-
import { useEffect as useEffect12, useRef as useRef10, useState as
|
|
3992
|
+
import { useEffect as useEffect12, useRef as useRef10, useState as useState16 } from "react";
|
|
3893
3993
|
import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
|
|
3894
|
-
import { jsx as
|
|
3994
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3895
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"}`;
|
|
3896
3996
|
var ChannelThumb = ({ channel, size }) => {
|
|
3897
3997
|
const ref = useRef10(null);
|
|
@@ -3906,14 +4006,14 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
3906
4006
|
img.data.set(px.data);
|
|
3907
4007
|
ctx.putImageData(img, 0, 0);
|
|
3908
4008
|
}, [channel.mask]);
|
|
3909
|
-
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" });
|
|
3910
4010
|
};
|
|
3911
4011
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
3912
|
-
const [, setTick] =
|
|
4012
|
+
const [, setTick] = useState16(0);
|
|
3913
4013
|
useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3914
|
-
const [activeId, setActiveId] =
|
|
3915
|
-
const [renaming, setRenaming] =
|
|
3916
|
-
const [error, setError] =
|
|
4014
|
+
const [activeId, setActiveId] = useState16(null);
|
|
4015
|
+
const [renaming, setRenaming] = useState16(null);
|
|
4016
|
+
const [error, setError] = useState16(null);
|
|
3917
4017
|
const fileInput = useRef10(null);
|
|
3918
4018
|
const channels = controller.getChannels();
|
|
3919
4019
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
@@ -3936,13 +4036,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3936
4036
|
setError(err instanceof Error ? err.message : String(err));
|
|
3937
4037
|
}
|
|
3938
4038
|
};
|
|
3939
|
-
return /* @__PURE__ */
|
|
3940
|
-
/* @__PURE__ */
|
|
3941
|
-
/* @__PURE__ */
|
|
3942
|
-
/* @__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" })
|
|
3943
4043
|
] }),
|
|
3944
|
-
channels.length === 0 && /* @__PURE__ */
|
|
3945
|
-
/* @__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(
|
|
3946
4046
|
"li",
|
|
3947
4047
|
{
|
|
3948
4048
|
"data-testid": "channel-row",
|
|
@@ -3954,7 +4054,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3954
4054
|
},
|
|
3955
4055
|
onDoubleClick: () => setRenaming(c.id),
|
|
3956
4056
|
children: [
|
|
3957
|
-
/* @__PURE__ */
|
|
4057
|
+
/* @__PURE__ */ jsx20(
|
|
3958
4058
|
"button",
|
|
3959
4059
|
{
|
|
3960
4060
|
type: "button",
|
|
@@ -3968,8 +4068,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3968
4068
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
3969
4069
|
}
|
|
3970
4070
|
),
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
renaming === c.id ? /* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ jsx20(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
4072
|
+
renaming === c.id ? /* @__PURE__ */ jsx20(
|
|
3973
4073
|
"input",
|
|
3974
4074
|
{
|
|
3975
4075
|
autoFocus: true,
|
|
@@ -3986,16 +4086,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
3986
4086
|
if (e.key === "Escape") setRenaming(null);
|
|
3987
4087
|
}
|
|
3988
4088
|
}
|
|
3989
|
-
) : /* @__PURE__ */
|
|
4089
|
+
) : /* @__PURE__ */ jsx20("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
3990
4090
|
]
|
|
3991
4091
|
},
|
|
3992
4092
|
c.id
|
|
3993
4093
|
)) }),
|
|
3994
|
-
/* @__PURE__ */
|
|
3995
|
-
/* @__PURE__ */
|
|
3996
|
-
/* @__PURE__ */
|
|
3997
|
-
/* @__PURE__ */
|
|
3998
|
-
/* @__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(
|
|
3999
4099
|
"button",
|
|
4000
4100
|
{
|
|
4001
4101
|
type: "button",
|
|
@@ -4008,8 +4108,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4008
4108
|
children: "Delete"
|
|
4009
4109
|
}
|
|
4010
4110
|
),
|
|
4011
|
-
/* @__PURE__ */
|
|
4012
|
-
/* @__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(
|
|
4013
4113
|
"button",
|
|
4014
4114
|
{
|
|
4015
4115
|
type: "button",
|
|
@@ -4020,7 +4120,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4020
4120
|
children: "Export PNG"
|
|
4021
4121
|
}
|
|
4022
4122
|
),
|
|
4023
|
-
/* @__PURE__ */
|
|
4123
|
+
/* @__PURE__ */ jsx20(
|
|
4024
4124
|
"input",
|
|
4025
4125
|
{
|
|
4026
4126
|
ref: fileInput,
|
|
@@ -4035,22 +4135,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4035
4135
|
}
|
|
4036
4136
|
)
|
|
4037
4137
|
] }),
|
|
4038
|
-
error && /* @__PURE__ */
|
|
4138
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
|
|
4039
4139
|
] });
|
|
4040
4140
|
};
|
|
4041
4141
|
|
|
4042
4142
|
// src/image-editor/PathsPanel.tsx
|
|
4043
|
-
import { useEffect as useEffect13, useState as
|
|
4143
|
+
import { useEffect as useEffect13, useState as useState17 } from "react";
|
|
4044
4144
|
import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
|
|
4045
|
-
import { jsx as
|
|
4145
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4046
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"}`;
|
|
4047
4147
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
4048
|
-
const [, setTick] =
|
|
4148
|
+
const [, setTick] = useState17(0);
|
|
4049
4149
|
useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4050
|
-
const [renaming, setRenaming] =
|
|
4051
|
-
const [color, setColor] =
|
|
4052
|
-
const [width, setWidth] =
|
|
4053
|
-
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);
|
|
4054
4154
|
const paths = controller.getPaths();
|
|
4055
4155
|
const activeId = controller.getState().activePathId ?? null;
|
|
4056
4156
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -4064,95 +4164,98 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
4064
4164
|
setError(err instanceof Error ? err.message : String(err));
|
|
4065
4165
|
}
|
|
4066
4166
|
};
|
|
4067
|
-
return
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
"
|
|
4072
|
-
{
|
|
4073
|
-
"
|
|
4074
|
-
"aria-current": p.id === activeId ? "true" : void 0,
|
|
4075
|
-
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
4076
|
-
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4077
|
-
onDoubleClick: () => setRenaming(p.id),
|
|
4078
|
-
children: [
|
|
4079
|
-
/* @__PURE__ */ jsx20("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__ */ jsx20("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
4080
|
-
renaming === p.id ? /* @__PURE__ */ jsx20(
|
|
4081
|
-
"input",
|
|
4082
|
-
{
|
|
4083
|
-
autoFocus: true,
|
|
4084
|
-
"aria-label": "Path name",
|
|
4085
|
-
defaultValue: p.work ? "" : p.name,
|
|
4086
|
-
placeholder: "Path name",
|
|
4087
|
-
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
4088
|
-
onClick: (e) => e.stopPropagation(),
|
|
4089
|
-
onBlur: (e) => {
|
|
4090
|
-
setRenaming(null);
|
|
4091
|
-
const name = e.currentTarget.value.trim();
|
|
4092
|
-
if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
|
|
4093
|
-
},
|
|
4094
|
-
onKeyDown: (e) => {
|
|
4095
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
4096
|
-
if (e.key === "Escape") setRenaming(null);
|
|
4097
|
-
}
|
|
4098
|
-
}
|
|
4099
|
-
) : /* @__PURE__ */ jsx20("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4100
|
-
]
|
|
4101
|
-
},
|
|
4102
|
-
p.id
|
|
4103
|
-
)) }),
|
|
4104
|
-
/* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
|
|
4105
|
-
/* @__PURE__ */ jsx20(
|
|
4106
|
-
"button",
|
|
4167
|
+
return (
|
|
4168
|
+
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
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(
|
|
4173
|
+
"li",
|
|
4107
4174
|
{
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
children:
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4175
|
+
"data-testid": "path-row",
|
|
4176
|
+
"aria-current": p.id === activeId ? "true" : void 0,
|
|
4177
|
+
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
4178
|
+
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
4179
|
+
onDoubleClick: () => setRenaming(p.id),
|
|
4180
|
+
children: [
|
|
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(
|
|
4183
|
+
"input",
|
|
4184
|
+
{
|
|
4185
|
+
autoFocus: true,
|
|
4186
|
+
"aria-label": "Path name",
|
|
4187
|
+
defaultValue: p.work ? "" : p.name,
|
|
4188
|
+
placeholder: "Path name",
|
|
4189
|
+
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
4190
|
+
onClick: (e) => e.stopPropagation(),
|
|
4191
|
+
onBlur: (e) => {
|
|
4192
|
+
setRenaming(null);
|
|
4193
|
+
const name = e.currentTarget.value.trim();
|
|
4194
|
+
if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
|
|
4195
|
+
},
|
|
4196
|
+
onKeyDown: (e) => {
|
|
4197
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
4198
|
+
if (e.key === "Escape") setRenaming(null);
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
) : /* @__PURE__ */ jsx21("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
4202
|
+
]
|
|
4203
|
+
},
|
|
4204
|
+
p.id
|
|
4205
|
+
)) }),
|
|
4206
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
|
|
4207
|
+
/* @__PURE__ */ jsx21(
|
|
4208
|
+
"button",
|
|
4126
4209
|
{
|
|
4127
|
-
type: "
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
|
|
4134
|
-
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4210
|
+
type: "button",
|
|
4211
|
+
className: btn3(),
|
|
4212
|
+
disabled: !active,
|
|
4213
|
+
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
4214
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: selectionModeFromModifiers2(e, "replace") })),
|
|
4215
|
+
children: "Load as Selection"
|
|
4135
4216
|
}
|
|
4136
4217
|
),
|
|
4137
|
-
"
|
|
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" })
|
|
4138
4221
|
] }),
|
|
4139
|
-
/* @__PURE__ */
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
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(
|
|
4227
|
+
"input",
|
|
4228
|
+
{
|
|
4229
|
+
type: "number",
|
|
4230
|
+
min: 0.5,
|
|
4231
|
+
max: 250,
|
|
4232
|
+
step: 0.5,
|
|
4233
|
+
"aria-label": "Stroke width",
|
|
4234
|
+
value: width,
|
|
4235
|
+
onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
|
|
4236
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4237
|
+
}
|
|
4238
|
+
),
|
|
4239
|
+
"px"
|
|
4240
|
+
] }),
|
|
4241
|
+
/* @__PURE__ */ jsx21("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
4242
|
+
] }),
|
|
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" })
|
|
4246
|
+
] }),
|
|
4247
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
|
|
4248
|
+
] })
|
|
4249
|
+
);
|
|
4147
4250
|
};
|
|
4148
4251
|
|
|
4149
4252
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4150
|
-
import { useEffect as useEffect14, useState as
|
|
4253
|
+
import { useEffect as useEffect14, useState as useState18 } from "react";
|
|
4151
4254
|
import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
|
|
4152
|
-
import { jsx as
|
|
4255
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4153
4256
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4154
4257
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4155
|
-
const [, setTick] =
|
|
4258
|
+
const [, setTick] = useState18(0);
|
|
4156
4259
|
useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4157
4260
|
const bar = tool.bar();
|
|
4158
4261
|
if (!tool.active || !bar) return null;
|
|
@@ -4165,17 +4268,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4165
4268
|
const v = Number(raw);
|
|
4166
4269
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4167
4270
|
};
|
|
4168
|
-
return /* @__PURE__ */
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
/* @__PURE__ */
|
|
4171
|
-
tool.mode === "warp" && /* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4173
|
-
/* @__PURE__ */
|
|
4174
|
-
/* @__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)) })
|
|
4175
4278
|
] }),
|
|
4176
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */
|
|
4177
|
-
/* @__PURE__ */
|
|
4178
|
-
/* @__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(
|
|
4179
4282
|
"input",
|
|
4180
4283
|
{
|
|
4181
4284
|
type: "number",
|
|
@@ -4196,9 +4299,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4196
4299
|
},
|
|
4197
4300
|
`${k}:${warp[k]}`
|
|
4198
4301
|
),
|
|
4199
|
-
/* @__PURE__ */
|
|
4302
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "%" })
|
|
4200
4303
|
] }, k)),
|
|
4201
|
-
/* @__PURE__ */
|
|
4304
|
+
/* @__PURE__ */ jsx22(
|
|
4202
4305
|
"button",
|
|
4203
4306
|
{
|
|
4204
4307
|
type: "button",
|
|
@@ -4210,9 +4313,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4210
4313
|
children: "Vertical"
|
|
4211
4314
|
}
|
|
4212
4315
|
),
|
|
4213
|
-
/* @__PURE__ */
|
|
4214
|
-
/* @__PURE__ */
|
|
4215
|
-
/* @__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(
|
|
4216
4319
|
"select",
|
|
4217
4320
|
{
|
|
4218
4321
|
"aria-label": "Warp grid",
|
|
@@ -4222,14 +4325,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4222
4325
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4223
4326
|
},
|
|
4224
4327
|
className: imageFieldClass,
|
|
4225
|
-
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))
|
|
4226
4329
|
}
|
|
4227
4330
|
)
|
|
4228
4331
|
] })
|
|
4229
4332
|
] }),
|
|
4230
|
-
tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */
|
|
4231
|
-
/* @__PURE__ */
|
|
4232
|
-
/* @__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(
|
|
4233
4336
|
"input",
|
|
4234
4337
|
{
|
|
4235
4338
|
type: "number",
|
|
@@ -4249,8 +4352,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4249
4352
|
},
|
|
4250
4353
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4251
4354
|
),
|
|
4252
|
-
/* @__PURE__ */
|
|
4253
|
-
f.id === "scaleX" && /* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4356
|
+
f.id === "scaleX" && /* @__PURE__ */ jsx22(
|
|
4254
4357
|
"button",
|
|
4255
4358
|
{
|
|
4256
4359
|
type: "button",
|
|
@@ -4265,33 +4368,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4265
4368
|
}
|
|
4266
4369
|
)
|
|
4267
4370
|
] }, f.id)),
|
|
4268
|
-
/* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
/* @__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(
|
|
4271
4374
|
"select",
|
|
4272
4375
|
{
|
|
4273
4376
|
"aria-label": "Interpolation",
|
|
4274
4377
|
value: tool.interpolation,
|
|
4275
4378
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4276
4379
|
className: imageFieldClass,
|
|
4277
|
-
children: INTERPOLATIONS.map((i) => /* @__PURE__ */
|
|
4380
|
+
children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx22("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4278
4381
|
}
|
|
4279
4382
|
)
|
|
4280
4383
|
] }),
|
|
4281
|
-
/* @__PURE__ */
|
|
4282
|
-
/* @__PURE__ */
|
|
4283
|
-
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 })
|
|
4284
4387
|
] });
|
|
4285
4388
|
};
|
|
4286
4389
|
|
|
4287
4390
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4288
|
-
import { useEffect as useEffect15, useState as
|
|
4391
|
+
import { useEffect as useEffect15, useState as useState19 } from "react";
|
|
4289
4392
|
import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
|
|
4290
|
-
import { Fragment as
|
|
4393
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4291
4394
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4292
|
-
const [, setTick] =
|
|
4395
|
+
const [, setTick] = useState19(0);
|
|
4293
4396
|
useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4294
|
-
const [error, setError] =
|
|
4397
|
+
const [error, setError] = useState19(null);
|
|
4295
4398
|
const active = controller.getActiveLayer();
|
|
4296
4399
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4297
4400
|
const set = (change) => {
|
|
@@ -4305,22 +4408,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4305
4408
|
}
|
|
4306
4409
|
};
|
|
4307
4410
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4308
|
-
return /* @__PURE__ */
|
|
4309
|
-
/* @__PURE__ */
|
|
4310
|
-
/* @__PURE__ */
|
|
4311
|
-
/* @__PURE__ */
|
|
4312
|
-
/* @__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 }) }),
|
|
4313
4416
|
"Fill",
|
|
4314
|
-
/* @__PURE__ */
|
|
4417
|
+
/* @__PURE__ */ jsx23(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
4315
4418
|
] }),
|
|
4316
|
-
/* @__PURE__ */
|
|
4317
|
-
/* @__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 }) }),
|
|
4318
4421
|
"Stroke",
|
|
4319
|
-
/* @__PURE__ */
|
|
4422
|
+
/* @__PURE__ */ jsx23(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
4320
4423
|
] }),
|
|
4321
|
-
/* @__PURE__ */
|
|
4424
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4322
4425
|
"Width",
|
|
4323
|
-
/* @__PURE__ */
|
|
4426
|
+
/* @__PURE__ */ jsx23(
|
|
4324
4427
|
"input",
|
|
4325
4428
|
{
|
|
4326
4429
|
type: "number",
|
|
@@ -4334,52 +4437,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4334
4437
|
)
|
|
4335
4438
|
] })
|
|
4336
4439
|
] }),
|
|
4337
|
-
/* @__PURE__ */
|
|
4338
|
-
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: [
|
|
4339
4442
|
"Radius",
|
|
4340
|
-
/* @__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}` })
|
|
4341
4444
|
] }),
|
|
4342
|
-
options.kind === "polygon" && /* @__PURE__ */
|
|
4445
|
+
options.kind === "polygon" && /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4343
4446
|
"Sides",
|
|
4344
|
-
/* @__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}` })
|
|
4345
4448
|
] }),
|
|
4346
|
-
options.kind === "star" && /* @__PURE__ */
|
|
4347
|
-
/* @__PURE__ */
|
|
4449
|
+
options.kind === "star" && /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
4450
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4348
4451
|
"Points",
|
|
4349
|
-
/* @__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}` })
|
|
4350
4453
|
] }),
|
|
4351
|
-
/* @__PURE__ */
|
|
4454
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4352
4455
|
"Inner",
|
|
4353
|
-
/* @__PURE__ */
|
|
4456
|
+
/* @__PURE__ */ jsx23(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4354
4457
|
] })
|
|
4355
4458
|
] }),
|
|
4356
|
-
options.kind === "line" && /* @__PURE__ */
|
|
4357
|
-
/* @__PURE__ */
|
|
4459
|
+
options.kind === "line" && /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
4460
|
+
/* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
|
|
4358
4461
|
"Weight",
|
|
4359
|
-
/* @__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}` })
|
|
4360
4463
|
] }),
|
|
4361
|
-
/* @__PURE__ */
|
|
4362
|
-
/* @__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 }) }),
|
|
4363
4466
|
"Arrowhead"
|
|
4364
4467
|
] })
|
|
4365
4468
|
] })
|
|
4366
4469
|
] }),
|
|
4367
|
-
/* @__PURE__ */
|
|
4368
|
-
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 })
|
|
4369
4472
|
] });
|
|
4370
4473
|
};
|
|
4371
4474
|
|
|
4372
4475
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4373
|
-
import { useEffect as useEffect16, useState as
|
|
4476
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
4374
4477
|
import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
|
|
4375
|
-
import { jsx as
|
|
4478
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4376
4479
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4377
4480
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
4378
4481
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4379
|
-
const [, setTick] =
|
|
4482
|
+
const [, setTick] = useState20(0);
|
|
4380
4483
|
useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4381
4484
|
useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4382
|
-
const [error, setError] =
|
|
4485
|
+
const [error, setError] = useState20(null);
|
|
4383
4486
|
const active = controller.getActiveLayer();
|
|
4384
4487
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4385
4488
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4432,11 +4535,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4432
4535
|
setError(e instanceof Error ? e.message : String(e));
|
|
4433
4536
|
}
|
|
4434
4537
|
};
|
|
4435
|
-
return /* @__PURE__ */
|
|
4436
|
-
/* @__PURE__ */
|
|
4437
|
-
/* @__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: [
|
|
4438
4541
|
"Font",
|
|
4439
|
-
/* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsx24(
|
|
4440
4543
|
"input",
|
|
4441
4544
|
{
|
|
4442
4545
|
list: "pixerate-type-fonts",
|
|
@@ -4446,11 +4549,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4446
4549
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4447
4550
|
}
|
|
4448
4551
|
),
|
|
4449
|
-
/* @__PURE__ */
|
|
4552
|
+
/* @__PURE__ */ jsx24("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx24("option", { value: f }, f)) })
|
|
4450
4553
|
] }),
|
|
4451
|
-
/* @__PURE__ */
|
|
4554
|
+
/* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
|
|
4452
4555
|
"Size",
|
|
4453
|
-
/* @__PURE__ */
|
|
4556
|
+
/* @__PURE__ */ jsx24(
|
|
4454
4557
|
"input",
|
|
4455
4558
|
{
|
|
4456
4559
|
type: "number",
|
|
@@ -4463,14 +4566,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4463
4566
|
}
|
|
4464
4567
|
)
|
|
4465
4568
|
] }),
|
|
4466
|
-
/* @__PURE__ */
|
|
4467
|
-
/* @__PURE__ */
|
|
4468
|
-
/* @__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 }) })
|
|
4469
4572
|
] }),
|
|
4470
|
-
/* @__PURE__ */
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */
|
|
4473
|
-
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(
|
|
4474
4577
|
"button",
|
|
4475
4578
|
{
|
|
4476
4579
|
type: "button",
|
|
@@ -4482,19 +4585,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4482
4585
|
}
|
|
4483
4586
|
)
|
|
4484
4587
|
] }),
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
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: [
|
|
4487
4590
|
"Missing ",
|
|
4488
4591
|
missing.length === 1 ? "font" : "fonts",
|
|
4489
4592
|
": ",
|
|
4490
4593
|
missing.join(", ")
|
|
4491
4594
|
] }),
|
|
4492
|
-
error && /* @__PURE__ */
|
|
4595
|
+
error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
|
|
4493
4596
|
] });
|
|
4494
4597
|
};
|
|
4495
4598
|
|
|
4496
4599
|
// src/image-editor/ImageEditor.tsx
|
|
4497
|
-
import { Fragment as
|
|
4600
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4498
4601
|
var ImageEditor = ({
|
|
4499
4602
|
editor: externalEditor,
|
|
4500
4603
|
src,
|
|
@@ -4519,7 +4622,7 @@ var ImageEditor = ({
|
|
|
4519
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);
|
|
4520
4623
|
});
|
|
4521
4624
|
const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
|
|
4522
|
-
const [activeTab, setActiveTab] =
|
|
4625
|
+
const [activeTab, setActiveTab] = useState21("crop");
|
|
4523
4626
|
const rootRef = useRef11(null);
|
|
4524
4627
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4525
4628
|
const activeTabRef = useRef11(activeTab);
|
|
@@ -4529,14 +4632,14 @@ var ImageEditor = ({
|
|
|
4529
4632
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4530
4633
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4531
4634
|
};
|
|
4532
|
-
const [activeCropRatio, setActiveCropRatio] =
|
|
4533
|
-
const [selectionOptions, setSelectionOptions] =
|
|
4534
|
-
const [shapeOptions, setShapeOptions] =
|
|
4535
|
-
const [typeOptions, setTypeOptions] =
|
|
4536
|
-
const [typeSession, setTypeSession] =
|
|
4537
|
-
const [selectionError, setSelectionError] =
|
|
4538
|
-
const [paintError, setPaintError] =
|
|
4539
|
-
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);
|
|
4540
4643
|
const handleCanvasError = (source, message) => {
|
|
4541
4644
|
if (source === "paint") setPaintError(message);
|
|
4542
4645
|
else if (source === "select") setSelectionError(message);
|
|
@@ -4553,16 +4656,16 @@ var ImageEditor = ({
|
|
|
4553
4656
|
transformControllerRef.current = controller;
|
|
4554
4657
|
}
|
|
4555
4658
|
const transformTool = transformToolRef.current;
|
|
4556
|
-
const [, setTransformTick] =
|
|
4659
|
+
const [, setTransformTick] = useState21(0);
|
|
4557
4660
|
useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
4558
4661
|
useEffect17(() => () => transformToolRef.current?.cancel(), []);
|
|
4559
|
-
const [inpaintPrompt, setInpaintPrompt] =
|
|
4560
|
-
const [inpaintMaskMode, setInpaintMaskMode] =
|
|
4561
|
-
const [isRemovingBg, setIsRemovingBg] =
|
|
4562
|
-
const [isInpainting, setIsInpainting] =
|
|
4563
|
-
const [aiError, setAiError] =
|
|
4564
|
-
const [aiSuccess, setAiSuccess] =
|
|
4565
|
-
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");
|
|
4566
4669
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4567
4670
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4568
4671
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4625,10 +4728,10 @@ var ImageEditor = ({
|
|
|
4625
4728
|
setIsInpainting(false);
|
|
4626
4729
|
}
|
|
4627
4730
|
};
|
|
4628
|
-
const [activeColor, setActiveColor] =
|
|
4629
|
-
const [strokeWidth, setStrokeWidth] =
|
|
4630
|
-
const [fontSize, setFontSize] =
|
|
4631
|
-
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("");
|
|
4632
4735
|
useEffect17(() => {
|
|
4633
4736
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4634
4737
|
editor.setTool("crop");
|
|
@@ -4657,16 +4760,16 @@ var ImageEditor = ({
|
|
|
4657
4760
|
link.click();
|
|
4658
4761
|
}
|
|
4659
4762
|
};
|
|
4660
|
-
return /* @__PURE__ */
|
|
4763
|
+
return /* @__PURE__ */ jsxs23(
|
|
4661
4764
|
"div",
|
|
4662
4765
|
{
|
|
4663
4766
|
ref: rootRef,
|
|
4664
4767
|
className: `${imageEditorFrameClass} ${className}`,
|
|
4665
4768
|
style,
|
|
4666
4769
|
children: [
|
|
4667
|
-
/* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsxs23("div", { className: imageEditorHeaderClass, children: [
|
|
4771
|
+
/* @__PURE__ */ jsxs23("div", { role: "tablist", className: imageTabListClass, children: [
|
|
4772
|
+
/* @__PURE__ */ jsx25(
|
|
4670
4773
|
"button",
|
|
4671
4774
|
{
|
|
4672
4775
|
type: "button",
|
|
@@ -4681,7 +4784,7 @@ var ImageEditor = ({
|
|
|
4681
4784
|
children: "Transform & Crop"
|
|
4682
4785
|
}
|
|
4683
4786
|
),
|
|
4684
|
-
/* @__PURE__ */
|
|
4787
|
+
/* @__PURE__ */ jsx25(
|
|
4685
4788
|
"button",
|
|
4686
4789
|
{
|
|
4687
4790
|
type: "button",
|
|
@@ -4696,7 +4799,7 @@ var ImageEditor = ({
|
|
|
4696
4799
|
children: "Adjustments"
|
|
4697
4800
|
}
|
|
4698
4801
|
),
|
|
4699
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ jsx25(
|
|
4700
4803
|
"button",
|
|
4701
4804
|
{
|
|
4702
4805
|
type: "button",
|
|
@@ -4711,7 +4814,7 @@ var ImageEditor = ({
|
|
|
4711
4814
|
children: "Layers"
|
|
4712
4815
|
}
|
|
4713
4816
|
),
|
|
4714
|
-
/* @__PURE__ */
|
|
4817
|
+
/* @__PURE__ */ jsx25(
|
|
4715
4818
|
"button",
|
|
4716
4819
|
{
|
|
4717
4820
|
type: "button",
|
|
@@ -4726,7 +4829,7 @@ var ImageEditor = ({
|
|
|
4726
4829
|
children: "Paint"
|
|
4727
4830
|
}
|
|
4728
4831
|
),
|
|
4729
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ jsx25(
|
|
4730
4833
|
"button",
|
|
4731
4834
|
{
|
|
4732
4835
|
type: "button",
|
|
@@ -4741,7 +4844,7 @@ var ImageEditor = ({
|
|
|
4741
4844
|
children: "Select & Mask"
|
|
4742
4845
|
}
|
|
4743
4846
|
),
|
|
4744
|
-
/* @__PURE__ */
|
|
4847
|
+
/* @__PURE__ */ jsx25(
|
|
4745
4848
|
"button",
|
|
4746
4849
|
{
|
|
4747
4850
|
type: "button",
|
|
@@ -4756,7 +4859,7 @@ var ImageEditor = ({
|
|
|
4756
4859
|
children: "Annotations"
|
|
4757
4860
|
}
|
|
4758
4861
|
),
|
|
4759
|
-
/* @__PURE__ */
|
|
4862
|
+
/* @__PURE__ */ jsx25(
|
|
4760
4863
|
"button",
|
|
4761
4864
|
{
|
|
4762
4865
|
type: "button",
|
|
@@ -4771,7 +4874,7 @@ var ImageEditor = ({
|
|
|
4771
4874
|
children: "Depth Mask"
|
|
4772
4875
|
}
|
|
4773
4876
|
),
|
|
4774
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsxs23(
|
|
4775
4878
|
"button",
|
|
4776
4879
|
{
|
|
4777
4880
|
type: "button",
|
|
@@ -4784,14 +4887,14 @@ var ImageEditor = ({
|
|
|
4784
4887
|
"aria-selected": activeTab === "ai",
|
|
4785
4888
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
4786
4889
|
children: [
|
|
4787
|
-
/* @__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" }) }),
|
|
4788
4891
|
"AI Tools"
|
|
4789
4892
|
]
|
|
4790
4893
|
}
|
|
4791
4894
|
)
|
|
4792
4895
|
] }),
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4896
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
4897
|
+
/* @__PURE__ */ jsx25(
|
|
4795
4898
|
"button",
|
|
4796
4899
|
{
|
|
4797
4900
|
type: "button",
|
|
@@ -4802,7 +4905,7 @@ var ImageEditor = ({
|
|
|
4802
4905
|
children: "\u21A9"
|
|
4803
4906
|
}
|
|
4804
4907
|
),
|
|
4805
|
-
/* @__PURE__ */
|
|
4908
|
+
/* @__PURE__ */ jsx25(
|
|
4806
4909
|
"button",
|
|
4807
4910
|
{
|
|
4808
4911
|
type: "button",
|
|
@@ -4813,7 +4916,7 @@ var ImageEditor = ({
|
|
|
4813
4916
|
children: "\u21AA"
|
|
4814
4917
|
}
|
|
4815
4918
|
),
|
|
4816
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsx25(
|
|
4817
4920
|
"button",
|
|
4818
4921
|
{
|
|
4819
4922
|
type: "button",
|
|
@@ -4822,8 +4925,8 @@ var ImageEditor = ({
|
|
|
4822
4925
|
children: "Reset"
|
|
4823
4926
|
}
|
|
4824
4927
|
),
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4928
|
+
/* @__PURE__ */ jsx25("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4929
|
+
/* @__PURE__ */ jsx25(
|
|
4827
4930
|
"button",
|
|
4828
4931
|
{
|
|
4829
4932
|
type: "button",
|
|
@@ -4833,11 +4936,11 @@ var ImageEditor = ({
|
|
|
4833
4936
|
children: "-"
|
|
4834
4937
|
}
|
|
4835
4938
|
),
|
|
4836
|
-
/* @__PURE__ */
|
|
4939
|
+
/* @__PURE__ */ jsxs23("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
4837
4940
|
Math.round(state.zoom * 100),
|
|
4838
4941
|
"%"
|
|
4839
4942
|
] }),
|
|
4840
|
-
/* @__PURE__ */
|
|
4943
|
+
/* @__PURE__ */ jsx25(
|
|
4841
4944
|
"button",
|
|
4842
4945
|
{
|
|
4843
4946
|
type: "button",
|
|
@@ -4847,8 +4950,8 @@ var ImageEditor = ({
|
|
|
4847
4950
|
children: "+"
|
|
4848
4951
|
}
|
|
4849
4952
|
),
|
|
4850
|
-
/* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsx25("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
4954
|
+
/* @__PURE__ */ jsx25(
|
|
4852
4955
|
"button",
|
|
4853
4956
|
{
|
|
4854
4957
|
type: "button",
|
|
@@ -4859,7 +4962,7 @@ var ImageEditor = ({
|
|
|
4859
4962
|
children: "Hold Compare"
|
|
4860
4963
|
}
|
|
4861
4964
|
),
|
|
4862
|
-
/* @__PURE__ */
|
|
4965
|
+
/* @__PURE__ */ jsx25(
|
|
4863
4966
|
"button",
|
|
4864
4967
|
{
|
|
4865
4968
|
type: "button",
|
|
@@ -4870,10 +4973,10 @@ var ImageEditor = ({
|
|
|
4870
4973
|
)
|
|
4871
4974
|
] })
|
|
4872
4975
|
] }),
|
|
4873
|
-
transformTool.active && /* @__PURE__ */
|
|
4874
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
4876
|
-
/* @__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(
|
|
4877
4980
|
ImageEditorCanvas,
|
|
4878
4981
|
{
|
|
4879
4982
|
editor,
|
|
@@ -4897,11 +5000,11 @@ var ImageEditor = ({
|
|
|
4897
5000
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
4898
5001
|
}
|
|
4899
5002
|
),
|
|
4900
|
-
/* @__PURE__ */
|
|
4901
|
-
activeTab === "crop" && /* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4903
|
-
/* @__PURE__ */
|
|
4904
|
-
/* @__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(
|
|
4905
5008
|
"button",
|
|
4906
5009
|
{
|
|
4907
5010
|
type: "button",
|
|
@@ -4913,7 +5016,7 @@ var ImageEditor = ({
|
|
|
4913
5016
|
children: "Freeform"
|
|
4914
5017
|
}
|
|
4915
5018
|
),
|
|
4916
|
-
/* @__PURE__ */
|
|
5019
|
+
/* @__PURE__ */ jsx25(
|
|
4917
5020
|
"button",
|
|
4918
5021
|
{
|
|
4919
5022
|
type: "button",
|
|
@@ -4925,7 +5028,7 @@ var ImageEditor = ({
|
|
|
4925
5028
|
children: "1:1 Square"
|
|
4926
5029
|
}
|
|
4927
5030
|
),
|
|
4928
|
-
/* @__PURE__ */
|
|
5031
|
+
/* @__PURE__ */ jsx25(
|
|
4929
5032
|
"button",
|
|
4930
5033
|
{
|
|
4931
5034
|
type: "button",
|
|
@@ -4937,7 +5040,7 @@ var ImageEditor = ({
|
|
|
4937
5040
|
children: "4:3 Standard"
|
|
4938
5041
|
}
|
|
4939
5042
|
),
|
|
4940
|
-
/* @__PURE__ */
|
|
5043
|
+
/* @__PURE__ */ jsx25(
|
|
4941
5044
|
"button",
|
|
4942
5045
|
{
|
|
4943
5046
|
type: "button",
|
|
@@ -4949,7 +5052,7 @@ var ImageEditor = ({
|
|
|
4949
5052
|
children: "16:9 Wide"
|
|
4950
5053
|
}
|
|
4951
5054
|
),
|
|
4952
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ jsx25(
|
|
4953
5056
|
"button",
|
|
4954
5057
|
{
|
|
4955
5058
|
type: "button",
|
|
@@ -4961,7 +5064,7 @@ var ImageEditor = ({
|
|
|
4961
5064
|
children: "3:2 Photo"
|
|
4962
5065
|
}
|
|
4963
5066
|
),
|
|
4964
|
-
/* @__PURE__ */
|
|
5067
|
+
/* @__PURE__ */ jsx25(
|
|
4965
5068
|
"button",
|
|
4966
5069
|
{
|
|
4967
5070
|
type: "button",
|
|
@@ -4974,10 +5077,10 @@ var ImageEditor = ({
|
|
|
4974
5077
|
}
|
|
4975
5078
|
)
|
|
4976
5079
|
] }),
|
|
4977
|
-
/* @__PURE__ */
|
|
4978
|
-
/* @__PURE__ */
|
|
4979
|
-
/* @__PURE__ */
|
|
4980
|
-
/* @__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(
|
|
4981
5084
|
"button",
|
|
4982
5085
|
{
|
|
4983
5086
|
type: "button",
|
|
@@ -4986,7 +5089,7 @@ var ImageEditor = ({
|
|
|
4986
5089
|
children: "Rotate -90\xB0"
|
|
4987
5090
|
}
|
|
4988
5091
|
),
|
|
4989
|
-
/* @__PURE__ */
|
|
5092
|
+
/* @__PURE__ */ jsx25(
|
|
4990
5093
|
"button",
|
|
4991
5094
|
{
|
|
4992
5095
|
type: "button",
|
|
@@ -4995,7 +5098,7 @@ var ImageEditor = ({
|
|
|
4995
5098
|
children: "Rotate +90\xB0"
|
|
4996
5099
|
}
|
|
4997
5100
|
),
|
|
4998
|
-
/* @__PURE__ */
|
|
5101
|
+
/* @__PURE__ */ jsx25(
|
|
4999
5102
|
"button",
|
|
5000
5103
|
{
|
|
5001
5104
|
type: "button",
|
|
@@ -5004,7 +5107,7 @@ var ImageEditor = ({
|
|
|
5004
5107
|
children: "Flip Horizontal"
|
|
5005
5108
|
}
|
|
5006
5109
|
),
|
|
5007
|
-
/* @__PURE__ */
|
|
5110
|
+
/* @__PURE__ */ jsx25(
|
|
5008
5111
|
"button",
|
|
5009
5112
|
{
|
|
5010
5113
|
type: "button",
|
|
@@ -5015,10 +5118,10 @@ var ImageEditor = ({
|
|
|
5015
5118
|
)
|
|
5016
5119
|
] })
|
|
5017
5120
|
] }),
|
|
5018
|
-
activeTab === "adjust" && /* @__PURE__ */
|
|
5019
|
-
/* @__PURE__ */
|
|
5020
|
-
/* @__PURE__ */
|
|
5021
|
-
/* @__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(
|
|
5022
5125
|
"button",
|
|
5023
5126
|
{
|
|
5024
5127
|
type: "button",
|
|
@@ -5028,9 +5131,9 @@ var ImageEditor = ({
|
|
|
5028
5131
|
}
|
|
5029
5132
|
)
|
|
5030
5133
|
] }),
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5134
|
+
/* @__PURE__ */ jsx25(Histogram, { histogram: editor.histogram }),
|
|
5135
|
+
IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs23(React20.Fragment, { children: [
|
|
5136
|
+
/* @__PURE__ */ jsx25(
|
|
5034
5137
|
ControlSlider,
|
|
5035
5138
|
{
|
|
5036
5139
|
spec,
|
|
@@ -5039,14 +5142,14 @@ var ImageEditor = ({
|
|
|
5039
5142
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5040
5143
|
}
|
|
5041
5144
|
),
|
|
5042
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */
|
|
5145
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs23(
|
|
5043
5146
|
"div",
|
|
5044
5147
|
{
|
|
5045
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",
|
|
5046
5149
|
"data-testid": "image-editor-process-notice",
|
|
5047
5150
|
children: [
|
|
5048
|
-
/* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
5151
|
+
/* @__PURE__ */ jsx25("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5152
|
+
/* @__PURE__ */ jsx25(
|
|
5050
5153
|
"button",
|
|
5051
5154
|
{
|
|
5052
5155
|
type: "button",
|
|
@@ -5059,7 +5162,7 @@ var ImageEditor = ({
|
|
|
5059
5162
|
}
|
|
5060
5163
|
)
|
|
5061
5164
|
] }, spec.id)),
|
|
5062
|
-
/* @__PURE__ */
|
|
5165
|
+
/* @__PURE__ */ jsx25("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx25(
|
|
5063
5166
|
AdjustmentLayersPanel,
|
|
5064
5167
|
{
|
|
5065
5168
|
controller,
|
|
@@ -5068,9 +5171,9 @@ var ImageEditor = ({
|
|
|
5068
5171
|
}
|
|
5069
5172
|
) })
|
|
5070
5173
|
] }),
|
|
5071
|
-
activeTab === "layers" && /* @__PURE__ */
|
|
5072
|
-
/* @__PURE__ */
|
|
5073
|
-
/* @__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(
|
|
5074
5177
|
"button",
|
|
5075
5178
|
{
|
|
5076
5179
|
type: "button",
|
|
@@ -5081,15 +5184,15 @@ var ImageEditor = ({
|
|
|
5081
5184
|
children: "Free Transform"
|
|
5082
5185
|
}
|
|
5083
5186
|
),
|
|
5084
|
-
/* @__PURE__ */
|
|
5085
|
-
effectsShown && /* @__PURE__ */
|
|
5086
|
-
/* @__PURE__ */
|
|
5087
|
-
/* @__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 })
|
|
5088
5191
|
] }),
|
|
5089
|
-
activeTab === "paint" && /* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5091
|
-
/* @__PURE__ */
|
|
5092
|
-
/* @__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(
|
|
5093
5196
|
"button",
|
|
5094
5197
|
{
|
|
5095
5198
|
type: "button",
|
|
@@ -5100,50 +5203,50 @@ var ImageEditor = ({
|
|
|
5100
5203
|
children: "Free Transform"
|
|
5101
5204
|
}
|
|
5102
5205
|
),
|
|
5103
|
-
paintError && /* @__PURE__ */
|
|
5104
|
-
/* @__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 }) })
|
|
5105
5208
|
] }),
|
|
5106
|
-
activeTab === "annotate" && /* @__PURE__ */
|
|
5107
|
-
/* @__PURE__ */
|
|
5108
|
-
/* @__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(
|
|
5109
5212
|
"button",
|
|
5110
5213
|
{
|
|
5111
5214
|
type: "button",
|
|
5112
5215
|
"aria-pressed": state.activeTool === t,
|
|
5113
5216
|
onClick: () => editor.setTool(t),
|
|
5114
5217
|
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
5115
|
-
children: t
|
|
5218
|
+
children: imageToolLabel(t)
|
|
5116
5219
|
},
|
|
5117
5220
|
t
|
|
5118
5221
|
)) }),
|
|
5119
|
-
state.activeTool === "shape" && /* @__PURE__ */
|
|
5120
|
-
state.activeTool === "type" && /* @__PURE__ */
|
|
5121
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */
|
|
5122
|
-
shapeTypeError && /* @__PURE__ */
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5125
|
-
/* @__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(
|
|
5126
5229
|
"button",
|
|
5127
5230
|
{
|
|
5128
5231
|
type: "button",
|
|
5129
5232
|
onClick: () => editor.setTool(t),
|
|
5130
5233
|
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
5131
|
-
children: t
|
|
5234
|
+
children: t === "pen" ? "freehand" : t
|
|
5132
5235
|
},
|
|
5133
5236
|
t
|
|
5134
5237
|
)) }),
|
|
5135
|
-
/* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5137
|
-
/* @__PURE__ */
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5140
|
-
/* @__PURE__ */
|
|
5141
|
-
/* @__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: [
|
|
5142
5245
|
strokeWidth,
|
|
5143
5246
|
"px"
|
|
5144
5247
|
] })
|
|
5145
5248
|
] }),
|
|
5146
|
-
/* @__PURE__ */
|
|
5249
|
+
/* @__PURE__ */ jsx25(
|
|
5147
5250
|
"input",
|
|
5148
5251
|
{
|
|
5149
5252
|
type: "range",
|
|
@@ -5156,10 +5259,10 @@ var ImageEditor = ({
|
|
|
5156
5259
|
)
|
|
5157
5260
|
] })
|
|
5158
5261
|
] }),
|
|
5159
|
-
/* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5161
|
-
/* @__PURE__ */
|
|
5162
|
-
/* @__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(
|
|
5163
5266
|
"input",
|
|
5164
5267
|
{
|
|
5165
5268
|
type: "text",
|
|
@@ -5170,7 +5273,7 @@ var ImageEditor = ({
|
|
|
5170
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"
|
|
5171
5274
|
}
|
|
5172
5275
|
),
|
|
5173
|
-
/* @__PURE__ */
|
|
5276
|
+
/* @__PURE__ */ jsx25(
|
|
5174
5277
|
"button",
|
|
5175
5278
|
{
|
|
5176
5279
|
type: "button",
|
|
@@ -5180,14 +5283,14 @@ var ImageEditor = ({
|
|
|
5180
5283
|
}
|
|
5181
5284
|
)
|
|
5182
5285
|
] }),
|
|
5183
|
-
/* @__PURE__ */
|
|
5184
|
-
/* @__PURE__ */
|
|
5185
|
-
/* @__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: [
|
|
5186
5289
|
fontSize,
|
|
5187
5290
|
"px"
|
|
5188
5291
|
] })
|
|
5189
5292
|
] }),
|
|
5190
|
-
/* @__PURE__ */
|
|
5293
|
+
/* @__PURE__ */ jsx25(
|
|
5191
5294
|
"input",
|
|
5192
5295
|
{
|
|
5193
5296
|
type: "range",
|
|
@@ -5198,14 +5301,14 @@ var ImageEditor = ({
|
|
|
5198
5301
|
className: imageRangeClass
|
|
5199
5302
|
}
|
|
5200
5303
|
),
|
|
5201
|
-
/* @__PURE__ */
|
|
5202
|
-
/* @__PURE__ */
|
|
5203
|
-
/* @__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: [
|
|
5204
5307
|
"Layers (",
|
|
5205
5308
|
state.annotations.length,
|
|
5206
5309
|
")"
|
|
5207
5310
|
] }),
|
|
5208
|
-
state.selectedAnnotationId && /* @__PURE__ */
|
|
5311
|
+
state.selectedAnnotationId && /* @__PURE__ */ jsx25(
|
|
5209
5312
|
"button",
|
|
5210
5313
|
{
|
|
5211
5314
|
type: "button",
|
|
@@ -5214,7 +5317,7 @@ var ImageEditor = ({
|
|
|
5214
5317
|
children: "Delete Selected"
|
|
5215
5318
|
}
|
|
5216
5319
|
),
|
|
5217
|
-
state.annotations.length > 0 && /* @__PURE__ */
|
|
5320
|
+
state.annotations.length > 0 && /* @__PURE__ */ jsx25(
|
|
5218
5321
|
"button",
|
|
5219
5322
|
{
|
|
5220
5323
|
type: "button",
|
|
@@ -5225,10 +5328,10 @@ var ImageEditor = ({
|
|
|
5225
5328
|
)
|
|
5226
5329
|
] })
|
|
5227
5330
|
] }),
|
|
5228
|
-
activeTab === "depth" && /* @__PURE__ */
|
|
5229
|
-
/* @__PURE__ */
|
|
5230
|
-
/* @__PURE__ */
|
|
5231
|
-
/* @__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(
|
|
5232
5335
|
"button",
|
|
5233
5336
|
{
|
|
5234
5337
|
type: "button",
|
|
@@ -5238,8 +5341,8 @@ var ImageEditor = ({
|
|
|
5238
5341
|
}
|
|
5239
5342
|
)
|
|
5240
5343
|
] }),
|
|
5241
|
-
/* @__PURE__ */
|
|
5242
|
-
/* @__PURE__ */
|
|
5344
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5345
|
+
/* @__PURE__ */ jsx25(
|
|
5243
5346
|
"input",
|
|
5244
5347
|
{
|
|
5245
5348
|
type: "checkbox",
|
|
@@ -5248,12 +5351,12 @@ var ImageEditor = ({
|
|
|
5248
5351
|
className: "rounded accent-primary"
|
|
5249
5352
|
}
|
|
5250
5353
|
),
|
|
5251
|
-
/* @__PURE__ */
|
|
5354
|
+
/* @__PURE__ */ jsx25("span", { children: "Enable Depth / Alpha Mask" })
|
|
5252
5355
|
] }),
|
|
5253
|
-
state.depthMask.enabled && /* @__PURE__ */
|
|
5254
|
-
/* @__PURE__ */
|
|
5255
|
-
/* @__PURE__ */
|
|
5256
|
-
/* @__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(
|
|
5257
5360
|
"input",
|
|
5258
5361
|
{
|
|
5259
5362
|
type: "text",
|
|
@@ -5264,8 +5367,8 @@ var ImageEditor = ({
|
|
|
5264
5367
|
}
|
|
5265
5368
|
)
|
|
5266
5369
|
] }),
|
|
5267
|
-
/* @__PURE__ */
|
|
5268
|
-
/* @__PURE__ */
|
|
5370
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
|
|
5371
|
+
/* @__PURE__ */ jsx25(
|
|
5269
5372
|
"button",
|
|
5270
5373
|
{
|
|
5271
5374
|
type: "button",
|
|
@@ -5274,7 +5377,7 @@ var ImageEditor = ({
|
|
|
5274
5377
|
children: "Threshold Mode"
|
|
5275
5378
|
}
|
|
5276
5379
|
),
|
|
5277
|
-
/* @__PURE__ */
|
|
5380
|
+
/* @__PURE__ */ jsx25(
|
|
5278
5381
|
"button",
|
|
5279
5382
|
{
|
|
5280
5383
|
type: "button",
|
|
@@ -5284,12 +5387,12 @@ var ImageEditor = ({
|
|
|
5284
5387
|
}
|
|
5285
5388
|
)
|
|
5286
5389
|
] }),
|
|
5287
|
-
/* @__PURE__ */
|
|
5288
|
-
/* @__PURE__ */
|
|
5289
|
-
/* @__PURE__ */
|
|
5290
|
-
/* @__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] })
|
|
5291
5394
|
] }),
|
|
5292
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsx25(
|
|
5293
5396
|
"input",
|
|
5294
5397
|
{
|
|
5295
5398
|
type: "range",
|
|
@@ -5303,12 +5406,12 @@ var ImageEditor = ({
|
|
|
5303
5406
|
}
|
|
5304
5407
|
)
|
|
5305
5408
|
] }),
|
|
5306
|
-
/* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5308
|
-
/* @__PURE__ */
|
|
5309
|
-
/* @__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] })
|
|
5310
5413
|
] }),
|
|
5311
|
-
/* @__PURE__ */
|
|
5414
|
+
/* @__PURE__ */ jsx25(
|
|
5312
5415
|
"input",
|
|
5313
5416
|
{
|
|
5314
5417
|
type: "range",
|
|
@@ -5322,12 +5425,12 @@ var ImageEditor = ({
|
|
|
5322
5425
|
}
|
|
5323
5426
|
)
|
|
5324
5427
|
] }),
|
|
5325
|
-
/* @__PURE__ */
|
|
5326
|
-
/* @__PURE__ */
|
|
5327
|
-
/* @__PURE__ */
|
|
5328
|
-
/* @__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 })
|
|
5329
5432
|
] }),
|
|
5330
|
-
/* @__PURE__ */
|
|
5433
|
+
/* @__PURE__ */ jsx25(
|
|
5331
5434
|
"input",
|
|
5332
5435
|
{
|
|
5333
5436
|
type: "range",
|
|
@@ -5339,8 +5442,8 @@ var ImageEditor = ({
|
|
|
5339
5442
|
}
|
|
5340
5443
|
)
|
|
5341
5444
|
] }),
|
|
5342
|
-
/* @__PURE__ */
|
|
5343
|
-
/* @__PURE__ */
|
|
5445
|
+
/* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5446
|
+
/* @__PURE__ */ jsx25(
|
|
5344
5447
|
"input",
|
|
5345
5448
|
{
|
|
5346
5449
|
type: "checkbox",
|
|
@@ -5349,12 +5452,12 @@ var ImageEditor = ({
|
|
|
5349
5452
|
className: "rounded accent-primary"
|
|
5350
5453
|
}
|
|
5351
5454
|
),
|
|
5352
|
-
/* @__PURE__ */
|
|
5455
|
+
/* @__PURE__ */ jsx25("span", { children: "Invert Mask" })
|
|
5353
5456
|
] })
|
|
5354
5457
|
] })
|
|
5355
5458
|
] }),
|
|
5356
|
-
activeTab === "select" && /* @__PURE__ */
|
|
5357
|
-
/* @__PURE__ */
|
|
5459
|
+
activeTab === "select" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5460
|
+
/* @__PURE__ */ jsx25(
|
|
5358
5461
|
SelectionOptionsBar,
|
|
5359
5462
|
{
|
|
5360
5463
|
controller,
|
|
@@ -5365,9 +5468,9 @@ var ImageEditor = ({
|
|
|
5365
5468
|
selectionDisplay: state.selectionDisplay
|
|
5366
5469
|
}
|
|
5367
5470
|
),
|
|
5368
|
-
selectionError && /* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5370
|
-
/* @__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(
|
|
5371
5474
|
"button",
|
|
5372
5475
|
{
|
|
5373
5476
|
type: "button",
|
|
@@ -5378,7 +5481,7 @@ var ImageEditor = ({
|
|
|
5378
5481
|
children: "Transform Selection"
|
|
5379
5482
|
}
|
|
5380
5483
|
),
|
|
5381
|
-
/* @__PURE__ */
|
|
5484
|
+
/* @__PURE__ */ jsx25(
|
|
5382
5485
|
"button",
|
|
5383
5486
|
{
|
|
5384
5487
|
type: "button",
|
|
@@ -5390,14 +5493,14 @@ var ImageEditor = ({
|
|
|
5390
5493
|
}
|
|
5391
5494
|
)
|
|
5392
5495
|
] }),
|
|
5393
|
-
/* @__PURE__ */
|
|
5394
|
-
/* @__PURE__ */
|
|
5395
|
-
/* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsx25(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
5497
|
+
/* @__PURE__ */ jsx25(ChannelsPanel, { controller }),
|
|
5498
|
+
/* @__PURE__ */ jsx25(PathsPanel, { controller })
|
|
5396
5499
|
] }),
|
|
5397
|
-
activeTab === "ai" && /* @__PURE__ */
|
|
5398
|
-
/* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5400
|
-
/* @__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(
|
|
5401
5504
|
"select",
|
|
5402
5505
|
{
|
|
5403
5506
|
"aria-label": "AI result target",
|
|
@@ -5405,54 +5508,54 @@ var ImageEditor = ({
|
|
|
5405
5508
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5406
5509
|
className: imageSelectClass,
|
|
5407
5510
|
children: [
|
|
5408
|
-
/* @__PURE__ */
|
|
5409
|
-
/* @__PURE__ */
|
|
5410
|
-
/* @__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" })
|
|
5411
5514
|
]
|
|
5412
5515
|
}
|
|
5413
5516
|
)
|
|
5414
5517
|
] }),
|
|
5415
|
-
/* @__PURE__ */
|
|
5416
|
-
/* @__PURE__ */
|
|
5417
|
-
/* @__PURE__ */
|
|
5418
|
-
/* @__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" }) }),
|
|
5419
5522
|
"Background Removal"
|
|
5420
5523
|
] }),
|
|
5421
|
-
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..." })
|
|
5422
5525
|
] }),
|
|
5423
|
-
/* @__PURE__ */
|
|
5424
|
-
/* @__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(
|
|
5425
5528
|
"button",
|
|
5426
5529
|
{
|
|
5427
5530
|
type: "button",
|
|
5428
5531
|
onClick: handleRemoveBackground,
|
|
5429
5532
|
disabled: isRemovingBg || isInpainting,
|
|
5430
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",
|
|
5431
|
-
children: isRemovingBg ? /* @__PURE__ */
|
|
5432
|
-
/* @__PURE__ */
|
|
5534
|
+
children: isRemovingBg ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5535
|
+
/* @__PURE__ */ jsx25("div", { className: imageSpinnerClass }),
|
|
5433
5536
|
"Removing Background..."
|
|
5434
|
-
] }) : /* @__PURE__ */
|
|
5435
|
-
/* @__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" }) }),
|
|
5436
5539
|
"Remove Background"
|
|
5437
5540
|
] })
|
|
5438
5541
|
}
|
|
5439
5542
|
)
|
|
5440
5543
|
] }),
|
|
5441
|
-
/* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
/* @__PURE__ */
|
|
5444
|
-
/* @__PURE__ */
|
|
5445
|
-
/* @__PURE__ */
|
|
5446
|
-
/* @__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" })
|
|
5447
5550
|
] }),
|
|
5448
5551
|
"Generative Inpainting"
|
|
5449
5552
|
] }),
|
|
5450
|
-
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..." })
|
|
5451
5554
|
] }),
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
/* @__PURE__ */
|
|
5455
|
-
/* @__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(
|
|
5456
5559
|
"textarea",
|
|
5457
5560
|
{
|
|
5458
5561
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5464,10 +5567,10 @@ var ImageEditor = ({
|
|
|
5464
5567
|
}
|
|
5465
5568
|
)
|
|
5466
5569
|
] }),
|
|
5467
|
-
/* @__PURE__ */
|
|
5468
|
-
/* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5470
|
-
/* @__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(
|
|
5471
5574
|
"button",
|
|
5472
5575
|
{
|
|
5473
5576
|
type: "button",
|
|
@@ -5480,7 +5583,7 @@ var ImageEditor = ({
|
|
|
5480
5583
|
]
|
|
5481
5584
|
}
|
|
5482
5585
|
),
|
|
5483
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsxs23(
|
|
5484
5587
|
"button",
|
|
5485
5588
|
{
|
|
5486
5589
|
type: "button",
|
|
@@ -5495,25 +5598,25 @@ var ImageEditor = ({
|
|
|
5495
5598
|
)
|
|
5496
5599
|
] })
|
|
5497
5600
|
] }),
|
|
5498
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsx25(
|
|
5499
5602
|
"button",
|
|
5500
5603
|
{
|
|
5501
5604
|
type: "button",
|
|
5502
5605
|
onClick: handleInpaint,
|
|
5503
5606
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5504
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",
|
|
5505
|
-
children: isInpainting ? /* @__PURE__ */
|
|
5506
|
-
/* @__PURE__ */
|
|
5608
|
+
children: isInpainting ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5609
|
+
/* @__PURE__ */ jsx25("div", { className: imageSpinnerClass }),
|
|
5507
5610
|
"Generating Inpaint..."
|
|
5508
|
-
] }) : /* @__PURE__ */
|
|
5509
|
-
/* @__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" }) }),
|
|
5510
5613
|
"Apply Inpainting"
|
|
5511
5614
|
] })
|
|
5512
5615
|
}
|
|
5513
5616
|
)
|
|
5514
5617
|
] }),
|
|
5515
|
-
aiError && /* @__PURE__ */
|
|
5516
|
-
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 })
|
|
5517
5620
|
] })
|
|
5518
5621
|
] })
|
|
5519
5622
|
] })
|
|
@@ -5547,6 +5650,7 @@ export {
|
|
|
5547
5650
|
SelectAndMaskWorkspace,
|
|
5548
5651
|
ContentAwareFillWorkspace,
|
|
5549
5652
|
SelectionOptionsBar,
|
|
5653
|
+
MaskEdgeCheck,
|
|
5550
5654
|
RefineEdgePanel,
|
|
5551
5655
|
ChannelsPanel,
|
|
5552
5656
|
PathsPanel,
|