@pixerate/editor-react 0.119.0 → 0.122.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-H2EO7O3J.js → chunk-VR3JON4V.js} +638 -309
- package/dist/image-editor/ChannelsPanel.d.cts +15 -0
- package/dist/image-editor/ChannelsPanel.d.ts +15 -0
- package/dist/image-editor/LayersPanel.d.cts +2 -1
- package/dist/image-editor/LayersPanel.d.ts +2 -1
- package/dist/image-editor/SelectionOptionsBar.d.cts +8 -4
- package/dist/image-editor/SelectionOptionsBar.d.ts +8 -4
- package/dist/image-editor/index.cjs +641 -317
- 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 +1161 -837
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -33,6 +33,7 @@ var image_editor_exports = {};
|
|
|
33
33
|
__export(image_editor_exports, {
|
|
34
34
|
AdjustmentLayersPanel: () => AdjustmentLayersPanel,
|
|
35
35
|
BrushOptionsBar: () => BrushOptionsBar,
|
|
36
|
+
ChannelsPanel: () => ChannelsPanel,
|
|
36
37
|
ColorProfilePanel: () => ColorProfilePanel,
|
|
37
38
|
ControlSlider: () => ControlSlider,
|
|
38
39
|
CurvesEditor: () => CurvesEditor,
|
|
@@ -230,8 +231,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
// src/image-editor/ImageEditor.tsx
|
|
233
|
-
var
|
|
234
|
-
var
|
|
234
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
235
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
235
236
|
|
|
236
237
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
237
238
|
var import_react5 = require("react");
|
|
@@ -696,6 +697,30 @@ var ImageEditorCanvas = ({
|
|
|
696
697
|
if (g.error) report("paint", g.error);
|
|
697
698
|
}
|
|
698
699
|
};
|
|
700
|
+
(0, import_react5.useEffect)(() => {
|
|
701
|
+
if (mode !== "select" || typeof window === "undefined") return;
|
|
702
|
+
const onKey = (e) => {
|
|
703
|
+
const target = e.target;
|
|
704
|
+
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
705
|
+
if (window.getSelection?.()?.toString()) return;
|
|
706
|
+
const gesture = selectionGestureRef.current;
|
|
707
|
+
if ((0, import_image_editor2.handleQuickMaskKey)(controller, e)) {
|
|
708
|
+
e.preventDefault();
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if ((0, import_image_editor2.handleSelectionShortcut)(controller, e, (message) => report("select", message))) {
|
|
712
|
+
e.preventDefault();
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
if (gesture?.key(e.key)) {
|
|
716
|
+
e.preventDefault();
|
|
717
|
+
selectionDraftRef.current = gesture.draftPath;
|
|
718
|
+
void renderCanvas();
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
window.addEventListener("keydown", onKey);
|
|
722
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
723
|
+
});
|
|
699
724
|
(0, import_react5.useEffect)(() => {
|
|
700
725
|
if (mode !== "paint" || typeof window === "undefined") return;
|
|
701
726
|
const onKey = (e) => {
|
|
@@ -711,7 +736,11 @@ var ImageEditorCanvas = ({
|
|
|
711
736
|
if (mode === "select") {
|
|
712
737
|
const gesture = selectionGestureRef.current;
|
|
713
738
|
const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
|
|
714
|
-
void gesture.begin(imgPt, e).then(() =>
|
|
739
|
+
void gesture.begin(imgPt, e).then(() => {
|
|
740
|
+
report("select", gesture.error);
|
|
741
|
+
selectionDraftRef.current = gesture.draftPath;
|
|
742
|
+
void renderCanvas();
|
|
743
|
+
});
|
|
715
744
|
return;
|
|
716
745
|
}
|
|
717
746
|
if (mode === "crop") {
|
|
@@ -793,7 +822,7 @@ var ImageEditorCanvas = ({
|
|
|
793
822
|
const canvasPt = getCanvasEventPoint(e);
|
|
794
823
|
if (mode === "select") {
|
|
795
824
|
const gesture = selectionGestureRef.current;
|
|
796
|
-
if (gesture.active && gesture.move((0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false))) {
|
|
825
|
+
if (gesture.active && gesture.move((0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false), e)) {
|
|
797
826
|
selectionDraftRef.current = gesture.draftPath;
|
|
798
827
|
renderCanvas();
|
|
799
828
|
}
|
|
@@ -936,7 +965,7 @@ var ImageEditorCanvas = ({
|
|
|
936
965
|
const gesture = selectionGestureRef.current;
|
|
937
966
|
if (gesture.active) {
|
|
938
967
|
gesture.end((0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false), e);
|
|
939
|
-
selectionDraftRef.current =
|
|
968
|
+
selectionDraftRef.current = gesture.draftPath;
|
|
940
969
|
renderCanvas();
|
|
941
970
|
}
|
|
942
971
|
return;
|
|
@@ -1445,7 +1474,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
1445
1474
|
type: "button",
|
|
1446
1475
|
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1447
1476
|
onClick: () => {
|
|
1448
|
-
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
1477
|
+
setSelectedId(controller.addAdjustmentLayer({ kind: newKind, useSelection: true }));
|
|
1449
1478
|
setChannel("master");
|
|
1450
1479
|
setRange(-1);
|
|
1451
1480
|
},
|
|
@@ -1998,7 +2027,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1998
2027
|
pixels: thumb(layer),
|
|
1999
2028
|
size: thumbnailSize,
|
|
2000
2029
|
label: `${row.label} pixels`,
|
|
2001
|
-
|
|
2030
|
+
testId: "layer-thumbnail",
|
|
2031
|
+
selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask),
|
|
2032
|
+
onClick: (e) => {
|
|
2033
|
+
if (e.ctrlKey || e.metaKey) {
|
|
2034
|
+
e.stopPropagation();
|
|
2035
|
+
attempt(() => (0, import_image_editor8.layerThumbnailClick)(controller, layer, e));
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2002
2038
|
}
|
|
2003
2039
|
),
|
|
2004
2040
|
layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -2043,8 +2079,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2043
2079
|
selected: row.active && state.activeTarget === "mask",
|
|
2044
2080
|
onClick: (e) => {
|
|
2045
2081
|
e.stopPropagation();
|
|
2046
|
-
|
|
2047
|
-
else attempt(() => controller.setActiveLayer(layer.id, "mask"));
|
|
2082
|
+
attempt(() => (0, import_image_editor8.maskThumbnailClick)(controller, layer, e));
|
|
2048
2083
|
}
|
|
2049
2084
|
}
|
|
2050
2085
|
),
|
|
@@ -4116,7 +4151,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4116
4151
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
4117
4152
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
4118
4153
|
] }),
|
|
4119
|
-
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
4154
|
+
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
|
|
4120
4155
|
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
4121
4156
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
4122
4157
|
const all = layer.smartFilters.filters;
|
|
@@ -4551,12 +4586,18 @@ var import_react25 = require("react");
|
|
|
4551
4586
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4552
4587
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4553
4588
|
var MODIFY_OPS = [
|
|
4554
|
-
{ op: "
|
|
4555
|
-
{ op: "
|
|
4589
|
+
{ op: "expand", label: "Expand" },
|
|
4590
|
+
{ op: "contract", label: "Contract" },
|
|
4556
4591
|
{ op: "feather", label: "Feather" },
|
|
4557
4592
|
{ op: "border", label: "Border" },
|
|
4558
4593
|
{ op: "smooth", label: "Smooth" }
|
|
4559
4594
|
];
|
|
4595
|
+
var DISPLAYS = [
|
|
4596
|
+
{ id: "ants", label: "Ants" },
|
|
4597
|
+
{ id: "quickMask", label: "Quick Mask" },
|
|
4598
|
+
{ id: "none", label: "Hidden" }
|
|
4599
|
+
];
|
|
4600
|
+
var numberInput = "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground";
|
|
4560
4601
|
var btn = (on) => `px-2 py-1 rounded-md border text-[11px] transition-colors ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
4561
4602
|
var SelectionOptionsBar = ({
|
|
4562
4603
|
controller,
|
|
@@ -4564,12 +4605,50 @@ var SelectionOptionsBar = ({
|
|
|
4564
4605
|
onOptionsChange,
|
|
4565
4606
|
selection,
|
|
4566
4607
|
quickMask,
|
|
4608
|
+
selectionDisplay,
|
|
4567
4609
|
className = ""
|
|
4568
4610
|
}) => {
|
|
4569
4611
|
const [radius, setRadius] = (0, import_react25.useState)(2);
|
|
4570
4612
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
4571
4613
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4572
|
-
const
|
|
4614
|
+
const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
|
|
4615
|
+
const [preset, setPreset] = (0, import_react25.useState)("reds");
|
|
4616
|
+
const [rangeStatus, setRangeStatus] = (0, import_react25.useState)(null);
|
|
4617
|
+
const [colorStatus, setColorStatus] = (0, import_react25.useState)(null);
|
|
4618
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react25.useState)(4);
|
|
4619
|
+
const [strokeLocation, setStrokeLocation] = (0, import_react25.useState)("outside");
|
|
4620
|
+
const edit = (fn) => {
|
|
4621
|
+
setColorStatus(null);
|
|
4622
|
+
try {
|
|
4623
|
+
fn();
|
|
4624
|
+
} catch (err) {
|
|
4625
|
+
setColorStatus(err instanceof Error ? err.message : String(err));
|
|
4626
|
+
}
|
|
4627
|
+
};
|
|
4628
|
+
const runColor = async (op) => {
|
|
4629
|
+
setColorStatus(null);
|
|
4630
|
+
const opts = { tolerance: options.tolerance, sampleMerged: options.sampleMerged, sample: options.sample };
|
|
4631
|
+
try {
|
|
4632
|
+
await (op === "grow" ? controller.growSelection(opts) : controller.selectSimilar(opts));
|
|
4633
|
+
} catch (err) {
|
|
4634
|
+
setColorStatus(err instanceof Error ? err.message : String(err));
|
|
4635
|
+
}
|
|
4636
|
+
};
|
|
4637
|
+
const applyPreset = async () => {
|
|
4638
|
+
setRangeStatus(null);
|
|
4639
|
+
try {
|
|
4640
|
+
await controller.selectColorRangePreset(preset, {
|
|
4641
|
+
mode: options.mode,
|
|
4642
|
+
feather: options.feather ?? 0,
|
|
4643
|
+
invert: options.rangeInvert ?? false,
|
|
4644
|
+
falloff: options.fuzziness ?? 20,
|
|
4645
|
+
sampleMerged: options.sampleMerged,
|
|
4646
|
+
sample: options.sample
|
|
4647
|
+
});
|
|
4648
|
+
} catch (err) {
|
|
4649
|
+
setRangeStatus(err instanceof Error ? err.message : String(err));
|
|
4650
|
+
}
|
|
4651
|
+
};
|
|
4573
4652
|
const [subject, setSubject] = (0, import_react25.useState)("");
|
|
4574
4653
|
const [segmenting, setSegmenting] = (0, import_react25.useState)(false);
|
|
4575
4654
|
const [subjectStatus, setSubjectStatus] = (0, import_react25.useState)(null);
|
|
@@ -4602,6 +4681,21 @@ var SelectionOptionsBar = ({
|
|
|
4602
4681
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
4603
4682
|
"Contiguous"
|
|
4604
4683
|
] }),
|
|
4684
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4685
|
+
"Distance",
|
|
4686
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4687
|
+
ImageSelect,
|
|
4688
|
+
{
|
|
4689
|
+
label: "Colour distance",
|
|
4690
|
+
value: options.distance,
|
|
4691
|
+
options: [
|
|
4692
|
+
{ value: "rgb", label: "RGB" },
|
|
4693
|
+
{ value: "perceptual", label: "Perceptual" }
|
|
4694
|
+
],
|
|
4695
|
+
onChange: (v) => set({ distance: v })
|
|
4696
|
+
}
|
|
4697
|
+
)
|
|
4698
|
+
] }),
|
|
4605
4699
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4606
4700
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
4607
4701
|
"Sample adjusted image"
|
|
@@ -4622,6 +4716,67 @@ var SelectionOptionsBar = ({
|
|
|
4622
4716
|
)
|
|
4623
4717
|
] })
|
|
4624
4718
|
] }),
|
|
4719
|
+
options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
|
|
4720
|
+
options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
|
|
4721
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Fuzziness" }),
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
|
|
4726
|
+
] }),
|
|
4727
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
|
|
4728
|
+
] }),
|
|
4729
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4730
|
+
"Localized radius",
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4732
|
+
"input",
|
|
4733
|
+
{
|
|
4734
|
+
type: "number",
|
|
4735
|
+
min: 0,
|
|
4736
|
+
step: 1,
|
|
4737
|
+
"aria-label": "Localized radius",
|
|
4738
|
+
value: options.localized ?? 0,
|
|
4739
|
+
onChange: (e) => set({ localized: Math.max(0, Number(e.target.value) || 0) }),
|
|
4740
|
+
className: numberInput
|
|
4741
|
+
}
|
|
4742
|
+
),
|
|
4743
|
+
"px"
|
|
4744
|
+
] }),
|
|
4745
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4746
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
|
|
4747
|
+
"Invert"
|
|
4748
|
+
] }),
|
|
4749
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4751
|
+
ImageSelect,
|
|
4752
|
+
{
|
|
4753
|
+
label: "Color Range preset",
|
|
4754
|
+
value: preset,
|
|
4755
|
+
options: import_image_editor14.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor14.COLOR_RANGE_PRESET_LABELS[p] })),
|
|
4756
|
+
onChange: (v) => setPreset(v)
|
|
4757
|
+
}
|
|
4758
|
+
),
|
|
4759
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
|
|
4760
|
+
] }),
|
|
4761
|
+
rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
|
|
4762
|
+
] }),
|
|
4763
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4764
|
+
"Feather",
|
|
4765
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4766
|
+
"input",
|
|
4767
|
+
{
|
|
4768
|
+
type: "number",
|
|
4769
|
+
min: 0,
|
|
4770
|
+
max: 1e3,
|
|
4771
|
+
step: 0.5,
|
|
4772
|
+
"aria-label": "Feather",
|
|
4773
|
+
value: options.feather ?? 0,
|
|
4774
|
+
onChange: (e) => set({ feather: Math.max(0, Number(e.target.value) || 0) }),
|
|
4775
|
+
className: numberInput
|
|
4776
|
+
}
|
|
4777
|
+
),
|
|
4778
|
+
"px"
|
|
4779
|
+
] }),
|
|
4625
4780
|
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4626
4781
|
"form",
|
|
4627
4782
|
{
|
|
@@ -4659,7 +4814,13 @@ var SelectionOptionsBar = ({
|
|
|
4659
4814
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
4660
4815
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
4661
4816
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
4662
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button",
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
|
|
4818
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
|
|
4820
|
+
] }),
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
4822
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
|
|
4823
|
+
DISPLAYS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
|
|
4663
4824
|
] }),
|
|
4664
4825
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4665
4826
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
@@ -4674,12 +4835,57 @@ var SelectionOptionsBar = ({
|
|
|
4674
4835
|
"aria-label": "Modify radius",
|
|
4675
4836
|
value: radius,
|
|
4676
4837
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
4677
|
-
className:
|
|
4838
|
+
className: numberInput
|
|
4678
4839
|
}
|
|
4679
4840
|
)
|
|
4680
4841
|
] }),
|
|
4681
4842
|
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
4682
4843
|
] }),
|
|
4844
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4846
|
+
"Stroke",
|
|
4847
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4848
|
+
"input",
|
|
4849
|
+
{
|
|
4850
|
+
type: "number",
|
|
4851
|
+
min: 1,
|
|
4852
|
+
max: 250,
|
|
4853
|
+
step: 1,
|
|
4854
|
+
"aria-label": "Stroke width",
|
|
4855
|
+
value: strokeWidth,
|
|
4856
|
+
onChange: (e) => setStrokeWidth(Math.min(250, Math.max(1, Number(e.target.value) || 1))),
|
|
4857
|
+
className: numberInput
|
|
4858
|
+
}
|
|
4859
|
+
),
|
|
4860
|
+
"px"
|
|
4861
|
+
] }),
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4863
|
+
ImageSelect,
|
|
4864
|
+
{
|
|
4865
|
+
label: "Stroke location",
|
|
4866
|
+
value: strokeLocation,
|
|
4867
|
+
options: [
|
|
4868
|
+
{ value: "outside", label: "Outside" },
|
|
4869
|
+
{ value: "center", label: "Center" },
|
|
4870
|
+
{ value: "inside", label: "Inside" }
|
|
4871
|
+
],
|
|
4872
|
+
onChange: (v) => setStrokeLocation(v)
|
|
4873
|
+
}
|
|
4874
|
+
),
|
|
4875
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
|
|
4876
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
|
|
4877
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" })
|
|
4878
|
+
] }),
|
|
4879
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
|
|
4881
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
|
|
4882
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
|
|
4883
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
|
|
4884
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
|
|
4885
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
|
|
4886
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
|
|
4887
|
+
] }),
|
|
4888
|
+
colorStatus && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
|
|
4683
4889
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
4684
4890
|
] });
|
|
4685
4891
|
};
|
|
@@ -4835,14 +5041,129 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4835
5041
|
] });
|
|
4836
5042
|
};
|
|
4837
5043
|
|
|
4838
|
-
// src/image-editor/
|
|
5044
|
+
// src/image-editor/ChannelsPanel.tsx
|
|
4839
5045
|
var import_react27 = require("react");
|
|
4840
5046
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4841
5047
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5048
|
+
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"}`;
|
|
5049
|
+
var ChannelThumb = ({ channel, size }) => {
|
|
5050
|
+
const ref = (0, import_react27.useRef)(null);
|
|
5051
|
+
(0, import_react27.useEffect)(() => {
|
|
5052
|
+
const canvas = ref.current;
|
|
5053
|
+
const ctx = canvas?.getContext("2d");
|
|
5054
|
+
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
5055
|
+
const px = (0, import_image_editor16.channelThumbnail)(channel, 64);
|
|
5056
|
+
canvas.width = px.width;
|
|
5057
|
+
canvas.height = px.height;
|
|
5058
|
+
const img = ctx.createImageData(px.width, px.height);
|
|
5059
|
+
img.data.set(px.data);
|
|
5060
|
+
ctx.putImageData(img, 0, 0);
|
|
5061
|
+
}, [channel.mask]);
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
5063
|
+
};
|
|
5064
|
+
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5065
|
+
const [, setTick] = (0, import_react27.useState)(0);
|
|
5066
|
+
(0, import_react27.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5067
|
+
const [activeId, setActiveId] = (0, import_react27.useState)(null);
|
|
5068
|
+
const [renaming, setRenaming] = (0, import_react27.useState)(null);
|
|
5069
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
5070
|
+
const channels = controller.getChannels();
|
|
5071
|
+
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5072
|
+
const hasSelection = Boolean(controller.getSelection());
|
|
5073
|
+
const quickMask = controller.quickMaskEditing;
|
|
5074
|
+
const attempt = (fn) => {
|
|
5075
|
+
setError(null);
|
|
5076
|
+
try {
|
|
5077
|
+
fn();
|
|
5078
|
+
} catch (err) {
|
|
5079
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
5080
|
+
}
|
|
5081
|
+
};
|
|
5082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5083
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5084
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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" })
|
|
5086
|
+
] }),
|
|
5087
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5089
|
+
"li",
|
|
5090
|
+
{
|
|
5091
|
+
"data-testid": "channel-row",
|
|
5092
|
+
"aria-current": c.id === activeId ? "true" : void 0,
|
|
5093
|
+
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"}`,
|
|
5094
|
+
onClick: (e) => {
|
|
5095
|
+
setActiveId(c.id);
|
|
5096
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor16.selectionModeFromModifiers)(e, "replace") }));
|
|
5097
|
+
},
|
|
5098
|
+
onDoubleClick: () => setRenaming(c.id),
|
|
5099
|
+
children: [
|
|
5100
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5101
|
+
"button",
|
|
5102
|
+
{
|
|
5103
|
+
type: "button",
|
|
5104
|
+
"aria-label": `${c.visible ? "Hide" : "Show"} ${c.name}`,
|
|
5105
|
+
"aria-pressed": c.visible,
|
|
5106
|
+
className: "w-4 text-muted-foreground",
|
|
5107
|
+
onClick: (e) => {
|
|
5108
|
+
e.stopPropagation();
|
|
5109
|
+
attempt(() => controller.setChannelProperties(c.id, { visible: !c.visible }));
|
|
5110
|
+
},
|
|
5111
|
+
children: c.visible ? "\u25CF" : "\u25CB"
|
|
5112
|
+
}
|
|
5113
|
+
),
|
|
5114
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
5115
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5116
|
+
"input",
|
|
5117
|
+
{
|
|
5118
|
+
autoFocus: true,
|
|
5119
|
+
"aria-label": "Channel name",
|
|
5120
|
+
defaultValue: c.name,
|
|
5121
|
+
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
5122
|
+
onClick: (e) => e.stopPropagation(),
|
|
5123
|
+
onBlur: (e) => {
|
|
5124
|
+
setRenaming(null);
|
|
5125
|
+
if (e.currentTarget.value.trim() && e.currentTarget.value !== c.name) attempt(() => controller.setChannelProperties(c.id, { name: e.currentTarget.value }));
|
|
5126
|
+
},
|
|
5127
|
+
onKeyDown: (e) => {
|
|
5128
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
5129
|
+
if (e.key === "Escape") setRenaming(null);
|
|
5130
|
+
}
|
|
5131
|
+
}
|
|
5132
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
5133
|
+
]
|
|
5134
|
+
},
|
|
5135
|
+
c.id
|
|
5136
|
+
)) }),
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5138
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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" }),
|
|
5140
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
5141
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5142
|
+
"button",
|
|
5143
|
+
{
|
|
5144
|
+
type: "button",
|
|
5145
|
+
className: btn2(),
|
|
5146
|
+
disabled: !active,
|
|
5147
|
+
onClick: () => attempt(() => {
|
|
5148
|
+
controller.deleteChannel(active.id);
|
|
5149
|
+
setActiveId(null);
|
|
5150
|
+
}),
|
|
5151
|
+
children: "Delete"
|
|
5152
|
+
}
|
|
5153
|
+
)
|
|
5154
|
+
] }),
|
|
5155
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5156
|
+
] });
|
|
5157
|
+
};
|
|
5158
|
+
|
|
5159
|
+
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
5160
|
+
var import_react28 = require("react");
|
|
5161
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5162
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4842
5163
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4843
5164
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4844
|
-
const [, setTick] = (0,
|
|
4845
|
-
(0,
|
|
5165
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
5166
|
+
(0, import_react28.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4846
5167
|
const bar = tool.bar();
|
|
4847
5168
|
if (!tool.active || !bar) return null;
|
|
4848
5169
|
const warp = tool.warpBar();
|
|
@@ -4854,17 +5175,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4854
5175
|
const v = Number(raw);
|
|
4855
5176
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4856
5177
|
};
|
|
4857
|
-
return /* @__PURE__ */ (0,
|
|
4858
|
-
/* @__PURE__ */ (0,
|
|
4859
|
-
/* @__PURE__ */ (0,
|
|
4860
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
4861
|
-
/* @__PURE__ */ (0,
|
|
4862
|
-
/* @__PURE__ */ (0,
|
|
4863
|
-
/* @__PURE__ */ (0,
|
|
5178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.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: [
|
|
5179
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor17.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime28.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)) }),
|
|
5180
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor17.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime28.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)) }),
|
|
5181
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
5182
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
5184
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor17.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
4864
5185
|
] }),
|
|
4865
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
4866
|
-
/* @__PURE__ */ (0,
|
|
4867
|
-
/* @__PURE__ */ (0,
|
|
5186
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5187
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4868
5189
|
"input",
|
|
4869
5190
|
{
|
|
4870
5191
|
type: "number",
|
|
@@ -4885,9 +5206,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4885
5206
|
},
|
|
4886
5207
|
`${k}:${warp[k]}`
|
|
4887
5208
|
),
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
5209
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
4889
5210
|
] }, k)),
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4891
5212
|
"button",
|
|
4892
5213
|
{
|
|
4893
5214
|
type: "button",
|
|
@@ -4899,26 +5220,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4899
5220
|
children: "Vertical"
|
|
4900
5221
|
}
|
|
4901
5222
|
),
|
|
4902
|
-
/* @__PURE__ */ (0,
|
|
4903
|
-
/* @__PURE__ */ (0,
|
|
4904
|
-
/* @__PURE__ */ (0,
|
|
5223
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5224
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
5225
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4905
5226
|
"select",
|
|
4906
5227
|
{
|
|
4907
5228
|
"aria-label": "Warp grid",
|
|
4908
|
-
value:
|
|
5229
|
+
value: import_image_editor17.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
4909
5230
|
onChange: (e) => {
|
|
4910
|
-
const g =
|
|
5231
|
+
const g = import_image_editor17.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
4911
5232
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4912
5233
|
},
|
|
4913
5234
|
className: imageFieldClass,
|
|
4914
|
-
children:
|
|
5235
|
+
children: import_image_editor17.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
4915
5236
|
}
|
|
4916
5237
|
)
|
|
4917
5238
|
] })
|
|
4918
5239
|
] }),
|
|
4919
|
-
tool.mode !== "warp" &&
|
|
4920
|
-
/* @__PURE__ */ (0,
|
|
4921
|
-
/* @__PURE__ */ (0,
|
|
5240
|
+
tool.mode !== "warp" && import_image_editor17.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
5241
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
5242
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4922
5243
|
"input",
|
|
4923
5244
|
{
|
|
4924
5245
|
type: "number",
|
|
@@ -4938,8 +5259,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4938
5259
|
},
|
|
4939
5260
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4940
5261
|
),
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
4942
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
5262
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
5263
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4943
5264
|
"button",
|
|
4944
5265
|
{
|
|
4945
5266
|
type: "button",
|
|
@@ -4954,33 +5275,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4954
5275
|
}
|
|
4955
5276
|
)
|
|
4956
5277
|
] }, f.id)),
|
|
4957
|
-
/* @__PURE__ */ (0,
|
|
4958
|
-
/* @__PURE__ */ (0,
|
|
4959
|
-
/* @__PURE__ */ (0,
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4960
5281
|
"select",
|
|
4961
5282
|
{
|
|
4962
5283
|
"aria-label": "Interpolation",
|
|
4963
5284
|
value: tool.interpolation,
|
|
4964
5285
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4965
5286
|
className: imageFieldClass,
|
|
4966
|
-
children:
|
|
5287
|
+
children: import_image_editor17.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4967
5288
|
}
|
|
4968
5289
|
)
|
|
4969
5290
|
] }),
|
|
4970
|
-
/* @__PURE__ */ (0,
|
|
4971
|
-
/* @__PURE__ */ (0,
|
|
4972
|
-
tool.error && /* @__PURE__ */ (0,
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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" }),
|
|
5292
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
5293
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4973
5294
|
] });
|
|
4974
5295
|
};
|
|
4975
5296
|
|
|
4976
5297
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4977
|
-
var
|
|
4978
|
-
var
|
|
4979
|
-
var
|
|
5298
|
+
var import_react29 = require("react");
|
|
5299
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5300
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4980
5301
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4981
|
-
const [, setTick] = (0,
|
|
4982
|
-
(0,
|
|
4983
|
-
const [error, setError] = (0,
|
|
5302
|
+
const [, setTick] = (0, import_react29.useState)(0);
|
|
5303
|
+
(0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5304
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
4984
5305
|
const active = controller.getActiveLayer();
|
|
4985
5306
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4986
5307
|
const set = (change) => {
|
|
@@ -4988,28 +5309,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4988
5309
|
if (!shapeId) return;
|
|
4989
5310
|
try {
|
|
4990
5311
|
setError(null);
|
|
4991
|
-
(0,
|
|
5312
|
+
(0, import_image_editor18.applyShapeOptions)(controller, shapeId, change);
|
|
4992
5313
|
} catch (e) {
|
|
4993
5314
|
setError(e instanceof Error ? e.message : String(e));
|
|
4994
5315
|
}
|
|
4995
5316
|
};
|
|
4996
5317
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4997
|
-
return /* @__PURE__ */ (0,
|
|
4998
|
-
/* @__PURE__ */ (0,
|
|
4999
|
-
/* @__PURE__ */ (0,
|
|
5000
|
-
/* @__PURE__ */ (0,
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
5318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
5319
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor18.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor18.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
5320
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5321
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5322
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
5002
5323
|
"Fill",
|
|
5003
|
-
/* @__PURE__ */ (0,
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
5004
5325
|
] }),
|
|
5005
|
-
/* @__PURE__ */ (0,
|
|
5006
|
-
/* @__PURE__ */ (0,
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
5007
5328
|
"Stroke",
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
5009
5330
|
] }),
|
|
5010
|
-
/* @__PURE__ */ (0,
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5011
5332
|
"Width",
|
|
5012
|
-
/* @__PURE__ */ (0,
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5013
5334
|
"input",
|
|
5014
5335
|
{
|
|
5015
5336
|
type: "number",
|
|
@@ -5023,51 +5344,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5023
5344
|
)
|
|
5024
5345
|
] })
|
|
5025
5346
|
] }),
|
|
5026
|
-
/* @__PURE__ */ (0,
|
|
5027
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
5347
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5348
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5028
5349
|
"Radius",
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5350
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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}` })
|
|
5030
5351
|
] }),
|
|
5031
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
5352
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5032
5353
|
"Sides",
|
|
5033
|
-
/* @__PURE__ */ (0,
|
|
5354
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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}` })
|
|
5034
5355
|
] }),
|
|
5035
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
5036
|
-
/* @__PURE__ */ (0,
|
|
5356
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5037
5358
|
"Points",
|
|
5038
|
-
/* @__PURE__ */ (0,
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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}` })
|
|
5039
5360
|
] }),
|
|
5040
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5041
5362
|
"Inner",
|
|
5042
|
-
/* @__PURE__ */ (0,
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
5043
5364
|
] })
|
|
5044
5365
|
] }),
|
|
5045
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
5046
|
-
/* @__PURE__ */ (0,
|
|
5366
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5367
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5047
5368
|
"Weight",
|
|
5048
|
-
/* @__PURE__ */ (0,
|
|
5369
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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}` })
|
|
5049
5370
|
] }),
|
|
5050
|
-
/* @__PURE__ */ (0,
|
|
5051
|
-
/* @__PURE__ */ (0,
|
|
5371
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
5052
5373
|
"Arrowhead"
|
|
5053
5374
|
] })
|
|
5054
5375
|
] })
|
|
5055
5376
|
] }),
|
|
5056
|
-
/* @__PURE__ */ (0,
|
|
5057
|
-
error && /* @__PURE__ */ (0,
|
|
5377
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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." }),
|
|
5378
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5058
5379
|
] });
|
|
5059
5380
|
};
|
|
5060
5381
|
|
|
5061
5382
|
// src/image-editor/TypeOptionsBar.tsx
|
|
5062
|
-
var
|
|
5063
|
-
var
|
|
5064
|
-
var
|
|
5383
|
+
var import_react30 = require("react");
|
|
5384
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5385
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5065
5386
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
5066
5387
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
5067
|
-
const [, setTick] = (0,
|
|
5068
|
-
(0,
|
|
5069
|
-
(0,
|
|
5070
|
-
const [error, setError] = (0,
|
|
5388
|
+
const [, setTick] = (0, import_react30.useState)(0);
|
|
5389
|
+
(0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5390
|
+
(0, import_react30.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
5391
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5071
5392
|
const active = controller.getActiveLayer();
|
|
5072
5393
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
5073
5394
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -5099,11 +5420,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5099
5420
|
setError(e instanceof Error ? e.message : String(e));
|
|
5100
5421
|
}
|
|
5101
5422
|
};
|
|
5102
|
-
return /* @__PURE__ */ (0,
|
|
5103
|
-
/* @__PURE__ */ (0,
|
|
5104
|
-
/* @__PURE__ */ (0,
|
|
5423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
5424
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5105
5426
|
"Font",
|
|
5106
|
-
/* @__PURE__ */ (0,
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5107
5428
|
"input",
|
|
5108
5429
|
{
|
|
5109
5430
|
list: "pixerate-type-fonts",
|
|
@@ -5113,11 +5434,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5113
5434
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
5114
5435
|
}
|
|
5115
5436
|
),
|
|
5116
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: f }, f)) })
|
|
5117
5438
|
] }),
|
|
5118
|
-
/* @__PURE__ */ (0,
|
|
5439
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5119
5440
|
"Size",
|
|
5120
|
-
/* @__PURE__ */ (0,
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5121
5442
|
"input",
|
|
5122
5443
|
{
|
|
5123
5444
|
type: "number",
|
|
@@ -5130,24 +5451,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5130
5451
|
}
|
|
5131
5452
|
)
|
|
5132
5453
|
] }),
|
|
5133
|
-
/* @__PURE__ */ (0,
|
|
5134
|
-
/* @__PURE__ */ (0,
|
|
5135
|
-
/* @__PURE__ */ (0,
|
|
5454
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.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" }),
|
|
5455
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
5456
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
5136
5457
|
] }),
|
|
5137
|
-
/* @__PURE__ */ (0,
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5139
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
5458
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor19.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
5460
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
5140
5461
|
"Missing ",
|
|
5141
5462
|
missing.length === 1 ? "font" : "fonts",
|
|
5142
5463
|
": ",
|
|
5143
5464
|
missing.join(", ")
|
|
5144
5465
|
] }),
|
|
5145
|
-
error && /* @__PURE__ */ (0,
|
|
5466
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5146
5467
|
] });
|
|
5147
5468
|
};
|
|
5148
5469
|
|
|
5149
5470
|
// src/image-editor/ImageEditor.tsx
|
|
5150
|
-
var
|
|
5471
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5151
5472
|
var ImageEditor = ({
|
|
5152
5473
|
editor: externalEditor,
|
|
5153
5474
|
src,
|
|
@@ -5171,51 +5492,51 @@ var ImageEditor = ({
|
|
|
5171
5492
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
5172
5493
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
5173
5494
|
});
|
|
5174
|
-
const legacyProcess = (0,
|
|
5175
|
-
const [activeTab, setActiveTab] = (0,
|
|
5176
|
-
const rootRef = (0,
|
|
5495
|
+
const legacyProcess = (0, import_image_editor20.normalizeProcessVersion)(state.adjustments.process) < import_image_editor20.LATEST_PROCESS_VERSION;
|
|
5496
|
+
const [activeTab, setActiveTab] = (0, import_react31.useState)("crop");
|
|
5497
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
5177
5498
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
5178
|
-
const activeTabRef = (0,
|
|
5499
|
+
const activeTabRef = (0, import_react31.useRef)(activeTab);
|
|
5179
5500
|
activeTabRef.current = activeTab;
|
|
5180
5501
|
const openPanel = async (ref) => {
|
|
5181
5502
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
5182
5503
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
5183
5504
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
5184
5505
|
};
|
|
5185
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
5186
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
5187
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
5188
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
5189
|
-
const [typeSession, setTypeSession] = (0,
|
|
5190
|
-
const [selectionError, setSelectionError] = (0,
|
|
5191
|
-
const [paintError, setPaintError] = (0,
|
|
5192
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
5506
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react31.useState)(null);
|
|
5507
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react31.useState)(import_image_editor20.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
5508
|
+
const [shapeOptions, setShapeOptions] = (0, import_react31.useState)(import_image_editor20.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
5509
|
+
const [typeOptions, setTypeOptions] = (0, import_react31.useState)(import_image_editor20.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
5510
|
+
const [typeSession, setTypeSession] = (0, import_react31.useState)(null);
|
|
5511
|
+
const [selectionError, setSelectionError] = (0, import_react31.useState)(null);
|
|
5512
|
+
const [paintError, setPaintError] = (0, import_react31.useState)(null);
|
|
5513
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react31.useState)(null);
|
|
5193
5514
|
const handleCanvasError = (source, message) => {
|
|
5194
5515
|
if (source === "paint") setPaintError(message);
|
|
5195
5516
|
else if (source === "select") setSelectionError(message);
|
|
5196
5517
|
else setShapeTypeError(message);
|
|
5197
5518
|
};
|
|
5198
5519
|
const finishTyping = () => setTypeSession(null);
|
|
5199
|
-
const transformToolRef = (0,
|
|
5200
|
-
const transformControllerRef = (0,
|
|
5520
|
+
const transformToolRef = (0, import_react31.useRef)(null);
|
|
5521
|
+
const transformControllerRef = (0, import_react31.useRef)(controller);
|
|
5201
5522
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
5202
5523
|
transformToolRef.current?.cancel();
|
|
5203
|
-
transformToolRef.current = new
|
|
5524
|
+
transformToolRef.current = new import_image_editor20.FreeTransformTool(controller, {
|
|
5204
5525
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
5205
5526
|
});
|
|
5206
5527
|
transformControllerRef.current = controller;
|
|
5207
5528
|
}
|
|
5208
5529
|
const transformTool = transformToolRef.current;
|
|
5209
|
-
const [, setTransformTick] = (0,
|
|
5210
|
-
(0,
|
|
5211
|
-
(0,
|
|
5212
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
5213
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
5214
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
5215
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
5216
|
-
const [aiError, setAiError] = (0,
|
|
5217
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
5218
|
-
const [aiTarget, setAiTarget] = (0,
|
|
5530
|
+
const [, setTransformTick] = (0, import_react31.useState)(0);
|
|
5531
|
+
(0, import_react31.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
5532
|
+
(0, import_react31.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
5533
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react31.useState)("");
|
|
5534
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react31.useState)("annotations");
|
|
5535
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react31.useState)(false);
|
|
5536
|
+
const [isInpainting, setIsInpainting] = (0, import_react31.useState)(false);
|
|
5537
|
+
const [aiError, setAiError] = (0, import_react31.useState)(null);
|
|
5538
|
+
const [aiSuccess, setAiSuccess] = (0, import_react31.useState)(null);
|
|
5539
|
+
const [aiTarget, setAiTarget] = (0, import_react31.useState)("auto");
|
|
5219
5540
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
5220
5541
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
5221
5542
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5278,11 +5599,11 @@ var ImageEditor = ({
|
|
|
5278
5599
|
setIsInpainting(false);
|
|
5279
5600
|
}
|
|
5280
5601
|
};
|
|
5281
|
-
const [activeColor, setActiveColor] = (0,
|
|
5282
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5283
|
-
const [fontSize, setFontSize] = (0,
|
|
5284
|
-
const [textInput, setTextInput] = (0,
|
|
5285
|
-
(0,
|
|
5602
|
+
const [activeColor, setActiveColor] = (0, import_react31.useState)("#ef4444");
|
|
5603
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react31.useState)(3);
|
|
5604
|
+
const [fontSize, setFontSize] = (0, import_react31.useState)(24);
|
|
5605
|
+
const [textInput, setTextInput] = (0, import_react31.useState)("");
|
|
5606
|
+
(0, import_react31.useEffect)(() => {
|
|
5286
5607
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5287
5608
|
editor.setTool("crop");
|
|
5288
5609
|
}
|
|
@@ -5310,16 +5631,16 @@ var ImageEditor = ({
|
|
|
5310
5631
|
link.click();
|
|
5311
5632
|
}
|
|
5312
5633
|
};
|
|
5313
|
-
return /* @__PURE__ */ (0,
|
|
5634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5314
5635
|
"div",
|
|
5315
5636
|
{
|
|
5316
5637
|
ref: rootRef,
|
|
5317
5638
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5318
5639
|
style,
|
|
5319
5640
|
children: [
|
|
5320
|
-
/* @__PURE__ */ (0,
|
|
5321
|
-
/* @__PURE__ */ (0,
|
|
5322
|
-
/* @__PURE__ */ (0,
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5643
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5323
5644
|
"button",
|
|
5324
5645
|
{
|
|
5325
5646
|
type: "button",
|
|
@@ -5334,7 +5655,7 @@ var ImageEditor = ({
|
|
|
5334
5655
|
children: "Transform & Crop"
|
|
5335
5656
|
}
|
|
5336
5657
|
),
|
|
5337
|
-
/* @__PURE__ */ (0,
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5338
5659
|
"button",
|
|
5339
5660
|
{
|
|
5340
5661
|
type: "button",
|
|
@@ -5349,7 +5670,7 @@ var ImageEditor = ({
|
|
|
5349
5670
|
children: "Adjustments"
|
|
5350
5671
|
}
|
|
5351
5672
|
),
|
|
5352
|
-
/* @__PURE__ */ (0,
|
|
5673
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5353
5674
|
"button",
|
|
5354
5675
|
{
|
|
5355
5676
|
type: "button",
|
|
@@ -5364,7 +5685,7 @@ var ImageEditor = ({
|
|
|
5364
5685
|
children: "Layers"
|
|
5365
5686
|
}
|
|
5366
5687
|
),
|
|
5367
|
-
/* @__PURE__ */ (0,
|
|
5688
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5368
5689
|
"button",
|
|
5369
5690
|
{
|
|
5370
5691
|
type: "button",
|
|
@@ -5379,7 +5700,7 @@ var ImageEditor = ({
|
|
|
5379
5700
|
children: "Paint"
|
|
5380
5701
|
}
|
|
5381
5702
|
),
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5383
5704
|
"button",
|
|
5384
5705
|
{
|
|
5385
5706
|
type: "button",
|
|
@@ -5394,7 +5715,7 @@ var ImageEditor = ({
|
|
|
5394
5715
|
children: "Select & Mask"
|
|
5395
5716
|
}
|
|
5396
5717
|
),
|
|
5397
|
-
/* @__PURE__ */ (0,
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5398
5719
|
"button",
|
|
5399
5720
|
{
|
|
5400
5721
|
type: "button",
|
|
@@ -5409,7 +5730,7 @@ var ImageEditor = ({
|
|
|
5409
5730
|
children: "Annotations"
|
|
5410
5731
|
}
|
|
5411
5732
|
),
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5413
5734
|
"button",
|
|
5414
5735
|
{
|
|
5415
5736
|
type: "button",
|
|
@@ -5424,7 +5745,7 @@ var ImageEditor = ({
|
|
|
5424
5745
|
children: "Depth Mask"
|
|
5425
5746
|
}
|
|
5426
5747
|
),
|
|
5427
|
-
/* @__PURE__ */ (0,
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5428
5749
|
"button",
|
|
5429
5750
|
{
|
|
5430
5751
|
type: "button",
|
|
@@ -5437,14 +5758,14 @@ var ImageEditor = ({
|
|
|
5437
5758
|
"aria-selected": activeTab === "ai",
|
|
5438
5759
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5439
5760
|
children: [
|
|
5440
|
-
/* @__PURE__ */ (0,
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.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" }) }),
|
|
5441
5762
|
"AI Tools"
|
|
5442
5763
|
]
|
|
5443
5764
|
}
|
|
5444
5765
|
)
|
|
5445
5766
|
] }),
|
|
5446
|
-
/* @__PURE__ */ (0,
|
|
5447
|
-
/* @__PURE__ */ (0,
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5448
5769
|
"button",
|
|
5449
5770
|
{
|
|
5450
5771
|
type: "button",
|
|
@@ -5455,7 +5776,7 @@ var ImageEditor = ({
|
|
|
5455
5776
|
children: "\u21A9"
|
|
5456
5777
|
}
|
|
5457
5778
|
),
|
|
5458
|
-
/* @__PURE__ */ (0,
|
|
5779
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5459
5780
|
"button",
|
|
5460
5781
|
{
|
|
5461
5782
|
type: "button",
|
|
@@ -5466,7 +5787,7 @@ var ImageEditor = ({
|
|
|
5466
5787
|
children: "\u21AA"
|
|
5467
5788
|
}
|
|
5468
5789
|
),
|
|
5469
|
-
/* @__PURE__ */ (0,
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5470
5791
|
"button",
|
|
5471
5792
|
{
|
|
5472
5793
|
type: "button",
|
|
@@ -5475,8 +5796,8 @@ var ImageEditor = ({
|
|
|
5475
5796
|
children: "Reset"
|
|
5476
5797
|
}
|
|
5477
5798
|
),
|
|
5478
|
-
/* @__PURE__ */ (0,
|
|
5479
|
-
/* @__PURE__ */ (0,
|
|
5799
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5800
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5480
5801
|
"button",
|
|
5481
5802
|
{
|
|
5482
5803
|
type: "button",
|
|
@@ -5486,11 +5807,11 @@ var ImageEditor = ({
|
|
|
5486
5807
|
children: "-"
|
|
5487
5808
|
}
|
|
5488
5809
|
),
|
|
5489
|
-
/* @__PURE__ */ (0,
|
|
5810
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5490
5811
|
Math.round(state.zoom * 100),
|
|
5491
5812
|
"%"
|
|
5492
5813
|
] }),
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5814
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5494
5815
|
"button",
|
|
5495
5816
|
{
|
|
5496
5817
|
type: "button",
|
|
@@ -5500,8 +5821,8 @@ var ImageEditor = ({
|
|
|
5500
5821
|
children: "+"
|
|
5501
5822
|
}
|
|
5502
5823
|
),
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5504
|
-
/* @__PURE__ */ (0,
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5505
5826
|
"button",
|
|
5506
5827
|
{
|
|
5507
5828
|
type: "button",
|
|
@@ -5512,7 +5833,7 @@ var ImageEditor = ({
|
|
|
5512
5833
|
children: "Hold Compare"
|
|
5513
5834
|
}
|
|
5514
5835
|
),
|
|
5515
|
-
/* @__PURE__ */ (0,
|
|
5836
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5516
5837
|
"button",
|
|
5517
5838
|
{
|
|
5518
5839
|
type: "button",
|
|
@@ -5523,10 +5844,10 @@ var ImageEditor = ({
|
|
|
5523
5844
|
)
|
|
5524
5845
|
] })
|
|
5525
5846
|
] }),
|
|
5526
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
5527
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
5528
|
-
/* @__PURE__ */ (0,
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5847
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5848
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5849
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5850
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5530
5851
|
ImageEditorCanvas,
|
|
5531
5852
|
{
|
|
5532
5853
|
editor,
|
|
@@ -5550,11 +5871,11 @@ var ImageEditor = ({
|
|
|
5550
5871
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5551
5872
|
}
|
|
5552
5873
|
),
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5554
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
5555
|
-
/* @__PURE__ */ (0,
|
|
5556
|
-
/* @__PURE__ */ (0,
|
|
5557
|
-
/* @__PURE__ */ (0,
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: imageSidebarClass, children: [
|
|
5875
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5878
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5558
5879
|
"button",
|
|
5559
5880
|
{
|
|
5560
5881
|
type: "button",
|
|
@@ -5566,7 +5887,7 @@ var ImageEditor = ({
|
|
|
5566
5887
|
children: "Freeform"
|
|
5567
5888
|
}
|
|
5568
5889
|
),
|
|
5569
|
-
/* @__PURE__ */ (0,
|
|
5890
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5570
5891
|
"button",
|
|
5571
5892
|
{
|
|
5572
5893
|
type: "button",
|
|
@@ -5578,7 +5899,7 @@ var ImageEditor = ({
|
|
|
5578
5899
|
children: "1:1 Square"
|
|
5579
5900
|
}
|
|
5580
5901
|
),
|
|
5581
|
-
/* @__PURE__ */ (0,
|
|
5902
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5582
5903
|
"button",
|
|
5583
5904
|
{
|
|
5584
5905
|
type: "button",
|
|
@@ -5590,7 +5911,7 @@ var ImageEditor = ({
|
|
|
5590
5911
|
children: "4:3 Standard"
|
|
5591
5912
|
}
|
|
5592
5913
|
),
|
|
5593
|
-
/* @__PURE__ */ (0,
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5594
5915
|
"button",
|
|
5595
5916
|
{
|
|
5596
5917
|
type: "button",
|
|
@@ -5602,7 +5923,7 @@ var ImageEditor = ({
|
|
|
5602
5923
|
children: "16:9 Wide"
|
|
5603
5924
|
}
|
|
5604
5925
|
),
|
|
5605
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5606
5927
|
"button",
|
|
5607
5928
|
{
|
|
5608
5929
|
type: "button",
|
|
@@ -5614,7 +5935,7 @@ var ImageEditor = ({
|
|
|
5614
5935
|
children: "3:2 Photo"
|
|
5615
5936
|
}
|
|
5616
5937
|
),
|
|
5617
|
-
/* @__PURE__ */ (0,
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5618
5939
|
"button",
|
|
5619
5940
|
{
|
|
5620
5941
|
type: "button",
|
|
@@ -5627,10 +5948,10 @@ var ImageEditor = ({
|
|
|
5627
5948
|
}
|
|
5628
5949
|
)
|
|
5629
5950
|
] }),
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
5631
|
-
/* @__PURE__ */ (0,
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
5633
|
-
/* @__PURE__ */ (0,
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5953
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5954
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5634
5955
|
"button",
|
|
5635
5956
|
{
|
|
5636
5957
|
type: "button",
|
|
@@ -5639,7 +5960,7 @@ var ImageEditor = ({
|
|
|
5639
5960
|
children: "Rotate -90\xB0"
|
|
5640
5961
|
}
|
|
5641
5962
|
),
|
|
5642
|
-
/* @__PURE__ */ (0,
|
|
5963
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5643
5964
|
"button",
|
|
5644
5965
|
{
|
|
5645
5966
|
type: "button",
|
|
@@ -5648,7 +5969,7 @@ var ImageEditor = ({
|
|
|
5648
5969
|
children: "Rotate +90\xB0"
|
|
5649
5970
|
}
|
|
5650
5971
|
),
|
|
5651
|
-
/* @__PURE__ */ (0,
|
|
5972
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5652
5973
|
"button",
|
|
5653
5974
|
{
|
|
5654
5975
|
type: "button",
|
|
@@ -5657,7 +5978,7 @@ var ImageEditor = ({
|
|
|
5657
5978
|
children: "Flip Horizontal"
|
|
5658
5979
|
}
|
|
5659
5980
|
),
|
|
5660
|
-
/* @__PURE__ */ (0,
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5661
5982
|
"button",
|
|
5662
5983
|
{
|
|
5663
5984
|
type: "button",
|
|
@@ -5668,10 +5989,10 @@ var ImageEditor = ({
|
|
|
5668
5989
|
)
|
|
5669
5990
|
] })
|
|
5670
5991
|
] }),
|
|
5671
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
5672
|
-
/* @__PURE__ */ (0,
|
|
5673
|
-
/* @__PURE__ */ (0,
|
|
5674
|
-
/* @__PURE__ */ (0,
|
|
5992
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5993
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5995
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5675
5996
|
"button",
|
|
5676
5997
|
{
|
|
5677
5998
|
type: "button",
|
|
@@ -5681,25 +6002,25 @@ var ImageEditor = ({
|
|
|
5681
6002
|
}
|
|
5682
6003
|
)
|
|
5683
6004
|
] }),
|
|
5684
|
-
/* @__PURE__ */ (0,
|
|
5685
|
-
|
|
5686
|
-
/* @__PURE__ */ (0,
|
|
6005
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Histogram, { histogram: editor.histogram }),
|
|
6006
|
+
import_image_editor20.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react31.default.Fragment, { children: [
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5687
6008
|
ControlSlider,
|
|
5688
6009
|
{
|
|
5689
6010
|
spec,
|
|
5690
|
-
value: (0,
|
|
6011
|
+
value: (0, import_image_editor20.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
5691
6012
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
5692
6013
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5693
6014
|
}
|
|
5694
6015
|
),
|
|
5695
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6016
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5696
6017
|
"div",
|
|
5697
6018
|
{
|
|
5698
6019
|
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",
|
|
5699
6020
|
"data-testid": "image-editor-process-notice",
|
|
5700
6021
|
children: [
|
|
5701
|
-
/* @__PURE__ */ (0,
|
|
5702
|
-
/* @__PURE__ */ (0,
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
6023
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5703
6024
|
"button",
|
|
5704
6025
|
{
|
|
5705
6026
|
type: "button",
|
|
@@ -5712,7 +6033,7 @@ var ImageEditor = ({
|
|
|
5712
6033
|
}
|
|
5713
6034
|
)
|
|
5714
6035
|
] }, spec.id)),
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
6036
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5716
6037
|
AdjustmentLayersPanel,
|
|
5717
6038
|
{
|
|
5718
6039
|
controller,
|
|
@@ -5721,9 +6042,9 @@ var ImageEditor = ({
|
|
|
5721
6042
|
}
|
|
5722
6043
|
) })
|
|
5723
6044
|
] }),
|
|
5724
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
5725
|
-
/* @__PURE__ */ (0,
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
6045
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
6047
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5727
6048
|
"button",
|
|
5728
6049
|
{
|
|
5729
6050
|
type: "button",
|
|
@@ -5734,15 +6055,15 @@ var ImageEditor = ({
|
|
|
5734
6055
|
children: "Free Transform"
|
|
5735
6056
|
}
|
|
5736
6057
|
),
|
|
5737
|
-
/* @__PURE__ */ (0,
|
|
5738
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
5739
|
-
/* @__PURE__ */ (0,
|
|
5740
|
-
/* @__PURE__ */ (0,
|
|
6058
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LayersPanel, { controller }),
|
|
6059
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
6061
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorProfilePanel, { controller })
|
|
5741
6062
|
] }),
|
|
5742
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5744
|
-
/* @__PURE__ */ (0,
|
|
5745
|
-
/* @__PURE__ */ (0,
|
|
6063
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
6065
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BrushOptionsBar, { controller }),
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5746
6067
|
"button",
|
|
5747
6068
|
{
|
|
5748
6069
|
type: "button",
|
|
@@ -5753,12 +6074,12 @@ var ImageEditor = ({
|
|
|
5753
6074
|
children: "Free Transform"
|
|
5754
6075
|
}
|
|
5755
6076
|
),
|
|
5756
|
-
paintError && /* @__PURE__ */ (0,
|
|
5757
|
-
/* @__PURE__ */ (0,
|
|
6077
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
6078
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LayersPanel, { controller }) })
|
|
5758
6079
|
] }),
|
|
5759
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
5760
|
-
/* @__PURE__ */ (0,
|
|
5761
|
-
/* @__PURE__ */ (0,
|
|
6080
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6081
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
6082
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5762
6083
|
"button",
|
|
5763
6084
|
{
|
|
5764
6085
|
type: "button",
|
|
@@ -5769,13 +6090,13 @@ var ImageEditor = ({
|
|
|
5769
6090
|
},
|
|
5770
6091
|
t
|
|
5771
6092
|
)) }),
|
|
5772
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
5773
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
5774
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
5775
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
5776
|
-
/* @__PURE__ */ (0,
|
|
5777
|
-
/* @__PURE__ */ (0,
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
6093
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
6094
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
6095
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime31.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" }),
|
|
6096
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
6097
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
6098
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
6099
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5779
6100
|
"button",
|
|
5780
6101
|
{
|
|
5781
6102
|
type: "button",
|
|
@@ -5785,18 +6106,18 @@ var ImageEditor = ({
|
|
|
5785
6106
|
},
|
|
5786
6107
|
t
|
|
5787
6108
|
)) }),
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
5790
|
-
/* @__PURE__ */ (0,
|
|
5791
|
-
/* @__PURE__ */ (0,
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
6109
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
6110
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
6111
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
6112
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
6113
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
6114
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Width:" }),
|
|
6115
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5795
6116
|
strokeWidth,
|
|
5796
6117
|
"px"
|
|
5797
6118
|
] })
|
|
5798
6119
|
] }),
|
|
5799
|
-
/* @__PURE__ */ (0,
|
|
6120
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5800
6121
|
"input",
|
|
5801
6122
|
{
|
|
5802
6123
|
type: "range",
|
|
@@ -5809,10 +6130,10 @@ var ImageEditor = ({
|
|
|
5809
6130
|
)
|
|
5810
6131
|
] })
|
|
5811
6132
|
] }),
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
5813
|
-
/* @__PURE__ */ (0,
|
|
5814
|
-
/* @__PURE__ */ (0,
|
|
5815
|
-
/* @__PURE__ */ (0,
|
|
6133
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
6134
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
6135
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-2", children: [
|
|
6136
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5816
6137
|
"input",
|
|
5817
6138
|
{
|
|
5818
6139
|
type: "text",
|
|
@@ -5823,7 +6144,7 @@ var ImageEditor = ({
|
|
|
5823
6144
|
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"
|
|
5824
6145
|
}
|
|
5825
6146
|
),
|
|
5826
|
-
/* @__PURE__ */ (0,
|
|
6147
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5827
6148
|
"button",
|
|
5828
6149
|
{
|
|
5829
6150
|
type: "button",
|
|
@@ -5833,14 +6154,14 @@ var ImageEditor = ({
|
|
|
5833
6154
|
}
|
|
5834
6155
|
)
|
|
5835
6156
|
] }),
|
|
5836
|
-
/* @__PURE__ */ (0,
|
|
5837
|
-
/* @__PURE__ */ (0,
|
|
5838
|
-
/* @__PURE__ */ (0,
|
|
6157
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
6158
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Font Size:" }),
|
|
6159
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5839
6160
|
fontSize,
|
|
5840
6161
|
"px"
|
|
5841
6162
|
] })
|
|
5842
6163
|
] }),
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
6164
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5844
6165
|
"input",
|
|
5845
6166
|
{
|
|
5846
6167
|
type: "range",
|
|
@@ -5851,14 +6172,14 @@ var ImageEditor = ({
|
|
|
5851
6172
|
className: imageRangeClass
|
|
5852
6173
|
}
|
|
5853
6174
|
),
|
|
5854
|
-
/* @__PURE__ */ (0,
|
|
5855
|
-
/* @__PURE__ */ (0,
|
|
5856
|
-
/* @__PURE__ */ (0,
|
|
6175
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
6176
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6177
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5857
6178
|
"Layers (",
|
|
5858
6179
|
state.annotations.length,
|
|
5859
6180
|
")"
|
|
5860
6181
|
] }),
|
|
5861
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
6182
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5862
6183
|
"button",
|
|
5863
6184
|
{
|
|
5864
6185
|
type: "button",
|
|
@@ -5867,7 +6188,7 @@ var ImageEditor = ({
|
|
|
5867
6188
|
children: "Delete Selected"
|
|
5868
6189
|
}
|
|
5869
6190
|
),
|
|
5870
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
6191
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5871
6192
|
"button",
|
|
5872
6193
|
{
|
|
5873
6194
|
type: "button",
|
|
@@ -5878,10 +6199,10 @@ var ImageEditor = ({
|
|
|
5878
6199
|
)
|
|
5879
6200
|
] })
|
|
5880
6201
|
] }),
|
|
5881
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
5883
|
-
/* @__PURE__ */ (0,
|
|
5884
|
-
/* @__PURE__ */ (0,
|
|
6202
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6203
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6204
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
6205
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5885
6206
|
"button",
|
|
5886
6207
|
{
|
|
5887
6208
|
type: "button",
|
|
@@ -5891,8 +6212,8 @@ var ImageEditor = ({
|
|
|
5891
6212
|
}
|
|
5892
6213
|
)
|
|
5893
6214
|
] }),
|
|
5894
|
-
/* @__PURE__ */ (0,
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
6215
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
6216
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5896
6217
|
"input",
|
|
5897
6218
|
{
|
|
5898
6219
|
type: "checkbox",
|
|
@@ -5901,12 +6222,12 @@ var ImageEditor = ({
|
|
|
5901
6222
|
className: "rounded accent-primary"
|
|
5902
6223
|
}
|
|
5903
6224
|
),
|
|
5904
|
-
/* @__PURE__ */ (0,
|
|
6225
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
5905
6226
|
] }),
|
|
5906
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
5907
|
-
/* @__PURE__ */ (0,
|
|
5908
|
-
/* @__PURE__ */ (0,
|
|
5909
|
-
/* @__PURE__ */ (0,
|
|
6227
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6228
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6229
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
6230
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5910
6231
|
"input",
|
|
5911
6232
|
{
|
|
5912
6233
|
type: "text",
|
|
@@ -5917,8 +6238,8 @@ var ImageEditor = ({
|
|
|
5917
6238
|
}
|
|
5918
6239
|
)
|
|
5919
6240
|
] }),
|
|
5920
|
-
/* @__PURE__ */ (0,
|
|
5921
|
-
/* @__PURE__ */ (0,
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-2", children: [
|
|
6242
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5922
6243
|
"button",
|
|
5923
6244
|
{
|
|
5924
6245
|
type: "button",
|
|
@@ -5927,7 +6248,7 @@ var ImageEditor = ({
|
|
|
5927
6248
|
children: "Threshold Mode"
|
|
5928
6249
|
}
|
|
5929
6250
|
),
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5931
6252
|
"button",
|
|
5932
6253
|
{
|
|
5933
6254
|
type: "button",
|
|
@@ -5937,12 +6258,12 @@ var ImageEditor = ({
|
|
|
5937
6258
|
}
|
|
5938
6259
|
)
|
|
5939
6260
|
] }),
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
5942
|
-
/* @__PURE__ */ (0,
|
|
5943
|
-
/* @__PURE__ */ (0,
|
|
6261
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6262
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6263
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
6264
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5944
6265
|
] }),
|
|
5945
|
-
/* @__PURE__ */ (0,
|
|
6266
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5946
6267
|
"input",
|
|
5947
6268
|
{
|
|
5948
6269
|
type: "range",
|
|
@@ -5956,12 +6277,12 @@ var ImageEditor = ({
|
|
|
5956
6277
|
}
|
|
5957
6278
|
)
|
|
5958
6279
|
] }),
|
|
5959
|
-
/* @__PURE__ */ (0,
|
|
5960
|
-
/* @__PURE__ */ (0,
|
|
5961
|
-
/* @__PURE__ */ (0,
|
|
5962
|
-
/* @__PURE__ */ (0,
|
|
6280
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6281
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6282
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
6283
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5963
6284
|
] }),
|
|
5964
|
-
/* @__PURE__ */ (0,
|
|
6285
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5965
6286
|
"input",
|
|
5966
6287
|
{
|
|
5967
6288
|
type: "range",
|
|
@@ -5975,12 +6296,12 @@ var ImageEditor = ({
|
|
|
5975
6296
|
}
|
|
5976
6297
|
)
|
|
5977
6298
|
] }),
|
|
5978
|
-
/* @__PURE__ */ (0,
|
|
5979
|
-
/* @__PURE__ */ (0,
|
|
5980
|
-
/* @__PURE__ */ (0,
|
|
5981
|
-
/* @__PURE__ */ (0,
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6300
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6301
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Softness:" }),
|
|
6302
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5982
6303
|
] }),
|
|
5983
|
-
/* @__PURE__ */ (0,
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5984
6305
|
"input",
|
|
5985
6306
|
{
|
|
5986
6307
|
type: "range",
|
|
@@ -5992,8 +6313,8 @@ var ImageEditor = ({
|
|
|
5992
6313
|
}
|
|
5993
6314
|
)
|
|
5994
6315
|
] }),
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
6316
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
6317
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5997
6318
|
"input",
|
|
5998
6319
|
{
|
|
5999
6320
|
type: "checkbox",
|
|
@@ -6002,24 +6323,25 @@ var ImageEditor = ({
|
|
|
6002
6323
|
className: "rounded accent-primary"
|
|
6003
6324
|
}
|
|
6004
6325
|
),
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6326
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Invert Mask" })
|
|
6006
6327
|
] })
|
|
6007
6328
|
] })
|
|
6008
6329
|
] }),
|
|
6009
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
6010
|
-
/* @__PURE__ */ (0,
|
|
6330
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6331
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6011
6332
|
SelectionOptionsBar,
|
|
6012
6333
|
{
|
|
6013
6334
|
controller,
|
|
6014
6335
|
options: selectionOptions,
|
|
6015
6336
|
onOptionsChange: setSelectionOptions,
|
|
6016
6337
|
selection: state.selection ?? null,
|
|
6017
|
-
quickMask: Boolean(state.quickMask)
|
|
6338
|
+
quickMask: Boolean(state.quickMask),
|
|
6339
|
+
selectionDisplay: state.selectionDisplay
|
|
6018
6340
|
}
|
|
6019
6341
|
),
|
|
6020
|
-
selectionError && /* @__PURE__ */ (0,
|
|
6021
|
-
/* @__PURE__ */ (0,
|
|
6022
|
-
/* @__PURE__ */ (0,
|
|
6342
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
6343
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
6344
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6023
6345
|
"button",
|
|
6024
6346
|
{
|
|
6025
6347
|
type: "button",
|
|
@@ -6030,7 +6352,7 @@ var ImageEditor = ({
|
|
|
6030
6352
|
children: "Transform Selection"
|
|
6031
6353
|
}
|
|
6032
6354
|
),
|
|
6033
|
-
/* @__PURE__ */ (0,
|
|
6355
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6034
6356
|
"button",
|
|
6035
6357
|
{
|
|
6036
6358
|
type: "button",
|
|
@@ -6042,12 +6364,13 @@ var ImageEditor = ({
|
|
|
6042
6364
|
}
|
|
6043
6365
|
)
|
|
6044
6366
|
] }),
|
|
6045
|
-
/* @__PURE__ */ (0,
|
|
6367
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
6368
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChannelsPanel, { controller })
|
|
6046
6369
|
] }),
|
|
6047
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
6048
|
-
/* @__PURE__ */ (0,
|
|
6049
|
-
/* @__PURE__ */ (0,
|
|
6050
|
-
/* @__PURE__ */ (0,
|
|
6370
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6371
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
6372
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Results go to" }),
|
|
6373
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6051
6374
|
"select",
|
|
6052
6375
|
{
|
|
6053
6376
|
"aria-label": "AI result target",
|
|
@@ -6055,54 +6378,54 @@ var ImageEditor = ({
|
|
|
6055
6378
|
onChange: (e) => setAiTarget(e.target.value),
|
|
6056
6379
|
className: imageSelectClass,
|
|
6057
6380
|
children: [
|
|
6058
|
-
/* @__PURE__ */ (0,
|
|
6059
|
-
/* @__PURE__ */ (0,
|
|
6060
|
-
/* @__PURE__ */ (0,
|
|
6381
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
6382
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
6383
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "replace", children: "Replace image" })
|
|
6061
6384
|
]
|
|
6062
6385
|
}
|
|
6063
6386
|
)
|
|
6064
6387
|
] }),
|
|
6065
|
-
/* @__PURE__ */ (0,
|
|
6066
|
-
/* @__PURE__ */ (0,
|
|
6067
|
-
/* @__PURE__ */ (0,
|
|
6068
|
-
/* @__PURE__ */ (0,
|
|
6388
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
6389
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6390
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
6391
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.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" }) }),
|
|
6069
6392
|
"Background Removal"
|
|
6070
6393
|
] }),
|
|
6071
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
6394
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime31.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..." })
|
|
6072
6395
|
] }),
|
|
6073
|
-
/* @__PURE__ */ (0,
|
|
6074
|
-
/* @__PURE__ */ (0,
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6075
6398
|
"button",
|
|
6076
6399
|
{
|
|
6077
6400
|
type: "button",
|
|
6078
6401
|
onClick: handleRemoveBackground,
|
|
6079
6402
|
disabled: isRemovingBg || isInpainting,
|
|
6080
6403
|
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",
|
|
6081
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
6082
|
-
/* @__PURE__ */ (0,
|
|
6404
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6405
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSpinnerClass }),
|
|
6083
6406
|
"Removing Background..."
|
|
6084
|
-
] }) : /* @__PURE__ */ (0,
|
|
6085
|
-
/* @__PURE__ */ (0,
|
|
6407
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6408
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.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" }) }),
|
|
6086
6409
|
"Remove Background"
|
|
6087
6410
|
] })
|
|
6088
6411
|
}
|
|
6089
6412
|
)
|
|
6090
6413
|
] }),
|
|
6091
|
-
/* @__PURE__ */ (0,
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
/* @__PURE__ */ (0,
|
|
6094
|
-
/* @__PURE__ */ (0,
|
|
6095
|
-
/* @__PURE__ */ (0,
|
|
6096
|
-
/* @__PURE__ */ (0,
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
6415
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6416
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
6417
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
6418
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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" }),
|
|
6419
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { d: "m14 7 3 3" })
|
|
6097
6420
|
] }),
|
|
6098
6421
|
"Generative Inpainting"
|
|
6099
6422
|
] }),
|
|
6100
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
6423
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime31.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..." })
|
|
6101
6424
|
] }),
|
|
6102
|
-
/* @__PURE__ */ (0,
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6104
|
-
/* @__PURE__ */ (0,
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6425
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
6426
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
6427
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
6428
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6106
6429
|
"textarea",
|
|
6107
6430
|
{
|
|
6108
6431
|
id: "ai-inpaint-prompt-react",
|
|
@@ -6114,10 +6437,10 @@ var ImageEditor = ({
|
|
|
6114
6437
|
}
|
|
6115
6438
|
)
|
|
6116
6439
|
] }),
|
|
6117
|
-
/* @__PURE__ */ (0,
|
|
6118
|
-
/* @__PURE__ */ (0,
|
|
6119
|
-
/* @__PURE__ */ (0,
|
|
6120
|
-
/* @__PURE__ */ (0,
|
|
6440
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
6441
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
6442
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
6443
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6121
6444
|
"button",
|
|
6122
6445
|
{
|
|
6123
6446
|
type: "button",
|
|
@@ -6130,7 +6453,7 @@ var ImageEditor = ({
|
|
|
6130
6453
|
]
|
|
6131
6454
|
}
|
|
6132
6455
|
),
|
|
6133
|
-
/* @__PURE__ */ (0,
|
|
6456
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6134
6457
|
"button",
|
|
6135
6458
|
{
|
|
6136
6459
|
type: "button",
|
|
@@ -6145,25 +6468,25 @@ var ImageEditor = ({
|
|
|
6145
6468
|
)
|
|
6146
6469
|
] })
|
|
6147
6470
|
] }),
|
|
6148
|
-
/* @__PURE__ */ (0,
|
|
6471
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6149
6472
|
"button",
|
|
6150
6473
|
{
|
|
6151
6474
|
type: "button",
|
|
6152
6475
|
onClick: handleInpaint,
|
|
6153
6476
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
6154
6477
|
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",
|
|
6155
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
6156
|
-
/* @__PURE__ */ (0,
|
|
6478
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6479
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSpinnerClass }),
|
|
6157
6480
|
"Generating Inpaint..."
|
|
6158
|
-
] }) : /* @__PURE__ */ (0,
|
|
6159
|
-
/* @__PURE__ */ (0,
|
|
6481
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6482
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.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" }) }),
|
|
6160
6483
|
"Apply Inpainting"
|
|
6161
6484
|
] })
|
|
6162
6485
|
}
|
|
6163
6486
|
)
|
|
6164
6487
|
] }),
|
|
6165
|
-
aiError && /* @__PURE__ */ (0,
|
|
6166
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
6488
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
6489
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
6167
6490
|
] })
|
|
6168
6491
|
] })
|
|
6169
6492
|
] })
|
|
@@ -6175,6 +6498,7 @@ var ImageEditor = ({
|
|
|
6175
6498
|
0 && (module.exports = {
|
|
6176
6499
|
AdjustmentLayersPanel,
|
|
6177
6500
|
BrushOptionsBar,
|
|
6501
|
+
ChannelsPanel,
|
|
6178
6502
|
ColorProfilePanel,
|
|
6179
6503
|
ControlSlider,
|
|
6180
6504
|
CurvesEditor,
|