@pixerate/editor-react 0.121.0 → 0.123.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-UNKMMYPZ.js} +453 -295
- package/dist/image-editor/ChannelsPanel.d.cts +16 -0
- package/dist/image-editor/ChannelsPanel.d.ts +16 -0
- package/dist/image-editor/index.cjs +461 -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 +981 -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,165 @@ 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 fileInput = (0, import_react27.useRef)(null);
|
|
5071
|
+
const channels = controller.getChannels();
|
|
5072
|
+
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
5073
|
+
const hasSelection = Boolean(controller.getSelection());
|
|
5074
|
+
const quickMask = controller.quickMaskEditing;
|
|
5075
|
+
const attempt = (fn) => {
|
|
5076
|
+
setError(null);
|
|
5077
|
+
try {
|
|
5078
|
+
fn();
|
|
5079
|
+
} catch (err) {
|
|
5080
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
5081
|
+
}
|
|
5082
|
+
};
|
|
5083
|
+
const importFile = async (file) => {
|
|
5084
|
+
if (!file) return;
|
|
5085
|
+
setError(null);
|
|
5086
|
+
try {
|
|
5087
|
+
setActiveId((await (0, import_image_editor16.openMaskFile)(controller, file)).id);
|
|
5088
|
+
} catch (err) {
|
|
5089
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
5090
|
+
}
|
|
5091
|
+
};
|
|
5092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5094
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
5095
|
+
/* @__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" })
|
|
5096
|
+
] }),
|
|
5097
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
5098
|
+
/* @__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)(
|
|
5099
|
+
"li",
|
|
5100
|
+
{
|
|
5101
|
+
"data-testid": "channel-row",
|
|
5102
|
+
"aria-current": c.id === activeId ? "true" : void 0,
|
|
5103
|
+
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"}`,
|
|
5104
|
+
onClick: (e) => {
|
|
5105
|
+
setActiveId(c.id);
|
|
5106
|
+
attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor16.selectionModeFromModifiers)(e, "replace") }));
|
|
5107
|
+
},
|
|
5108
|
+
onDoubleClick: () => setRenaming(c.id),
|
|
5109
|
+
children: [
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5111
|
+
"button",
|
|
5112
|
+
{
|
|
5113
|
+
type: "button",
|
|
5114
|
+
"aria-label": `${c.visible ? "Hide" : "Show"} ${c.name}`,
|
|
5115
|
+
"aria-pressed": c.visible,
|
|
5116
|
+
className: "w-4 text-muted-foreground",
|
|
5117
|
+
onClick: (e) => {
|
|
5118
|
+
e.stopPropagation();
|
|
5119
|
+
attempt(() => controller.setChannelProperties(c.id, { visible: !c.visible }));
|
|
5120
|
+
},
|
|
5121
|
+
children: c.visible ? "\u25CF" : "\u25CB"
|
|
5122
|
+
}
|
|
5123
|
+
),
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
5125
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5126
|
+
"input",
|
|
5127
|
+
{
|
|
5128
|
+
autoFocus: true,
|
|
5129
|
+
"aria-label": "Channel name",
|
|
5130
|
+
defaultValue: c.name,
|
|
5131
|
+
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
5132
|
+
onClick: (e) => e.stopPropagation(),
|
|
5133
|
+
onBlur: (e) => {
|
|
5134
|
+
setRenaming(null);
|
|
5135
|
+
if (e.currentTarget.value.trim() && e.currentTarget.value !== c.name) attempt(() => controller.setChannelProperties(c.id, { name: e.currentTarget.value }));
|
|
5136
|
+
},
|
|
5137
|
+
onKeyDown: (e) => {
|
|
5138
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
5139
|
+
if (e.key === "Escape") setRenaming(null);
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
5143
|
+
]
|
|
5144
|
+
},
|
|
5145
|
+
c.id
|
|
5146
|
+
)) }),
|
|
5147
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
5148
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
5149
|
+
/* @__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" }),
|
|
5150
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5152
|
+
"button",
|
|
5153
|
+
{
|
|
5154
|
+
type: "button",
|
|
5155
|
+
className: btn2(),
|
|
5156
|
+
disabled: !active,
|
|
5157
|
+
onClick: () => attempt(() => {
|
|
5158
|
+
controller.deleteChannel(active.id);
|
|
5159
|
+
setActiveId(null);
|
|
5160
|
+
}),
|
|
5161
|
+
children: "Delete"
|
|
5162
|
+
}
|
|
5163
|
+
),
|
|
5164
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5166
|
+
"button",
|
|
5167
|
+
{
|
|
5168
|
+
type: "button",
|
|
5169
|
+
className: btn2(),
|
|
5170
|
+
disabled: !active && !hasSelection,
|
|
5171
|
+
title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
|
|
5172
|
+
onClick: () => attempt(() => (0, import_image_editor16.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
|
|
5173
|
+
children: "Export PNG"
|
|
5174
|
+
}
|
|
5175
|
+
),
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5177
|
+
"input",
|
|
5178
|
+
{
|
|
5179
|
+
ref: fileInput,
|
|
5180
|
+
type: "file",
|
|
5181
|
+
accept: import_image_editor16.MASK_FILE_ACCEPT,
|
|
5182
|
+
hidden: true,
|
|
5183
|
+
"data-testid": "channel-import-input",
|
|
5184
|
+
onChange: (e) => {
|
|
5185
|
+
void importFile(e.currentTarget.files?.[0]);
|
|
5186
|
+
e.currentTarget.value = "";
|
|
5187
|
+
}
|
|
5188
|
+
}
|
|
5189
|
+
)
|
|
5190
|
+
] }),
|
|
5191
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5192
|
+
] });
|
|
5193
|
+
};
|
|
5194
|
+
|
|
5195
|
+
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
5196
|
+
var import_react28 = require("react");
|
|
5197
|
+
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
5198
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5043
5199
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
5044
5200
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
5045
|
-
const [, setTick] = (0,
|
|
5046
|
-
(0,
|
|
5201
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
5202
|
+
(0, import_react28.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
5047
5203
|
const bar = tool.bar();
|
|
5048
5204
|
if (!tool.active || !bar) return null;
|
|
5049
5205
|
const warp = tool.warpBar();
|
|
@@ -5055,17 +5211,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5055
5211
|
const v = Number(raw);
|
|
5056
5212
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
5057
5213
|
};
|
|
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,
|
|
5214
|
+
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: [
|
|
5215
|
+
/* @__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)) }),
|
|
5216
|
+
/* @__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)) }),
|
|
5217
|
+
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: [
|
|
5218
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
5220
|
+
/* @__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
5221
|
] }),
|
|
5066
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
5067
|
-
/* @__PURE__ */ (0,
|
|
5068
|
-
/* @__PURE__ */ (0,
|
|
5222
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5223
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
5224
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5069
5225
|
"input",
|
|
5070
5226
|
{
|
|
5071
5227
|
type: "number",
|
|
@@ -5086,9 +5242,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5086
5242
|
},
|
|
5087
5243
|
`${k}:${warp[k]}`
|
|
5088
5244
|
),
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
5090
5246
|
] }, k)),
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5092
5248
|
"button",
|
|
5093
5249
|
{
|
|
5094
5250
|
type: "button",
|
|
@@ -5100,26 +5256,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5100
5256
|
children: "Vertical"
|
|
5101
5257
|
}
|
|
5102
5258
|
),
|
|
5103
|
-
/* @__PURE__ */ (0,
|
|
5104
|
-
/* @__PURE__ */ (0,
|
|
5105
|
-
/* @__PURE__ */ (0,
|
|
5259
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5260
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
5261
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5106
5262
|
"select",
|
|
5107
5263
|
{
|
|
5108
5264
|
"aria-label": "Warp grid",
|
|
5109
|
-
value:
|
|
5265
|
+
value: import_image_editor17.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
5110
5266
|
onChange: (e) => {
|
|
5111
|
-
const g =
|
|
5267
|
+
const g = import_image_editor17.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
5112
5268
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
5113
5269
|
},
|
|
5114
5270
|
className: imageFieldClass,
|
|
5115
|
-
children:
|
|
5271
|
+
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
5272
|
}
|
|
5117
5273
|
)
|
|
5118
5274
|
] })
|
|
5119
5275
|
] }),
|
|
5120
|
-
tool.mode !== "warp" &&
|
|
5121
|
-
/* @__PURE__ */ (0,
|
|
5122
|
-
/* @__PURE__ */ (0,
|
|
5276
|
+
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: [
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5123
5279
|
"input",
|
|
5124
5280
|
{
|
|
5125
5281
|
type: "number",
|
|
@@ -5139,8 +5295,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5139
5295
|
},
|
|
5140
5296
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
5141
5297
|
),
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5143
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
5298
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
5299
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5144
5300
|
"button",
|
|
5145
5301
|
{
|
|
5146
5302
|
type: "button",
|
|
@@ -5155,33 +5311,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5155
5311
|
}
|
|
5156
5312
|
)
|
|
5157
5313
|
] }, f.id)),
|
|
5158
|
-
/* @__PURE__ */ (0,
|
|
5159
|
-
/* @__PURE__ */ (0,
|
|
5160
|
-
/* @__PURE__ */ (0,
|
|
5314
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5315
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
5316
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5161
5317
|
"select",
|
|
5162
5318
|
{
|
|
5163
5319
|
"aria-label": "Interpolation",
|
|
5164
5320
|
value: tool.interpolation,
|
|
5165
5321
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
5166
5322
|
className: imageFieldClass,
|
|
5167
|
-
children:
|
|
5323
|
+
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
5324
|
}
|
|
5169
5325
|
)
|
|
5170
5326
|
] }),
|
|
5171
|
-
/* @__PURE__ */ (0,
|
|
5172
|
-
/* @__PURE__ */ (0,
|
|
5173
|
-
tool.error && /* @__PURE__ */ (0,
|
|
5327
|
+
/* @__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" }),
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
5329
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
5174
5330
|
] });
|
|
5175
5331
|
};
|
|
5176
5332
|
|
|
5177
5333
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
5178
|
-
var
|
|
5179
|
-
var
|
|
5180
|
-
var
|
|
5334
|
+
var import_react29 = require("react");
|
|
5335
|
+
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
5336
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5181
5337
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
5182
|
-
const [, setTick] = (0,
|
|
5183
|
-
(0,
|
|
5184
|
-
const [error, setError] = (0,
|
|
5338
|
+
const [, setTick] = (0, import_react29.useState)(0);
|
|
5339
|
+
(0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5340
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
5185
5341
|
const active = controller.getActiveLayer();
|
|
5186
5342
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
5187
5343
|
const set = (change) => {
|
|
@@ -5189,28 +5345,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5189
5345
|
if (!shapeId) return;
|
|
5190
5346
|
try {
|
|
5191
5347
|
setError(null);
|
|
5192
|
-
(0,
|
|
5348
|
+
(0, import_image_editor18.applyShapeOptions)(controller, shapeId, change);
|
|
5193
5349
|
} catch (e) {
|
|
5194
5350
|
setError(e instanceof Error ? e.message : String(e));
|
|
5195
5351
|
}
|
|
5196
5352
|
};
|
|
5197
5353
|
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,
|
|
5354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
5355
|
+
/* @__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)) }),
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
5203
5359
|
"Fill",
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
5205
5361
|
] }),
|
|
5206
|
-
/* @__PURE__ */ (0,
|
|
5207
|
-
/* @__PURE__ */ (0,
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
5208
5364
|
"Stroke",
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
5210
5366
|
] }),
|
|
5211
|
-
/* @__PURE__ */ (0,
|
|
5367
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5212
5368
|
"Width",
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5369
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5214
5370
|
"input",
|
|
5215
5371
|
{
|
|
5216
5372
|
type: "number",
|
|
@@ -5224,51 +5380,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
5224
5380
|
)
|
|
5225
5381
|
] })
|
|
5226
5382
|
] }),
|
|
5227
|
-
/* @__PURE__ */ (0,
|
|
5228
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
5383
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
5384
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5229
5385
|
"Radius",
|
|
5230
|
-
/* @__PURE__ */ (0,
|
|
5386
|
+
/* @__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
5387
|
] }),
|
|
5232
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
5388
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5233
5389
|
"Sides",
|
|
5234
|
-
/* @__PURE__ */ (0,
|
|
5390
|
+
/* @__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
5391
|
] }),
|
|
5236
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
5237
|
-
/* @__PURE__ */ (0,
|
|
5392
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5393
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5238
5394
|
"Points",
|
|
5239
|
-
/* @__PURE__ */ (0,
|
|
5395
|
+
/* @__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
5396
|
] }),
|
|
5241
|
-
/* @__PURE__ */ (0,
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5242
5398
|
"Inner",
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5399
|
+
/* @__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
5400
|
] })
|
|
5245
5401
|
] }),
|
|
5246
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
5247
|
-
/* @__PURE__ */ (0,
|
|
5402
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5403
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5248
5404
|
"Weight",
|
|
5249
|
-
/* @__PURE__ */ (0,
|
|
5405
|
+
/* @__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
5406
|
] }),
|
|
5251
|
-
/* @__PURE__ */ (0,
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5407
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5408
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
5253
5409
|
"Arrowhead"
|
|
5254
5410
|
] })
|
|
5255
5411
|
] })
|
|
5256
5412
|
] }),
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
error && /* @__PURE__ */ (0,
|
|
5413
|
+
/* @__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." }),
|
|
5414
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5259
5415
|
] });
|
|
5260
5416
|
};
|
|
5261
5417
|
|
|
5262
5418
|
// src/image-editor/TypeOptionsBar.tsx
|
|
5263
|
-
var
|
|
5264
|
-
var
|
|
5265
|
-
var
|
|
5419
|
+
var import_react30 = require("react");
|
|
5420
|
+
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5421
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5266
5422
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
5267
5423
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
5268
|
-
const [, setTick] = (0,
|
|
5269
|
-
(0,
|
|
5270
|
-
(0,
|
|
5271
|
-
const [error, setError] = (0,
|
|
5424
|
+
const [, setTick] = (0, import_react30.useState)(0);
|
|
5425
|
+
(0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5426
|
+
(0, import_react30.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
5427
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5272
5428
|
const active = controller.getActiveLayer();
|
|
5273
5429
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
5274
5430
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -5300,11 +5456,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5300
5456
|
setError(e instanceof Error ? e.message : String(e));
|
|
5301
5457
|
}
|
|
5302
5458
|
};
|
|
5303
|
-
return /* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5305
|
-
/* @__PURE__ */ (0,
|
|
5459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
5460
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5306
5462
|
"Font",
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5463
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5308
5464
|
"input",
|
|
5309
5465
|
{
|
|
5310
5466
|
list: "pixerate-type-fonts",
|
|
@@ -5314,11 +5470,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5314
5470
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
5315
5471
|
}
|
|
5316
5472
|
),
|
|
5317
|
-
/* @__PURE__ */ (0,
|
|
5473
|
+
/* @__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
5474
|
] }),
|
|
5319
|
-
/* @__PURE__ */ (0,
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
5320
5476
|
"Size",
|
|
5321
|
-
/* @__PURE__ */ (0,
|
|
5477
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5322
5478
|
"input",
|
|
5323
5479
|
{
|
|
5324
5480
|
type: "number",
|
|
@@ -5331,24 +5487,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
5331
5487
|
}
|
|
5332
5488
|
)
|
|
5333
5489
|
] }),
|
|
5334
|
-
/* @__PURE__ */ (0,
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5336
|
-
/* @__PURE__ */ (0,
|
|
5490
|
+
/* @__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" }),
|
|
5491
|
+
/* @__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" }),
|
|
5492
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
5337
5493
|
] }),
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
5339
|
-
/* @__PURE__ */ (0,
|
|
5340
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
5494
|
+
/* @__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)) }),
|
|
5495
|
+
/* @__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." }),
|
|
5496
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
5341
5497
|
"Missing ",
|
|
5342
5498
|
missing.length === 1 ? "font" : "fonts",
|
|
5343
5499
|
": ",
|
|
5344
5500
|
missing.join(", ")
|
|
5345
5501
|
] }),
|
|
5346
|
-
error && /* @__PURE__ */ (0,
|
|
5502
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
5347
5503
|
] });
|
|
5348
5504
|
};
|
|
5349
5505
|
|
|
5350
5506
|
// src/image-editor/ImageEditor.tsx
|
|
5351
|
-
var
|
|
5507
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5352
5508
|
var ImageEditor = ({
|
|
5353
5509
|
editor: externalEditor,
|
|
5354
5510
|
src,
|
|
@@ -5372,51 +5528,51 @@ var ImageEditor = ({
|
|
|
5372
5528
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
5373
5529
|
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
5530
|
});
|
|
5375
|
-
const legacyProcess = (0,
|
|
5376
|
-
const [activeTab, setActiveTab] = (0,
|
|
5377
|
-
const rootRef = (0,
|
|
5531
|
+
const legacyProcess = (0, import_image_editor20.normalizeProcessVersion)(state.adjustments.process) < import_image_editor20.LATEST_PROCESS_VERSION;
|
|
5532
|
+
const [activeTab, setActiveTab] = (0, import_react31.useState)("crop");
|
|
5533
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
5378
5534
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
5379
|
-
const activeTabRef = (0,
|
|
5535
|
+
const activeTabRef = (0, import_react31.useRef)(activeTab);
|
|
5380
5536
|
activeTabRef.current = activeTab;
|
|
5381
5537
|
const openPanel = async (ref) => {
|
|
5382
5538
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
5383
5539
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
5384
5540
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
5385
5541
|
};
|
|
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,
|
|
5542
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react31.useState)(null);
|
|
5543
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react31.useState)(import_image_editor20.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
5544
|
+
const [shapeOptions, setShapeOptions] = (0, import_react31.useState)(import_image_editor20.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
5545
|
+
const [typeOptions, setTypeOptions] = (0, import_react31.useState)(import_image_editor20.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
5546
|
+
const [typeSession, setTypeSession] = (0, import_react31.useState)(null);
|
|
5547
|
+
const [selectionError, setSelectionError] = (0, import_react31.useState)(null);
|
|
5548
|
+
const [paintError, setPaintError] = (0, import_react31.useState)(null);
|
|
5549
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react31.useState)(null);
|
|
5394
5550
|
const handleCanvasError = (source, message) => {
|
|
5395
5551
|
if (source === "paint") setPaintError(message);
|
|
5396
5552
|
else if (source === "select") setSelectionError(message);
|
|
5397
5553
|
else setShapeTypeError(message);
|
|
5398
5554
|
};
|
|
5399
5555
|
const finishTyping = () => setTypeSession(null);
|
|
5400
|
-
const transformToolRef = (0,
|
|
5401
|
-
const transformControllerRef = (0,
|
|
5556
|
+
const transformToolRef = (0, import_react31.useRef)(null);
|
|
5557
|
+
const transformControllerRef = (0, import_react31.useRef)(controller);
|
|
5402
5558
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
5403
5559
|
transformToolRef.current?.cancel();
|
|
5404
|
-
transformToolRef.current = new
|
|
5560
|
+
transformToolRef.current = new import_image_editor20.FreeTransformTool(controller, {
|
|
5405
5561
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
5406
5562
|
});
|
|
5407
5563
|
transformControllerRef.current = controller;
|
|
5408
5564
|
}
|
|
5409
5565
|
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,
|
|
5566
|
+
const [, setTransformTick] = (0, import_react31.useState)(0);
|
|
5567
|
+
(0, import_react31.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
5568
|
+
(0, import_react31.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
5569
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react31.useState)("");
|
|
5570
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react31.useState)("annotations");
|
|
5571
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react31.useState)(false);
|
|
5572
|
+
const [isInpainting, setIsInpainting] = (0, import_react31.useState)(false);
|
|
5573
|
+
const [aiError, setAiError] = (0, import_react31.useState)(null);
|
|
5574
|
+
const [aiSuccess, setAiSuccess] = (0, import_react31.useState)(null);
|
|
5575
|
+
const [aiTarget, setAiTarget] = (0, import_react31.useState)("auto");
|
|
5420
5576
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
5421
5577
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
5422
5578
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -5479,11 +5635,11 @@ var ImageEditor = ({
|
|
|
5479
5635
|
setIsInpainting(false);
|
|
5480
5636
|
}
|
|
5481
5637
|
};
|
|
5482
|
-
const [activeColor, setActiveColor] = (0,
|
|
5483
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
5484
|
-
const [fontSize, setFontSize] = (0,
|
|
5485
|
-
const [textInput, setTextInput] = (0,
|
|
5486
|
-
(0,
|
|
5638
|
+
const [activeColor, setActiveColor] = (0, import_react31.useState)("#ef4444");
|
|
5639
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react31.useState)(3);
|
|
5640
|
+
const [fontSize, setFontSize] = (0, import_react31.useState)(24);
|
|
5641
|
+
const [textInput, setTextInput] = (0, import_react31.useState)("");
|
|
5642
|
+
(0, import_react31.useEffect)(() => {
|
|
5487
5643
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
5488
5644
|
editor.setTool("crop");
|
|
5489
5645
|
}
|
|
@@ -5511,16 +5667,16 @@ var ImageEditor = ({
|
|
|
5511
5667
|
link.click();
|
|
5512
5668
|
}
|
|
5513
5669
|
};
|
|
5514
|
-
return /* @__PURE__ */ (0,
|
|
5670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5515
5671
|
"div",
|
|
5516
5672
|
{
|
|
5517
5673
|
ref: rootRef,
|
|
5518
5674
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5519
5675
|
style,
|
|
5520
5676
|
children: [
|
|
5521
|
-
/* @__PURE__ */ (0,
|
|
5522
|
-
/* @__PURE__ */ (0,
|
|
5523
|
-
/* @__PURE__ */ (0,
|
|
5677
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
5678
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5524
5680
|
"button",
|
|
5525
5681
|
{
|
|
5526
5682
|
type: "button",
|
|
@@ -5535,7 +5691,7 @@ var ImageEditor = ({
|
|
|
5535
5691
|
children: "Transform & Crop"
|
|
5536
5692
|
}
|
|
5537
5693
|
),
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5694
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5539
5695
|
"button",
|
|
5540
5696
|
{
|
|
5541
5697
|
type: "button",
|
|
@@ -5550,7 +5706,7 @@ var ImageEditor = ({
|
|
|
5550
5706
|
children: "Adjustments"
|
|
5551
5707
|
}
|
|
5552
5708
|
),
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5709
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5554
5710
|
"button",
|
|
5555
5711
|
{
|
|
5556
5712
|
type: "button",
|
|
@@ -5565,7 +5721,7 @@ var ImageEditor = ({
|
|
|
5565
5721
|
children: "Layers"
|
|
5566
5722
|
}
|
|
5567
5723
|
),
|
|
5568
|
-
/* @__PURE__ */ (0,
|
|
5724
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5569
5725
|
"button",
|
|
5570
5726
|
{
|
|
5571
5727
|
type: "button",
|
|
@@ -5580,7 +5736,7 @@ var ImageEditor = ({
|
|
|
5580
5736
|
children: "Paint"
|
|
5581
5737
|
}
|
|
5582
5738
|
),
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5584
5740
|
"button",
|
|
5585
5741
|
{
|
|
5586
5742
|
type: "button",
|
|
@@ -5595,7 +5751,7 @@ var ImageEditor = ({
|
|
|
5595
5751
|
children: "Select & Mask"
|
|
5596
5752
|
}
|
|
5597
5753
|
),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5599
5755
|
"button",
|
|
5600
5756
|
{
|
|
5601
5757
|
type: "button",
|
|
@@ -5610,7 +5766,7 @@ var ImageEditor = ({
|
|
|
5610
5766
|
children: "Annotations"
|
|
5611
5767
|
}
|
|
5612
5768
|
),
|
|
5613
|
-
/* @__PURE__ */ (0,
|
|
5769
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5614
5770
|
"button",
|
|
5615
5771
|
{
|
|
5616
5772
|
type: "button",
|
|
@@ -5625,7 +5781,7 @@ var ImageEditor = ({
|
|
|
5625
5781
|
children: "Depth Mask"
|
|
5626
5782
|
}
|
|
5627
5783
|
),
|
|
5628
|
-
/* @__PURE__ */ (0,
|
|
5784
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5629
5785
|
"button",
|
|
5630
5786
|
{
|
|
5631
5787
|
type: "button",
|
|
@@ -5638,14 +5794,14 @@ var ImageEditor = ({
|
|
|
5638
5794
|
"aria-selected": activeTab === "ai",
|
|
5639
5795
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5640
5796
|
children: [
|
|
5641
|
-
/* @__PURE__ */ (0,
|
|
5797
|
+
/* @__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
5798
|
"AI Tools"
|
|
5643
5799
|
]
|
|
5644
5800
|
}
|
|
5645
5801
|
)
|
|
5646
5802
|
] }),
|
|
5647
|
-
/* @__PURE__ */ (0,
|
|
5648
|
-
/* @__PURE__ */ (0,
|
|
5803
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5649
5805
|
"button",
|
|
5650
5806
|
{
|
|
5651
5807
|
type: "button",
|
|
@@ -5656,7 +5812,7 @@ var ImageEditor = ({
|
|
|
5656
5812
|
children: "\u21A9"
|
|
5657
5813
|
}
|
|
5658
5814
|
),
|
|
5659
|
-
/* @__PURE__ */ (0,
|
|
5815
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5660
5816
|
"button",
|
|
5661
5817
|
{
|
|
5662
5818
|
type: "button",
|
|
@@ -5667,7 +5823,7 @@ var ImageEditor = ({
|
|
|
5667
5823
|
children: "\u21AA"
|
|
5668
5824
|
}
|
|
5669
5825
|
),
|
|
5670
|
-
/* @__PURE__ */ (0,
|
|
5826
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5671
5827
|
"button",
|
|
5672
5828
|
{
|
|
5673
5829
|
type: "button",
|
|
@@ -5676,8 +5832,8 @@ var ImageEditor = ({
|
|
|
5676
5832
|
children: "Reset"
|
|
5677
5833
|
}
|
|
5678
5834
|
),
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
/* @__PURE__ */ (0,
|
|
5835
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5836
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5681
5837
|
"button",
|
|
5682
5838
|
{
|
|
5683
5839
|
type: "button",
|
|
@@ -5687,11 +5843,11 @@ var ImageEditor = ({
|
|
|
5687
5843
|
children: "-"
|
|
5688
5844
|
}
|
|
5689
5845
|
),
|
|
5690
|
-
/* @__PURE__ */ (0,
|
|
5846
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5691
5847
|
Math.round(state.zoom * 100),
|
|
5692
5848
|
"%"
|
|
5693
5849
|
] }),
|
|
5694
|
-
/* @__PURE__ */ (0,
|
|
5850
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5695
5851
|
"button",
|
|
5696
5852
|
{
|
|
5697
5853
|
type: "button",
|
|
@@ -5701,8 +5857,8 @@ var ImageEditor = ({
|
|
|
5701
5857
|
children: "+"
|
|
5702
5858
|
}
|
|
5703
5859
|
),
|
|
5704
|
-
/* @__PURE__ */ (0,
|
|
5705
|
-
/* @__PURE__ */ (0,
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5861
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5706
5862
|
"button",
|
|
5707
5863
|
{
|
|
5708
5864
|
type: "button",
|
|
@@ -5713,7 +5869,7 @@ var ImageEditor = ({
|
|
|
5713
5869
|
children: "Hold Compare"
|
|
5714
5870
|
}
|
|
5715
5871
|
),
|
|
5716
|
-
/* @__PURE__ */ (0,
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5717
5873
|
"button",
|
|
5718
5874
|
{
|
|
5719
5875
|
type: "button",
|
|
@@ -5724,10 +5880,10 @@ var ImageEditor = ({
|
|
|
5724
5880
|
)
|
|
5725
5881
|
] })
|
|
5726
5882
|
] }),
|
|
5727
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
5728
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
5729
|
-
/* @__PURE__ */ (0,
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5883
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5884
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5731
5887
|
ImageEditorCanvas,
|
|
5732
5888
|
{
|
|
5733
5889
|
editor,
|
|
@@ -5751,11 +5907,11 @@ var ImageEditor = ({
|
|
|
5751
5907
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5752
5908
|
}
|
|
5753
5909
|
),
|
|
5754
|
-
/* @__PURE__ */ (0,
|
|
5755
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
5757
|
-
/* @__PURE__ */ (0,
|
|
5758
|
-
/* @__PURE__ */ (0,
|
|
5910
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: imageSidebarClass, children: [
|
|
5911
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5912
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5913
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5759
5915
|
"button",
|
|
5760
5916
|
{
|
|
5761
5917
|
type: "button",
|
|
@@ -5767,7 +5923,7 @@ var ImageEditor = ({
|
|
|
5767
5923
|
children: "Freeform"
|
|
5768
5924
|
}
|
|
5769
5925
|
),
|
|
5770
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5771
5927
|
"button",
|
|
5772
5928
|
{
|
|
5773
5929
|
type: "button",
|
|
@@ -5779,7 +5935,7 @@ var ImageEditor = ({
|
|
|
5779
5935
|
children: "1:1 Square"
|
|
5780
5936
|
}
|
|
5781
5937
|
),
|
|
5782
|
-
/* @__PURE__ */ (0,
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5783
5939
|
"button",
|
|
5784
5940
|
{
|
|
5785
5941
|
type: "button",
|
|
@@ -5791,7 +5947,7 @@ var ImageEditor = ({
|
|
|
5791
5947
|
children: "4:3 Standard"
|
|
5792
5948
|
}
|
|
5793
5949
|
),
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
5950
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5795
5951
|
"button",
|
|
5796
5952
|
{
|
|
5797
5953
|
type: "button",
|
|
@@ -5803,7 +5959,7 @@ var ImageEditor = ({
|
|
|
5803
5959
|
children: "16:9 Wide"
|
|
5804
5960
|
}
|
|
5805
5961
|
),
|
|
5806
|
-
/* @__PURE__ */ (0,
|
|
5962
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5807
5963
|
"button",
|
|
5808
5964
|
{
|
|
5809
5965
|
type: "button",
|
|
@@ -5815,7 +5971,7 @@ var ImageEditor = ({
|
|
|
5815
5971
|
children: "3:2 Photo"
|
|
5816
5972
|
}
|
|
5817
5973
|
),
|
|
5818
|
-
/* @__PURE__ */ (0,
|
|
5974
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5819
5975
|
"button",
|
|
5820
5976
|
{
|
|
5821
5977
|
type: "button",
|
|
@@ -5828,10 +5984,10 @@ var ImageEditor = ({
|
|
|
5828
5984
|
}
|
|
5829
5985
|
)
|
|
5830
5986
|
] }),
|
|
5831
|
-
/* @__PURE__ */ (0,
|
|
5832
|
-
/* @__PURE__ */ (0,
|
|
5833
|
-
/* @__PURE__ */ (0,
|
|
5834
|
-
/* @__PURE__ */ (0,
|
|
5987
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
5988
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5989
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5990
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5835
5991
|
"button",
|
|
5836
5992
|
{
|
|
5837
5993
|
type: "button",
|
|
@@ -5840,7 +5996,7 @@ var ImageEditor = ({
|
|
|
5840
5996
|
children: "Rotate -90\xB0"
|
|
5841
5997
|
}
|
|
5842
5998
|
),
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5999
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5844
6000
|
"button",
|
|
5845
6001
|
{
|
|
5846
6002
|
type: "button",
|
|
@@ -5849,7 +6005,7 @@ var ImageEditor = ({
|
|
|
5849
6005
|
children: "Rotate +90\xB0"
|
|
5850
6006
|
}
|
|
5851
6007
|
),
|
|
5852
|
-
/* @__PURE__ */ (0,
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5853
6009
|
"button",
|
|
5854
6010
|
{
|
|
5855
6011
|
type: "button",
|
|
@@ -5858,7 +6014,7 @@ var ImageEditor = ({
|
|
|
5858
6014
|
children: "Flip Horizontal"
|
|
5859
6015
|
}
|
|
5860
6016
|
),
|
|
5861
|
-
/* @__PURE__ */ (0,
|
|
6017
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5862
6018
|
"button",
|
|
5863
6019
|
{
|
|
5864
6020
|
type: "button",
|
|
@@ -5869,10 +6025,10 @@ var ImageEditor = ({
|
|
|
5869
6025
|
)
|
|
5870
6026
|
] })
|
|
5871
6027
|
] }),
|
|
5872
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5874
|
-
/* @__PURE__ */ (0,
|
|
5875
|
-
/* @__PURE__ */ (0,
|
|
6028
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6030
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
6031
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5876
6032
|
"button",
|
|
5877
6033
|
{
|
|
5878
6034
|
type: "button",
|
|
@@ -5882,25 +6038,25 @@ var ImageEditor = ({
|
|
|
5882
6038
|
}
|
|
5883
6039
|
)
|
|
5884
6040
|
] }),
|
|
5885
|
-
/* @__PURE__ */ (0,
|
|
5886
|
-
|
|
5887
|
-
/* @__PURE__ */ (0,
|
|
6041
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Histogram, { histogram: editor.histogram }),
|
|
6042
|
+
import_image_editor20.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react31.default.Fragment, { children: [
|
|
6043
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5888
6044
|
ControlSlider,
|
|
5889
6045
|
{
|
|
5890
6046
|
spec,
|
|
5891
|
-
value: (0,
|
|
6047
|
+
value: (0, import_image_editor20.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
5892
6048
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
5893
6049
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5894
6050
|
}
|
|
5895
6051
|
),
|
|
5896
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6052
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5897
6053
|
"div",
|
|
5898
6054
|
{
|
|
5899
6055
|
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
6056
|
"data-testid": "image-editor-process-notice",
|
|
5901
6057
|
children: [
|
|
5902
|
-
/* @__PURE__ */ (0,
|
|
5903
|
-
/* @__PURE__ */ (0,
|
|
6058
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
6059
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5904
6060
|
"button",
|
|
5905
6061
|
{
|
|
5906
6062
|
type: "button",
|
|
@@ -5913,7 +6069,7 @@ var ImageEditor = ({
|
|
|
5913
6069
|
}
|
|
5914
6070
|
)
|
|
5915
6071
|
] }, spec.id)),
|
|
5916
|
-
/* @__PURE__ */ (0,
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5917
6073
|
AdjustmentLayersPanel,
|
|
5918
6074
|
{
|
|
5919
6075
|
controller,
|
|
@@ -5922,9 +6078,9 @@ var ImageEditor = ({
|
|
|
5922
6078
|
}
|
|
5923
6079
|
) })
|
|
5924
6080
|
] }),
|
|
5925
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
5926
|
-
/* @__PURE__ */ (0,
|
|
5927
|
-
/* @__PURE__ */ (0,
|
|
6081
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6082
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
6083
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5928
6084
|
"button",
|
|
5929
6085
|
{
|
|
5930
6086
|
type: "button",
|
|
@@ -5935,15 +6091,15 @@ var ImageEditor = ({
|
|
|
5935
6091
|
children: "Free Transform"
|
|
5936
6092
|
}
|
|
5937
6093
|
),
|
|
5938
|
-
/* @__PURE__ */ (0,
|
|
5939
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
6094
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LayersPanel, { controller }),
|
|
6095
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
6096
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
6097
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorProfilePanel, { controller })
|
|
5942
6098
|
] }),
|
|
5943
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
5944
|
-
/* @__PURE__ */ (0,
|
|
5945
|
-
/* @__PURE__ */ (0,
|
|
5946
|
-
/* @__PURE__ */ (0,
|
|
6099
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6100
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BrushOptionsBar, { controller }),
|
|
6102
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5947
6103
|
"button",
|
|
5948
6104
|
{
|
|
5949
6105
|
type: "button",
|
|
@@ -5954,12 +6110,12 @@ var ImageEditor = ({
|
|
|
5954
6110
|
children: "Free Transform"
|
|
5955
6111
|
}
|
|
5956
6112
|
),
|
|
5957
|
-
paintError && /* @__PURE__ */ (0,
|
|
5958
|
-
/* @__PURE__ */ (0,
|
|
6113
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
6114
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LayersPanel, { controller }) })
|
|
5959
6115
|
] }),
|
|
5960
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
5961
|
-
/* @__PURE__ */ (0,
|
|
5962
|
-
/* @__PURE__ */ (0,
|
|
6116
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6117
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
6118
|
+
/* @__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
6119
|
"button",
|
|
5964
6120
|
{
|
|
5965
6121
|
type: "button",
|
|
@@ -5970,13 +6126,13 @@ var ImageEditor = ({
|
|
|
5970
6126
|
},
|
|
5971
6127
|
t
|
|
5972
6128
|
)) }),
|
|
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,
|
|
6129
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
6130
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
6131
|
+
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" }),
|
|
6132
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
6133
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
6134
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
6135
|
+
/* @__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
6136
|
"button",
|
|
5981
6137
|
{
|
|
5982
6138
|
type: "button",
|
|
@@ -5986,18 +6142,18 @@ var ImageEditor = ({
|
|
|
5986
6142
|
},
|
|
5987
6143
|
t
|
|
5988
6144
|
)) }),
|
|
5989
|
-
/* @__PURE__ */ (0,
|
|
5990
|
-
/* @__PURE__ */ (0,
|
|
5991
|
-
/* @__PURE__ */ (0,
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
5993
|
-
/* @__PURE__ */ (0,
|
|
5994
|
-
/* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
6145
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
6146
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
6147
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
6148
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
6149
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
6150
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Width:" }),
|
|
6151
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
5996
6152
|
strokeWidth,
|
|
5997
6153
|
"px"
|
|
5998
6154
|
] })
|
|
5999
6155
|
] }),
|
|
6000
|
-
/* @__PURE__ */ (0,
|
|
6156
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6001
6157
|
"input",
|
|
6002
6158
|
{
|
|
6003
6159
|
type: "range",
|
|
@@ -6010,10 +6166,10 @@ var ImageEditor = ({
|
|
|
6010
6166
|
)
|
|
6011
6167
|
] })
|
|
6012
6168
|
] }),
|
|
6013
|
-
/* @__PURE__ */ (0,
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6015
|
-
/* @__PURE__ */ (0,
|
|
6016
|
-
/* @__PURE__ */ (0,
|
|
6169
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-2", children: [
|
|
6172
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6017
6173
|
"input",
|
|
6018
6174
|
{
|
|
6019
6175
|
type: "text",
|
|
@@ -6024,7 +6180,7 @@ var ImageEditor = ({
|
|
|
6024
6180
|
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
6181
|
}
|
|
6026
6182
|
),
|
|
6027
|
-
/* @__PURE__ */ (0,
|
|
6183
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6028
6184
|
"button",
|
|
6029
6185
|
{
|
|
6030
6186
|
type: "button",
|
|
@@ -6034,14 +6190,14 @@ var ImageEditor = ({
|
|
|
6034
6190
|
}
|
|
6035
6191
|
)
|
|
6036
6192
|
] }),
|
|
6037
|
-
/* @__PURE__ */ (0,
|
|
6038
|
-
/* @__PURE__ */ (0,
|
|
6039
|
-
/* @__PURE__ */ (0,
|
|
6193
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
6194
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Font Size:" }),
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
|
|
6040
6196
|
fontSize,
|
|
6041
6197
|
"px"
|
|
6042
6198
|
] })
|
|
6043
6199
|
] }),
|
|
6044
|
-
/* @__PURE__ */ (0,
|
|
6200
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6045
6201
|
"input",
|
|
6046
6202
|
{
|
|
6047
6203
|
type: "range",
|
|
@@ -6052,14 +6208,14 @@ var ImageEditor = ({
|
|
|
6052
6208
|
className: imageRangeClass
|
|
6053
6209
|
}
|
|
6054
6210
|
),
|
|
6055
|
-
/* @__PURE__ */ (0,
|
|
6056
|
-
/* @__PURE__ */ (0,
|
|
6057
|
-
/* @__PURE__ */ (0,
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageDividerClass }),
|
|
6212
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6213
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
6058
6214
|
"Layers (",
|
|
6059
6215
|
state.annotations.length,
|
|
6060
6216
|
")"
|
|
6061
6217
|
] }),
|
|
6062
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
6218
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6063
6219
|
"button",
|
|
6064
6220
|
{
|
|
6065
6221
|
type: "button",
|
|
@@ -6068,7 +6224,7 @@ var ImageEditor = ({
|
|
|
6068
6224
|
children: "Delete Selected"
|
|
6069
6225
|
}
|
|
6070
6226
|
),
|
|
6071
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
6227
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6072
6228
|
"button",
|
|
6073
6229
|
{
|
|
6074
6230
|
type: "button",
|
|
@@ -6079,10 +6235,10 @@ var ImageEditor = ({
|
|
|
6079
6235
|
)
|
|
6080
6236
|
] })
|
|
6081
6237
|
] }),
|
|
6082
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
6083
|
-
/* @__PURE__ */ (0,
|
|
6084
|
-
/* @__PURE__ */ (0,
|
|
6085
|
-
/* @__PURE__ */ (0,
|
|
6238
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6239
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6240
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
6241
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6086
6242
|
"button",
|
|
6087
6243
|
{
|
|
6088
6244
|
type: "button",
|
|
@@ -6092,8 +6248,8 @@ var ImageEditor = ({
|
|
|
6092
6248
|
}
|
|
6093
6249
|
)
|
|
6094
6250
|
] }),
|
|
6095
|
-
/* @__PURE__ */ (0,
|
|
6096
|
-
/* @__PURE__ */ (0,
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
6252
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6097
6253
|
"input",
|
|
6098
6254
|
{
|
|
6099
6255
|
type: "checkbox",
|
|
@@ -6102,12 +6258,12 @@ var ImageEditor = ({
|
|
|
6102
6258
|
className: "rounded accent-primary"
|
|
6103
6259
|
}
|
|
6104
6260
|
),
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6261
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
6106
6262
|
] }),
|
|
6107
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
6108
|
-
/* @__PURE__ */ (0,
|
|
6109
|
-
/* @__PURE__ */ (0,
|
|
6110
|
-
/* @__PURE__ */ (0,
|
|
6263
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6264
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6265
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
6266
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6111
6267
|
"input",
|
|
6112
6268
|
{
|
|
6113
6269
|
type: "text",
|
|
@@ -6118,8 +6274,8 @@ var ImageEditor = ({
|
|
|
6118
6274
|
}
|
|
6119
6275
|
)
|
|
6120
6276
|
] }),
|
|
6121
|
-
/* @__PURE__ */ (0,
|
|
6122
|
-
/* @__PURE__ */ (0,
|
|
6277
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-2", children: [
|
|
6278
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6123
6279
|
"button",
|
|
6124
6280
|
{
|
|
6125
6281
|
type: "button",
|
|
@@ -6128,7 +6284,7 @@ var ImageEditor = ({
|
|
|
6128
6284
|
children: "Threshold Mode"
|
|
6129
6285
|
}
|
|
6130
6286
|
),
|
|
6131
|
-
/* @__PURE__ */ (0,
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6132
6288
|
"button",
|
|
6133
6289
|
{
|
|
6134
6290
|
type: "button",
|
|
@@ -6138,12 +6294,12 @@ var ImageEditor = ({
|
|
|
6138
6294
|
}
|
|
6139
6295
|
)
|
|
6140
6296
|
] }),
|
|
6141
|
-
/* @__PURE__ */ (0,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6144
|
-
/* @__PURE__ */ (0,
|
|
6297
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6298
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
6300
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
6145
6301
|
] }),
|
|
6146
|
-
/* @__PURE__ */ (0,
|
|
6302
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6147
6303
|
"input",
|
|
6148
6304
|
{
|
|
6149
6305
|
type: "range",
|
|
@@ -6157,12 +6313,12 @@ var ImageEditor = ({
|
|
|
6157
6313
|
}
|
|
6158
6314
|
)
|
|
6159
6315
|
] }),
|
|
6160
|
-
/* @__PURE__ */ (0,
|
|
6161
|
-
/* @__PURE__ */ (0,
|
|
6162
|
-
/* @__PURE__ */ (0,
|
|
6163
|
-
/* @__PURE__ */ (0,
|
|
6316
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6317
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6318
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
6319
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
6164
6320
|
] }),
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6321
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6166
6322
|
"input",
|
|
6167
6323
|
{
|
|
6168
6324
|
type: "range",
|
|
@@ -6176,12 +6332,12 @@ var ImageEditor = ({
|
|
|
6176
6332
|
}
|
|
6177
6333
|
)
|
|
6178
6334
|
] }),
|
|
6179
|
-
/* @__PURE__ */ (0,
|
|
6180
|
-
/* @__PURE__ */ (0,
|
|
6181
|
-
/* @__PURE__ */ (0,
|
|
6182
|
-
/* @__PURE__ */ (0,
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
6337
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Softness:" }),
|
|
6338
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
6183
6339
|
] }),
|
|
6184
|
-
/* @__PURE__ */ (0,
|
|
6340
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6185
6341
|
"input",
|
|
6186
6342
|
{
|
|
6187
6343
|
type: "range",
|
|
@@ -6193,8 +6349,8 @@ var ImageEditor = ({
|
|
|
6193
6349
|
}
|
|
6194
6350
|
)
|
|
6195
6351
|
] }),
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
6353
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6198
6354
|
"input",
|
|
6199
6355
|
{
|
|
6200
6356
|
type: "checkbox",
|
|
@@ -6203,12 +6359,12 @@ var ImageEditor = ({
|
|
|
6203
6359
|
className: "rounded accent-primary"
|
|
6204
6360
|
}
|
|
6205
6361
|
),
|
|
6206
|
-
/* @__PURE__ */ (0,
|
|
6362
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Invert Mask" })
|
|
6207
6363
|
] })
|
|
6208
6364
|
] })
|
|
6209
6365
|
] }),
|
|
6210
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
6211
|
-
/* @__PURE__ */ (0,
|
|
6366
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6367
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6212
6368
|
SelectionOptionsBar,
|
|
6213
6369
|
{
|
|
6214
6370
|
controller,
|
|
@@ -6219,9 +6375,9 @@ var ImageEditor = ({
|
|
|
6219
6375
|
selectionDisplay: state.selectionDisplay
|
|
6220
6376
|
}
|
|
6221
6377
|
),
|
|
6222
|
-
selectionError && /* @__PURE__ */ (0,
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6224
|
-
/* @__PURE__ */ (0,
|
|
6378
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
6379
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
6380
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6225
6381
|
"button",
|
|
6226
6382
|
{
|
|
6227
6383
|
type: "button",
|
|
@@ -6232,7 +6388,7 @@ var ImageEditor = ({
|
|
|
6232
6388
|
children: "Transform Selection"
|
|
6233
6389
|
}
|
|
6234
6390
|
),
|
|
6235
|
-
/* @__PURE__ */ (0,
|
|
6391
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6236
6392
|
"button",
|
|
6237
6393
|
{
|
|
6238
6394
|
type: "button",
|
|
@@ -6244,12 +6400,13 @@ var ImageEditor = ({
|
|
|
6244
6400
|
}
|
|
6245
6401
|
)
|
|
6246
6402
|
] }),
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChannelsPanel, { controller })
|
|
6248
6405
|
] }),
|
|
6249
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
6250
|
-
/* @__PURE__ */ (0,
|
|
6251
|
-
/* @__PURE__ */ (0,
|
|
6252
|
-
/* @__PURE__ */ (0,
|
|
6406
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6407
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
6408
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Results go to" }),
|
|
6409
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6253
6410
|
"select",
|
|
6254
6411
|
{
|
|
6255
6412
|
"aria-label": "AI result target",
|
|
@@ -6257,54 +6414,54 @@ var ImageEditor = ({
|
|
|
6257
6414
|
onChange: (e) => setAiTarget(e.target.value),
|
|
6258
6415
|
className: imageSelectClass,
|
|
6259
6416
|
children: [
|
|
6260
|
-
/* @__PURE__ */ (0,
|
|
6261
|
-
/* @__PURE__ */ (0,
|
|
6262
|
-
/* @__PURE__ */ (0,
|
|
6417
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
6418
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
6419
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "replace", children: "Replace image" })
|
|
6263
6420
|
]
|
|
6264
6421
|
}
|
|
6265
6422
|
)
|
|
6266
6423
|
] }),
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6269
|
-
/* @__PURE__ */ (0,
|
|
6270
|
-
/* @__PURE__ */ (0,
|
|
6424
|
+
/* @__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: [
|
|
6425
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6426
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
6427
|
+
/* @__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
6428
|
"Background Removal"
|
|
6272
6429
|
] }),
|
|
6273
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
6430
|
+
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
6431
|
] }),
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6276
|
-
/* @__PURE__ */ (0,
|
|
6432
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
6433
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6277
6434
|
"button",
|
|
6278
6435
|
{
|
|
6279
6436
|
type: "button",
|
|
6280
6437
|
onClick: handleRemoveBackground,
|
|
6281
6438
|
disabled: isRemovingBg || isInpainting,
|
|
6282
6439
|
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,
|
|
6440
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6441
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSpinnerClass }),
|
|
6285
6442
|
"Removing Background..."
|
|
6286
|
-
] }) : /* @__PURE__ */ (0,
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6443
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6444
|
+
/* @__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
6445
|
"Remove Background"
|
|
6289
6446
|
] })
|
|
6290
6447
|
}
|
|
6291
6448
|
)
|
|
6292
6449
|
] }),
|
|
6293
|
-
/* @__PURE__ */ (0,
|
|
6294
|
-
/* @__PURE__ */ (0,
|
|
6295
|
-
/* @__PURE__ */ (0,
|
|
6296
|
-
/* @__PURE__ */ (0,
|
|
6297
|
-
/* @__PURE__ */ (0,
|
|
6298
|
-
/* @__PURE__ */ (0,
|
|
6450
|
+
/* @__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: [
|
|
6451
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6452
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
6453
|
+
/* @__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: [
|
|
6454
|
+
/* @__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" }),
|
|
6455
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { d: "m14 7 3 3" })
|
|
6299
6456
|
] }),
|
|
6300
6457
|
"Generative Inpainting"
|
|
6301
6458
|
] }),
|
|
6302
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
6459
|
+
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
6460
|
] }),
|
|
6304
|
-
/* @__PURE__ */ (0,
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6306
|
-
/* @__PURE__ */ (0,
|
|
6307
|
-
/* @__PURE__ */ (0,
|
|
6461
|
+
/* @__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." }),
|
|
6462
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
6463
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
6464
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6308
6465
|
"textarea",
|
|
6309
6466
|
{
|
|
6310
6467
|
id: "ai-inpaint-prompt-react",
|
|
@@ -6316,10 +6473,10 @@ var ImageEditor = ({
|
|
|
6316
6473
|
}
|
|
6317
6474
|
)
|
|
6318
6475
|
] }),
|
|
6319
|
-
/* @__PURE__ */ (0,
|
|
6320
|
-
/* @__PURE__ */ (0,
|
|
6321
|
-
/* @__PURE__ */ (0,
|
|
6322
|
-
/* @__PURE__ */ (0,
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
6477
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
6478
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
6479
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6323
6480
|
"button",
|
|
6324
6481
|
{
|
|
6325
6482
|
type: "button",
|
|
@@ -6332,7 +6489,7 @@ var ImageEditor = ({
|
|
|
6332
6489
|
]
|
|
6333
6490
|
}
|
|
6334
6491
|
),
|
|
6335
|
-
/* @__PURE__ */ (0,
|
|
6492
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6336
6493
|
"button",
|
|
6337
6494
|
{
|
|
6338
6495
|
type: "button",
|
|
@@ -6347,25 +6504,25 @@ var ImageEditor = ({
|
|
|
6347
6504
|
)
|
|
6348
6505
|
] })
|
|
6349
6506
|
] }),
|
|
6350
|
-
/* @__PURE__ */ (0,
|
|
6507
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6351
6508
|
"button",
|
|
6352
6509
|
{
|
|
6353
6510
|
type: "button",
|
|
6354
6511
|
onClick: handleInpaint,
|
|
6355
6512
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
6356
6513
|
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,
|
|
6514
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6515
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: imageSpinnerClass }),
|
|
6359
6516
|
"Generating Inpaint..."
|
|
6360
|
-
] }) : /* @__PURE__ */ (0,
|
|
6361
|
-
/* @__PURE__ */ (0,
|
|
6517
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6518
|
+
/* @__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
6519
|
"Apply Inpainting"
|
|
6363
6520
|
] })
|
|
6364
6521
|
}
|
|
6365
6522
|
)
|
|
6366
6523
|
] }),
|
|
6367
|
-
aiError && /* @__PURE__ */ (0,
|
|
6368
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
6524
|
+
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 }),
|
|
6525
|
+
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
6526
|
] })
|
|
6370
6527
|
] })
|
|
6371
6528
|
] })
|
|
@@ -6377,6 +6534,7 @@ var ImageEditor = ({
|
|
|
6377
6534
|
0 && (module.exports = {
|
|
6378
6535
|
AdjustmentLayersPanel,
|
|
6379
6536
|
BrushOptionsBar,
|
|
6537
|
+
ChannelsPanel,
|
|
6380
6538
|
ColorProfilePanel,
|
|
6381
6539
|
ControlSlider,
|
|
6382
6540
|
CurvesEditor,
|