@pixerate/editor-react 0.98.0 → 0.99.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/animation-editor/index.cjs +11 -7
- package/dist/animation-editor/index.js +7 -7
- package/dist/canvas/index.cjs +20 -11
- package/dist/canvas/index.js +14 -9
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +8 -2
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +8 -2
- package/dist/chart/index.cjs +8 -4
- package/dist/chart/index.js +2 -2
- package/dist/{chunk-TFEKLNC7.js → chunk-EFF4YWJK.js} +390 -358
- package/dist/{chunk-S6C2W5JW.js → chunk-EP6MSQN4.js} +1 -1
- package/dist/{chunk-AILJ4JOW.js → chunk-GDPWLGPD.js} +3 -3
- package/dist/{chunk-SI2V7XPZ.js → chunk-GNO54NFG.js} +5 -1
- package/dist/{chunk-NEQI2ZIU.js → chunk-V2YC5T4R.js} +14 -8
- package/dist/image-editor/AdjustmentLayersPanel.d.cts +2 -0
- package/dist/image-editor/AdjustmentLayersPanel.d.ts +2 -0
- package/dist/image-editor/ControlSlider.d.cts +2 -0
- package/dist/image-editor/ControlSlider.d.ts +2 -0
- package/dist/image-editor/CurvesEditor.d.cts +2 -0
- package/dist/image-editor/CurvesEditor.d.ts +2 -0
- package/dist/image-editor/ImageEffectControls.d.cts +3 -1
- package/dist/image-editor/ImageEffectControls.d.ts +3 -1
- package/dist/image-editor/index.cjs +397 -361
- package/dist/image-editor/index.js +2 -2
- package/dist/image-editor/styles.d.cts +51 -0
- package/dist/image-editor/styles.d.ts +51 -0
- package/dist/index.cjs +437 -395
- package/dist/index.js +5 -5
- package/dist/paint-editor/index.cjs +8 -4
- package/dist/paint-editor/index.js +4 -4
- package/dist/parameters/index.cjs +18 -8
- package/dist/parameters/index.js +2 -2
- package/dist/playback/useElementPlaybackSurface.d.cts +5 -4
- package/dist/playback/useElementPlaybackSurface.d.ts +5 -4
- package/dist/spreadsheet/index.cjs +5 -1
- package/dist/spreadsheet/index.js +2 -2
- package/dist/vector/index.cjs +5 -1
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +11 -7
- package/dist/video-editor/index.js +7 -7
- package/package.json +3 -3
|
@@ -213,11 +213,11 @@ function useImageEditor(options = {}) {
|
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
function useImageEffectsTools(registry, controller, options = {}) {
|
|
216
|
-
const { id, namespace, readOnly } = options;
|
|
216
|
+
const { id, namespace, readOnly, playbackSurface } = options;
|
|
217
217
|
(0, import_react.useEffect)(() => {
|
|
218
218
|
if (!registry) return;
|
|
219
|
-
return registry.register((0, import_image_editor.createImageEffectsToolProvider)(controller, { id, namespace, readOnly }));
|
|
220
|
-
}, [registry, controller, id, namespace, readOnly]);
|
|
219
|
+
return registry.register((0, import_image_editor.createImageEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
|
|
220
|
+
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
// src/image-editor/ImageEditor.tsx
|
|
@@ -259,7 +259,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
259
259
|
beginGesture: (key) => o().beginGesture?.(key),
|
|
260
260
|
endGesture: () => o().endGesture?.(),
|
|
261
261
|
reveal: () => o().reveal?.(),
|
|
262
|
-
open
|
|
262
|
+
// Only a surface whose options can open things has `open`, so playback skips `open` steps
|
|
263
|
+
// (and their wait) everywhere else. Read per step, like the other options.
|
|
264
|
+
get open() {
|
|
265
|
+
return o().open ? (ref) => o().open?.(ref) : void 0;
|
|
266
|
+
},
|
|
263
267
|
get defaultKind() {
|
|
264
268
|
return o().defaultKind;
|
|
265
269
|
}
|
|
@@ -1025,11 +1029,11 @@ var ImageEditorCanvas = ({
|
|
|
1025
1029
|
// src/image-editor/ControlSlider.tsx
|
|
1026
1030
|
var import_image_editor3 = require("@pixerate/editor/image-editor");
|
|
1027
1031
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1028
|
-
var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
1032
|
+
var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
|
|
1029
1033
|
const name = label ?? spec.label;
|
|
1030
1034
|
const track = (0, import_image_editor3.controlTrackBackground)(spec);
|
|
1031
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-control-id": spec.id, children: [
|
|
1032
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex justify-between text-
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-control-id": spec.id, className, children: [
|
|
1036
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
1033
1037
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: name }),
|
|
1034
1038
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
|
|
1035
1039
|
] }),
|
|
@@ -1044,7 +1048,7 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
|
|
|
1044
1048
|
disabled,
|
|
1045
1049
|
value,
|
|
1046
1050
|
onChange: (e) => onChange(Number(e.target.value)),
|
|
1047
|
-
className: "w-full accent-
|
|
1051
|
+
className: "w-full accent-primary disabled:opacity-40"
|
|
1048
1052
|
}
|
|
1049
1053
|
),
|
|
1050
1054
|
track && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
|
|
@@ -1079,7 +1083,7 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
|
|
|
1079
1083
|
role: "img",
|
|
1080
1084
|
"aria-label": histogram ? `Histogram of ${histogram.samples} pixels` : "Histogram (no data)",
|
|
1081
1085
|
"data-testid": "image-editor-histogram",
|
|
1082
|
-
className: `w-full rounded bg-
|
|
1086
|
+
className: `w-full rounded bg-muted/40 ${className}`,
|
|
1083
1087
|
style: { height, ...style },
|
|
1084
1088
|
children: [
|
|
1085
1089
|
paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
|
|
@@ -1104,8 +1108,8 @@ var import_react7 = require("react");
|
|
|
1104
1108
|
var import_image_editor5 = require("@pixerate/editor/image-editor");
|
|
1105
1109
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1106
1110
|
var BOX = 256;
|
|
1107
|
-
var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1108
|
-
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
|
|
1111
|
+
var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
|
|
1112
|
+
var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
|
|
1109
1113
|
const svgRef = (0, import_react7.useRef)(null);
|
|
1110
1114
|
const [drag, setDrag] = (0, import_react7.useState)(null);
|
|
1111
1115
|
const toBox = (e) => {
|
|
@@ -1146,7 +1150,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1146
1150
|
role: "application",
|
|
1147
1151
|
"aria-label": `${channel} curve`,
|
|
1148
1152
|
"data-testid": "curves-editor",
|
|
1149
|
-
className:
|
|
1153
|
+
className: `rounded bg-muted/40 touch-none select-none cursor-crosshair ${className}`.trim(),
|
|
1150
1154
|
onPointerDown,
|
|
1151
1155
|
onPointerMove,
|
|
1152
1156
|
onPointerUp: () => setDrag(null),
|
|
@@ -1168,7 +1172,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1168
1172
|
cx: b.x,
|
|
1169
1173
|
cy: b.y,
|
|
1170
1174
|
r: 5,
|
|
1171
|
-
fill: drag === i ? STROKE[channel] : "#0f172a",
|
|
1175
|
+
fill: drag === i ? STROKE[channel] : "var(--background, #0f172a)",
|
|
1172
1176
|
stroke: STROKE[channel],
|
|
1173
1177
|
strokeWidth: 2,
|
|
1174
1178
|
"aria-label": `Point ${p.input} to ${p.output}`
|
|
@@ -1181,6 +1185,28 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
|
|
|
1181
1185
|
);
|
|
1182
1186
|
};
|
|
1183
1187
|
|
|
1188
|
+
// src/image-editor/styles.ts
|
|
1189
|
+
var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
|
|
1190
|
+
var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
|
|
1191
|
+
var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
|
|
1192
|
+
var imageTabClass = (active) => `px-3 py-1.5 rounded-md font-medium transition-colors ${active ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:text-foreground hover:bg-muted"}`;
|
|
1193
|
+
var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1194
|
+
var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
|
|
1195
|
+
var imageSidebarClass = "w-full md:w-80 bg-background border-t md:border-t-0 md:border-l border-border p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]";
|
|
1196
|
+
var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
|
|
1197
|
+
var imageSectionClass = "border-t border-border pt-3";
|
|
1198
|
+
var imageDividerClass = "h-px bg-border my-1";
|
|
1199
|
+
var imageSmallButtonClass = "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start disabled:opacity-40";
|
|
1200
|
+
var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
1201
|
+
var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
|
|
1202
|
+
var imageChipClass = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
1203
|
+
var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
|
|
1204
|
+
var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
|
|
1205
|
+
var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
|
|
1206
|
+
var imageRangeClass = "w-full accent-primary";
|
|
1207
|
+
var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
|
|
1208
|
+
var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
|
|
1209
|
+
|
|
1184
1210
|
// src/image-editor/AdjustmentLayersPanel.tsx
|
|
1185
1211
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1186
1212
|
var CHANNELS = [
|
|
@@ -1194,8 +1220,7 @@ var TONES = [
|
|
|
1194
1220
|
{ id: "midtones", label: "Midtones" },
|
|
1195
1221
|
{ id: "highlights", label: "Highlights" }
|
|
1196
1222
|
];
|
|
1197
|
-
var
|
|
1198
|
-
var chipClass = (on) => `px-2 py-0.5 rounded text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-400 hover:text-slate-200"}`;
|
|
1223
|
+
var chipClass = (on) => `px-2 py-0.5 rounded text-[10px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:text-foreground"}`;
|
|
1199
1224
|
var HueRangeStrip = ({ bounds }) => {
|
|
1200
1225
|
const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor6.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
|
|
1201
1226
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
|
|
@@ -1204,7 +1229,7 @@ var HueRangeStrip = ({ bounds }) => {
|
|
|
1204
1229
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
|
|
1205
1230
|
] });
|
|
1206
1231
|
};
|
|
1207
|
-
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
1232
|
+
var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
|
|
1208
1233
|
const follow = layersProp === void 0;
|
|
1209
1234
|
const [, setTick] = (0, import_react8.useState)(0);
|
|
1210
1235
|
(0, import_react8.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
|
|
@@ -1228,14 +1253,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1228
1253
|
spec.id
|
|
1229
1254
|
);
|
|
1230
1255
|
const controlsOf = (layer, filter = () => true) => import_image_editor6.ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
|
|
1231
|
-
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
1256
|
+
const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1232
1257
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1233
1258
|
"input",
|
|
1234
1259
|
{
|
|
1235
1260
|
type: "checkbox",
|
|
1236
1261
|
checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)),
|
|
1237
1262
|
onChange: (e) => setParam(layer, path, e.target.checked),
|
|
1238
|
-
className: "accent-
|
|
1263
|
+
className: "accent-primary"
|
|
1239
1264
|
}
|
|
1240
1265
|
),
|
|
1241
1266
|
label
|
|
@@ -1281,14 +1306,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1281
1306
|
case "blackWhite":
|
|
1282
1307
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1283
1308
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
1284
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1285
1310
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1286
1311
|
"input",
|
|
1287
1312
|
{
|
|
1288
1313
|
type: "checkbox",
|
|
1289
1314
|
checked: layer.params.tint !== null,
|
|
1290
1315
|
onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
|
|
1291
|
-
className: "accent-
|
|
1316
|
+
className: "accent-primary"
|
|
1292
1317
|
}
|
|
1293
1318
|
),
|
|
1294
1319
|
"Tint",
|
|
@@ -1306,7 +1331,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1306
1331
|
] });
|
|
1307
1332
|
case "photoFilter":
|
|
1308
1333
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1309
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
1310
1335
|
"Filter colour",
|
|
1311
1336
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1312
1337
|
"input",
|
|
@@ -1323,19 +1348,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1323
1348
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
1324
1349
|
] });
|
|
1325
1350
|
case "invert":
|
|
1326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-
|
|
1351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
|
|
1327
1352
|
default:
|
|
1328
1353
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
|
|
1329
1354
|
}
|
|
1330
1355
|
};
|
|
1331
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className:
|
|
1332
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className:
|
|
1356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
|
|
1333
1358
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-1.5", children: [
|
|
1334
1359
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1335
1360
|
"select",
|
|
1336
1361
|
{
|
|
1337
1362
|
"aria-label": "New adjustment layer kind",
|
|
1338
|
-
className: `${
|
|
1363
|
+
className: `${imageSelectClass} flex-1`,
|
|
1339
1364
|
value: newKind,
|
|
1340
1365
|
onChange: (e) => setNewKind(e.target.value),
|
|
1341
1366
|
children: import_image_editor6.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
@@ -1345,7 +1370,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1345
1370
|
"button",
|
|
1346
1371
|
{
|
|
1347
1372
|
type: "button",
|
|
1348
|
-
className: "px-2 py-1 rounded bg-
|
|
1373
|
+
className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1349
1374
|
onClick: () => {
|
|
1350
1375
|
setSelectedId(controller.addAdjustmentLayer(newKind));
|
|
1351
1376
|
setChannel("master");
|
|
@@ -1361,7 +1386,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1361
1386
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1362
1387
|
"li",
|
|
1363
1388
|
{
|
|
1364
|
-
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-
|
|
1389
|
+
className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-primary/20 ring-1 ring-primary/50" : "bg-muted/60"}`,
|
|
1365
1390
|
children: [
|
|
1366
1391
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1367
1392
|
"input",
|
|
@@ -1370,14 +1395,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1370
1395
|
"aria-label": `Show ${label}`,
|
|
1371
1396
|
checked: layer.enabled,
|
|
1372
1397
|
onChange: () => controller.toggleAdjustmentLayer(layer.id),
|
|
1373
|
-
className: "accent-
|
|
1398
|
+
className: "accent-primary"
|
|
1374
1399
|
}
|
|
1375
1400
|
),
|
|
1376
1401
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1377
1402
|
"button",
|
|
1378
1403
|
{
|
|
1379
1404
|
type: "button",
|
|
1380
|
-
className: `flex-1 text-left truncate ${layer.enabled ? "text-
|
|
1405
|
+
className: `flex-1 text-left truncate ${layer.enabled ? "text-foreground" : "text-muted-foreground line-through"}`,
|
|
1381
1406
|
onClick: () => setSelectedId(layer.id === selectedId ? null : layer.id),
|
|
1382
1407
|
"aria-pressed": layer.id === selectedId,
|
|
1383
1408
|
children: label
|
|
@@ -1390,7 +1415,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1390
1415
|
"aria-label": `Move ${label} up`,
|
|
1391
1416
|
disabled: index === layers.length - 1,
|
|
1392
1417
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index + 1),
|
|
1393
|
-
className: "px-1 text-
|
|
1418
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1394
1419
|
children: "\u2191"
|
|
1395
1420
|
}
|
|
1396
1421
|
),
|
|
@@ -1401,7 +1426,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1401
1426
|
"aria-label": `Move ${label} down`,
|
|
1402
1427
|
disabled: index === 0,
|
|
1403
1428
|
onClick: () => controller.moveAdjustmentLayer(layer.id, index - 1),
|
|
1404
|
-
className: "px-1 text-
|
|
1429
|
+
className: "px-1 text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1405
1430
|
children: "\u2193"
|
|
1406
1431
|
}
|
|
1407
1432
|
),
|
|
@@ -1414,7 +1439,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1414
1439
|
controller.removeAdjustmentLayer(layer.id);
|
|
1415
1440
|
if (selectedId === layer.id) setSelectedId(null);
|
|
1416
1441
|
},
|
|
1417
|
-
className: "px-1 text-
|
|
1442
|
+
className: "px-1 text-destructive hover:text-destructive",
|
|
1418
1443
|
children: "\u2715"
|
|
1419
1444
|
}
|
|
1420
1445
|
)
|
|
@@ -1423,14 +1448,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
|
|
|
1423
1448
|
layer.id
|
|
1424
1449
|
);
|
|
1425
1450
|
}) }),
|
|
1426
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-
|
|
1451
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
|
|
1427
1452
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1428
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
|
|
1429
1454
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1430
1455
|
"select",
|
|
1431
1456
|
{
|
|
1432
1457
|
"aria-label": "Blend mode",
|
|
1433
|
-
className: `${
|
|
1458
|
+
className: `${imageSelectClass} flex-1`,
|
|
1434
1459
|
value: selected.blend,
|
|
1435
1460
|
onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
|
|
1436
1461
|
children: import_image_editor6.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m.id, children: m.label }, m.id))
|
|
@@ -1458,7 +1483,6 @@ var import_react10 = require("react");
|
|
|
1458
1483
|
var import_react9 = require("react");
|
|
1459
1484
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
1460
1485
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1461
|
-
var button = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
|
|
1462
1486
|
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
1463
1487
|
const [, setTick] = (0, import_react9.useState)(0);
|
|
1464
1488
|
(0, import_react9.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -1482,7 +1506,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1482
1506
|
onKeyDown: () => commitNext.current = true
|
|
1483
1507
|
};
|
|
1484
1508
|
if (!model.available || !id) {
|
|
1485
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
|
|
1486
1510
|
}
|
|
1487
1511
|
const effects = controller.getLayerEffects(id);
|
|
1488
1512
|
const patterns = controller.getDocumentPatterns();
|
|
@@ -1498,7 +1522,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1498
1522
|
const k = c.percent ? 100 : 1;
|
|
1499
1523
|
const shown = Math.round(c.value * k * 100) / 100;
|
|
1500
1524
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1501
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1502
1526
|
label,
|
|
1503
1527
|
" ",
|
|
1504
1528
|
shown,
|
|
@@ -1516,24 +1540,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1516
1540
|
disabled: model.readOnly,
|
|
1517
1541
|
...sliderEvents,
|
|
1518
1542
|
onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
|
|
1519
|
-
className: "accent-
|
|
1543
|
+
className: "accent-primary"
|
|
1520
1544
|
}
|
|
1521
1545
|
)
|
|
1522
1546
|
] }, c.key);
|
|
1523
1547
|
}
|
|
1524
1548
|
case "color":
|
|
1525
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
1549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1526
1550
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
|
|
1527
1551
|
label
|
|
1528
1552
|
] }, c.key);
|
|
1529
1553
|
case "checkbox":
|
|
1530
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
1531
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-primary" }),
|
|
1532
1556
|
label
|
|
1533
1557
|
] }, c.key);
|
|
1534
1558
|
case "select":
|
|
1535
1559
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1536
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: label }),
|
|
1537
1561
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1538
1562
|
"select",
|
|
1539
1563
|
{
|
|
@@ -1541,17 +1565,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1541
1565
|
value: c.value,
|
|
1542
1566
|
disabled: model.readOnly,
|
|
1543
1567
|
onChange: (e) => change(effectId, c, e.target.value),
|
|
1544
|
-
className:
|
|
1568
|
+
className: imageSelectClass,
|
|
1545
1569
|
children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
1546
1570
|
}
|
|
1547
1571
|
)
|
|
1548
1572
|
] }, c.key);
|
|
1549
1573
|
}
|
|
1550
1574
|
};
|
|
1551
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-
|
|
1575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
|
|
1552
1576
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1553
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-
|
|
1554
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1555
1579
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1556
1580
|
"input",
|
|
1557
1581
|
{
|
|
@@ -1560,12 +1584,12 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1560
1584
|
checked: model.enabled,
|
|
1561
1585
|
disabled: model.readOnly,
|
|
1562
1586
|
onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
|
|
1563
|
-
className: "accent-
|
|
1587
|
+
className: "accent-primary"
|
|
1564
1588
|
}
|
|
1565
1589
|
),
|
|
1566
1590
|
"On"
|
|
1567
1591
|
] }),
|
|
1568
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
1569
1593
|
"Scale",
|
|
1570
1594
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1571
1595
|
"input",
|
|
@@ -1581,7 +1605,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1581
1605
|
const v = Number(e.target.value);
|
|
1582
1606
|
if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
|
|
1583
1607
|
},
|
|
1584
|
-
className: "w-14 bg-
|
|
1608
|
+
className: "w-14 bg-muted border border-border rounded px-1"
|
|
1585
1609
|
}
|
|
1586
1610
|
),
|
|
1587
1611
|
"%"
|
|
@@ -1597,7 +1621,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1597
1621
|
if (!kind) return;
|
|
1598
1622
|
attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
|
|
1599
1623
|
},
|
|
1600
|
-
className:
|
|
1624
|
+
className: imageSelectClass,
|
|
1601
1625
|
children: [
|
|
1602
1626
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
1603
1627
|
import_image_editor7.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m.kind, children: m.label }, m.kind))
|
|
@@ -1605,11 +1629,11 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1605
1629
|
}
|
|
1606
1630
|
)
|
|
1607
1631
|
] }),
|
|
1608
|
-
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-
|
|
1632
|
+
model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
|
|
1609
1633
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
|
|
1610
1634
|
const effect = effects.items.find((e) => e.id === row.id);
|
|
1611
1635
|
const expanded = open === row.id;
|
|
1612
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
|
|
1613
1637
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
|
|
1614
1638
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1615
1639
|
"input",
|
|
@@ -1619,7 +1643,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1619
1643
|
checked: row.enabled,
|
|
1620
1644
|
disabled: model.readOnly,
|
|
1621
1645
|
onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
|
|
1622
|
-
className: "accent-
|
|
1646
|
+
className: "accent-primary"
|
|
1623
1647
|
}
|
|
1624
1648
|
),
|
|
1625
1649
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -1627,25 +1651,24 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
1627
1651
|
{
|
|
1628
1652
|
type: "button",
|
|
1629
1653
|
"aria-expanded": expanded,
|
|
1630
|
-
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-
|
|
1654
|
+
className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
|
|
1631
1655
|
onClick: () => setOpen(expanded ? null : row.id),
|
|
1632
1656
|
children: row.label
|
|
1633
1657
|
}
|
|
1634
1658
|
),
|
|
1635
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className:
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
|
|
1636
1660
|
] }),
|
|
1637
1661
|
expanded && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor7.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
|
|
1638
1662
|
] }, row.id);
|
|
1639
1663
|
}) }),
|
|
1640
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-
|
|
1664
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
1641
1665
|
] });
|
|
1642
1666
|
};
|
|
1643
1667
|
|
|
1644
1668
|
// src/image-editor/LayersPanel.tsx
|
|
1645
1669
|
var import_image_editor8 = require("@pixerate/editor/image-editor");
|
|
1646
1670
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1647
|
-
var
|
|
1648
|
-
var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "hover:bg-slate-800"}`;
|
|
1671
|
+
var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
|
|
1649
1672
|
var Thumbnail = ({
|
|
1650
1673
|
pixels,
|
|
1651
1674
|
size,
|
|
@@ -1674,7 +1697,7 @@ var Thumbnail = ({
|
|
|
1674
1697
|
"data-testid": testId,
|
|
1675
1698
|
onClick,
|
|
1676
1699
|
style: { width: size, height: size },
|
|
1677
|
-
className: `shrink-0 rounded bg-[repeating-conic-gradient(#334155_0%_25%,#1e293b_0%_50%)] [background-size:8px_8px] object-contain ${selected ? "ring-2 ring-
|
|
1700
|
+
className: `shrink-0 rounded bg-[repeating-conic-gradient(#334155_0%_25%,#1e293b_0%_50%)] [background-size:8px_8px] object-contain ${selected ? "ring-2 ring-foreground" : "ring-1 ring-border"}`
|
|
1678
1701
|
}
|
|
1679
1702
|
);
|
|
1680
1703
|
};
|
|
@@ -1733,18 +1756,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1733
1756
|
const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
|
|
1734
1757
|
const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
|
|
1735
1758
|
const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
|
|
1736
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
1759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
|
|
1737
1760
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
|
|
1738
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1739
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1740
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1741
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1742
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
|
|
1764
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
|
|
1743
1766
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1744
1767
|
"button",
|
|
1745
1768
|
{
|
|
1746
1769
|
type: "button",
|
|
1747
|
-
className:
|
|
1770
|
+
className: imageIconButtonClass,
|
|
1748
1771
|
"aria-label": "Layer menu",
|
|
1749
1772
|
"aria-haspopup": "menu",
|
|
1750
1773
|
onClick: (e) => {
|
|
@@ -1760,15 +1783,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1760
1783
|
{
|
|
1761
1784
|
"aria-label": "Bits per channel",
|
|
1762
1785
|
title: "Image \u203A Mode: bits per channel",
|
|
1763
|
-
className: "rounded bg-
|
|
1786
|
+
className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
|
|
1764
1787
|
value: controller.bitDepth,
|
|
1765
1788
|
onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
|
|
1766
1789
|
children: import_image_editor8.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
|
|
1767
1790
|
}
|
|
1768
1791
|
),
|
|
1769
1792
|
psd && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1770
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1771
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className:
|
|
1793
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor8.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
|
|
1772
1795
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1773
1796
|
"input",
|
|
1774
1797
|
{
|
|
@@ -1787,13 +1810,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1787
1810
|
)
|
|
1788
1811
|
] })
|
|
1789
1812
|
] }),
|
|
1790
|
-
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("ul", { className: "rounded bg-amber-
|
|
1813
|
+
psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
|
|
1791
1814
|
psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: n }, n)),
|
|
1792
1815
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
|
|
1793
1816
|
] }),
|
|
1794
1817
|
active && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
|
|
1795
1818
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1796
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1797
1820
|
"Opacity ",
|
|
1798
1821
|
Math.round(active.opacity * 100),
|
|
1799
1822
|
"%"
|
|
@@ -1808,12 +1831,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1808
1831
|
value: Math.round(active.opacity * 100),
|
|
1809
1832
|
...sliderEvents,
|
|
1810
1833
|
onChange: (e) => prop("opacity", Number(e.target.value) / 100),
|
|
1811
|
-
className: "accent-
|
|
1834
|
+
className: "accent-primary"
|
|
1812
1835
|
}
|
|
1813
1836
|
)
|
|
1814
1837
|
] }),
|
|
1815
1838
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
|
|
1816
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1817
1840
|
"Fill ",
|
|
1818
1841
|
Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1819
1842
|
"%"
|
|
@@ -1829,7 +1852,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1829
1852
|
value: Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
|
|
1830
1853
|
...sliderEvents,
|
|
1831
1854
|
onChange: (e) => prop("fillOpacity", Number(e.target.value) / 100),
|
|
1832
|
-
className: "accent-
|
|
1855
|
+
className: "accent-primary disabled:opacity-40"
|
|
1833
1856
|
}
|
|
1834
1857
|
)
|
|
1835
1858
|
] }),
|
|
@@ -1837,7 +1860,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1837
1860
|
"select",
|
|
1838
1861
|
{
|
|
1839
1862
|
"aria-label": "Layer blend mode",
|
|
1840
|
-
className:
|
|
1863
|
+
className: imageSelectClass,
|
|
1841
1864
|
value: active.blend,
|
|
1842
1865
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
|
|
1843
1866
|
children: [
|
|
@@ -1846,7 +1869,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1846
1869
|
]
|
|
1847
1870
|
}
|
|
1848
1871
|
),
|
|
1849
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
1850
1873
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1851
1874
|
"input",
|
|
1852
1875
|
{
|
|
@@ -1854,12 +1877,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1854
1877
|
"aria-label": "Clip to layer below",
|
|
1855
1878
|
checked: Boolean(active.clipped),
|
|
1856
1879
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { clipped: e.target.checked })),
|
|
1857
|
-
className: "accent-
|
|
1880
|
+
className: "accent-primary"
|
|
1858
1881
|
}
|
|
1859
1882
|
),
|
|
1860
1883
|
"Clip to below"
|
|
1861
1884
|
] }),
|
|
1862
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1863
1886
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1864
1887
|
"input",
|
|
1865
1888
|
{
|
|
@@ -1867,13 +1890,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1867
1890
|
"aria-label": `Lock ${k}`,
|
|
1868
1891
|
checked: Boolean(active.locks?.[k]),
|
|
1869
1892
|
onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { locks: { ...active.locks, [k]: e.target.checked } })),
|
|
1870
|
-
className: "accent-
|
|
1893
|
+
className: "accent-primary"
|
|
1871
1894
|
}
|
|
1872
1895
|
),
|
|
1873
1896
|
k
|
|
1874
1897
|
] }, k)) })
|
|
1875
1898
|
] }),
|
|
1876
|
-
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LayerEffectsPanel, { controller, className: "border-t border-
|
|
1899
|
+
effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
|
|
1877
1900
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
|
|
1878
1901
|
const { layer } = row;
|
|
1879
1902
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
@@ -1912,7 +1935,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1912
1935
|
type: "button",
|
|
1913
1936
|
"aria-label": layer.visible ? `Hide ${row.label}` : `Show ${row.label}`,
|
|
1914
1937
|
"aria-pressed": layer.visible,
|
|
1915
|
-
className: "w-4 text-center text-
|
|
1938
|
+
className: "w-4 text-center text-foreground",
|
|
1916
1939
|
onClick: (e) => {
|
|
1917
1940
|
e.stopPropagation();
|
|
1918
1941
|
attempt(() => controller.setLayerProperties(layer.id, { visible: !layer.visible }));
|
|
@@ -1925,7 +1948,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1925
1948
|
{
|
|
1926
1949
|
type: "button",
|
|
1927
1950
|
"aria-label": layer.collapsed ? `Expand ${row.label}` : `Collapse ${row.label}`,
|
|
1928
|
-
className: "w-3 text-
|
|
1951
|
+
className: "w-3 text-muted-foreground",
|
|
1929
1952
|
onClick: (e) => {
|
|
1930
1953
|
e.stopPropagation();
|
|
1931
1954
|
attempt(() => controller.setLayerProperties(layer.id, { collapsed: !layer.collapsed }));
|
|
@@ -1933,7 +1956,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1933
1956
|
children: layer.collapsed ? "\u25B8" : "\u25BE"
|
|
1934
1957
|
}
|
|
1935
1958
|
),
|
|
1936
|
-
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-
|
|
1959
|
+
row.clipped && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
|
|
1937
1960
|
(0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "relative shrink-0", children: [
|
|
1938
1961
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1939
1962
|
Thumbnail,
|
|
@@ -1948,14 +1971,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1948
1971
|
"span",
|
|
1949
1972
|
{
|
|
1950
1973
|
"data-testid": "layer-kind-badge",
|
|
1951
|
-
className: "absolute -bottom-1 -right-1 rounded bg-
|
|
1974
|
+
className: "absolute -bottom-1 -right-1 rounded bg-accent px-0.5 text-[8px] font-bold leading-tight text-foreground ring-1 ring-background",
|
|
1952
1975
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
1953
1976
|
}
|
|
1954
1977
|
)
|
|
1955
1978
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1956
1979
|
"span",
|
|
1957
1980
|
{
|
|
1958
|
-
className: "shrink-0 grid place-items-center rounded bg-
|
|
1981
|
+
className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
|
|
1959
1982
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
1960
1983
|
children: (0, import_image_editor8.layerBadge)(layer)
|
|
1961
1984
|
}
|
|
@@ -1968,7 +1991,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1968
1991
|
"aria-pressed": layer.mask.linked !== false,
|
|
1969
1992
|
title: layer.mask.linked === false ? "Mask unlinked: it stays put when the layer moves or transforms. Click to link." : "Mask linked: it moves with the layer. Click to unlink.",
|
|
1970
1993
|
"data-testid": "layer-mask-link",
|
|
1971
|
-
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-
|
|
1994
|
+
className: `shrink-0 text-[10px] leading-none ${layer.mask.linked === false ? "text-muted-foreground/70" : "text-foreground"}`,
|
|
1972
1995
|
onClick: (e) => {
|
|
1973
1996
|
e.stopPropagation();
|
|
1974
1997
|
attempt(() => controller.setLayerMaskProps(layer.id, { linked: layer.mask.linked === false }));
|
|
@@ -1997,7 +2020,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
1997
2020
|
autoFocus: true,
|
|
1998
2021
|
"aria-label": "Layer name",
|
|
1999
2022
|
defaultValue: layer.name || row.label,
|
|
2000
|
-
className: "flex-1 min-w-0 bg-
|
|
2023
|
+
className: "flex-1 min-w-0 bg-background border border-border rounded px-1",
|
|
2001
2024
|
onClick: (e) => e.stopPropagation(),
|
|
2002
2025
|
onBlur: (e) => {
|
|
2003
2026
|
setRenaming(null);
|
|
@@ -2011,7 +2034,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2011
2034
|
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2012
2035
|
"span",
|
|
2013
2036
|
{
|
|
2014
|
-
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-
|
|
2037
|
+
className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
|
|
2015
2038
|
onDoubleClick: (e) => {
|
|
2016
2039
|
e.stopPropagation();
|
|
2017
2040
|
setRenaming(layer.id);
|
|
@@ -2019,7 +2042,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2019
2042
|
children: row.label
|
|
2020
2043
|
}
|
|
2021
2044
|
),
|
|
2022
|
-
(0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-
|
|
2045
|
+
(0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
|
|
2023
2046
|
(0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2024
2047
|
"button",
|
|
2025
2048
|
{
|
|
@@ -2027,7 +2050,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2027
2050
|
"data-testid": "layer-fx-badge",
|
|
2028
2051
|
"aria-label": (0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? `Turn effects off for ${row.label}` : `Turn effects on for ${row.label}`,
|
|
2029
2052
|
"aria-pressed": (0, import_image_editor8.layerEffectsBadge)(layer) === "on",
|
|
2030
|
-
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-
|
|
2053
|
+
className: `text-[9px] italic font-semibold ${(0, import_image_editor8.layerEffectsBadge)(layer) === "on" ? "text-primary" : "text-muted-foreground/70 line-through"}`,
|
|
2031
2054
|
onClick: (e) => {
|
|
2032
2055
|
e.stopPropagation();
|
|
2033
2056
|
attempt(() => controller.setLayerEffectsEnabled(layer.id, (0, import_image_editor8.layerEffectsBadge)(layer) !== "on"));
|
|
@@ -2035,20 +2058,20 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2035
2058
|
children: "fx"
|
|
2036
2059
|
}
|
|
2037
2060
|
),
|
|
2038
|
-
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-label": "Locked", className: "text-
|
|
2039
|
-
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[9px] text-
|
|
2061
|
+
locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
|
|
2062
|
+
layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
|
|
2040
2063
|
]
|
|
2041
2064
|
},
|
|
2042
2065
|
layer.id
|
|
2043
2066
|
);
|
|
2044
2067
|
}) }),
|
|
2045
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-
|
|
2068
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
2046
2069
|
menu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2047
2070
|
"div",
|
|
2048
2071
|
{
|
|
2049
2072
|
role: "menu",
|
|
2050
2073
|
"aria-label": "Layer menu",
|
|
2051
|
-
className: "fixed z-50 min-w-44 rounded border border-
|
|
2074
|
+
className: "fixed z-50 min-w-44 rounded border border-border bg-background py-1 shadow-xl",
|
|
2052
2075
|
style: { left: menu.x, top: menu.y },
|
|
2053
2076
|
onClick: (e) => e.stopPropagation(),
|
|
2054
2077
|
onKeyDown: (e) => e.key === "Escape" && setMenu(null),
|
|
@@ -2058,7 +2081,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2058
2081
|
type: "button",
|
|
2059
2082
|
role: "menuitem",
|
|
2060
2083
|
disabled: !item.enabled,
|
|
2061
|
-
className: "block w-full px-3 py-1 text-left hover:bg-
|
|
2084
|
+
className: "block w-full px-3 py-1 text-left hover:bg-muted disabled:opacity-40",
|
|
2062
2085
|
onClick: () => run(item.action),
|
|
2063
2086
|
children: item.label
|
|
2064
2087
|
},
|
|
@@ -3695,21 +3718,22 @@ function EffectParameters({
|
|
|
3695
3718
|
|
|
3696
3719
|
// src/image-editor/ImageEffectControls.tsx
|
|
3697
3720
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3698
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }) {
|
|
3721
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
3699
3722
|
const { description, error } = useEffectDescription(provider, effect);
|
|
3700
|
-
|
|
3723
|
+
let body;
|
|
3724
|
+
if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
3701
3725
|
'No effects provider: "',
|
|
3702
3726
|
name ?? effect,
|
|
3703
3727
|
'" is kept but not drawn.'
|
|
3704
3728
|
] });
|
|
3705
|
-
if (error)
|
|
3706
|
-
if (!description)
|
|
3707
|
-
|
|
3729
|
+
else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
|
|
3730
|
+
else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
3731
|
+
else body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
|
|
3732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
3708
3733
|
}
|
|
3709
3734
|
|
|
3710
3735
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
3711
3736
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3712
|
-
var btn = "rounded border border-slate-700 px-1.5 py-0.5 text-[11px] text-slate-300 hover:text-white disabled:opacity-40";
|
|
3713
3737
|
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
3714
3738
|
const [, setTick] = (0, import_react19.useState)(0);
|
|
3715
3739
|
(0, import_react19.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -3739,17 +3763,17 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3739
3763
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
3740
3764
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
3741
3765
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3742
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-
|
|
3743
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className:
|
|
3744
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className:
|
|
3766
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
3745
3769
|
] }),
|
|
3746
|
-
!provider && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-
|
|
3770
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
3747
3771
|
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
3748
3772
|
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
3749
3773
|
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
3750
3774
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3751
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-medium text-
|
|
3752
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className:
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
3776
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
3753
3777
|
] }),
|
|
3754
3778
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3755
3779
|
ImageEffectControls,
|
|
@@ -3768,20 +3792,20 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3768
3792
|
const all = layer.smartFilters.filters;
|
|
3769
3793
|
const index = all.indexOf(f);
|
|
3770
3794
|
if (f.kind !== "effect") return null;
|
|
3771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-
|
|
3795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
3772
3796
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3773
3797
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
|
|
3774
3798
|
const enabled = e.currentTarget.checked;
|
|
3775
3799
|
run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
|
|
3776
3800
|
} }),
|
|
3777
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-
|
|
3778
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className:
|
|
3779
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className:
|
|
3780
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className:
|
|
3801
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
|
|
3803
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
3804
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
3781
3805
|
] }),
|
|
3782
3806
|
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
3783
3807
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3784
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-[11px] text-
|
|
3808
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
3785
3809
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3786
3810
|
"input",
|
|
3787
3811
|
{
|
|
@@ -3813,8 +3837,8 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3813
3837
|
] })
|
|
3814
3838
|
] }, f.id);
|
|
3815
3839
|
}) }),
|
|
3816
|
-
!layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-
|
|
3817
|
-
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-[11px] text-
|
|
3840
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
3841
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
3818
3842
|
] });
|
|
3819
3843
|
}
|
|
3820
3844
|
|
|
@@ -3829,7 +3853,7 @@ var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
|
3829
3853
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
3830
3854
|
var import_react20 = require("react");
|
|
3831
3855
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3832
|
-
var
|
|
3856
|
+
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
3833
3857
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
3834
3858
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
3835
3859
|
var pct = (v) => Math.round(v * 1e3) / 10;
|
|
@@ -3865,7 +3889,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3865
3889
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
3866
3890
|
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: i, children: p.name }, p.name))
|
|
3867
3891
|
] }),
|
|
3868
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className:
|
|
3892
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
3869
3893
|
] }),
|
|
3870
3894
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3871
3895
|
"div",
|
|
@@ -3923,7 +3947,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3923
3947
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
|
|
3924
3948
|
"%"
|
|
3925
3949
|
] }),
|
|
3926
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className:
|
|
3950
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
|
|
3927
3951
|
] }),
|
|
3928
3952
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
3929
3953
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
|
|
@@ -3954,7 +3978,6 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.js
|
|
|
3954
3978
|
|
|
3955
3979
|
// src/image-editor/BrushOptionsBar.tsx
|
|
3956
3980
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3957
|
-
var chip = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
3958
3981
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
3959
3982
|
const [, setTick] = (0, import_react21.useState)(0);
|
|
3960
3983
|
(0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -3970,14 +3993,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
3970
3993
|
setError(err instanceof Error ? err.message : String(err));
|
|
3971
3994
|
}
|
|
3972
3995
|
};
|
|
3973
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
3996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
3974
3997
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3975
3998
|
"button",
|
|
3976
3999
|
{
|
|
3977
4000
|
type: "button",
|
|
3978
4001
|
"aria-pressed": state.activeTool === t.id,
|
|
3979
4002
|
title: t.shortcut ? `${t.label} (${t.shortcut})` : t.label,
|
|
3980
|
-
className:
|
|
4003
|
+
className: imageChipClass(state.activeTool === t.id),
|
|
3981
4004
|
onClick: () => controller.setTool(t.id),
|
|
3982
4005
|
children: t.label
|
|
3983
4006
|
},
|
|
@@ -3992,10 +4015,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
3992
4015
|
"aria-label": "Foreground colour",
|
|
3993
4016
|
value: foreground,
|
|
3994
4017
|
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
3995
|
-
className:
|
|
4018
|
+
className: imageColorInputClass
|
|
3996
4019
|
}
|
|
3997
4020
|
),
|
|
3998
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-
|
|
4021
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
3999
4022
|
] }),
|
|
4000
4023
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4001
4024
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -4005,20 +4028,20 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4005
4028
|
"aria-label": "Background colour",
|
|
4006
4029
|
value: background,
|
|
4007
4030
|
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
4008
|
-
className:
|
|
4031
|
+
className: imageColorInputClass
|
|
4009
4032
|
}
|
|
4010
4033
|
),
|
|
4011
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
4012
4035
|
] }),
|
|
4013
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Swap colours (X)", className:
|
|
4014
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Default colours (D)", className:
|
|
4036
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
4037
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
4015
4038
|
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4016
4039
|
"button",
|
|
4017
4040
|
{
|
|
4018
4041
|
type: "button",
|
|
4019
4042
|
"aria-pressed": paint.type === "gradient",
|
|
4020
4043
|
title: "Gradient paint: the brush changes colour as the stroke goes",
|
|
4021
|
-
className:
|
|
4044
|
+
className: imageChipClass(paint.type === "gradient"),
|
|
4022
4045
|
onClick: () => attempt(() => controller.setPaintOptions(paint.type === "gradient" ? { foreground } : { paint: import_image_editor12.DEFAULT_PAINT_GRADIENT })),
|
|
4023
4046
|
children: "Gradient"
|
|
4024
4047
|
}
|
|
@@ -4034,19 +4057,19 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4034
4057
|
},
|
|
4035
4058
|
spec.id
|
|
4036
4059
|
)),
|
|
4037
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
4060
|
+
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
4038
4061
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4039
4062
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4040
4063
|
"span",
|
|
4041
4064
|
{
|
|
4042
4065
|
"aria-label": "Brush load",
|
|
4043
4066
|
title: mixerLoad.reservoir ? `Loaded ${(0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir)}, ${Math.round(mixerLoad.amount * 100)}% left` : "Unloaded",
|
|
4044
|
-
className: "h-6 w-6 rounded border border-
|
|
4067
|
+
className: "h-6 w-6 rounded border border-border",
|
|
4045
4068
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
4046
4069
|
}
|
|
4047
4070
|
),
|
|
4048
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className:
|
|
4049
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Empty the picked-up colour", className:
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
4072
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
4050
4073
|
] }),
|
|
4051
4074
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4052
4075
|
"button",
|
|
@@ -4054,14 +4077,14 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4054
4077
|
type: "button",
|
|
4055
4078
|
"aria-pressed": mixer.mixing === m.id,
|
|
4056
4079
|
title: m.title,
|
|
4057
|
-
className:
|
|
4080
|
+
className: imageChipClass(mixer.mixing === m.id),
|
|
4058
4081
|
onClick: () => controller.setPaintOptions({ mixer: { mixing: m.id } }),
|
|
4059
4082
|
children: m.label
|
|
4060
4083
|
},
|
|
4061
4084
|
m.id
|
|
4062
4085
|
)) }),
|
|
4063
4086
|
import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
4064
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-
|
|
4087
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
4065
4088
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4066
4089
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4067
4090
|
"input",
|
|
@@ -4070,7 +4093,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4070
4093
|
"aria-label": "Load the brush after each stroke",
|
|
4071
4094
|
checked: mixer.loadEachStroke,
|
|
4072
4095
|
onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
|
|
4073
|
-
className: "accent-
|
|
4096
|
+
className: "accent-primary"
|
|
4074
4097
|
}
|
|
4075
4098
|
),
|
|
4076
4099
|
"Load each stroke"
|
|
@@ -4083,35 +4106,35 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4083
4106
|
"aria-label": "Clean the brush after each stroke",
|
|
4084
4107
|
checked: mixer.cleanEachStroke,
|
|
4085
4108
|
onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
|
|
4086
|
-
className: "accent-
|
|
4109
|
+
className: "accent-primary"
|
|
4087
4110
|
}
|
|
4088
4111
|
),
|
|
4089
4112
|
"Clean each stroke"
|
|
4090
4113
|
] })
|
|
4091
4114
|
] })
|
|
4092
4115
|
] }),
|
|
4093
|
-
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-
|
|
4116
|
+
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
4094
4117
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4095
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-
|
|
4096
|
-
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Forget the source point", className:
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
|
|
4119
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
4097
4120
|
] }),
|
|
4098
4121
|
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
4099
4122
|
import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
4100
4123
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4101
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className:
|
|
4102
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className:
|
|
4103
|
-
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className:
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
4126
|
+
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
4104
4127
|
] })
|
|
4105
4128
|
] }),
|
|
4106
4129
|
import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
4107
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
4108
4131
|
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4109
4132
|
"button",
|
|
4110
4133
|
{
|
|
4111
4134
|
type: "button",
|
|
4112
4135
|
"aria-pressed": retouch[choice.id] === o.id,
|
|
4113
4136
|
title: o.title,
|
|
4114
|
-
className:
|
|
4137
|
+
className: imageChipClass(retouch[choice.id] === o.id),
|
|
4115
4138
|
onClick: () => (0, import_image_editor11.setRetouchChoice)(controller, choice.id, o.id),
|
|
4116
4139
|
children: o.label
|
|
4117
4140
|
},
|
|
@@ -4119,7 +4142,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4119
4142
|
))
|
|
4120
4143
|
] }, choice.id)),
|
|
4121
4144
|
import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
4122
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-3 text-
|
|
4145
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4123
4146
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4124
4147
|
"input",
|
|
4125
4148
|
{
|
|
@@ -4127,13 +4150,13 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4127
4150
|
"aria-label": t.label,
|
|
4128
4151
|
checked: retouch[t.id],
|
|
4129
4152
|
onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
|
|
4130
|
-
className: "accent-
|
|
4153
|
+
className: "accent-primary"
|
|
4131
4154
|
}
|
|
4132
4155
|
),
|
|
4133
4156
|
t.label
|
|
4134
4157
|
] }, t.id)) })
|
|
4135
4158
|
] }),
|
|
4136
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-
|
|
4159
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
4137
4160
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4138
4161
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4139
4162
|
"input",
|
|
@@ -4142,7 +4165,7 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4142
4165
|
"aria-label": "Pressure controls size",
|
|
4143
4166
|
checked: brush.pressureSize,
|
|
4144
4167
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
|
|
4145
|
-
className: "accent-
|
|
4168
|
+
className: "accent-primary"
|
|
4146
4169
|
}
|
|
4147
4170
|
),
|
|
4148
4171
|
"Pressure size"
|
|
@@ -4155,17 +4178,17 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4155
4178
|
"aria-label": "Pressure controls opacity",
|
|
4156
4179
|
checked: brush.pressureOpacity,
|
|
4157
4180
|
onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
|
|
4158
|
-
className: "accent-
|
|
4181
|
+
className: "accent-primary"
|
|
4159
4182
|
}
|
|
4160
4183
|
),
|
|
4161
4184
|
"Pressure opacity"
|
|
4162
4185
|
] })
|
|
4163
4186
|
] }),
|
|
4164
4187
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
|
|
4165
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className:
|
|
4166
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className:
|
|
4188
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
4189
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
4167
4190
|
] }),
|
|
4168
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-
|
|
4191
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4169
4192
|
] });
|
|
4170
4193
|
};
|
|
4171
4194
|
|
|
@@ -4173,8 +4196,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4173
4196
|
var import_react22 = require("react");
|
|
4174
4197
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
4175
4198
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4176
|
-
var
|
|
4177
|
-
var select2 = "rounded bg-
|
|
4199
|
+
var chip = imageChipClass(false);
|
|
4200
|
+
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
4178
4201
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
4179
4202
|
const [, setTick] = (0, import_react22.useState)(0);
|
|
4180
4203
|
(0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -4203,28 +4226,28 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4203
4226
|
})
|
|
4204
4227
|
);
|
|
4205
4228
|
};
|
|
4206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
4229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
4207
4230
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4208
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-
|
|
4231
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
4209
4232
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
4210
4233
|
] }),
|
|
4211
4234
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
4212
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-
|
|
4235
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
4213
4236
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4214
|
-
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-
|
|
4237
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
4215
4238
|
] }),
|
|
4216
4239
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
4217
4240
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4218
4241
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4219
4242
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4220
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-
|
|
4243
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
4221
4244
|
"BPC"
|
|
4222
4245
|
] }),
|
|
4223
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className:
|
|
4224
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className:
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
4247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
4225
4248
|
] }),
|
|
4226
4249
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
4227
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
4228
4251
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4229
4252
|
"select",
|
|
4230
4253
|
{
|
|
@@ -4241,16 +4264,16 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4241
4264
|
view.proof && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
4242
4265
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4243
4266
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4244
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-
|
|
4267
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
4245
4268
|
"Paper"
|
|
4246
4269
|
] }),
|
|
4247
4270
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4248
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-
|
|
4271
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
4249
4272
|
"Gamut warning"
|
|
4250
4273
|
] })
|
|
4251
4274
|
] })
|
|
4252
4275
|
] }),
|
|
4253
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-
|
|
4276
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4254
4277
|
] });
|
|
4255
4278
|
};
|
|
4256
4279
|
|
|
@@ -4265,7 +4288,7 @@ var MODIFY_OPS = [
|
|
|
4265
4288
|
{ op: "border", label: "Border" },
|
|
4266
4289
|
{ op: "smooth", label: "Smooth" }
|
|
4267
4290
|
];
|
|
4268
|
-
var
|
|
4291
|
+
var btn = (on) => `px-2 py-1 rounded-md border text-[11px] transition-colors ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
4269
4292
|
var SelectionOptionsBar = ({
|
|
4270
4293
|
controller,
|
|
4271
4294
|
options,
|
|
@@ -4279,11 +4302,11 @@ var SelectionOptionsBar = ({
|
|
|
4279
4302
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4280
4303
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
4281
4304
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4282
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className:
|
|
4283
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className:
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
4306
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
4284
4307
|
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4285
4308
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4286
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex justify-between text-
|
|
4309
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4287
4310
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Tolerance" }),
|
|
4288
4311
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
4289
4312
|
] }),
|
|
@@ -4297,19 +4320,19 @@ var SelectionOptionsBar = ({
|
|
|
4297
4320
|
"aria-label": "Tolerance",
|
|
4298
4321
|
value: options.tolerance,
|
|
4299
4322
|
onChange: (e) => set({ tolerance: Number(e.target.value) }),
|
|
4300
|
-
className:
|
|
4323
|
+
className: imageRangeClass
|
|
4301
4324
|
}
|
|
4302
4325
|
)
|
|
4303
4326
|
] }),
|
|
4304
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4327
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4305
4328
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
|
|
4306
4329
|
"Contiguous"
|
|
4307
4330
|
] }),
|
|
4308
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4309
4332
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
|
|
4310
4333
|
"Sample adjusted image"
|
|
4311
4334
|
] }),
|
|
4312
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4313
4336
|
"Sample",
|
|
4314
4337
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4315
4338
|
"select",
|
|
@@ -4317,7 +4340,7 @@ var SelectionOptionsBar = ({
|
|
|
4317
4340
|
"aria-label": "Sample from",
|
|
4318
4341
|
value: options.sample ?? "composite",
|
|
4319
4342
|
onChange: (e) => set({ sample: e.target.value }),
|
|
4320
|
-
className: "bg-
|
|
4343
|
+
className: "bg-muted border border-border rounded px-1 py-0.5",
|
|
4321
4344
|
children: [
|
|
4322
4345
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "composite", children: "All layers" }),
|
|
4323
4346
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "active-layer", children: "Active layer" })
|
|
@@ -4326,18 +4349,18 @@ var SelectionOptionsBar = ({
|
|
|
4326
4349
|
)
|
|
4327
4350
|
] })
|
|
4328
4351
|
] }),
|
|
4329
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4352
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4330
4353
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
|
|
4331
4354
|
"Anti-alias"
|
|
4332
4355
|
] }),
|
|
4333
4356
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4334
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className:
|
|
4335
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className:
|
|
4336
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className:
|
|
4337
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": qm, className:
|
|
4357
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
4358
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
4360
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
4338
4361
|
] }),
|
|
4339
4362
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4340
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4341
4364
|
"Radius",
|
|
4342
4365
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4343
4366
|
"input",
|
|
@@ -4349,13 +4372,13 @@ var SelectionOptionsBar = ({
|
|
|
4349
4372
|
"aria-label": "Modify radius",
|
|
4350
4373
|
value: radius,
|
|
4351
4374
|
onChange: (e) => setRadius(Math.max(0, Number(e.target.value) || 0)),
|
|
4352
|
-
className: "w-14 bg-
|
|
4375
|
+
className: "w-14 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
4353
4376
|
}
|
|
4354
4377
|
)
|
|
4355
4378
|
] }),
|
|
4356
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className:
|
|
4379
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
4357
4380
|
] }),
|
|
4358
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { "data-testid": "selection-status", className: "text-
|
|
4381
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
4359
4382
|
] });
|
|
4360
4383
|
};
|
|
4361
4384
|
|
|
@@ -4364,7 +4387,7 @@ var import_react24 = require("react");
|
|
|
4364
4387
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
4365
4388
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4366
4389
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
4367
|
-
var
|
|
4390
|
+
var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4368
4391
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
4369
4392
|
const [params, setParams] = (0, import_react24.useState)(DEFAULT_PARAMS);
|
|
4370
4393
|
const [busy, setBusy] = (0, import_react24.useState)(false);
|
|
@@ -4386,9 +4409,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4386
4409
|
}
|
|
4387
4410
|
};
|
|
4388
4411
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4389
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className:
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
4390
4413
|
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4391
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-
|
|
4414
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4392
4415
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: c.label }),
|
|
4393
4416
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4394
4417
|
params[c.id],
|
|
@@ -4405,20 +4428,20 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4405
4428
|
"aria-label": c.label,
|
|
4406
4429
|
value: params[c.id],
|
|
4407
4430
|
onChange: (e) => setParams({ ...params, [c.id]: Number(e.target.value) }),
|
|
4408
|
-
className:
|
|
4431
|
+
className: imageRangeClass
|
|
4409
4432
|
}
|
|
4410
4433
|
)
|
|
4411
4434
|
] }, c.id)),
|
|
4412
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4413
4436
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
4414
4437
|
"Smart Radius"
|
|
4415
4438
|
] }),
|
|
4416
4439
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
|
|
4417
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className:
|
|
4418
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className:
|
|
4440
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
4441
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
4419
4442
|
] }),
|
|
4420
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-
|
|
4421
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-
|
|
4443
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
4444
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
4422
4445
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
4423
4446
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4424
4447
|
"select",
|
|
@@ -4426,7 +4449,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4426
4449
|
"aria-label": "New masked layer kind",
|
|
4427
4450
|
value: newKind,
|
|
4428
4451
|
onChange: (e) => setNewKind(e.target.value),
|
|
4429
|
-
className: "flex-1 bg-
|
|
4452
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4430
4453
|
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
4431
4454
|
}
|
|
4432
4455
|
),
|
|
@@ -4434,7 +4457,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4434
4457
|
"button",
|
|
4435
4458
|
{
|
|
4436
4459
|
type: "button",
|
|
4437
|
-
className:
|
|
4460
|
+
className: button2,
|
|
4438
4461
|
disabled: !sel,
|
|
4439
4462
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor15.layerMaskFromSelection)(sel) })),
|
|
4440
4463
|
children: "New Masked Layer"
|
|
@@ -4448,7 +4471,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4448
4471
|
"aria-label": "Mask layer",
|
|
4449
4472
|
value: target.id,
|
|
4450
4473
|
onChange: (e) => setLayerId(e.target.value),
|
|
4451
|
-
className: "bg-
|
|
4474
|
+
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4452
4475
|
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: l.id, children: [
|
|
4453
4476
|
l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
|
|
4454
4477
|
l.mask ? " (masked)" : ""
|
|
@@ -4456,13 +4479,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4456
4479
|
}
|
|
4457
4480
|
),
|
|
4458
4481
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4459
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className:
|
|
4460
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className:
|
|
4461
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className:
|
|
4482
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4483
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4484
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
4462
4485
|
] }),
|
|
4463
4486
|
target.mask && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4464
4487
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4465
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4466
4489
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Density" }),
|
|
4467
4490
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4468
4491
|
Math.round((target.mask.density ?? 1) * 100),
|
|
@@ -4479,12 +4502,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4479
4502
|
"aria-label": "Mask density",
|
|
4480
4503
|
value: Math.round((target.mask.density ?? 1) * 100),
|
|
4481
4504
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { density: Number(e.target.value) / 100 }),
|
|
4482
|
-
className:
|
|
4505
|
+
className: imageRangeClass
|
|
4483
4506
|
}
|
|
4484
4507
|
)
|
|
4485
4508
|
] }),
|
|
4486
4509
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4487
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4488
4511
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Mask Feather" }),
|
|
4489
4512
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
|
|
4490
4513
|
target.mask.feather ?? 0,
|
|
@@ -4501,7 +4524,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4501
4524
|
"aria-label": "Mask feather",
|
|
4502
4525
|
value: target.mask.feather ?? 0,
|
|
4503
4526
|
onChange: (e) => controller.setAdjustmentLayerMaskProps(target.id, { feather: Number(e.target.value) }),
|
|
4504
|
-
className:
|
|
4527
|
+
className: imageRangeClass
|
|
4505
4528
|
}
|
|
4506
4529
|
)
|
|
4507
4530
|
] })
|
|
@@ -4514,7 +4537,6 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4514
4537
|
var import_react25 = require("react");
|
|
4515
4538
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4516
4539
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4517
|
-
var chip3 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
4518
4540
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4519
4541
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4520
4542
|
const [, setTick] = (0, import_react25.useState)(0);
|
|
@@ -4530,16 +4552,16 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4530
4552
|
const v = Number(raw);
|
|
4531
4553
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4532
4554
|
};
|
|
4533
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-
|
|
4534
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className:
|
|
4535
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-
|
|
4555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.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: [
|
|
4556
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.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)) }),
|
|
4557
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime24.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)) }),
|
|
4536
4558
|
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4537
4559
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4538
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4539
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className:
|
|
4560
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
4540
4562
|
] }),
|
|
4541
4563
|
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4542
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4564
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4543
4565
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4544
4566
|
"input",
|
|
4545
4567
|
{
|
|
@@ -4549,7 +4571,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4549
4571
|
min: -100,
|
|
4550
4572
|
max: 100,
|
|
4551
4573
|
disabled: warp.style === "custom",
|
|
4552
|
-
className: "w-14 rounded border border-
|
|
4574
|
+
className: "w-14 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
4553
4575
|
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
4554
4576
|
onKeyDown: (e) => {
|
|
4555
4577
|
if (e.key === "Enter") {
|
|
@@ -4561,7 +4583,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4561
4583
|
},
|
|
4562
4584
|
`${k}:${warp[k]}`
|
|
4563
4585
|
),
|
|
4564
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
4565
4587
|
] }, k)),
|
|
4566
4588
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4567
4589
|
"button",
|
|
@@ -4570,13 +4592,13 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4570
4592
|
title: "Bend along the vertical axis",
|
|
4571
4593
|
"aria-pressed": warp.orientation === "vertical",
|
|
4572
4594
|
disabled: warp.style === "custom",
|
|
4573
|
-
className:
|
|
4595
|
+
className: imageChipClass(warp.orientation === "vertical"),
|
|
4574
4596
|
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
4575
4597
|
children: "Vertical"
|
|
4576
4598
|
}
|
|
4577
4599
|
),
|
|
4578
4600
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4579
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4580
4602
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4581
4603
|
"select",
|
|
4582
4604
|
{
|
|
@@ -4586,14 +4608,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4586
4608
|
const g = import_image_editor16.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
4587
4609
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4588
4610
|
},
|
|
4589
|
-
className:
|
|
4611
|
+
className: imageFieldClass,
|
|
4590
4612
|
children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
4591
4613
|
}
|
|
4592
4614
|
)
|
|
4593
4615
|
] })
|
|
4594
4616
|
] }),
|
|
4595
4617
|
tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4596
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
4597
4619
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4598
4620
|
"input",
|
|
4599
4621
|
{
|
|
@@ -4602,7 +4624,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4602
4624
|
defaultValue: round(bar[f.id], f.unit),
|
|
4603
4625
|
disabled: !bar.affine,
|
|
4604
4626
|
step: f.unit === "px" ? 1 : 0.1,
|
|
4605
|
-
className: "w-16 rounded border border-
|
|
4627
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5 text-right disabled:opacity-40",
|
|
4606
4628
|
onBlur: (e) => apply(f.id, e.currentTarget.value),
|
|
4607
4629
|
onKeyDown: (e) => {
|
|
4608
4630
|
if (e.key === "Enter") {
|
|
@@ -4614,14 +4636,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4614
4636
|
},
|
|
4615
4637
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4616
4638
|
),
|
|
4617
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4639
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4618
4640
|
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4619
4641
|
"button",
|
|
4620
4642
|
{
|
|
4621
4643
|
type: "button",
|
|
4622
4644
|
"aria-label": "Keep width and height proportional",
|
|
4623
4645
|
"aria-pressed": tool.proportional,
|
|
4624
|
-
className:
|
|
4646
|
+
className: imageChipClass(tool.proportional),
|
|
4625
4647
|
onClick: () => {
|
|
4626
4648
|
tool.proportional = !tool.proportional;
|
|
4627
4649
|
setTick((n) => n + 1);
|
|
@@ -4631,21 +4653,21 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4631
4653
|
)
|
|
4632
4654
|
] }, f.id)),
|
|
4633
4655
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4634
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4635
4657
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4636
4658
|
"select",
|
|
4637
4659
|
{
|
|
4638
4660
|
"aria-label": "Interpolation",
|
|
4639
4661
|
value: tool.interpolation,
|
|
4640
4662
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4641
|
-
className:
|
|
4663
|
+
className: imageFieldClass,
|
|
4642
4664
|
children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4643
4665
|
}
|
|
4644
4666
|
)
|
|
4645
4667
|
] }),
|
|
4646
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-
|
|
4647
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: "Cancel (Esc)", className:
|
|
4648
|
-
tool.error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { role: "alert", className: "text-
|
|
4668
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.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" }),
|
|
4669
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4670
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4649
4671
|
] });
|
|
4650
4672
|
};
|
|
4651
4673
|
|
|
@@ -4653,7 +4675,6 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4653
4675
|
var import_react26 = require("react");
|
|
4654
4676
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
4655
4677
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4656
|
-
var chip4 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
4657
4678
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4658
4679
|
const [, setTick] = (0, import_react26.useState)(0);
|
|
4659
4680
|
(0, import_react26.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
@@ -4671,8 +4692,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4671
4692
|
}
|
|
4672
4693
|
};
|
|
4673
4694
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4674
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
4675
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className:
|
|
4695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4676
4697
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4677
4698
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4678
4699
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
|
|
@@ -4685,7 +4706,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4685
4706
|
disabled: options.fill === null,
|
|
4686
4707
|
value: options.fill ?? "#4f46e5",
|
|
4687
4708
|
onChange: (e) => set({ fill: e.target.value }),
|
|
4688
|
-
className:
|
|
4709
|
+
className: imageColorInputClass
|
|
4689
4710
|
}
|
|
4690
4711
|
)
|
|
4691
4712
|
] }),
|
|
@@ -4700,7 +4721,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4700
4721
|
disabled: options.stroke === null,
|
|
4701
4722
|
value: options.stroke ?? "#000000",
|
|
4702
4723
|
onChange: (e) => set({ stroke: e.target.value }),
|
|
4703
|
-
className:
|
|
4724
|
+
className: imageColorInputClass
|
|
4704
4725
|
}
|
|
4705
4726
|
)
|
|
4706
4727
|
] }),
|
|
@@ -4715,7 +4736,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4715
4736
|
max: 200,
|
|
4716
4737
|
value: options.strokeWidth,
|
|
4717
4738
|
onChange: (e) => set({ strokeWidth: num(e.target.value, 0, 200) }),
|
|
4718
|
-
className:
|
|
4739
|
+
className: `w-14 ${imageFieldClass}`
|
|
4719
4740
|
}
|
|
4720
4741
|
)
|
|
4721
4742
|
] })
|
|
@@ -4723,16 +4744,16 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4723
4744
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4724
4745
|
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4725
4746
|
"Radius",
|
|
4726
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.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:
|
|
4747
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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}` })
|
|
4727
4748
|
] }),
|
|
4728
4749
|
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4729
4750
|
"Sides",
|
|
4730
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.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:
|
|
4751
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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}` })
|
|
4731
4752
|
] }),
|
|
4732
4753
|
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4733
4754
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4734
4755
|
"Points",
|
|
4735
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.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:
|
|
4756
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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}` })
|
|
4736
4757
|
] }),
|
|
4737
4758
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4738
4759
|
"Inner",
|
|
@@ -4746,7 +4767,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4746
4767
|
step: 0.05,
|
|
4747
4768
|
value: options.innerRatio,
|
|
4748
4769
|
onChange: (e) => set({ innerRatio: Number(e.target.value) }),
|
|
4749
|
-
className: "accent-
|
|
4770
|
+
className: "accent-primary"
|
|
4750
4771
|
}
|
|
4751
4772
|
)
|
|
4752
4773
|
] })
|
|
@@ -4754,7 +4775,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4754
4775
|
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4755
4776
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4756
4777
|
"Weight",
|
|
4757
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.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:
|
|
4778
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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}` })
|
|
4758
4779
|
] }),
|
|
4759
4780
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4760
4781
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
|
|
@@ -4762,8 +4783,8 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4762
4783
|
] })
|
|
4763
4784
|
] })
|
|
4764
4785
|
] }),
|
|
4765
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[10px] text-
|
|
4766
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-
|
|
4786
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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." }),
|
|
4787
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4767
4788
|
] });
|
|
4768
4789
|
};
|
|
4769
4790
|
|
|
@@ -4771,7 +4792,6 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4771
4792
|
var import_react27 = require("react");
|
|
4772
4793
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
4773
4794
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4774
|
-
var chip5 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
4775
4795
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4776
4796
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4777
4797
|
const [, setTick] = (0, import_react27.useState)(0);
|
|
@@ -4809,7 +4829,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4809
4829
|
setError(e instanceof Error ? e.message : String(e));
|
|
4810
4830
|
}
|
|
4811
4831
|
};
|
|
4812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-
|
|
4832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4813
4833
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4814
4834
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4815
4835
|
"Font",
|
|
@@ -4820,7 +4840,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4820
4840
|
"aria-label": "Font family",
|
|
4821
4841
|
value: shown.fontFamily,
|
|
4822
4842
|
onChange: (e) => e.target.value.trim() && style({ fontFamily: e.target.value }),
|
|
4823
|
-
className: "w-32 rounded border border-
|
|
4843
|
+
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4824
4844
|
}
|
|
4825
4845
|
),
|
|
4826
4846
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: f }, f)) })
|
|
@@ -4836,23 +4856,23 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4836
4856
|
max: 2e3,
|
|
4837
4857
|
value: Math.round(shown.fontSize * 10) / 10,
|
|
4838
4858
|
onChange: (e) => Number(e.target.value) > 0 && style({ fontSize: Number(e.target.value) }),
|
|
4839
|
-
className: "w-16 rounded border border-
|
|
4859
|
+
className: "w-16 rounded border border-border bg-background px-1 py-0.5"
|
|
4840
4860
|
}
|
|
4841
4861
|
)
|
|
4842
4862
|
] }),
|
|
4843
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${
|
|
4844
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${
|
|
4845
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className:
|
|
4863
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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" }),
|
|
4864
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4865
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
4846
4866
|
] }),
|
|
4847
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.align === a, className:
|
|
4848
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[10px] text-
|
|
4849
|
-
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { role: "status", className: "text-amber-
|
|
4867
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4868
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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." }),
|
|
4869
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4850
4870
|
"Missing ",
|
|
4851
4871
|
missing.length === 1 ? "font" : "fonts",
|
|
4852
4872
|
": ",
|
|
4853
4873
|
missing.join(", ")
|
|
4854
4874
|
] }),
|
|
4855
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-
|
|
4875
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4856
4876
|
] });
|
|
4857
4877
|
};
|
|
4858
4878
|
|
|
@@ -5024,11 +5044,11 @@ var ImageEditor = ({
|
|
|
5024
5044
|
"div",
|
|
5025
5045
|
{
|
|
5026
5046
|
ref: rootRef,
|
|
5027
|
-
className:
|
|
5047
|
+
className: `${imageEditorFrameClass} ${className}`,
|
|
5028
5048
|
style,
|
|
5029
5049
|
children: [
|
|
5030
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className:
|
|
5031
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", {
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5032
5052
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5033
5053
|
"button",
|
|
5034
5054
|
{
|
|
@@ -5038,7 +5058,9 @@ var ImageEditor = ({
|
|
|
5038
5058
|
setActiveTab("crop");
|
|
5039
5059
|
editor.setTool("crop");
|
|
5040
5060
|
},
|
|
5041
|
-
|
|
5061
|
+
role: "tab",
|
|
5062
|
+
"aria-selected": activeTab === "crop",
|
|
5063
|
+
className: `${imageTabClass(activeTab === "crop")}`,
|
|
5042
5064
|
children: "Transform & Crop"
|
|
5043
5065
|
}
|
|
5044
5066
|
),
|
|
@@ -5051,7 +5073,9 @@ var ImageEditor = ({
|
|
|
5051
5073
|
setActiveTab("adjust");
|
|
5052
5074
|
editor.setTool("select");
|
|
5053
5075
|
},
|
|
5054
|
-
|
|
5076
|
+
role: "tab",
|
|
5077
|
+
"aria-selected": activeTab === "adjust",
|
|
5078
|
+
className: `${imageTabClass(activeTab === "adjust")}`,
|
|
5055
5079
|
children: "Adjustments"
|
|
5056
5080
|
}
|
|
5057
5081
|
),
|
|
@@ -5064,7 +5088,9 @@ var ImageEditor = ({
|
|
|
5064
5088
|
setActiveTab("layers");
|
|
5065
5089
|
editor.setTool("select");
|
|
5066
5090
|
},
|
|
5067
|
-
|
|
5091
|
+
role: "tab",
|
|
5092
|
+
"aria-selected": activeTab === "layers",
|
|
5093
|
+
className: `${imageTabClass(activeTab === "layers")}`,
|
|
5068
5094
|
children: "Layers"
|
|
5069
5095
|
}
|
|
5070
5096
|
),
|
|
@@ -5077,7 +5103,9 @@ var ImageEditor = ({
|
|
|
5077
5103
|
setActiveTab("paint");
|
|
5078
5104
|
editor.setTool("brush");
|
|
5079
5105
|
},
|
|
5080
|
-
|
|
5106
|
+
role: "tab",
|
|
5107
|
+
"aria-selected": activeTab === "paint",
|
|
5108
|
+
className: `${imageTabClass(activeTab === "paint")}`,
|
|
5081
5109
|
children: "Paint"
|
|
5082
5110
|
}
|
|
5083
5111
|
),
|
|
@@ -5090,7 +5118,9 @@ var ImageEditor = ({
|
|
|
5090
5118
|
setActiveTab("select");
|
|
5091
5119
|
editor.setTool("select");
|
|
5092
5120
|
},
|
|
5093
|
-
|
|
5121
|
+
role: "tab",
|
|
5122
|
+
"aria-selected": activeTab === "select",
|
|
5123
|
+
className: `${imageTabClass(activeTab === "select")}`,
|
|
5094
5124
|
children: "Select & Mask"
|
|
5095
5125
|
}
|
|
5096
5126
|
),
|
|
@@ -5103,7 +5133,9 @@ var ImageEditor = ({
|
|
|
5103
5133
|
setActiveTab("annotate");
|
|
5104
5134
|
editor.setTool("pen");
|
|
5105
5135
|
},
|
|
5106
|
-
|
|
5136
|
+
role: "tab",
|
|
5137
|
+
"aria-selected": activeTab === "annotate",
|
|
5138
|
+
className: `${imageTabClass(activeTab === "annotate")}`,
|
|
5107
5139
|
children: "Annotations"
|
|
5108
5140
|
}
|
|
5109
5141
|
),
|
|
@@ -5116,7 +5148,9 @@ var ImageEditor = ({
|
|
|
5116
5148
|
setActiveTab("depth");
|
|
5117
5149
|
editor.setTool("select");
|
|
5118
5150
|
},
|
|
5119
|
-
|
|
5151
|
+
role: "tab",
|
|
5152
|
+
"aria-selected": activeTab === "depth",
|
|
5153
|
+
className: `${imageTabClass(activeTab === "depth")}`,
|
|
5120
5154
|
children: "Depth Mask"
|
|
5121
5155
|
}
|
|
5122
5156
|
),
|
|
@@ -5129,7 +5163,9 @@ var ImageEditor = ({
|
|
|
5129
5163
|
setActiveTab("ai");
|
|
5130
5164
|
editor.setTool("select");
|
|
5131
5165
|
},
|
|
5132
|
-
|
|
5166
|
+
role: "tab",
|
|
5167
|
+
"aria-selected": activeTab === "ai",
|
|
5168
|
+
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5133
5169
|
children: [
|
|
5134
5170
|
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.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" }) }),
|
|
5135
5171
|
"AI Tools"
|
|
@@ -5144,7 +5180,7 @@ var ImageEditor = ({
|
|
|
5144
5180
|
type: "button",
|
|
5145
5181
|
disabled: !editor.canUndo,
|
|
5146
5182
|
onClick: () => editor.undo(),
|
|
5147
|
-
className:
|
|
5183
|
+
className: imageHeaderButtonClass,
|
|
5148
5184
|
title: "Undo",
|
|
5149
5185
|
children: "\u21A9"
|
|
5150
5186
|
}
|
|
@@ -5155,7 +5191,7 @@ var ImageEditor = ({
|
|
|
5155
5191
|
type: "button",
|
|
5156
5192
|
disabled: !editor.canRedo,
|
|
5157
5193
|
onClick: () => editor.redo(),
|
|
5158
|
-
className:
|
|
5194
|
+
className: imageHeaderButtonClass,
|
|
5159
5195
|
title: "Redo",
|
|
5160
5196
|
children: "\u21AA"
|
|
5161
5197
|
}
|
|
@@ -5165,22 +5201,22 @@ var ImageEditor = ({
|
|
|
5165
5201
|
{
|
|
5166
5202
|
type: "button",
|
|
5167
5203
|
onClick: () => editor.reset(),
|
|
5168
|
-
className:
|
|
5204
|
+
className: `${imageHeaderButtonClass} px-2 text-muted-foreground`,
|
|
5169
5205
|
children: "Reset"
|
|
5170
5206
|
}
|
|
5171
5207
|
),
|
|
5172
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5173
5209
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5174
5210
|
"button",
|
|
5175
5211
|
{
|
|
5176
5212
|
type: "button",
|
|
5177
5213
|
onClick: () => editor.zoomOut(),
|
|
5178
|
-
className:
|
|
5214
|
+
className: imageHeaderButtonClass,
|
|
5179
5215
|
title: "Zoom Out",
|
|
5180
5216
|
children: "-"
|
|
5181
5217
|
}
|
|
5182
5218
|
),
|
|
5183
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono text-
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5184
5220
|
Math.round(state.zoom * 100),
|
|
5185
5221
|
"%"
|
|
5186
5222
|
] }),
|
|
@@ -5189,12 +5225,12 @@ var ImageEditor = ({
|
|
|
5189
5225
|
{
|
|
5190
5226
|
type: "button",
|
|
5191
5227
|
onClick: () => editor.zoomIn(),
|
|
5192
|
-
className:
|
|
5228
|
+
className: imageHeaderButtonClass,
|
|
5193
5229
|
title: "Zoom In",
|
|
5194
5230
|
children: "+"
|
|
5195
5231
|
}
|
|
5196
5232
|
),
|
|
5197
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5198
5234
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5199
5235
|
"button",
|
|
5200
5236
|
{
|
|
@@ -5202,7 +5238,7 @@ var ImageEditor = ({
|
|
|
5202
5238
|
onMouseDown: () => editor.setComparing(true),
|
|
5203
5239
|
onMouseUp: () => editor.setComparing(false),
|
|
5204
5240
|
onMouseLeave: () => editor.setComparing(false),
|
|
5205
|
-
className: "px-2.5 py-1.5 rounded-lg border border-
|
|
5241
|
+
className: "px-2.5 py-1.5 rounded-lg border border-border bg-background text-amber-600 hover:bg-muted select-none active:bg-amber-500/10",
|
|
5206
5242
|
children: "Hold Compare"
|
|
5207
5243
|
}
|
|
5208
5244
|
),
|
|
@@ -5211,14 +5247,14 @@ var ImageEditor = ({
|
|
|
5211
5247
|
{
|
|
5212
5248
|
type: "button",
|
|
5213
5249
|
onClick: handleExport,
|
|
5214
|
-
className:
|
|
5250
|
+
className: `${imagePrimaryButtonClass} px-4 py-1.5`,
|
|
5215
5251
|
children: "Export Image"
|
|
5216
5252
|
}
|
|
5217
5253
|
)
|
|
5218
5254
|
] })
|
|
5219
5255
|
] }),
|
|
5220
|
-
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-
|
|
5221
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "alert", className:
|
|
5256
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5257
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5222
5258
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5223
5259
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5224
5260
|
ImageEditorCanvas,
|
|
@@ -5241,12 +5277,12 @@ var ImageEditor = ({
|
|
|
5241
5277
|
onPlaybackReveal,
|
|
5242
5278
|
chromeRoot: rootRef,
|
|
5243
5279
|
open: openPanel,
|
|
5244
|
-
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-
|
|
5280
|
+
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5245
5281
|
}
|
|
5246
5282
|
),
|
|
5247
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className:
|
|
5283
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: imageSidebarClass, children: [
|
|
5248
5284
|
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5249
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5250
5286
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5251
5287
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5252
5288
|
"button",
|
|
@@ -5256,7 +5292,7 @@ var ImageEditor = ({
|
|
|
5256
5292
|
setActiveCropRatio(null);
|
|
5257
5293
|
editor.applyCropPreset(null);
|
|
5258
5294
|
},
|
|
5259
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-
|
|
5295
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === null && state.crop ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
5260
5296
|
children: "Freeform"
|
|
5261
5297
|
}
|
|
5262
5298
|
),
|
|
@@ -5268,7 +5304,7 @@ var ImageEditor = ({
|
|
|
5268
5304
|
setActiveCropRatio(1);
|
|
5269
5305
|
editor.applyCropPreset(1);
|
|
5270
5306
|
},
|
|
5271
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-
|
|
5307
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 1 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
5272
5308
|
children: "1:1 Square"
|
|
5273
5309
|
}
|
|
5274
5310
|
),
|
|
@@ -5280,7 +5316,7 @@ var ImageEditor = ({
|
|
|
5280
5316
|
setActiveCropRatio(4 / 3);
|
|
5281
5317
|
editor.applyCropPreset(4 / 3);
|
|
5282
5318
|
},
|
|
5283
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-
|
|
5319
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 4 / 3 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
5284
5320
|
children: "4:3 Standard"
|
|
5285
5321
|
}
|
|
5286
5322
|
),
|
|
@@ -5292,7 +5328,7 @@ var ImageEditor = ({
|
|
|
5292
5328
|
setActiveCropRatio(16 / 9);
|
|
5293
5329
|
editor.applyCropPreset(16 / 9);
|
|
5294
5330
|
},
|
|
5295
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-
|
|
5331
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 16 / 9 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
5296
5332
|
children: "16:9 Wide"
|
|
5297
5333
|
}
|
|
5298
5334
|
),
|
|
@@ -5304,7 +5340,7 @@ var ImageEditor = ({
|
|
|
5304
5340
|
setActiveCropRatio(3 / 2);
|
|
5305
5341
|
editor.applyCropPreset(3 / 2);
|
|
5306
5342
|
},
|
|
5307
|
-
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-
|
|
5343
|
+
className: `px-2.5 py-2 rounded-lg border font-medium ${activeCropRatio === 3 / 2 ? "bg-primary border-primary text-primary-foreground" : "bg-muted hover:bg-accent text-foreground border-border"}`,
|
|
5308
5344
|
children: "3:2 Photo"
|
|
5309
5345
|
}
|
|
5310
5346
|
),
|
|
@@ -5316,20 +5352,20 @@ var ImageEditor = ({
|
|
|
5316
5352
|
setActiveCropRatio(null);
|
|
5317
5353
|
editor.resetCrop();
|
|
5318
5354
|
},
|
|
5319
|
-
className: "px-2.5 py-2 rounded-lg bg-
|
|
5355
|
+
className: "px-2.5 py-2 rounded-lg bg-destructive/10 hover:bg-destructive/20 text-destructive border border-destructive/40 font-medium",
|
|
5320
5356
|
children: "Clear Crop"
|
|
5321
5357
|
}
|
|
5322
5358
|
)
|
|
5323
5359
|
] }),
|
|
5324
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5325
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5326
5362
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5327
5363
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5328
5364
|
"button",
|
|
5329
5365
|
{
|
|
5330
5366
|
type: "button",
|
|
5331
5367
|
onClick: () => editor.rotate(-90),
|
|
5332
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
5368
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
5333
5369
|
children: "Rotate -90\xB0"
|
|
5334
5370
|
}
|
|
5335
5371
|
),
|
|
@@ -5338,7 +5374,7 @@ var ImageEditor = ({
|
|
|
5338
5374
|
{
|
|
5339
5375
|
type: "button",
|
|
5340
5376
|
onClick: () => editor.rotate(90),
|
|
5341
|
-
className: "px-3 py-2 rounded-lg bg-
|
|
5377
|
+
className: "px-3 py-2 rounded-lg bg-muted hover:bg-accent text-foreground border border-border",
|
|
5342
5378
|
children: "Rotate +90\xB0"
|
|
5343
5379
|
}
|
|
5344
5380
|
),
|
|
@@ -5347,7 +5383,7 @@ var ImageEditor = ({
|
|
|
5347
5383
|
{
|
|
5348
5384
|
type: "button",
|
|
5349
5385
|
onClick: () => editor.flipHorizontal(),
|
|
5350
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-
|
|
5386
|
+
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipH ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
5351
5387
|
children: "Flip Horizontal"
|
|
5352
5388
|
}
|
|
5353
5389
|
),
|
|
@@ -5356,7 +5392,7 @@ var ImageEditor = ({
|
|
|
5356
5392
|
{
|
|
5357
5393
|
type: "button",
|
|
5358
5394
|
onClick: () => editor.flipVertical(),
|
|
5359
|
-
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-
|
|
5395
|
+
className: `px-3 py-2 rounded-lg border transition-colors ${state.transform.flipV ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
5360
5396
|
children: "Flip Vertical"
|
|
5361
5397
|
}
|
|
5362
5398
|
)
|
|
@@ -5364,13 +5400,13 @@ var ImageEditor = ({
|
|
|
5364
5400
|
] }),
|
|
5365
5401
|
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5366
5402
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5367
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5403
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5368
5404
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5369
5405
|
"button",
|
|
5370
5406
|
{
|
|
5371
5407
|
type: "button",
|
|
5372
5408
|
onClick: () => editor.resetAdjustments(),
|
|
5373
|
-
className: "text-[10px] text-
|
|
5409
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
5374
5410
|
children: "Reset Sliders"
|
|
5375
5411
|
}
|
|
5376
5412
|
)
|
|
@@ -5389,7 +5425,7 @@ var ImageEditor = ({
|
|
|
5389
5425
|
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5390
5426
|
"div",
|
|
5391
5427
|
{
|
|
5392
|
-
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-
|
|
5428
|
+
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",
|
|
5393
5429
|
"data-testid": "image-editor-process-notice",
|
|
5394
5430
|
children: [
|
|
5395
5431
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
@@ -5406,7 +5442,7 @@ var ImageEditor = ({
|
|
|
5406
5442
|
}
|
|
5407
5443
|
)
|
|
5408
5444
|
] }, spec.id)),
|
|
5409
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5445
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5410
5446
|
AdjustmentLayersPanel,
|
|
5411
5447
|
{
|
|
5412
5448
|
controller,
|
|
@@ -5416,82 +5452,82 @@ var ImageEditor = ({
|
|
|
5416
5452
|
) })
|
|
5417
5453
|
] }),
|
|
5418
5454
|
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5419
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5455
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5420
5456
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5421
5457
|
"button",
|
|
5422
5458
|
{
|
|
5423
5459
|
type: "button",
|
|
5424
5460
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
5425
|
-
className:
|
|
5461
|
+
className: imageSmallButtonClass,
|
|
5426
5462
|
disabled: transformTool.active,
|
|
5427
5463
|
onClick: () => transformTool.begin(),
|
|
5428
5464
|
children: "Free Transform"
|
|
5429
5465
|
}
|
|
5430
5466
|
),
|
|
5431
5467
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayersPanel, { controller }),
|
|
5432
|
-
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageProviderEffectsPanel, { controller, className:
|
|
5433
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5468
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5469
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5434
5470
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ColorProfilePanel, { controller })
|
|
5435
5471
|
] }),
|
|
5436
5472
|
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5437
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5438
5474
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BrushOptionsBar, { controller }),
|
|
5439
5475
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5440
5476
|
"button",
|
|
5441
5477
|
{
|
|
5442
5478
|
type: "button",
|
|
5443
5479
|
title: "Edit \u203A Free Transform (Ctrl/Cmd+T): the selected pixels, or the whole active layer",
|
|
5444
|
-
className: "px-2 py-1 rounded text-[11px] bg-
|
|
5480
|
+
className: "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start",
|
|
5445
5481
|
disabled: transformTool.active,
|
|
5446
5482
|
onClick: () => transformTool.begin(),
|
|
5447
5483
|
children: "Free Transform"
|
|
5448
5484
|
}
|
|
5449
5485
|
),
|
|
5450
|
-
paintError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-
|
|
5451
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5486
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5487
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayersPanel, { controller }) })
|
|
5452
5488
|
] }),
|
|
5453
5489
|
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5454
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
5455
5491
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5456
5492
|
"button",
|
|
5457
5493
|
{
|
|
5458
5494
|
type: "button",
|
|
5459
5495
|
"aria-pressed": state.activeTool === t,
|
|
5460
5496
|
onClick: () => editor.setTool(t),
|
|
5461
|
-
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-
|
|
5497
|
+
className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
5462
5498
|
children: t === "shape" ? "Shape" : "Type"
|
|
5463
5499
|
},
|
|
5464
5500
|
t
|
|
5465
5501
|
)) }),
|
|
5466
5502
|
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5467
5503
|
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5468
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-
|
|
5469
|
-
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-
|
|
5470
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5471
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5504
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime27.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" }),
|
|
5505
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5506
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5507
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5472
5508
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5473
5509
|
"button",
|
|
5474
5510
|
{
|
|
5475
5511
|
type: "button",
|
|
5476
5512
|
onClick: () => editor.setTool(t),
|
|
5477
|
-
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-
|
|
5513
|
+
className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
|
|
5478
5514
|
children: t
|
|
5479
5515
|
},
|
|
5480
5516
|
t
|
|
5481
5517
|
)) }),
|
|
5482
5518
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5483
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-
|
|
5519
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5484
5520
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5485
5521
|
"input",
|
|
5486
5522
|
{
|
|
5487
5523
|
type: "color",
|
|
5488
5524
|
value: activeColor,
|
|
5489
5525
|
onChange: (e) => setActiveColor(e.target.value),
|
|
5490
|
-
className: "w-8 h-8 rounded border border-
|
|
5526
|
+
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
5491
5527
|
}
|
|
5492
5528
|
),
|
|
5493
5529
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
5494
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5495
5531
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Width:" }),
|
|
5496
5532
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5497
5533
|
strokeWidth,
|
|
@@ -5506,13 +5542,13 @@ var ImageEditor = ({
|
|
|
5506
5542
|
max: "20",
|
|
5507
5543
|
value: strokeWidth,
|
|
5508
5544
|
onChange: (e) => setStrokeWidth(Number(e.target.value)),
|
|
5509
|
-
className:
|
|
5545
|
+
className: imageRangeClass
|
|
5510
5546
|
}
|
|
5511
5547
|
)
|
|
5512
5548
|
] })
|
|
5513
5549
|
] }),
|
|
5514
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5515
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5551
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5516
5552
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
|
|
5517
5553
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5518
5554
|
"input",
|
|
@@ -5522,7 +5558,7 @@ var ImageEditor = ({
|
|
|
5522
5558
|
value: textInput,
|
|
5523
5559
|
onChange: (e) => setTextInput(e.target.value),
|
|
5524
5560
|
onKeyDown: (e) => e.key === "Enter" && handleAddText(),
|
|
5525
|
-
className: "flex-1 bg-
|
|
5561
|
+
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"
|
|
5526
5562
|
}
|
|
5527
5563
|
),
|
|
5528
5564
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -5530,12 +5566,12 @@ var ImageEditor = ({
|
|
|
5530
5566
|
{
|
|
5531
5567
|
type: "button",
|
|
5532
5568
|
onClick: handleAddText,
|
|
5533
|
-
className: "px-3 py-1.5 rounded-lg bg-
|
|
5569
|
+
className: "px-3 py-1.5 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow",
|
|
5534
5570
|
children: "Add"
|
|
5535
5571
|
}
|
|
5536
5572
|
)
|
|
5537
5573
|
] }),
|
|
5538
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between text-
|
|
5574
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5539
5575
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Font Size:" }),
|
|
5540
5576
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
|
|
5541
5577
|
fontSize,
|
|
@@ -5550,12 +5586,12 @@ var ImageEditor = ({
|
|
|
5550
5586
|
max: "72",
|
|
5551
5587
|
value: fontSize,
|
|
5552
5588
|
onChange: (e) => setFontSize(Number(e.target.value)),
|
|
5553
|
-
className:
|
|
5589
|
+
className: imageRangeClass
|
|
5554
5590
|
}
|
|
5555
5591
|
),
|
|
5556
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
|
|
5557
5593
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5558
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-
|
|
5594
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5559
5595
|
"Layers (",
|
|
5560
5596
|
state.annotations.length,
|
|
5561
5597
|
")"
|
|
@@ -5565,7 +5601,7 @@ var ImageEditor = ({
|
|
|
5565
5601
|
{
|
|
5566
5602
|
type: "button",
|
|
5567
5603
|
onClick: () => editor.removeAnnotation(state.selectedAnnotationId),
|
|
5568
|
-
className: "text-
|
|
5604
|
+
className: "text-destructive hover:underline text-[11px]",
|
|
5569
5605
|
children: "Delete Selected"
|
|
5570
5606
|
}
|
|
5571
5607
|
),
|
|
@@ -5574,7 +5610,7 @@ var ImageEditor = ({
|
|
|
5574
5610
|
{
|
|
5575
5611
|
type: "button",
|
|
5576
5612
|
onClick: () => editor.clearAnnotations(),
|
|
5577
|
-
className: "text-
|
|
5613
|
+
className: "text-muted-foreground hover:text-foreground text-[11px]",
|
|
5578
5614
|
children: "Clear All"
|
|
5579
5615
|
}
|
|
5580
5616
|
)
|
|
@@ -5582,32 +5618,32 @@ var ImageEditor = ({
|
|
|
5582
5618
|
] }),
|
|
5583
5619
|
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5584
5620
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5585
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className:
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5586
5622
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5587
5623
|
"button",
|
|
5588
5624
|
{
|
|
5589
5625
|
type: "button",
|
|
5590
5626
|
onClick: () => editor.resetDepthMask(),
|
|
5591
|
-
className: "text-[10px] text-
|
|
5627
|
+
className: "text-[10px] text-destructive hover:underline",
|
|
5592
5628
|
children: "Reset Mask"
|
|
5593
5629
|
}
|
|
5594
5630
|
)
|
|
5595
5631
|
] }),
|
|
5596
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5597
5633
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5598
5634
|
"input",
|
|
5599
5635
|
{
|
|
5600
5636
|
type: "checkbox",
|
|
5601
5637
|
checked: state.depthMask.enabled,
|
|
5602
5638
|
onChange: (e) => editor.setDepthMask({ enabled: e.target.checked }),
|
|
5603
|
-
className: "rounded accent-
|
|
5639
|
+
className: "rounded accent-primary"
|
|
5604
5640
|
}
|
|
5605
5641
|
),
|
|
5606
5642
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
5607
5643
|
] }),
|
|
5608
5644
|
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5609
5645
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5610
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-
|
|
5646
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5611
5647
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5612
5648
|
"input",
|
|
5613
5649
|
{
|
|
@@ -5615,7 +5651,7 @@ var ImageEditor = ({
|
|
|
5615
5651
|
placeholder: "https://.../depthmap.png",
|
|
5616
5652
|
value: state.depthMask.maskSource || "",
|
|
5617
5653
|
onChange: (e) => editor.setDepthMask({ maskSource: e.target.value || null }),
|
|
5618
|
-
className: "w-full bg-
|
|
5654
|
+
className: "w-full bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground"
|
|
5619
5655
|
}
|
|
5620
5656
|
)
|
|
5621
5657
|
] }),
|
|
@@ -5625,7 +5661,7 @@ var ImageEditor = ({
|
|
|
5625
5661
|
{
|
|
5626
5662
|
type: "button",
|
|
5627
5663
|
onClick: () => editor.setDepthMask({ mode: "threshold" }),
|
|
5628
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-
|
|
5664
|
+
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "threshold" ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground"}`,
|
|
5629
5665
|
children: "Threshold Mode"
|
|
5630
5666
|
}
|
|
5631
5667
|
),
|
|
@@ -5634,13 +5670,13 @@ var ImageEditor = ({
|
|
|
5634
5670
|
{
|
|
5635
5671
|
type: "button",
|
|
5636
5672
|
onClick: () => editor.setDepthMask({ mode: "brightness" }),
|
|
5637
|
-
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-
|
|
5673
|
+
className: `flex-1 py-1.5 rounded-lg border text-xs font-medium ${state.depthMask.mode === "brightness" ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground"}`,
|
|
5638
5674
|
children: "Brightness Mode"
|
|
5639
5675
|
}
|
|
5640
5676
|
)
|
|
5641
5677
|
] }),
|
|
5642
5678
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5643
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5644
5680
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
5645
5681
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5646
5682
|
] }),
|
|
@@ -5654,12 +5690,12 @@ var ImageEditor = ({
|
|
|
5654
5690
|
onChange: (e) => editor.setDepthMask({
|
|
5655
5691
|
depthRange: [Number(e.target.value), state.depthMask.depthRange[1]]
|
|
5656
5692
|
}),
|
|
5657
|
-
className:
|
|
5693
|
+
className: imageRangeClass
|
|
5658
5694
|
}
|
|
5659
5695
|
)
|
|
5660
5696
|
] }),
|
|
5661
5697
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5662
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5698
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5663
5699
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
5664
5700
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5665
5701
|
] }),
|
|
@@ -5673,12 +5709,12 @@ var ImageEditor = ({
|
|
|
5673
5709
|
onChange: (e) => editor.setDepthMask({
|
|
5674
5710
|
depthRange: [state.depthMask.depthRange[0], Number(e.target.value)]
|
|
5675
5711
|
}),
|
|
5676
|
-
className:
|
|
5712
|
+
className: imageRangeClass
|
|
5677
5713
|
}
|
|
5678
5714
|
)
|
|
5679
5715
|
] }),
|
|
5680
5716
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5681
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-
|
|
5717
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5682
5718
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Softness:" }),
|
|
5683
5719
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5684
5720
|
] }),
|
|
@@ -5690,18 +5726,18 @@ var ImageEditor = ({
|
|
|
5690
5726
|
max: "50",
|
|
5691
5727
|
value: state.depthMask.softness,
|
|
5692
5728
|
onChange: (e) => editor.setDepthMask({ softness: Number(e.target.value) }),
|
|
5693
|
-
className:
|
|
5729
|
+
className: imageRangeClass
|
|
5694
5730
|
}
|
|
5695
5731
|
)
|
|
5696
5732
|
] }),
|
|
5697
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5698
5734
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5699
5735
|
"input",
|
|
5700
5736
|
{
|
|
5701
5737
|
type: "checkbox",
|
|
5702
5738
|
checked: state.depthMask.invert,
|
|
5703
5739
|
onChange: (e) => editor.setDepthMask({ invert: e.target.checked }),
|
|
5704
|
-
className: "rounded accent-
|
|
5740
|
+
className: "rounded accent-primary"
|
|
5705
5741
|
}
|
|
5706
5742
|
),
|
|
5707
5743
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Invert Mask" })
|
|
@@ -5719,14 +5755,14 @@ var ImageEditor = ({
|
|
|
5719
5755
|
quickMask: Boolean(state.quickMask)
|
|
5720
5756
|
}
|
|
5721
5757
|
),
|
|
5722
|
-
selectionError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-
|
|
5758
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5723
5759
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
|
|
5724
5760
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5725
5761
|
"button",
|
|
5726
5762
|
{
|
|
5727
5763
|
type: "button",
|
|
5728
5764
|
title: "Select \u203A Transform Selection: the outline only",
|
|
5729
|
-
className:
|
|
5765
|
+
className: imageSmallButtonClass,
|
|
5730
5766
|
disabled: transformTool.active,
|
|
5731
5767
|
onClick: () => transformTool.begin({ content: "selection-outline" }),
|
|
5732
5768
|
children: "Transform Selection"
|
|
@@ -5737,7 +5773,7 @@ var ImageEditor = ({
|
|
|
5737
5773
|
{
|
|
5738
5774
|
type: "button",
|
|
5739
5775
|
title: "Edit \u203A Free Transform: the selected pixels of the active layer",
|
|
5740
|
-
className:
|
|
5776
|
+
className: imageSmallButtonClass,
|
|
5741
5777
|
disabled: transformTool.active,
|
|
5742
5778
|
onClick: () => transformTool.begin({ content: "selection" }),
|
|
5743
5779
|
children: "Free Transform Pixels"
|
|
@@ -5747,7 +5783,7 @@ var ImageEditor = ({
|
|
|
5747
5783
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
5748
5784
|
] }),
|
|
5749
5785
|
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5750
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center justify-between gap-2 text-
|
|
5786
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5751
5787
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Results go to" }),
|
|
5752
5788
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5753
5789
|
"select",
|
|
@@ -5755,7 +5791,7 @@ var ImageEditor = ({
|
|
|
5755
5791
|
"aria-label": "AI result target",
|
|
5756
5792
|
value: aiTarget,
|
|
5757
5793
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5758
|
-
className:
|
|
5794
|
+
className: imageSelectClass,
|
|
5759
5795
|
children: [
|
|
5760
5796
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5761
5797
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
@@ -5764,24 +5800,24 @@ var ImageEditor = ({
|
|
|
5764
5800
|
}
|
|
5765
5801
|
)
|
|
5766
5802
|
] }),
|
|
5767
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
5803
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5768
5804
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5769
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-
|
|
5770
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { className: "w-3.5 h-3.5 text-
|
|
5805
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.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" }) }),
|
|
5771
5807
|
"Background Removal"
|
|
5772
5808
|
] }),
|
|
5773
|
-
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
5809
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime27.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..." })
|
|
5774
5810
|
] }),
|
|
5775
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-
|
|
5811
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5776
5812
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5777
5813
|
"button",
|
|
5778
5814
|
{
|
|
5779
5815
|
type: "button",
|
|
5780
5816
|
onClick: handleRemoveBackground,
|
|
5781
5817
|
disabled: isRemovingBg || isInpainting,
|
|
5782
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
5818
|
+
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",
|
|
5783
5819
|
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5784
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSpinnerClass }),
|
|
5785
5821
|
"Removing Background..."
|
|
5786
5822
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5787
5823
|
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.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" }) }),
|
|
@@ -5790,20 +5826,20 @@ var ImageEditor = ({
|
|
|
5790
5826
|
}
|
|
5791
5827
|
)
|
|
5792
5828
|
] }),
|
|
5793
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-
|
|
5829
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5794
5830
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5795
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-
|
|
5796
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("svg", { className: "w-3.5 h-3.5 text-
|
|
5831
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5832
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5797
5833
|
/* @__PURE__ */ (0, import_jsx_runtime27.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" }),
|
|
5798
5834
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m14 7 3 3" })
|
|
5799
5835
|
] }),
|
|
5800
5836
|
"Generative Inpainting"
|
|
5801
5837
|
] }),
|
|
5802
|
-
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-
|
|
5838
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime27.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..." })
|
|
5803
5839
|
] }),
|
|
5804
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-
|
|
5840
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5805
5841
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5806
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-
|
|
5842
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5807
5843
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5808
5844
|
"textarea",
|
|
5809
5845
|
{
|
|
@@ -5812,19 +5848,19 @@ var ImageEditor = ({
|
|
|
5812
5848
|
onChange: (e) => setInpaintPrompt(e.target.value),
|
|
5813
5849
|
placeholder: "e.g. replace sunglasses with steampunk goggles, remove person in background...",
|
|
5814
5850
|
rows: 3,
|
|
5815
|
-
className: "w-full bg-
|
|
5851
|
+
className: "w-full bg-background border border-border rounded-lg p-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary resize-none"
|
|
5816
5852
|
}
|
|
5817
5853
|
)
|
|
5818
5854
|
] }),
|
|
5819
5855
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5820
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-
|
|
5856
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5821
5857
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5822
5858
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5823
5859
|
"button",
|
|
5824
5860
|
{
|
|
5825
5861
|
type: "button",
|
|
5826
5862
|
onClick: () => setInpaintMaskMode("annotations"),
|
|
5827
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-
|
|
5863
|
+
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "annotations" ? "bg-primary/30 border-primary text-primary" : "bg-background border-border text-muted-foreground hover:text-foreground"}`,
|
|
5828
5864
|
children: [
|
|
5829
5865
|
"Drawn Shapes (",
|
|
5830
5866
|
state.annotations.length,
|
|
@@ -5837,7 +5873,7 @@ var ImageEditor = ({
|
|
|
5837
5873
|
{
|
|
5838
5874
|
type: "button",
|
|
5839
5875
|
onClick: () => setInpaintMaskMode("crop"),
|
|
5840
|
-
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-
|
|
5876
|
+
className: `px-2 py-1.5 rounded border text-[11px] font-medium text-left transition-colors ${inpaintMaskMode === "crop" ? "bg-primary/30 border-primary text-primary" : "bg-background border-border text-muted-foreground hover:text-foreground"}`,
|
|
5841
5877
|
children: [
|
|
5842
5878
|
"Crop Box (",
|
|
5843
5879
|
state.crop ? "Selected" : "Full",
|
|
@@ -5853,9 +5889,9 @@ var ImageEditor = ({
|
|
|
5853
5889
|
type: "button",
|
|
5854
5890
|
onClick: handleInpaint,
|
|
5855
5891
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5856
|
-
className: "mt-1 px-3 py-2 rounded-lg bg-
|
|
5892
|
+
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",
|
|
5857
5893
|
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5858
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className:
|
|
5894
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSpinnerClass }),
|
|
5859
5895
|
"Generating Inpaint..."
|
|
5860
5896
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5861
5897
|
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.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" }) }),
|
|
@@ -5864,8 +5900,8 @@ var ImageEditor = ({
|
|
|
5864
5900
|
}
|
|
5865
5901
|
)
|
|
5866
5902
|
] }),
|
|
5867
|
-
aiError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-2.5 rounded-lg bg-
|
|
5868
|
-
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-
|
|
5903
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
5904
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5869
5905
|
] })
|
|
5870
5906
|
] })
|
|
5871
5907
|
] })
|