@pixerate/editor-react 0.121.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-CQXZVIV7.js → chunk-VR3JON4V.js} +417 -295
- package/dist/image-editor/ChannelsPanel.d.cts +15 -0
- package/dist/image-editor/ChannelsPanel.d.ts +15 -0
- package/dist/image-editor/index.cjs +425 -303
- 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 +945 -823
- 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");
|
|
@@ -703,6 +704,10 @@ var ImageEditorCanvas = ({
|
|
|
703
704
|
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
704
705
|
if (window.getSelection?.()?.toString()) return;
|
|
705
706
|
const gesture = selectionGestureRef.current;
|
|
707
|
+
if ((0, import_image_editor2.handleQuickMaskKey)(controller, e)) {
|
|
708
|
+
e.preventDefault();
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
706
711
|
if ((0, import_image_editor2.handleSelectionShortcut)(controller, e, (message) => report("select", message))) {
|
|
707
712
|
e.preventDefault();
|
|
708
713
|
return;
|
|
@@ -5036,14 +5041,129 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5036
5041
|
] });
|
|
5037
5042
|
};
|
|
5038
5043
|
|
|
5039
|
-
// src/image-editor/
|
|
5044
|
+
// src/image-editor/ChannelsPanel.tsx
|
|
5040
5045
|
var import_react27 = require("react");
|
|
5041
5046
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
5042
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");
|
|
5043
5163
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
5044
5164
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
5045
|
-
const [, setTick] = (0,
|
|
5046
|
-
(0,
|
|
5165
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
5166
|
+
(0, import_react28.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
5047
5167
|
const bar = tool.bar();
|
|
5048
5168
|
if (!tool.active || !bar) return null;
|
|
5049
5169
|
const warp = tool.warpBar();
|
|
@@ -5055,17 +5175,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5055
5175
|
const v = Number(raw);
|
|
5056
5176
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
5057
5177
|
};
|
|
5058
|
-
return /* @__PURE__ */ (0,
|
|
5059
|
-
/* @__PURE__ */ (0,
|
|
5060
|
-
/* @__PURE__ */ (0,
|
|
5061
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
5062
|
-
/* @__PURE__ */ (0,
|
|
5063
|
-
/* @__PURE__ */ (0,
|
|
5064
|
-
/* @__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)) })
|
|
5065
5185
|
] }),
|
|
5066
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
5067
|
-
/* @__PURE__ */ (0,
|
|
5068
|
-
/* @__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)(
|
|
5069
5189
|
"input",
|
|
5070
5190
|
{
|
|
5071
5191
|
type: "number",
|
|
@@ -5086,9 +5206,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5086
5206
|
},
|
|
5087
5207
|
`${k}:${warp[k]}`
|
|
5088
5208
|
),
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5209
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
5090
5210
|
] }, k)),
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5092
5212
|
"button",
|
|
5093
5213
|
{
|
|
5094
5214
|
type: "button",
|
|
@@ -5100,26 +5220,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5100
5220
|
children: "Vertical"
|
|
5101
5221
|
}
|
|
5102
5222
|
),
|
|
5103
|
-
/* @__PURE__ */ (0,
|
|
5104
|
-
/* @__PURE__ */ (0,
|
|
5105
|
-
/* @__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)(
|
|
5106
5226
|
"select",
|
|
5107
5227
|
{
|
|
5108
5228
|
"aria-label": "Warp grid",
|
|
5109
|
-
value:
|
|
5229
|
+
value: import_image_editor17.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
5110
5230
|
onChange: (e) => {
|
|
5111
|
-
const g =
|
|
5231
|
+
const g = import_image_editor17.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
5112
5232
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
5113
5233
|
},
|
|
5114
5234
|
className: imageFieldClass,
|
|
5115
|
-
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))
|
|
5116
5236
|
}
|
|
5117
5237
|
)
|
|
5118
5238
|
] })
|
|
5119
5239
|
] }),
|
|
5120
|
-
tool.mode !== "warp" &&
|
|
5121
|
-
/* @__PURE__ */ (0,
|
|
5122
|
-
/* @__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)(
|
|
5123
5243
|
"input",
|
|
5124
5244
|
{
|
|
5125
5245
|
type: "number",
|
|
@@ -5139,8 +5259,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5139
5259
|
},
|
|
5140
5260
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
5141
5261
|
),
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5143
|
-
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)(
|
|
5144
5264
|
"button",
|
|
5145
5265
|
{
|
|
5146
5266
|
type: "button",
|
|
@@ -5155,33 +5275,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5155
5275
|
}
|
|
5156
5276
|
)
|
|
5157
5277
|
] }, f.id)),
|
|
5158
|
-
/* @__PURE__ */ (0,
|
|
5159
|
-
/* @__PURE__ */ (0,
|
|
5160
|
-
/* @__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)(
|
|
5161
5281
|
"select",
|
|
5162
5282
|
{
|
|
5163
5283
|
"aria-label": "Interpolation",
|
|
5164
5284
|
value: tool.interpolation,
|
|
5165
5285
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
5166
5286
|
className: imageFieldClass,
|
|
5167
|
-
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))
|
|
5168
5288
|
}
|
|
5169
5289
|
)
|
|
5170
5290
|
] }),
|
|
5171
|
-
/* @__PURE__ */ (0,
|
|
5172
|
-
/* @__PURE__ */ (0,
|
|
5173
|
-
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 })
|
|
5174
5294
|
] });
|
|
5175
5295
|
};
|
|
5176
5296
|
|
|
5177
5297
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
5178
|
-
var
|
|
5179
|
-
var
|
|
5180
|
-
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");
|
|
5181
5301
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
5182
|
-
const [, setTick] = (0,
|
|
5183
|
-
(0,
|
|
5184
|
-
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);
|
|
5185
5305
|
const active = controller.getActiveLayer();
|
|
5186
5306
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
5187
5307
|
const set = (change) => {
|
|
@@ -5189,28 +5309,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5189
5309
|
if (!shapeId) return;
|
|
5190
5310
|
try {
|
|
5191
5311
|
setError(null);
|
|
5192
|
-
(0,
|
|
5312
|
+
(0, import_image_editor18.applyShapeOptions)(controller, shapeId, change);
|
|
5193
5313
|
} catch (e) {
|
|
5194
5314
|
setError(e instanceof Error ? e.message : String(e));
|
|
5195
5315
|
}
|
|
5196
5316
|
};
|
|
5197
5317
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
5198
|
-
return /* @__PURE__ */ (0,
|
|
5199
|
-
/* @__PURE__ */ (0,
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5201
|
-
/* @__PURE__ */ (0,
|
|
5202
|
-
/* @__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 }) }),
|
|
5203
5323
|
"Fill",
|
|
5204
|
-
/* @__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 }) })
|
|
5205
5325
|
] }),
|
|
5206
|
-
/* @__PURE__ */ (0,
|
|
5207
|
-
/* @__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 }) }),
|
|
5208
5328
|
"Stroke",
|
|
5209
|
-
/* @__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 }) })
|
|
5210
5330
|
] }),
|
|
5211
|
-
/* @__PURE__ */ (0,
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5212
5332
|
"Width",
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5214
5334
|
"input",
|
|
5215
5335
|
{
|
|
5216
5336
|
type: "number",
|
|
@@ -5224,51 +5344,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5224
5344
|
)
|
|
5225
5345
|
] })
|
|
5226
5346
|
] }),
|
|
5227
|
-
/* @__PURE__ */ (0,
|
|
5228
|
-
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: [
|
|
5229
5349
|
"Radius",
|
|
5230
|
-
/* @__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}` })
|
|
5231
5351
|
] }),
|
|
5232
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
5352
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5233
5353
|
"Sides",
|
|
5234
|
-
/* @__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}` })
|
|
5235
5355
|
] }),
|
|
5236
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
5237
|
-
/* @__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: [
|
|
5238
5358
|
"Points",
|
|
5239
|
-
/* @__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}` })
|
|
5240
5360
|
] }),
|
|
5241
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5242
5362
|
"Inner",
|
|
5243
|
-
/* @__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 }) })
|
|
5244
5364
|
] })
|
|
5245
5365
|
] }),
|
|
5246
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
5247
|
-
/* @__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: [
|
|
5248
5368
|
"Weight",
|
|
5249
|
-
/* @__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}` })
|
|
5250
5370
|
] }),
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5252
|
-
/* @__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 }) }),
|
|
5253
5373
|
"Arrowhead"
|
|
5254
5374
|
] })
|
|
5255
5375
|
] })
|
|
5256
5376
|
] }),
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
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 })
|
|
5259
5379
|
] });
|
|
5260
5380
|
};
|
|
5261
5381
|
|
|
5262
5382
|
// src/image-editor/TypeOptionsBar.tsx
|
|
5263
|
-
var
|
|
5264
|
-
var
|
|
5265
|
-
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");
|
|
5266
5386
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
5267
5387
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
5268
|
-
const [, setTick] = (0,
|
|
5269
|
-
(0,
|
|
5270
|
-
(0,
|
|
5271
|
-
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);
|
|
5272
5392
|
const active = controller.getActiveLayer();
|
|
5273
5393
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
5274
5394
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -5300,11 +5420,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5300
5420
|
setError(e instanceof Error ? e.message : String(e));
|
|
5301
5421
|
}
|
|
5302
5422
|
};
|
|
5303
|
-
return /* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5305
|
-
/* @__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: [
|
|
5306
5426
|
"Font",
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5308
5428
|
"input",
|
|
5309
5429
|
{
|
|
5310
5430
|
list: "pixerate-type-fonts",
|
|
@@ -5314,11 +5434,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5314
5434
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
5315
5435
|
}
|
|
5316
5436
|
),
|
|
5317
|
-
/* @__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)) })
|
|
5318
5438
|
] }),
|
|
5319
|
-
/* @__PURE__ */ (0,
|
|
5439
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5320
5440
|
"Size",
|
|
5321
|
-
/* @__PURE__ */ (0,
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5322
5442
|
"input",
|
|
5323
5443
|
{
|
|
5324
5444
|
type: "number",
|
|
@@ -5331,24 +5451,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5331
5451
|
}
|
|
5332
5452
|
)
|
|
5333
5453
|
] }),
|
|
5334
|
-
/* @__PURE__ */ (0,
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5336
|
-
/* @__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 }) })
|
|
5337
5457
|
] }),
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
5339
|
-
/* @__PURE__ */ (0,
|
|
5340
|
-
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: [
|
|
5341
5461
|
"Missing ",
|
|
5342
5462
|
missing.length === 1 ? "font" : "fonts",
|
|
5343
5463
|
": ",
|
|
5344
5464
|
missing.join(", ")
|
|
5345
5465
|
] }),
|
|
5346
|
-
error && /* @__PURE__ */ (0,
|
|
5466
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5347
5467
|
] });
|
|
5348
5468
|
};
|
|
5349
5469
|
|
|
5350
5470
|
// src/image-editor/ImageEditor.tsx
|
|
5351
|
-
var
|
|
5471
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5352
5472
|
var ImageEditor = ({
|
|
5353
5473
|
editor: externalEditor,
|
|
5354
5474
|
src,
|
|
@@ -5372,51 +5492,51 @@ var ImageEditor = ({
|
|
|
5372
5492
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
5373
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);
|
|
5374
5494
|
});
|
|
5375
|
-
const legacyProcess = (0,
|
|
5376
|
-
const [activeTab, setActiveTab] = (0,
|
|
5377
|
-
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);
|
|
5378
5498
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
5379
|
-
const activeTabRef = (0,
|
|
5499
|
+
const activeTabRef = (0, import_react31.useRef)(activeTab);
|
|
5380
5500
|
activeTabRef.current = activeTab;
|
|
5381
5501
|
const openPanel = async (ref) => {
|
|
5382
5502
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
5383
5503
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
5384
5504
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
5385
5505
|
};
|
|
5386
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
5387
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
5388
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
5389
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
5390
|
-
const [typeSession, setTypeSession] = (0,
|
|
5391
|
-
const [selectionError, setSelectionError] = (0,
|
|
5392
|
-
const [paintError, setPaintError] = (0,
|
|
5393
|
-
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);
|
|
5394
5514
|
const handleCanvasError = (source, message) => {
|
|
5395
5515
|
if (source === "paint") setPaintError(message);
|
|
5396
5516
|
else if (source === "select") setSelectionError(message);
|
|
5397
5517
|
else setShapeTypeError(message);
|
|
5398
5518
|
};
|
|
5399
5519
|
const finishTyping = () => setTypeSession(null);
|
|
5400
|
-
const transformToolRef = (0,
|
|
5401
|
-
const transformControllerRef = (0,
|
|
5520
|
+
const transformToolRef = (0, import_react31.useRef)(null);
|
|
5521
|
+
const transformControllerRef = (0, import_react31.useRef)(controller);
|
|
5402
5522
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
5403
5523
|
transformToolRef.current?.cancel();
|
|
5404
|
-
transformToolRef.current = new
|
|
5524
|
+
transformToolRef.current = new import_image_editor20.FreeTransformTool(controller, {
|
|
5405
5525
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
5406
5526
|
});
|
|
5407
5527
|
transformControllerRef.current = controller;
|
|
5408
5528
|
}
|
|
5409
5529
|
const transformTool = transformToolRef.current;
|
|
5410
|
-
const [, setTransformTick] = (0,
|
|
5411
|
-
(0,
|
|
5412
|
-
(0,
|
|
5413
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
5414
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
5415
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
5416
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
5417
|
-
const [aiError, setAiError] = (0,
|
|
5418
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
5419
|
-
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");
|
|
5420
5540
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
5421
5541
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
5422
5542
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5479,11 +5599,11 @@ var ImageEditor = ({
|
|
|
5479
5599
|
setIsInpainting(false);
|
|
5480
5600
|
}
|
|
5481
5601
|
};
|
|
5482
|
-
const [activeColor, setActiveColor] = (0,
|
|
5483
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5484
|
-
const [fontSize, setFontSize] = (0,
|
|
5485
|
-
const [textInput, setTextInput] = (0,
|
|
5486
|
-
(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)(() => {
|
|
5487
5607
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5488
5608
|
editor.setTool("crop");
|
|
5489
5609
|
}
|
|
@@ -5511,16 +5631,16 @@ var ImageEditor = ({
|
|
|
5511
5631
|
link.click();
|
|
5512
5632
|
}
|
|
5513
5633
|
};
|
|
5514
|
-
return /* @__PURE__ */ (0,
|
|
5634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5515
5635
|
"div",
|
|
5516
5636
|
{
|
|
5517
5637
|
ref: rootRef,
|
|
5518
5638
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5519
5639
|
style,
|
|
5520
5640
|
children: [
|
|
5521
|
-
/* @__PURE__ */ (0,
|
|
5522
|
-
/* @__PURE__ */ (0,
|
|
5523
|
-
/* @__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)(
|
|
5524
5644
|
"button",
|
|
5525
5645
|
{
|
|
5526
5646
|
type: "button",
|
|
@@ -5535,7 +5655,7 @@ var ImageEditor = ({
|
|
|
5535
5655
|
children: "Transform & Crop"
|
|
5536
5656
|
}
|
|
5537
5657
|
),
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5539
5659
|
"button",
|
|
5540
5660
|
{
|
|
5541
5661
|
type: "button",
|
|
@@ -5550,7 +5670,7 @@ var ImageEditor = ({
|
|
|
5550
5670
|
children: "Adjustments"
|
|
5551
5671
|
}
|
|
5552
5672
|
),
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5673
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5554
5674
|
"button",
|
|
5555
5675
|
{
|
|
5556
5676
|
type: "button",
|
|
@@ -5565,7 +5685,7 @@ var ImageEditor = ({
|
|
|
5565
5685
|
children: "Layers"
|
|
5566
5686
|
}
|
|
5567
5687
|
),
|
|
5568
|
-
/* @__PURE__ */ (0,
|
|
5688
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5569
5689
|
"button",
|
|
5570
5690
|
{
|
|
5571
5691
|
type: "button",
|
|
@@ -5580,7 +5700,7 @@ var ImageEditor = ({
|
|
|
5580
5700
|
children: "Paint"
|
|
5581
5701
|
}
|
|
5582
5702
|
),
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5584
5704
|
"button",
|
|
5585
5705
|
{
|
|
5586
5706
|
type: "button",
|
|
@@ -5595,7 +5715,7 @@ var ImageEditor = ({
|
|
|
5595
5715
|
children: "Select & Mask"
|
|
5596
5716
|
}
|
|
5597
5717
|
),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5599
5719
|
"button",
|
|
5600
5720
|
{
|
|
5601
5721
|
type: "button",
|
|
@@ -5610,7 +5730,7 @@ var ImageEditor = ({
|
|
|
5610
5730
|
children: "Annotations"
|
|
5611
5731
|
}
|
|
5612
5732
|
),
|
|
5613
|
-
/* @__PURE__ */ (0,
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5614
5734
|
"button",
|
|
5615
5735
|
{
|
|
5616
5736
|
type: "button",
|
|
@@ -5625,7 +5745,7 @@ var ImageEditor = ({
|
|
|
5625
5745
|
children: "Depth Mask"
|
|
5626
5746
|
}
|
|
5627
5747
|
),
|
|
5628
|
-
/* @__PURE__ */ (0,
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5629
5749
|
"button",
|
|
5630
5750
|
{
|
|
5631
5751
|
type: "button",
|
|
@@ -5638,14 +5758,14 @@ var ImageEditor = ({
|
|
|
5638
5758
|
"aria-selected": activeTab === "ai",
|
|
5639
5759
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5640
5760
|
children: [
|
|
5641
|
-
/* @__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" }) }),
|
|
5642
5762
|
"AI Tools"
|
|
5643
5763
|
]
|
|
5644
5764
|
}
|
|
5645
5765
|
)
|
|
5646
5766
|
] }),
|
|
5647
|
-
/* @__PURE__ */ (0,
|
|
5648
|
-
/* @__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)(
|
|
5649
5769
|
"button",
|
|
5650
5770
|
{
|
|
5651
5771
|
type: "button",
|
|
@@ -5656,7 +5776,7 @@ var ImageEditor = ({
|
|
|
5656
5776
|
children: "\u21A9"
|
|
5657
5777
|
}
|
|
5658
5778
|
),
|
|
5659
|
-
/* @__PURE__ */ (0,
|
|
5779
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5660
5780
|
"button",
|
|
5661
5781
|
{
|
|
5662
5782
|
type: "button",
|
|
@@ -5667,7 +5787,7 @@ var ImageEditor = ({
|
|
|
5667
5787
|
children: "\u21AA"
|
|
5668
5788
|
}
|
|
5669
5789
|
),
|
|
5670
|
-
/* @__PURE__ */ (0,
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5671
5791
|
"button",
|
|
5672
5792
|
{
|
|
5673
5793
|
type: "button",
|
|
@@ -5676,8 +5796,8 @@ var ImageEditor = ({
|
|
|
5676
5796
|
children: "Reset"
|
|
5677
5797
|
}
|
|
5678
5798
|
),
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
/* @__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)(
|
|
5681
5801
|
"button",
|
|
5682
5802
|
{
|
|
5683
5803
|
type: "button",
|
|
@@ -5687,11 +5807,11 @@ var ImageEditor = ({
|
|
|
5687
5807
|
children: "-"
|
|
5688
5808
|
}
|
|
5689
5809
|
),
|
|
5690
|
-
/* @__PURE__ */ (0,
|
|
5810
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5691
5811
|
Math.round(state.zoom * 100),
|
|
5692
5812
|
"%"
|
|
5693
5813
|
] }),
|
|
5694
|
-
/* @__PURE__ */ (0,
|
|
5814
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5695
5815
|
"button",
|
|
5696
5816
|
{
|
|
5697
5817
|
type: "button",
|
|
@@ -5701,8 +5821,8 @@ var ImageEditor = ({
|
|
|
5701
5821
|
children: "+"
|
|
5702
5822
|
}
|
|
5703
5823
|
),
|
|
5704
|
-
/* @__PURE__ */ (0,
|
|
5705
|
-
/* @__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)(
|
|
5706
5826
|
"button",
|
|
5707
5827
|
{
|
|
5708
5828
|
type: "button",
|
|
@@ -5713,7 +5833,7 @@ var ImageEditor = ({
|
|
|
5713
5833
|
children: "Hold Compare"
|
|
5714
5834
|
}
|
|
5715
5835
|
),
|
|
5716
|
-
/* @__PURE__ */ (0,
|
|
5836
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5717
5837
|
"button",
|
|
5718
5838
|
{
|
|
5719
5839
|
type: "button",
|
|
@@ -5724,10 +5844,10 @@ var ImageEditor = ({
|
|
|
5724
5844
|
)
|
|
5725
5845
|
] })
|
|
5726
5846
|
] }),
|
|
5727
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
5728
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
5729
|
-
/* @__PURE__ */ (0,
|
|
5730
|
-
/* @__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)(
|
|
5731
5851
|
ImageEditorCanvas,
|
|
5732
5852
|
{
|
|
5733
5853
|
editor,
|
|
@@ -5751,11 +5871,11 @@ var ImageEditor = ({
|
|
|
5751
5871
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5752
5872
|
}
|
|
5753
5873
|
),
|
|
5754
|
-
/* @__PURE__ */ (0,
|
|
5755
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
5757
|
-
/* @__PURE__ */ (0,
|
|
5758
|
-
/* @__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)(
|
|
5759
5879
|
"button",
|
|
5760
5880
|
{
|
|
5761
5881
|
type: "button",
|
|
@@ -5767,7 +5887,7 @@ var ImageEditor = ({
|
|
|
5767
5887
|
children: "Freeform"
|
|
5768
5888
|
}
|
|
5769
5889
|
),
|
|
5770
|
-
/* @__PURE__ */ (0,
|
|
5890
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5771
5891
|
"button",
|
|
5772
5892
|
{
|
|
5773
5893
|
type: "button",
|
|
@@ -5779,7 +5899,7 @@ var ImageEditor = ({
|
|
|
5779
5899
|
children: "1:1 Square"
|
|
5780
5900
|
}
|
|
5781
5901
|
),
|
|
5782
|
-
/* @__PURE__ */ (0,
|
|
5902
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5783
5903
|
"button",
|
|
5784
5904
|
{
|
|
5785
5905
|
type: "button",
|
|
@@ -5791,7 +5911,7 @@ var ImageEditor = ({
|
|
|
5791
5911
|
children: "4:3 Standard"
|
|
5792
5912
|
}
|
|
5793
5913
|
),
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5795
5915
|
"button",
|
|
5796
5916
|
{
|
|
5797
5917
|
type: "button",
|
|
@@ -5803,7 +5923,7 @@ var ImageEditor = ({
|
|
|
5803
5923
|
children: "16:9 Wide"
|
|
5804
5924
|
}
|
|
5805
5925
|
),
|
|
5806
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5807
5927
|
"button",
|
|
5808
5928
|
{
|
|
5809
5929
|
type: "button",
|
|
@@ -5815,7 +5935,7 @@ var ImageEditor = ({
|
|
|
5815
5935
|
children: "3:2 Photo"
|
|
5816
5936
|
}
|
|
5817
5937
|
),
|
|
5818
|
-
/* @__PURE__ */ (0,
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5819
5939
|
"button",
|
|
5820
5940
|
{
|
|
5821
5941
|
type: "button",
|
|
@@ -5828,10 +5948,10 @@ var ImageEditor = ({
|
|
|
5828
5948
|
}
|
|
5829
5949
|
)
|
|
5830
5950
|
] }),
|
|
5831
|
-
/* @__PURE__ */ (0,
|
|
5832
|
-
/* @__PURE__ */ (0,
|
|
5833
|
-
/* @__PURE__ */ (0,
|
|
5834
|
-
/* @__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)(
|
|
5835
5955
|
"button",
|
|
5836
5956
|
{
|
|
5837
5957
|
type: "button",
|
|
@@ -5840,7 +5960,7 @@ var ImageEditor = ({
|
|
|
5840
5960
|
children: "Rotate -90\xB0"
|
|
5841
5961
|
}
|
|
5842
5962
|
),
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5963
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5844
5964
|
"button",
|
|
5845
5965
|
{
|
|
5846
5966
|
type: "button",
|
|
@@ -5849,7 +5969,7 @@ var ImageEditor = ({
|
|
|
5849
5969
|
children: "Rotate +90\xB0"
|
|
5850
5970
|
}
|
|
5851
5971
|
),
|
|
5852
|
-
/* @__PURE__ */ (0,
|
|
5972
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5853
5973
|
"button",
|
|
5854
5974
|
{
|
|
5855
5975
|
type: "button",
|
|
@@ -5858,7 +5978,7 @@ var ImageEditor = ({
|
|
|
5858
5978
|
children: "Flip Horizontal"
|
|
5859
5979
|
}
|
|
5860
5980
|
),
|
|
5861
|
-
/* @__PURE__ */ (0,
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5862
5982
|
"button",
|
|
5863
5983
|
{
|
|
5864
5984
|
type: "button",
|
|
@@ -5869,10 +5989,10 @@ var ImageEditor = ({
|
|
|
5869
5989
|
)
|
|
5870
5990
|
] })
|
|
5871
5991
|
] }),
|
|
5872
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5874
|
-
/* @__PURE__ */ (0,
|
|
5875
|
-
/* @__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)(
|
|
5876
5996
|
"button",
|
|
5877
5997
|
{
|
|
5878
5998
|
type: "button",
|
|
@@ -5882,25 +6002,25 @@ var ImageEditor = ({
|
|
|
5882
6002
|
}
|
|
5883
6003
|
)
|
|
5884
6004
|
] }),
|
|
5885
|
-
/* @__PURE__ */ (0,
|
|
5886
|
-
|
|
5887
|
-
/* @__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)(
|
|
5888
6008
|
ControlSlider,
|
|
5889
6009
|
{
|
|
5890
6010
|
spec,
|
|
5891
|
-
value: (0,
|
|
6011
|
+
value: (0, import_image_editor20.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
5892
6012
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
5893
6013
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5894
6014
|
}
|
|
5895
6015
|
),
|
|
5896
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6016
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5897
6017
|
"div",
|
|
5898
6018
|
{
|
|
5899
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",
|
|
5900
6020
|
"data-testid": "image-editor-process-notice",
|
|
5901
6021
|
children: [
|
|
5902
|
-
/* @__PURE__ */ (0,
|
|
5903
|
-
/* @__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)(
|
|
5904
6024
|
"button",
|
|
5905
6025
|
{
|
|
5906
6026
|
type: "button",
|
|
@@ -5913,7 +6033,7 @@ var ImageEditor = ({
|
|
|
5913
6033
|
}
|
|
5914
6034
|
)
|
|
5915
6035
|
] }, spec.id)),
|
|
5916
|
-
/* @__PURE__ */ (0,
|
|
6036
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5917
6037
|
AdjustmentLayersPanel,
|
|
5918
6038
|
{
|
|
5919
6039
|
controller,
|
|
@@ -5922,9 +6042,9 @@ var ImageEditor = ({
|
|
|
5922
6042
|
}
|
|
5923
6043
|
) })
|
|
5924
6044
|
] }),
|
|
5925
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
5926
|
-
/* @__PURE__ */ (0,
|
|
5927
|
-
/* @__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)(
|
|
5928
6048
|
"button",
|
|
5929
6049
|
{
|
|
5930
6050
|
type: "button",
|
|
@@ -5935,15 +6055,15 @@ var ImageEditor = ({
|
|
|
5935
6055
|
children: "Free Transform"
|
|
5936
6056
|
}
|
|
5937
6057
|
),
|
|
5938
|
-
/* @__PURE__ */ (0,
|
|
5939
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
5941
|
-
/* @__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 })
|
|
5942
6062
|
] }),
|
|
5943
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
5944
|
-
/* @__PURE__ */ (0,
|
|
5945
|
-
/* @__PURE__ */ (0,
|
|
5946
|
-
/* @__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)(
|
|
5947
6067
|
"button",
|
|
5948
6068
|
{
|
|
5949
6069
|
type: "button",
|
|
@@ -5954,12 +6074,12 @@ var ImageEditor = ({
|
|
|
5954
6074
|
children: "Free Transform"
|
|
5955
6075
|
}
|
|
5956
6076
|
),
|
|
5957
|
-
paintError && /* @__PURE__ */ (0,
|
|
5958
|
-
/* @__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 }) })
|
|
5959
6079
|
] }),
|
|
5960
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
5961
|
-
/* @__PURE__ */ (0,
|
|
5962
|
-
/* @__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)(
|
|
5963
6083
|
"button",
|
|
5964
6084
|
{
|
|
5965
6085
|
type: "button",
|
|
@@ -5970,13 +6090,13 @@ var ImageEditor = ({
|
|
|
5970
6090
|
},
|
|
5971
6091
|
t
|
|
5972
6092
|
)) }),
|
|
5973
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
5974
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
5975
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
5976
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
5977
|
-
/* @__PURE__ */ (0,
|
|
5978
|
-
/* @__PURE__ */ (0,
|
|
5979
|
-
/* @__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)(
|
|
5980
6100
|
"button",
|
|
5981
6101
|
{
|
|
5982
6102
|
type: "button",
|
|
@@ -5986,18 +6106,18 @@ var ImageEditor = ({
|
|
|
5986
6106
|
},
|
|
5987
6107
|
t
|
|
5988
6108
|
)) }),
|
|
5989
|
-
/* @__PURE__ */ (0,
|
|
5990
|
-
/* @__PURE__ */ (0,
|
|
5991
|
-
/* @__PURE__ */ (0,
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
5993
|
-
/* @__PURE__ */ (0,
|
|
5994
|
-
/* @__PURE__ */ (0,
|
|
5995
|
-
/* @__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: [
|
|
5996
6116
|
strokeWidth,
|
|
5997
6117
|
"px"
|
|
5998
6118
|
] })
|
|
5999
6119
|
] }),
|
|
6000
|
-
/* @__PURE__ */ (0,
|
|
6120
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6001
6121
|
"input",
|
|
6002
6122
|
{
|
|
6003
6123
|
type: "range",
|
|
@@ -6010,10 +6130,10 @@ var ImageEditor = ({
|
|
|
6010
6130
|
)
|
|
6011
6131
|
] })
|
|
6012
6132
|
] }),
|
|
6013
|
-
/* @__PURE__ */ (0,
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6015
|
-
/* @__PURE__ */ (0,
|
|
6016
|
-
/* @__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)(
|
|
6017
6137
|
"input",
|
|
6018
6138
|
{
|
|
6019
6139
|
type: "text",
|
|
@@ -6024,7 +6144,7 @@ var ImageEditor = ({
|
|
|
6024
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"
|
|
6025
6145
|
}
|
|
6026
6146
|
),
|
|
6027
|
-
/* @__PURE__ */ (0,
|
|
6147
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6028
6148
|
"button",
|
|
6029
6149
|
{
|
|
6030
6150
|
type: "button",
|
|
@@ -6034,14 +6154,14 @@ var ImageEditor = ({
|
|
|
6034
6154
|
}
|
|
6035
6155
|
)
|
|
6036
6156
|
] }),
|
|
6037
|
-
/* @__PURE__ */ (0,
|
|
6038
|
-
/* @__PURE__ */ (0,
|
|
6039
|
-
/* @__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: [
|
|
6040
6160
|
fontSize,
|
|
6041
6161
|
"px"
|
|
6042
6162
|
] })
|
|
6043
6163
|
] }),
|
|
6044
|
-
/* @__PURE__ */ (0,
|
|
6164
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6045
6165
|
"input",
|
|
6046
6166
|
{
|
|
6047
6167
|
type: "range",
|
|
@@ -6052,14 +6172,14 @@ var ImageEditor = ({
|
|
|
6052
6172
|
className: imageRangeClass
|
|
6053
6173
|
}
|
|
6054
6174
|
),
|
|
6055
|
-
/* @__PURE__ */ (0,
|
|
6056
|
-
/* @__PURE__ */ (0,
|
|
6057
|
-
/* @__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: [
|
|
6058
6178
|
"Layers (",
|
|
6059
6179
|
state.annotations.length,
|
|
6060
6180
|
")"
|
|
6061
6181
|
] }),
|
|
6062
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
6182
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6063
6183
|
"button",
|
|
6064
6184
|
{
|
|
6065
6185
|
type: "button",
|
|
@@ -6068,7 +6188,7 @@ var ImageEditor = ({
|
|
|
6068
6188
|
children: "Delete Selected"
|
|
6069
6189
|
}
|
|
6070
6190
|
),
|
|
6071
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
6191
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6072
6192
|
"button",
|
|
6073
6193
|
{
|
|
6074
6194
|
type: "button",
|
|
@@ -6079,10 +6199,10 @@ var ImageEditor = ({
|
|
|
6079
6199
|
)
|
|
6080
6200
|
] })
|
|
6081
6201
|
] }),
|
|
6082
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
6083
|
-
/* @__PURE__ */ (0,
|
|
6084
|
-
/* @__PURE__ */ (0,
|
|
6085
|
-
/* @__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)(
|
|
6086
6206
|
"button",
|
|
6087
6207
|
{
|
|
6088
6208
|
type: "button",
|
|
@@ -6092,8 +6212,8 @@ var ImageEditor = ({
|
|
|
6092
6212
|
}
|
|
6093
6213
|
)
|
|
6094
6214
|
] }),
|
|
6095
|
-
/* @__PURE__ */ (0,
|
|
6096
|
-
/* @__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)(
|
|
6097
6217
|
"input",
|
|
6098
6218
|
{
|
|
6099
6219
|
type: "checkbox",
|
|
@@ -6102,12 +6222,12 @@ var ImageEditor = ({
|
|
|
6102
6222
|
className: "rounded accent-primary"
|
|
6103
6223
|
}
|
|
6104
6224
|
),
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6225
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
6106
6226
|
] }),
|
|
6107
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
6108
|
-
/* @__PURE__ */ (0,
|
|
6109
|
-
/* @__PURE__ */ (0,
|
|
6110
|
-
/* @__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)(
|
|
6111
6231
|
"input",
|
|
6112
6232
|
{
|
|
6113
6233
|
type: "text",
|
|
@@ -6118,8 +6238,8 @@ var ImageEditor = ({
|
|
|
6118
6238
|
}
|
|
6119
6239
|
)
|
|
6120
6240
|
] }),
|
|
6121
|
-
/* @__PURE__ */ (0,
|
|
6122
|
-
/* @__PURE__ */ (0,
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-2", children: [
|
|
6242
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6123
6243
|
"button",
|
|
6124
6244
|
{
|
|
6125
6245
|
type: "button",
|
|
@@ -6128,7 +6248,7 @@ var ImageEditor = ({
|
|
|
6128
6248
|
children: "Threshold Mode"
|
|
6129
6249
|
}
|
|
6130
6250
|
),
|
|
6131
|
-
/* @__PURE__ */ (0,
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6132
6252
|
"button",
|
|
6133
6253
|
{
|
|
6134
6254
|
type: "button",
|
|
@@ -6138,12 +6258,12 @@ var ImageEditor = ({
|
|
|
6138
6258
|
}
|
|
6139
6259
|
)
|
|
6140
6260
|
] }),
|
|
6141
|
-
/* @__PURE__ */ (0,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6144
|
-
/* @__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] })
|
|
6145
6265
|
] }),
|
|
6146
|
-
/* @__PURE__ */ (0,
|
|
6266
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6147
6267
|
"input",
|
|
6148
6268
|
{
|
|
6149
6269
|
type: "range",
|
|
@@ -6157,12 +6277,12 @@ var ImageEditor = ({
|
|
|
6157
6277
|
}
|
|
6158
6278
|
)
|
|
6159
6279
|
] }),
|
|
6160
|
-
/* @__PURE__ */ (0,
|
|
6161
|
-
/* @__PURE__ */ (0,
|
|
6162
|
-
/* @__PURE__ */ (0,
|
|
6163
|
-
/* @__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] })
|
|
6164
6284
|
] }),
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6285
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6166
6286
|
"input",
|
|
6167
6287
|
{
|
|
6168
6288
|
type: "range",
|
|
@@ -6176,12 +6296,12 @@ var ImageEditor = ({
|
|
|
6176
6296
|
}
|
|
6177
6297
|
)
|
|
6178
6298
|
] }),
|
|
6179
|
-
/* @__PURE__ */ (0,
|
|
6180
|
-
/* @__PURE__ */ (0,
|
|
6181
|
-
/* @__PURE__ */ (0,
|
|
6182
|
-
/* @__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 })
|
|
6183
6303
|
] }),
|
|
6184
|
-
/* @__PURE__ */ (0,
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6185
6305
|
"input",
|
|
6186
6306
|
{
|
|
6187
6307
|
type: "range",
|
|
@@ -6193,8 +6313,8 @@ var ImageEditor = ({
|
|
|
6193
6313
|
}
|
|
6194
6314
|
)
|
|
6195
6315
|
] }),
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6197
|
-
/* @__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)(
|
|
6198
6318
|
"input",
|
|
6199
6319
|
{
|
|
6200
6320
|
type: "checkbox",
|
|
@@ -6203,12 +6323,12 @@ var ImageEditor = ({
|
|
|
6203
6323
|
className: "rounded accent-primary"
|
|
6204
6324
|
}
|
|
6205
6325
|
),
|
|
6206
|
-
/* @__PURE__ */ (0,
|
|
6326
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Invert Mask" })
|
|
6207
6327
|
] })
|
|
6208
6328
|
] })
|
|
6209
6329
|
] }),
|
|
6210
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
6211
|
-
/* @__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)(
|
|
6212
6332
|
SelectionOptionsBar,
|
|
6213
6333
|
{
|
|
6214
6334
|
controller,
|
|
@@ -6219,9 +6339,9 @@ var ImageEditor = ({
|
|
|
6219
6339
|
selectionDisplay: state.selectionDisplay
|
|
6220
6340
|
}
|
|
6221
6341
|
),
|
|
6222
|
-
selectionError && /* @__PURE__ */ (0,
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6224
|
-
/* @__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)(
|
|
6225
6345
|
"button",
|
|
6226
6346
|
{
|
|
6227
6347
|
type: "button",
|
|
@@ -6232,7 +6352,7 @@ var ImageEditor = ({
|
|
|
6232
6352
|
children: "Transform Selection"
|
|
6233
6353
|
}
|
|
6234
6354
|
),
|
|
6235
|
-
/* @__PURE__ */ (0,
|
|
6355
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6236
6356
|
"button",
|
|
6237
6357
|
{
|
|
6238
6358
|
type: "button",
|
|
@@ -6244,12 +6364,13 @@ var ImageEditor = ({
|
|
|
6244
6364
|
}
|
|
6245
6365
|
)
|
|
6246
6366
|
] }),
|
|
6247
|
-
/* @__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 })
|
|
6248
6369
|
] }),
|
|
6249
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
6250
|
-
/* @__PURE__ */ (0,
|
|
6251
|
-
/* @__PURE__ */ (0,
|
|
6252
|
-
/* @__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)(
|
|
6253
6374
|
"select",
|
|
6254
6375
|
{
|
|
6255
6376
|
"aria-label": "AI result target",
|
|
@@ -6257,54 +6378,54 @@ var ImageEditor = ({
|
|
|
6257
6378
|
onChange: (e) => setAiTarget(e.target.value),
|
|
6258
6379
|
className: imageSelectClass,
|
|
6259
6380
|
children: [
|
|
6260
|
-
/* @__PURE__ */ (0,
|
|
6261
|
-
/* @__PURE__ */ (0,
|
|
6262
|
-
/* @__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" })
|
|
6263
6384
|
]
|
|
6264
6385
|
}
|
|
6265
6386
|
)
|
|
6266
6387
|
] }),
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6269
|
-
/* @__PURE__ */ (0,
|
|
6270
|
-
/* @__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" }) }),
|
|
6271
6392
|
"Background Removal"
|
|
6272
6393
|
] }),
|
|
6273
|
-
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..." })
|
|
6274
6395
|
] }),
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6276
|
-
/* @__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)(
|
|
6277
6398
|
"button",
|
|
6278
6399
|
{
|
|
6279
6400
|
type: "button",
|
|
6280
6401
|
onClick: handleRemoveBackground,
|
|
6281
6402
|
disabled: isRemovingBg || isInpainting,
|
|
6282
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",
|
|
6283
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
6284
|
-
/* @__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 }),
|
|
6285
6406
|
"Removing Background..."
|
|
6286
|
-
] }) : /* @__PURE__ */ (0,
|
|
6287
|
-
/* @__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" }) }),
|
|
6288
6409
|
"Remove Background"
|
|
6289
6410
|
] })
|
|
6290
6411
|
}
|
|
6291
6412
|
)
|
|
6292
6413
|
] }),
|
|
6293
|
-
/* @__PURE__ */ (0,
|
|
6294
|
-
/* @__PURE__ */ (0,
|
|
6295
|
-
/* @__PURE__ */ (0,
|
|
6296
|
-
/* @__PURE__ */ (0,
|
|
6297
|
-
/* @__PURE__ */ (0,
|
|
6298
|
-
/* @__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" })
|
|
6299
6420
|
] }),
|
|
6300
6421
|
"Generative Inpainting"
|
|
6301
6422
|
] }),
|
|
6302
|
-
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..." })
|
|
6303
6424
|
] }),
|
|
6304
|
-
/* @__PURE__ */ (0,
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6306
|
-
/* @__PURE__ */ (0,
|
|
6307
|
-
/* @__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)(
|
|
6308
6429
|
"textarea",
|
|
6309
6430
|
{
|
|
6310
6431
|
id: "ai-inpaint-prompt-react",
|
|
@@ -6316,10 +6437,10 @@ var ImageEditor = ({
|
|
|
6316
6437
|
}
|
|
6317
6438
|
)
|
|
6318
6439
|
] }),
|
|
6319
|
-
/* @__PURE__ */ (0,
|
|
6320
|
-
/* @__PURE__ */ (0,
|
|
6321
|
-
/* @__PURE__ */ (0,
|
|
6322
|
-
/* @__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)(
|
|
6323
6444
|
"button",
|
|
6324
6445
|
{
|
|
6325
6446
|
type: "button",
|
|
@@ -6332,7 +6453,7 @@ var ImageEditor = ({
|
|
|
6332
6453
|
]
|
|
6333
6454
|
}
|
|
6334
6455
|
),
|
|
6335
|
-
/* @__PURE__ */ (0,
|
|
6456
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6336
6457
|
"button",
|
|
6337
6458
|
{
|
|
6338
6459
|
type: "button",
|
|
@@ -6347,25 +6468,25 @@ var ImageEditor = ({
|
|
|
6347
6468
|
)
|
|
6348
6469
|
] })
|
|
6349
6470
|
] }),
|
|
6350
|
-
/* @__PURE__ */ (0,
|
|
6471
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6351
6472
|
"button",
|
|
6352
6473
|
{
|
|
6353
6474
|
type: "button",
|
|
6354
6475
|
onClick: handleInpaint,
|
|
6355
6476
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
6356
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",
|
|
6357
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
6358
|
-
/* @__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 }),
|
|
6359
6480
|
"Generating Inpaint..."
|
|
6360
|
-
] }) : /* @__PURE__ */ (0,
|
|
6361
|
-
/* @__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" }) }),
|
|
6362
6483
|
"Apply Inpainting"
|
|
6363
6484
|
] })
|
|
6364
6485
|
}
|
|
6365
6486
|
)
|
|
6366
6487
|
] }),
|
|
6367
|
-
aiError && /* @__PURE__ */ (0,
|
|
6368
|
-
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 })
|
|
6369
6490
|
] })
|
|
6370
6491
|
] })
|
|
6371
6492
|
] })
|
|
@@ -6377,6 +6498,7 @@ var ImageEditor = ({
|
|
|
6377
6498
|
0 && (module.exports = {
|
|
6378
6499
|
AdjustmentLayersPanel,
|
|
6379
6500
|
BrushOptionsBar,
|
|
6501
|
+
ChannelsPanel,
|
|
6380
6502
|
ColorProfilePanel,
|
|
6381
6503
|
ControlSlider,
|
|
6382
6504
|
CurvesEditor,
|