@pixerate/editor-react 0.140.0 → 0.142.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-75P7WMCR.js → chunk-ULBLX67B.js} +407 -296
- package/dist/image-editor/ContentAwareFillWorkspace.d.cts +1 -1
- package/dist/image-editor/ContentAwareFillWorkspace.d.ts +1 -1
- package/dist/image-editor/PathsPanel.d.cts +16 -0
- package/dist/image-editor/PathsPanel.d.ts +16 -0
- package/dist/image-editor/index.cjs +420 -308
- 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 +940 -828
- package/dist/index.js +3 -1
- package/package.json +3 -3
|
@@ -52,6 +52,7 @@ __export(image_editor_exports, {
|
|
|
52
52
|
LayerEffectsPanel: () => LayerEffectsPanel,
|
|
53
53
|
LayersPanel: () => LayersPanel,
|
|
54
54
|
PaintGradientEditor: () => PaintGradientEditor,
|
|
55
|
+
PathsPanel: () => PathsPanel,
|
|
55
56
|
RefineEdgePanel: () => RefineEdgePanel,
|
|
56
57
|
SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
|
|
57
58
|
SelectionOptionsBar: () => SelectionOptionsBar,
|
|
@@ -233,8 +234,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
// src/image-editor/ImageEditor.tsx
|
|
236
|
-
var
|
|
237
|
-
var
|
|
237
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
238
|
+
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
238
239
|
|
|
239
240
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
240
241
|
var import_react5 = require("react");
|
|
@@ -4987,6 +4988,7 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
4987
4988
|
Math.round(zoom * 100),
|
|
4988
4989
|
"%"
|
|
4989
4990
|
] }),
|
|
4991
|
+
!session.showsWholeImage && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
|
|
4990
4992
|
session.computing && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
|
|
4991
4993
|
] }),
|
|
4992
4994
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
|
|
@@ -5058,7 +5060,8 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
|
|
|
5058
5060
|
value: settings.output,
|
|
5059
5061
|
options: [
|
|
5060
5062
|
{ value: "new-layer", label: "New Layer" },
|
|
5061
|
-
{ value: "current", label: "Current Layer" }
|
|
5063
|
+
{ value: "current", label: "Current Layer" },
|
|
5064
|
+
{ value: "duplicate-layer", label: "Duplicate Layer" }
|
|
5062
5065
|
],
|
|
5063
5066
|
onChange: (v) => set({ output: v })
|
|
5064
5067
|
}
|
|
@@ -5964,14 +5967,121 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
5964
5967
|
] });
|
|
5965
5968
|
};
|
|
5966
5969
|
|
|
5967
|
-
// src/image-editor/
|
|
5970
|
+
// src/image-editor/PathsPanel.tsx
|
|
5968
5971
|
var import_react30 = require("react");
|
|
5969
5972
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
5970
5973
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5974
|
+
var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
5975
|
+
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
5976
|
+
const [, setTick] = (0, import_react30.useState)(0);
|
|
5977
|
+
(0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5978
|
+
const [renaming, setRenaming] = (0, import_react30.useState)(null);
|
|
5979
|
+
const [color, setColor] = (0, import_react30.useState)("#000000");
|
|
5980
|
+
const [width, setWidth] = (0, import_react30.useState)(2);
|
|
5981
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5982
|
+
const paths = controller.getPaths();
|
|
5983
|
+
const activeId = controller.getState().activePathId ?? null;
|
|
5984
|
+
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
5985
|
+
const hasSelection = Boolean(controller.getSelection());
|
|
5986
|
+
const { width: w, height: h } = controller.getState().imageDimensions;
|
|
5987
|
+
const attempt = (fn) => {
|
|
5988
|
+
setError(null);
|
|
5989
|
+
try {
|
|
5990
|
+
fn();
|
|
5991
|
+
} catch (err) {
|
|
5992
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
5993
|
+
}
|
|
5994
|
+
};
|
|
5995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
5996
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
5997
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5999
|
+
"li",
|
|
6000
|
+
{
|
|
6001
|
+
"data-testid": "path-row",
|
|
6002
|
+
"aria-current": p.id === activeId ? "true" : void 0,
|
|
6003
|
+
className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
|
|
6004
|
+
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
6005
|
+
onDoubleClick: () => setRenaming(p.id),
|
|
6006
|
+
children: [
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: (0, import_image_editor19.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
6008
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6009
|
+
"input",
|
|
6010
|
+
{
|
|
6011
|
+
autoFocus: true,
|
|
6012
|
+
"aria-label": "Path name",
|
|
6013
|
+
defaultValue: p.work ? "" : p.name,
|
|
6014
|
+
placeholder: "Path name",
|
|
6015
|
+
className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
|
|
6016
|
+
onClick: (e) => e.stopPropagation(),
|
|
6017
|
+
onBlur: (e) => {
|
|
6018
|
+
setRenaming(null);
|
|
6019
|
+
const name = e.currentTarget.value.trim();
|
|
6020
|
+
if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
|
|
6021
|
+
},
|
|
6022
|
+
onKeyDown: (e) => {
|
|
6023
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
6024
|
+
if (e.key === "Escape") setRenaming(null);
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
6027
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
6028
|
+
]
|
|
6029
|
+
},
|
|
6030
|
+
p.id
|
|
6031
|
+
)) }),
|
|
6032
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6033
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6034
|
+
"button",
|
|
6035
|
+
{
|
|
6036
|
+
type: "button",
|
|
6037
|
+
className: btn3(),
|
|
6038
|
+
disabled: !active,
|
|
6039
|
+
title: "Load the path as the selection (Shift adds, Alt subtracts)",
|
|
6040
|
+
onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") })),
|
|
6041
|
+
children: "Load as Selection"
|
|
6042
|
+
}
|
|
6043
|
+
),
|
|
6044
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
6045
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
6047
|
+
] }),
|
|
6048
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
|
|
6050
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
6051
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
6052
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6053
|
+
"input",
|
|
6054
|
+
{
|
|
6055
|
+
type: "number",
|
|
6056
|
+
min: 0.5,
|
|
6057
|
+
max: 250,
|
|
6058
|
+
step: 0.5,
|
|
6059
|
+
"aria-label": "Stroke width",
|
|
6060
|
+
value: width,
|
|
6061
|
+
onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
|
|
6062
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
6063
|
+
}
|
|
6064
|
+
),
|
|
6065
|
+
"px"
|
|
6066
|
+
] }),
|
|
6067
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
6068
|
+
] }),
|
|
6069
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6070
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
6071
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
6072
|
+
] }),
|
|
6073
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6074
|
+
] });
|
|
6075
|
+
};
|
|
6076
|
+
|
|
6077
|
+
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
6078
|
+
var import_react31 = require("react");
|
|
6079
|
+
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
6080
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5971
6081
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
5972
6082
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
5973
|
-
const [, setTick] = (0,
|
|
5974
|
-
(0,
|
|
6083
|
+
const [, setTick] = (0, import_react31.useState)(0);
|
|
6084
|
+
(0, import_react31.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
5975
6085
|
const bar = tool.bar();
|
|
5976
6086
|
if (!tool.active || !bar) return null;
|
|
5977
6087
|
const warp = tool.warpBar();
|
|
@@ -5983,17 +6093,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
5983
6093
|
const v = Number(raw);
|
|
5984
6094
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
5985
6095
|
};
|
|
5986
|
-
return /* @__PURE__ */ (0,
|
|
5987
|
-
/* @__PURE__ */ (0,
|
|
5988
|
-
/* @__PURE__ */ (0,
|
|
5989
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
5990
|
-
/* @__PURE__ */ (0,
|
|
5991
|
-
/* @__PURE__ */ (0,
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
6096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.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: [
|
|
6097
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor20.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime31.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)) }),
|
|
6098
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor20.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime31.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)) }),
|
|
6099
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
6100
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
6102
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor20.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
5993
6103
|
] }),
|
|
5994
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
6104
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6105
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
6106
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5997
6107
|
"input",
|
|
5998
6108
|
{
|
|
5999
6109
|
type: "number",
|
|
@@ -6014,9 +6124,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6014
6124
|
},
|
|
6015
6125
|
`${k}:${warp[k]}`
|
|
6016
6126
|
),
|
|
6017
|
-
/* @__PURE__ */ (0,
|
|
6127
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
6018
6128
|
] }, k)),
|
|
6019
|
-
/* @__PURE__ */ (0,
|
|
6129
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6020
6130
|
"button",
|
|
6021
6131
|
{
|
|
6022
6132
|
type: "button",
|
|
@@ -6028,26 +6138,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6028
6138
|
children: "Vertical"
|
|
6029
6139
|
}
|
|
6030
6140
|
),
|
|
6031
|
-
/* @__PURE__ */ (0,
|
|
6032
|
-
/* @__PURE__ */ (0,
|
|
6033
|
-
/* @__PURE__ */ (0,
|
|
6141
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6142
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
6143
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6034
6144
|
"select",
|
|
6035
6145
|
{
|
|
6036
6146
|
"aria-label": "Warp grid",
|
|
6037
|
-
value:
|
|
6147
|
+
value: import_image_editor20.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
6038
6148
|
onChange: (e) => {
|
|
6039
|
-
const g =
|
|
6149
|
+
const g = import_image_editor20.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
6040
6150
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
6041
6151
|
},
|
|
6042
6152
|
className: imageFieldClass,
|
|
6043
|
-
children:
|
|
6153
|
+
children: import_image_editor20.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
6044
6154
|
}
|
|
6045
6155
|
)
|
|
6046
6156
|
] })
|
|
6047
6157
|
] }),
|
|
6048
|
-
tool.mode !== "warp" &&
|
|
6049
|
-
/* @__PURE__ */ (0,
|
|
6050
|
-
/* @__PURE__ */ (0,
|
|
6158
|
+
tool.mode !== "warp" && import_image_editor20.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
6159
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
6160
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6051
6161
|
"input",
|
|
6052
6162
|
{
|
|
6053
6163
|
type: "number",
|
|
@@ -6067,8 +6177,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6067
6177
|
},
|
|
6068
6178
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
6069
6179
|
),
|
|
6070
|
-
/* @__PURE__ */ (0,
|
|
6071
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
6180
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
6181
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6072
6182
|
"button",
|
|
6073
6183
|
{
|
|
6074
6184
|
type: "button",
|
|
@@ -6083,33 +6193,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
6083
6193
|
}
|
|
6084
6194
|
)
|
|
6085
6195
|
] }, f.id)),
|
|
6086
|
-
/* @__PURE__ */ (0,
|
|
6087
|
-
/* @__PURE__ */ (0,
|
|
6088
|
-
/* @__PURE__ */ (0,
|
|
6196
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6197
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
6198
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6089
6199
|
"select",
|
|
6090
6200
|
{
|
|
6091
6201
|
"aria-label": "Interpolation",
|
|
6092
6202
|
value: tool.interpolation,
|
|
6093
6203
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
6094
6204
|
className: imageFieldClass,
|
|
6095
|
-
children:
|
|
6205
|
+
children: import_image_editor20.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
6096
6206
|
}
|
|
6097
6207
|
)
|
|
6098
6208
|
] }),
|
|
6099
|
-
/* @__PURE__ */ (0,
|
|
6100
|
-
/* @__PURE__ */ (0,
|
|
6101
|
-
tool.error && /* @__PURE__ */ (0,
|
|
6209
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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" }),
|
|
6210
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
6211
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
6102
6212
|
] });
|
|
6103
6213
|
};
|
|
6104
6214
|
|
|
6105
6215
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
6106
|
-
var
|
|
6107
|
-
var
|
|
6108
|
-
var
|
|
6216
|
+
var import_react32 = require("react");
|
|
6217
|
+
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
6218
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6109
6219
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
6110
|
-
const [, setTick] = (0,
|
|
6111
|
-
(0,
|
|
6112
|
-
const [error, setError] = (0,
|
|
6220
|
+
const [, setTick] = (0, import_react32.useState)(0);
|
|
6221
|
+
(0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6222
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
6113
6223
|
const active = controller.getActiveLayer();
|
|
6114
6224
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
6115
6225
|
const set = (change) => {
|
|
@@ -6117,28 +6227,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6117
6227
|
if (!shapeId) return;
|
|
6118
6228
|
try {
|
|
6119
6229
|
setError(null);
|
|
6120
|
-
(0,
|
|
6230
|
+
(0, import_image_editor21.applyShapeOptions)(controller, shapeId, change);
|
|
6121
6231
|
} catch (e) {
|
|
6122
6232
|
setError(e instanceof Error ? e.message : String(e));
|
|
6123
6233
|
}
|
|
6124
6234
|
};
|
|
6125
6235
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
6126
|
-
return /* @__PURE__ */ (0,
|
|
6127
|
-
/* @__PURE__ */ (0,
|
|
6128
|
-
/* @__PURE__ */ (0,
|
|
6129
|
-
/* @__PURE__ */ (0,
|
|
6130
|
-
/* @__PURE__ */ (0,
|
|
6236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor21.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor21.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
6238
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6239
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6240
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
6131
6241
|
"Fill",
|
|
6132
|
-
/* @__PURE__ */ (0,
|
|
6242
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
6133
6243
|
] }),
|
|
6134
|
-
/* @__PURE__ */ (0,
|
|
6135
|
-
/* @__PURE__ */ (0,
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6245
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
6136
6246
|
"Stroke",
|
|
6137
|
-
/* @__PURE__ */ (0,
|
|
6247
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
6138
6248
|
] }),
|
|
6139
|
-
/* @__PURE__ */ (0,
|
|
6249
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6140
6250
|
"Width",
|
|
6141
|
-
/* @__PURE__ */ (0,
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6142
6252
|
"input",
|
|
6143
6253
|
{
|
|
6144
6254
|
type: "number",
|
|
@@ -6152,52 +6262,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
6152
6262
|
)
|
|
6153
6263
|
] })
|
|
6154
6264
|
] }),
|
|
6155
|
-
/* @__PURE__ */ (0,
|
|
6156
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
6265
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6266
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6157
6267
|
"Radius",
|
|
6158
|
-
/* @__PURE__ */ (0,
|
|
6268
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.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}` })
|
|
6159
6269
|
] }),
|
|
6160
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
6270
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6161
6271
|
"Sides",
|
|
6162
|
-
/* @__PURE__ */ (0,
|
|
6272
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.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}` })
|
|
6163
6273
|
] }),
|
|
6164
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6274
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6275
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6166
6276
|
"Points",
|
|
6167
|
-
/* @__PURE__ */ (0,
|
|
6277
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.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}` })
|
|
6168
6278
|
] }),
|
|
6169
|
-
/* @__PURE__ */ (0,
|
|
6279
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6170
6280
|
"Inner",
|
|
6171
|
-
/* @__PURE__ */ (0,
|
|
6281
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
6172
6282
|
] })
|
|
6173
6283
|
] }),
|
|
6174
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6284
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6285
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6176
6286
|
"Weight",
|
|
6177
|
-
/* @__PURE__ */ (0,
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.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}` })
|
|
6178
6288
|
] }),
|
|
6179
|
-
/* @__PURE__ */ (0,
|
|
6180
|
-
/* @__PURE__ */ (0,
|
|
6289
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6290
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
6181
6291
|
"Arrowhead"
|
|
6182
6292
|
] })
|
|
6183
6293
|
] })
|
|
6184
6294
|
] }),
|
|
6185
|
-
/* @__PURE__ */ (0,
|
|
6186
|
-
error && /* @__PURE__ */ (0,
|
|
6295
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.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." }),
|
|
6296
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6187
6297
|
] });
|
|
6188
6298
|
};
|
|
6189
6299
|
|
|
6190
6300
|
// src/image-editor/TypeOptionsBar.tsx
|
|
6191
|
-
var
|
|
6192
|
-
var
|
|
6193
|
-
var
|
|
6301
|
+
var import_react33 = require("react");
|
|
6302
|
+
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
6303
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6194
6304
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
6195
6305
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
6196
6306
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
6197
|
-
const [, setTick] = (0,
|
|
6198
|
-
(0,
|
|
6199
|
-
(0,
|
|
6200
|
-
const [error, setError] = (0,
|
|
6307
|
+
const [, setTick] = (0, import_react33.useState)(0);
|
|
6308
|
+
(0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
6309
|
+
(0, import_react33.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
6310
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
6201
6311
|
const active = controller.getActiveLayer();
|
|
6202
6312
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
6203
6313
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -6250,11 +6360,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6250
6360
|
setError(e instanceof Error ? e.message : String(e));
|
|
6251
6361
|
}
|
|
6252
6362
|
};
|
|
6253
|
-
return /* @__PURE__ */ (0,
|
|
6254
|
-
/* @__PURE__ */ (0,
|
|
6255
|
-
/* @__PURE__ */ (0,
|
|
6363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
6364
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6365
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6256
6366
|
"Font",
|
|
6257
|
-
/* @__PURE__ */ (0,
|
|
6367
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6258
6368
|
"input",
|
|
6259
6369
|
{
|
|
6260
6370
|
list: "pixerate-type-fonts",
|
|
@@ -6264,11 +6374,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6264
6374
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
6265
6375
|
}
|
|
6266
6376
|
),
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6377
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: f }, f)) })
|
|
6268
6378
|
] }),
|
|
6269
|
-
/* @__PURE__ */ (0,
|
|
6379
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
6270
6380
|
"Size",
|
|
6271
|
-
/* @__PURE__ */ (0,
|
|
6381
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6272
6382
|
"input",
|
|
6273
6383
|
{
|
|
6274
6384
|
type: "number",
|
|
@@ -6281,14 +6391,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6281
6391
|
}
|
|
6282
6392
|
)
|
|
6283
6393
|
] }),
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6285
|
-
/* @__PURE__ */ (0,
|
|
6286
|
-
/* @__PURE__ */ (0,
|
|
6394
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.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" }),
|
|
6395
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
6287
6397
|
] }),
|
|
6288
|
-
/* @__PURE__ */ (0,
|
|
6289
|
-
/* @__PURE__ */ (0,
|
|
6290
|
-
|
|
6291
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor22.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
6399
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
6400
|
+
import_image_editor22.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
6401
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6292
6402
|
"button",
|
|
6293
6403
|
{
|
|
6294
6404
|
type: "button",
|
|
@@ -6300,19 +6410,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
6300
6410
|
}
|
|
6301
6411
|
)
|
|
6302
6412
|
] }),
|
|
6303
|
-
/* @__PURE__ */ (0,
|
|
6304
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
6413
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
6414
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
6305
6415
|
"Missing ",
|
|
6306
6416
|
missing.length === 1 ? "font" : "fonts",
|
|
6307
6417
|
": ",
|
|
6308
6418
|
missing.join(", ")
|
|
6309
6419
|
] }),
|
|
6310
|
-
error && /* @__PURE__ */ (0,
|
|
6420
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
6311
6421
|
] });
|
|
6312
6422
|
};
|
|
6313
6423
|
|
|
6314
6424
|
// src/image-editor/ImageEditor.tsx
|
|
6315
|
-
var
|
|
6425
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6316
6426
|
var ImageEditor = ({
|
|
6317
6427
|
editor: externalEditor,
|
|
6318
6428
|
src,
|
|
@@ -6336,51 +6446,51 @@ var ImageEditor = ({
|
|
|
6336
6446
|
const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
|
|
6337
6447
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
6338
6448
|
});
|
|
6339
|
-
const legacyProcess = (0,
|
|
6340
|
-
const [activeTab, setActiveTab] = (0,
|
|
6341
|
-
const rootRef = (0,
|
|
6449
|
+
const legacyProcess = (0, import_image_editor23.normalizeProcessVersion)(state.adjustments.process) < import_image_editor23.LATEST_PROCESS_VERSION;
|
|
6450
|
+
const [activeTab, setActiveTab] = (0, import_react34.useState)("crop");
|
|
6451
|
+
const rootRef = (0, import_react34.useRef)(null);
|
|
6342
6452
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
6343
|
-
const activeTabRef = (0,
|
|
6453
|
+
const activeTabRef = (0, import_react34.useRef)(activeTab);
|
|
6344
6454
|
activeTabRef.current = activeTab;
|
|
6345
6455
|
const openPanel = async (ref) => {
|
|
6346
6456
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
6347
6457
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
6348
6458
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
6349
6459
|
};
|
|
6350
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
6351
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
6352
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
6353
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
6354
|
-
const [typeSession, setTypeSession] = (0,
|
|
6355
|
-
const [selectionError, setSelectionError] = (0,
|
|
6356
|
-
const [paintError, setPaintError] = (0,
|
|
6357
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
6460
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react34.useState)(null);
|
|
6461
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
6462
|
+
const [shapeOptions, setShapeOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
6463
|
+
const [typeOptions, setTypeOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
6464
|
+
const [typeSession, setTypeSession] = (0, import_react34.useState)(null);
|
|
6465
|
+
const [selectionError, setSelectionError] = (0, import_react34.useState)(null);
|
|
6466
|
+
const [paintError, setPaintError] = (0, import_react34.useState)(null);
|
|
6467
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react34.useState)(null);
|
|
6358
6468
|
const handleCanvasError = (source, message) => {
|
|
6359
6469
|
if (source === "paint") setPaintError(message);
|
|
6360
6470
|
else if (source === "select") setSelectionError(message);
|
|
6361
6471
|
else setShapeTypeError(message);
|
|
6362
6472
|
};
|
|
6363
6473
|
const finishTyping = () => setTypeSession(null);
|
|
6364
|
-
const transformToolRef = (0,
|
|
6365
|
-
const transformControllerRef = (0,
|
|
6474
|
+
const transformToolRef = (0, import_react34.useRef)(null);
|
|
6475
|
+
const transformControllerRef = (0, import_react34.useRef)(controller);
|
|
6366
6476
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
6367
6477
|
transformToolRef.current?.cancel();
|
|
6368
|
-
transformToolRef.current = new
|
|
6478
|
+
transformToolRef.current = new import_image_editor23.FreeTransformTool(controller, {
|
|
6369
6479
|
schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
|
|
6370
6480
|
});
|
|
6371
6481
|
transformControllerRef.current = controller;
|
|
6372
6482
|
}
|
|
6373
6483
|
const transformTool = transformToolRef.current;
|
|
6374
|
-
const [, setTransformTick] = (0,
|
|
6375
|
-
(0,
|
|
6376
|
-
(0,
|
|
6377
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
6378
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
6379
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
6380
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
6381
|
-
const [aiError, setAiError] = (0,
|
|
6382
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
6383
|
-
const [aiTarget, setAiTarget] = (0,
|
|
6484
|
+
const [, setTransformTick] = (0, import_react34.useState)(0);
|
|
6485
|
+
(0, import_react34.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
6486
|
+
(0, import_react34.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
6487
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react34.useState)("");
|
|
6488
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react34.useState)("annotations");
|
|
6489
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react34.useState)(false);
|
|
6490
|
+
const [isInpainting, setIsInpainting] = (0, import_react34.useState)(false);
|
|
6491
|
+
const [aiError, setAiError] = (0, import_react34.useState)(null);
|
|
6492
|
+
const [aiSuccess, setAiSuccess] = (0, import_react34.useState)(null);
|
|
6493
|
+
const [aiTarget, setAiTarget] = (0, import_react34.useState)("auto");
|
|
6384
6494
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
6385
6495
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
6386
6496
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -6443,11 +6553,11 @@ var ImageEditor = ({
|
|
|
6443
6553
|
setIsInpainting(false);
|
|
6444
6554
|
}
|
|
6445
6555
|
};
|
|
6446
|
-
const [activeColor, setActiveColor] = (0,
|
|
6447
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
6448
|
-
const [fontSize, setFontSize] = (0,
|
|
6449
|
-
const [textInput, setTextInput] = (0,
|
|
6450
|
-
(0,
|
|
6556
|
+
const [activeColor, setActiveColor] = (0, import_react34.useState)("#ef4444");
|
|
6557
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react34.useState)(3);
|
|
6558
|
+
const [fontSize, setFontSize] = (0, import_react34.useState)(24);
|
|
6559
|
+
const [textInput, setTextInput] = (0, import_react34.useState)("");
|
|
6560
|
+
(0, import_react34.useEffect)(() => {
|
|
6451
6561
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
6452
6562
|
editor.setTool("crop");
|
|
6453
6563
|
}
|
|
@@ -6475,16 +6585,16 @@ var ImageEditor = ({
|
|
|
6475
6585
|
link.click();
|
|
6476
6586
|
}
|
|
6477
6587
|
};
|
|
6478
|
-
return /* @__PURE__ */ (0,
|
|
6588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6479
6589
|
"div",
|
|
6480
6590
|
{
|
|
6481
6591
|
ref: rootRef,
|
|
6482
6592
|
className: `${imageEditorFrameClass} ${className}`,
|
|
6483
6593
|
style,
|
|
6484
6594
|
children: [
|
|
6485
|
-
/* @__PURE__ */ (0,
|
|
6486
|
-
/* @__PURE__ */ (0,
|
|
6487
|
-
/* @__PURE__ */ (0,
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
6597
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6488
6598
|
"button",
|
|
6489
6599
|
{
|
|
6490
6600
|
type: "button",
|
|
@@ -6499,7 +6609,7 @@ var ImageEditor = ({
|
|
|
6499
6609
|
children: "Transform & Crop"
|
|
6500
6610
|
}
|
|
6501
6611
|
),
|
|
6502
|
-
/* @__PURE__ */ (0,
|
|
6612
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6503
6613
|
"button",
|
|
6504
6614
|
{
|
|
6505
6615
|
type: "button",
|
|
@@ -6514,7 +6624,7 @@ var ImageEditor = ({
|
|
|
6514
6624
|
children: "Adjustments"
|
|
6515
6625
|
}
|
|
6516
6626
|
),
|
|
6517
|
-
/* @__PURE__ */ (0,
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6518
6628
|
"button",
|
|
6519
6629
|
{
|
|
6520
6630
|
type: "button",
|
|
@@ -6529,7 +6639,7 @@ var ImageEditor = ({
|
|
|
6529
6639
|
children: "Layers"
|
|
6530
6640
|
}
|
|
6531
6641
|
),
|
|
6532
|
-
/* @__PURE__ */ (0,
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6533
6643
|
"button",
|
|
6534
6644
|
{
|
|
6535
6645
|
type: "button",
|
|
@@ -6544,7 +6654,7 @@ var ImageEditor = ({
|
|
|
6544
6654
|
children: "Paint"
|
|
6545
6655
|
}
|
|
6546
6656
|
),
|
|
6547
|
-
/* @__PURE__ */ (0,
|
|
6657
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6548
6658
|
"button",
|
|
6549
6659
|
{
|
|
6550
6660
|
type: "button",
|
|
@@ -6559,7 +6669,7 @@ var ImageEditor = ({
|
|
|
6559
6669
|
children: "Select & Mask"
|
|
6560
6670
|
}
|
|
6561
6671
|
),
|
|
6562
|
-
/* @__PURE__ */ (0,
|
|
6672
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6563
6673
|
"button",
|
|
6564
6674
|
{
|
|
6565
6675
|
type: "button",
|
|
@@ -6574,7 +6684,7 @@ var ImageEditor = ({
|
|
|
6574
6684
|
children: "Annotations"
|
|
6575
6685
|
}
|
|
6576
6686
|
),
|
|
6577
|
-
/* @__PURE__ */ (0,
|
|
6687
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6578
6688
|
"button",
|
|
6579
6689
|
{
|
|
6580
6690
|
type: "button",
|
|
@@ -6589,7 +6699,7 @@ var ImageEditor = ({
|
|
|
6589
6699
|
children: "Depth Mask"
|
|
6590
6700
|
}
|
|
6591
6701
|
),
|
|
6592
|
-
/* @__PURE__ */ (0,
|
|
6702
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6593
6703
|
"button",
|
|
6594
6704
|
{
|
|
6595
6705
|
type: "button",
|
|
@@ -6602,14 +6712,14 @@ var ImageEditor = ({
|
|
|
6602
6712
|
"aria-selected": activeTab === "ai",
|
|
6603
6713
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
6604
6714
|
children: [
|
|
6605
|
-
/* @__PURE__ */ (0,
|
|
6715
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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" }) }),
|
|
6606
6716
|
"AI Tools"
|
|
6607
6717
|
]
|
|
6608
6718
|
}
|
|
6609
6719
|
)
|
|
6610
6720
|
] }),
|
|
6611
|
-
/* @__PURE__ */ (0,
|
|
6612
|
-
/* @__PURE__ */ (0,
|
|
6721
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
6722
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6613
6723
|
"button",
|
|
6614
6724
|
{
|
|
6615
6725
|
type: "button",
|
|
@@ -6620,7 +6730,7 @@ var ImageEditor = ({
|
|
|
6620
6730
|
children: "\u21A9"
|
|
6621
6731
|
}
|
|
6622
6732
|
),
|
|
6623
|
-
/* @__PURE__ */ (0,
|
|
6733
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6624
6734
|
"button",
|
|
6625
6735
|
{
|
|
6626
6736
|
type: "button",
|
|
@@ -6631,7 +6741,7 @@ var ImageEditor = ({
|
|
|
6631
6741
|
children: "\u21AA"
|
|
6632
6742
|
}
|
|
6633
6743
|
),
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6635
6745
|
"button",
|
|
6636
6746
|
{
|
|
6637
6747
|
type: "button",
|
|
@@ -6640,8 +6750,8 @@ var ImageEditor = ({
|
|
|
6640
6750
|
children: "Reset"
|
|
6641
6751
|
}
|
|
6642
6752
|
),
|
|
6643
|
-
/* @__PURE__ */ (0,
|
|
6644
|
-
/* @__PURE__ */ (0,
|
|
6753
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6754
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6645
6755
|
"button",
|
|
6646
6756
|
{
|
|
6647
6757
|
type: "button",
|
|
@@ -6651,11 +6761,11 @@ var ImageEditor = ({
|
|
|
6651
6761
|
children: "-"
|
|
6652
6762
|
}
|
|
6653
6763
|
),
|
|
6654
|
-
/* @__PURE__ */ (0,
|
|
6764
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
6655
6765
|
Math.round(state.zoom * 100),
|
|
6656
6766
|
"%"
|
|
6657
6767
|
] }),
|
|
6658
|
-
/* @__PURE__ */ (0,
|
|
6768
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6659
6769
|
"button",
|
|
6660
6770
|
{
|
|
6661
6771
|
type: "button",
|
|
@@ -6665,8 +6775,8 @@ var ImageEditor = ({
|
|
|
6665
6775
|
children: "+"
|
|
6666
6776
|
}
|
|
6667
6777
|
),
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
6669
|
-
/* @__PURE__ */ (0,
|
|
6778
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
6779
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6670
6780
|
"button",
|
|
6671
6781
|
{
|
|
6672
6782
|
type: "button",
|
|
@@ -6677,7 +6787,7 @@ var ImageEditor = ({
|
|
|
6677
6787
|
children: "Hold Compare"
|
|
6678
6788
|
}
|
|
6679
6789
|
),
|
|
6680
|
-
/* @__PURE__ */ (0,
|
|
6790
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6681
6791
|
"button",
|
|
6682
6792
|
{
|
|
6683
6793
|
type: "button",
|
|
@@ -6688,10 +6798,10 @@ var ImageEditor = ({
|
|
|
6688
6798
|
)
|
|
6689
6799
|
] })
|
|
6690
6800
|
] }),
|
|
6691
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
6692
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
6693
|
-
/* @__PURE__ */ (0,
|
|
6694
|
-
/* @__PURE__ */ (0,
|
|
6801
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
6802
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6695
6805
|
ImageEditorCanvas,
|
|
6696
6806
|
{
|
|
6697
6807
|
editor,
|
|
@@ -6715,11 +6825,11 @@ var ImageEditor = ({
|
|
|
6715
6825
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
6716
6826
|
}
|
|
6717
6827
|
),
|
|
6718
|
-
/* @__PURE__ */ (0,
|
|
6719
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
6720
|
-
/* @__PURE__ */ (0,
|
|
6721
|
-
/* @__PURE__ */ (0,
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
6828
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: imageSidebarClass, children: [
|
|
6829
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
6831
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
6832
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6723
6833
|
"button",
|
|
6724
6834
|
{
|
|
6725
6835
|
type: "button",
|
|
@@ -6731,7 +6841,7 @@ var ImageEditor = ({
|
|
|
6731
6841
|
children: "Freeform"
|
|
6732
6842
|
}
|
|
6733
6843
|
),
|
|
6734
|
-
/* @__PURE__ */ (0,
|
|
6844
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6735
6845
|
"button",
|
|
6736
6846
|
{
|
|
6737
6847
|
type: "button",
|
|
@@ -6743,7 +6853,7 @@ var ImageEditor = ({
|
|
|
6743
6853
|
children: "1:1 Square"
|
|
6744
6854
|
}
|
|
6745
6855
|
),
|
|
6746
|
-
/* @__PURE__ */ (0,
|
|
6856
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6747
6857
|
"button",
|
|
6748
6858
|
{
|
|
6749
6859
|
type: "button",
|
|
@@ -6755,7 +6865,7 @@ var ImageEditor = ({
|
|
|
6755
6865
|
children: "4:3 Standard"
|
|
6756
6866
|
}
|
|
6757
6867
|
),
|
|
6758
|
-
/* @__PURE__ */ (0,
|
|
6868
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6759
6869
|
"button",
|
|
6760
6870
|
{
|
|
6761
6871
|
type: "button",
|
|
@@ -6767,7 +6877,7 @@ var ImageEditor = ({
|
|
|
6767
6877
|
children: "16:9 Wide"
|
|
6768
6878
|
}
|
|
6769
6879
|
),
|
|
6770
|
-
/* @__PURE__ */ (0,
|
|
6880
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6771
6881
|
"button",
|
|
6772
6882
|
{
|
|
6773
6883
|
type: "button",
|
|
@@ -6779,7 +6889,7 @@ var ImageEditor = ({
|
|
|
6779
6889
|
children: "3:2 Photo"
|
|
6780
6890
|
}
|
|
6781
6891
|
),
|
|
6782
|
-
/* @__PURE__ */ (0,
|
|
6892
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6783
6893
|
"button",
|
|
6784
6894
|
{
|
|
6785
6895
|
type: "button",
|
|
@@ -6792,10 +6902,10 @@ var ImageEditor = ({
|
|
|
6792
6902
|
}
|
|
6793
6903
|
)
|
|
6794
6904
|
] }),
|
|
6795
|
-
/* @__PURE__ */ (0,
|
|
6796
|
-
/* @__PURE__ */ (0,
|
|
6797
|
-
/* @__PURE__ */ (0,
|
|
6798
|
-
/* @__PURE__ */ (0,
|
|
6905
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
|
|
6906
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
6907
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
6908
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6799
6909
|
"button",
|
|
6800
6910
|
{
|
|
6801
6911
|
type: "button",
|
|
@@ -6804,7 +6914,7 @@ var ImageEditor = ({
|
|
|
6804
6914
|
children: "Rotate -90\xB0"
|
|
6805
6915
|
}
|
|
6806
6916
|
),
|
|
6807
|
-
/* @__PURE__ */ (0,
|
|
6917
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6808
6918
|
"button",
|
|
6809
6919
|
{
|
|
6810
6920
|
type: "button",
|
|
@@ -6813,7 +6923,7 @@ var ImageEditor = ({
|
|
|
6813
6923
|
children: "Rotate +90\xB0"
|
|
6814
6924
|
}
|
|
6815
6925
|
),
|
|
6816
|
-
/* @__PURE__ */ (0,
|
|
6926
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6817
6927
|
"button",
|
|
6818
6928
|
{
|
|
6819
6929
|
type: "button",
|
|
@@ -6822,7 +6932,7 @@ var ImageEditor = ({
|
|
|
6822
6932
|
children: "Flip Horizontal"
|
|
6823
6933
|
}
|
|
6824
6934
|
),
|
|
6825
|
-
/* @__PURE__ */ (0,
|
|
6935
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6826
6936
|
"button",
|
|
6827
6937
|
{
|
|
6828
6938
|
type: "button",
|
|
@@ -6833,10 +6943,10 @@ var ImageEditor = ({
|
|
|
6833
6943
|
)
|
|
6834
6944
|
] })
|
|
6835
6945
|
] }),
|
|
6836
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
6837
|
-
/* @__PURE__ */ (0,
|
|
6838
|
-
/* @__PURE__ */ (0,
|
|
6839
|
-
/* @__PURE__ */ (0,
|
|
6946
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
6947
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
6949
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6840
6950
|
"button",
|
|
6841
6951
|
{
|
|
6842
6952
|
type: "button",
|
|
@@ -6846,25 +6956,25 @@ var ImageEditor = ({
|
|
|
6846
6956
|
}
|
|
6847
6957
|
)
|
|
6848
6958
|
] }),
|
|
6849
|
-
/* @__PURE__ */ (0,
|
|
6850
|
-
|
|
6851
|
-
/* @__PURE__ */ (0,
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Histogram, { histogram: editor.histogram }),
|
|
6960
|
+
import_image_editor23.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react34.default.Fragment, { children: [
|
|
6961
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6852
6962
|
ControlSlider,
|
|
6853
6963
|
{
|
|
6854
6964
|
spec,
|
|
6855
|
-
value: (0,
|
|
6965
|
+
value: (0, import_image_editor23.readAdjustmentControls)(state.adjustments)[spec.id],
|
|
6856
6966
|
disabled: spec.requiresProcess !== void 0 && legacyProcess,
|
|
6857
6967
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
6858
6968
|
}
|
|
6859
6969
|
),
|
|
6860
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
6970
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6861
6971
|
"div",
|
|
6862
6972
|
{
|
|
6863
6973
|
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",
|
|
6864
6974
|
"data-testid": "image-editor-process-notice",
|
|
6865
6975
|
children: [
|
|
6866
|
-
/* @__PURE__ */ (0,
|
|
6867
|
-
/* @__PURE__ */ (0,
|
|
6976
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
6977
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6868
6978
|
"button",
|
|
6869
6979
|
{
|
|
6870
6980
|
type: "button",
|
|
@@ -6877,7 +6987,7 @@ var ImageEditor = ({
|
|
|
6877
6987
|
}
|
|
6878
6988
|
)
|
|
6879
6989
|
] }, spec.id)),
|
|
6880
|
-
/* @__PURE__ */ (0,
|
|
6990
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6881
6991
|
AdjustmentLayersPanel,
|
|
6882
6992
|
{
|
|
6883
6993
|
controller,
|
|
@@ -6886,9 +6996,9 @@ var ImageEditor = ({
|
|
|
6886
6996
|
}
|
|
6887
6997
|
) })
|
|
6888
6998
|
] }),
|
|
6889
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
6890
|
-
/* @__PURE__ */ (0,
|
|
6891
|
-
/* @__PURE__ */ (0,
|
|
6999
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7000
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6892
7002
|
"button",
|
|
6893
7003
|
{
|
|
6894
7004
|
type: "button",
|
|
@@ -6899,15 +7009,15 @@ var ImageEditor = ({
|
|
|
6899
7009
|
children: "Free Transform"
|
|
6900
7010
|
}
|
|
6901
7011
|
),
|
|
6902
|
-
/* @__PURE__ */ (0,
|
|
6903
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
6904
|
-
/* @__PURE__ */ (0,
|
|
6905
|
-
/* @__PURE__ */ (0,
|
|
7012
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayersPanel, { controller }),
|
|
7013
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
7015
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColorProfilePanel, { controller })
|
|
6906
7016
|
] }),
|
|
6907
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
6908
|
-
/* @__PURE__ */ (0,
|
|
6909
|
-
/* @__PURE__ */ (0,
|
|
6910
|
-
/* @__PURE__ */ (0,
|
|
7017
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7018
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
7019
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BrushOptionsBar, { controller }),
|
|
7020
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6911
7021
|
"button",
|
|
6912
7022
|
{
|
|
6913
7023
|
type: "button",
|
|
@@ -6918,12 +7028,12 @@ var ImageEditor = ({
|
|
|
6918
7028
|
children: "Free Transform"
|
|
6919
7029
|
}
|
|
6920
7030
|
),
|
|
6921
|
-
paintError && /* @__PURE__ */ (0,
|
|
6922
|
-
/* @__PURE__ */ (0,
|
|
7031
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
7032
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayersPanel, { controller }) })
|
|
6923
7033
|
] }),
|
|
6924
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
6925
|
-
/* @__PURE__ */ (0,
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
7034
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7035
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
7036
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6927
7037
|
"button",
|
|
6928
7038
|
{
|
|
6929
7039
|
type: "button",
|
|
@@ -6934,13 +7044,13 @@ var ImageEditor = ({
|
|
|
6934
7044
|
},
|
|
6935
7045
|
t
|
|
6936
7046
|
)) }),
|
|
6937
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
6938
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
6939
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
6940
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
6941
|
-
/* @__PURE__ */ (0,
|
|
6942
|
-
/* @__PURE__ */ (0,
|
|
6943
|
-
/* @__PURE__ */ (0,
|
|
7047
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
7048
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
7049
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime34.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" }),
|
|
7050
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
7051
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
|
|
7052
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
7053
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6944
7054
|
"button",
|
|
6945
7055
|
{
|
|
6946
7056
|
type: "button",
|
|
@@ -6950,18 +7060,18 @@ var ImageEditor = ({
|
|
|
6950
7060
|
},
|
|
6951
7061
|
t
|
|
6952
7062
|
)) }),
|
|
6953
|
-
/* @__PURE__ */ (0,
|
|
6954
|
-
/* @__PURE__ */ (0,
|
|
6955
|
-
/* @__PURE__ */ (0,
|
|
6956
|
-
/* @__PURE__ */ (0,
|
|
6957
|
-
/* @__PURE__ */ (0,
|
|
6958
|
-
/* @__PURE__ */ (0,
|
|
6959
|
-
/* @__PURE__ */ (0,
|
|
7063
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
7064
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
7065
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
7066
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
7067
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
7068
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Width:" }),
|
|
7069
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
6960
7070
|
strokeWidth,
|
|
6961
7071
|
"px"
|
|
6962
7072
|
] })
|
|
6963
7073
|
] }),
|
|
6964
|
-
/* @__PURE__ */ (0,
|
|
7074
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6965
7075
|
"input",
|
|
6966
7076
|
{
|
|
6967
7077
|
type: "range",
|
|
@@ -6974,10 +7084,10 @@ var ImageEditor = ({
|
|
|
6974
7084
|
)
|
|
6975
7085
|
] })
|
|
6976
7086
|
] }),
|
|
6977
|
-
/* @__PURE__ */ (0,
|
|
6978
|
-
/* @__PURE__ */ (0,
|
|
6979
|
-
/* @__PURE__ */ (0,
|
|
6980
|
-
/* @__PURE__ */ (0,
|
|
7087
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
|
|
7088
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
|
|
7090
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6981
7091
|
"input",
|
|
6982
7092
|
{
|
|
6983
7093
|
type: "text",
|
|
@@ -6988,7 +7098,7 @@ var ImageEditor = ({
|
|
|
6988
7098
|
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"
|
|
6989
7099
|
}
|
|
6990
7100
|
),
|
|
6991
|
-
/* @__PURE__ */ (0,
|
|
7101
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6992
7102
|
"button",
|
|
6993
7103
|
{
|
|
6994
7104
|
type: "button",
|
|
@@ -6998,14 +7108,14 @@ var ImageEditor = ({
|
|
|
6998
7108
|
}
|
|
6999
7109
|
)
|
|
7000
7110
|
] }),
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7003
|
-
/* @__PURE__ */ (0,
|
|
7111
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
7112
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Font Size:" }),
|
|
7113
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
|
|
7004
7114
|
fontSize,
|
|
7005
7115
|
"px"
|
|
7006
7116
|
] })
|
|
7007
7117
|
] }),
|
|
7008
|
-
/* @__PURE__ */ (0,
|
|
7118
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7009
7119
|
"input",
|
|
7010
7120
|
{
|
|
7011
7121
|
type: "range",
|
|
@@ -7016,14 +7126,14 @@ var ImageEditor = ({
|
|
|
7016
7126
|
className: imageRangeClass
|
|
7017
7127
|
}
|
|
7018
7128
|
),
|
|
7019
|
-
/* @__PURE__ */ (0,
|
|
7020
|
-
/* @__PURE__ */ (0,
|
|
7021
|
-
/* @__PURE__ */ (0,
|
|
7129
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
|
|
7130
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7131
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
7022
7132
|
"Layers (",
|
|
7023
7133
|
state.annotations.length,
|
|
7024
7134
|
")"
|
|
7025
7135
|
] }),
|
|
7026
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
7136
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7027
7137
|
"button",
|
|
7028
7138
|
{
|
|
7029
7139
|
type: "button",
|
|
@@ -7032,7 +7142,7 @@ var ImageEditor = ({
|
|
|
7032
7142
|
children: "Delete Selected"
|
|
7033
7143
|
}
|
|
7034
7144
|
),
|
|
7035
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
7145
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7036
7146
|
"button",
|
|
7037
7147
|
{
|
|
7038
7148
|
type: "button",
|
|
@@ -7043,10 +7153,10 @@ var ImageEditor = ({
|
|
|
7043
7153
|
)
|
|
7044
7154
|
] })
|
|
7045
7155
|
] }),
|
|
7046
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
7047
|
-
/* @__PURE__ */ (0,
|
|
7048
|
-
/* @__PURE__ */ (0,
|
|
7049
|
-
/* @__PURE__ */ (0,
|
|
7156
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
7157
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7158
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
7159
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7050
7160
|
"button",
|
|
7051
7161
|
{
|
|
7052
7162
|
type: "button",
|
|
@@ -7056,8 +7166,8 @@ var ImageEditor = ({
|
|
|
7056
7166
|
}
|
|
7057
7167
|
)
|
|
7058
7168
|
] }),
|
|
7059
|
-
/* @__PURE__ */ (0,
|
|
7060
|
-
/* @__PURE__ */ (0,
|
|
7169
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
7170
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7061
7171
|
"input",
|
|
7062
7172
|
{
|
|
7063
7173
|
type: "checkbox",
|
|
@@ -7066,12 +7176,12 @@ var ImageEditor = ({
|
|
|
7066
7176
|
className: "rounded accent-primary"
|
|
7067
7177
|
}
|
|
7068
7178
|
),
|
|
7069
|
-
/* @__PURE__ */ (0,
|
|
7179
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
7070
7180
|
] }),
|
|
7071
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
7072
|
-
/* @__PURE__ */ (0,
|
|
7073
|
-
/* @__PURE__ */ (0,
|
|
7074
|
-
/* @__PURE__ */ (0,
|
|
7181
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
7182
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
7183
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
7184
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7075
7185
|
"input",
|
|
7076
7186
|
{
|
|
7077
7187
|
type: "text",
|
|
@@ -7082,8 +7192,8 @@ var ImageEditor = ({
|
|
|
7082
7192
|
}
|
|
7083
7193
|
)
|
|
7084
7194
|
] }),
|
|
7085
|
-
/* @__PURE__ */ (0,
|
|
7086
|
-
/* @__PURE__ */ (0,
|
|
7195
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7087
7197
|
"button",
|
|
7088
7198
|
{
|
|
7089
7199
|
type: "button",
|
|
@@ -7092,7 +7202,7 @@ var ImageEditor = ({
|
|
|
7092
7202
|
children: "Threshold Mode"
|
|
7093
7203
|
}
|
|
7094
7204
|
),
|
|
7095
|
-
/* @__PURE__ */ (0,
|
|
7205
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7096
7206
|
"button",
|
|
7097
7207
|
{
|
|
7098
7208
|
type: "button",
|
|
@@ -7102,12 +7212,12 @@ var ImageEditor = ({
|
|
|
7102
7212
|
}
|
|
7103
7213
|
)
|
|
7104
7214
|
] }),
|
|
7105
|
-
/* @__PURE__ */ (0,
|
|
7106
|
-
/* @__PURE__ */ (0,
|
|
7107
|
-
/* @__PURE__ */ (0,
|
|
7108
|
-
/* @__PURE__ */ (0,
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7217
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
7218
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
7109
7219
|
] }),
|
|
7110
|
-
/* @__PURE__ */ (0,
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7111
7221
|
"input",
|
|
7112
7222
|
{
|
|
7113
7223
|
type: "range",
|
|
@@ -7121,12 +7231,12 @@ var ImageEditor = ({
|
|
|
7121
7231
|
}
|
|
7122
7232
|
)
|
|
7123
7233
|
] }),
|
|
7124
|
-
/* @__PURE__ */ (0,
|
|
7125
|
-
/* @__PURE__ */ (0,
|
|
7126
|
-
/* @__PURE__ */ (0,
|
|
7127
|
-
/* @__PURE__ */ (0,
|
|
7234
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
7235
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7236
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
7237
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
7128
7238
|
] }),
|
|
7129
|
-
/* @__PURE__ */ (0,
|
|
7239
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7130
7240
|
"input",
|
|
7131
7241
|
{
|
|
7132
7242
|
type: "range",
|
|
@@ -7140,12 +7250,12 @@ var ImageEditor = ({
|
|
|
7140
7250
|
}
|
|
7141
7251
|
)
|
|
7142
7252
|
] }),
|
|
7143
|
-
/* @__PURE__ */ (0,
|
|
7144
|
-
/* @__PURE__ */ (0,
|
|
7145
|
-
/* @__PURE__ */ (0,
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7253
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
7254
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
7255
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Softness:" }),
|
|
7256
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
7147
7257
|
] }),
|
|
7148
|
-
/* @__PURE__ */ (0,
|
|
7258
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7149
7259
|
"input",
|
|
7150
7260
|
{
|
|
7151
7261
|
type: "range",
|
|
@@ -7157,8 +7267,8 @@ var ImageEditor = ({
|
|
|
7157
7267
|
}
|
|
7158
7268
|
)
|
|
7159
7269
|
] }),
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7161
|
-
/* @__PURE__ */ (0,
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
7271
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7162
7272
|
"input",
|
|
7163
7273
|
{
|
|
7164
7274
|
type: "checkbox",
|
|
@@ -7167,12 +7277,12 @@ var ImageEditor = ({
|
|
|
7167
7277
|
className: "rounded accent-primary"
|
|
7168
7278
|
}
|
|
7169
7279
|
),
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Invert Mask" })
|
|
7171
7281
|
] })
|
|
7172
7282
|
] })
|
|
7173
7283
|
] }),
|
|
7174
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
7175
|
-
/* @__PURE__ */ (0,
|
|
7284
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7285
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7176
7286
|
SelectionOptionsBar,
|
|
7177
7287
|
{
|
|
7178
7288
|
controller,
|
|
@@ -7183,9 +7293,9 @@ var ImageEditor = ({
|
|
|
7183
7293
|
selectionDisplay: state.selectionDisplay
|
|
7184
7294
|
}
|
|
7185
7295
|
),
|
|
7186
|
-
selectionError && /* @__PURE__ */ (0,
|
|
7187
|
-
/* @__PURE__ */ (0,
|
|
7188
|
-
/* @__PURE__ */ (0,
|
|
7296
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", children: [
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7189
7299
|
"button",
|
|
7190
7300
|
{
|
|
7191
7301
|
type: "button",
|
|
@@ -7196,7 +7306,7 @@ var ImageEditor = ({
|
|
|
7196
7306
|
children: "Transform Selection"
|
|
7197
7307
|
}
|
|
7198
7308
|
),
|
|
7199
|
-
/* @__PURE__ */ (0,
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7200
7310
|
"button",
|
|
7201
7311
|
{
|
|
7202
7312
|
type: "button",
|
|
@@ -7208,13 +7318,14 @@ var ImageEditor = ({
|
|
|
7208
7318
|
}
|
|
7209
7319
|
)
|
|
7210
7320
|
] }),
|
|
7211
|
-
/* @__PURE__ */ (0,
|
|
7212
|
-
/* @__PURE__ */ (0,
|
|
7321
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
7322
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChannelsPanel, { controller }),
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PathsPanel, { controller })
|
|
7213
7324
|
] }),
|
|
7214
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
7215
|
-
/* @__PURE__ */ (0,
|
|
7216
|
-
/* @__PURE__ */ (0,
|
|
7217
|
-
/* @__PURE__ */ (0,
|
|
7325
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
7326
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
7327
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Results go to" }),
|
|
7328
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
7218
7329
|
"select",
|
|
7219
7330
|
{
|
|
7220
7331
|
"aria-label": "AI result target",
|
|
@@ -7222,54 +7333,54 @@ var ImageEditor = ({
|
|
|
7222
7333
|
onChange: (e) => setAiTarget(e.target.value),
|
|
7223
7334
|
className: imageSelectClass,
|
|
7224
7335
|
children: [
|
|
7225
|
-
/* @__PURE__ */ (0,
|
|
7226
|
-
/* @__PURE__ */ (0,
|
|
7227
|
-
/* @__PURE__ */ (0,
|
|
7336
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
7337
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
7338
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "replace", children: "Replace image" })
|
|
7228
7339
|
]
|
|
7229
7340
|
}
|
|
7230
7341
|
)
|
|
7231
7342
|
] }),
|
|
7232
|
-
/* @__PURE__ */ (0,
|
|
7233
|
-
/* @__PURE__ */ (0,
|
|
7234
|
-
/* @__PURE__ */ (0,
|
|
7235
|
-
/* @__PURE__ */ (0,
|
|
7343
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7344
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7345
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7346
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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" }) }),
|
|
7236
7347
|
"Background Removal"
|
|
7237
7348
|
] }),
|
|
7238
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
7349
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime34.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..." })
|
|
7239
7350
|
] }),
|
|
7240
|
-
/* @__PURE__ */ (0,
|
|
7241
|
-
/* @__PURE__ */ (0,
|
|
7351
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
7352
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7242
7353
|
"button",
|
|
7243
7354
|
{
|
|
7244
7355
|
type: "button",
|
|
7245
7356
|
onClick: handleRemoveBackground,
|
|
7246
7357
|
disabled: isRemovingBg || isInpainting,
|
|
7247
7358
|
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",
|
|
7248
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
7249
|
-
/* @__PURE__ */ (0,
|
|
7359
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
7360
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSpinnerClass }),
|
|
7250
7361
|
"Removing Background..."
|
|
7251
|
-
] }) : /* @__PURE__ */ (0,
|
|
7252
|
-
/* @__PURE__ */ (0,
|
|
7362
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
7363
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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" }) }),
|
|
7253
7364
|
"Remove Background"
|
|
7254
7365
|
] })
|
|
7255
7366
|
}
|
|
7256
7367
|
)
|
|
7257
7368
|
] }),
|
|
7258
|
-
/* @__PURE__ */ (0,
|
|
7259
|
-
/* @__PURE__ */ (0,
|
|
7260
|
-
/* @__PURE__ */ (0,
|
|
7261
|
-
/* @__PURE__ */ (0,
|
|
7262
|
-
/* @__PURE__ */ (0,
|
|
7263
|
-
/* @__PURE__ */ (0,
|
|
7369
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
7370
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7371
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
7372
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
7373
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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" }),
|
|
7374
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "m14 7 3 3" })
|
|
7264
7375
|
] }),
|
|
7265
7376
|
"Generative Inpainting"
|
|
7266
7377
|
] }),
|
|
7267
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
7378
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime34.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..." })
|
|
7268
7379
|
] }),
|
|
7269
|
-
/* @__PURE__ */ (0,
|
|
7270
|
-
/* @__PURE__ */ (0,
|
|
7271
|
-
/* @__PURE__ */ (0,
|
|
7272
|
-
/* @__PURE__ */ (0,
|
|
7380
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
7381
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
7383
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7273
7384
|
"textarea",
|
|
7274
7385
|
{
|
|
7275
7386
|
id: "ai-inpaint-prompt-react",
|
|
@@ -7281,10 +7392,10 @@ var ImageEditor = ({
|
|
|
7281
7392
|
}
|
|
7282
7393
|
)
|
|
7283
7394
|
] }),
|
|
7284
|
-
/* @__PURE__ */ (0,
|
|
7285
|
-
/* @__PURE__ */ (0,
|
|
7286
|
-
/* @__PURE__ */ (0,
|
|
7287
|
-
/* @__PURE__ */ (0,
|
|
7395
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
7396
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
7397
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
7398
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
7288
7399
|
"button",
|
|
7289
7400
|
{
|
|
7290
7401
|
type: "button",
|
|
@@ -7297,7 +7408,7 @@ var ImageEditor = ({
|
|
|
7297
7408
|
]
|
|
7298
7409
|
}
|
|
7299
7410
|
),
|
|
7300
|
-
/* @__PURE__ */ (0,
|
|
7411
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
7301
7412
|
"button",
|
|
7302
7413
|
{
|
|
7303
7414
|
type: "button",
|
|
@@ -7312,25 +7423,25 @@ var ImageEditor = ({
|
|
|
7312
7423
|
)
|
|
7313
7424
|
] })
|
|
7314
7425
|
] }),
|
|
7315
|
-
/* @__PURE__ */ (0,
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7316
7427
|
"button",
|
|
7317
7428
|
{
|
|
7318
7429
|
type: "button",
|
|
7319
7430
|
onClick: handleInpaint,
|
|
7320
7431
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
7321
7432
|
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",
|
|
7322
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
7323
|
-
/* @__PURE__ */ (0,
|
|
7433
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
7434
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSpinnerClass }),
|
|
7324
7435
|
"Generating Inpaint..."
|
|
7325
|
-
] }) : /* @__PURE__ */ (0,
|
|
7326
|
-
/* @__PURE__ */ (0,
|
|
7436
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
7437
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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" }) }),
|
|
7327
7438
|
"Apply Inpainting"
|
|
7328
7439
|
] })
|
|
7329
7440
|
}
|
|
7330
7441
|
)
|
|
7331
7442
|
] }),
|
|
7332
|
-
aiError && /* @__PURE__ */ (0,
|
|
7333
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
7443
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
7444
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
7334
7445
|
] })
|
|
7335
7446
|
] })
|
|
7336
7447
|
] })
|
|
@@ -7361,6 +7472,7 @@ var ImageEditor = ({
|
|
|
7361
7472
|
LayerEffectsPanel,
|
|
7362
7473
|
LayersPanel,
|
|
7363
7474
|
PaintGradientEditor,
|
|
7475
|
+
PathsPanel,
|
|
7364
7476
|
RefineEdgePanel,
|
|
7365
7477
|
SelectAndMaskWorkspace,
|
|
7366
7478
|
SelectionOptionsBar,
|