@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
|
@@ -51,6 +51,7 @@ __export(image_editor_exports, {
|
|
|
51
51
|
ImageSelect: () => ImageSelect,
|
|
52
52
|
LayerEffectsPanel: () => LayerEffectsPanel,
|
|
53
53
|
LayersPanel: () => LayersPanel,
|
|
54
|
+
MaskEdgeCheck: () => MaskEdgeCheck,
|
|
54
55
|
PaintGradientEditor: () => PaintGradientEditor,
|
|
55
56
|
PathsPanel: () => PathsPanel,
|
|
56
57
|
RefineEdgePanel: () => RefineEdgePanel,
|
|
@@ -234,8 +235,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
// src/image-editor/ImageEditor.tsx
|
|
237
|
-
var
|
|
238
|
-
var
|
|
238
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
239
|
+
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
239
240
|
|
|
240
241
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
241
242
|
var import_react5 = require("react");
|
|
@@ -470,6 +471,12 @@ var ImageEditorCanvas = ({
|
|
|
470
471
|
typeToolRef.current = new import_image_editor2.TypeToolGesture(controller, () => typeOptionsRef.current);
|
|
471
472
|
shapeTypeControllerRef.current = controller;
|
|
472
473
|
}
|
|
474
|
+
const pathGestureRef = (0, import_react5.useRef)(null);
|
|
475
|
+
const pathControllerRef = (0, import_react5.useRef)(controller);
|
|
476
|
+
if (!pathGestureRef.current || pathControllerRef.current !== controller) {
|
|
477
|
+
pathGestureRef.current = new import_image_editor2.PathEditGesture(controller);
|
|
478
|
+
pathControllerRef.current = controller;
|
|
479
|
+
}
|
|
473
480
|
const typeInputRef = (0, import_react5.useRef)(null);
|
|
474
481
|
const [typeSession, setTypeSessionState] = (0, import_react5.useState)(typeToolRef.current.session);
|
|
475
482
|
const setTypeSession = (session) => {
|
|
@@ -491,7 +498,10 @@ var ImageEditorCanvas = ({
|
|
|
491
498
|
if (!canvas || !container) return;
|
|
492
499
|
const viewport = (0, import_image_editor2.measureCanvasViewport)(container);
|
|
493
500
|
viewRef.current = { width: viewport.width, height: viewport.height };
|
|
494
|
-
|
|
501
|
+
const viewScale = (0, import_image_editor2.getViewportProjection)(controller.getState(), viewport.width, viewport.height, mode === "crop").scale;
|
|
502
|
+
transformTool.setView(viewScale);
|
|
503
|
+
pathGestureRef.current?.setView(viewScale);
|
|
504
|
+
const activeTool = controller.getState().activeTool;
|
|
495
505
|
await controller.render(canvas, {
|
|
496
506
|
viewportWidth: viewport.width,
|
|
497
507
|
viewportHeight: viewport.height,
|
|
@@ -507,7 +517,8 @@ var ImageEditorCanvas = ({
|
|
|
507
517
|
draftSelectionPath: selectionDraftRef.current,
|
|
508
518
|
brushCursor: mode === "paint" && brushCursorRef.current && controller.getState().activeTool !== "move" && !transformTool.active ? { ...brushCursorRef.current, diameter: controller.getState().paint.brush.size } : null,
|
|
509
519
|
freeTransform: transformTool.overlay(),
|
|
510
|
-
textEdit: typeToolRef.current?.session?.alive ? typeToolRef.current.session.overlay() : null
|
|
520
|
+
textEdit: typeToolRef.current?.session?.alive ? typeToolRef.current.session.overlay() : null,
|
|
521
|
+
pathEdit: mode === "annotate" && (0, import_image_editor2.isPathEditTool)(activeTool) ? pathGestureRef.current?.overlay(activeTool) : null
|
|
511
522
|
});
|
|
512
523
|
},
|
|
513
524
|
[controller, mode, fit, transformTool]
|
|
@@ -724,6 +735,21 @@ var ImageEditorCanvas = ({
|
|
|
724
735
|
window.addEventListener("keydown", onKey);
|
|
725
736
|
return () => window.removeEventListener("keydown", onKey);
|
|
726
737
|
});
|
|
738
|
+
(0, import_react5.useEffect)(() => {
|
|
739
|
+
if (mode !== "annotate" || typeof window === "undefined") return;
|
|
740
|
+
const onKey = (e) => {
|
|
741
|
+
const target = e.target;
|
|
742
|
+
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
743
|
+
if (!(0, import_image_editor2.isPathEditTool)(controller.getState().activeTool)) return;
|
|
744
|
+
if (pathGestureRef.current?.key(e.key)) {
|
|
745
|
+
e.preventDefault();
|
|
746
|
+
report("path", pathGestureRef.current.error);
|
|
747
|
+
void renderCanvas();
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
window.addEventListener("keydown", onKey);
|
|
751
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
752
|
+
});
|
|
727
753
|
(0, import_react5.useEffect)(() => {
|
|
728
754
|
if (mode !== "paint" || typeof window === "undefined") return;
|
|
729
755
|
const onKey = (e) => {
|
|
@@ -772,6 +798,13 @@ var ImageEditorCanvas = ({
|
|
|
772
798
|
}
|
|
773
799
|
return;
|
|
774
800
|
}
|
|
801
|
+
if (mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool)) {
|
|
802
|
+
const g = pathGestureRef.current;
|
|
803
|
+
g.down((0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false), state.activeTool, { shift: e.shiftKey, alt: e.altKey });
|
|
804
|
+
report("path", g.error);
|
|
805
|
+
void renderCanvas();
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
775
808
|
if (mode === "annotate" && (state.activeTool === "shape" || state.activeTool === "type")) {
|
|
776
809
|
const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
|
|
777
810
|
report(state.activeTool, null);
|
|
@@ -873,6 +906,16 @@ var ImageEditorCanvas = ({
|
|
|
873
906
|
}
|
|
874
907
|
return;
|
|
875
908
|
}
|
|
909
|
+
if (mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool)) {
|
|
910
|
+
const g = pathGestureRef.current;
|
|
911
|
+
const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
|
|
912
|
+
if (g.active) {
|
|
913
|
+
g.move(imgPt, { shift: e.shiftKey, alt: e.altKey });
|
|
914
|
+
if (g.error) report("path", g.error);
|
|
915
|
+
} else g.hover(imgPt);
|
|
916
|
+
void renderCanvas();
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
876
919
|
if (mode === "annotate" && state.activeTool === "shape") {
|
|
877
920
|
const g = shapeGestureRef.current;
|
|
878
921
|
if (g.active) {
|
|
@@ -984,6 +1027,11 @@ var ImageEditorCanvas = ({
|
|
|
984
1027
|
}
|
|
985
1028
|
return;
|
|
986
1029
|
}
|
|
1030
|
+
if (mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool)) {
|
|
1031
|
+
pathGestureRef.current.up();
|
|
1032
|
+
void renderCanvas();
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
987
1035
|
if (mode === "annotate" && state.activeTool === "shape") {
|
|
988
1036
|
shapeGestureRef.current.up();
|
|
989
1037
|
return;
|
|
@@ -1072,7 +1120,7 @@ var ImageEditorCanvas = ({
|
|
|
1072
1120
|
onPointerCancel: () => paintGestureRef.current?.cancel(),
|
|
1073
1121
|
"data-testid": "image-editor-canvas",
|
|
1074
1122
|
style: transformTool.active ? { width: "100%", height: "100%", cursor: transformCursor } : { width: "100%", height: "100%" },
|
|
1075
|
-
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" : ""}`
|
|
1123
|
+
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" && (0, import_image_editor2.isPathEditTool)(state.activeTool) ? "cursor-default" : ""}`
|
|
1076
1124
|
}
|
|
1077
1125
|
),
|
|
1078
1126
|
typeSession && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -5615,20 +5663,69 @@ var SelectionOptionsBar = ({
|
|
|
5615
5663
|
};
|
|
5616
5664
|
|
|
5617
5665
|
// src/image-editor/RefineEdgePanel.tsx
|
|
5618
|
-
var
|
|
5666
|
+
var import_react29 = require("react");
|
|
5667
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5668
|
+
|
|
5669
|
+
// src/image-editor/MaskEdgeCheck.tsx
|
|
5670
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
5619
5671
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5620
5672
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5621
|
-
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5622
5673
|
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";
|
|
5623
|
-
var
|
|
5624
|
-
const
|
|
5625
|
-
const [
|
|
5674
|
+
var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
|
|
5675
|
+
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5676
|
+
const [result, setResult] = (0, import_react28.useState)(null);
|
|
5626
5677
|
const [error, setError] = (0, import_react28.useState)(null);
|
|
5627
|
-
const
|
|
5628
|
-
const
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5678
|
+
const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
|
|
5679
|
+
const check = () => {
|
|
5680
|
+
setError(null);
|
|
5681
|
+
try {
|
|
5682
|
+
setResult({ report: controller.inspectMaskEdge(target, { layerId }), for: sel });
|
|
5683
|
+
} catch (err) {
|
|
5684
|
+
setResult(null);
|
|
5685
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
5686
|
+
}
|
|
5687
|
+
};
|
|
5688
|
+
const T = import_image_editor17.MASK_EDGE_THRESHOLDS;
|
|
5689
|
+
const rows = report ? [
|
|
5690
|
+
{ label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
|
|
5691
|
+
{ label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
|
|
5692
|
+
{ label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
|
|
5693
|
+
{ label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
|
|
5694
|
+
] : [];
|
|
5695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
5696
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: `${button4} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
|
|
5697
|
+
report && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5698
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
|
|
5699
|
+
rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react28.default.Fragment, { children: [
|
|
5700
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("dt", { className: "text-muted-foreground", children: r.label }),
|
|
5701
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
|
|
5702
|
+
] }, r.label)),
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
|
|
5704
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
|
|
5705
|
+
report.holes.count,
|
|
5706
|
+
" / ",
|
|
5707
|
+
report.islands.count
|
|
5708
|
+
] })
|
|
5709
|
+
] }),
|
|
5710
|
+
report.issues.length ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { children: s }, s)) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground", children: "The edge looks clean." })
|
|
5711
|
+
] }),
|
|
5712
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5713
|
+
] });
|
|
5714
|
+
};
|
|
5715
|
+
|
|
5716
|
+
// src/image-editor/RefineEdgePanel.tsx
|
|
5717
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5718
|
+
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
5719
|
+
var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
5720
|
+
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
5721
|
+
const [params, setParams] = (0, import_react29.useState)(DEFAULT_PARAMS);
|
|
5722
|
+
const [busy, setBusy] = (0, import_react29.useState)(false);
|
|
5723
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
5724
|
+
const [layerId, setLayerId] = (0, import_react29.useState)("");
|
|
5725
|
+
const [newKind, setNewKind] = (0, import_react29.useState)("hueSaturation");
|
|
5726
|
+
const [output, setOutput] = (0, import_react29.useState)("selection");
|
|
5727
|
+
const [decontaminate, setDecontaminate] = (0, import_react29.useState)(0);
|
|
5728
|
+
const [objectAware, setObjectAware] = (0, import_react29.useState)(false);
|
|
5632
5729
|
const canObject = Boolean(controller.segmentationProvider);
|
|
5633
5730
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
5634
5731
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -5648,17 +5745,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5648
5745
|
setBusy(false);
|
|
5649
5746
|
}
|
|
5650
5747
|
};
|
|
5651
|
-
return /* @__PURE__ */ (0,
|
|
5652
|
-
/* @__PURE__ */ (0,
|
|
5653
|
-
|
|
5654
|
-
/* @__PURE__ */ (0,
|
|
5655
|
-
/* @__PURE__ */ (0,
|
|
5656
|
-
/* @__PURE__ */ (0,
|
|
5748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
5749
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
5750
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: c.label }),
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5657
5754
|
params[c.id],
|
|
5658
5755
|
c.unit
|
|
5659
5756
|
] })
|
|
5660
5757
|
] }),
|
|
5661
|
-
/* @__PURE__ */ (0,
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5662
5759
|
"input",
|
|
5663
5760
|
{
|
|
5664
5761
|
type: "range",
|
|
@@ -5672,39 +5769,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5672
5769
|
}
|
|
5673
5770
|
)
|
|
5674
5771
|
] }, c.id)),
|
|
5675
|
-
/* @__PURE__ */ (0,
|
|
5676
|
-
/* @__PURE__ */ (0,
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5773
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
5677
5774
|
"Smart Radius"
|
|
5678
5775
|
] }),
|
|
5679
|
-
canObject && /* @__PURE__ */ (0,
|
|
5680
|
-
/* @__PURE__ */ (0,
|
|
5776
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
5681
5778
|
"Object aware (segmentation model)"
|
|
5682
5779
|
] }),
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5684
5781
|
"Output to",
|
|
5685
|
-
/* @__PURE__ */ (0,
|
|
5782
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5686
5783
|
"select",
|
|
5687
5784
|
{
|
|
5688
5785
|
"aria-label": "Refine output",
|
|
5689
5786
|
value: output,
|
|
5690
5787
|
onChange: (e) => setOutput(e.target.value),
|
|
5691
5788
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5692
|
-
children:
|
|
5789
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
5693
5790
|
}
|
|
5694
5791
|
)
|
|
5695
5792
|
] }),
|
|
5696
|
-
/* @__PURE__ */ (0,
|
|
5697
|
-
/* @__PURE__ */ (0,
|
|
5698
|
-
/* @__PURE__ */ (0,
|
|
5793
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5794
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5795
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
5699
5796
|
"Decontaminate colors",
|
|
5700
5797
|
toLayer ? "" : " (new layer or document outputs)"
|
|
5701
5798
|
] }),
|
|
5702
|
-
/* @__PURE__ */ (0,
|
|
5799
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5703
5800
|
decontaminate,
|
|
5704
5801
|
"%"
|
|
5705
5802
|
] })
|
|
5706
5803
|
] }),
|
|
5707
|
-
/* @__PURE__ */ (0,
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5708
5805
|
"input",
|
|
5709
5806
|
{
|
|
5710
5807
|
type: "range",
|
|
@@ -5719,63 +5816,64 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5719
5816
|
}
|
|
5720
5817
|
)
|
|
5721
5818
|
] }),
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5723
|
-
/* @__PURE__ */ (0,
|
|
5724
|
-
/* @__PURE__ */ (0,
|
|
5819
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1", children: [
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
5821
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
5725
5822
|
] }),
|
|
5726
|
-
error && /* @__PURE__ */ (0,
|
|
5727
|
-
/* @__PURE__ */ (0,
|
|
5728
|
-
/* @__PURE__ */ (0,
|
|
5729
|
-
|
|
5823
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MaskEdgeCheck, { controller, selection: sel }),
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
5826
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
5827
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5730
5828
|
"select",
|
|
5731
5829
|
{
|
|
5732
5830
|
"aria-label": "New masked layer kind",
|
|
5733
5831
|
value: newKind,
|
|
5734
5832
|
onChange: (e) => setNewKind(e.target.value),
|
|
5735
5833
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5736
|
-
children:
|
|
5834
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
5737
5835
|
}
|
|
5738
5836
|
),
|
|
5739
|
-
/* @__PURE__ */ (0,
|
|
5837
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5740
5838
|
"button",
|
|
5741
5839
|
{
|
|
5742
5840
|
type: "button",
|
|
5743
|
-
className:
|
|
5841
|
+
className: button5,
|
|
5744
5842
|
disabled: !sel,
|
|
5745
|
-
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0,
|
|
5843
|
+
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
|
|
5746
5844
|
children: "New Masked Layer"
|
|
5747
5845
|
}
|
|
5748
5846
|
)
|
|
5749
5847
|
] }),
|
|
5750
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
5751
|
-
/* @__PURE__ */ (0,
|
|
5848
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5849
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5752
5850
|
"select",
|
|
5753
5851
|
{
|
|
5754
5852
|
"aria-label": "Mask layer",
|
|
5755
5853
|
value: target.id,
|
|
5756
5854
|
onChange: (e) => setLayerId(e.target.value),
|
|
5757
5855
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5758
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
5759
|
-
l.name || (0,
|
|
5856
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("option", { value: l.id, children: [
|
|
5857
|
+
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
5760
5858
|
l.mask ? " (masked)" : ""
|
|
5761
5859
|
] }, l.id))
|
|
5762
5860
|
}
|
|
5763
5861
|
),
|
|
5764
|
-
/* @__PURE__ */ (0,
|
|
5765
|
-
/* @__PURE__ */ (0,
|
|
5766
|
-
/* @__PURE__ */ (0,
|
|
5767
|
-
/* @__PURE__ */ (0,
|
|
5862
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
5864
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
5865
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
5768
5866
|
] }),
|
|
5769
|
-
target.mask && /* @__PURE__ */ (0,
|
|
5770
|
-
/* @__PURE__ */ (0,
|
|
5771
|
-
/* @__PURE__ */ (0,
|
|
5772
|
-
/* @__PURE__ */ (0,
|
|
5773
|
-
/* @__PURE__ */ (0,
|
|
5867
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5870
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Density" }),
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5774
5872
|
Math.round((target.mask.density ?? 1) * 100),
|
|
5775
5873
|
"%"
|
|
5776
5874
|
] })
|
|
5777
5875
|
] }),
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5779
5877
|
"input",
|
|
5780
5878
|
{
|
|
5781
5879
|
type: "range",
|
|
@@ -5789,15 +5887,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5789
5887
|
}
|
|
5790
5888
|
)
|
|
5791
5889
|
] }),
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
5795
|
-
/* @__PURE__ */ (0,
|
|
5890
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5892
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Mask Feather" }),
|
|
5893
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
|
|
5796
5894
|
target.mask.feather ?? 0,
|
|
5797
5895
|
"px"
|
|
5798
5896
|
] })
|
|
5799
5897
|
] }),
|
|
5800
|
-
/* @__PURE__ */ (0,
|
|
5898
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5801
5899
|
"input",
|
|
5802
5900
|
{
|
|
5803
5901
|
type: "range",
|
|
@@ -5817,32 +5915,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5817
5915
|
};
|
|
5818
5916
|
|
|
5819
5917
|
// src/image-editor/ChannelsPanel.tsx
|
|
5820
|
-
var
|
|
5821
|
-
var
|
|
5822
|
-
var
|
|
5918
|
+
var import_react30 = require("react");
|
|
5919
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5920
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5823
5921
|
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"}`;
|
|
5824
5922
|
var ChannelThumb = ({ channel, size }) => {
|
|
5825
|
-
const ref = (0,
|
|
5826
|
-
(0,
|
|
5923
|
+
const ref = (0, import_react30.useRef)(null);
|
|
5924
|
+
(0, import_react30.useEffect)(() => {
|
|
5827
5925
|
const canvas = ref.current;
|
|
5828
5926
|
const ctx = canvas?.getContext("2d");
|
|
5829
5927
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
5830
|
-
const px = (0,
|
|
5928
|
+
const px = (0, import_image_editor19.channelThumbnail)(channel, 64);
|
|
5831
5929
|
canvas.width = px.width;
|
|
5832
5930
|
canvas.height = px.height;
|
|
5833
5931
|
const img = ctx.createImageData(px.width, px.height);
|
|
5834
5932
|
img.data.set(px.data);
|
|
5835
5933
|
ctx.putImageData(img, 0, 0);
|
|
5836
5934
|
}, [channel.mask]);
|
|
5837
|
-
return /* @__PURE__ */ (0,
|
|
5935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
5838
5936
|
};
|
|
5839
5937
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5840
|
-
const [, setTick] = (0,
|
|
5841
|
-
(0,
|
|
5842
|
-
const [activeId, setActiveId] = (0,
|
|
5843
|
-
const [renaming, setRenaming] = (0,
|
|
5844
|
-
const [error, setError] = (0,
|
|
5845
|
-
const fileInput = (0,
|
|
5938
|
+
const [, setTick] = (0, import_react30.useState)(0);
|
|
5939
|
+
(0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5940
|
+
const [activeId, setActiveId] = (0, import_react30.useState)(null);
|
|
5941
|
+
const [renaming, setRenaming] = (0, import_react30.useState)(null);
|
|
5942
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5943
|
+
const fileInput = (0, import_react30.useRef)(null);
|
|
5846
5944
|
const channels = controller.getChannels();
|
|
5847
5945
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5848
5946
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -5859,18 +5957,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5859
5957
|
if (!file) return;
|
|
5860
5958
|
setError(null);
|
|
5861
5959
|
try {
|
|
5862
|
-
setActiveId((await (0,
|
|
5960
|
+
setActiveId((await (0, import_image_editor19.openMaskFile)(controller, file)).id);
|
|
5863
5961
|
} catch (err) {
|
|
5864
5962
|
setError(err instanceof Error ? err.message : String(err));
|
|
5865
5963
|
}
|
|
5866
5964
|
};
|
|
5867
|
-
return /* @__PURE__ */ (0,
|
|
5868
|
-
/* @__PURE__ */ (0,
|
|
5869
|
-
/* @__PURE__ */ (0,
|
|
5870
|
-
/* @__PURE__ */ (0,
|
|
5965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5966
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5967
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
5968
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
|
|
5871
5969
|
] }),
|
|
5872
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5970
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
5971
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5874
5972
|
"li",
|
|
5875
5973
|
{
|
|
5876
5974
|
"data-testid": "channel-row",
|
|
@@ -5878,11 +5976,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5878
5976
|
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
5879
5977
|
onClick: (e) => {
|
|
5880
5978
|
setActiveId(c.id);
|
|
5881
|
-
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0,
|
|
5979
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") }));
|
|
5882
5980
|
},
|
|
5883
5981
|
onDoubleClick: () => setRenaming(c.id),
|
|
5884
5982
|
children: [
|
|
5885
|
-
/* @__PURE__ */ (0,
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5886
5984
|
"button",
|
|
5887
5985
|
{
|
|
5888
5986
|
type: "button",
|
|
@@ -5896,8 +5994,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5896
5994
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
5897
5995
|
}
|
|
5898
5996
|
),
|
|
5899
|
-
/* @__PURE__ */ (0,
|
|
5900
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
5997
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
5998
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5901
5999
|
"input",
|
|
5902
6000
|
{
|
|
5903
6001
|
autoFocus: true,
|
|
@@ -5914,16 +6012,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5914
6012
|
if (e.key === "Escape") setRenaming(null);
|
|
5915
6013
|
}
|
|
5916
6014
|
}
|
|
5917
|
-
) : /* @__PURE__ */ (0,
|
|
6015
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
5918
6016
|
]
|
|
5919
6017
|
},
|
|
5920
6018
|
c.id
|
|
5921
6019
|
)) }),
|
|
5922
|
-
/* @__PURE__ */ (0,
|
|
5923
|
-
/* @__PURE__ */ (0,
|
|
5924
|
-
/* @__PURE__ */ (0,
|
|
5925
|
-
/* @__PURE__ */ (0,
|
|
5926
|
-
/* @__PURE__ */ (0,
|
|
6020
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6021
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
|
|
6023
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
6024
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5927
6025
|
"button",
|
|
5928
6026
|
{
|
|
5929
6027
|
type: "button",
|
|
@@ -5936,24 +6034,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5936
6034
|
children: "Delete"
|
|
5937
6035
|
}
|
|
5938
6036
|
),
|
|
5939
|
-
/* @__PURE__ */ (0,
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
6037
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
6038
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5941
6039
|
"button",
|
|
5942
6040
|
{
|
|
5943
6041
|
type: "button",
|
|
5944
6042
|
className: btn2(),
|
|
5945
6043
|
disabled: !active && !hasSelection,
|
|
5946
6044
|
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
5947
|
-
onClick: () => attempt(() => (0,
|
|
6045
|
+
onClick: () => attempt(() => (0, import_image_editor19.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
5948
6046
|
children: "Export PNG"
|
|
5949
6047
|
}
|
|
5950
6048
|
),
|
|
5951
|
-
/* @__PURE__ */ (0,
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5952
6050
|
"input",
|
|
5953
6051
|
{
|
|
5954
6052
|
ref: fileInput,
|
|
5955
6053
|
type: "file",
|
|
5956
|
-
accept:
|
|
6054
|
+
accept: import_image_editor19.MASK_FILE_ACCEPT,
|
|
5957
6055
|
hidden: true,
|
|
5958
6056
|
"data-testid": "channel-import-input",
|
|
5959
6057
|
onChange: (e) => {
|
|
@@ -5963,22 +6061,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5963
6061
|
}
|
|
5964
6062
|
)
|
|
5965
6063
|
] }),
|
|
5966
|
-
error && /* @__PURE__ */ (0,
|
|
6064
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5967
6065
|
] });
|
|
5968
6066
|
};
|
|
5969
6067
|
|
|
5970
6068
|
// src/image-editor/PathsPanel.tsx
|
|
5971
|
-
var
|
|
5972
|
-
var
|
|
5973
|
-
var
|
|
6069
|
+
var import_react31 = require("react");
|
|
6070
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
6071
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5974
6072
|
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"}`;
|
|
5975
6073
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5976
|
-
const [, setTick] = (0,
|
|
5977
|
-
(0,
|
|
5978
|
-
const [renaming, setRenaming] = (0,
|
|
5979
|
-
const [color, setColor] = (0,
|
|
5980
|
-
const [width, setWidth] = (0,
|
|
5981
|
-
const [error, setError] = (0,
|
|
6074
|
+
const [, setTick] = (0, import_react31.useState)(0);
|
|
6075
|
+
(0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6076
|
+
const [renaming, setRenaming] = (0, import_react31.useState)(null);
|
|
6077
|
+
const [color, setColor] = (0, import_react31.useState)("#000000");
|
|
6078
|
+
const [width, setWidth] = (0, import_react31.useState)(2);
|
|
6079
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
5982
6080
|
const paths = controller.getPaths();
|
|
5983
6081
|
const activeId = controller.getState().activePathId ?? null;
|
|
5984
6082
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -5992,96 +6090,99 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5992
6090
|
setError(err instanceof Error ? err.message : String(err));
|
|
5993
6091
|
}
|
|
5994
6092
|
};
|
|
5995
|
-
return
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
"
|
|
6000
|
-
{
|
|
6001
|
-
"
|
|
6002
|
-
"aria-current": p.id === activeId ? "true" : void 0,
|
|
6003
|
-
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"}`,
|
|
6004
|
-
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6005
|
-
onDoubleClick: () => setRenaming(p.id),
|
|
6006
|
-
children: [
|
|
6007
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: (0, import_image_editor19.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6008
|
-
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6009
|
-
"input",
|
|
6010
|
-
{
|
|
6011
|
-
autoFocus: true,
|
|
6012
|
-
"aria-label": "Path name",
|
|
6013
|
-
defaultValue: p.work ? "" : p.name,
|
|
6014
|
-
placeholder: "Path name",
|
|
6015
|
-
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
6016
|
-
onClick: (e) => e.stopPropagation(),
|
|
6017
|
-
onBlur: (e) => {
|
|
6018
|
-
setRenaming(null);
|
|
6019
|
-
const name = e.currentTarget.value.trim();
|
|
6020
|
-
if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
|
|
6021
|
-
},
|
|
6022
|
-
onKeyDown: (e) => {
|
|
6023
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
6024
|
-
if (e.key === "Escape") setRenaming(null);
|
|
6025
|
-
}
|
|
6026
|
-
}
|
|
6027
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
6028
|
-
]
|
|
6029
|
-
},
|
|
6030
|
-
p.id
|
|
6031
|
-
)) }),
|
|
6032
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6033
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6034
|
-
"button",
|
|
6093
|
+
return (
|
|
6094
|
+
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
6095
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
|
|
6096
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
6097
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
6098
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6099
|
+
"li",
|
|
6035
6100
|
{
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
children:
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6101
|
+
"data-testid": "path-row",
|
|
6102
|
+
"aria-current": p.id === activeId ? "true" : void 0,
|
|
6103
|
+
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"}`,
|
|
6104
|
+
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6105
|
+
onDoubleClick: () => setRenaming(p.id),
|
|
6106
|
+
children: [
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6108
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6109
|
+
"input",
|
|
6110
|
+
{
|
|
6111
|
+
autoFocus: true,
|
|
6112
|
+
"aria-label": "Path name",
|
|
6113
|
+
defaultValue: p.work ? "" : p.name,
|
|
6114
|
+
placeholder: "Path name",
|
|
6115
|
+
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
6116
|
+
onClick: (e) => e.stopPropagation(),
|
|
6117
|
+
onBlur: (e) => {
|
|
6118
|
+
setRenaming(null);
|
|
6119
|
+
const name = e.currentTarget.value.trim();
|
|
6120
|
+
if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
|
|
6121
|
+
},
|
|
6122
|
+
onKeyDown: (e) => {
|
|
6123
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
6124
|
+
if (e.key === "Escape") setRenaming(null);
|
|
6125
|
+
}
|
|
6126
|
+
}
|
|
6127
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
6128
|
+
]
|
|
6129
|
+
},
|
|
6130
|
+
p.id
|
|
6131
|
+
)) }),
|
|
6132
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6133
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6134
|
+
"button",
|
|
6054
6135
|
{
|
|
6055
|
-
type: "
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
|
|
6062
|
-
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
6136
|
+
type: "button",
|
|
6137
|
+
className: btn3(),
|
|
6138
|
+
disabled: !active,
|
|
6139
|
+
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
6140
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") })),
|
|
6141
|
+
children: "Load as Selection"
|
|
6063
6142
|
}
|
|
6064
6143
|
),
|
|
6065
|
-
"
|
|
6144
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
6145
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
6146
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
6066
6147
|
] }),
|
|
6067
|
-
/* @__PURE__ */ (0,
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6148
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6149
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
|
|
6150
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
6151
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
6152
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6153
|
+
"input",
|
|
6154
|
+
{
|
|
6155
|
+
type: "number",
|
|
6156
|
+
min: 0.5,
|
|
6157
|
+
max: 250,
|
|
6158
|
+
step: 0.5,
|
|
6159
|
+
"aria-label": "Stroke width",
|
|
6160
|
+
value: width,
|
|
6161
|
+
onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
|
|
6162
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
6163
|
+
}
|
|
6164
|
+
),
|
|
6165
|
+
"px"
|
|
6166
|
+
] }),
|
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
6168
|
+
] }),
|
|
6169
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
6172
|
+
] }),
|
|
6173
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6174
|
+
] })
|
|
6175
|
+
);
|
|
6075
6176
|
};
|
|
6076
6177
|
|
|
6077
6178
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
6078
|
-
var
|
|
6079
|
-
var
|
|
6080
|
-
var
|
|
6179
|
+
var import_react32 = require("react");
|
|
6180
|
+
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
6181
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6081
6182
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
6082
6183
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
6083
|
-
const [, setTick] = (0,
|
|
6084
|
-
(0,
|
|
6184
|
+
const [, setTick] = (0, import_react32.useState)(0);
|
|
6185
|
+
(0, import_react32.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
6085
6186
|
const bar = tool.bar();
|
|
6086
6187
|
if (!tool.active || !bar) return null;
|
|
6087
6188
|
const warp = tool.warpBar();
|
|
@@ -6093,17 +6194,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6093
6194
|
const v = Number(raw);
|
|
6094
6195
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
6095
6196
|
};
|
|
6096
|
-
return /* @__PURE__ */ (0,
|
|
6097
|
-
/* @__PURE__ */ (0,
|
|
6098
|
-
/* @__PURE__ */ (0,
|
|
6099
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
6100
|
-
/* @__PURE__ */ (0,
|
|
6101
|
-
/* @__PURE__ */ (0,
|
|
6102
|
-
/* @__PURE__ */ (0,
|
|
6197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
6198
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
6199
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
|
|
6200
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
6201
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6202
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
6203
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
6103
6204
|
] }),
|
|
6104
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6106
|
-
/* @__PURE__ */ (0,
|
|
6205
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6206
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
6207
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6107
6208
|
"input",
|
|
6108
6209
|
{
|
|
6109
6210
|
type: "number",
|
|
@@ -6124,9 +6225,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6124
6225
|
},
|
|
6125
6226
|
`${k}:${warp[k]}`
|
|
6126
6227
|
),
|
|
6127
|
-
/* @__PURE__ */ (0,
|
|
6228
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
6128
6229
|
] }, k)),
|
|
6129
|
-
/* @__PURE__ */ (0,
|
|
6230
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6130
6231
|
"button",
|
|
6131
6232
|
{
|
|
6132
6233
|
type: "button",
|
|
@@ -6138,26 +6239,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6138
6239
|
children: "Vertical"
|
|
6139
6240
|
}
|
|
6140
6241
|
),
|
|
6141
|
-
/* @__PURE__ */ (0,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6242
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6243
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6144
6245
|
"select",
|
|
6145
6246
|
{
|
|
6146
6247
|
"aria-label": "Warp grid",
|
|
6147
|
-
value:
|
|
6248
|
+
value: import_image_editor21.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
6148
6249
|
onChange: (e) => {
|
|
6149
|
-
const g =
|
|
6250
|
+
const g = import_image_editor21.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
6150
6251
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
6151
6252
|
},
|
|
6152
6253
|
className: imageFieldClass,
|
|
6153
|
-
children:
|
|
6254
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
6154
6255
|
}
|
|
6155
6256
|
)
|
|
6156
6257
|
] })
|
|
6157
6258
|
] }),
|
|
6158
|
-
tool.mode !== "warp" &&
|
|
6159
|
-
/* @__PURE__ */ (0,
|
|
6160
|
-
/* @__PURE__ */ (0,
|
|
6259
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
6260
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
6261
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6161
6262
|
"input",
|
|
6162
6263
|
{
|
|
6163
6264
|
type: "number",
|
|
@@ -6177,8 +6278,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6177
6278
|
},
|
|
6178
6279
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
6179
6280
|
),
|
|
6180
|
-
/* @__PURE__ */ (0,
|
|
6181
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
6281
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
6282
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6182
6283
|
"button",
|
|
6183
6284
|
{
|
|
6184
6285
|
type: "button",
|
|
@@ -6193,33 +6294,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6193
6294
|
}
|
|
6194
6295
|
)
|
|
6195
6296
|
] }, f.id)),
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6297
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6298
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6199
6300
|
"select",
|
|
6200
6301
|
{
|
|
6201
6302
|
"aria-label": "Interpolation",
|
|
6202
6303
|
value: tool.interpolation,
|
|
6203
6304
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
6204
6305
|
className: imageFieldClass,
|
|
6205
|
-
children:
|
|
6306
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
6206
6307
|
}
|
|
6207
6308
|
)
|
|
6208
6309
|
] }),
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6211
|
-
tool.error && /* @__PURE__ */ (0,
|
|
6310
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
|
|
6311
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
6312
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
6212
6313
|
] });
|
|
6213
6314
|
};
|
|
6214
6315
|
|
|
6215
6316
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
6216
|
-
var
|
|
6217
|
-
var
|
|
6218
|
-
var
|
|
6317
|
+
var import_react33 = require("react");
|
|
6318
|
+
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
6319
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6219
6320
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
6220
|
-
const [, setTick] = (0,
|
|
6221
|
-
(0,
|
|
6222
|
-
const [error, setError] = (0,
|
|
6321
|
+
const [, setTick] = (0, import_react33.useState)(0);
|
|
6322
|
+
(0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6323
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
6223
6324
|
const active = controller.getActiveLayer();
|
|
6224
6325
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
6225
6326
|
const set = (change) => {
|
|
@@ -6227,28 +6328,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6227
6328
|
if (!shapeId) return;
|
|
6228
6329
|
try {
|
|
6229
6330
|
setError(null);
|
|
6230
|
-
(0,
|
|
6331
|
+
(0, import_image_editor22.applyShapeOptions)(controller, shapeId, change);
|
|
6231
6332
|
} catch (e) {
|
|
6232
6333
|
setError(e instanceof Error ? e.message : String(e));
|
|
6233
6334
|
}
|
|
6234
6335
|
};
|
|
6235
6336
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
6236
|
-
return /* @__PURE__ */ (0,
|
|
6237
|
-
/* @__PURE__ */ (0,
|
|
6238
|
-
/* @__PURE__ */ (0,
|
|
6239
|
-
/* @__PURE__ */ (0,
|
|
6240
|
-
/* @__PURE__ */ (0,
|
|
6337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
6338
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
6339
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6340
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6341
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
6241
6342
|
"Fill",
|
|
6242
|
-
/* @__PURE__ */ (0,
|
|
6343
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
6243
6344
|
] }),
|
|
6244
|
-
/* @__PURE__ */ (0,
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6345
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6346
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
6246
6347
|
"Stroke",
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
6248
6349
|
] }),
|
|
6249
|
-
/* @__PURE__ */ (0,
|
|
6350
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6250
6351
|
"Width",
|
|
6251
|
-
/* @__PURE__ */ (0,
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6252
6353
|
"input",
|
|
6253
6354
|
{
|
|
6254
6355
|
type: "number",
|
|
@@ -6262,52 +6363,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6262
6363
|
)
|
|
6263
6364
|
] })
|
|
6264
6365
|
] }),
|
|
6265
|
-
/* @__PURE__ */ (0,
|
|
6266
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6367
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6267
6368
|
"Radius",
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6369
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
|
|
6269
6370
|
] }),
|
|
6270
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
6371
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6271
6372
|
"Sides",
|
|
6272
|
-
/* @__PURE__ */ (0,
|
|
6373
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
6273
6374
|
] }),
|
|
6274
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6375
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
6376
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6276
6377
|
"Points",
|
|
6277
|
-
/* @__PURE__ */ (0,
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
6278
6379
|
] }),
|
|
6279
|
-
/* @__PURE__ */ (0,
|
|
6380
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6280
6381
|
"Inner",
|
|
6281
|
-
/* @__PURE__ */ (0,
|
|
6382
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
6282
6383
|
] })
|
|
6283
6384
|
] }),
|
|
6284
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
6285
|
-
/* @__PURE__ */ (0,
|
|
6385
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
6386
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6286
6387
|
"Weight",
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6388
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
|
|
6288
6389
|
] }),
|
|
6289
|
-
/* @__PURE__ */ (0,
|
|
6290
|
-
/* @__PURE__ */ (0,
|
|
6390
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6391
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
6291
6392
|
"Arrowhead"
|
|
6292
6393
|
] })
|
|
6293
6394
|
] })
|
|
6294
6395
|
] }),
|
|
6295
|
-
/* @__PURE__ */ (0,
|
|
6296
|
-
error && /* @__PURE__ */ (0,
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
|
|
6397
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6297
6398
|
] });
|
|
6298
6399
|
};
|
|
6299
6400
|
|
|
6300
6401
|
// src/image-editor/TypeOptionsBar.tsx
|
|
6301
|
-
var
|
|
6302
|
-
var
|
|
6303
|
-
var
|
|
6402
|
+
var import_react34 = require("react");
|
|
6403
|
+
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
6404
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6304
6405
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
6305
6406
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
6306
6407
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
6307
|
-
const [, setTick] = (0,
|
|
6308
|
-
(0,
|
|
6309
|
-
(0,
|
|
6310
|
-
const [error, setError] = (0,
|
|
6408
|
+
const [, setTick] = (0, import_react34.useState)(0);
|
|
6409
|
+
(0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6410
|
+
(0, import_react34.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
6411
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
6311
6412
|
const active = controller.getActiveLayer();
|
|
6312
6413
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
6313
6414
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -6360,11 +6461,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6360
6461
|
setError(e instanceof Error ? e.message : String(e));
|
|
6361
6462
|
}
|
|
6362
6463
|
};
|
|
6363
|
-
return /* @__PURE__ */ (0,
|
|
6364
|
-
/* @__PURE__ */ (0,
|
|
6365
|
-
/* @__PURE__ */ (0,
|
|
6464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6465
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6466
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6366
6467
|
"Font",
|
|
6367
|
-
/* @__PURE__ */ (0,
|
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6368
6469
|
"input",
|
|
6369
6470
|
{
|
|
6370
6471
|
list: "pixerate-type-fonts",
|
|
@@ -6374,11 +6475,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6374
6475
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
6375
6476
|
}
|
|
6376
6477
|
),
|
|
6377
|
-
/* @__PURE__ */ (0,
|
|
6478
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: f }, f)) })
|
|
6378
6479
|
] }),
|
|
6379
|
-
/* @__PURE__ */ (0,
|
|
6480
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6380
6481
|
"Size",
|
|
6381
|
-
/* @__PURE__ */ (0,
|
|
6482
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6382
6483
|
"input",
|
|
6383
6484
|
{
|
|
6384
6485
|
type: "number",
|
|
@@ -6391,14 +6492,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6391
6492
|
}
|
|
6392
6493
|
)
|
|
6393
6494
|
] }),
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
6395
|
-
/* @__PURE__ */ (0,
|
|
6396
|
-
/* @__PURE__ */ (0,
|
|
6495
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
|
|
6496
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6497
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
6397
6498
|
] }),
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6400
|
-
|
|
6401
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6499
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6500
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6501
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6502
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6402
6503
|
"button",
|
|
6403
6504
|
{
|
|
6404
6505
|
type: "button",
|
|
@@ -6410,19 +6511,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6410
6511
|
}
|
|
6411
6512
|
)
|
|
6412
6513
|
] }),
|
|
6413
|
-
/* @__PURE__ */ (0,
|
|
6414
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6514
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
6515
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
6415
6516
|
"Missing ",
|
|
6416
6517
|
missing.length === 1 ? "font" : "fonts",
|
|
6417
6518
|
": ",
|
|
6418
6519
|
missing.join(", ")
|
|
6419
6520
|
] }),
|
|
6420
|
-
error && /* @__PURE__ */ (0,
|
|
6521
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6421
6522
|
] });
|
|
6422
6523
|
};
|
|
6423
6524
|
|
|
6424
6525
|
// src/image-editor/ImageEditor.tsx
|
|
6425
|
-
var
|
|
6526
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6426
6527
|
var ImageEditor = ({
|
|
6427
6528
|
editor: externalEditor,
|
|
6428
6529
|
src,
|
|
@@ -6446,51 +6547,51 @@ var ImageEditor = ({
|
|
|
6446
6547
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
6447
6548
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
6448
6549
|
});
|
|
6449
|
-
const legacyProcess = (0,
|
|
6450
|
-
const [activeTab, setActiveTab] = (0,
|
|
6451
|
-
const rootRef = (0,
|
|
6550
|
+
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
6551
|
+
const [activeTab, setActiveTab] = (0, import_react35.useState)("crop");
|
|
6552
|
+
const rootRef = (0, import_react35.useRef)(null);
|
|
6452
6553
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
6453
|
-
const activeTabRef = (0,
|
|
6554
|
+
const activeTabRef = (0, import_react35.useRef)(activeTab);
|
|
6454
6555
|
activeTabRef.current = activeTab;
|
|
6455
6556
|
const openPanel = async (ref) => {
|
|
6456
6557
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
6457
6558
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
6458
6559
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
6459
6560
|
};
|
|
6460
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
6461
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
6462
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
6463
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
6464
|
-
const [typeSession, setTypeSession] = (0,
|
|
6465
|
-
const [selectionError, setSelectionError] = (0,
|
|
6466
|
-
const [paintError, setPaintError] = (0,
|
|
6467
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
6561
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react35.useState)(null);
|
|
6562
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react35.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6563
|
+
const [shapeOptions, setShapeOptions] = (0, import_react35.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6564
|
+
const [typeOptions, setTypeOptions] = (0, import_react35.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6565
|
+
const [typeSession, setTypeSession] = (0, import_react35.useState)(null);
|
|
6566
|
+
const [selectionError, setSelectionError] = (0, import_react35.useState)(null);
|
|
6567
|
+
const [paintError, setPaintError] = (0, import_react35.useState)(null);
|
|
6568
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react35.useState)(null);
|
|
6468
6569
|
const handleCanvasError = (source, message) => {
|
|
6469
6570
|
if (source === "paint") setPaintError(message);
|
|
6470
6571
|
else if (source === "select") setSelectionError(message);
|
|
6471
6572
|
else setShapeTypeError(message);
|
|
6472
6573
|
};
|
|
6473
6574
|
const finishTyping = () => setTypeSession(null);
|
|
6474
|
-
const transformToolRef = (0,
|
|
6475
|
-
const transformControllerRef = (0,
|
|
6575
|
+
const transformToolRef = (0, import_react35.useRef)(null);
|
|
6576
|
+
const transformControllerRef = (0, import_react35.useRef)(controller);
|
|
6476
6577
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
6477
6578
|
transformToolRef.current?.cancel();
|
|
6478
|
-
transformToolRef.current = new
|
|
6579
|
+
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
6479
6580
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
6480
6581
|
});
|
|
6481
6582
|
transformControllerRef.current = controller;
|
|
6482
6583
|
}
|
|
6483
6584
|
const transformTool = transformToolRef.current;
|
|
6484
|
-
const [, setTransformTick] = (0,
|
|
6485
|
-
(0,
|
|
6486
|
-
(0,
|
|
6487
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
6488
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
6489
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
6490
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
6491
|
-
const [aiError, setAiError] = (0,
|
|
6492
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
6493
|
-
const [aiTarget, setAiTarget] = (0,
|
|
6585
|
+
const [, setTransformTick] = (0, import_react35.useState)(0);
|
|
6586
|
+
(0, import_react35.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
6587
|
+
(0, import_react35.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
6588
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react35.useState)("");
|
|
6589
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react35.useState)("annotations");
|
|
6590
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react35.useState)(false);
|
|
6591
|
+
const [isInpainting, setIsInpainting] = (0, import_react35.useState)(false);
|
|
6592
|
+
const [aiError, setAiError] = (0, import_react35.useState)(null);
|
|
6593
|
+
const [aiSuccess, setAiSuccess] = (0, import_react35.useState)(null);
|
|
6594
|
+
const [aiTarget, setAiTarget] = (0, import_react35.useState)("auto");
|
|
6494
6595
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
6495
6596
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
6496
6597
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -6553,11 +6654,11 @@ var ImageEditor = ({
|
|
|
6553
6654
|
setIsInpainting(false);
|
|
6554
6655
|
}
|
|
6555
6656
|
};
|
|
6556
|
-
const [activeColor, setActiveColor] = (0,
|
|
6557
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
6558
|
-
const [fontSize, setFontSize] = (0,
|
|
6559
|
-
const [textInput, setTextInput] = (0,
|
|
6560
|
-
(0,
|
|
6657
|
+
const [activeColor, setActiveColor] = (0, import_react35.useState)("#ef4444");
|
|
6658
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react35.useState)(3);
|
|
6659
|
+
const [fontSize, setFontSize] = (0, import_react35.useState)(24);
|
|
6660
|
+
const [textInput, setTextInput] = (0, import_react35.useState)("");
|
|
6661
|
+
(0, import_react35.useEffect)(() => {
|
|
6561
6662
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
6562
6663
|
editor.setTool("crop");
|
|
6563
6664
|
}
|
|
@@ -6585,16 +6686,16 @@ var ImageEditor = ({
|
|
|
6585
6686
|
link.click();
|
|
6586
6687
|
}
|
|
6587
6688
|
};
|
|
6588
|
-
return /* @__PURE__ */ (0,
|
|
6689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6589
6690
|
"div",
|
|
6590
6691
|
{
|
|
6591
6692
|
ref: rootRef,
|
|
6592
6693
|
className: `${imageEditorFrameClass} ${className}`,
|
|
6593
6694
|
style,
|
|
6594
6695
|
children: [
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
/* @__PURE__ */ (0,
|
|
6696
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
6697
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6598
6699
|
"button",
|
|
6599
6700
|
{
|
|
6600
6701
|
type: "button",
|
|
@@ -6609,7 +6710,7 @@ var ImageEditor = ({
|
|
|
6609
6710
|
children: "Transform & Crop"
|
|
6610
6711
|
}
|
|
6611
6712
|
),
|
|
6612
|
-
/* @__PURE__ */ (0,
|
|
6713
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6613
6714
|
"button",
|
|
6614
6715
|
{
|
|
6615
6716
|
type: "button",
|
|
@@ -6624,7 +6725,7 @@ var ImageEditor = ({
|
|
|
6624
6725
|
children: "Adjustments"
|
|
6625
6726
|
}
|
|
6626
6727
|
),
|
|
6627
|
-
/* @__PURE__ */ (0,
|
|
6728
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6628
6729
|
"button",
|
|
6629
6730
|
{
|
|
6630
6731
|
type: "button",
|
|
@@ -6639,7 +6740,7 @@ var ImageEditor = ({
|
|
|
6639
6740
|
children: "Layers"
|
|
6640
6741
|
}
|
|
6641
6742
|
),
|
|
6642
|
-
/* @__PURE__ */ (0,
|
|
6743
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6643
6744
|
"button",
|
|
6644
6745
|
{
|
|
6645
6746
|
type: "button",
|
|
@@ -6654,7 +6755,7 @@ var ImageEditor = ({
|
|
|
6654
6755
|
children: "Paint"
|
|
6655
6756
|
}
|
|
6656
6757
|
),
|
|
6657
|
-
/* @__PURE__ */ (0,
|
|
6758
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6658
6759
|
"button",
|
|
6659
6760
|
{
|
|
6660
6761
|
type: "button",
|
|
@@ -6669,7 +6770,7 @@ var ImageEditor = ({
|
|
|
6669
6770
|
children: "Select & Mask"
|
|
6670
6771
|
}
|
|
6671
6772
|
),
|
|
6672
|
-
/* @__PURE__ */ (0,
|
|
6773
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6673
6774
|
"button",
|
|
6674
6775
|
{
|
|
6675
6776
|
type: "button",
|
|
@@ -6684,7 +6785,7 @@ var ImageEditor = ({
|
|
|
6684
6785
|
children: "Annotations"
|
|
6685
6786
|
}
|
|
6686
6787
|
),
|
|
6687
|
-
/* @__PURE__ */ (0,
|
|
6788
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6688
6789
|
"button",
|
|
6689
6790
|
{
|
|
6690
6791
|
type: "button",
|
|
@@ -6699,7 +6800,7 @@ var ImageEditor = ({
|
|
|
6699
6800
|
children: "Depth Mask"
|
|
6700
6801
|
}
|
|
6701
6802
|
),
|
|
6702
|
-
/* @__PURE__ */ (0,
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6703
6804
|
"button",
|
|
6704
6805
|
{
|
|
6705
6806
|
type: "button",
|
|
@@ -6712,14 +6813,14 @@ var ImageEditor = ({
|
|
|
6712
6813
|
"aria-selected": activeTab === "ai",
|
|
6713
6814
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
6714
6815
|
children: [
|
|
6715
|
-
/* @__PURE__ */ (0,
|
|
6816
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
6716
6817
|
"AI Tools"
|
|
6717
6818
|
]
|
|
6718
6819
|
}
|
|
6719
6820
|
)
|
|
6720
6821
|
] }),
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
6822
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
6823
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6723
6824
|
"button",
|
|
6724
6825
|
{
|
|
6725
6826
|
type: "button",
|
|
@@ -6730,7 +6831,7 @@ var ImageEditor = ({
|
|
|
6730
6831
|
children: "\u21A9"
|
|
6731
6832
|
}
|
|
6732
6833
|
),
|
|
6733
|
-
/* @__PURE__ */ (0,
|
|
6834
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6734
6835
|
"button",
|
|
6735
6836
|
{
|
|
6736
6837
|
type: "button",
|
|
@@ -6741,7 +6842,7 @@ var ImageEditor = ({
|
|
|
6741
6842
|
children: "\u21AA"
|
|
6742
6843
|
}
|
|
6743
6844
|
),
|
|
6744
|
-
/* @__PURE__ */ (0,
|
|
6845
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6745
6846
|
"button",
|
|
6746
6847
|
{
|
|
6747
6848
|
type: "button",
|
|
@@ -6750,8 +6851,8 @@ var ImageEditor = ({
|
|
|
6750
6851
|
children: "Reset"
|
|
6751
6852
|
}
|
|
6752
6853
|
),
|
|
6753
|
-
/* @__PURE__ */ (0,
|
|
6754
|
-
/* @__PURE__ */ (0,
|
|
6854
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6855
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6755
6856
|
"button",
|
|
6756
6857
|
{
|
|
6757
6858
|
type: "button",
|
|
@@ -6761,11 +6862,11 @@ var ImageEditor = ({
|
|
|
6761
6862
|
children: "-"
|
|
6762
6863
|
}
|
|
6763
6864
|
),
|
|
6764
|
-
/* @__PURE__ */ (0,
|
|
6865
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
6765
6866
|
Math.round(state.zoom * 100),
|
|
6766
6867
|
"%"
|
|
6767
6868
|
] }),
|
|
6768
|
-
/* @__PURE__ */ (0,
|
|
6869
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6769
6870
|
"button",
|
|
6770
6871
|
{
|
|
6771
6872
|
type: "button",
|
|
@@ -6775,8 +6876,8 @@ var ImageEditor = ({
|
|
|
6775
6876
|
children: "+"
|
|
6776
6877
|
}
|
|
6777
6878
|
),
|
|
6778
|
-
/* @__PURE__ */ (0,
|
|
6779
|
-
/* @__PURE__ */ (0,
|
|
6879
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6880
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6780
6881
|
"button",
|
|
6781
6882
|
{
|
|
6782
6883
|
type: "button",
|
|
@@ -6787,7 +6888,7 @@ var ImageEditor = ({
|
|
|
6787
6888
|
children: "Hold Compare"
|
|
6788
6889
|
}
|
|
6789
6890
|
),
|
|
6790
|
-
/* @__PURE__ */ (0,
|
|
6891
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6791
6892
|
"button",
|
|
6792
6893
|
{
|
|
6793
6894
|
type: "button",
|
|
@@ -6798,10 +6899,10 @@ var ImageEditor = ({
|
|
|
6798
6899
|
)
|
|
6799
6900
|
] })
|
|
6800
6901
|
] }),
|
|
6801
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
6802
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
6803
|
-
/* @__PURE__ */ (0,
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
6902
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
6903
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
6904
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
6905
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6805
6906
|
ImageEditorCanvas,
|
|
6806
6907
|
{
|
|
6807
6908
|
editor,
|
|
@@ -6825,11 +6926,11 @@ var ImageEditor = ({
|
|
|
6825
6926
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
6826
6927
|
}
|
|
6827
6928
|
),
|
|
6828
|
-
/* @__PURE__ */ (0,
|
|
6829
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
6830
|
-
/* @__PURE__ */ (0,
|
|
6831
|
-
/* @__PURE__ */ (0,
|
|
6832
|
-
/* @__PURE__ */ (0,
|
|
6929
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: imageSidebarClass, children: [
|
|
6930
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6931
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
6932
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
6933
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6833
6934
|
"button",
|
|
6834
6935
|
{
|
|
6835
6936
|
type: "button",
|
|
@@ -6841,7 +6942,7 @@ var ImageEditor = ({
|
|
|
6841
6942
|
children: "Freeform"
|
|
6842
6943
|
}
|
|
6843
6944
|
),
|
|
6844
|
-
/* @__PURE__ */ (0,
|
|
6945
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6845
6946
|
"button",
|
|
6846
6947
|
{
|
|
6847
6948
|
type: "button",
|
|
@@ -6853,7 +6954,7 @@ var ImageEditor = ({
|
|
|
6853
6954
|
children: "1:1 Square"
|
|
6854
6955
|
}
|
|
6855
6956
|
),
|
|
6856
|
-
/* @__PURE__ */ (0,
|
|
6957
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6857
6958
|
"button",
|
|
6858
6959
|
{
|
|
6859
6960
|
type: "button",
|
|
@@ -6865,7 +6966,7 @@ var ImageEditor = ({
|
|
|
6865
6966
|
children: "4:3 Standard"
|
|
6866
6967
|
}
|
|
6867
6968
|
),
|
|
6868
|
-
/* @__PURE__ */ (0,
|
|
6969
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6869
6970
|
"button",
|
|
6870
6971
|
{
|
|
6871
6972
|
type: "button",
|
|
@@ -6877,7 +6978,7 @@ var ImageEditor = ({
|
|
|
6877
6978
|
children: "16:9 Wide"
|
|
6878
6979
|
}
|
|
6879
6980
|
),
|
|
6880
|
-
/* @__PURE__ */ (0,
|
|
6981
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6881
6982
|
"button",
|
|
6882
6983
|
{
|
|
6883
6984
|
type: "button",
|
|
@@ -6889,7 +6990,7 @@ var ImageEditor = ({
|
|
|
6889
6990
|
children: "3:2 Photo"
|
|
6890
6991
|
}
|
|
6891
6992
|
),
|
|
6892
|
-
/* @__PURE__ */ (0,
|
|
6993
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6893
6994
|
"button",
|
|
6894
6995
|
{
|
|
6895
6996
|
type: "button",
|
|
@@ -6902,10 +7003,10 @@ var ImageEditor = ({
|
|
|
6902
7003
|
}
|
|
6903
7004
|
)
|
|
6904
7005
|
] }),
|
|
6905
|
-
/* @__PURE__ */ (0,
|
|
6906
|
-
/* @__PURE__ */ (0,
|
|
6907
|
-
/* @__PURE__ */ (0,
|
|
6908
|
-
/* @__PURE__ */ (0,
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
|
|
7007
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
7008
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
7009
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6909
7010
|
"button",
|
|
6910
7011
|
{
|
|
6911
7012
|
type: "button",
|
|
@@ -6914,7 +7015,7 @@ var ImageEditor = ({
|
|
|
6914
7015
|
children: "Rotate -90\xB0"
|
|
6915
7016
|
}
|
|
6916
7017
|
),
|
|
6917
|
-
/* @__PURE__ */ (0,
|
|
7018
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6918
7019
|
"button",
|
|
6919
7020
|
{
|
|
6920
7021
|
type: "button",
|
|
@@ -6923,7 +7024,7 @@ var ImageEditor = ({
|
|
|
6923
7024
|
children: "Rotate +90\xB0"
|
|
6924
7025
|
}
|
|
6925
7026
|
),
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
7027
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6927
7028
|
"button",
|
|
6928
7029
|
{
|
|
6929
7030
|
type: "button",
|
|
@@ -6932,7 +7033,7 @@ var ImageEditor = ({
|
|
|
6932
7033
|
children: "Flip Horizontal"
|
|
6933
7034
|
}
|
|
6934
7035
|
),
|
|
6935
|
-
/* @__PURE__ */ (0,
|
|
7036
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6936
7037
|
"button",
|
|
6937
7038
|
{
|
|
6938
7039
|
type: "button",
|
|
@@ -6943,10 +7044,10 @@ var ImageEditor = ({
|
|
|
6943
7044
|
)
|
|
6944
7045
|
] })
|
|
6945
7046
|
] }),
|
|
6946
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
6947
|
-
/* @__PURE__ */ (0,
|
|
6948
|
-
/* @__PURE__ */ (0,
|
|
6949
|
-
/* @__PURE__ */ (0,
|
|
7047
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7048
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7049
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
7050
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6950
7051
|
"button",
|
|
6951
7052
|
{
|
|
6952
7053
|
type: "button",
|
|
@@ -6956,25 +7057,25 @@ var ImageEditor = ({
|
|
|
6956
7057
|
}
|
|
6957
7058
|
)
|
|
6958
7059
|
] }),
|
|
6959
|
-
/* @__PURE__ */ (0,
|
|
6960
|
-
|
|
6961
|
-
/* @__PURE__ */ (0,
|
|
7060
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Histogram, { histogram: editor.histogram }),
|
|
7061
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react35.default.Fragment, { children: [
|
|
7062
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6962
7063
|
ControlSlider,
|
|
6963
7064
|
{
|
|
6964
7065
|
spec,
|
|
6965
|
-
value: (0,
|
|
7066
|
+
value: (0, import_image_editor24.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
6966
7067
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
6967
7068
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
6968
7069
|
}
|
|
6969
7070
|
),
|
|
6970
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
7071
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6971
7072
|
"div",
|
|
6972
7073
|
{
|
|
6973
7074
|
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",
|
|
6974
7075
|
"data-testid": "image-editor-process-notice",
|
|
6975
7076
|
children: [
|
|
6976
|
-
/* @__PURE__ */ (0,
|
|
6977
|
-
/* @__PURE__ */ (0,
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
7078
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6978
7079
|
"button",
|
|
6979
7080
|
{
|
|
6980
7081
|
type: "button",
|
|
@@ -6987,7 +7088,7 @@ var ImageEditor = ({
|
|
|
6987
7088
|
}
|
|
6988
7089
|
)
|
|
6989
7090
|
] }, spec.id)),
|
|
6990
|
-
/* @__PURE__ */ (0,
|
|
7091
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6991
7092
|
AdjustmentLayersPanel,
|
|
6992
7093
|
{
|
|
6993
7094
|
controller,
|
|
@@ -6996,9 +7097,9 @@ var ImageEditor = ({
|
|
|
6996
7097
|
}
|
|
6997
7098
|
) })
|
|
6998
7099
|
] }),
|
|
6999
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
7000
|
-
/* @__PURE__ */ (0,
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7100
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7101
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
7102
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7002
7103
|
"button",
|
|
7003
7104
|
{
|
|
7004
7105
|
type: "button",
|
|
@@ -7009,15 +7110,15 @@ var ImageEditor = ({
|
|
|
7009
7110
|
children: "Free Transform"
|
|
7010
7111
|
}
|
|
7011
7112
|
),
|
|
7012
|
-
/* @__PURE__ */ (0,
|
|
7013
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
7014
|
-
/* @__PURE__ */ (0,
|
|
7015
|
-
/* @__PURE__ */ (0,
|
|
7113
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayersPanel, { controller }),
|
|
7114
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
7115
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
7116
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColorProfilePanel, { controller })
|
|
7016
7117
|
] }),
|
|
7017
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
7018
|
-
/* @__PURE__ */ (0,
|
|
7019
|
-
/* @__PURE__ */ (0,
|
|
7020
|
-
/* @__PURE__ */ (0,
|
|
7118
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7119
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
7120
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BrushOptionsBar, { controller }),
|
|
7121
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7021
7122
|
"button",
|
|
7022
7123
|
{
|
|
7023
7124
|
type: "button",
|
|
@@ -7028,50 +7129,50 @@ var ImageEditor = ({
|
|
|
7028
7129
|
children: "Free Transform"
|
|
7029
7130
|
}
|
|
7030
7131
|
),
|
|
7031
|
-
paintError && /* @__PURE__ */ (0,
|
|
7032
|
-
/* @__PURE__ */ (0,
|
|
7132
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
7133
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayersPanel, { controller }) })
|
|
7033
7134
|
] }),
|
|
7034
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
7035
|
-
/* @__PURE__ */ (0,
|
|
7036
|
-
/* @__PURE__ */ (0,
|
|
7135
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7136
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
7137
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7037
7138
|
"button",
|
|
7038
7139
|
{
|
|
7039
7140
|
type: "button",
|
|
7040
7141
|
"aria-pressed": state.activeTool === t,
|
|
7041
7142
|
onClick: () => editor.setTool(t),
|
|
7042
7143
|
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"}`,
|
|
7043
|
-
children: t
|
|
7144
|
+
children: (0, import_image_editor24.imageToolLabel)(t)
|
|
7044
7145
|
},
|
|
7045
7146
|
t
|
|
7046
7147
|
)) }),
|
|
7047
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
7048
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
7049
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
7050
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
7051
|
-
/* @__PURE__ */ (0,
|
|
7052
|
-
/* @__PURE__ */ (0,
|
|
7053
|
-
/* @__PURE__ */ (0,
|
|
7148
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
7149
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
7150
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
|
|
7151
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
7152
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
|
|
7153
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
7154
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7054
7155
|
"button",
|
|
7055
7156
|
{
|
|
7056
7157
|
type: "button",
|
|
7057
7158
|
onClick: () => editor.setTool(t),
|
|
7058
7159
|
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"}`,
|
|
7059
|
-
children: t
|
|
7160
|
+
children: t === "pen" ? "freehand" : t
|
|
7060
7161
|
},
|
|
7061
7162
|
t
|
|
7062
7163
|
)) }),
|
|
7063
|
-
/* @__PURE__ */ (0,
|
|
7064
|
-
/* @__PURE__ */ (0,
|
|
7065
|
-
/* @__PURE__ */ (0,
|
|
7066
|
-
/* @__PURE__ */ (0,
|
|
7067
|
-
/* @__PURE__ */ (0,
|
|
7068
|
-
/* @__PURE__ */ (0,
|
|
7069
|
-
/* @__PURE__ */ (0,
|
|
7164
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
7165
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
7166
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
7167
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
7168
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
7169
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Width:" }),
|
|
7170
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
|
|
7070
7171
|
strokeWidth,
|
|
7071
7172
|
"px"
|
|
7072
7173
|
] })
|
|
7073
7174
|
] }),
|
|
7074
|
-
/* @__PURE__ */ (0,
|
|
7175
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7075
7176
|
"input",
|
|
7076
7177
|
{
|
|
7077
7178
|
type: "range",
|
|
@@ -7084,10 +7185,10 @@ var ImageEditor = ({
|
|
|
7084
7185
|
)
|
|
7085
7186
|
] })
|
|
7086
7187
|
] }),
|
|
7087
|
-
/* @__PURE__ */ (0,
|
|
7088
|
-
/* @__PURE__ */ (0,
|
|
7089
|
-
/* @__PURE__ */ (0,
|
|
7090
|
-
/* @__PURE__ */ (0,
|
|
7188
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
|
|
7189
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
7190
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-2", children: [
|
|
7191
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7091
7192
|
"input",
|
|
7092
7193
|
{
|
|
7093
7194
|
type: "text",
|
|
@@ -7098,7 +7199,7 @@ var ImageEditor = ({
|
|
|
7098
7199
|
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"
|
|
7099
7200
|
}
|
|
7100
7201
|
),
|
|
7101
|
-
/* @__PURE__ */ (0,
|
|
7202
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7102
7203
|
"button",
|
|
7103
7204
|
{
|
|
7104
7205
|
type: "button",
|
|
@@ -7108,14 +7209,14 @@ var ImageEditor = ({
|
|
|
7108
7209
|
}
|
|
7109
7210
|
)
|
|
7110
7211
|
] }),
|
|
7111
|
-
/* @__PURE__ */ (0,
|
|
7112
|
-
/* @__PURE__ */ (0,
|
|
7113
|
-
/* @__PURE__ */ (0,
|
|
7212
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
7213
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Font Size:" }),
|
|
7214
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
|
|
7114
7215
|
fontSize,
|
|
7115
7216
|
"px"
|
|
7116
7217
|
] })
|
|
7117
7218
|
] }),
|
|
7118
|
-
/* @__PURE__ */ (0,
|
|
7219
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7119
7220
|
"input",
|
|
7120
7221
|
{
|
|
7121
7222
|
type: "range",
|
|
@@ -7126,14 +7227,14 @@ var ImageEditor = ({
|
|
|
7126
7227
|
className: imageRangeClass
|
|
7127
7228
|
}
|
|
7128
7229
|
),
|
|
7129
|
-
/* @__PURE__ */ (0,
|
|
7130
|
-
/* @__PURE__ */ (0,
|
|
7131
|
-
/* @__PURE__ */ (0,
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
|
|
7231
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7232
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
7132
7233
|
"Layers (",
|
|
7133
7234
|
state.annotations.length,
|
|
7134
7235
|
")"
|
|
7135
7236
|
] }),
|
|
7136
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
7237
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7137
7238
|
"button",
|
|
7138
7239
|
{
|
|
7139
7240
|
type: "button",
|
|
@@ -7142,7 +7243,7 @@ var ImageEditor = ({
|
|
|
7142
7243
|
children: "Delete Selected"
|
|
7143
7244
|
}
|
|
7144
7245
|
),
|
|
7145
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
7246
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7146
7247
|
"button",
|
|
7147
7248
|
{
|
|
7148
7249
|
type: "button",
|
|
@@ -7153,10 +7254,10 @@ var ImageEditor = ({
|
|
|
7153
7254
|
)
|
|
7154
7255
|
] })
|
|
7155
7256
|
] }),
|
|
7156
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
7157
|
-
/* @__PURE__ */ (0,
|
|
7158
|
-
/* @__PURE__ */ (0,
|
|
7159
|
-
/* @__PURE__ */ (0,
|
|
7257
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7258
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7259
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
7260
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7160
7261
|
"button",
|
|
7161
7262
|
{
|
|
7162
7263
|
type: "button",
|
|
@@ -7166,8 +7267,8 @@ var ImageEditor = ({
|
|
|
7166
7267
|
}
|
|
7167
7268
|
)
|
|
7168
7269
|
] }),
|
|
7169
|
-
/* @__PURE__ */ (0,
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
7271
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7171
7272
|
"input",
|
|
7172
7273
|
{
|
|
7173
7274
|
type: "checkbox",
|
|
@@ -7176,12 +7277,12 @@ var ImageEditor = ({
|
|
|
7176
7277
|
className: "rounded accent-primary"
|
|
7177
7278
|
}
|
|
7178
7279
|
),
|
|
7179
|
-
/* @__PURE__ */ (0,
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
7180
7281
|
] }),
|
|
7181
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
7182
|
-
/* @__PURE__ */ (0,
|
|
7183
|
-
/* @__PURE__ */ (0,
|
|
7184
|
-
/* @__PURE__ */ (0,
|
|
7282
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7283
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
7284
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
7285
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7185
7286
|
"input",
|
|
7186
7287
|
{
|
|
7187
7288
|
type: "text",
|
|
@@ -7192,8 +7293,8 @@ var ImageEditor = ({
|
|
|
7192
7293
|
}
|
|
7193
7294
|
)
|
|
7194
7295
|
] }),
|
|
7195
|
-
/* @__PURE__ */ (0,
|
|
7196
|
-
/* @__PURE__ */ (0,
|
|
7296
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-2", children: [
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7197
7298
|
"button",
|
|
7198
7299
|
{
|
|
7199
7300
|
type: "button",
|
|
@@ -7202,7 +7303,7 @@ var ImageEditor = ({
|
|
|
7202
7303
|
children: "Threshold Mode"
|
|
7203
7304
|
}
|
|
7204
7305
|
),
|
|
7205
|
-
/* @__PURE__ */ (0,
|
|
7306
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7206
7307
|
"button",
|
|
7207
7308
|
{
|
|
7208
7309
|
type: "button",
|
|
@@ -7212,12 +7313,12 @@ var ImageEditor = ({
|
|
|
7212
7313
|
}
|
|
7213
7314
|
)
|
|
7214
7315
|
] }),
|
|
7215
|
-
/* @__PURE__ */ (0,
|
|
7216
|
-
/* @__PURE__ */ (0,
|
|
7217
|
-
/* @__PURE__ */ (0,
|
|
7218
|
-
/* @__PURE__ */ (0,
|
|
7316
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
7317
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7318
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
7319
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
7219
7320
|
] }),
|
|
7220
|
-
/* @__PURE__ */ (0,
|
|
7321
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7221
7322
|
"input",
|
|
7222
7323
|
{
|
|
7223
7324
|
type: "range",
|
|
@@ -7231,12 +7332,12 @@ var ImageEditor = ({
|
|
|
7231
7332
|
}
|
|
7232
7333
|
)
|
|
7233
7334
|
] }),
|
|
7234
|
-
/* @__PURE__ */ (0,
|
|
7235
|
-
/* @__PURE__ */ (0,
|
|
7236
|
-
/* @__PURE__ */ (0,
|
|
7237
|
-
/* @__PURE__ */ (0,
|
|
7335
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
7336
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7337
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
7338
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
7238
7339
|
] }),
|
|
7239
|
-
/* @__PURE__ */ (0,
|
|
7340
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7240
7341
|
"input",
|
|
7241
7342
|
{
|
|
7242
7343
|
type: "range",
|
|
@@ -7250,12 +7351,12 @@ var ImageEditor = ({
|
|
|
7250
7351
|
}
|
|
7251
7352
|
)
|
|
7252
7353
|
] }),
|
|
7253
|
-
/* @__PURE__ */ (0,
|
|
7254
|
-
/* @__PURE__ */ (0,
|
|
7255
|
-
/* @__PURE__ */ (0,
|
|
7256
|
-
/* @__PURE__ */ (0,
|
|
7354
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
7355
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Softness:" }),
|
|
7357
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
7257
7358
|
] }),
|
|
7258
|
-
/* @__PURE__ */ (0,
|
|
7359
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7259
7360
|
"input",
|
|
7260
7361
|
{
|
|
7261
7362
|
type: "range",
|
|
@@ -7267,8 +7368,8 @@ var ImageEditor = ({
|
|
|
7267
7368
|
}
|
|
7268
7369
|
)
|
|
7269
7370
|
] }),
|
|
7270
|
-
/* @__PURE__ */ (0,
|
|
7271
|
-
/* @__PURE__ */ (0,
|
|
7371
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
7372
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7272
7373
|
"input",
|
|
7273
7374
|
{
|
|
7274
7375
|
type: "checkbox",
|
|
@@ -7277,12 +7378,12 @@ var ImageEditor = ({
|
|
|
7277
7378
|
className: "rounded accent-primary"
|
|
7278
7379
|
}
|
|
7279
7380
|
),
|
|
7280
|
-
/* @__PURE__ */ (0,
|
|
7381
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Invert Mask" })
|
|
7281
7382
|
] })
|
|
7282
7383
|
] })
|
|
7283
7384
|
] }),
|
|
7284
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
7285
|
-
/* @__PURE__ */ (0,
|
|
7385
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7386
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7286
7387
|
SelectionOptionsBar,
|
|
7287
7388
|
{
|
|
7288
7389
|
controller,
|
|
@@ -7293,9 +7394,9 @@ var ImageEditor = ({
|
|
|
7293
7394
|
selectionDisplay: state.selectionDisplay
|
|
7294
7395
|
}
|
|
7295
7396
|
),
|
|
7296
|
-
selectionError && /* @__PURE__ */ (0,
|
|
7297
|
-
/* @__PURE__ */ (0,
|
|
7298
|
-
/* @__PURE__ */ (0,
|
|
7397
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
7398
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1", children: [
|
|
7399
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7299
7400
|
"button",
|
|
7300
7401
|
{
|
|
7301
7402
|
type: "button",
|
|
@@ -7306,7 +7407,7 @@ var ImageEditor = ({
|
|
|
7306
7407
|
children: "Transform Selection"
|
|
7307
7408
|
}
|
|
7308
7409
|
),
|
|
7309
|
-
/* @__PURE__ */ (0,
|
|
7410
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7310
7411
|
"button",
|
|
7311
7412
|
{
|
|
7312
7413
|
type: "button",
|
|
@@ -7318,14 +7419,14 @@ var ImageEditor = ({
|
|
|
7318
7419
|
}
|
|
7319
7420
|
)
|
|
7320
7421
|
] }),
|
|
7321
|
-
/* @__PURE__ */ (0,
|
|
7322
|
-
/* @__PURE__ */ (0,
|
|
7323
|
-
/* @__PURE__ */ (0,
|
|
7422
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
7423
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChannelsPanel, { controller }),
|
|
7424
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PathsPanel, { controller })
|
|
7324
7425
|
] }),
|
|
7325
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
7326
|
-
/* @__PURE__ */ (0,
|
|
7327
|
-
/* @__PURE__ */ (0,
|
|
7328
|
-
/* @__PURE__ */ (0,
|
|
7426
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7427
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
7428
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Results go to" }),
|
|
7429
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7329
7430
|
"select",
|
|
7330
7431
|
{
|
|
7331
7432
|
"aria-label": "AI result target",
|
|
@@ -7333,54 +7434,54 @@ var ImageEditor = ({
|
|
|
7333
7434
|
onChange: (e) => setAiTarget(e.target.value),
|
|
7334
7435
|
className: imageSelectClass,
|
|
7335
7436
|
children: [
|
|
7336
|
-
/* @__PURE__ */ (0,
|
|
7337
|
-
/* @__PURE__ */ (0,
|
|
7338
|
-
/* @__PURE__ */ (0,
|
|
7437
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
7438
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
7439
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "replace", children: "Replace image" })
|
|
7339
7440
|
]
|
|
7340
7441
|
}
|
|
7341
7442
|
)
|
|
7342
7443
|
] }),
|
|
7343
|
-
/* @__PURE__ */ (0,
|
|
7344
|
-
/* @__PURE__ */ (0,
|
|
7345
|
-
/* @__PURE__ */ (0,
|
|
7346
|
-
/* @__PURE__ */ (0,
|
|
7444
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7445
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7446
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7447
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
|
|
7347
7448
|
"Background Removal"
|
|
7348
7449
|
] }),
|
|
7349
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
7450
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
|
|
7350
7451
|
] }),
|
|
7351
|
-
/* @__PURE__ */ (0,
|
|
7352
|
-
/* @__PURE__ */ (0,
|
|
7452
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
7453
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7353
7454
|
"button",
|
|
7354
7455
|
{
|
|
7355
7456
|
type: "button",
|
|
7356
7457
|
onClick: handleRemoveBackground,
|
|
7357
7458
|
disabled: isRemovingBg || isInpainting,
|
|
7358
7459
|
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",
|
|
7359
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
7360
|
-
/* @__PURE__ */ (0,
|
|
7460
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7461
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSpinnerClass }),
|
|
7361
7462
|
"Removing Background..."
|
|
7362
|
-
] }) : /* @__PURE__ */ (0,
|
|
7363
|
-
/* @__PURE__ */ (0,
|
|
7463
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7464
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
7364
7465
|
"Remove Background"
|
|
7365
7466
|
] })
|
|
7366
7467
|
}
|
|
7367
7468
|
)
|
|
7368
7469
|
] }),
|
|
7369
|
-
/* @__PURE__ */ (0,
|
|
7370
|
-
/* @__PURE__ */ (0,
|
|
7371
|
-
/* @__PURE__ */ (0,
|
|
7372
|
-
/* @__PURE__ */ (0,
|
|
7373
|
-
/* @__PURE__ */ (0,
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7470
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7471
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7472
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7473
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
7474
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
|
|
7475
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "m14 7 3 3" })
|
|
7375
7476
|
] }),
|
|
7376
7477
|
"Generative Inpainting"
|
|
7377
7478
|
] }),
|
|
7378
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7479
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
|
|
7379
7480
|
] }),
|
|
7380
|
-
/* @__PURE__ */ (0,
|
|
7381
|
-
/* @__PURE__ */ (0,
|
|
7382
|
-
/* @__PURE__ */ (0,
|
|
7383
|
-
/* @__PURE__ */ (0,
|
|
7481
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
7482
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7483
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7484
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7384
7485
|
"textarea",
|
|
7385
7486
|
{
|
|
7386
7487
|
id: "ai-inpaint-prompt-react",
|
|
@@ -7392,10 +7493,10 @@ var ImageEditor = ({
|
|
|
7392
7493
|
}
|
|
7393
7494
|
)
|
|
7394
7495
|
] }),
|
|
7395
|
-
/* @__PURE__ */ (0,
|
|
7396
|
-
/* @__PURE__ */ (0,
|
|
7397
|
-
/* @__PURE__ */ (0,
|
|
7398
|
-
/* @__PURE__ */ (0,
|
|
7496
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7497
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7498
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7499
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7399
7500
|
"button",
|
|
7400
7501
|
{
|
|
7401
7502
|
type: "button",
|
|
@@ -7408,7 +7509,7 @@ var ImageEditor = ({
|
|
|
7408
7509
|
]
|
|
7409
7510
|
}
|
|
7410
7511
|
),
|
|
7411
|
-
/* @__PURE__ */ (0,
|
|
7512
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7412
7513
|
"button",
|
|
7413
7514
|
{
|
|
7414
7515
|
type: "button",
|
|
@@ -7423,25 +7524,25 @@ var ImageEditor = ({
|
|
|
7423
7524
|
)
|
|
7424
7525
|
] })
|
|
7425
7526
|
] }),
|
|
7426
|
-
/* @__PURE__ */ (0,
|
|
7527
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7427
7528
|
"button",
|
|
7428
7529
|
{
|
|
7429
7530
|
type: "button",
|
|
7430
7531
|
onClick: handleInpaint,
|
|
7431
7532
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
7432
7533
|
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",
|
|
7433
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
7434
|
-
/* @__PURE__ */ (0,
|
|
7534
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7535
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSpinnerClass }),
|
|
7435
7536
|
"Generating Inpaint..."
|
|
7436
|
-
] }) : /* @__PURE__ */ (0,
|
|
7437
|
-
/* @__PURE__ */ (0,
|
|
7537
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7538
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
7438
7539
|
"Apply Inpainting"
|
|
7439
7540
|
] })
|
|
7440
7541
|
}
|
|
7441
7542
|
)
|
|
7442
7543
|
] }),
|
|
7443
|
-
aiError && /* @__PURE__ */ (0,
|
|
7444
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7544
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
7545
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
7445
7546
|
] })
|
|
7446
7547
|
] })
|
|
7447
7548
|
] })
|
|
@@ -7471,6 +7572,7 @@ var ImageEditor = ({
|
|
|
7471
7572
|
ImageSelect,
|
|
7472
7573
|
LayerEffectsPanel,
|
|
7473
7574
|
LayersPanel,
|
|
7575
|
+
MaskEdgeCheck,
|
|
7474
7576
|
PaintGradientEditor,
|
|
7475
7577
|
PathsPanel,
|
|
7476
7578
|
RefineEdgePanel,
|